Linux: Debating devfs and udev

Submitted by Jeremy
on December 23, 2003 - 10:36pm

A recent posting to the lkml suggested that the udev project has unfairly hijacked the devfs project, leading into yet another lengthy discussion comparing udev to devfs, and questioning why the latter has been deprecated. Linux devfs was written by Richard Gooch and merged into the 2.3.46 kernel in February of 2000. Since that time, Richard has stopped maintaining it, though a number of issues remain. During the 2.5 release cycle others such as Andrey Borzenkov have contributed fixes, though problems evidently remain with the actual design.

As early as 2001, Greg Kroah-Hartman began developing udev, working to implement the same functionality as devfs, but in userspace. Currently at version 010 [story], though not complete, udev is quite functional. For a good understanding of how it works, refer to this pdf from Greg's 2003 OLS talk. During the recent lkml discussion, 2.6 maintainer Andrew Morton acknowledged that though it has "architectural/cleanliness issues [...] devfs shall remain in 2.6 and shall continue to be supported." He went on to explain:

"Nor would I recommend that devfs be removed early from 2.7.x. We should wait until the proposed udev/sysfs solutions have matured in 2.6 and have proven themselves in the field. Only then will we be in a position to confirm that devfs can be removed without causing some people unacceptable levels of grief. There is no rush."


From: Bradley W. Allen [email blocked]
To:  linux-kernel
Subject: Re:  DevFS vs. udev
Date: Tue, 23 Dec 2003 03:51:58 -0800

DevFS was written by an articulate person who solved a lot of
problems.  udev sounds more like a thug who's smug about winning,
not explaining himself, saying things like "oh, the other guy
disappeared, so who cares, you have to use my code, too bad it sucks".

Just by what the udev people have said I have decided never to use it,
and to return to DevFS.  Thank god for linux-kernel archives.

A few points:

*  User space is slow, causing all sorts of extra work for device
   accesses.
*  Another layer of filesystem for udev to have to interact with
   is also slow, especially if it has to be disk based with all sorts
   of extra caches, and also if it's with buggy tmpfs code and layers.
*  Most of the interesting devices I have now are character devices,
   and have multiple potential /dev entries per device.  I've heard
   that udev can't even handle that requirement!
   Udev has lots of other problems, like something called an anonymous
   device, and it not being fully implemented, however, that's OK for
   development.  We're in 2.6.0, now, so that's not OK!  DevFS has been
   solid for over half a decade, so it belongs in stable kernels.
*  Many times a broken record comes out with claims.  Here are a few:
   "... there are still unfixable devfs bugs in the code." without
   any examples, so I don't believe him (Greg K-H).  Others have looked
   and not found that.
*  Userspace is not the proper place for kernel device drivers or
   anything they need to work.
*  We do not need the same old maintainer for devfs.  We can create
   new code, and maintain old code, as a group, ourselves.
