public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: Olivier Galibert <galibert@pobox.com>
Cc: ajwade@cpe001346162bf9-cm0011ae8cd564.cpe.net.cable.rogers.com,
	Greg KH <greg@kroah.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Device enumeration (was Re: CD writing in future Linux (stirring up a hornets' nest))
Date: Tue, 14 Feb 2006 17:32:22 -0500	[thread overview]
Message-ID: <200602141732.22712.rob@landley.net> (raw)
In-Reply-To: <20060214104003.GA97714@dspnet.fr.eu.org>

On Tuesday 14 February 2006 5:40 am, Olivier Galibert wrote:

> > > 4- sysfs has all the information you need, just read it

There's no ownership or permissions information in sysfs.  Even busybox's 
eight kilobyte micro-udev replacement has the option for an /etc/mdev.conf to 
specify permissions and ownership on device nodes.

> > That mapping should not live in sysfs,
> > /dev is none of the kernel's business and sysfs is the kernel's
> > playground.
>
> Why not have udev and whatever comes after tell the kernel so that a
> symlink is done in sysfs?  The kernel not deciding policy do not
> prevent it from storing and giving back userland-provided information.

That wouldn't help us.  If userspace generates the info, then userspace can 
drop a note in /dev or something to keep it there.

> I guess you didn't bother to read the "answer 3" paragraph of my
> email.  Do you trust udev to still exist two years from now, given
> that hotplug died in less than that?  Do you trust udevinfo to have
> the same interface two years from now given that the current interface
> is already incompatible with a not even two-years old one (udev 039,
> 15-Oct-2004 according to kernel.org) which is widely deployed as part
> of fedora core 3?

You want something simple and stable?

Busybox's mdev should still be there, and have the same interface, two 
years from now.  (We may have to fix it between now and then if the kernel 
keeps moving out from under us, but that shouldn't change how you set up and 
use it.)

When you call "mdev -s", we iterate through /sys/class and sys/block looking 
for "dev" nodes containing a "major:minor" string, and take the name of the 
directory we find each /dev node in as the name of the device to mknod 
in /dev.  (As an option, it can check /etc/mdev.conf which has three 
space-separated fields: a regex, a numeric colon-separated uid:gid pair, and 
octal permissions.  "tty[0-9]* 0:42 770".  Stops at the first match and uses 
that ownership and permission info for the new node.  If there's no mdev.conf 
or it doesn't match any regex against the name it's creating, it defaults to 
0:0 and 660.)

If you call it without -s, it assumes it was called from /sbin/hotplug and 
looks at its environment variables to figure out what device node to 
create/delete.

That's it.  That's all we do.  No persistent naming, no device renaming, /dev 
is a flat namespace with no subdirectories, mounting tmpfs on it before 
calling us is your problem, as is putting /dev/pts and /dev/shm in there...

Changes to the kernel have already managed to break us twice 
(switching /sys/class from real subdirectories to symlinks means we can't 
just ignore symlinks when recursing down through directories anymore, which 
is a problem because the existing symlinks form loops.  And 
deprecating /sbin/hotplug means we've got to bloat the code with netlink 
stuff.)  But we'll cope, and the user interface isn't changing.

We can extend the mdev.conf file to specify other stuff.  (Such as append a 
command line as an optional argument #4 to execute when one of these suckers 
is created/destroyed.  But so far, it's really really simple and our target 
audience hasn't needed more than that.)

If you want to try mdev, grab the most recent snapshot from 
busybox.net/downloads/snapshots and build it this way:

make allnoconfig
echo "CONFIG_MDEV=y" >> .config
echo "CONFIG_FEATURE_MDEV_CONF=y" >> .config
make
mv busybox mdev

There you go, standalone 8k binary.  It'll come standard in the busybox 1.1.1 
release.  (It was in 1.1.0, but had a bug.)

Rob
-- 
Never bet against the cheap plastic solution.

  parent reply	other threads:[~2006-02-14 22:32 UTC|newest]

Thread overview: 177+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-25  3:23 CD writing in future Linux (stirring up a hornets' nest) Albert Cahalan
2006-01-25 14:26 ` Jan Engelhardt
2006-01-25 14:45   ` Jens Axboe
2006-01-25 15:13     ` Jan Engelhardt
2006-01-25 15:30       ` Jens Axboe
2006-01-25 17:03         ` Joerg Schilling
2006-01-25 17:11           ` Matthias Andree
2006-01-25 17:18           ` grundig
2006-01-25 17:31             ` Jens Axboe
2006-01-25 18:22               ` Matthias Andree
2006-01-25 18:25                 ` Jens Axboe
2006-01-25 23:14                   ` Matthias Andree
2006-01-26  1:13                     ` grundig
2006-01-26  8:23                       ` Matthias Andree
2006-01-26 13:56                         ` Joerg Schilling
2006-01-26 18:47                           ` Jan Engelhardt
2006-01-30 21:58                           ` Bill Davidsen
2006-01-26 13:41                       ` Joerg Schilling
2006-01-26  0:36                 ` Nix
2006-01-26 13:39                   ` Joerg Schilling
2006-02-10 21:06                   ` Bill Davidsen
     [not found]                     ` <20060210184241.35332e78.seanlkml@sympatico.ca>
2006-02-10 23:42                       ` sean
2006-02-10 23:51                     ` Christian Neumair
2006-02-13 13:24                       ` Joerg Schilling
2006-02-13 13:55                         ` Martin Mares
2006-02-13 15:17                           ` Joerg Schilling
2006-02-18 13:47                             ` Bill Davidsen
2006-02-19  1:10                               ` D. Hazelton
2006-02-19  9:20                                 ` Matthias Andree
2006-02-20  1:53                                   ` D. Hazelton
2006-02-20 16:41                                     ` Joerg Schilling
2006-02-20 18:40                                       ` D. Hazelton
2006-02-21 10:08                                         ` Joerg Schilling
2006-02-21 10:20                                           ` Matthias Andree
2006-02-21  4:11                                       ` D. Hazelton
2006-02-21 10:36                                         ` Joerg Schilling
2006-02-24 19:46                                           ` Christian Neumair
2006-02-27 11:32                                             ` Joerg Schilling
2006-02-20 16:05                               ` Joerg Schilling
2006-02-20 18:53                                 ` D. Hazelton
2006-02-20 22:30                                   ` Martin Schlemmer
2006-02-21  8:32                                   ` Jens Axboe
2006-02-21 10:19                                   ` Joerg Schilling
2006-02-21 10:23                                     ` Jens Axboe
2006-02-13 14:07                         ` jerome lacoste
2006-02-13 15:26                           ` Joerg Schilling
2006-02-13 15:42                             ` jerome lacoste
2006-02-13 16:43                         ` Jan Engelhardt
2006-02-13 17:27                           ` Luke-Jr
2006-02-14  8:11                             ` Jan Engelhardt
2006-02-14  0:01                         ` D. Hazelton
2006-02-14 13:59                           ` Joerg Schilling
2006-02-10 23:56                     ` Greg KH
2006-02-12 12:04                       ` Olivier Galibert
2006-02-12 16:46                         ` Greg KH
2006-02-12 21:14                           ` Olivier Galibert
2006-02-12 21:49                             ` Krzysztof Halasa
2006-02-13  6:24                             ` Greg KH
2006-02-13 16:49                               ` Olivier Galibert
2006-02-13 17:50                                 ` Greg KH
2006-02-13 19:53                                   ` Device enumeration (was Re: CD writing in future Linux (stirring up a hornets' nest)) Olivier Galibert
2006-02-14  5:23                                     ` Andrew James Wade
2006-02-14 10:40                                       ` Olivier Galibert
2006-02-14 22:24                                         ` Greg KH
2006-02-14 23:00                                           ` Olivier Galibert
2006-02-14 23:45                                             ` Greg KH
2006-02-15 15:01                                               ` Olivier Galibert
2006-02-14 22:32                                         ` Rob Landley [this message]
2006-02-14 23:17                                           ` Olivier Galibert
2006-02-15  0:24                                             ` Rob Landley
2006-02-15  0:54                                               ` Greg KH
2006-02-15  3:18                                                 ` Rob Landley
2006-02-15 16:55                                               ` Olivier Galibert
2006-02-15 18:19                                                 ` Rob Landley
2006-02-14 23:32                                           ` Olivier Galibert
2006-02-15  1:50                                             ` Rob Landley
2006-02-14 23:47                                           ` Greg KH
2006-02-15  2:07                                             ` Rob Landley
2006-02-15 13:42                                         ` Andrew James Wade
2006-02-15 14:54                                           ` Olivier Galibert
2006-02-14 11:53                                     ` Michael Tokarev
2006-02-13  5:01                       ` CD writing in future Linux (stirring up a hornets' nest) Daniel Barkalow
2006-02-13  6:21                         ` Greg KH
2006-02-13  8:05                           ` Daniel Barkalow
2006-02-13 17:51                             ` Greg KH
2006-02-13 18:03                               ` Dmitry Torokhov
2006-02-13 19:09                                 ` Daniel Barkalow
2006-02-17 21:35                                   ` Bill Davidsen
2006-02-18  0:02                                     ` D. Hazelton
2006-02-18 16:56                                       ` Bill Davidsen
2006-02-19  0:29                                         ` D. Hazelton
2006-02-18  0:35                                     ` Greg KH
2006-02-18 12:06                                     ` Christoph Hellwig
2006-02-18 13:37                                       ` Martin Michlmayr
2006-02-18 13:52                                         ` Christoph Hellwig
2006-02-19 12:04                                           ` Jens Axboe
2006-02-18 17:15                                       ` Gene Heskett
2006-02-19  0:41                                         ` D. Hazelton
2006-02-19  5:44                                           ` Gene Heskett
2006-02-19  9:27                                           ` Matthias Andree
2006-02-27 20:23                                             ` Bill Davidsen
2006-02-19 18:50                                         ` Daniel Barkalow
2006-02-18 18:36                                       ` Chris Adams
2006-02-19  1:05                                         ` D. Hazelton
2006-02-27 20:24                                         ` Bill Davidsen
2006-02-27 21:21                                           ` Chris Adams
2006-02-27 21:47                                             ` D. Hazelton
2006-02-27 22:30                                               ` Peter Gordon
2006-02-27 22:24                                                 ` D. Hazelton
2006-02-28  0:44                                                   ` Sam Vilain
2006-02-13 13:26                       ` Joerg Schilling
2006-02-13 15:49                         ` Greg KH
2006-02-14 18:59                           ` Joerg Schilling
2006-02-14 19:53                             ` Matthias Andree
2006-02-14 19:58                               ` Joerg Schilling
2006-02-14 20:25                                 ` Matthias Andree
2006-02-14 22:35                                 ` D. Hazelton
2006-02-14 22:32                             ` D. Hazelton
2006-02-14 18:59                           ` Olivier Galibert
2006-02-14 19:01                           ` Bill Davidsen
2006-02-14 22:33                             ` Nix
2006-02-15 15:44                           ` Jan Engelhardt
2006-02-15 16:40                             ` Olivier Galibert
2006-02-15 17:07                             ` Greg KH
2006-02-13 22:14                         ` Nix
2006-02-14  0:03                           ` D. Hazelton
2006-02-14  0:32                             ` Nix
2006-02-14  9:22                           ` Matthias Andree
2006-02-14 18:09                             ` Jan Engelhardt
2006-02-14 18:41                               ` Olivier Galibert
2006-02-17 15:36                                 ` Jan Engelhardt
2006-02-14 11:27                           ` Joerg Schilling
2006-02-14 22:30                             ` Greg KH
2006-02-15  0:43                               ` Matthias Andree
2006-02-15  5:20                                 ` Greg KH
2006-02-16 12:01                                   ` Matthias Andree
2006-02-16 16:51                                     ` Randy.Dunlap
2006-02-16 18:03                                     ` Greg KH
2006-02-14 22:40                             ` Nix
2006-02-16 12:09                               ` Joerg Schilling
2006-02-16 12:36                                 ` Martin Mares
2006-02-17  0:38                                   ` Nix
     [not found]                                   ` <43F746B8.6080607@tmr.com>
2006-02-18 21:04                                     ` Martin Mares
2006-02-18 22:00                                       ` Ondrej Zary
2006-02-16 12:55                                 ` Marc Koschewski
2006-02-13 12:11                     ` Joerg Schilling
     [not found]                       ` <515e525f0602130446s1091f09ande10910f65a0f5f0@mail.gmail.com>
2006-02-13 15:12                         ` Joerg Schilling
2006-02-13 16:40                           ` Jan Engelhardt
2006-02-13 23:24                           ` D. Hazelton
2006-02-14 13:55                             ` Joerg Schilling
2006-02-14 21:59                               ` D. Hazelton
     [not found]                                 ` <43F74884.50904@tmr.com>
2006-02-18 20:00                                   ` Nix
2006-01-26 10:11                 ` Joerg Schilling
2006-01-25 19:04               ` Olivier Galibert
2006-01-26  9:38             ` Joerg Schilling
2006-01-26  9:45               ` Lee Revell
2006-01-26 13:58                 ` Joerg Schilling
2006-01-26 14:09                   ` Nick Piggin
2006-01-26 14:32                     ` Joerg Schilling
2006-01-26 15:16                       ` Nick Piggin
2006-01-26 16:04                       ` Matthias Andree
2006-01-26 15:38               ` grundig
2006-01-25 19:00           ` Tomasz Torcz
2006-01-26 10:25             ` Joerg Schilling
2006-01-26 10:56               ` Tomasz Torcz
2006-01-26 14:11                 ` Joerg Schilling
2006-01-25 22:01         ` jerome lacoste
2006-01-26 12:13           ` Joerg Schilling
2006-01-26 12:39             ` Martin Mares
2006-01-26 14:14               ` Joerg Schilling
2006-01-26 20:42         ` Jan Engelhardt
2006-01-27  8:00           ` Jens Axboe
2006-01-30 22:52             ` Bill Davidsen
2006-01-31  2:04               ` Kyle Moffett
2006-02-16 16:20                 ` Bill Davidsen
2006-02-16 17:45                   ` Olivier Galibert
2006-01-25 17:10       ` are added/removed - which

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200602141732.22712.rob@landley.net \
    --to=rob@landley.net \
    --cc=ajwade@cpe001346162bf9-cm0011ae8cd564.cpe.net.cable.rogers.com \
    --cc=galibert@pobox.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox