aboutsummaryrefslogtreecommitdiff
path: root/util-linux/unshare.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-09-07 14:09:01 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-09-07 14:09:01 +0200
commit20a3262cd756aadf8771969a4764cd3c571f0a3e (patch)
treed0d64a79b6c0a86cba0c5454f7d39085828d550b /util-linux/unshare.c
parentb9f56e82da9a0821011e1e0924acd1d781643070 (diff)
downloadbusybox-20a3262cd756aadf8771969a4764cd3c571f0a3e.tar.gz
mdev: create devices from /sys/dev
Currently some new devices that have a bus but no class will be missed by mdev coldplug device creation after boot. This happens because mdev recursively searches /sys/class which will by definition only find class devices. Some important devices such as iio and gpiochip does not have a class. But users will need them. This switches from using /sys/class as the place to look for devices to create to using /sys/dev where all char and block devices are listed. The subsystem lookup code that provide the G.subsystem environment variable is changed from using the directory name of the class device to instead dereference the "subsystem" symlink for the device, and look at the last element of the path of the symlink for the subsystem, which will work with class devices and bus devices alike. (The new bus-only devices only symlink to the /sys/bus/* hierarchy.) We delete the legacy kernel v2.6.2x /sys/block device path code as part of this change. It's too old to be kept alive. Tested on kernel v4.6-rc2 with a bunch of devices, including some IIO and gpiochip devices. With a print inserted before make_device() the log looks like so: Create device from "/sys/dev/char/1:1", subsystem "mem" Create device from "/sys/dev/char/1:2", subsystem "mem" Create device from "/sys/dev/char/1:3", subsystem "mem" Create device from "/sys/dev/char/1:5", subsystem "mem" (...) Create device from "/sys/dev/block/179:56", subsystem "block" Create device from "/sys/dev/block/179:64", subsystem "block" function old new delta mdev_main 1388 1346 -42 dirAction 134 14 -120 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-162) Total: -162 bytes Cc: Isaac Dunham <ibid.ag@gmail.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/unshare.c')
0 files changed, 0 insertions, 0 deletions