*  Greg K-H (what that dash is for I can't imagine) claims that DevFS
   is experimental and proof of concept; well, it has been in production
   use for over half a decade, which in the life of Linux is pretty long.
   It's certainly not just some experiment any more.
*  Greg K-H refers to "hahahaha" and "the OLS paper" and "sysfs",
   things that most Linux kernel compilers, linux-kernel readers, and
   DevFS users (including lots of admins) have probably never ever
   heard of except the bad attitude of the hahaha part.
*  Someone named viro said "the latter had stayed, period" refering to
   udev, which means absolutely nothing, but expected it to mean
   something.
*  Viro also said that devfs had been "shoved" into the tree, and
   that it "had stayed around for many months".  It's been stable for
   many *YEARS*, for most of a *DECADE*.

I've spent two hours on this problem, and that's absurd; stable shouldn't
be doing this sort of thing to us.  Yes, we know there are things that
happen during transition from development to stable, but to have some
terrorist hijack part of the kernel and destroy it right at the begin-
ing of stable is simply criminal thinking.  Luckily, this is just
software, so we can do what we want with it, but organizationally it
is conceptually just as bad.


From: Paul Dickson [email blocked] Subject: Re: DevFS vs. udev Date: Tue, 23 Dec 2003 07:30:52 -0700 On Tue, 23 Dec 2003 03:51:58 -0800, Bradley W. Allen wrote: > DevFS was written by an articulate person who solved a lot of > problems. udev sounds more like a thug who's smug about winning, > not explaining himself, saying things like "oh, the other guy > disappeared, so who cares, you have to use my code, too bad it sucks". > > Just by what the udev people have said I have decided never to use it, > and to return to DevFS. Thank god for linux-kernel archives. Nice piece of FUD you've written without really understanding what devfs and udev do. This devfs vs udev issue has become emotional, and it's starting to slip into name calling. Devfs had reached its design limits and the maintainer gave up on it, mostly because the support was too painful for other kernel developers. It's still in 2.6, just don't expect fixes for areas that don't (and can't) work. I use devfs for my router I threw together, but I fully expect to switch to udev once all the missing /dev support is added in 2.6.1 or 2.6.2. Devfs is deprecated. This means it's still available but you should consider moving to other options when available. Obsolete means it shouldn't be used. Some 2.6 docs have confused these two terms WRT devfs. > A few points: > > * User space is slow, causing all sorts of extra work for device > accesses. > * Another layer of filesystem for udev to have to interact with > is also slow, especially if it has to be disk based with all sorts > of extra caches, and also if it's with buggy tmpfs code and layers. udev is not used for device access. The /dev devices are no slower than a static /dev directory or a devfs /dev directory. > * Most of the interesting devices I have now are character devices, > and have multiple potential /dev entries per device. I've heard > that udev can't even handle that requirement! > Udev has lots of other problems, like something called an anonymous > device, and it not being fully implemented, however, that's OK for > development. We're in 2.6.0, now, so that's not OK! DevFS has been > solid for over half a decade, so it belongs in stable kernels. Udev is not a finished or fully functional project in 2.6.0, but neither is devfs (and, as you mentioned, devfs has had five years). > * Many times a broken record comes out with claims. Here are a few: > "... there are still unfixable devfs bugs in the code." without > any examples, so I don't believe him (Greg K-H). Others have looked > and not found that. A large chunk of devfs code was removed during 2.5 development if I recall correctly. I believe is was mostly unused so I haven't missed it. Perhaps you should depend on the hearsay of others. Either listen to the kernel developers or figure out the locking code within the kernel yourself. > * Userspace is not the proper place for kernel device drivers or > anything they need to work. Device drivers do not need /dev to function, only userspace needs these. Configuring userspace should be done in userspace, IMHO. > * We do not need the same old maintainer for devfs. We can create > new code, and maintain old code, as a group, ourselves. As I mentioned, devfs had reach limits in it's design and to push past this would require added complexity to other areas of the kernel. Complexity that would make maintainability harder. Designs that don't work are eventually replaced with those that do. > * Greg K-H (what that dash is for I can't imagine) claims that DevFS > is experimental and proof of concept; well, it has been in production > use for over half a decade, which in the life of Linux is pretty long. > It's certainly not just some experiment any more. Careful, you're starting to drop into name calling. Devfs has problems. It's being replace during the life of the 2.6 kernel with something that hopefully won't have as many problems. This is the norm for software development. > * Greg K-H refers to "hahahaha" and "the OLS paper" and "sysfs", > things that most Linux kernel compilers, linux-kernel readers, and > DevFS users (including lots of admins) have probably never ever > heard of except the bad attitude of the hahaha part. So udev documentation is a bit scarce. So don't use it. Continue to use devfs or a static /dev until you find documentation good enough for you to understand or you find some else's example to copy. > * Someone named viro said "the latter had stayed, period" refering to > udev, which means absolutely nothing, but expected it to mean > something. Reading http://kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ, I take the part you quote as meaning: the unfixable bugs in devfs, since the section was about devfs. > * Viro also said that devfs had been "shoved" into the tree, and > that it "had stayed around for many months". It's been stable for > many *YEARS*, for most of a *DECADE*. > > I've spent two hours on this problem, and that's absurd; stable shouldn't > be doing this sort of thing to us. Yes, we know there are things that > happen during transition from development to stable, but to have some > terrorist hijack part of the kernel and destroy it right at the begin- > ing of stable is simply criminal thinking. Luckily, this is just > software, so we can do what we want with it, but organizationally it > is conceptually just as bad. Getting closer and closer to name calling... If you don't like udev, don't use it. It's as simple as that for the moment. Since 2.6.0 shipped with devfs deprecated, it's conceivable, although unlikely, that devfs could be removed once a udev-like project is fully functional. You did not mention how you're using devfs. Your comments don't suggest a lot of experience with it either. -Paul Dickson
From: Greg KH [email blocked] Subject: Re: DevFS vs. udev Date: Tue, 23 Dec 2003 13:59:10 -0800 On Tue, Dec 23, 2003 at 03:51:58AM -0800, Bradley W. Allen wrote: > DevFS was written by an articulate person who solved a lot of > problems. udev sounds more like a thug who's smug about winning, > not explaining himself, saying things like "oh, the other guy > disappeared, so who cares, you have to use my code, too bad it sucks". Huh? I sound like a thug? I might look like one at times, smell like one lots of times, but I didn't think I typed like one... > Just by what the udev people have said I have decided never to use it, > and to return to DevFS. Thank god for linux-kernel archives. > > A few points: > > * User space is slow, causing all sorts of extra work for device > accesses. What do you mean by this. What is too slow for you? Have you timed udev vs. devfs? Yes, udev-010 now takes a whole second to band-aid over a race condition in the udev code, but that will be fixed up... And that's only 1 second from inserting a device into the system. Is this a problem with some kind of hardware or real-time devices that you are using? Do you have to be able to access the device in the least possible amount of time? If so, what's your timing constraints you are working with? > * Another layer of filesystem for udev to have to interact with > is also slow, especially if it has to be disk based with all sorts > of extra caches, and also if it's with buggy tmpfs code and layers. What "extra layer of filesystem" are you talking about? sysfs? Hey, sysfs isn't going away at all. Reading from a ramfs filesystem is _fast_, no disk accesses at all. What do you mean by "buggy tmpfs code and layers"? sysfs uses libfs and is a ramfs-like filesystem. It isn't tmpfs. And if you've found some bugs, people are interested in finding them. > * Most of the interesting devices I have now are character devices, > and have multiple potential /dev entries per device. I've heard > that udev can't even handle that requirement! Where did you hear this? It isn't true. I have a multi-port usb serial device with 16 /dev entries for a single device. Works just fine. > Udev has lots of other problems, like something called an anonymous > device, and it not being fully implemented, however, that's OK for > development. What kind of device exactly are you talking about? > DevFS has been solid for over half a decade, so it belongs in > stable kernels. 5 years stability? Hm, oh well, please check the lkml archives and the udev FAQ for the reasons why devfs is broken and can not be fixed. > * Many times a broken record comes out with claims. Here are a few: > "... there are still unfixable devfs bugs in the code." without > any examples, so I don't believe him (Greg K-H). Others have looked > and not found that. Heh, see the archives for where these claims were made by Al Viro and backed up with real examples. > * Userspace is not the proper place for kernel device drivers or > anything they need to work. What do you mean by this? Userspace is where the device node lives, on a filesystem, that's it. > * We do not need the same old maintainer for devfs. We can create > new code, and maintain old code, as a group, ourselves. Are you volunteering? > * Greg K-H (what that dash is for I can't imagine) claims that DevFS > is experimental and proof of concept; well, it has been in production > use for over half a decade, which in the life of Linux is pretty long. > It's certainly not just some experiment any more. Where did I claim this? And the '-' is part of my name, if you want you can spell the whole thing out every time. > * Greg K-H refers to "hahahaha" and "the OLS paper" and "sysfs", > things that most Linux kernel compilers, linux-kernel readers, and > DevFS users (including lots of admins) have probably never ever > heard of except the bad attitude of the hahaha part. Hm, sorry for trying to lend a bit of humor at times. My 2003 udev paper is well documented (try googling for it) and is contained in the udev tarball. sysfs is also well documented in a linux.conf.au paper by it's author, Pat Mochel. > I've spent two hours on this problem, and that's absurd; stable shouldn't > be doing this sort of thing to us. What problem is this? Have you posted with questions on how to set up udev properly for you? > Yes, we know there are things that happen during transition from > development to stable, but to have some terrorist hijack part of the > kernel and destroy it right at the begin- ing of stable is simply > criminal thinking. Luckily, this is just software, so we can do what > we want with it, but organizationally it is conceptually just as bad. I welcome you as the new devfs maintainer. I'm not forcing anyone to not use devfs, just realize that there are problems with it, and it will probably go away in the future. thanks, greg k-h /me sighs...
From: Ian Kent [email blocked] Subject: Re: DevFS vs. udev Date: Wed, 24 Dec 2003 09:52:00 +0800 (WST) On Tue, 23 Dec 2003, Greg KH wrote: > > Are you volunteering? Well I was. That was the point of my post which started this again. Sorry. Seems to me that the best way to remedy this unrest is to have someone accept maintenance of devfs and when/if it is not used to remove it from the kernel then. It certainly seems like a good project for a someone, such as myself, that is new to kernel development. However, if Andrew wants it gone from the kernel there is no point. Ian
From: Rob Love [email blocked] Subject: Re: DevFS vs. udev Date: Tue, 23 Dec 2003 21:03:57 -0500 On Tue, 2003-12-23 at 20:52, Ian Kent wrote: > It certainly seems like a good project for a someone, such as myself, that > is new to kernel development. Please take no offense to this, but it is an awful project for someone new to kernel development. Plenty of knowledgeable/semi-knowledgeable kernel hackers looked at devfs and given up on it. Despite what some people say about Richard, he is a good guy, and he did not succeed either. devfs is hard to get right and, worse, you will be starting with a bad base of code that I would not want to touch with an 18.72 foot pole. Greg, via udev, has made it so easy to just back up, slowly, and walk away from devfs. devfs is not going anywhere in 2.6, I do not think, but let sleeping piles of crap sleep and let's just jettison this thing as soon as we can. Just my two cents - I am warning you ;) Rob Love
From: Andrew Morton [email blocked] Subject: Re: DevFS vs. udev Date: Tue, 23 Dec 2003 18:38:20 -0800 Ian Kent [email blocked] wrote: > > However, if Andrew wants it gone from the kernel there is no point. I do not. devfs shall remain in 2.6 and shall continue to be supported. Richard has disappeared but Andrey Borzenkov understands devfs well and performed valuable work on it during 2.5 development. Nor would I recommend that devfs be removed early from 2.7.x. We should wait until the proposed udev/sysfs solutions have matured in 2.6 and have proven themselves in the field. Only then will we be in a position to confirm that devfs can be removed without causing some people unacceptable levels of grief. There is no rush. And yes, there are architectural/cleanliness issues with devfs. In 2.5 Adam Richter totally reinventing devfs's internals, basing it around the ramfs infrastructure. If we elect to retain devfs in 2.8 then that effort should be resurrected. Now would be a good time for someone to feed the whole thing through indent though.
From: Al Viro [email blocked] Subject: Re: DevFS vs. udev Date: Wed, 24 Dec 2003 03:41:21 +0000 On Tue, Dec 23, 2003 at 06:38:20PM -0800, Andrew Morton wrote: > And yes, there are architectural/cleanliness issues with devfs. In 2.5 > Adam Richter totally reinventing devfs's internals, basing it around the > ramfs infrastructure. If we elect to retain devfs in 2.8 then that effort > should be resurrected. Switching internals to ramfs won't be enough, though. There are problems with devfs API that can't be solved by work on internals - lifetime rules for devfs nodes make no sense. Take a look at the insertion/removal primitives and think of the lifetime rules they create for directories and user-created nodes. _That_ is independent from the way you implement the internals (and sanitized version of the interface won't fit into use of ramfs, BTW).

From: Rusty Russell [email blocked]
Subject: Re: DevFS vs. udev
Date: Wed, 24 Dec 2003 15:13:14 +1100

On Tue, 23 Dec 2003 03:51:58 -0800
"Bradley W. Allen" [email blocked] wrote:

> DevFS was written by an articulate person who solved a lot of
> problems.  udev sounds more like a thug who's smug about winning,
> not explaining himself, saying things like "oh, the other guy
> disappeared, so who cares, you have to use my code, too bad it sucks".

Badley, you've made an unvaluable contribution today.  The least I can
do is punctuate your words with my own thoughts, below:

> *  User space is slow, causing all sorts of extra work for device
>    accesses.

Hey, I didn't realize that!  It seems so unlikely.

> *  Another layer of filesystem for udev to have to interact with
>    is also slow, especially if it has to be disk based with all sorts
>    of extra caches, and also if it's with buggy tmpfs code and layers.

I hear you: if it were slow and buggy, it *would* be slow and buggy.
I had never really thought of it in that way before.

> *  Most of the interesting devices I have now are character devices,
>    and have multiple potential /dev entries per device.  I've heard
>    that udev can't even handle that requirement!

Now, I've heard that too!

>    Udev has lots of other problems, like something called an anonymous
>    device, and it not being fully implemented, however, that's OK for
>    development.  We're in 2.6.0, now, so that's not OK!  DevFS has been
>    solid for over half a decade, so it belongs in stable kernels.

And who's thinking about the poor users?  Their upturned faces, full of
trust and love: their shining lack of experience, unstained by harsh
knowledge of programming realities.  These people have needed a voice:
a hero if you will.

> *  Userspace is not the proper place for kernel device drivers or
>    anything they need to work.

Agreed.  Not to put it too harshly, these "kernel hackers" are cruel
overlords, jealously guarding their free code from the users who need it.

It's time for the USERS to rise up and speak.  But who will speak for
them?  Who?

> *  We do not need the same old maintainer for devfs.  We can create
>    new code, and maintain old code, as a group, ourselves.

You're right: WE know what we want!  All we need is someone like US:
close to the users, NOT close to the code!

> *  Viro also said that devfs had been "shoved" into the tree, and
>    that it "had stayed around for many months".  It's been stable for
>    many *YEARS*, for most of a *DECADE*.

This Viro, he's another one of these oppressive "coders", right?
It seems pretty clear that we need LESS coders making technical
decisions which effect users, an MORE users making technical
decisions!

> I've spent two hours on this problem, and that's absurd

After reading the precision and sophistication of your prose, your
grasp of technical content is clear.  Finding out that you'd spent two
hours on *anything* technical is shocking to me.

> Luckily, this is just software, so we can do what we want with it, but
> organizationally it is conceptually just as bad.

Reading this last sentence brought tears to my eyes.  Really.

I think I speak for most people on this list when I say that the kernel
NEEDS people like you like we need devfs itself.  I remember in 2.3, when
we all needed devfs badly, and that's how we got it: we needed it, and
it went in.  Now those same people who didn't want it in the first place
want it removed.

Badley, I ask you in all seriousness: will you take up the challenge,
and fill the gaping hole which we've all felt for so long in the Linux
community?  To give raw, unvarnished feedback, unconfused by the
complexities of code?

I, for one, see the future lies in your posts.
Rusty.
-- 
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy

From: Jari Soderholm [email blocked]
Subject: DEVFS is very good compared to UDEV
Date: Tue, 23 Dec 2003 23:20:18 +0200

Hello !

I am quite advanced Linux user who has used DEVFS quite
long time, and have also been a little suprised that it
has been marked OBSOLETE in 2.6 kernel.

I think that there are plenty good arguments why in many
cases it is technically better solution than udev, and
I like to give my view on that.

DEVFS is a really simple to use, compile it into kernel and configure the programs 
to use DEVFS filenames and thats it.

I think that it is very good that devicename files are out from the disk, one 
cannot delete those files, disk errors do not affect the, and searching device 
files is faster.

Booting kernel is faster compared to UDEV.

And DEVFS has worked for years for me at least very well, I haven't had any 
problems with it.

I do not understand some opinions that DEVFS uses memory.
Compared to the size of applications people run in linux
, the memory what kernel with DEVFS takes is practically
nonexistent.
I think that files in SYSFS-directory (needed by UDEV) probably take more memory 
than those in DEVFS-dir.

UDEV otherwise is very complex for average user and it
is definetly much slower , it has much greater chance
for errors because very complicated scrips which seem 
to need many different gnu commandline utilities.

It is quite funny that when DEVFS creates device files
automagically and in the ram-memory, some people want
to go backwards, and use shell scripts to 
create those files on hard disk, and then it is technically better solution.

If one you look at the /sysfs-directory there are
device filenames, (but not the actual devicefiles), so
it does same thing that DEVFS, but actually much worce
way, it created devicefilenames in the ram, but
one cannot use them, because they are not devicefiles.

Why could you develop it so that UDEV could create those
actual device files there also, then most linux
users would not need those horrible scipts anymore.
All that is then needed link from /sysfs to /dev dir.

In my option good operating system kernel should use disk and external programs 
little as possible.

T Jari Söderholm
jari.soderholm#stadia.fi


From: Rob Love [email blocked] Subject: Re: DEVFS is very good compared to UDEV Date: Tue, 23 Dec 2003 17:01:24 -0500 On Tue, 2003-12-23 at 16:20, Jari Soderholm wrote: (please use a mailer that wraps lines, in the future) > I am quite advanced Linux user who has used DEVFS quite > long time, and have also been a little suprised that it > has been marked OBSOLETE in 2.6 kernel. devfs is marked obsolete for more reasons that just the presence of udev. Devfs is also buggy, poorly designed, and unmaintained. > DEVFS is a really simple to use, compile it into kernel and configure > the programs to use DEVFS filenames and thats it. udev, in time, we be even easier than this: just install it. It will use the historic kernel naming (FHS names) so you need not change your programs, although a devfs-style naming policy is possible > I think that it is very good that devicename files are out from the disk, > one cannot delete those files, disk errors do not affect the, and searching > device files is faster. udev can store files on a tmpfs (or any other) mount, if so desired. > Booting kernel is faster compared to UDEV. Today, udev is not even involved in booting, so this cannot possible be true. If you mean running the udev initscript is slow, perhaps it is: but eventually that will not be needed. Also, udev is nascent and still under development. It has not been fine-tuned yet. > And DEVFS has worked for years for me at least very well, I haven't > had any problems with it. Lucky you. It is a mess. > I do not understand some opinions that DEVFS uses memory. > Compared to the size of applications people run in linux > , the memory what kernel with DEVFS takes is practically > nonexistent. I never heard this argument, actually, and I agree it is not an important one. > UDEV otherwise is very complex for average user and it > is definetly much slower , it has much greater chance > for errors because very complicated scrips which seem > to need many different gnu commandline utilities. The user will never have to do with the command line stuff. And udev does not involve any complicated scripts. And, as I said, I do not yet buy the slower argument. > It is quite funny that when DEVFS creates device files > automagically and in the ram-memory, some people want > to go backwards, and use shell scripts to > create those files on hard disk, and then it is technically better solution. udev is not a shell script and, as I said, udev can use _anything_ as its backing store -- whether that is a directory on your root partition, an NFS mount, or a tmpfs mount. > If one you look at the /sysfs-directory there are > device filenames, (but not the actual devicefiles), so > it does same thing that DEVFS, but actually much worce > way, it created devicefilenames in the ram, but > one cannot use them, because they are not devicefiles. sysfs is a tree of the kernel's in-memory representation of devices. We do _not_ want to put the device naming policy in the kernel. User-space should handle that. > Why could you develop it so that UDEV could create those > actual device files there also, then most linux > users would not need those horrible scipts anymore. > All that is then needed link from /sysfs to /dev dir. This was proposed before, and certainly do-able. Someone (Linus, I think?) shot it down. But this is not a huge step from current udev. Is it that big a deal whether the device nodes are created new or symlinked? It is the same solution, either way. > In my option good operating system kernel should use disk and external > programs little as possible. In my opinion, good operating system kernels should be wise to correctly delineate between what should be in user-space and what should be in the kernel. Rob Love
From: Hua Zhong [email blocked] Subject: RE: DEVFS is very good compared to UDEV Date: Tue, 23 Dec 2003 14:21:03 -0800 > On Tue, 2003-12-23 at 16:20, Jari Soderholm wrote: > > (please use a mailer that wraps lines, in the future) > > > I am quite advanced Linux user who has used DEVFS quite > > long time, and have also been a little suprised that it > > has been marked OBSOLETE in 2.6 kernel. > > devfs is marked obsolete for more reasons that just the presence of > udev. Devfs is also buggy, poorly designed, and unmaintained. I do not care about devfs, and I believe/trust udev is a better approach. But I do have sth fair to say about this "unmaintained" part. >From my memory, at some point in time, somebody (Al Viro?) reviewed devfs code and flamed the author in public (klml), throwing lots of bad impolite words to him, which I think was the biggest reason that the author stopped maintaining it. This was one of the projects that got killed by flames, or improper handling with flames (another one that comes to mind is CML2). Correct (but not flame :-) me if I am wrong.
From: Rob Love [email blocked] Subject: RE: DEVFS is very good compared to UDEV Date: Tue, 23 Dec 2003 17:30:04 -0500 On Tue, 2003-12-23 at 17:21, Hua Zhong wrote: > But I do have sth fair to say about this "unmaintained" part. > > From my memory, at some point in time, somebody (Al Viro?) reviewed > devfs code and flamed the author in public (klml), throwing lots of bad > impolite words to him, which I think was the biggest reason that the > author stopped maintaining it. This was one of the projects that got > killed by flames, or improper handling with flames (another one that > comes to mind is CML2). > > Correct (but not flame :-) me if I am wrong. Well, Al definitely shot forth many flames over devfs, for sure :) I do not know the time line of the flames vs. any decisions made by Richard, though. Some flamage was definitely earlier, when Richard was active, and some flames were definitely after Richard scaled back his kernel development. And, yes, Al flames very hard and a bit rude -- but I have never seen him wrong, that is for sure ;-) So I cannot comment over _why_ defvs is unmaintained, but that is not the point: either way, it stands that devfs is unmaintained. That is a problem in and of itself. Rob Love
From: Hua Zhong [email blocked] Subject: RE: DEVFS is very good compared to UDEV Date: Tue, 23 Dec 2003 15:00:43 -0800 > I do not know the time line of the flames vs. any decisions made by > Richard, though. I believe this is what I saw but I am not exactly sure: http://www.ussg.iu.edu/hypermail/linux/kernel/0110.3/0712.html And at that time Richard claimed he was still active. > And, yes, Al flames very hard and a bit rude -- but > I have never seen him wrong, that is for sure ;-) Me neither :-) and when he is not flaming me (which I have not got the chance yet), it's fun to read. But I hate him, you know, because I now tend to be influenced by the way he (and several others on this list) writes emails, and that's not nice in a corporate environment!! > So I cannot comment over _why_ defvs is unmaintained, but that is not > the point: either way, it stands that devfs is unmaintained. > That is a problem in and of itself. It's just my impression that around that time core developers had decided to replace devfs with a new model. If I were in ths same shoes, I would probably also stop maintaining it. Then 2 years later when somebody asks, the reason to replace my code shouldn't be "unmaintained". Just the technical reasons should be enough. :-) > Rob Love
From: Al Viro [email blocked] Subject: Re: DEVFS is very good compared to UDEV Date: Tue, 23 Dec 2003 23:26:27 +0000 On Tue, Dec 23, 2003 at 03:00:43PM -0800, Hua Zhong wrote: > Me neither :-) and when he is not flaming me (which I have not got the > chance yet), it's fun to read. But I hate him, you know, because I now > tend to be influenced by the way he (and several others on this list) > writes emails, and that's not nice in a corporate environment!! Why, thank you. It's a bit early for New Year present, but it certainly makes a good one ;-)
From: Rob Love [email blocked] Subject: RE: DEVFS is very good compared to UDEV Date: Tue, 23 Dec 2003 18:03:23 -0500 On Tue, 2003-12-23 at 18:00, Hua Zhong wrote: > Me neither :-) and when he is not flaming me (which I have not got the > chance yet), it's fun to read. But I hate him, you know, because I now > tend to be influenced by the way he (and several others on this list) > writes emails, and that's not nice in a corporate environment!! You should not hate anyone. But especially not Al. > It's just my impression that around that time core developers had > decided to replace devfs with a new model. If I were in ths same shoes, > I would probably also stop maintaining it. Then 2 years later when > somebody asks, the reason to replace my code shouldn't be > "unmaintained". Just the technical reasons should be enough. :-) Sure. But, it is unmaintained today, regardless of why, and that is a factor in deciding how to proceed. Rob Love
From: Greg KH [email blocked] Subject: Re: DEVFS is very good compared to UDEV Date: Tue, 23 Dec 2003 15:14:57 -0800 On Tue, Dec 23, 2003 at 03:00:43PM -0800, Hua Zhong wrote: > > So I cannot comment over _why_ defvs is unmaintained, but that is not > > the point: either way, it stands that devfs is unmaintained. > > That is a problem in and of itself. > > It's just my impression that around that time core developers had > decided to replace devfs with a new model. If I were in ths same shoes, > I would probably also stop maintaining it. Then 2 years later when > somebody asks, the reason to replace my code shouldn't be > "unmaintained". Just the technical reasons should be enough. :-) Back in June of 2001, Pat Mochel and I talked with Richard about this whole driver model, sysfs, and udev design at the 2001 kernel summit, after presenting it to all of the other kernel developers. He had some objections, but was very aware of what we wanted to do. It's not like udev and this whole sysfs / driver model implementation snuck into the kernel late at night when no one else was looking, and pounced on all of the poor, unsuspecting devfs users, eating them for a early morning snack. greg k-h

