Re: Device enumeration (was Re: CD writing in future Linux (stirring up a hornets' nest))
From: Rob Landley
Date: Wed Feb 15 2006 - 13:18:35 EST
On Wednesday 15 February 2006 11:55 am, Olivier Galibert wrote:
> On Tue, Feb 14, 2006 at 07:24:22PM -0500, Rob Landley wrote:
> > I'm torn between "nuts to alsa", pointing out that "ln -s /dev /dev/snd"
> > should shut it up nicely, and thinking up a way to actually do what it
> > wants.
> >
> > If there's a real need for subdirectories, I'm sure we can come up with a
> > way to shunt stuff into them. (Of course a shellout could do it, but if
> > it's common enough we could build something into mdev...)
> >
> > The easy one's the symlink, assuming there are no name collisions
> > flinging everything into one directory...
>
> Let's see, on a recent kernel and recent udev I have as directories
> under /dev:
>
> - disk, a pure udev creation, so no conflict there
> - loop, devices names under that are numeric. mount has /dev/loop%d
> and /dev/loop/%d hardcoded
I just downloaded 2.6.13-rc3 and built it. That has:
/sys/block/{loop0,loop1,loop2,loop3,loop4,loop5,loop6,loop7}
And those are the names mdev would use. Turning /dev/loop# into /dev/loop/#
has to be some kind of udev filter in the config file.
There are no duplicate dev nodes in /sys right now. Check for yourself. Grab
all the names mdev would use:
find /sys -name dev | sed -e 's@^/sys/.*/\(.*\)/dev@\1@'
And then pipe that to sort | uniq -d
No hits on my ubuntu "flatulent badger" system. I'm not saying there won't be
any, I haven't tried plugging in a few usb memory keys and such. (But it
shouldn't be an overwhelming problem. We could keep just the first one,
stick a #2 on the second one... I'll worry about it when it crops up.)
> - bus/usb, this one collides with itself if flattened
> - snd/sound, names except for seq and timer are pretty much line
> noise. "timer" is scary though.
> - net with tun and (I think) tap.
> - pktcdvd with "control", not sure what tool uses it
> - misc is ok (they're all ex-/dev/xx devices)
> - video1394, dv1394, i2c with '0' as device name
> - dri with card%d
> - cpu which self-collides too
> - input with a potentially dangerous event%d
Don't look at the output of udev. Look at the contents of /sys.
> So, well, I think you're going to need directories for usb and cpu
> without doubt, and some of the rest is potentially risky, long-term
> wise.
The current way sys handles things like "loop0" is to call it "loop0" rather
than having a "loop" subdirectory with "0" under it. If they changed that:
A) I'd whimper on the list and make puppy eyes.
B) I could turn loop/0 back into "loop0" if I had to. Not too hard to do
mechanically...
> OG.
Rob
--
Never bet against the cheap plastic solution.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/