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