Related Links:

devfs, udev

Anonymous
on
December 23, 2003 - 11:06pm

Just out of curiosity, what is so important about having a pseudo `device filesystem' in the first place? I was under the impression that the original idea behind this was to save inodes (no unused /dev/* entries). With harddrives so large these days, why would anyone care to save a few kb's by adding a large chunk of kernel code instead? I don't see what is so complicated in regards to creating device nodes as opposed to the kernel creating them on the fly. Perhaps I'm being ignorant, someone please enlighten me here..

Keeping inodes for every sing

Anonymous
on
December 24, 2003 - 1:02am

Keeping inodes for every single possible device the kernel supports is annoying because there's so many of them. With devfs (and udev), a listing of the /dev directory only lists what is currently available to the kernel. It's much cleaner and practical. It's definitely not a disk space issue, since even a full device node listing wouldn't take up more than half a megabyte, and even then devfs was a virtual filesystem so it wasn't even on disk.

As for the user/kernel issue, some people think for some reason that doing the device node management inside the kernel is wrong and shouldn't be there (why?), so they developped udev. Of course the biggest excuse they have to trash devfs is actually because it has been poorly coded and nobody wants to maintain it. Personnaly I think devfs was a much smarter solution, it's just that the actual implementation was, sadly, buggy as hell (ie. device nodes permissions always screw up) and needlessly complicated (a weird configuration file, a userspace daemon that takes care of the ownership and symlinks). Not to mention the guy who designed devfs stupidly thought it was a good idea to give new names to some devices. Meanwhile, udev actually works through hotplug (I hate that thing, it doesn't do half of what it should) and has yet to offer all functionnality devfs had (ie. automatic module loading on attempting to access devices that are not loaded yet). I wish they would just make devfs not suck and it would be perfect.

devfs not sucking

Anonymous
on
December 24, 2003 - 1:37am

i think the explaination for this exercise is this: devfs is not the correct approach. IPfwadm worked. IPChains worked, but they were supplanted in thier own right. Each by something superior. Device naming policy belongs in user space. udev + sysfs is much better. Let the kernel describe itself, then let user space interpret that.

Exactly!

Anonymous
on
December 24, 2003 - 6:01am

That is the way a clean design should exist!

automatic module loading on a

Anonymous
on
December 25, 2003 - 2:45am

automatic module loading on attempting to access devices that are not loaded yet

Why on earth would you want this? Plug in a device and the device node(s) automagically appear(s). It does not make sense to access device nodes (and modules cannot be loaded anyway) for devices which are not plugged in.

I do this everytime I use my

Noth
on
December 26, 2003 - 6:41am

I do this everytime I use my floppy. I rarely use it so the module stays unloaded, but as soon as I access /dev/fd0 it's loaded and things 'just work'.

automatic module loading on a

Anonymous
on
December 25, 2003 - 2:46am

automatic module loading on attempting to access devices that are not loaded yet

Why on earth would you want this? Plug in a device and the device node(s) automagically appear(s) and all necessary modules are also automagically loaded (by hotplug). It does not make sense to access device nodes (and modules cannot be loaded anyway) for devices which are not plugged in.

Umm... It's called automatic

Anonymous
on
December 25, 2003 - 6:22am

Umm... It's called automatic module loading and it's very convenient.

When it comes to hotplug hardware it may make more sense to load modules automatically when something is plugged in, but when it comes to things like say the TUN/TAP driver it's much better to load it when the /dev/misc/net/tun device is accessed. Otherwise how do you decide when to load it?

i agree on every single word

Anonymous
on
February 18, 2004 - 3:40pm

i agree on every single word said in the post above.

Does anyone use this stuff?

molo
on
December 24, 2003 - 2:23am

Does anyone use devfs or udev here? What is the point? I've got a bunch of traditional block and char devices in my /dev.. and they work fine. Once in a while when I get some new hardware, I get to create a new one. Whoohoo. Whats the big deal with that? Why do you need all this machinery to manage device nodes?

-molo

Hrrm, I was under the impression,..

inojte
on
December 24, 2003 - 5:37am

... that the point was not to save inodes, but to lead the way to doing truly dynamic device number allocation. The linux device numbering scheme as maintained by LANANA (H. Peter Anvin, if I recall correctly) is a finite set of numbers (major and minor device numbers) statically assigned for one device to interface with the kernel. For example, the first scsi disk is 8,0, first ide disk is 3,0, first disk slice/partition on either would be 8,1 and 3,1 respectively. One begins to run out of numbers eventually. One of the items on the 2.5 todo list was to increase this space to being 32 bits in size, which was done towards the end of the 2.5 development cycle (again if I recall correctly).

The real solution that is being pursued, if I understand this at all, is dynamically assigned device numbers, so that hpa doesnt have to say to any one particular group of folks ( the video4linux group for example) that their drivers will need to use xyz set of numbers for the hardware they are trying to support. This won't scale well when the amount of hardware expands exponentially, and linux grows to being used in ever increasing amounts of hardware. Linus put a moratorium on assigning more device numbers at one point, though im not sure how long that held up. I think static device numbering schemes are what every unix system employs these days ( I could be wrong, solaris could do dynamic device number allocation, I havent looked that closely).

Since devfs never dynamically assigned numbers, only maintained namespace and cleaned up /dev and maintained permissions, I could be completely wrong as to its original purpose. Since udev monitors sysfs for devices and uses hotplug to create device nodes, it is probably actually intended to be part of some dynamic device allocation scheme.

Of course, I could also be entirely on crack, since I never really understood how devfs was supposed to be doing dynamic dev allocation in the first place, but this is my impression of these efforts as a whole. Though if anyone is taking this much time and coding effort to save a few kb in /dev though, they're probably hitting up the pipe more often than I.

the point

Anonymous
on
December 24, 2003 - 11:21am

Another big issue was to save hits to the filesystem layer. With a traditional /dev file system on disk whatever file system the parttion is formated with has to handle some of the transactions with the device node. Udev or Devfs can reduce net overhead.

Another big issue was to sa

Anonymous
on
December 25, 2003 - 3:00am

Another big issue was to save hits to the filesystem layer.

The only device access which could possibly benefit would be open(). You still have to do read()/write() to FDs just as you did with a static /dev. So nothing is saved there. With that in mind...

With a traditional /dev file system on disk whatever file system the parttion is formated with has to handle some of the transactions with the device node.

Umm... the overhead of open() is not really relevant to anything (unless we are talking about several seconds). If an application open()s device nodes so often that the filesystem overhead of open() becomes an issue, then the application is programmed incorrectly. Besides, nothing was preventing the distributions from just copying the on-disk /dev to a tmpfs (or similar) upon boot and mounting that over /dev. (Well, I realize that you would be able to directly modify /dev, but if you needed to do that you could just as well have a /realdev where the on-disk representation was.)

In short: You do not know what you are talking about.

No, you are completely correc

Anonymous
on
December 26, 2003 - 7:36pm

No, you are completely correct.

I don't care about emulating devfs, udev was created to allow persistant device naming, and allow us to never worry about the major/minor mapping anymore.

This will come in handy in 2.7 when I make all major/minor number allocation randome :)

- greg k-h

For me...

Anonymous
on
December 24, 2003 - 6:28am

...the real attraction to devfs was the ability to dynamically load and unload modules, based on device access. On my older systems, where memory is still precious, getting back 20k here and 100k there, adds up. For most modern system, with 1G+, I guess memory is a fairly silly argument. Nonetheless, when I look at the number of modules on my system and how rarely I use many of my devices, the memory does seemingly start to become attractive.

The other part of it is, sometimes I don't remember the name of every dang device that I have and find it fairly easy to simply load it's module and find the newly created entry. Bingo! Obviously, it's a lot easier to find it from a short list of available devices rather than a long list of 1000s of device names all in one location. On it's own merit, again, I imagine this to be a fairly silly argument.

Back in the day where filesystem corruption did occur from time to time, I've actually had static device nodes disappear, following the run of a fsck. Having to find the major and minor numbers, can sometimes be a pain. Having to boot into a rescue mode, create the node, and then reboot, was somewhat tedious. The use of devfs looked like an easy way to have to avoid all of that garbage. These days, the filesystems are solid. *Knock* on wood, I can't remember the last time I actually lost data from any of the filesystems. So again, perhaps this argument is both silly and outdated.

Having said all of that, and reading some of the code comments about the current devfs codebase, it's very clear that devfs needs to be canned. I also agree that the coding style is hard to read, just for starters. At any rate, I also believe that, if you're willing to buy into the need (see below) for capabiities, as much as is possible, should really be done in userspace. I have yet to see a single valid argument to support the position that devfs, or any like implementation, belongs in kernel space. In my mind, if you can't make a compelling argument for something to be in kernel space, by defacto, it belongs in user space.

I guess the actual need boils down to something very simple. In this day and age, many devices are becoming more and more transient. At the same time, Linux is becoming more and more mainstream. It's only a matter or time before Linux starts to be adopted for mainstream desktop use. As such, more and more less technically capable people are going to be needing to add and remove devices. Having a faciility available which automatically detects, configures, and loads modules, greatly increases the end-user's experience. I know I sure don't wan't to have to tell some end-user to have to start a shell, use mknod, blah...blah...blah.... That's a support concern. And a valid one at that.

I guess I'm done now. ;)

Reasons for devfs

Zombie
on
December 24, 2003 - 3:18pm

Read the "why do it" part of the devfs faq for a very thorough explanation.

Note also particularly this part:

FreeBSD has a devfs implementation. Solaris and AIX each have a pseudo-devfs (something akin to scsidev but for all devices, with some unspecified kernel support). BeOS, Plan9 and QNX also have it. SGI's IRIX 6.4 and above also have a device filesystem.

Static device creation on a general-purpose system that is used in an environment where hotplugging devices is an everyday activity (PCMCIA cards, USB devices, Bluetooth etc.) is simply braindead. Maintaining a global list of 8-bit major and 8-bit minor numbers for all devices in the world is more than braindead. Other Unix-like OS's have already shrugged off this Unix legacy. It's mind-boggling that anyone would still want to stick with it.

udev mostly fixes that problem too, of course. The devfs model has a lot of advantages over udev though. One point is that I really don't see why userspace should be involved. Yet more crap that's needed to get Linux up and running. I build embedded Linux systems, and I really don't want even more userspace bloat.

I regularly write device drivers that auto-detect the presence of hardware, and create device files based on the configuration. Being able to control this entirely from the device driver is great.

I haven't used udev yet, but I have used devfs extensively, and I've never had a problem with it (except when I tried to register a device from a tasklet, and that was my bug - devfs shouldn't have to support that). Without being aware of the internals of its implementation, I tend to generally agree with the user arguing that from a functional point of view, devfs is great, and there's no reason to deprecate it.

Re: Reasons for devfs

rhekman
on
December 25, 2003 - 8:06am

> I regularly write device drivers that auto-detect the presence of
> hardware, and create device files based on the configuration. Being
> able to control this entirely from the device driver is great.

So your driver happily goes out and starts writing bits to disk? Without the knowledge or assent of the sysadmin? All I ask is that you stay away from my kernel.

The most pressing issues are about namespaces. It's about what the kernel has available vs. what userspace can see vs. what userspace has access to. With static device numbers and device files, what users and apps can see (in the device file namespace) and what they can actually access is completely disconnected. The distro or the admin has to create device files based on magic numbers as new hardware shows up. The current solution is for the distro to throw all possible device files (based on the current LANANA database) into /dev and hope for the best. This means you can't look in /dev to see what devices are actually installed. You could delete unused items, but then you're screwed as soon as something new shows up. It also means that some coordination must be done so that the number encoded in the device file matches the type of device the kernel thinks it is, so you don't end up having a program open /dev/dsp and erase your hard drive.

OK, so the Real Solution® is to have something happen when a device becomes available (boot or insert). DevFS does this. udev does it too. So why the new way? DevFS tries to get things right the first time in kernel-space, but it can't always do the right thing. To make sure that permissions are set correctly and stay the way you set them, you have a userspace daemon and a config file and disk storage that are used to fix up the holes. The kernel part of devfs solves the problem of device files being too static by being too transient. You then get all this kernel code dealing with insert, register, remove and so on that is only used for device naming, that has races for loading and unloading, and causes debug problems compared to when it's compiled in or not.

Now with udev, all of the kernel complexity is handled by hotplug and sysfs. Hotplug is needed anyway to deal with more transient devices (USB, PCMCIA, input, etc), and sysfs is also useful for system info and power management. Instead of having sometime used kernel code in each driver for dynamic devices, you have more shared code that is simpler and used by other things that gets testing even by people that just use static /dev. When the kernel gets a plug event, it just just yells for udev, and udev comes running, figures out the situation via sysfs, consults it's config file and creates or removes devices as necessary. And by the way, if you need other things set up, like mounting that inserted USB memory key, or starting your net connection, that happens at the same time with the same infrastructure. Sysfs and hotplug are inherently dynamic. So with little extra massaging, udev can understand exactly what devices the kernel is requesting be setup, with no need for a static global device number database.

In the end, I think the new way is more maintainable, and I look forward to seeing it near completion and get used by distros.

Regards,
Reid

So your driver happily goes o

Noth
on
December 26, 2003 - 6:47am

So your driver happily goes out and starts writing bits to disk? Without the knowledge or assent of the sysadmin? All I ask is that you stay away from my kernel.

Not without your consent, if you're running devfs (and now udev) you've basically given them explicit consent to manage /dev for you.

Re: So your driver happily goes

rhekman
on
December 26, 2003 - 9:34am

Thus spake Zombie: "Being able to control this entirely from the device driver is great."

The original post did not specify he was writing devfs (or sysfs/hotplug/udev) capable drivers. I read from the above quote that the driver itself is creating device nodes. When setting up my own systems, I want "control" of devices, either through static files or via a udev config file. I don't want the device driver creating it's own nodes for userspace access, with whatever location and permissions the developer thinks is best for me.

Re: So your driver happily goes

Zombie
on
December 26, 2003 - 2:14pm

Yes, I specifically write devfs-capable drivers.

And yes, the whole point of devfs is that your device tree is virtual (i.e. the device nodes are not on disk as you seem to infer) and represents the available hardware devices at any point in time.

In my environment, having to control which device files exist is a pain. The need for a script to go along with every device driver, which is how I understand the sysfs/hotplug/udev scheme works, certainly isn't a very pleasant thing to look forward to.

Having the device drivers control which device files are present is not such a bizarre idea. The device drivers (typically) register the major/minor nodes at initialisation, based on the hardware they detect. With a static /dev, there is no link between which device file exist and if those device files actually grant access to a real device. With devfs and presumably udev, that link is automatic.

The missing bit between the device drivers and the device files is access control, controlled by the device file ownership and mode. That's a system policy decision that should definitely not be left to the device driver. Doing it statically, by creating all the device files in a file system on disk, just plain sucks for all the listed reasons in the devfs faq and then some. The way devfs does it, is not very good. For a completely new device, I want to be able to explicitly notify a user land program that understands and controls the access control logic. And that's where the sysfs/hotplug/udev scheme really seems to make the most sense. It just really seems like a pain in the butt on a system where that functionality is overkill, such as an embedded device where everything runs as root for efficiency purposes.

I build embedded Linux system

Anonymous
on
December 27, 2003 - 4:52am

I build embedded Linux systems

You are not the common case, and therefore there is no point in giving you more consideration than the average user (unless one can do so without any disadvantage to the average user). Deal.

Comparing devFS with other operating systems...

Anonymous
on
December 27, 2003 - 1:20pm

FreeBSD has a devfs implementation. Solaris and AIX each have a pseudo-devfs (something akin to scsidev but for all devices, with some unspecified kernel support). BeOS, Plan9 and QNX also have it. SGI's IRIX 6.4 and above also have a device filesystem.

----

The FreeBSD devFS implementation, from a driver view, is one directly tied to devices and not file/inodes. The layered model of devFS in this case has created a nice and well-defined design for dynamic device node allocation. The same applies to Solaris, and I bet AIX. Such an argument is not very strong for the device model that Linux uses, the devFS API is directly tied to inode/file management, a cruftier API is expected...

Embedded System

Anonymous
on
March 4, 2004 - 8:43pm

I build embedded Linux systems, and I really don't want even more userspace bloat.

I build embedded systems too, and for sure devfs is great for that purpose compared to a static /dev filesystem.

However, I dont get your point about userspace bloat. As far as i understand, the only thing you need to add in userspace is the naming, that devfs does in kernelspace. Basically you just move a mknod call from kernel space to user space. You may not need all the features and complex naming policies that udev offers, but I'm sure its not too hard to get a stripped down version of udev for embedded systems.

I've used devfs on an embedde

Anonymous
on
December 25, 2003 - 6:27am

I've used devfs on an embedded system. I wanted to save space (I booted from floppy) and also auto-detect drives and partitions when booting (I wanted this floppy to work automagically on different systems). I liked it very much... but I still have never used it on my normal systems.

I was under the impression...

Anonymous
on
December 24, 2003 - 6:10pm

...that DevFS was already mostly removed (at least severely crippled) in 2.6.0-- I recently experimented with a 2.6 kernel, and a number of devices that devfs created perfectly normally under 2.4 weren't properly created under the 2.6 kernel (but when the device files were manually made with mknod, they worked fine), like /dev/videoX for bttv and the /dev/input/eventX.

Linux

Anonymous
on
December 24, 2003 - 7:53pm

When linux was busy cloning unix didnt anyone look at this major,minor number inode shite and say "who do we need this ?"

DOS used names ..... why couldnt linux just have started out allocating devices by name dynamically during boot - much like device loading under DOS ?

If each instance of a device was given a 32bit handle and a table was used to translate names to instances then none of this nastix nix stuff need have existed. No code should use anything other than the name so why all this mknod major minor stuff, the reasons users dont get it is because it was stupid counter intuative idea in the first place

Clone a mess, you get a new mess !

DOS does dynamic device management

Anonymous
on
December 24, 2003 - 9:09pm

Hi

If you want any kind of credibility here stop talking about the way DOS did device management. You have no idea what you are talking about

Sun

Yes, people said that, but yo

Anonymous
on
December 25, 2003 - 12:41am

Yes, people said that, but you have to remember, there was an attempt to remain somewhat compatible with Unix, and a lot of Linux programmers knew how to implement things "the Unix way". (Although not like SCO would have you believe, by copying code, but because that was the way Unix-style sytems worked, and they were well documented, so people knew how to adapt the process without reimplementing the problems as well.)

One point of contention I would raise, is your suggestion that DOS is a good naming system. Simplistic, yes, but not good. Remember, A:, B:, C:, D:, E:, etc. weren't based on niceness, but on saving space. (A: is a lot less memory usage than /dev/fd0, on a number of levels, but you're more severely limited in the number of items you can use.) In addition, DOS limits you to set devices, whereas Linux/Unix allows you to "write" your own devices, with a lot more ease than DOS.

That said, DevFS can be a pain. :) Still, for an intermediate step/bandaid/tryout, it's not that bad.

?

Anonymous
on
December 25, 2003 - 1:38pm

/dev/input/eventX and /dev/videoX are created with devfs under 2.6.0.

I've been playing with udev s

Anonymous
on
December 26, 2003 - 2:49pm

I've been playing with udev since 008 here and have 011 installed. Not sure who is slow on the ball, but looks like my Microtek scanner is in /sys and is named correctly, but there is never a device created for it (sg) or for my mouse. Can watch it in syslog, but it just doesn't know what to do with them. But this might not be udev, it might be sysfs or hotplug. Added my scanner to the map in hotplug and can watch it when plug/unplug, but udev never creates a device node for it.

So I think the biggest gripe I have so far is the lack of documentation. Yes, there are man pages, but they don't go far enough to describe what is happening or why something may not be happening. The udev.rules,... look more like they are for changing,.. devices that are already created instead of trying to get something to work.
That might be something they could add to the docs, what works and what doesn't (maybe I missed it :) )

Rusty's comment

schneelocke
on
December 25, 2003 - 5:43am

"I, for one, see the future lies in your posts."

You're brilliant, Rusty. ^_^ Thanks for a hearty laugh!

--
schnee

devsf vs. udev

Anonymous
on
December 25, 2003 - 6:37am

As I am not a linux guru maybe I'm wrong at all,
but would it not be easier if :

whenever the kernel initializes a device it also creates the corresponding
device however named in whatever dir using whatever filesystem and
whatever major/minor number scheme (eventually hardcoded )

and removes this entry if the device is removed.

(same thing obviously when we load a module that initializes a device )

With no need to use external scripts, programs and other magics.

Just an Idea..................
Tito

in kernel vs user space

Anonymous
on
December 25, 2003 - 9:38pm

I'm not very good at this, not a kernel developer but just a user. But from what i've read this device block creation which is done automagically sounds nice. escpecially since we don't have to create them beforehand. It helps a lot in thin client environments (and embedded) coz to system on creates the nodes that u need. I think the issue hear is that should the kernel handle them or should a userspace prog do it.

*quote*
whenever the kernel initializes a device it also creates the corresponding
device however named in whatever dir using whatever filesystem and
whatever major/minor number scheme (eventually hardcoded )

and removes this entry if the device is removed.

(same thing obviously when we load a module that initializes a device )
*quote*

If we wanted some thing like that where would we keep the info that links the device driver and the node and the config stuffs. certainly not in the kernel. I mean it is logical that the kernel will know the events of plugging and unplugging but a userspace prog called by the kernel when these events occur is better suited for the job IMHO. In that sense i suppose udev seems suitable. Of course i could be wrong. Just my 2cents

Crazy solutions

too (not verified)
on
January 6, 2005 - 2:10pm

Kernel developers have more specific problems than overview of the design of linux alltogether, but the udev/devfs is just an example of how early linux (and most of) OS design is. Commandline tools like hotplug/modprobe is a poor but yet powerful interface between HUMAN and MACHINE but they are primarly designed for MACHINE. System configuration (devfsd.conf) is designed for MACHINE also. So all the command line should be replaced by more intuitive function calls for kernel and commandline should be just an interface to kernel itself, which would know what device driver to load, how to name a device in filesystem for it and what would be the order of loading. Windows registry is a good example of a step for better solution - user use an application regedit to edit it manually, windows and apps use dll calls and windows have fast access to it because it's not bloated ASCII configuration (where's system.ini / win.ini now ?). Give kernel a configuration file and let it do it's job without additional disk access. Reduce the need of command-line, it is an interface not the way the system runs ! make menuconfig; make systemconfig;

If you use the same major/min

Noth
on
December 26, 2003 - 6:57am

If you use the same major/minor theme you've missed half the point, major/minor numbers need to be phased out because they're hard to manage and unintuitive. Do you know what device uses major number 5?

Ideally I think most of the devs want to move to something filename based, something people can actually remember and understand.

And hardcoding the major/minor numbers and their dev path entries in the code would make things harder to maintain or at the very least no easier than it is now.

And external scripts, programs and magic are easier to test and debug than in kernel code. And as long as sysfs stays more standardized than procfs it should be simple for udev to take over for devfs.

major/minor to device class/subclass/instance

Anonymous
on
December 30, 2003 - 1:49pm

I noticed there was an old thread regarding "On re-working the major/minor system" around 2001...was this the reason for devfs/udev type of work?

Okay...IANAKH (I Am Not A Kernel Hacker) and I'm sure it's not so simple and I probably haven't considered everything but...

Can't we use the existing method of using major/minor numbers and in place of these numbers, replace them with device classes, with sub classes of devices?

We could have device classes, subclasses, instances of a device, aliases of the device, dependencies (ex: if a device is on a bus, then it depends on the bus device) and if need be (although if I understand things correctly this type of information is maintained by sysfs) device setting. One of the aliases could also contain the former major/minor number to allow for backward compatibility in dev_t usage.

I would guess though you would have to identify peer devices (similar classes of devices) and synchronize the class/subclass hiearchy. This would of course still have the same static class/subclass-major/minor allocation aspect, but it solves the desire to have more meaningful entries in /dev.

That being said though, I'm guess this doesn't really complete solve the need for dynamic naming, unless you consider the instant of the device to be dynamic and all the upper level devices to be static.

With the class/subclass you could have shared code for each and take advantage of existing code.

You could also try and maintain some level permission/access related matters in the shared code for handling this. I could see the kernel needs to own device...userspace needs to work with the devices and should never be allows to change this. Items contains on the device would be a separate issue.

Although I'm thinking the whole idea of the major/minor was probably originall for efficiency sake, allowing for table lookup type of functionality and avoiding additional overhead maintaining dynamic types of information. Or it may have been related to POSIX compliance, and backward compatibility issues.

Is there any value or truth to this?

Eric Bresie
ebresie@usa.net

I like devfs, but...

Anonymous
on
December 26, 2003 - 8:32am

Obviously, there are soem technical problems with devfs, otherwise it wouldn't generate so much derision. But having been a user of devfs, and having written one small device, I have to admit to liking it. I haven't tried udev for comparision, but devfs is a damn site better than "traditional" device creation.

Major and minor numbers are a huge pain. Likewise, creating device nodes on disk for all possible devices is moronic. Furthermore, traditional device names are useless. What's /dev/sdc? Could be a scsi disk, or a SCSI cd-rom drive, or a USB storage device, or a IDE cd-burner with SCSI emulation. With devfs, it's /dev/cdroms/cdrom0; novel concept - it actually makes sense. Furthermore, that's not a "magic" file sitting on your disk, it's a virtual filesystem created by the kernel dynamically. If you don't have a device, it doesn't show up.

Furthermore, the process (programmaticaly) for creating a device within the kernel is much simpler than the "traditional" method, and requires nothing from the user.

Even if udev solves the same problems and is superior to devfs, I do not think it is fair for devfs to get the bad press it's gotten. It is such a dramatic improvement over the "old way" that it deserves a better fate. The baby is being thrown out with the bathwater - at the very least, a devfs-style heirarchical /dev should become the standard. There's no good reason why we should inflict the old crippled, cryptic device system upon ourselves any more.

the straw

Anonymous
on
December 26, 2003 - 8:49am

i think this was maybe the straw that broke it for mr gooch and probably rightly so... no matter the the state of devfs working into the future it has proven to work , i use it ... i dont know a damn thing about it but all my shit works , as i say that i trust that udev will do the same in its time... rob love said al viro was never wrong i think gooch would disagree... you guys need to code not insult each other. seems ego likes to play too

Rik van Riel writes:
> On Sat, 27 Oct 2001, Ryan Cumming wrote:
>
> > It might be more productive to provide patches or at least generate
> > constructive ideas as how to fix these problems, as you are obviously
> > quite capable of doing so.
>
> 1) yes, Al Viro is very capable of sending in devfs fixes
> and he has done so in the past (IIRC around 2 months ago)

A truely horrible, busy-wait patch that was quickly superceeded by a
much cleaner patch that I wrote shortly thereafter. And was applied by
Linus in due course.

> 2) Richard Gooch then told Al he'd just started working on
> a patch to fix the problem and he'd rather fix things
> himself ... as far as I can see this hasn't happened yet

Complete fucking bullshit. Over the last several months, I've been
sending a steady stream of bugfix patches to Linus and the list, and
if you'd been paying attention, you'd notice that in time they've been
applied.

Furthermore, I've nearly finished the big rewrite of devfs which adds
proper locking and refcounting. That work was progressing nicely (but
it's a big job), although it's temporarily stalled because of some
important travel. Work on that will resume in the next couple of
weeks. There's no point sending in an incomplete version of the code.

It's beyond me why you state that there has been no progress by me
when my announcements of new devfs patches have been posted to the
list and even Linus' ChangeLog messages have shown stuff going in. If
you don't actually know what's going on, why do you bother posting on
this subject in the first place? How would you like it if I started
flaming about how long the VM code was taking to get working? Our VM
has sucked for *years*.

Regards,

Richard....

rom

Anonymous
on
December 31, 2003 - 9:02pm

I wonder if Mr Gooch is going to maintain/enhance devfs and make the patches available on his website, so in time if udev begins to suck, we'll have a sort of backup way of replacing it

Why?

Anonymous
on
December 27, 2003 - 11:58am

Why should a desktop user / generaly linux user use devfs/udev anyway? It takes more memory ( we all want to save memory don't we ) , ( less cpu usage ?) , what advantage should I have?

Simplification

Anonymous
on
December 28, 2003 - 1:29am

None of this should matter to the typical desktop user. One of the nice things that udev and devfs strive to do is dynamic creation and destruction of /dev files. This means that you will only have /dev entries for devices that you acutally have installed at any given moment.

it matters

Anonymous
on
December 29, 2003 - 6:27am

Of course it matters. If I plug in an USB-stick, I expect to see a /dev/sdxy entry, and I expect to see it dissapear if I plug it out.

Well exactly my point as

webstermeen@dru...
on
March 24, 2008 - 11:47am

Well exactly my point as well.
Memory is the key and if you lose it in this manner its not worth it imo.

comparision to solaris (not a flame)

Anonymous
on
January 6, 2004 - 4:51am

There are points of comparision with solaris. It may be instructive to read the documentation on docs.sun.com.

This is from my rusty memory : SPARC kit uses OpenBoot firmware, rather than a BIOS. OpenBoot builds a device tree at boot time for static devices and bust structures. At boot, Solaris reads this and builds a /devices directory tree, in much the same way that sysfs appears to do it. Note that is is a representation of the bus and devices, no device names are applied.

User space programs then are used to populate the /dev tree. A hotplug daemon is used to watch for kernel events that indicate additional devices.

In the intel implementation, the system boots via a real-mode helper prgram that passes the device tree up to the kernel.

The solaris system can cope with hotpugging, and it can also handle dynamic reconfiguration (reallocation of system boards) in the high end equipment.

Again, this is not flamebait, only that I am interested in the comparison of the technical approach.

Regards

Neil.

As it stands now..

Anonymous
on
January 14, 2004 - 8:25pm

I'm a sysadmin, and honestly I can see this as much ado about nothing at the moment. The possible issue from my point of view is knowing what actual devices I have attached to my system, whether or not udev has been handed a module for it or not. I don't like that kind of blindness when configuring boxes.

I'm sure that over time the structure will become more transparent and udev/sysfs will begin to surprise us. Because if they don't suprise us, and I get to just sit there with a :/ dumb look on my face, it won't be pretty.

I think Robert Love and the rest of the fellas have a decent feel for this being the right way to do it. But, having something function in code and being useful in the workflow of reality are years apart. I, for instance, am not going to install 2.6.1 for use as of yet because I've had multiple issues with our topic of the day. I'd love to submit a bug report if I knew what the kernel devices were linked to and why it wasn't working. But.. alas, I can't. Because I have no way of knowing this without being a kernel coder. From an engineering point of view, I see the move as correct. But, from a practical shit hits the fan point of view, it's painful.

My suggestion would be to walk softly with singing the praises of an untested immature device management system. Nobody cares if it's there when it works. But, alot of people are caring now.. so If anyone has any suggestions on submitting a bug report for udev, I'd love to hear them. Keep in mind that sysadmin and programmer are not the same species. KISS. Thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.