]>
Commit | Line | Data |
---|---|---|
07a6aa79 | 1 | fs/Kconfig | 6 +-- |
2 | fs/umsdos/Makefile | 4 +- | |
3 | fs/umsdos/dir.c | 25 +++++++++------ | |
4 | fs/umsdos/inode.c | 71 ++++++++++++++++++++++++++++++++------------ | |
5 | fs/umsdos/ioctl.c | 17 ++++++---- | |
6 | fs/umsdos/namei.c | 2 + | |
7 | fs/umsdos/rdir.c | 1 | |
8 | include/linux/umsdos_fs.p | 14 +++----- | |
9 | include/linux/umsdos_fs_i.h | 4 ++ | |
10 | 9 files changed, 96 insertions(+), 48 deletions(-) | |
11 | ||
12 | diff -Naurp linux-260-test8-efs/include/linux/umsdos_fs_i.h linux-260-test8/include/linux/umsdos_fs_i.h | |
13 | --- linux-260-test8-efs/include/linux/umsdos_fs_i.h 2003-10-17 14:43:20.000000000 -0700 | |
14 | +++ linux-260-test8/include/linux/umsdos_fs_i.h 2003-10-23 16:13:10.000000000 -0700 | |
15 | @@ -55,4 +55,8 @@ struct umsdos_inode_info { | |
16 | off_t pos; /* Entry offset in the emd_owner file */ | |
17 | }; | |
18 | ||
19 | +static inline struct umsdos_inode_info *UMSDOS_I(struct inode *inode) | |
20 | +{ | |
21 | + return (struct umsdos_inode_info *)inode->u.generic_ip; | |
22 | +} | |
23 | #endif | |
24 | diff -Naurp linux-260-test8-efs/include/linux/umsdos_fs.p linux-260-test8/include/linux/umsdos_fs.p | |
25 | --- linux-260-test8-efs/include/linux/umsdos_fs.p 2003-10-17 14:43:00.000000000 -0700 | |
26 | +++ linux-260-test8/include/linux/umsdos_fs.p 2003-10-23 23:20:36.000000000 -0700 | |
27 | @@ -37,8 +37,10 @@ void UMSDOS_write_inode (struct inode *, | |
28 | int UMSDOS_notify_change (struct dentry *, struct iattr *attr); | |
29 | int umsdos_notify_change_locked(struct dentry *, struct iattr *attr); | |
30 | void UMSDOS_put_inode (struct inode *); | |
31 | -int UMSDOS_statfs (struct super_block *, struct statfs *); | |
32 | -struct super_block *UMSDOS_read_super (struct super_block *, void *, int); | |
33 | +struct statfs; | |
34 | +int UMSDOS_statfs (struct super_block *, struct kstatfs *); | |
35 | +int UMSDOS_read_super (struct super_block *, void *, int, | |
36 | + struct inode_operations *, int); | |
37 | void UMSDOS_put_super (struct super_block *); | |
38 | ||
39 | void umsdos_setup_dir(struct dentry *); | |
40 | @@ -74,7 +76,8 @@ int UMSDOS_link (struct dentry *olddentr | |
41 | struct dentry *dentry); | |
42 | int UMSDOS_create (struct inode *dir, | |
43 | struct dentry *dentry, | |
44 | - int mode); | |
45 | + int mode, | |
46 | + struct nameidata *nd); | |
47 | ||
48 | int UMSDOS_mkdir (struct inode *dir, | |
49 | struct dentry *dentry, | |
50 | @@ -93,8 +96,3 @@ int UMSDOS_rename (struct inode *old_dir | |
51 | /* rdir.c 22/03/95 03.31.42 */ | |
52 | struct dentry *umsdos_rlookup_x (struct inode *dir, struct dentry *dentry, int nopseudo); | |
53 | struct dentry *UMSDOS_rlookup (struct inode *dir, struct dentry *dentry, struct nameidata *nd); | |
54 | - | |
55 | -static inline struct umsdos_inode_info *UMSDOS_I(struct inode *inode) | |
56 | -{ | |
57 | - return &inode->u.umsdos_i; | |
58 | -} | |
59 | --- linux-260-test8-efs/fs/Kconfig 2003-10-17 14:43:15.000000000 -0700 | |
60 | +++ linux-260-test8/fs/Kconfig 2003-10-23 13:01:50.000000000 -0700 | |
61 | @@ -621,9 +621,9 @@ config VFAT_FS | |
62 | vfat. | |
63 | ||
64 | config UMSDOS_FS | |
65 | -#dep_tristate ' UMSDOS: Unix-like file system on top of standard MSDOS fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS | |
66 | -# UMSDOS is temprory broken | |
67 | - bool | |
68 | + tristate ' UMSDOS: Unix-like file system on top of standard MSDOS fs' | |
69 | + depends on MSDOS_FS || BROKEN | |
70 | +# UMSDOS is BROKEN until someone spends some time to fix it | |
71 | help | |
72 | Say Y here if you want to run Linux from within an existing DOS | |
73 | partition of your hard drive. The advantage of this is that you can | |
74 | diff -Naurp linux-260-test8-efs/fs/umsdos/inode.c linux-260-test8/fs/umsdos/inode.c | |
75 | --- linux-260-test8-efs/fs/umsdos/inode.c 2003-10-17 14:42:54.000000000 -0700 | |
76 | +++ linux-260-test8/fs/umsdos/inode.c 2003-10-23 23:18:39.000000000 -0700 | |
77 | @@ -11,16 +11,21 @@ | |
78 | #include <linux/fs.h> | |
79 | #include <linux/msdos_fs.h> | |
80 | #include <linux/kernel.h> | |
81 | +#include <linux/namei.h> | |
82 | #include <linux/time.h> | |
83 | #include <linux/errno.h> | |
84 | #include <asm/uaccess.h> | |
85 | #include <linux/string.h> | |
86 | #include <linux/stat.h> | |
87 | +#include <linux/statfs.h> | |
88 | +#include <linux/smp_lock.h> | |
89 | #include <linux/umsdos_fs.h> | |
90 | +#include <linux/umsdos_fs_i.h> | |
91 | #include <linux/list.h> | |
92 | #include <linux/pagemap.h> | |
93 | ||
94 | extern struct dentry_operations umsdos_dentry_operations; | |
95 | +extern dev_t ROOT_DEV; | |
96 | ||
97 | struct dentry *saved_root; /* Original root if changed */ | |
98 | struct inode *pseudo_root; /* Useful to simulate the pseudo DOS */ | |
99 | @@ -49,7 +54,9 @@ void UMSDOS_put_inode (struct inode *ino | |
100 | void UMSDOS_put_super (struct super_block *sb) | |
101 | { | |
102 | Printk ((KERN_DEBUG "UMSDOS_put_super: entering\n")); | |
103 | - if (saved_root && pseudo_root && kdev_same(sb->s_dev, ROOT_DEV)) { | |
104 | + if (saved_root && pseudo_root && | |
105 | + old_encode_dev(sb->s_dev) == old_encode_dev(ROOT_DEV)) { | |
106 | + /* TBD: is using 16-bit dev_t OK here? */ | |
107 | shrink_dcache_parent(saved_root); | |
108 | dput(saved_root); | |
109 | saved_root = NULL; | |
110 | @@ -150,7 +157,7 @@ dentry, f_pos)); | |
111 | inode->i_op = &umsdos_symlink_inode_operations; | |
112 | } else | |
113 | init_special_inode(inode, inode->i_mode, | |
114 | - kdev_t_to_nr(inode->i_rdev)); | |
115 | + inode->i_rdev); | |
116 | } | |
117 | ||
118 | ||
119 | @@ -282,12 +289,15 @@ dentry->d_parent->d_name.name, dentry->d | |
120 | entry->gid = cpu_to_le16(attr->ia_gid); | |
121 | if (attr->ia_valid & ATTR_MODE) | |
122 | entry->mode = cpu_to_le16(attr->ia_mode); | |
123 | + /* TBD: fix times */ | |
124 | +#if 0 | |
125 | if (attr->ia_valid & ATTR_ATIME) | |
126 | entry->atime = cpu_to_le32(attr->ia_atime); | |
127 | if (attr->ia_valid & ATTR_MTIME) | |
128 | entry->mtime = cpu_to_le32(attr->ia_mtime); | |
129 | if (attr->ia_valid & ATTR_CTIME) | |
130 | entry->ctime = cpu_to_le32(attr->ia_ctime); | |
131 | +#endif | |
132 | entry->nlink = cpu_to_le16(inode->i_nlink); | |
133 | ret=mapping->a_ops->commit_write(NULL,page,offs,offs+UMSDOS_REC_SIZE); | |
134 | if (ret) | |
135 | @@ -343,7 +353,7 @@ static struct super_operations umsdos_so | |
136 | .clear_inode = fat_clear_inode, | |
137 | }; | |
138 | ||
139 | -int UMSDOS_statfs(struct super_block *sb,struct statfs *buf) | |
140 | +int UMSDOS_statfs(struct super_block *sb, struct kstatfs *buf) | |
141 | { | |
142 | int ret; | |
143 | ret = fat_statfs (sb, buf); | |
144 | @@ -355,26 +365,27 @@ int UMSDOS_statfs(struct super_block *sb | |
145 | /* | |
146 | * Read the super block of an Extended MS-DOS FS. | |
147 | */ | |
148 | -struct super_block *UMSDOS_read_super (struct super_block *sb, void *data, | |
149 | - int silent) | |
150 | +int UMSDOS_read_super (struct super_block *sb, | |
151 | + void *data, int silent, | |
152 | + struct inode_operations *fs_dir_inode_ops, | |
153 | + int isvfat) | |
154 | { | |
155 | - struct super_block *res; | |
156 | struct dentry *new_root; | |
157 | + int res; | |
158 | ||
159 | /* | |
160 | * Call msdos-fs to mount the disk. | |
161 | - * Note: this returns res == sb or NULL | |
162 | + * Note: this returns res == 0 (success) else error. | |
163 | */ | |
164 | MSDOS_SB(sb)->options.isvfat = 0; | |
165 | - res = fat_read_super(sb, data, silent, &umsdos_rdir_inode_operations); | |
166 | - | |
167 | - if (IS_ERR(res)) | |
168 | - return NULL; | |
169 | - if (res == NULL) { | |
170 | + // TBD: which inode_operations to use: | |
171 | + res = fat_fill_super(sb, data, silent, | |
172 | + &umsdos_rdir_inode_operations, isvfat); | |
173 | + if (res) { | |
174 | if (!silent) | |
175 | printk(KERN_INFO "VFS: Can't find a valid " | |
176 | "UMSDOS filesystem on dev %s.\n", sb->s_id); | |
177 | - return NULL; | |
178 | + return res; | |
179 | } | |
180 | ||
181 | printk (KERN_INFO "UMSDOS 0.86k " | |
182 | @@ -402,14 +413,13 @@ struct super_block *UMSDOS_read_super (s | |
183 | printk(KERN_INFO "UMSDOS: changed to alternate root\n"); | |
184 | dget (sb->s_root); sb->s_root = dget(new_root); | |
185 | } | |
186 | - return sb; | |
187 | + return 0; | |
188 | } | |
189 | ||
190 | /* | |
191 | * Check for an alternate root if we're the root device. | |
192 | */ | |
193 | ||
194 | -extern kdev_t ROOT_DEV; | |
195 | static struct dentry *check_pseudo_root(struct super_block *sb) | |
196 | { | |
197 | struct dentry *root, *sbin, *init; | |
198 | @@ -419,14 +429,15 @@ static struct dentry *check_pseudo_root( | |
199 | * must check like this, because we can be used with initrd | |
200 | */ | |
201 | ||
202 | - if (!kdev_same(sb->s_dev, ROOT_DEV)) | |
203 | + if (old_encode_dev(sb->s_dev) != old_encode_dev(ROOT_DEV)) | |
204 | goto out_noroot; | |
205 | ||
206 | /* | |
207 | * lookup_dentry needs a (so far non-existent) root. | |
208 | */ | |
209 | printk(KERN_INFO "check_pseudo_root: mounted as root\n"); | |
210 | - root = lookup_one_len(UMSDOS_PSDROOT_NAME, sb->s_root,UMSDOS_PSDROOT_LEN); | |
211 | + root = lookup_one_len(UMSDOS_PSDROOT_NAME, | |
212 | + sb->s_root, UMSDOS_PSDROOT_LEN); | |
213 | if (IS_ERR(root)) | |
214 | goto out_noroot; | |
215 | ||
216 | @@ -464,7 +475,31 @@ out_noroot: | |
217 | } | |
218 | ||
219 | ||
220 | -static DECLARE_FSTYPE_DEV(umsdos_fs_type, "umsdos", UMSDOS_read_super); | |
221 | +static int umsdos_fill_super(struct super_block *sb, void *data, int silent) | |
222 | +{ | |
223 | + int res; | |
224 | + | |
225 | + res = UMSDOS_read_super(sb, data, silent, &umsdos_dir_inode_operations, 0); | |
226 | + | |
227 | + return res; | |
228 | +} | |
229 | + | |
230 | +static struct super_block *umsdos_get_sb(struct file_system_type *fs_type, | |
231 | + int flags, const char *dev_name, void *data) | |
232 | +{ | |
233 | + return get_sb_bdev(fs_type, flags, dev_name, data, umsdos_fill_super); | |
234 | +} | |
235 | + | |
236 | +//TBD: must EXPORT all entry points; | |
237 | +//and use UMSDOS_ for them by local convention; | |
238 | + | |
239 | +static struct file_system_type umsdos_fs_type = { | |
240 | + .owner = THIS_MODULE, | |
241 | + .name = "umsdos", | |
242 | + .get_sb = umsdos_get_sb, | |
243 | + .kill_sb = kill_block_super, | |
244 | + .fs_flags = FS_REQUIRES_DEV, | |
245 | +}; | |
246 | ||
247 | static int __init init_umsdos_fs (void) | |
248 | { | |
249 | diff -Naurp linux-260-test8-efs/fs/umsdos/ioctl.c linux-260-test8/fs/umsdos/ioctl.c | |
250 | --- linux-260-test8-efs/fs/umsdos/ioctl.c 2003-10-17 14:42:54.000000000 -0700 | |
251 | +++ linux-260-test8/fs/umsdos/ioctl.c 2003-10-23 21:22:53.000000000 -0700 | |
252 | @@ -402,9 +402,10 @@ new_dentry->d_parent->d_name.name, new_d | |
253 | data.stat.st_ino = inode->i_ino; | |
254 | data.stat.st_mode = inode->i_mode; | |
255 | data.stat.st_size = inode->i_size; | |
256 | - data.stat.st_atime = inode->i_atime; | |
257 | - data.stat.st_ctime = inode->i_ctime; | |
258 | - data.stat.st_mtime = inode->i_mtime; | |
259 | + /* TBD: fix times */ | |
260 | + ///data.stat.st_atime = inode->i_atime; | |
261 | + ///data.stat.st_ctime = inode->i_ctime; | |
262 | + ///data.stat.st_mtime = inode->i_mtime; | |
263 | ret = -EFAULT; | |
264 | if (!copy_to_user (&idata->stat, &data.stat, | |
265 | sizeof (data.stat))) | |
266 | @@ -414,6 +415,7 @@ new_dentry->d_parent->d_name.name, new_d | |
267 | goto out; | |
268 | } | |
269 | else if (cmd == UMSDOS_DOS_SETUP) { | |
270 | + struct msdos_sb_info *msdossbi = (struct msdos_sb_info *)dir->i_sb->s_fs_info; | |
271 | /* #Specification: ioctl / UMSDOS_DOS_SETUP | |
272 | * The UMSDOS_DOS_SETUP ioctl allow changing the | |
273 | * default permission of the MS-DOS filesystem driver | |
274 | @@ -433,10 +435,11 @@ new_dentry->d_parent->d_name.name, new_d | |
275 | * umsdos_dirent.uid and gid sets the owner and group. | |
276 | * umsdos_dirent.mode set the permissions flags. | |
277 | */ | |
278 | - dir->i_sb->u.msdos_sb.options.fs_uid = data.umsdos_dirent.uid; | |
279 | - dir->i_sb->u.msdos_sb.options.fs_gid = data.umsdos_dirent.gid; | |
280 | - dir->i_sb->u.msdos_sb.options.fs_fmask = | |
281 | - dir->i_sb->u.msdos_sb.options.fs_dmask = | |
282 | + msdossbi->options.fs_uid = data.umsdos_dirent.uid; | |
283 | + msdossbi->options.fs_gid = data.umsdos_dirent.gid; | |
284 | + msdossbi->options.fs_fmask = | |
285 | + data.umsdos_dirent.mode; | |
286 | + msdossbi->options.fs_dmask = | |
287 | data.umsdos_dirent.mode; | |
288 | ret = 0; | |
289 | } | |
290 | diff -Naurp linux-260-test8-efs/fs/umsdos/Makefile linux-260-test8/fs/umsdos/Makefile | |
291 | --- linux-260-test8-efs/fs/umsdos/Makefile 2003-10-17 14:42:58.000000000 -0700 | |
292 | +++ linux-260-test8/fs/umsdos/Makefile 2003-10-23 13:05:13.000000000 -0700 | |
293 | @@ -2,9 +2,9 @@ | |
294 | # Makefile for the umsdos Unix-like filesystem routines. | |
295 | # | |
296 | ||
297 | -obj-$(CONFIG_UMSDOS) += umsdos.o | |
298 | +obj-$(CONFIG_UMSDOS_FS) += umsdos.o | |
299 | ||
300 | -umsdos-objs := dir.o inode.o ioctl.o mangle.o namei.o rdir.o emd.o | |
301 | +umsdos-objs := dir.o inode.o ioctl.o mangle.o namei.o rdir.o emd.o | |
302 | ||
303 | p: | |
304 | proto *.c >/usr/include/linux/umsdos_fs.p | |
305 | diff -Naurp linux-260-test8-efs/fs/umsdos/namei.c linux-260-test8/fs/umsdos/namei.c | |
306 | --- linux-260-test8-efs/fs/umsdos/namei.c 2003-10-17 14:43:23.000000000 -0700 | |
307 | +++ linux-260-test8/fs/umsdos/namei.c 2003-10-23 21:46:02.000000000 -0700 | |
308 | @@ -16,10 +16,12 @@ | |
309 | #include <linux/time.h> | |
310 | #include <linux/types.h> | |
311 | #include <linux/fcntl.h> | |
312 | +#include <linux/sched.h> | |
313 | #include <linux/stat.h> | |
314 | #include <linux/string.h> | |
315 | #include <linux/msdos_fs.h> | |
316 | #include <linux/umsdos_fs.h> | |
317 | +#include <linux/umsdos_fs_i.h> | |
318 | #include <linux/slab.h> | |
319 | ||
320 | #define UMSDOS_DIR_LOCK | |
321 | diff -Naurp linux-260-test8-efs/fs/umsdos/rdir.c linux-260-test8/fs/umsdos/rdir.c | |
322 | --- linux-260-test8-efs/fs/umsdos/rdir.c 2003-10-17 14:42:56.000000000 -0700 | |
323 | +++ linux-260-test8/fs/umsdos/rdir.c 2003-10-23 20:11:33.000000000 -0700 | |
324 | @@ -14,6 +14,7 @@ | |
325 | #include <linux/stat.h> | |
326 | #include <linux/limits.h> | |
327 | #include <linux/umsdos_fs.h> | |
328 | +#include <linux/umsdos_fs_i.h> | |
329 | #include <linux/slab.h> | |
330 | #include <linux/smp_lock.h> | |
331 | ||
332 | diff -Naurp linux-260-test8-efs/fs/umsdos/dir.c linux-260-test8/fs/umsdos/dir.c | |
333 | --- linux-260-test8-efs/fs/umsdos/dir.c 2003-10-17 14:43:11.000000000 -0700 | |
334 | +++ linux-260-test8/fs/umsdos/dir.c 2003-10-23 23:45:19.000000000 -0700 | |
335 | @@ -15,6 +15,7 @@ | |
336 | #include <linux/stat.h> | |
337 | #include <linux/limits.h> | |
338 | #include <linux/umsdos_fs.h> | |
339 | +#include <linux/umsdos_fs_i.h> | |
340 | #include <linux/slab.h> | |
341 | #include <linux/pagemap.h> | |
342 | #include <linux/smp_lock.h> | |
343 | @@ -368,13 +369,16 @@ void umsdos_lookup_patch_new(struct dent | |
344 | if (UMSDOS_I(inode)->i_patched) | |
345 | goto out; | |
346 | UMSDOS_I(inode)->i_patched = 1; | |
347 | - if (S_ISREG (entry->mode)) | |
348 | - entry->mtime = inode->i_mtime; | |
349 | + /* TBD: fix mtime */ | |
350 | + ///if (S_ISREG (entry->mode)) | |
351 | + ///entry->mtime = inode->i_mtime; | |
352 | inode->i_mode = entry->mode; | |
353 | - inode->i_rdev = to_kdev_t (entry->rdev); | |
354 | - inode->i_atime = entry->atime; | |
355 | - inode->i_ctime = entry->ctime; | |
356 | - inode->i_mtime = entry->mtime; | |
357 | + /* TBD: still using 16-bit dev_t; is this a problem? */ | |
358 | + inode->i_rdev = old_decode_dev (entry->rdev); | |
359 | + /* TBD: fix times */ | |
360 | + ///inode->i_atime = entry->atime; | |
361 | + ///inode->i_ctime = entry->ctime; | |
362 | + ///inode->i_mtime = entry->mtime; | |
363 | inode->i_uid = entry->uid; | |
364 | inode->i_gid = entry->gid; | |
365 | ||
366 | @@ -593,7 +597,7 @@ struct dentry *umsdos_covered(struct den | |
367 | dentry = d_alloc(parent, &qstr); | |
368 | if (dentry) { | |
369 | /* XXXXXXXXXXXXXXXXXXX Race alert! */ | |
370 | - result = UMSDOS_rlookup(parent->d_inode, dentry); | |
371 | + result = UMSDOS_rlookup(parent->d_inode, dentry, NULL); | |
372 | d_drop(dentry); | |
373 | if (result) | |
374 | goto out_fail; | |
375 | @@ -628,8 +632,8 @@ struct dentry *umsdos_lookup_dentry(stru | |
376 | dentry = d_alloc(parent, &qstr); | |
377 | if (dentry) { | |
378 | result = real ? | |
379 | - UMSDOS_rlookup(parent->d_inode, dentry) : | |
380 | - UMSDOS_lookup(parent->d_inode, dentry); | |
381 | + UMSDOS_rlookup(parent->d_inode, dentry, NULL) : | |
382 | + UMSDOS_lookup(parent->d_inode, dentry, NULL); | |
383 | if (result) | |
384 | goto out_fail; | |
385 | return dentry; | |
386 | @@ -655,7 +659,8 @@ char * umsdos_d_path(struct dentry *dent | |
387 | old_root = dget(current->fs->root); | |
388 | read_unlock(¤t->fs->lock); | |
389 | spin_lock(&dcache_lock); | |
390 | - path = __d_path(dentry, current->fs->rootmnt, dentry->d_sb->s_root, current->fs->rootmnt, buffer, len); /* FIXME: current->fs->rootmnt */ | |
391 | + /* FIXME: current->fs->rootmnt: */ | |
392 | + path = d_path(dentry, current->fs->rootmnt, buffer, len); | |
393 | spin_unlock(&dcache_lock); | |
394 | ||
395 | if (*path == '/') |