aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mdev.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-19 23:38:08 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-19 23:38:08 +0000
commit11c17f75a7f29da47eae35a2f41d274a99a95760 (patch)
treeadce05421005f905211808cd6d139b955268b2f4 /util-linux/mdev.c
parentdcd78c4d0ff71a36d5c88953a62f5df6a4f31a9c (diff)
downloadbusybox-w32-11c17f75a7f29da47eae35a2f41d274a99a95760.tar.gz
busybox-w32-11c17f75a7f29da47eae35a2f41d274a99a95760.tar.bz2
busybox-w32-11c17f75a7f29da47eae35a2f41d274a99a95760.zip
mdev: enlarge inline documentation
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r--util-linux/mdev.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index ea1edcc40..8fc8a3df4 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -15,6 +15,8 @@
15 * contains "4:0\n". Directory name is taken as device name, path component 15 * contains "4:0\n". Directory name is taken as device name, path component
16 * directly after /sys/class/ as subsystem. In this example, "tty0" and "tty". 16 * directly after /sys/class/ as subsystem. In this example, "tty0" and "tty".
17 * Then mdev creates the /dev/device_name node. 17 * Then mdev creates the /dev/device_name node.
18 * If /sys/class/.../dev file does not exist, mdev still may act
19 * on this device: see "@|$|*command args..." parameter in config file.
18 * 20 *
19 * mdev w/o parameters is called as hotplug helper. It takes device 21 * mdev w/o parameters is called as hotplug helper. It takes device
20 * and subsystem names from $DEVPATH and $SUBSYSTEM, extracts 22 * and subsystem names from $DEVPATH and $SUBSYSTEM, extracts
@@ -29,20 +31,34 @@
29 * 31 *
30 * [-][subsystem/]device user:grp mode [>|=path] [@|$|*command args...] 32 * [-][subsystem/]device user:grp mode [>|=path] [@|$|*command args...]
31 * [-]@maj,min[-min2] user:grp mode [>|=path] [@|$|*command args...] 33 * [-]@maj,min[-min2] user:grp mode [>|=path] [@|$|*command args...]
32 * 34 * [-]$envvar=val user:grp mode [>|=path] [@|$|*command args...]
33 * The device name or "subsystem/device" combo is matched against 1st field
34 * (which is a regex), or maj,min is matched against 1st field.
35 * 35 *
36 * Leading minus in 1st field means "don't stop on this line", otherwise 36 * Leading minus in 1st field means "don't stop on this line", otherwise
37 * search is stopped after the matching line is encountered. 37 * search is stopped after the matching line is encountered.
38 * 38 *
39 * When line matches, the device node is created, chmod'ed and chown'ed. 39 * The device name or "subsystem/device" combo is matched against 1st field
40 * Then it moved to path, and if >path, a symlink to moved node is created 40 * (which is a regex), or maj,min is matched against 1st field,
41 * or specified environment variable (as regex) is matched against 1st field.
42 *
43 * $envvar=val format is useful for loading modules for hot-plugged devices
44 * which do not have driver loaded yet. In this case /sys/class/.../dev
45 * does not exist, but $MODALIAS is set to needed module's name
46 * (actually, an alias to it) by kernel. This rule instructs mdev
47 * to load the module and exit:
48 * $MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"
49 * The kernel will generate another hotplug event when /sys/class/.../dev
50 * file appears.
51 *
52 * When line matches, the device node is created, chmod'ed and chown'ed,
53 * moved to path, and if >path, a symlink to moved node is created,
54 * all this if /sys/class/.../dev exists.
41 * Examples: 55 * Examples:
42 * =loop/ - moves to /dev/loop 56 * =loop/ - moves to /dev/loop
43 * >disk/sda%1 - moves to /dev/disk/sdaN, makes /dev/sdaN a symlink 57 * >disk/sda%1 - moves to /dev/disk/sdaN, makes /dev/sdaN a symlink
44 * Then "command args" is executed (via sh -c 'command args'). 58 *
59 * Then "command args..." is executed (via sh -c 'command args...').
45 * @:execute on creation, $:on deletion, *:on both. 60 * @:execute on creation, $:on deletion, *:on both.
61 * This happens regardless of /sys/class/.../dev existence.
46 */ 62 */
47 63
48struct globals { 64struct globals {