chiark / gitweb /
[PATCH] minor grammer fixes for the udev_vs_devfs document
[elogind.git] / docs / overview
1
2 We've got a couple goals for udev:
3
4 1) dynamic replacement for /dev
5 2) device naming
6 3) API to access info about current system devices
7
8 Splitting these goals into separate subsystems:
9
10 1) udev - dynamic replacement for /dev
11 2) namedev - device naming
12 3) libsysfs - a standard library for accessing device information on the
13               system.
14
15 Udev
16 ------
17
18 Udev will be responsible for responding to /sbin/hotplug on device
19 events.  It will receive the device class information along with
20 device's sysfs directory.  Udev will call the name_device function from
21 the naming device subsystem with that information and receive a unique
22 device name in return.  Udev will then query sysfs through the libsysfs
23 for specific device information required for creating the /dev node like
24 major and minor number.  Once it has the important information, udev
25 will create a /dev entry for the device, add the device to the in memory
26 table of current devices, and send notification of the successful event
27 through a D-BUS message.  On a remove call, udev will remove the /dev
28 entry, remove the device from the in memory table, and send
29 notification.
30
31 Udev will consist of a command udev - to be called from /sbin/hotplug.
32 It will require the in memory dynamic database/table for keeping track
33 of current system devices, and a library of routines for accessing that
34 database/table.  Udev will not care about "how" devices are named, that
35 will be separated into the device naming subsystem.  It's presented a
36 common device naming API by the device naming subsystem to use for
37 naming devices.
38
39
40
41 namedev
42 ----------
43
44 From comments people have made, the device naming part of udev has been
45 pushed into its own "subsystem".  The reason is to make this as flexible
46 and pluggable as possible.  The device naming subsystem, or namedev, will
47 present a standard interface for udev to call for naming a particular
48 device.  Under that interface, system administrators can plug in their
49 own methods for device naming.
50
51 We would provide a default naming scheme. The first prototype
52 implementation could simply take the sysfs directory passed in with the
53 device name function, query sysfs for the major and minor numbers, and
54 then look up in a static device name mapping file the name of the
55 device. The static device naming file could look just like devices.txt
56 in the Linux kernel's Documentation directory.  Obviously, this isn't a
57 great implementation because eventually we'd like major an minor numbers
58 to be dynamic.
59
60 The default naming scheme in the future would have a set of policies to
61 go through in order to determine the name of the device.  The device
62 naming subsystem would get the sysfs directory of the to be named device
63 and would use the following information in order to map the device's
64 name:
65
66 1) Label info - like SCSI's UUID
67 2) Bus Device Number
68 3) Topology on Bus
69 4) Kernel Name - DEFAULT
70
71 System administrators could use the default naming system or enterprise
72 computing environments could plug in their Universal Unique Identifier
73 (UUID) policies.  The idea is to make the device naming as flexible and
74 pluggable as possible.
75
76 The device naming subsystem would require accessing sysfs for device
77 information.  It will receive the device's sysfs directory in the call
78 from udev and use it to get more information to determine naming.  The
79 namedev subsystem will include a standard naming API for udev to use.
80 The default naming scheme will include a set of functions and a static
81 device naming file, which will reside in /etc or /var.
82
83
84
85 libsysfs
86 --------
87
88 There is a need for a common API to access device information in sysfs.
89 The device naming subsystem and the udev subsystem need to take the
90 sysfs directory path and query device information.  Instead of copying
91 code so each one will have to readdir, etc., splitting this logic of
92 sysfs calls into a separate library that will sit atop sysfs makes more
93 sense.  Sysfs callbacks aren't standard across devices, so this is
94 another reason for creating a common and standard library interface for
95 querying device information. 
96