umsdos FS in 2.6.x
RFC PATCH 1/1 umsdos FS in 2.6.x
This patch enables umsdos filesystem to build, although a few things still need to be fixed, such as:
. updating {acm}time, since those fields changed from time_t to
struct timespec: for backward compatibility, do these fields need to remain as time_t (i.e., keep the same size) ?
. I kept using a 16-bit dev_t. Does this need to change?
If yes, to 32-bit, or to use whatever size is passed to it?
. fill_super/read_super probably still need a little bit of work,
such as which inode_operations structure to use.
. I'll begin testing it soon.
--
~Randy
Quoted 3 lines
Hi folks,
Does kernel 2.6 supports UMSDOS file system?
Not unless it gets very massive fixes. (--viro)
fs/Kconfig | 6 +-- fs/umsdos/Makefile | 4 +- fs/umsdos/dir.c | 25 +++++++++------ fs/umsdos/inode.c | 71 ++++++++++++++++++++++++++++++++------------ fs/umsdos/ioctl.c | 17 ++++++---- fs/umsdos/namei.c | 2 + fs/umsdos/rdir.c | 1 include/linux/umsdos_fs.p | 14 +++----- include/linux/umsdos_fs_i.h | 4 ++ 9 files changed, 96 insertions(+), 48 deletions(-)
include/linux/umsdos_fs_i.h +4 -0
@@ -55,4 +55,8 @@ struct umsdos_inode_info { off_t pos; /* Entry offset in the emd_owner file */ }; +static inline struct umsdos_inode_info *UMSDOS_I (struct inode *inode) +{ +return (struct umsdos_inode_info *)inode->u.generic_ip; +}#endif
include/linux/umsdos_fs.p +6 -8
@@ -37,8 +37,10 @@ void UMSDOS_write_inode (struct inode *, int UMSDOS_notify_change (struct dentry *, struct iattr *attr); int umsdos_notify_change_locked(struct dentry *, struct iattr *attr); void UMSDOS_put_inode (struct inode *); -int UMSDOS_statfs (struct super_block *, struct statfs *); -struct super_block *UMSDOS_read_super (struct super_block *, void *, int); +struct statfs; +int UMSDOS_statfs (struct super_block *, struct kstatfs *); +int UMSDOS_read_super (struct super_block *, void *, int, + struct inode_operations *, int); void UMSDOS_put_super (struct super_block *); void umsdos_setup_dir(struct dentry *);
@@ -74,7 +76,8 @@ int UMSDOS_link (struct dentry *olddentr struct dentry *dentry); int UMSDOS_create (struct inode *dir, struct dentry *dentry, - int mode); + int mode, + struct nameidata *nd); int UMSDOS_mkdir (struct inode *dir, struct dentry *dentry,
@@ -93,8 +96,3 @@ int UMSDOS_rename (struct inode *old_dir /* rdir.c 22/03/95 03.31.42 */ struct dentry *umsdos_rlookup_x (struct inode *dir, struct dentry *dentry, int nopseudo); struct dentry *UMSDOS_rlookup (struct inode *dir, struct dentry *dentry, struct nameidata *nd); - -static inline struct umsdos_inode_info *UMSDOS_I(struct inode *inode) -{ - return &inode->u.umsdos_i; -}
fs/Kconfig +3 -3
@@ -621,9 +621,9 @@ config VFAT_FS vfat. config UMSDOS_FS -#dep_tristate ' UMSDOS: Unix-like file system on top of standard MSDOS fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS -# UMSDOS is temprory broken - bool + tristate ' UMSDOS: Unix-like file system on top of standard MSDOS fs' + depends on MSDOS_FS || BROKEN +# UMSDOS is BROKEN until someone spends some time to fix it help Say Y here if you want to run Linux from within an existing DOS partition of your hard drive. The advantage of this is that you can
fs/umsdos/inode.c +53 -18
163 lines not on this page · raw message
fs/umsdos/ioctl.c +10 -7
@@ -402,9 +402,10 @@ new_dentry->d_parent->d_name.name, new_d data.stat.st_ino = inode->i_ino; data.stat.st_mode = inode->i_mode; data.stat.st_size = inode->i_size; - data.stat.st_atime = inode->i_atime; - data.stat.st_ctime = inode->i_ctime; - data.stat.st_mtime = inode->i_mtime; +/* TBD: fix times */ +///data.stat.st_atime = inode->i_atime; +///data.stat.st_ctime = inode->i_ctime; +///data.stat.st_mtime = inode->i_mtime; ret = -EFAULT ;if (!copy_to_user (&idata->stat, &data.stat,sizeof (data.stat)))
@@ -414,6 +415,7 @@ new_dentry->d_parent->d_name.name, new_d goto out; }else if (cmd ==UMSDOS_DOS_SETUP ) { +struct msdos_sb_info *msdossbi = (struct msdos_sb_info *)dir->i_sb->s_fs_info;/* #Specification: ioctl / UMSDOS_DOS_SETUP * The UMSDOS_DOS_SETUP ioctl allow changing the * default permission of the MS-DOS filesystem driver
@@ -433,10 +435,11 @@ new_dentry->d_parent->d_name.name, new_d* umsdos_dirent.uid and gid sets the owner and group. * umsdos_dirent.mode set the permissions flags. */ - dir->i_sb->u.msdos_sb.options.fs_uid = data.umsdos_dirent.uid; - dir->i_sb->u.msdos_sb.options.fs_gid = data.umsdos_dirent.gid; - dir->i_sb->u.msdos_sb.options.fs_fmask = - dir->i_sb->u.msdos_sb.options.fs_dmask = + msdossbi->options.fs_uid = data.umsdos_dirent.uid; + msdossbi->options.fs_gid = data.umsdos_dirent.gid; + msdossbi->options.fs_fmask = + data.umsdos_dirent.mode; + msdossbi->options.fs_dmask = data.umsdos_dirent.mode; ret =0 ; }
fs/umsdos/Makefile +2 -2
@@ -2,9 +2,9 @@ # Makefile for the umsdos Unix-like filesystem routines. # -obj-$(CONFIG_UMSDOS) += umsdos.o +obj-$(CONFIG_UMSDOS_FS) += umsdos.o -umsdos-objs := dir.o inode.o ioctl.o mangle.o namei.o rdir.o emd.o +umsdos-objs := dir.o inode.o ioctl.o mangle.o namei.o rdir.o emd.o p: proto *.c >/usr/include/linux/umsdos_fs.p
fs/umsdos/namei.c +2 -0
@@ -16,10 +16,12 @@#include <linux/time.h> #include <linux/types.h> #include <linux/fcntl.h> +#include <linux/sched.h> #include <linux/stat.h> #include <linux/string.h> #include <linux/msdos_fs.h> #include <linux/umsdos_fs.h> +#include <linux/umsdos_fs_i.h> #include <linux/slab.h> #define UMSDOS_DIR_LOCK
fs/umsdos/rdir.c +1 -0
@@ -14,6 +14,7 @@#include <linux/stat.h> #include <linux/limits.h> #include <linux/umsdos_fs.h> +#include <linux/umsdos_fs_i.h> #include <linux/slab.h> #include <linux/smp_lock.h>
fs/umsdos/dir.c +15 -10
@@ -15,6 +15,7 @@#include <linux/stat.h> #include <linux/limits.h> #include <linux/umsdos_fs.h> +#include <linux/umsdos_fs_i.h> #include <linux/slab.h> #include <linux/pagemap.h> #include <linux/smp_lock.h>
@@ -368,13 +369,16 @@ void umsdos_lookup_patch_new(struct dentif (UMSDOS_I (inode)->i_patched) goto out;UMSDOS_I (inode)->i_patched =1 ; -if (S_ISREG (entry->mode)) - entry->mtime = inode->i_mtime; +/* TBD: fix mtime */ +///if (S_ISREG (entry->mode)) +///entry->mtime = inode->i_mtime; inode->i_mode = entry->mode; - inode->i_rdev =to_kdev_t (entry->rdev); - inode->i_atime = entry->atime; - inode->i_ctime = entry->ctime; - inode->i_mtime = entry->mtime; +/* TBD: still using 16-bit dev_t; is this a problem? */ + inode->i_rdev =old_decode_dev (entry->rdev); +/* TBD: fix times */ +///inode->i_atime = entry->atime; +///inode->i_ctime = entry->ctime; +///inode->i_mtime = entry->mtime; inode->i_uid = entry->uid; inode->i_gid = entry->gid;
@@ -593,7 +597,7 @@ struct dentry *umsdos_covered(struct den dentry =d_alloc (parent, &qstr);if (dentry) {/* XXXXXXXXXXXXXXXXXXX Race alert! */ - result =UMSDOS_rlookup (parent->d_inode, dentry); + result =UMSDOS_rlookup (parent->d_inode, dentry,NULL );d_drop (dentry);if (result) goto out_fail;
@@ -628,8 +632,8 @@ struct dentry *umsdos_lookup_dentry(stru dentry =d_alloc (parent, &qstr);if (dentry) { result = real ? -UMSDOS_rlookup (parent->d_inode, dentry) : -UMSDOS_lookup (parent->d_inode, dentry); +UMSDOS_rlookup (parent->d_inode, dentry,NULL ) : +UMSDOS_lookup (parent->d_inode, dentry,NULL );if (result) goto out_fail;return dentry;
@@ -655,7 +659,8 @@ char * umsdos_d_path(struct dentry *dent old_root =dget (current->fs->root);read_unlock (¤t->fs->lock);spin_lock (&dcache_lock); - path =__d_path (dentry, current->fs->rootmnt, dentry->d_sb->s_root, current->fs->rootmnt, buffer, len);/* FIXME: current->fs->rootmnt */ +/* FIXME: current->fs->rootmnt: */ + path =d_path (dentry, current->fs->rootmnt, buffer, len);spin_unlock (&dcache_lock);if (*path =='/' )
Quoted 8 lines · Randy.Dunlap
This patch enables umsdos filesystem to build, although a few things still need to be fixed, such as:
. updating {acm}time, since those fields changed from
time_tto
struct timespec: for backward compatibility, do these fields need to remain astime_t(i.e., keep the same size) ?
Quoted 7 lines
. I kept using a 16-bit
dev_t. Does this need to change?
If yes, to 32-bit, or to use whatever size is passed to it?. fill_super/read_super probably still need a little bit of work,
such as whichinode_operationsstructure to use.. I'll begin testing it soon.
* struct inode reuse between msdos and umsdos is FUBAR. Allocation/freeing of inode is controlled by its ->i_sb. So is location of struct inode within the allocated object. That's where umsdos got really broken and AFAICS the only more or less sane way to handle that crap is separation of msdos and umsdos inode/dentry/superblock, so that the latter would refer the former.
The rest is more or less trivial; compile fixes, mostly from prototype changes for methods. Inode reuse problem is where the real PITA is and it will take a serious work to fix.