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>
This commit is contained in:
Denys Vlasenko 2011-09-19 12:18:11 +02:00
parent 34c469ae04
commit 5c6ba6c56f
5 changed files with 89 additions and 71 deletions

View File

@ -51,19 +51,25 @@ device nodes if your system needs something more than the default root/root
660 permissions. 660 permissions.
The file has the format: The file has the format:
<device regex> <uid>:<gid> <permissions> [-]<device regex> <uid>:<gid> <permissions>
or @<maj[,min1[-min2]]> <uid>:<gid> <permissions> or
@<maj[,min1[-min2]]> <uid>:<gid> <permissions>
or
$envvar=<regex> <uid>:<gid> <permissions>
For example: For example:
hd[a-z][0-9]* 0:3 660 hd[a-z][0-9]* 0:3 660
The config file parsing stops at the first matching line. If no line is The config file parsing stops at the first matching line. If no line is
matched, then the default of 0:0 660 is used. To set your own default, simply matched, then the default of 0:0 660 is used. To set your own default, simply
create your own total match like so: create your own total match like so:
.* 1:1 777 .* 1:1 777
You can rename/move device nodes by using the next optional field. You can rename/move device nodes by using the next optional field.
<device regex> <uid>:<gid> <permissions> [=path] <device regex> <uid>:<gid> <permissions> [=path]
So if you want to place the device node into a subdirectory, make sure the path So if you want to place the device node into a subdirectory, make sure the path
has a trailing /. If you want to rename the device node, just place the name. has a trailing /. If you want to rename the device node, just place the name.
hda 0:3 660 =drives/ hda 0:3 660 =drives/

View File

@ -239,7 +239,6 @@ IF_MAKEMIME(APPLET(makemime, BB_DIR_BIN, BB_SUID_DROP))
IF_MAN(APPLET(man, BB_DIR_SBIN, BB_SUID_DROP)) IF_MAN(APPLET(man, BB_DIR_SBIN, BB_SUID_DROP))
IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_MD5SUM(APPLET_NOEXEC(md5sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, md5sum)) IF_MD5SUM(APPLET_NOEXEC(md5sum, md5_sha1_sum, BB_DIR_USR_BIN, BB_SUID_DROP, md5sum))
IF_MDEV(APPLET(mdev, BB_DIR_SBIN, BB_SUID_DROP))
IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir)) IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir))
IF_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat)) IF_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))

View File

@ -404,64 +404,6 @@ config LSUSB
This version uses sysfs (/sys/bus/usb/devices) only. This version uses sysfs (/sys/bus/usb/devices) only.
config MDEV
bool "mdev"
default y
select PLATFORM_LINUX
help
mdev is a mini-udev implementation for dynamically creating device
nodes in the /dev directory.
For more information, please see docs/mdev.txt
config FEATURE_MDEV_CONF
bool "Support /etc/mdev.conf"
default y
depends on MDEV
help
Add support for the mdev config file to control ownership and
permissions of the device nodes.
For more information, please see docs/mdev.txt
config FEATURE_MDEV_RENAME
bool "Support subdirs/symlinks"
default y
depends on FEATURE_MDEV_CONF
help
Add support for renaming devices and creating symlinks.
For more information, please see docs/mdev.txt
config FEATURE_MDEV_RENAME_REGEXP
bool "Support regular expressions substitutions when renaming device"
default y
depends on FEATURE_MDEV_RENAME
help
Add support for regular expressions substitutions when renaming
device.
config FEATURE_MDEV_EXEC
bool "Support command execution at device addition/removal"
default y
depends on FEATURE_MDEV_CONF
help
This adds support for an optional field to /etc/mdev.conf for
executing commands when devices are created/removed.
For more information, please see docs/mdev.txt
config FEATURE_MDEV_LOAD_FIRMWARE
bool "Support loading of firmwares"
default y
depends on MDEV
help
Some devices need to load firmware before they can be usable.
These devices will request userspace look up the files in
/lib/firmware/ and if it exists, send it to the kernel for
loading into the hardware.
config MKSWAP config MKSWAP
bool "mkswap" bool "mkswap"
default y default y

View File

@ -26,7 +26,6 @@ lib-$(CONFIG_IPCS) += ipcs.o
lib-$(CONFIG_LOSETUP) += losetup.o lib-$(CONFIG_LOSETUP) += losetup.o
lib-$(CONFIG_LSPCI) += lspci.o lib-$(CONFIG_LSPCI) += lspci.o
lib-$(CONFIG_LSUSB) += lsusb.o lib-$(CONFIG_LSUSB) += lsusb.o
lib-$(CONFIG_MDEV) += mdev.o
lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o
lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o
lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o

View File

@ -8,19 +8,91 @@
* Licensed under GPLv2, see file LICENSE in this source tree. * Licensed under GPLv2, see file LICENSE in this source tree.
*/ */
//config:config MDEV
//config: bool "mdev"
//config: default y
//config: select PLATFORM_LINUX
//config: help
//config: mdev is a mini-udev implementation for dynamically creating device
//config: nodes in the /dev directory.
//config:
//config: For more information, please see docs/mdev.txt
//config:
//config:config FEATURE_MDEV_CONF
//config: bool "Support /etc/mdev.conf"
//config: default y
//config: depends on MDEV
//config: help
//config: Add support for the mdev config file to control ownership and
//config: permissions of the device nodes.
//config:
//config: For more information, please see docs/mdev.txt
//config:
//config:config FEATURE_MDEV_RENAME
//config: bool "Support subdirs/symlinks"
//config: default y
//config: depends on FEATURE_MDEV_CONF
//config: help
//config: Add support for renaming devices and creating symlinks.
//config:
//config: For more information, please see docs/mdev.txt
//config:
//config:config FEATURE_MDEV_RENAME_REGEXP
//config: bool "Support regular expressions substitutions when renaming device"
//config: default y
//config: depends on FEATURE_MDEV_RENAME
//config: help
//config: Add support for regular expressions substitutions when renaming
//config: device.
//config:
//config:config FEATURE_MDEV_EXEC
//config: bool "Support command execution at device addition/removal"
//config: default y
//config: depends on FEATURE_MDEV_CONF
//config: help
//config: This adds support for an optional field to /etc/mdev.conf for
//config: executing commands when devices are created/removed.
//config:
//config: For more information, please see docs/mdev.txt
//config:
//config:config FEATURE_MDEV_LOAD_FIRMWARE
//config: bool "Support loading of firmwares"
//config: default y
//config: depends on MDEV
//config: help
//config: Some devices need to load firmware before they can be usable.
//config:
//config: These devices will request userspace look up the files in
//config: /lib/firmware/ and if it exists, send it to the kernel for
//config: loading into the hardware.
//applet:IF_MDEV(APPLET(mdev, BB_DIR_SBIN, BB_SUID_DROP))
//kbuild:lib-$(CONFIG_MDEV) += mdev.o
//usage:#define mdev_trivial_usage //usage:#define mdev_trivial_usage
//usage: "[-s]" //usage: "[-s]"
//usage:#define mdev_full_usage "\n\n" //usage:#define mdev_full_usage "\n\n"
//usage: " -s Scan /sys and populate /dev during system boot\n" //usage: "mdev -s is to be run during boot to scan /sys and populate /dev.\n"
//usage: "\n" //usage: "\n"
//usage: "It can be run by kernel as a hotplug helper. To activate it:\n" //usage: "Bare mdev is a kernel hotplug helper. To activate it:\n"
//usage: " echo /sbin/mdev > /proc/sys/kernel/hotplug\n" //usage: " echo /sbin/mdev >/proc/sys/kernel/hotplug\n"
//usage: IF_FEATURE_MDEV_CONF( //usage: IF_FEATURE_MDEV_CONF(
//usage: "\n"
//usage: "It uses /etc/mdev.conf with lines\n" //usage: "It uses /etc/mdev.conf with lines\n"
//usage: "[-]DEVNAME UID:GID PERM" //usage: " [-]DEVNAME UID:GID PERM"
//usage: IF_FEATURE_MDEV_RENAME(" [>|=PATH]") //usage: IF_FEATURE_MDEV_RENAME(" [>|=PATH]|[!]")
//usage: IF_FEATURE_MDEV_EXEC(" [@|$|*PROG]") //usage: IF_FEATURE_MDEV_EXEC(" [@|$|*PROG]")
//usage: "\n"
//usage: "where DEVNAME is device name regex, @major,minor[-minor2], or\n"
//usage: "environment variable regex. A common use of the latter is\n"
//usage: "to load modules for hotplugged devices:\n"
//usage: " $MODALIAS=.* 0:0 660 @modprobe \"$MODALIAS\"\n"
//usage: ) //usage: )
//usage: "\n"
//usage: "If /dev/mdev.seq file exists, mdev will wait for its value\n"
//usage: "to match $SEQNUM variable. This prevents plug/unplug races.\n"
//usage: "To activate this feature, create empty /dev/mdev.seq at boot."
//usage: //usage:
//usage:#define mdev_notes_usage "" //usage:#define mdev_notes_usage ""
//usage: IF_FEATURE_MDEV_CONFIG( //usage: IF_FEATURE_MDEV_CONFIG(
@ -64,9 +136,9 @@
* If /etc/mdev.conf exists, it may modify /dev/device_name's properties. * If /etc/mdev.conf exists, it may modify /dev/device_name's properties.
* /etc/mdev.conf file format: * /etc/mdev.conf file format:
* *
* [-][subsystem/]device user:grp mode [>|=path] [@|$|*command args...] * [-][subsystem/]device user:grp mode [>|=path]|[!] [@|$|*command args...]
* [-]@maj,min[-min2] user:grp mode [>|=path] [@|$|*command args...] * [-]@maj,min[-min2] user:grp mode [>|=path]|[!] [@|$|*command args...]
* [-]$envvar=val user:grp mode [>|=path] [@|$|*command args...] * [-]$envvar=val user:grp mode [>|=path]|[!] [@|$|*command args...]
* *
* Leading minus in 1st field means "don't stop on this line", otherwise * Leading minus in 1st field means "don't stop on this line", otherwise
* search is stopped after the matching line is encountered. * search is stopped after the matching line is encountered.