mdev with hda's

David Henderson dhenderson at digital-pipe.com
Wed May 11 15:34:08 UTC 2011


On 05/11/2011 10:56 AM, Harald Becker wrote:
>   Hallo David!
>
>> I agree.  Plus, as the previous reply stated, some of the values to
>> the more robust environment output can be included as it's already
>> used by mdev just to be able to create the device files (and other
>> values can be determined based on rule matching or further processing).
> Which environment variables do you really need? Give a complete list,
> please.
>
> --
> Harald
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox

Ok, the below list is what's generated by an sda attached device:

DEVTYPE=disk
SUBSYSTEM=block
DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host5/target5:0:0/5:0:0:0/block/sde
MINOR=64
PATH=/sbin:/bin:/usr/sbin:/usr/bin
ACTION=add
PWD=/dev
MAJOR=8
DEVNAME=sde
SHLVL=1
HOME=/
MDEV=sde
SEQNUM=686
_=/bin/env


Of those, some can be eliminated because they are available via 'env' 
from an external script call, including: PATH, PWD, SHLVL, and HOME.  
This leaves just the following that should actually be related to mdev:

DEVTYPE=disk
SUBSYSTEM=block
DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host5/target5:0:0/5:0:0:0/block/sde
MINOR=64
ACTION=add
MAJOR=8
DEVNAME=sde
MDEV=sde
SEQNUM=686
_=/bin/env


Of those, you can actually merge DEVNAME and MDEV into one variable 
since they always contain the exact same information.  I also, don't 
think anyone would have a use for the _ variable as that information can 
be obtained easily elsewhere (e.g. 'which env').  This now leaves:

DEVTYPE=disk
SUBSYSTEM=block
DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/host5/target5:0:0/5:0:0:0/block/sde
MINOR=64
ACTION=add
MAJOR=8
MDEV or DEVNAME=sde
SEQNUM=686


At this point, we've reduce the number of actual/usable mdev environment 
variables from 14 to 8!  Everyone one of the variables used below is 
used to perform indepth configuration of an attached device (with the 
exception of SEQNUM as I have no idea what that is).  These remaining 
variables should be able to be passed as a standard set of variables to 
any storage device whether it's passed by the kernel thread or logical 
deduction.  I'll include a note beside each one below:

SUBSYSTEM - already part of the mdev environment
MDEV or DEVNAME - already part of the mdev environment

DEVTYPE - this could be figured about by the rule matching (h|s)da 
devices or some other easily accessible piece of info
DEVPATH - this is part of sysfs (that's currently not parsed by mdev) 
and should be provided for indepth information retrieval on the device 
from within a script
MINOR - used by mdev (to setup /dev/? files) already irregardless of 
(h|s)da devices when not calling a script.  Why is this not passed when 
a script is used?
ACTION - useful by a script to know whether to add device related files 
or fs cleanup.  This is only one of two possible values that can easily 
be determined.
MAJOR - see MINOR
SEQNUM - no idea what this is; possibly remove?


Thoughts anyone?

Dave


More information about the busybox mailing list