Import 2.3.1
[davej-history.git] / fs / hpfs / hpfs_fs.c
blobcb1d0215be8a10732e5d04dd75cbe04b9b650e9f
1 /*
2 * linux/fs/hpfs/hpfs_fs.c
3 * read-only HPFS
4 * version 1.0
6 * Chris Smith 1993
8 * Sources & references:
9 * Duncan, _Design ... of HPFS_, MSJ 4(5) (C) 1989 Microsoft Corp
10 * linux/fs/minix Copyright (C) 1991, 1992, 1993 Linus Torvalds
11 * linux/fs/msdos Written 1992, 1993 by Werner Almesberger
12 * linux/fs/isofs Copyright (C) 1991 Eric Youngdale
15 #include <linux/module.h>
17 #include <linux/fs.h>
18 #include <linux/hpfs_fs.h>
19 #include <linux/errno.h>
20 #include <linux/malloc.h>
21 #include <linux/kernel.h>
22 #include <linux/sched.h>
23 #include <linux/locks.h>
24 #include <linux/stat.h>
25 #include <linux/string.h>
26 #include <linux/init.h>
27 #include <asm/bitops.h>
28 #include <asm/uaccess.h>
30 #include "hpfs.h"
31 #include "hpfs_caps.h"
34 * HPFS is a mixture of 512-byte blocks and 2048-byte blocks. The 2k blocks
35 * are used for directories and bitmaps. For bmap to work, we must run the
36 * file system with 512-byte blocks. The 2k blocks are assembled in buffers
37 * obtained from kmalloc.
39 * For a file's i-number we use the sector number of its fnode, coded.
40 * (Directory ino's are even, file ino's are odd, and ino >> 1 is the
41 * sector address of the fnode. This is a hack to allow lookup() to
42 * tell read_inode() whether it is necessary to read the fnode.)
44 * The map_xxx routines all read something into a buffer and return a
45 * pointer somewhere in the buffer. The caller must do the brelse.
46 * The other routines are balanced.
48 * For details on the data structures see hpfs.h and the Duncan paper.
50 * Overview
52 * [ The names of these data structures, except fnode, are not Microsoft's
53 * or IBM's. I don't know what names they use. The semantics described
54 * here are those of this implementation, and any coincidence between it
55 * and real HPFS is to be hoped for but not guaranteed by me, and
56 * certainly not guaranteed by MS or IBM. Who know nothing about this. ]
58 * [ Also, the following will make little sense if you haven't read the
59 * Duncan paper, which is excellent. ]
61 * HPFS is a tree. There are 3 kinds of nodes. A directory is a tree
62 * of dnodes, and a file's allocation info is a tree of sector runs
63 * stored in fnodes and anodes.
65 * The top pointer is in the super block, it points to the fnode of the
66 * root directory.
68 * The root directory -- all directories -- gives file names, dates &c,
69 * and fnode addresses. If the directory fits in one dnode, that's it,
70 * otherwise the top dnode points to other dnodes, forming a tree. A
71 * dnode tree (one directory) might look like
73 * ((a b c) d (e f g) h (i j) k l (m n o p))
75 * The subtrees appear between the files. Each dir entry contains, along
76 * with the name and fnode, a dnode pointer to the subtree that precedes it
77 * (if there is one; a flag tells that). The first entry in every directory
78 * is ^A^A, the "." entry for the directory itself. The last entry in every
79 * dnode is \377, a fake entry whose only valid fields are the bit marking
80 * it last and the down pointer to the subtree preceding it, if any.
82 * The "value" field of directory entries is an fnode address. The fnode
83 * tells where the sectors of the file are. The fnode for a subdirectory
84 * contains one pointer, to the root dnode of the subdirectory. The fnode
85 * for a data file contains, in effect, a tiny anode. (Most of the space
86 * in fnodes is for extended attributes.)
88 * anodes and the anode part of fnodes are trees of extents. An extent
89 * is a (length, disk address) pair, labeled with the file address being
90 * mapped. E.g.,
92 * (0: 3@1000 3: 1@2000 4: 2@10)
94 * means the file:disk sector map (0:1000 1:1001 2:1002 3:2000 4:10 5:11).
96 * There is space for 8 file:len@disk triples in an fnode, or for 40 in an
97 * anode. If this is insufficient, subtrees are used, as in
99 * (6: (0: 3@1000 3: 1@2000 4: 2@10) 12: (6: 3@8000 9: 1@9000 10: 2@20))
101 * The label on a subtree is the first address *after* that tree. The
102 * subtrees are always anodes. The label:subtree pairs require only
103 * two words each, so non-leaf subtrees have a different format; there
104 * is room for 12 label:subtree pairs in an fnode, or 60 in an anode.
106 * Within a directory, each dnode contains a pointer up to its parent
107 * dnode. The root dnode points up to the directory's fnode.
109 * Each fnode contains a pointer to the directory that contains it
110 * (to the fnode of the directory). So this pointer in a directory
111 * fnode is "..".
113 * On the disk, dnodes are all together in the center of the partition,
114 * and HPFS even manages to put all the dnodes for a single directory
115 * together, generally. fnodes are out with the data. anodes are seldom
116 * seen -- in fact noncontiguous files are seldom seen. I think this is
117 * partly the open() call that lets programs specify the length of an
118 * output file when they know it, and partly because HPFS.IFS really is
119 * very good at resisting fragmentation.
122 /* notation */
124 #define little_ushort(x) (*(unsigned short *) &(x))
125 typedef void nonconst;
127 /* super block ops */
129 static void hpfs_read_inode(struct inode *);
130 static void hpfs_put_super(struct super_block *);
131 static int hpfs_statfs(struct super_block *, struct statfs *, int);
132 static int hpfs_remount_fs(struct super_block *, int *, char *);
134 static const struct super_operations hpfs_sops =
136 hpfs_read_inode, /* read_inode */
137 NULL, /* write_inode */
138 NULL, /* put_inode */
139 NULL, /* delete_inode */
140 NULL, /* notify_change */
141 hpfs_put_super, /* put_super */
142 NULL, /* write_super */
143 hpfs_statfs, /* statfs */
144 hpfs_remount_fs, /* remount_fs */
147 /* file ops */
149 static ssize_t hpfs_file_read(struct file *, char *, size_t, loff_t *);
150 static secno hpfs_bmap(struct inode *, unsigned);
152 static const struct file_operations hpfs_file_ops =
154 NULL, /* lseek - default */
155 hpfs_file_read, /* read */
156 NULL, /* write */
157 NULL, /* readdir - bad */
158 NULL, /* poll - default */
159 NULL, /* ioctl - default */
160 generic_file_mmap, /* mmap */
161 NULL, /* no special open is needed */
162 NULL, /* flush */
163 NULL, /* release */
164 file_fsync, /* fsync */
167 static const struct inode_operations hpfs_file_iops =
169 (nonconst *) & hpfs_file_ops, /* default file operations */
170 NULL, /* create */
171 NULL, /* lookup */
172 NULL, /* link */
173 NULL, /* unlink */
174 NULL, /* symlink */
175 NULL, /* mkdir */
176 NULL, /* rmdir */
177 NULL, /* mknod */
178 NULL, /* rename */
179 NULL, /* readlink */
180 NULL, /* follow_link */
181 generic_readpage, /* readpage */
182 NULL, /* writepage */
183 (int (*)(struct inode *, int))
184 &hpfs_bmap, /* bmap */
185 NULL, /* truncate */
186 NULL, /* permission */
189 /* directory ops */
191 static ssize_t hpfs_dir_read(struct file *filp, char *buf,
192 size_t count, loff_t *ppos);
193 static int hpfs_readdir(struct file *filp,
194 void *dirent, filldir_t filldir);
195 static struct dentry *hpfs_lookup(struct inode *, struct dentry *);
197 static const struct file_operations hpfs_dir_ops =
199 NULL, /* lseek - default */
200 hpfs_dir_read, /* read */
201 NULL, /* write - bad */
202 hpfs_readdir, /* readdir */
203 NULL, /* poll - default */
204 NULL, /* ioctl - default */
205 NULL, /* mmap */
206 NULL, /* no special open code */
207 NULL, /* flush */
208 NULL, /* no special release code */
209 file_fsync, /* fsync */
212 static const struct inode_operations hpfs_dir_iops =
214 (nonconst *) & hpfs_dir_ops, /* default directory file ops */
215 NULL, /* create */
216 hpfs_lookup, /* lookup */
217 NULL, /* link */
218 NULL, /* unlink */
219 NULL, /* symlink */
220 NULL, /* mkdir */
221 NULL, /* rmdir */
222 NULL, /* mknod */
223 NULL, /* rename */
224 NULL, /* readlink */
225 NULL, /* readpage */
226 NULL, /* writepage */
227 NULL, /* bmap */
228 NULL, /* truncate */
229 NULL, /* permission */
232 /* Four 512-byte buffers and the 2k block obtained by concatenating them */
234 struct quad_buffer_head {
235 struct buffer_head *bh[4];
236 void *data;
239 /* forwards */
241 static int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask,
242 int *lowercase, int *conv, int *nocheck);
243 static int check_warn(int not_ok,
244 const char *p1, const char *p2, const char *p3);
245 static int zerop(void *addr, unsigned len);
246 static void count_dnodes(struct inode *inode, dnode_secno dno,
247 unsigned *n_dnodes, unsigned *n_subdirs);
248 static unsigned count_bitmap(struct super_block *s);
249 static unsigned count_one_bitmap(kdev_t dev, secno secno);
250 static secno bplus_lookup(struct inode *inode, struct bplus_header *b,
251 secno file_secno, struct buffer_head **bhp);
252 static struct hpfs_dirent *map_dirent(struct inode *inode, dnode_secno dno,
253 const unsigned char *name, unsigned len,
254 struct quad_buffer_head *qbh);
255 static struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
256 struct quad_buffer_head *qbh);
257 static dnode_secno dir_subdno(struct inode *inode, unsigned pos);
258 static struct hpfs_dirent *map_nth_dirent(kdev_t dev, dnode_secno dno,
259 int n,
260 struct quad_buffer_head *qbh);
261 static unsigned choose_conv(unsigned char *p, unsigned len);
262 static unsigned convcpy_tofs(unsigned char *out, unsigned char *in,
263 unsigned len);
264 static dnode_secno fnode_dno(kdev_t dev, ino_t ino);
265 static struct fnode *map_fnode(kdev_t dev, ino_t ino,
266 struct buffer_head **bhp);
267 static struct anode *map_anode(kdev_t dev, unsigned secno,
268 struct buffer_head **bhp);
269 static struct dnode *map_dnode(kdev_t dev, unsigned secno,
270 struct quad_buffer_head *qbh);
271 static void *map_sector(kdev_t dev, unsigned secno, struct buffer_head **bhp);
272 static void *map_4sectors(kdev_t dev, unsigned secno,
273 struct quad_buffer_head *qbh);
274 static void brelse4(struct quad_buffer_head *qbh);
277 * make inode number for a file
280 static inline ino_t file_ino(fnode_secno secno)
282 return secno << 1 | 1;
286 * make inode number for a directory
289 static inline ino_t dir_ino(fnode_secno secno)
291 return secno << 1;
295 * get fnode address from an inode number
298 static inline fnode_secno ino_secno(ino_t ino)
300 return ino >> 1;
304 * test for directory's inode number
307 static inline int ino_is_dir(ino_t ino)
309 return (ino & 1) == 0;
313 * conv= options
316 #define CONV_BINARY 0 /* no conversion */
317 #define CONV_TEXT 1 /* crlf->newline */
318 #define CONV_AUTO 2 /* decide based on file contents */
321 * local time (HPFS) to GMT (Unix)
324 static inline time_t local_to_gmt(time_t t)
326 extern struct timezone sys_tz;
327 return t + sys_tz.tz_minuteswest * 60 - (sys_tz.tz_dsttime ? 3600 : 0);
330 /* super block ops */
333 * mount. This gets one thing, the root directory inode. It does a
334 * bunch of guessed-at consistency checks.
337 struct super_block *hpfs_read_super(struct super_block *s,
338 void *options, int silent)
340 struct hpfs_boot_block *bootblock;
341 struct hpfs_super_block *superblock;
342 struct hpfs_spare_block *spareblock;
343 struct hpfs_dirent *de = NULL;
344 struct buffer_head *bh0, *bh1, *bh2;
345 struct quad_buffer_head qbh;
346 dnode_secno root_dno;
347 kdev_t dev;
348 uid_t uid;
349 gid_t gid;
350 umode_t umask;
351 int lowercase;
352 int conv;
353 int dubious;
354 int nocheck;
356 MOD_INC_USE_COUNT;
359 * Get the mount options
362 if (!parse_opts(options, &uid, &gid, &umask, &lowercase, &conv,
363 &nocheck)) {
364 printk("HPFS: syntax error in mount options. Not mounted.\n");
365 s->s_dev = 0;
366 MOD_DEC_USE_COUNT;
367 return 0;
371 * Fill in the super block struct
374 lock_super(s);
375 dev = s->s_dev;
376 set_blocksize(dev, 512);
379 * fetch sectors 0, 16, 17
382 bootblock = map_sector(dev, 0, &bh0);
383 if (!bootblock)
384 goto bail;
386 superblock = map_sector(dev, 16, &bh1);
387 if (!superblock)
388 goto bail0;
390 spareblock = map_sector(dev, 17, &bh2);
391 if (!spareblock)
392 goto bail1;
395 * Check that this fs looks enough like a known one that we can find
396 * and read the root directory.
399 if (bootblock->magic != 0xaa55
400 || superblock->magic != SB_MAGIC
401 || spareblock->magic != SP_MAGIC
402 || bootblock->sig_28h != 0x28
403 || memcmp(&bootblock->sig_hpfs, "HPFS ", 8)
404 || little_ushort(bootblock->bytes_per_sector) != 512) {
405 printk("HPFS: hpfs_read_super: Not HPFS\n");
406 goto bail2;
410 * Check for inconsistencies -- possibly wrong guesses here, possibly
411 * filesystem problems.
414 dubious = 0;
416 dubious |= check_warn(spareblock->dirty != 0,
417 "`Improperly stopped'", "flag is set", "run CHKDSK");
418 dubious |= check_warn(spareblock->n_spares_used != 0,
419 "Spare blocks", "may be in use", "run CHKDSK");
422 * Above errors mean we could get wrong answers if we proceed,
423 * so don't
426 if (dubious && !nocheck)
427 goto bail2;
429 dubious |= check_warn((spareblock->n_dnode_spares !=
430 spareblock->n_dnode_spares_free),
431 "Spare dnodes", "may be in use", "run CHKDSK");
432 dubious |= check_warn(superblock->zero1 != 0,
433 "#1", "unknown word nonzero", "investigate");
434 dubious |= check_warn(superblock->zero3 != 0,
435 "#3", "unknown word nonzero", "investigate");
436 dubious |= check_warn(superblock->zero4 != 0,
437 "#4", "unknown word nonzero", "investigate");
438 dubious |= check_warn(!zerop(superblock->zero5,
439 sizeof superblock->zero5),
440 "#5", "unknown word nonzero", "investigate");
441 dubious |= check_warn(!zerop(superblock->zero6,
442 sizeof superblock->zero6),
443 "#6", "unknown word nonzero", "investigate");
445 if (dubious)
446 printk("HPFS: Proceeding, but operation may be unreliable\n");
449 * set fs read only
452 s->s_flags |= MS_RDONLY;
455 * fill in standard stuff
458 s->s_magic = HPFS_SUPER_MAGIC;
459 s->s_blocksize = 512;
460 s->s_blocksize_bits = 9;
461 s->s_op = (struct super_operations *) &hpfs_sops;
464 * fill in hpfs stuff
467 s->s_hpfs_root = dir_ino(superblock->root);
468 s->s_hpfs_fs_size = superblock->n_sectors;
469 s->s_hpfs_dirband_size = superblock->n_dir_band / 4;
470 s->s_hpfs_dmap = superblock->dir_band_bitmap;
471 s->s_hpfs_bitmaps = superblock->bitmaps;
472 s->s_hpfs_uid = uid;
473 s->s_hpfs_gid = gid;
474 s->s_hpfs_mode = 0777 & ~umask;
475 s->s_hpfs_n_free = -1;
476 s->s_hpfs_n_free_dnodes = -1;
477 s->s_hpfs_lowercase = lowercase;
478 s->s_hpfs_conv = conv;
481 * done with the low blocks
484 brelse(bh2);
485 brelse(bh1);
486 brelse(bh0);
489 * all set. try it out.
492 s->s_root = d_alloc_root(iget(s, s->s_hpfs_root), NULL);
493 unlock_super(s);
495 if (!s->s_root) {
496 printk("HPFS: hpfs_read_super: inode get failed\n");
497 s->s_dev = 0;
498 MOD_DEC_USE_COUNT;
499 return 0;
503 * find the root directory's . pointer & finish filling in the inode
506 root_dno = fnode_dno(dev, s->s_hpfs_root);
507 if (root_dno)
508 de = map_dirent(s->s_root->d_inode, root_dno,
509 "\001\001", 2, &qbh);
510 if (!root_dno || !de) {
511 printk("HPFS: "
512 "hpfs_read_super: root dir isn't in the root dir\n");
513 s->s_dev = 0;
514 MOD_DEC_USE_COUNT;
515 return 0;
518 s->s_root->d_inode->i_atime = local_to_gmt(de->read_date);
519 s->s_root->d_inode->i_mtime = local_to_gmt(de->write_date);
520 s->s_root->d_inode->i_ctime = local_to_gmt(de->creation_date);
522 brelse4(&qbh);
523 return s;
525 bail2:
526 brelse(bh2);
527 bail1:
528 brelse(bh1);
529 bail0:
530 brelse(bh0);
531 bail:
532 s->s_dev = 0;
533 unlock_super(s);
534 MOD_DEC_USE_COUNT;
535 return 0;
538 static int check_warn(int not_ok,
539 const char *p1, const char *p2, const char *p3)
541 if (not_ok)
542 printk("HPFS: %s %s. Please %s\n", p1, p2, p3);
543 return not_ok;
546 static int zerop(void *addr, unsigned len)
548 unsigned char *p = addr;
549 return p[0] == 0 && memcmp(p, p + 1, len - 1) == 0;
553 * A tiny parser for option strings, stolen from dosfs.
556 static int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask,
557 int *lowercase, int *conv, int *nocheck)
559 char *p, *rhs;
561 *uid = current->uid;
562 *gid = current->gid;
563 *umask = current->fs->umask;
564 *lowercase = 1;
565 *conv = CONV_BINARY;
566 *nocheck = 0;
568 if (!opts)
569 return 1;
571 for (p = strtok(opts, ","); p != 0; p = strtok(0, ",")) {
572 if ((rhs = strchr(p, '=')) != 0)
573 *rhs++ = '\0';
574 if (!strcmp(p, "uid")) {
575 if (!rhs || !*rhs)
576 return 0;
577 *uid = simple_strtoul(rhs, &rhs, 0);
578 if (*rhs)
579 return 0;
581 else if (!strcmp(p, "gid")) {
582 if (!rhs || !*rhs)
583 return 0;
584 *gid = simple_strtoul(rhs, &rhs, 0);
585 if (*rhs)
586 return 0;
588 else if (!strcmp(p, "umask")) {
589 if (!rhs || !*rhs)
590 return 0;
591 *umask = simple_strtoul(rhs, &rhs, 8);
592 if (*rhs)
593 return 0;
595 else if (!strcmp(p, "case")) {
596 if (!strcmp(rhs, "lower"))
597 *lowercase = 1;
598 else if (!strcmp(rhs, "asis"))
599 *lowercase = 0;
600 else
601 return 0;
603 else if (!strcmp(p, "conv")) {
604 if (!strcmp(rhs, "binary"))
605 *conv = CONV_BINARY;
606 else if (!strcmp(rhs, "text"))
607 *conv = CONV_TEXT;
608 else if (!strcmp(rhs, "auto"))
609 *conv = CONV_AUTO;
610 else
611 return 0;
613 else if (!strcmp(p,"nocheck"))
614 *nocheck=1;
615 else
616 return 1;
619 return 1;
623 * read_inode. This is called with exclusive access to a new inode that
624 * has only (i_dev,i_ino) set. It is responsible for filling in the rest.
625 * We leave the dates blank, to be filled in from the dir entry.
627 * NOTE that there must be no sleeping from the return in this routine
628 * until lookup() finishes filling in the inode, otherwise the partly
629 * completed inode would be visible during the sleep.
631 * It is done in this strange and sinful way because the alternative
632 * is to read the fnode, find the dir pointer in it, read that fnode
633 * to get the dnode pointer, search through that whole directory for
634 * the ino we're reading, and get the dates. It works that way, but
635 * ls sounds like fsck.
638 static void hpfs_read_inode(struct inode *inode)
640 struct super_block *s = inode->i_sb;
642 /* be ready to bail out */
644 inode->i_op = 0;
645 inode->i_mode = 0;
647 if (inode->i_ino == 0
648 || ino_secno(inode->i_ino) >= inode->i_sb->s_hpfs_fs_size) {
649 printk("HPFS: read_inode: bad ino\n");
650 return;
654 * canned stuff
657 inode->i_uid = s->s_hpfs_uid;
658 inode->i_gid = s->s_hpfs_gid;
659 inode->i_mode = s->s_hpfs_mode;
660 inode->i_hpfs_conv = s->s_hpfs_conv;
662 inode->i_hpfs_dno = 0;
663 inode->i_hpfs_n_secs = 0;
664 inode->i_hpfs_file_sec = 0;
665 inode->i_hpfs_disk_sec = 0;
666 inode->i_hpfs_dpos = 0;
667 inode->i_hpfs_dsubdno = 0;
670 * figure out whether we are looking at a directory or a file
673 if (ino_is_dir(inode->i_ino))
674 inode->i_mode |= S_IFDIR;
675 else {
676 inode->i_mode |= S_IFREG;
677 inode->i_mode &= ~0111;
681 * these fields must be filled in from the dir entry, which we don't
682 * have but lookup does. It will fill them in before letting the
683 * inode out of its grasp.
686 inode->i_atime = 0;
687 inode->i_mtime = 0;
688 inode->i_ctime = 0;
689 inode->i_size = 0;
692 * fill in the rest
695 if (S_ISREG(inode->i_mode)) {
697 inode->i_op = (struct inode_operations *) &hpfs_file_iops;
698 inode->i_nlink = 1;
699 inode->i_blksize = 512;
702 else {
703 unsigned n_dnodes, n_subdirs;
704 struct buffer_head *bh0;
705 struct fnode *fnode = map_fnode(inode->i_dev,
706 inode->i_ino, &bh0);
708 if (!fnode) {
709 printk("HPFS: read_inode: no fnode\n");
710 inode->i_mode = 0;
711 return;
714 inode->i_hpfs_parent_dir = dir_ino(fnode->up);
715 inode->i_hpfs_dno = fnode->u.external[0].disk_secno;
717 brelse(bh0);
719 n_dnodes = n_subdirs = 0;
720 count_dnodes(inode, inode->i_hpfs_dno, &n_dnodes, &n_subdirs);
722 inode->i_op = (struct inode_operations *) &hpfs_dir_iops;
723 inode->i_blksize = 512; /* 2048 here confuses ls & du & ... */
724 inode->i_blocks = 4 * n_dnodes;
725 inode->i_size = 512 * inode->i_blocks;
726 inode->i_nlink = 2 + n_subdirs;
731 * unmount.
734 static void hpfs_put_super(struct super_block *s)
736 MOD_DEC_USE_COUNT;
740 * statfs. For free inode counts we report the count of dnodes in the
741 * directory band -- not exactly right but pretty analogous.
744 static int hpfs_statfs(struct super_block *s, struct statfs *buf, int bufsiz)
746 struct statfs tmp;
749 * count the bits in the bitmaps, unless we already have
751 if (s->s_hpfs_n_free == -1) {
752 s->s_hpfs_n_free = count_bitmap(s);
753 s->s_hpfs_n_free_dnodes =
754 count_one_bitmap(s->s_dev, s->s_hpfs_dmap);
758 * fill in the user statfs struct
760 tmp.f_type = s->s_magic;
761 tmp.f_bsize = 512;
762 tmp.f_blocks = s->s_hpfs_fs_size;
763 tmp.f_bfree = s->s_hpfs_n_free;
764 tmp.f_bavail = s->s_hpfs_n_free;
765 tmp.f_files = s->s_hpfs_dirband_size;
766 tmp.f_ffree = s->s_hpfs_n_free_dnodes;
767 tmp.f_namelen = 254;
769 return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
773 * remount. Don't let read only be turned off.
776 static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
778 if (!(*flags & MS_RDONLY))
779 return -EINVAL;
780 return 0;
784 * count the dnodes in a directory, and the subdirs.
787 static void count_dnodes(struct inode *inode, dnode_secno dno,
788 unsigned *n_dnodes, unsigned *n_subdirs)
790 struct quad_buffer_head qbh;
791 struct dnode *dnode;
792 struct hpfs_dirent *de;
793 struct hpfs_dirent *de_end;
795 dnode = map_dnode(inode->i_dev, dno, &qbh);
796 if (!dnode)
797 return;
798 de = dnode_first_de(dnode);
799 de_end = dnode_end_de(dnode);
801 (*n_dnodes)++;
803 for (; de < de_end; de = de_next_de(de)) {
804 if (de->down)
805 count_dnodes(inode, de_down_pointer(de),
806 n_dnodes, n_subdirs);
807 if (de->directory && !de->first)
808 (*n_subdirs)++;
809 if (de->last || de->length == 0)
810 break;
813 brelse4(&qbh);
817 * count the bits in the free space bit maps
820 static unsigned count_bitmap(struct super_block *s)
822 unsigned n, count, n_bands;
823 secno *bitmaps;
824 struct quad_buffer_head qbh;
827 * there is one bit map for each 16384 sectors
829 n_bands = (s->s_hpfs_fs_size + 0x3fff) >> 14;
832 * their locations are given in an array pointed to by the super
833 * block
835 bitmaps = map_4sectors(s->s_dev, s->s_hpfs_bitmaps, &qbh);
836 if (!bitmaps)
837 return 0;
839 count = 0;
842 * map each one and count the free sectors
844 for (n = 0; n < n_bands; n++)
845 if (bitmaps[n] == 0)
846 printk("HPFS: bit map pointer missing\n");
847 else
848 count += count_one_bitmap(s->s_dev, bitmaps[n]);
850 brelse4(&qbh);
851 return count;
855 * Read in one bit map, count the bits, return the count.
858 static unsigned count_one_bitmap(kdev_t dev, secno secno)
860 struct quad_buffer_head qbh;
861 char *bits;
862 unsigned i, count;
864 bits = map_4sectors(dev, secno, &qbh);
865 if (!bits)
866 return 0;
868 count = 0;
870 for (i = 0; i < 8 * 2048; i++)
871 count += (test_bit(i, bits) != 0);
872 brelse4(&qbh);
874 return count;
877 /* file ops */
880 * read. Read the bytes, put them in buf, return the count.
883 static ssize_t hpfs_file_read(struct file *filp, char *buf,
884 size_t count, loff_t *ppos)
886 struct inode *inode = filp->f_dentry->d_inode;
887 size_t q, r, n, n0;
888 struct buffer_head *bh;
889 char *block;
890 char *start;
892 if (inode == 0 || !S_ISREG(inode->i_mode))
893 return -EINVAL;
896 * truncate count at EOF
898 if (count > inode->i_size - (off_t) *ppos)
899 count = inode->i_size - *ppos;
901 start = buf;
902 while (count > 0) {
904 * get file sector number, offset in sector, length to end of
905 * sector
907 q = *ppos >> 9;
908 r = *ppos & 511;
909 n = 512 - r;
912 * get length to copy to user buffer
914 if (n > count)
915 n = count;
918 * read the sector, copy to user
920 block = map_sector(inode->i_dev, hpfs_bmap(inode, q), &bh);
921 if (!block)
922 return -EIO;
925 * but first decide if it has \r\n, if the mount option said
926 * to do that
928 if (inode->i_hpfs_conv == CONV_AUTO)
929 inode->i_hpfs_conv = choose_conv(block + r, n);
931 if (inode->i_hpfs_conv == CONV_BINARY) {
933 * regular copy, output length is same as input
934 * length
936 copy_to_user(buf, block + r, n);
937 n0 = n;
939 else {
941 * squeeze out \r, output length varies
943 n0 = convcpy_tofs(buf, block + r, n);
944 if (count > inode->i_size - (off_t) *ppos - n + n0)
945 count = inode->i_size - *ppos - n + n0;
948 brelse(bh);
951 * advance input n bytes, output n0 bytes
953 *ppos += n;
954 buf += n0;
955 count -= n0;
958 return buf - start;
962 * This routine implements conv=auto. Return CONV_BINARY or CONV_TEXT.
965 static unsigned choose_conv(unsigned char *p, unsigned len)
967 unsigned tvote, bvote;
968 unsigned c;
970 tvote = bvote = 0;
972 while (len--) {
973 c = *p++;
974 if (c < ' ') {
975 if (c == '\r' && len && *p == '\n')
976 tvote += 10;
977 else if (c == '\t' || c == '\n');
978 else
979 bvote += 5;
980 } else if (c < '\177')
981 tvote++;
982 else
983 bvote += 5;
986 if (tvote > bvote)
987 return CONV_TEXT;
988 else
989 return CONV_BINARY;
993 * This routine implements conv=text. :s/crlf/nl/
996 static unsigned convcpy_tofs(unsigned char *out, unsigned char *in,
997 unsigned len)
999 unsigned char *start = out;
1001 while (len--) {
1002 unsigned c = *in++;
1003 if (c == '\r' && (len == 0 || *in == '\n'));
1004 else
1005 put_user(c, out++);
1008 return out - start;
1012 * Return the disk sector number containing a file sector.
1015 static secno hpfs_bmap(struct inode *inode, unsigned file_secno)
1017 unsigned n, disk_secno;
1018 struct fnode *fnode;
1019 struct buffer_head *bh;
1022 * There is one sector run cached in the inode. See if the sector is
1023 * in it.
1026 n = file_secno - inode->i_hpfs_file_sec;
1027 if (n < inode->i_hpfs_n_secs)
1028 return inode->i_hpfs_disk_sec + n;
1031 * No, read the fnode and go find the sector.
1034 else {
1035 fnode = map_fnode(inode->i_dev, inode->i_ino, &bh);
1036 if (!fnode)
1037 return 0;
1038 disk_secno = bplus_lookup(inode, &fnode->btree,
1039 file_secno, &bh);
1040 brelse(bh);
1041 return disk_secno;
1046 * Search allocation tree *b for the given file sector number and return
1047 * the disk sector number. Buffer *bhp has the tree in it, and can be
1048 * reused for subtrees when access to *b is no longer needed.
1049 * *bhp is busy on entry and exit.
1052 static secno bplus_lookup(struct inode *inode, struct bplus_header *b,
1053 secno file_secno, struct buffer_head **bhp)
1055 int i;
1058 * A leaf-level tree gives a list of sector runs. Find the one
1059 * containing the file sector we want, cache the map info in the
1060 * inode for later, and return the corresponding disk sector.
1063 if (!b->internal) {
1064 struct bplus_leaf_node *n = b->u.external;
1065 for (i = 0; i < b->n_used_nodes; i++) {
1066 unsigned t = file_secno - n[i].file_secno;
1067 if (t < n[i].length) {
1068 inode->i_hpfs_file_sec = n[i].file_secno;
1069 inode->i_hpfs_disk_sec = n[i].disk_secno;
1070 inode->i_hpfs_n_secs = n[i].length;
1071 return n[i].disk_secno + t;
1077 * A non-leaf tree gives a list of subtrees. Find the one containing
1078 * the file sector we want, read it in, and recurse to search it.
1081 else {
1082 struct bplus_internal_node *n = b->u.internal;
1083 for (i = 0; i < b->n_used_nodes; i++) {
1084 if (file_secno < n[i].file_secno) {
1085 struct anode *anode;
1086 anode_secno ano = n[i].down;
1087 brelse(*bhp);
1088 anode = map_anode(inode->i_dev, ano, bhp);
1089 if (!anode)
1090 break;
1091 return bplus_lookup(inode, &anode->btree,
1092 file_secno, bhp);
1098 * If we get here there was a hole in the file. As far as I know we
1099 * never do get here, but falling off the end would be indelicate. So
1100 * return a pointer to a handy all-zero sector. This is not a
1101 * reasonable way to handle files with holes if they really do
1102 * happen.
1105 printk("HPFS: bplus_lookup: sector not found\n");
1106 return 15;
1109 /* directory ops */
1112 * lookup. Search the specified directory for the specified name, set
1113 * *result to the corresponding inode.
1115 * lookup uses the inode number to tell read_inode whether it is reading
1116 * the inode of a directory or a file -- file ino's are odd, directory
1117 * ino's are even. read_inode avoids i/o for file inodes; everything
1118 * needed is up here in the directory. (And file fnodes are out in
1119 * the boondocks.)
1122 static struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry)
1124 const char *name = dentry->d_name.name;
1125 int len = dentry->d_name.len;
1126 struct hpfs_dirent *de;
1127 struct inode *inode;
1128 ino_t ino;
1129 int retval;
1130 struct quad_buffer_head qbh;
1133 * Read in the directory entry. "." is there under the name ^A^A .
1134 * Always read the dir even for . and .. in case we need the dates.
1137 if (name[0] == '.' && len == 1)
1138 de = map_dirent(dir, dir->i_hpfs_dno, "\001\001", 2, &qbh);
1139 else if (name[0] == '.' && name[1] == '.' && len == 2)
1140 de = map_dirent(dir,
1141 fnode_dno(dir->i_dev, dir->i_hpfs_parent_dir),
1142 "\001\001", 2, &qbh);
1143 else
1144 de = map_dirent(dir, dir->i_hpfs_dno, name, len, &qbh);
1147 * This is not really a bailout, just means file not found.
1150 if (!de) {
1151 d_add(dentry, NULL);
1152 retval = 0;
1153 goto out;
1157 * Get inode number, what we're after.
1160 if (de->directory)
1161 ino = dir_ino(de->fnode);
1162 else
1163 ino = file_ino(de->fnode);
1166 * Go find or make an inode.
1169 retval = -EACCES;
1170 if (!(inode = iget(dir->i_sb, ino)))
1171 goto free4;
1174 * Fill in the info from the directory if this is a newly created
1175 * inode.
1178 if (!inode->i_atime) {
1179 inode->i_atime = local_to_gmt(de->read_date);
1180 inode->i_mtime = local_to_gmt(de->write_date);
1181 inode->i_ctime = local_to_gmt(de->creation_date);
1182 if (de->read_only)
1183 inode->i_mode &= ~0222;
1184 if (!de->directory) {
1185 inode->i_size = de->file_size;
1187 * i_blocks should count the fnode and any anodes.
1188 * We count 1 for the fnode and don't bother about
1189 * anodes -- the disk heads are on the directory band
1190 * and we want them to stay there.
1192 inode->i_blocks = 1 + ((inode->i_size + 511) >> 9);
1196 d_add(dentry, inode);
1197 retval = 0;
1199 free4:
1200 brelse4(&qbh);
1202 out:
1203 return ERR_PTR(retval);
1207 * Compare two counted strings ignoring case.
1208 * HPFS directory order sorts letters as if they're upper case.
1211 static inline int memcasecmp(const unsigned char *s1, const unsigned char *s2,
1212 unsigned n)
1214 int t;
1216 if (n != 0)
1217 do {
1218 unsigned c1 = linux_char_to_upper_linux (*s1++);
1219 unsigned c2 = hpfs_char_to_upper_linux (*s2++);
1220 if ((t = c1 - c2) != 0)
1221 return t;
1222 } while (--n != 0);
1224 return 0;
1228 * Search a directory for the given name, return a pointer to its dir entry
1229 * and a pointer to the buffer containing it.
1232 static struct hpfs_dirent *map_dirent(struct inode *inode, dnode_secno dno,
1233 const unsigned char *name, unsigned len,
1234 struct quad_buffer_head *qbh)
1236 struct dnode *dnode;
1237 struct hpfs_dirent *de;
1238 struct hpfs_dirent *de_end;
1239 int t, l;
1242 * read the dnode at the root of our subtree
1244 dnode = map_dnode(inode->i_dev, dno, qbh);
1245 if (!dnode)
1246 return 0;
1249 * get pointers to start and end+1 of dir entries
1251 de = dnode_first_de(dnode);
1252 de_end = dnode_end_de(dnode);
1255 * look through the entries for the name we're after
1257 for ( ; de < de_end; de = de_next_de(de)) {
1260 * compare names
1262 l = len < de->namelen ? len : de->namelen;
1263 t = memcasecmp(name, de->name, l);
1266 * initial substring matches, compare lengths
1268 if (t == 0) {
1269 t = len - de->namelen;
1270 /* bingo */
1271 if (t == 0)
1272 return de;
1276 * wanted name .lt. dir name => not present.
1278 if (t < 0) {
1280 * if there is a subtree, search it.
1282 if (de->down) {
1283 dnode_secno sub_dno = de_down_pointer(de);
1284 brelse4(qbh);
1285 return map_dirent(inode, sub_dno,
1286 name, len, qbh);
1288 else
1289 break;
1293 * de->last is set on the last name in the dnode (it's always
1294 * a "\377" pseudo entry). de->length == 0 means we're about
1295 * to infinite loop. This test does nothing in a well-formed
1296 * dnode.
1298 if (de->last || de->length == 0)
1299 break;
1303 * name not found.
1305 brelse4(qbh);
1306 return 0;
1310 * readdir. Return exactly 1 dirent. (I tried and tried, but currently
1311 * the interface with libc just does not permit more than 1. If it gets
1312 * fixed, throw this out and just walk the tree and write records into
1313 * the user buffer.)
1315 * [ we now can handle multiple dirents, although the current libc doesn't
1316 * use that. The way hpfs does this is pretty strange, as we need to do
1317 * the name translation etc before calling "filldir()". This is untested,
1318 * as I don't have any hpfs partitions to test against. Linus ]
1320 * We keep track of our position in the dnode tree with a sort of
1321 * dewey-decimal record of subtree locations. Like so:
1323 * (1 (1.1 1.2 1.3) 2 3 (3.1 (3.1.1 3.1.2) 3.2 3.3 (3.3.1)) 4)
1325 * Subtrees appear after their file, out of lexical order,
1326 * which would be before their file. It's easier.
1328 * A directory can't hold more than 56 files, so 6 bits are used for
1329 * position numbers. If the tree is so deep that the position encoding
1330 * doesn't fit, I'm sure something absolutely fascinating happens.
1332 * The actual sequence of f_pos values is
1333 * 0 => . -1 => .. 1 1.1 ... 8.9 9 => files -2 => eof
1335 * The directory inode caches one position-to-dnode correspondence so
1336 * we won't have to repeatedly scan the top levels of the tree.
1340 * Translate the given name: Blam it to lowercase if the mount option said to.
1343 static void translate_hpfs_name(const unsigned char * from, int len, char * to, int lowercase)
1345 while (len > 0) {
1346 unsigned t = *from;
1347 len--;
1348 if (lowercase)
1349 t = hpfs_char_to_lower_linux (t);
1350 else
1351 t = hpfs_char_to_linux (t);
1352 *to = t;
1353 from++;
1354 to++;
1358 static int hpfs_readdir(struct file *filp, void * dirent,
1359 filldir_t filldir)
1361 struct quad_buffer_head qbh;
1362 struct hpfs_dirent *de;
1363 int namelen, lc;
1364 ino_t ino;
1365 char * tempname;
1366 long old_pos;
1367 struct inode *inode = filp->f_dentry->d_inode;
1369 tempname = (char *) __get_free_page(GFP_KERNEL);
1370 if (!tempname)
1371 return -ENOMEM;
1373 lc = inode->i_sb->s_hpfs_lowercase;
1374 switch ((long) filp->f_pos) {
1375 case -2:
1376 break;
1378 case 0:
1379 if (filldir(dirent, ".", 1, filp->f_pos, inode->i_ino) < 0)
1380 break;
1381 filp->f_pos = -1;
1382 /* fall through */
1384 case -1:
1385 if (filldir(dirent, "..", 2, filp->f_pos, inode->i_hpfs_parent_dir) < 0)
1386 break;
1387 filp->f_pos = 1;
1388 /* fall through */
1390 default:
1391 for (;;) {
1392 old_pos = filp->f_pos;
1393 de = map_pos_dirent(inode, &filp->f_pos, &qbh);
1394 if (!de) {
1395 filp->f_pos = -2;
1396 break;
1398 namelen = de->namelen;
1399 translate_hpfs_name(de->name, namelen, tempname, lc);
1400 if (de->directory)
1401 ino = dir_ino(de->fnode);
1402 else
1403 ino = file_ino(de->fnode);
1404 brelse4(&qbh);
1405 if (filldir(dirent, tempname, namelen, old_pos, ino) < 0) {
1406 filp->f_pos = old_pos;
1407 break;
1411 free_page((unsigned long) tempname);
1412 return 0;
1416 * Map the dir entry at subtree coordinates given by *posp, and
1417 * increment *posp to point to the following dir entry.
1420 static struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
1421 struct quad_buffer_head *qbh)
1423 unsigned pos, q, r;
1424 dnode_secno dno;
1425 struct hpfs_dirent *de;
1428 * Get the position code and split off the rightmost index r
1431 pos = *posp;
1432 q = pos >> 6;
1433 r = pos & 077;
1436 * Get the sector address of the dnode
1437 * pointed to by the leading part q
1440 dno = dir_subdno(inode, q);
1441 if (!dno)
1442 return 0;
1445 * Get the entry at index r in dnode q
1448 de = map_nth_dirent(inode->i_dev, dno, r, qbh);
1451 * If none, we're out of files in this dnode. Ascend.
1454 if (!de) {
1455 if (q == 0)
1456 return 0;
1457 *posp = q + 1;
1458 return map_pos_dirent(inode, posp, qbh);
1462 * If a subtree is here, descend.
1465 if (de->down)
1466 *posp = pos << 6 | 1;
1467 else
1468 *posp = pos + 1;
1471 * Don't return the ^A^A and \377 entries.
1474 if (de->first || de->last) {
1475 brelse4(qbh);
1476 return map_pos_dirent(inode, posp, qbh);
1478 else
1479 return de;
1483 * Return the address of the dnode with subtree coordinates given by pos.
1486 static dnode_secno dir_subdno(struct inode *inode, unsigned pos)
1488 struct hpfs_dirent *de;
1489 struct quad_buffer_head qbh;
1492 * 0 is the root dnode
1495 if (pos == 0)
1496 return inode->i_hpfs_dno;
1499 * we have one pos->dnode translation cached in the inode
1502 else if (pos == inode->i_hpfs_dpos)
1503 return inode->i_hpfs_dsubdno;
1506 * otherwise go look
1509 else {
1510 unsigned q = pos >> 6;
1511 unsigned r = pos & 077;
1512 dnode_secno dno;
1515 * dnode at position q
1517 dno = dir_subdno(inode, q);
1518 if (dno == 0)
1519 return 0;
1522 * entry at index r
1524 de = map_nth_dirent(inode->i_dev, dno, r, &qbh);
1525 if (!de || !de->down)
1526 return 0;
1529 * get the dnode down pointer
1531 dno = de_down_pointer(de);
1532 brelse4(&qbh);
1535 * cache it for next time
1537 inode->i_hpfs_dpos = pos;
1538 inode->i_hpfs_dsubdno = dno;
1539 return dno;
1544 * Return the dir entry at index n in dnode dno, or 0 if there isn't one
1547 static struct hpfs_dirent *map_nth_dirent(kdev_t dev, dnode_secno dno,
1548 int n,
1549 struct quad_buffer_head *qbh)
1551 int i;
1552 struct hpfs_dirent *de, *de_end;
1553 struct dnode *dnode = map_dnode(dev, dno, qbh);
1555 de = dnode_first_de(dnode);
1556 de_end = dnode_end_de(dnode);
1558 for (i = 1; de < de_end; i++, de = de_next_de(de)) {
1559 if (i == n)
1560 return de;
1561 if (de->last || de->length == 0)
1562 break;
1565 brelse4(qbh);
1566 return 0;
1569 static ssize_t hpfs_dir_read(struct file *filp, char *buf,
1570 size_t count, loff_t *ppos)
1572 return -EISDIR;
1575 /* Return the dnode pointer in a directory fnode */
1577 static dnode_secno fnode_dno(kdev_t dev, ino_t ino)
1579 struct buffer_head *bh;
1580 struct fnode *fnode;
1581 dnode_secno dno;
1583 fnode = map_fnode(dev, ino, &bh);
1584 if (!fnode)
1585 return 0;
1587 dno = fnode->u.external[0].disk_secno;
1588 brelse(bh);
1589 return dno;
1592 /* Map an fnode into a buffer and return pointers to it and to the buffer. */
1594 static struct fnode *map_fnode(kdev_t dev, ino_t ino, struct buffer_head **bhp)
1596 struct fnode *fnode;
1598 if (ino == 0) {
1599 printk("HPFS: missing fnode\n");
1600 return 0;
1603 fnode = map_sector(dev, ino_secno(ino), bhp);
1604 if (fnode)
1605 if (fnode->magic != FNODE_MAGIC) {
1606 printk("HPFS: map_fnode: bad fnode pointer\n");
1607 brelse(*bhp);
1608 return 0;
1610 return fnode;
1613 /* Map an anode into a buffer and return pointers to it and to the buffer. */
1615 static struct anode *map_anode(kdev_t dev, unsigned secno,
1616 struct buffer_head **bhp)
1618 struct anode *anode;
1620 if (secno == 0) {
1621 printk("HPFS: missing anode\n");
1622 return 0;
1625 anode = map_sector(dev, secno, bhp);
1626 if (anode)
1627 if (anode->magic != ANODE_MAGIC || anode->self != secno) {
1628 printk("HPFS: map_anode: bad anode pointer\n");
1629 brelse(*bhp);
1630 return 0;
1632 return anode;
1635 /* Map a dnode into a buffer and return pointers to it and to the buffer. */
1637 static struct dnode *map_dnode(kdev_t dev, unsigned secno,
1638 struct quad_buffer_head *qbh)
1640 struct dnode *dnode;
1642 if (secno == 0) {
1643 printk("HPFS: missing dnode\n");
1644 return 0;
1647 dnode = map_4sectors(dev, secno, qbh);
1648 if (dnode)
1649 if (dnode->magic != DNODE_MAGIC || dnode->self != secno) {
1650 printk("HPFS: map_dnode: bad dnode pointer\n");
1651 brelse4(qbh);
1652 return 0;
1654 return dnode;
1657 /* Map a sector into a buffer and return pointers to it and to the buffer. */
1659 static void *map_sector(kdev_t dev, unsigned secno, struct buffer_head **bhp)
1661 struct buffer_head *bh;
1663 if ((*bhp = bh = bread(dev, secno, 512)) != 0)
1664 return bh->b_data;
1665 else {
1666 printk("HPFS: map_sector: read error\n");
1667 return 0;
1671 /* Map 4 sectors into a 4buffer and return pointers to it and to the buffer. */
1673 static void *map_4sectors(kdev_t dev, unsigned secno,
1674 struct quad_buffer_head *qbh)
1676 struct buffer_head *bh;
1677 char *data;
1679 if (secno & 3) {
1680 printk("HPFS: map_4sectors: unaligned read\n");
1681 return 0;
1684 qbh->data = data = kmalloc(2048, GFP_KERNEL);
1685 if (!data)
1686 goto bail;
1688 qbh->bh[0] = bh = bread(dev, secno, 512);
1689 if (!bh)
1690 goto bail0;
1691 memcpy(data, bh->b_data, 512);
1693 qbh->bh[1] = bh = bread(dev, secno + 1, 512);
1694 if (!bh)
1695 goto bail1;
1696 memcpy(data + 512, bh->b_data, 512);
1698 qbh->bh[2] = bh = bread(dev, secno + 2, 512);
1699 if (!bh)
1700 goto bail2;
1701 memcpy(data + 2 * 512, bh->b_data, 512);
1703 qbh->bh[3] = bh = bread(dev, secno + 3, 512);
1704 if (!bh)
1705 goto bail3;
1706 memcpy(data + 3 * 512, bh->b_data, 512);
1708 return data;
1710 bail3:
1711 brelse(qbh->bh[2]);
1712 bail2:
1713 brelse(qbh->bh[1]);
1714 bail1:
1715 brelse(qbh->bh[0]);
1716 bail0:
1717 kfree_s(data, 2048);
1718 bail:
1719 printk("HPFS: map_4sectors: read error\n");
1720 return 0;
1723 /* Deallocate a 4-buffer block */
1725 static void brelse4(struct quad_buffer_head *qbh)
1727 brelse(qbh->bh[3]);
1728 brelse(qbh->bh[2]);
1729 brelse(qbh->bh[1]);
1730 brelse(qbh->bh[0]);
1731 kfree_s(qbh->data, 2048);
1734 static struct file_system_type hpfs_fs_type = {
1735 "hpfs",
1736 FS_REQUIRES_DEV,
1737 hpfs_read_super,
1738 NULL
1741 __initfunc(int init_hpfs_fs(void))
1743 return register_filesystem(&hpfs_fs_type);
1746 #ifdef MODULE
1747 EXPORT_NO_SYMBOLS;
1749 int init_module(void)
1751 return init_hpfs_fs();
1754 void cleanup_module(void)
1756 unregister_filesystem(&hpfs_fs_type);
1759 #endif