public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Patch: 2.5.62 devfs shrink
@ 2003-02-25 10:23 Adam J. Richter
  2003-02-25 21:50 ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: Adam J. Richter @ 2003-02-25 10:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, alistair, cloos, elenstev, jordan.breeding, maneesh, scole,
	solarce

	Here is an update to my patch to shrink devfs for linux-2.5.62.
The patch is a net deletion of 2407 lines.  It contains the following new
changes:

	- Maneesh Soni submitted a patch for operation with the
	  read-copy-update code, which was extremely good timing,
	  as that code apparently got integrated into 2.5.62.

	- Fixed a bug reported by Alistair Strachan where
	  pseudo-terminals could not be allocated by non-super-user
	  processes (devfs needed to set CAP_DAC_OVERRIDE in a couple
	  of places).

	- Restore the devfs=nomount option, to accomodate a distribution
	  compatability problem reported by Steven Cole.  devfs=nomount
	  suppresses the effect CONFIG_DEVFS_MOUNT--that is, mounting
	  of /dev before the kernel invokes /sbin/init.  Note: perhsps
	  we should eliminate CONFIG_DEVFS_MOUNT entirely.  I'll have
	  to check to see if it is needed by systems that boot directly
	  to a hardware device rather than to an initial ramdisk.


	Presumably because of the size of all of the "-" lines in the
patch, the linux-kernel mailing list filters it out, so I'll just post
a URL for it:

ftp://ftp.yggdrasil.com/pub/dist/device_control/devfs/smalldevfs-2.5.62-v10.patch

	Also, here is the URL for the latest devfs_helper user level
program (version 0.2, unchanged).  It is a reduced functionality
replacement for devfsd.

ftp://ftp.yggdrasil.com/pub/dist/device_control/devfs/devfs_helper-0.2.tar.gz


	I'll also describe my "to do" list for this software, in case
anyone spots something I've forgotten:

		- Submit a patch to the -mm kernels, as Andrew has been
		  kind enough to distribute this change in his -mm kernels.
		- Write a small FAQ list on moving from old devfs.
		- Remove CONFIG_DEVFS_MOUNT?
		- Probably request integration after linux-2.7.0.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Patch: 2.5.62 devfs shrink
@ 2003-02-26  2:47 miltonm
  0 siblings, 0 replies; 12+ messages in thread
From: miltonm @ 2003-02-26  2:47 UTC (permalink / raw)
  To: Dave Jones; +Cc: linux-kernel

The real fix cset is below and was applied long ago (dated Jan 5), and indeed
reading carefully bugzilla #110

  "2.5.55 boots ok with no workarounds needed, but 2.5.54 fails"


akpm@digeo.com|ChangeSet|20030106035042|11703


1.879.2.22 03/01/05 19:50:42-08:00 akpm@digeo.com 15796 15795 00003/00000/00001

[PATCH] devfs mount-time readdir fix and cleanup


milton

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Patch: 2.5.62 devfs shrink
@ 2003-02-27 23:13 Adam J. Richter
  2003-02-28  0:00 ` Miquel van Smoorenburg
  2003-02-28  1:37 ` Andrew Walrond
  0 siblings, 2 replies; 12+ messages in thread
From: Adam J. Richter @ 2003-02-27 23:13 UTC (permalink / raw)
  To: akpm
  Cc: alistair, cloos, elenstev, jordan.breeding, linux-kernel, maneesh,
	scole, solarce

On Tue, 25 Feb 2003, Andrew Morton wrote, about my devfs code shrink:
>Adam, could you please provide a description of the incompatibilities between
>this implementation and the present one?  For both kernel and userspace.

	OK.  Here is a first draft of what I plan to put in
linux/Documentation/filesystems/devfs/small-devfs.  Corrections and
comments are welcome.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."


---------------------------CUT HERE----------------------------------

This document describes the differences between Richard Gooch's
original devfs and my "small" devfs.

This new devfs replaces the internal devfs file system with one
derived from ramfs, a reduction of more than 2400 lines of source
code, although file systems based on ramfs rely on the 345 line
file fs/libfs.c.


User level differences:

1. devfsd replaced by devfs_helper

	devfs_helper implements a subset of devfsd functionality.
devfsd is not a deamon.  Instead, the new devfs invokes devfs_helper
with argument for each event.  The new devfs currently only calls
devfs_helper for "LOOKUP" and "REGISTER" events.  devfs_helper
uses the existing /etc/devfsd.conf file and supports devfsd's regular
expression matching.  Like devfsd, devfs_helper is optional.  It is
available from the following FTP directory.

	ftp://ftp.yggdrasil.com/pub/dist/device_control/devfs/


2. Old device names not automatically installed.

   Unlike devfsd, devfs_helper does not install old "compatible"
   device names.  This keeps devfs_helper small, which is particularly
   important since devfs_helper is invoked repeatedly.

   If you want to install a bunch of alternate device
   names (such as /dev/hda1 for /dev/ide/host0/bus0/target0/lun0/part1),
   you can do this at boot time after /dev has been mounted.  For
   example, you could maintain a tree of device nodes to overlay
   on /dev in, say /dev.overlay, and then add something like the
   following to a boot script:

	( cd /dev.overlay && tar cf - ) | ( cd /dev && tar xfp - )

   Note that you should not use "cp" or even "cp -a" for this
   operation, as that "cp" will always try to open devices and
   read from them.

   If you want to save the current /dev every time you shut your
   system down, you could add a line like the following to a
   halt script:

	( cd /dev && tar cf - ) | ( cd /dev.overlay && tar xfp - )

   Note that if you want to support booting both with and without
   devfs, a simpler approach might be to convert your non-devfs
   system to use devfs-style names, at least for the devices that
   are needed for booting (/dev/vc/0, /dev/vc/1... for virtual
   consoles, /dev/discs/disc0/disc for the first whole hard disk,
   /dev/discs/discs0/part1 for the first partition of the first
   disk, /dev/floppy/0).


3. Future: DEVFS_MOUNT and "devfs=nomount" may disappear.

   The option to have the kernel automatically mount /dev may
   disappear in the future.  As with old devfs, you can already
   eliminate this feature by not defining DEVFS_MOUNT.  If you
   do this, the kernel will not be able to open /dev/console
   before invoking /sbin/init.  Eliminating DEVFS_MOUNT shrinks
   the kernel, allowing this functionality to be provided by
   user level programs (which don't necessarily remain resident
   in memory and which may want to do something different anyhow).
   The init program can do something like the following untested
   code to mount /dev and open /dev/console:

	mount("", "/dev", "devfs", 0, NULL);
	close(0); close(1); close(2);	/* Just to make sure. */
	open("/dev/console", O_RDONLY); /* This will return fd 0. */
	open("/dev/console", O_WRONLY); /* This will return fd 1. */
	dup2(1, 2);			/* stderr = stdout. */


4. Partition table support now matches non-devfs systems (i.e., no
   automatic partition table rereading, which was causing problems).

	The old devfs would automatically reread partition tables
at various times.  This was a functional difference with non-devfs
systems, and made it nearly impossible to use drivers that returned
incorrect "media changed" information such as with CompactFlash cards
on systems that used user level partition reading programs like partx
to keep the kernel small.  Basically, the old devfs would make the
kernel forget CompactFlash partition tables on nearly every operation.
This misfeature is removed in smalldevfs.  smalldevfs systems now
handle partition tables just like non-devfs systems.


Kernel differences:

5. "ops" argument to devfs_register is temporarily ignored

	If you are using devfs to register a character or block
device, you should not notice any difference.  The difference is that
the ops argument to devfs_register is currently ignored.  So, for the
time being, access to all devices still go through major and minor
device numbers.  Eventually, I would like to restore the functionality
of potentially eliminating major and minor device numbers, but, for
now, this functionality is temporarily gone.

	Because this functionality is gone, you can only register
character or block devices to get device-like behavior.  The only
users of this functionality were a couple of interfaces that
duplicated /proc interfaces.  They were removed from the kernel
recently anyhow.

	In the future, I hope to restore this functionality in a way
that will allow even more device support code to removed (or
"configured out") as a result than under the old devfs.  So, please
continue to pass the character or block device operations pointer to
devfs_register, even if devfs_register is currently not using it.


5a. devfs_only() always returns 0

	devfs_only() is supposed to return 1 on systems that always
use the ops field in devfs_register and therefore do not need to
reference devices by number.  Because of #2, devfs_only() currently
always return 0.  This should change in the future, so please do not
delete code that tests devfs_only().  The compiler will optimize out
the unnecessary code in the meantime.


Adam J. Richter
adam@yggdrasil.com

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Patch: 2.5.62 devfs shrink
@ 2003-02-28  2:49 Adam J. Richter
  0 siblings, 0 replies; 12+ messages in thread
From: Adam J. Richter @ 2003-02-28  2:49 UTC (permalink / raw)
  To: andrew; +Cc: linux-kernel

On Fri, 28 Feb 2003, Andrew Walrond wrote:
>I assume you meant devfs_helper here:

> > devfsd is not a deamon.  Instead, the new devfs invokes devfs_helper
>   ------

	Right.  I've checked in the fix.  Thanks.


>Looks good to me. I want to give this another whirl, but your latest 
>patch doesn't apply cleanly against 2.5.63+ (fs/devfs/base.c fails). Any 
>chance of an update?

	I've just come across a bug with in in 2.5.63 where
devfs_helper hangs while trying to down a semaphore.  I think it is
doing down(&dir->i_sem) in some lookup routine in fs/namei.c.
I am trying to figure out what exactly inode->i_sem protects
so I can determine if it is OK for the routine that calls
defvs_helper to release it and reacquire it when devfs_helper
exits.  Once I think I've fixed this, I'll post a new patch.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: Patch: 2.5.62 devfs shrink
@ 2003-02-28  3:14 Adam J. Richter
  2003-02-28  4:03 ` Miles Bader
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Adam J. Richter @ 2003-02-28  3:14 UTC (permalink / raw)
  To: miquels; +Cc: linux-kernel

miquels@cistron-office.nl wrote:
>If you're making it not 100% compatible anyway, now is the time
>to do away with that horrible 'disc' spelling ;). 'disk' is a
>harddisk or floppy disk, 'disc' is for compact disc (try Google
>on both spellings and you'll see that the world agrees ..).
>Just do s/disc/disk/g in devfs_register().

	The names of devices are not chosen by fs/devfs/*.[ch].  They
are chosen by the client code in device drivers and elsewhere that
call call devfs.  In the case of the /dev/discs/ names, they are
chose by devfs_{create,remove}_partitions in fs/partitions/check.c,
which, from the comments, was apparently written by Linus Torvalds
and Russell King.

Tangential note:	

	For what it's worth, my preference would be to change from
/dev/discs/disc0/part1 to /dev/disk/0/part1, but I think it would
probably do more harm than good to try to coordinate such a change
with switching devfs.  If you want to try to make a change where
people will eventually have to update their systems, I think it would
probably make more sense to survey existing devfs naming practices and
try to come up with some recommendations harmonize them a bit.  For
example, should the directory names be singular or plural (/dev/loop
or /dev/loops, /dev/disk or /dev/disks)?  I would recommend signular
because it is less English-centric.  There are probably four or five
recommendations like these that could be put into a Documentation
file.  More consistent naming schemes in anything tend to make
a system more readily usable.

Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2003-02-28 12:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-25 10:23 Patch: 2.5.62 devfs shrink Adam J. Richter
2003-02-25 21:50 ` Andrew Morton
2003-02-26  0:51   ` Dave Jones
  -- strict thread matches above, loose matches on Subject: below --
2003-02-26  2:47 miltonm
2003-02-27 23:13 Adam J. Richter
2003-02-28  0:00 ` Miquel van Smoorenburg
2003-02-28  1:37 ` Andrew Walrond
2003-02-28  2:49 Adam J. Richter
2003-02-28  3:14 Adam J. Richter
2003-02-28  4:03 ` Miles Bader
2003-02-28  8:08 ` Andreas Jellinghaus
2003-02-28 12:50 ` Helge Hafting

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox