[RFC] mdev: support reading events from stdin, add features to mdev -s

Isaac Dunham ibid.ag at gmail.com
Mon Apr 13 17:15:31 UTC 2015


Here's a patch series to add mdev -i and make mdev -s a little more
featureful, so rules like this one:
$MODALIAS=.*    root:root 660 @modprobe "$MODALIAS"
will work even with coldplug.

mdev -i reads hotplug events from stdin, in a format proposed by Laurent Bercot
wherein each "line" is terminated with '\0' (rather than '\n') and each event
is terminated by an additional '\0'.
Internally, each event is loaded into the environment (without copying) at
the start of handle_event(), then the environment is cleared before
handle_event() returns.
This is done instead of using a new key lookup method because helper
scripts rely extensively on environment variables; if we did not load
the events into the environment at some point, autoloading modules and
other important features would no longer work. 

The new mdev -s (FEATURE_MDEV_NEWSCAN) uses the same codepath as mdev -i
instead of calling make_device() directly.

Both mdev -i and the new mdev -s are compile-time options, separately
selectable.

Patch 1 just moves the hotplug code into a separate function.
Patch 2 is ncopa's preliminary version of mdev -i.
Patch 3 is my work on mdev -i, including a config option to disable it.
Patch 4 is FEATURE_MDEV_NEWSCAN.

Comments welcome.

Thanks,
Isaac Dunham



More information about the busybox mailing list