RFC/Patch - Implode devfs
Just to keep everyone up to date, here is a third iteration of
my patch converting devfs to a ramfs-based file system. This one uses an almost unmodified version of devfs/util.c to restore automatic device number allocation and devfs_{,un}register_tape().
This code now tries to implement almost all of the devfs
functionality that anything outside of arch/ia64/sn uses. The most significant except that I'm aware of is the ability to create a plain file with custom file operations, which is done the Memory Type Range Register code, but that code also provides a proc interface for the same thing, and I think the proc interface is what everyone uses right now anyhow.
If Christoph's patch for deleting a bunch of unused stuff from
devfs gets into 2.5.54, that should make my patch smaller, and I'll post a new version then. If nobody objects, then perhaps I'll make that version replace fs/devfs rather than creating a separate fs/mini-devfs.
Signature · 4 lines
Adam J. Richter __ ______________ 575 Oroville Road [email protected] \ / 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."
include/linux/devfs_fs_kernel.h +16 -3
@@ -24,7 +24,11 @@#define DEVFS_SPECIAL_CHR 0#define DEVFS_SPECIAL_BLK 1 +#ifdef CONFIG_DEVFS_SMALL +typedef struct dentry *devfs_handle_t ; +#else typedef struct devfs_entry *devfs_handle_t ; +#endif #ifdef CONFIG_DEVFS_FS
@@ -53,10 +57,19 @@ devfs_handle_t *handle, void *info);extern devfs_handle_t devfs_mk_dir (devfs_handle_t dir,const char *name,void *info); + +extern int devfs_generate_path (devfs_handle_t de,char *path,int buflen); +extern int devfs_only (void ); + +#ifdef CONFIG_DEVFS_SMALL +extern int devfs_alloc_major (umode_t mode); +extern void devfs_dealloc_major (umode_t mode,int major); +extern dev_t devfs_alloc_devnum (umode_t mode); +extern void devfs_dealloc_devnum (umode_t mode,dev_t devnum); +#else extern devfs_handle_t devfs_get_handle (devfs_handle_t dir,const char *name,int traverse_symlinks);extern devfs_handle_t devfs_get_handle_from_inode (struct inode *inode); -extern int devfs_generate_path (devfs_handle_t de,char *path,int buflen);extern int devfs_set_file_size (devfs_handle_t de,unsigned long size);extern void *devfs_get_info (devfs_handle_t de);extern int devfs_set_info (devfs_handle_t de,void *info);
@@ -64,17 +77,17 @@extern devfs_handle_t devfs_get_first_child (devfs_handle_t de);extern devfs_handle_t devfs_get_next_sibling (devfs_handle_t de);extern const char *devfs_get_name (devfs_handle_t de,unsigned int *namelen); -extern int devfs_only (void );extern int devfs_register_tape (devfs_handle_t de);extern void devfs_unregister_tape (int num);extern int devfs_alloc_major (char type);extern void devfs_dealloc_major (char type,int major);extern dev_t devfs_alloc_devnum (char type);extern void devfs_dealloc_devnum (char type,dev_t devnum); +#endif /* !CONFIG_DEVFS_SMALL */ +extern int devfs_alloc_unique_number (struct unique_numspace *space);extern void devfs_dealloc_unique_number (struct unique_numspace *space,int number); -extern void mount_devfs_fs (void );#else /* CONFIG_DEVFS_FS */
fs/namei.c +26 -3
@@ -1377,9 +1377,9 @@ }/* SMP-safe */ -static struct dentry *lookup_create (struct nameidata *nd,int is_dir) +struct dentry *lookup_create (struct nameidata *nd,int is_dir) {struct dentry *dentry; --- linux-2.5.53/fs/Kconfig 2002-12-23 21:20:32.000000000 -0800 +++ linux/fs/Kconfig 2002-12-31 18:45:59.000000000 -0800
@@ -847,7 +847,21 @@ If unsure, say N. +config DEVFS_SMALL + bool "Smaller /dev file system (EXPERIMENTAL)" + depends onEXPERIMENTAL &&DEVFS_FS + ---help--- + New smaller devfs without automatic partition rereading + (which impeded user level partition handling) and currently + without some features used by arch/ia64/sn. + + If unsure, say N. + +config DEVFS_BIG + bool + depends on DEVFS_FS && !DEVFS_SMALL + config DEVFS_MOUNT bool "Automatically mount at boot" depends onDEVFS_FS --- linux-2.5.53/fs/mini-devfs/Makefile 1969-12-31 16:00:00.000000000 -0800 +++ linux/fs/mini-devfs/Makefile 2003-01-01 14:16:05.000000000 -0800
@@ -0,0 +1,9 @@ +# +# Makefile for the linux ramfs routines. +# + +export-objs := inode.o util.o + +obj-$(CONFIG_DEVFS_FS) += devfs.o + +devfs-objs := inode.o util.o
fs/mini-devfs/inode.c +580 -0
580 lines not on this page · raw message
fs/mini-devfs/util.c +396 -0
396 lines not on this page · raw message
Quoted 6 lines · Adam J. Richter
The most
significant except that I'm aware of is the ability to create a plain file with custom file operations, which is done the Memory Type Range Register code, but that code also provides a proc interface for the same thing, and I think the proc interface is what everyone uses right now anyhow.
There is some userspace code out there doing ioctls on /dev/mtrr The testgart app uses it, and I *think* thats what X uses.
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Quoted 7 lines · Adam J. Richter
This code now tries to implement almost all of the devfs
functionality that anything outside ofarch/ia64/snuses. The most significant except that I'm aware of is the ability to create a plain file with custom file operations, which is done the Memory Type Range Register code, but that code also provides a proc interface for the same thing, and I think the proc interface is what everyone uses right now anyhow.
Ignore other mail. -ENOTAWAKEYET
testgart uses /proc/mtrr too, and thinking about it I guess X does too, or it would break in the non-devfs case.
Dave
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs