mdev

Vladimir Dronnikov dronnikov at gmail.com
Sun Apr 19 05:34:54 UTC 2009


>
> So you wouldn't be reusing any of the existing code in mdev?

I would: make_device(), build_alias()

>> Simple. "mdev -s" doesn't enumerate /sys/devices/*. Some devices
>
> Ok, I'll bite.  How do you tell if devices under /sys/devices are char devices
> or block devices?  You can't mknod without that information.
>
> I asked Greg Kroah-Hartman and Kay Sievers this information directly, more
> than once.  They didn't provide a coherent answer.

I don't care here of device type. Let them be char. If the system has
a device X (which is denoted by existance of a directory under
/sys/devices/), I want mdev -s to account for it. Current mdev -s
don't. If I rely on mdev -s to enumerate ALL devices, I'll fail here.

>> And to load them you either
>> need to issue modprobe "by hands", or (as I propose) rely on
>> enumerating /sys/devices/* and $MODALIAS suport in mdev hotplug.
>
> You're using the words "enumerating" and "hotplug" in the same sentence.

I'm not very fluent in english punctuation. The right sense is:
enumeration in "mdev -s"; [and] $MODALIAS support in mdev hotplug.

> pci:v00008086d000027DAsv00001028sd000001BDbc0Csc05i00
>
> Which looks like the data the hotplug thing I linked to earlier was parsing...

Current modprobe is happy with such arguments. We don't need any
additional parsing.

>> > Right now, if you haven't got _either_ a device name _or_ a major/minor
>> > to match on (neither of which you have if you have in the absence of a
>> > device node), then there's no way for the current config file to identify
>> > the device and thus attach behavior to its events.
>>
>> Wrong.
>
> I started my paragraph with "right now", and you tell me I'm wrong because of
> code mdev hasn't got right now.  Interesting definition of "wrong".

The definition is right. Because current ("right now") mdev is capable
of identifying a device by its subsystem (neither device _name_ nor
maj:min). I explained it two lines later:

---
>> net/.* - - @netif
---

> You could add code to mdev to match on other environment variables it's not
> currently looking at

This is unneeded complication, may be, I'm rethinking now. The only
envvars hotplug should reliably respect are $DEVPATH -> $MDEV,
$ACTION, $SUBSYSTEM, $MODALIAS, $FIRMWARE. There is no reason to
handle anything.
Currently only $MODALIAS isn't respected. And it IMHO should be
intrinsic mdev behavior, so we could survive even with no mdev.conf at
all.

>
> They did adjust its assumptions.  The wrong way.
>

Then may be reextact the right way code to mdev.c, and throw away the
wrong one to mdev1.c, which can be changed until stabilized?

> Because you haven't explained what's performing device enumeration (what is
> finding devices that haven't got modules loaded, and requesting that they be
> loaded?)

# echo -n "add" >...uevent

But this is very slow and cause hotplug storm. I admit it for _coldplug_.

>  And when I currently probe for this data from the code similar to
> the enumeration code mdev already has, I get data that needs an extensive
> parser referencing external data files (like the one in the hotplug code I
> linked to) to make any sense of.

No. No. No. modprobe will take it verbatim -- it is all in modules.aliases.

>>
>> A better alternative is IMHO a _solid_ hotplug helper capable of
>> matching against environment variables (for they are the primary
>> source of the event info).
>
> I'm all for it.  It should be a hotplug wrapper that calls mdev as necessary,
> once it's handled modules and firmware and so on that mdev isn't interested
> in.

But notice then, that the rule which would match $MODALIAS, should be
executed _any time_ an event is fired. So I see no gain in pushing the
intrinsic behavior into an external every-time-executing rule.

>
> Centralized means everything is done through it, potentially adding arbitrary
> amounts of pluggable behavior for who knows what devices.
>
> I don't even know what you mean by "uniform".

Uniform is for "configuration is applied to matching hotplug event
targets (devices or not real devices, eth*, e.g.) thru mdev.conf
rules".

--
Vladimir


More information about the busybox mailing list