aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-09-19 12:18:11 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-09-19 12:18:11 +0200
commit5c6ba6c56f9653488e1d805e727bb06c39ed23fa (patch)
treed87fd3c6ebf6c3ce37876a554ef0f46394196e6e
parent34c469ae0495bb010969eb920c63d31ed4a0e793 (diff)
downloadbusybox-w32-5c6ba6c56f9653488e1d805e727bb06c39ed23fa.tar.gz
busybox-w32-5c6ba6c56f9653488e1d805e727bb06c39ed23fa.tar.bz2
busybox-w32-5c6ba6c56f9653488e1d805e727bb06c39ed23fa.zip
mdev: expand --help so that it's actually useful.
function old new delta packed_usage 28634 28822 +188 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--docs/mdev.txt12
-rw-r--r--include/applets.src.h1
-rw-r--r--util-linux/Config.src58
-rw-r--r--util-linux/Kbuild.src1
-rw-r--r--util-linux/mdev.c88
5 files changed, 89 insertions, 71 deletions
diff --git a/docs/mdev.txt b/docs/mdev.txt
index 2d03bd8b2..61f93c9df 100644
--- a/docs/mdev.txt
+++ b/docs/mdev.txt
@@ -51,19 +51,25 @@ device nodes if your system needs something more than the default root/root
51660 permissions. 51660 permissions.
52 52
53The file has the format: 53The file has the format:
54 <device regex> <uid>:<gid> <permissions> 54 [-]<device regex> <uid>:<gid> <permissions>
55 or @<maj[,min1[-min2]]> <uid>:<gid> <permissions> 55or
56 @<maj[,min1[-min2]]> <uid>:<gid> <permissions>
57or
58 $envvar=<regex> <uid>:<gid> <permissions>
56 59
57For example: 60For example:
58 hd[a-z][0-9]* 0:3 660 61 hd[a-z][0-9]* 0:3 660
59 62
60The config file parsing stops at the first matching line. If no line is 63The config file parsing stops at the first matching line. If no line is
61matched, then the default of 0:0 660 is used. To set your own default, simply 64matched, then the default of 0:0 660 is used. To set your own default, simply
62create your own total match like so: 65create your own total match like so:
66
63 .* 1:1 777 67 .* 1:1 777
64 68
65You can rename/move device nodes by using the next optional field. 69You can rename/move device nodes by using the next optional field.
70
66 <device regex> <uid>:<gid> <permissions> [=path] 71 <device regex> <uid>:<gid> <permissions> [=path]
72
67So if you want to place the device node into a subdirectory, make sure the path 73So if you want to place the device node into a subdirectory, make sure the path
68has a trailing /. If you want to rename the device node, just place the name. 74has a trailing /. If you want to rename the device node, just place the name.
69 hda 0:3 660 =drives/ 75 hda 0:3 660 =drives/
diff --git a/include/applets.src.h b/include/applets.src.h
index a5866d83b..252a060fb 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -239,7 +239,6 @@ IF_MAKEMIME(APPLET(makemime, BB_DIR_BIN, BB_SUID_DROP))
239IF_MAN(APPLET(man, BB_DIR_SBIN, BB_SUID_DROP)) 239IF_MAN(APPLET(man, BB_DIR_SBIN, BB_SUID_DROP))
240IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP)) 240IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP))
241IF_MD5SUM(APPLET_NOEXEC(md5sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, md5sum)) 241IF_MD5SUM(APPLET_NOEXEC(md5sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, md5sum))
242IF_MDEV(APPLET(mdev, BB_DIR_SBIN, BB_SUID_DROP))
243IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, BB_SUID_DROP)) 242IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, BB_SUID_DROP))
244IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir)) 243IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir))
245IF_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat)) 244IF_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))
diff --git a/util-linux/Config.src b/util-linux/Config.src
index bb45705a9..888bc8f3b 100644
--- a/util-linux/Config.src
+++ b/util-linux/Config.src
@@ -404,64 +404,6 @@ config LSUSB
404 404
405 This version uses sysfs (/sys/bus/usb/devices) only. 405 This version uses sysfs (/sys/bus/usb/devices) only.
406 406
407config MDEV
408 bool "mdev"
409 default y
410 select PLATFORM_LINUX
411 help
412 mdev is a mini-udev implementation for dynamically creating device
413 nodes in the /dev directory.
414
415 For more information, please see docs/mdev.txt
416
417config FEATURE_MDEV_CONF
418 bool "Support /etc/mdev.conf"
419 default y
420 depends on MDEV
421 help
422 Add support for the mdev config file to control ownership and
423 permissions of the device nodes.
424
425 For more information, please see docs/mdev.txt
426
427config FEATURE_MDEV_RENAME
428 bool "Support subdirs/symlinks"
429 default y
430 depends on FEATURE_MDEV_CONF
431 help
432 Add support for renaming devices and creating symlinks.
433
434 For more information, please see docs/mdev.txt
435
436config FEATURE_MDEV_RENAME_REGEXP
437 bool "Support regular expressions substitutions when renaming device"
438 default y
439 depends on FEATURE_MDEV_RENAME
440 help
441 Add support for regular expressions substitutions when renaming
442 device.
443
444config FEATURE_MDEV_EXEC
445 bool "Support command execution at device addition/removal"
446 default y
447 depends on FEATURE_MDEV_CONF
448 help
449 This adds support for an optional field to /etc/mdev.conf for
450 executing commands when devices are created/removed.
451
452 For more information, please see docs/mdev.txt
453
454config FEATURE_MDEV_LOAD_FIRMWARE
455 bool "Support loading of firmwares"
456 default y
457 depends on MDEV
458 help
459 Some devices need to load firmware before they can be usable.
460
461 These devices will request userspace look up the files in
462 /lib/firmware/ and if it exists, send it to the kernel for
463 loading into the hardware.
464
465config MKSWAP 407config MKSWAP
466 bool "mkswap" 408 bool "mkswap"
467 default y 409 default y
diff --git a/util-linux/Kbuild.src b/util-linux/Kbuild.src
index c06d911ec..468fc6bc1 100644
--- a/util-linux/Kbuild.src
+++ b/util-linux/Kbuild.src
@@ -26,7 +26,6 @@ lib-$(CONFIG_IPCS) += ipcs.o
26lib-$(CONFIG_LOSETUP) += losetup.o 26lib-$(CONFIG_LOSETUP) += losetup.o
27lib-$(CONFIG_LSPCI) += lspci.o 27lib-$(CONFIG_LSPCI) += lspci.o
28lib-$(CONFIG_LSUSB) += lsusb.o 28lib-$(CONFIG_LSUSB) += lsusb.o
29lib-$(CONFIG_MDEV) += mdev.o
30lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o 29lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o
31lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o 30lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o
32lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o 31lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 7cabb1df6..27b35572d 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -8,19 +8,91 @@
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11//config:config MDEV
12//config: bool "mdev"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: mdev is a mini-udev implementation for dynamically creating device
17//config: nodes in the /dev directory.
18//config:
19//config: For more information, please see docs/mdev.txt
20//config:
21//config:config FEATURE_MDEV_CONF
22//config: bool "Support /etc/mdev.conf"
23//config: default y
24//config: depends on MDEV
25//config: help
26//config: Add support for the mdev config file to control ownership and
27//config: permissions of the device nodes.
28//config:
29//config: For more information, please see docs/mdev.txt
30//config:
31//config:config FEATURE_MDEV_RENAME
32//config: bool "Support subdirs/symlinks"
33//config: default y
34//config: depends on FEATURE_MDEV_CONF
35//config: help
36//config: Add support for renaming devices and creating symlinks.
37//config:
38//config: For more information, please see docs/mdev.txt
39//config:
40//config:config FEATURE_MDEV_RENAME_REGEXP
41//config: bool "Support regular expressions substitutions when renaming device"
42//config: default y
43//config: depends on FEATURE_MDEV_RENAME
44//config: help
45//config: Add support for regular expressions substitutions when renaming
46//config: device.
47//config:
48//config:config FEATURE_MDEV_EXEC
49//config: bool "Support command execution at device addition/removal"
50//config: default y
51//config: depends on FEATURE_MDEV_CONF
52//config: help
53//config: This adds support for an optional field to /etc/mdev.conf for
54//config: executing commands when devices are created/removed.
55//config:
56//config: For more information, please see docs/mdev.txt
57//config:
58//config:config FEATURE_MDEV_LOAD_FIRMWARE
59//config: bool "Support loading of firmwares"
60//config: default y
61//config: depends on MDEV
62//config: help
63//config: Some devices need to load firmware before they can be usable.
64//config:
65//config: These devices will request userspace look up the files in
66//config: /lib/firmware/ and if it exists, send it to the kernel for
67//config: loading into the hardware.
68
69//applet:IF_MDEV(APPLET(mdev, BB_DIR_SBIN, BB_SUID_DROP))
70
71//kbuild:lib-$(CONFIG_MDEV) += mdev.o
72
11//usage:#define mdev_trivial_usage 73//usage:#define mdev_trivial_usage
12//usage: "[-s]" 74//usage: "[-s]"
13//usage:#define mdev_full_usage "\n\n" 75//usage:#define mdev_full_usage "\n\n"
14//usage: " -s Scan /sys and populate /dev during system boot\n" 76//usage: "mdev -s is to be run during boot to scan /sys and populate /dev.\n"
15//usage: "\n" 77//usage: "\n"
16//usage: "It can be run by kernel as a hotplug helper. To activate it:\n" 78//usage: "Bare mdev is a kernel hotplug helper. To activate it:\n"
17//usage: " echo /sbin/mdev > /proc/sys/kernel/hotplug\n" 79//usage: " echo /sbin/mdev >/proc/sys/kernel/hotplug\n"
18//usage: IF_FEATURE_MDEV_CONF( 80//usage: IF_FEATURE_MDEV_CONF(
81//usage: "\n"
19//usage: "It uses /etc/mdev.conf with lines\n" 82//usage: "It uses /etc/mdev.conf with lines\n"
20//usage: "[-]DEVNAME UID:GID PERM" 83//usage: " [-]DEVNAME UID:GID PERM"
21//usage: IF_FEATURE_MDEV_RENAME(" [>|=PATH]") 84//usage: IF_FEATURE_MDEV_RENAME(" [>|=PATH]|[!]")
22//usage: IF_FEATURE_MDEV_EXEC(" [@|$|*PROG]") 85//usage: IF_FEATURE_MDEV_EXEC(" [@|$|*PROG]")
86//usage: "\n"
87//usage: "where DEVNAME is device name regex, @major,minor[-minor2], or\n"
88//usage: "environment variable regex. A common use of the latter is\n"
89//usage: "to load modules for hotplugged devices:\n"
90//usage: " $MODALIAS=.* 0:0 660 @modprobe \"$MODALIAS\"\n"
23//usage: ) 91//usage: )
92//usage: "\n"
93//usage: "If /dev/mdev.seq file exists, mdev will wait for its value\n"
94//usage: "to match $SEQNUM variable. This prevents plug/unplug races.\n"
95//usage: "To activate this feature, create empty /dev/mdev.seq at boot."
24//usage: 96//usage:
25//usage:#define mdev_notes_usage "" 97//usage:#define mdev_notes_usage ""
26//usage: IF_FEATURE_MDEV_CONFIG( 98//usage: IF_FEATURE_MDEV_CONFIG(
@@ -64,9 +136,9 @@
64 * If /etc/mdev.conf exists, it may modify /dev/device_name's properties. 136 * If /etc/mdev.conf exists, it may modify /dev/device_name's properties.
65 * /etc/mdev.conf file format: 137 * /etc/mdev.conf file format:
66 * 138 *
67 * [-][subsystem/]device user:grp mode [>|=path] [@|$|*command args...] 139 * [-][subsystem/]device user:grp mode [>|=path]|[!] [@|$|*command args...]
68 * [-]@maj,min[-min2] user:grp mode [>|=path] [@|$|*command args...] 140 * [-]@maj,min[-min2] user:grp mode [>|=path]|[!] [@|$|*command args...]
69 * [-]$envvar=val user:grp mode [>|=path] [@|$|*command args...] 141 * [-]$envvar=val user:grp mode [>|=path]|[!] [@|$|*command args...]
70 * 142 *
71 * Leading minus in 1st field means "don't stop on this line", otherwise 143 * Leading minus in 1st field means "don't stop on this line", otherwise
72 * search is stopped after the matching line is encountered. 144 * search is stopped after the matching line is encountered.