RFC: mdev: use $DEVNAME in uevent sysfs file for device node name

Walter Dnes waltdnes at waltdnes.org
Wed Oct 31 13:05:37 UTC 2012


On Mon, Oct 29, 2012 at 09:49:39PM +0000, Ed W wrote
> On 25/10/2012 20:56, Walter Dnes wrote:
> > On Tue, Oct 23, 2012 at 03:37:56PM +0200, Nikolaus Voss wrote
> >> 516530c932bd17d87c9eb4347a490be051e495f4 uses $DEVNAME variable
> >> for device node name. This is fine, but only works for hotplugging,
> >> "mdev -s" will behave differently when DEVNAME and basename(path)
> >> differ.
> >>
> >> This patch extracts the DEVNAME from the uevent sysfs file in
> >> make_device(), thus works for hot- and coldplugging; so using
> >> the environment DEVNAME on hotplug events is no longer necessary.
> >>
> >> Signed-off-by: Nikolaus Voss <n.voss at weinmann.de>
> >    Question... will it hurt scripts that depend on the current behaviour?
> > I started a Gentoo wiki page (contributions from several others) at...
> > https://wiki.gentoo.org/wiki/Mdev detailing replacing udev with mdev.
> > Look Ma... no initramfs, even with a separate /usr.  I've also set up
> > my machine to automount USB devices when they're plugged in.  See...
> > https://wiki.gentoo.org/wiki/Mdev/Automount_USB
> >
> >    If this patch helps or hurts my setup, I'd be very interested in
> > knowing.
> >
> 
> I'm no expert, but I would strongly suggest watching Alpine linux for 
> ideas using mdev.  Natanael Copa is a smart cookie and done a lot of 
> integration with mdev that is worth observing.   Alpine is no longer 
> based on gentoo, but I think his ideas are close enough to be re-usable 
> everywhere.

  I've exchanged emails with Nikolaus Voss offline.  His patch should
not be a problem for my mdev USB automount script which is listed at
https://wiki.gentoo.org/wiki/Mdev/Automount_USB/automount  The script
checks its environment for variables "MDEV" and "ACTION", i.e.

if [ ! -b ${MDEV} ] ; then exit 0 ; fi

if [ "X${ACTION}" == "Xremove" ] ; then

if [ "X${ACTION}" == "Xadd" ] ; then

elif [ "X${ACTION}" == "Xremove" ] ; then

  "mdev -s" (run at boot time) does not return any "ACTION" variable to
the script's environment, so it doesn't do anything at bootup, and does
not interfere with cold-plugging.

-- 
Walter Dnes <waltdnes at waltdnes.org>


More information about the busybox mailing list