2 * linux/fs/vfat/namei.c
4 * Written 1992,1993 by Werner Almesberger
6 * Windows95/Windows NT compatible extended MSDOS filesystem
7 * by Gordon Chaffee Copyright (C) 1995. Send bug reports for the
8 * VFAT filesystem to <chaffee@cs.berkeley.edu>. Specify
9 * what file operation caused you trouble and if you can duplicate
10 * the problem, send a script that demonstrates it.
12 * Short name translation 1999, 2001 by Wolfram Pienkoss <wp@bszh.de>
14 * Support Multibyte characters and cleanup by
15 * OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
18 #include <linux/module.h>
20 #include <linux/jiffies.h>
21 #include <linux/msdos_fs.h>
22 #include <linux/ctype.h>
23 #include <linux/slab.h>
24 #include <linux/smp_lock.h>
25 #include <linux/buffer_head.h>
26 #include <linux/namei.h>
28 static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd)
32 if (!dentry->d_inode &&
33 nd && !(nd->flags & LOOKUP_CONTINUE) && (nd->flags & LOOKUP_CREATE))
35 * negative dentry is dropped, in order to make sure
36 * to use the name which a user desires if this is
41 spin_lock(&dentry->d_lock);
42 if (dentry->d_time != dentry->d_parent->d_inode->i_version)
44 spin_unlock(&dentry->d_lock);
49 /* returns the length of a struct qstr, ignoring trailing dots */
50 static unsigned int vfat_striptail_len(struct qstr *qstr)
52 unsigned int len = qstr->len;
54 while (len && qstr->name[len - 1] == '.')
60 * Compute the hash for the vfat name corresponding to the dentry.
61 * Note: if the name is invalid, we leave the hash code unchanged so
62 * that the existing dentry can be used. The vfat fs routines will
63 * return ENOENT or EINVAL as appropriate.
65 static int vfat_hash(struct dentry *dentry, struct qstr *qstr)
67 qstr->hash = full_name_hash(qstr->name, vfat_striptail_len(qstr));
72 * Compute the hash for the vfat name corresponding to the dentry.
73 * Note: if the name is invalid, we leave the hash code unchanged so
74 * that the existing dentry can be used. The vfat fs routines will
75 * return ENOENT or EINVAL as appropriate.
77 static int vfat_hashi(struct dentry *dentry, struct qstr *qstr)
79 struct nls_table *t = MSDOS_SB(dentry->d_inode->i_sb)->nls_io;
80 const unsigned char *name;
85 len = vfat_striptail_len(qstr);
87 hash = init_name_hash();
89 hash = partial_name_hash(nls_tolower(t, *name++), hash);
90 qstr->hash = end_name_hash(hash);
96 * Case insensitive compare of two vfat names.
98 static int vfat_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b)
100 struct nls_table *t = MSDOS_SB(dentry->d_inode->i_sb)->nls_io;
101 unsigned int alen, blen;
103 /* A filename cannot end in '.' or we treat it like it has none */
104 alen = vfat_striptail_len(a);
105 blen = vfat_striptail_len(b);
107 if (nls_strnicmp(t, a->name, b->name, alen) == 0)
114 * Case sensitive compare of two vfat names.
116 static int vfat_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b)
118 unsigned int alen, blen;
120 /* A filename cannot end in '.' or we treat it like it has none */
121 alen = vfat_striptail_len(a);
122 blen = vfat_striptail_len(b);
124 if (strncmp(a->name, b->name, alen) == 0)
130 static struct dentry_operations vfat_dentry_ops[4] = {
132 .d_hash = vfat_hashi,
133 .d_compare = vfat_cmpi,
136 .d_revalidate = vfat_revalidate,
137 .d_hash = vfat_hashi,
138 .d_compare = vfat_cmpi,
142 .d_compare = vfat_cmp,
145 .d_revalidate = vfat_revalidate,
147 .d_compare = vfat_cmp,
151 /* Characters that are undesirable in an MS-DOS file name */
153 static inline wchar_t vfat_bad_char(wchar_t w)
156 || (w == '*') || (w == '?') || (w == '<') || (w == '>')
157 || (w == '|') || (w == '"') || (w == ':') || (w == '/')
161 static inline wchar_t vfat_replace_char(wchar_t w)
163 return (w == '[') || (w == ']') || (w == ';') || (w == ',')
164 || (w == '+') || (w == '=');
167 static wchar_t vfat_skip_char(wchar_t w)
169 return (w == '.') || (w == ' ');
172 static inline int vfat_is_used_badchars(const wchar_t *s, int len)
176 for (i = 0; i < len; i++)
177 if (vfat_bad_char(s[i]))
182 static int vfat_valid_longname(const unsigned char *name, unsigned int len)
184 if (name[len - 1] == ' ')
187 return -ENAMETOOLONG;
189 /* MS-DOS "device special files" */
190 if (len == 3 || (len > 3 && name[3] == '.')) { /* basename == 3 */
191 if (!strnicmp(name, "aux", 3) ||
192 !strnicmp(name, "con", 3) ||
193 !strnicmp(name, "nul", 3) ||
194 !strnicmp(name, "prn", 3))
197 if (len == 4 || (len > 4 && name[4] == '.')) { /* basename == 4 */
198 /* "com1", "com2", ... */
199 if ('1' <= name[3] && name[3] <= '9') {
200 if (!strnicmp(name, "com", 3) ||
201 !strnicmp(name, "lpt", 3))
209 static int vfat_find_form(struct inode *dir, unsigned char *name)
211 struct msdos_dir_entry *de;
212 struct buffer_head *bh = NULL;
216 res = fat_scan(dir, name, &bh, &de, &i_pos);
224 * 1) Valid characters for the 8.3 format alias are any combination of
225 * letters, uppercase alphabets, digits, any of the
226 * following special characters:
227 * $ % ' ` - @ { } ~ ! # ( ) & _ ^
228 * In this case Longfilename is not stored in disk.
231 * File name and extension name is contain uppercase/lowercase
232 * only. And it is expressed by CASE_LOWER_BASE and CASE_LOWER_EXT.
234 * 2) File name is 8.3 format, but it contain the uppercase and
235 * lowercase char, muliti bytes char, etc. In this case numtail is not
236 * added, but Longfilename is stored.
238 * 3) When the one except for the above, or the following special
239 * character are contained:
241 * numtail is added, and Longfilename must be stored in disk .
243 struct shortname_info {
244 unsigned char lower:1,
248 #define INIT_SHORTNAME_INFO(x) do { \
254 static inline int to_shortname_char(struct nls_table *nls,
255 unsigned char *buf, int buf_size,
256 wchar_t *src, struct shortname_info *info)
260 if (vfat_skip_char(*src)) {
264 if (vfat_replace_char(*src)) {
270 len = nls->uni2char(*src, buf, buf_size);
275 } else if (len == 1) {
276 unsigned char prev = buf[0];
278 if (buf[0] >= 0x7F) {
283 buf[0] = nls_toupper(nls, buf[0]);
284 if (isalpha(buf[0])) {
299 * Given a valid longname, create a unique shortname. Make sure the
300 * shortname does not exist
301 * Returns negative number on error, 0 for a normal
302 * return, and 1 for valid shortname
304 static int vfat_create_shortname(struct inode *dir, struct nls_table *nls,
305 wchar_t *uname, int ulen,
306 unsigned char *name_res, unsigned char *lcase)
308 wchar_t *ip, *ext_start, *end, *name_start;
309 unsigned char base[9], ext[4], buf[8], *p;
310 unsigned char charbuf[NLS_MAX_CHARSET_SIZE];
312 int sz = 0, extlen, baselen, i, numtail_baselen, numtail2_baselen;
314 struct shortname_info base_info, ext_info;
315 unsigned short opt_shortname = MSDOS_SB(dir->i_sb)->options.shortname;
318 INIT_SHORTNAME_INFO(&base_info);
319 INIT_SHORTNAME_INFO(&ext_info);
321 /* Now, we need to create a shortname from the long name */
322 ext_start = end = &uname[ulen];
323 while (--ext_start >= uname) {
324 if (*ext_start == 0x002E) { /* is `.' */
325 if (ext_start == end - 1) {
333 if (ext_start == uname - 1) {
336 } else if (ext_start) {
338 * Names which start with a dot could be just
339 * an extension eg. "...test". In this case Win95
340 * uses the extension as the name and sets no extension.
342 name_start = &uname[0];
343 while (name_start < ext_start) {
344 if (!vfat_skip_char(*name_start))
348 if (name_start != ext_start) {
349 sz = ext_start - uname;
358 numtail2_baselen = 2;
359 for (baselen = i = 0, p = base, ip = uname; i < sz; i++, ip++) {
360 chl = to_shortname_char(nls, charbuf, sizeof(charbuf),
365 if (baselen < 2 && (baselen + chl) > 2)
366 numtail2_baselen = baselen;
367 if (baselen < 6 && (baselen + chl) > 6)
368 numtail_baselen = baselen;
369 for (chi = 0; chi < chl; chi++) {
376 if ((chi < chl - 1) || (ip + 1) - uname < sz)
387 for (p = ext, ip = ext_start; extlen < 3 && ip < end; ip++) {
388 chl = to_shortname_char(nls, charbuf, sizeof(charbuf),
393 if ((extlen + chl) > 3) {
397 for (chi = 0; chi < chl; chi++) {
409 base[baselen] = '\0';
411 /* Yes, it can happen. ".\xe5" would do it. */
412 if (base[0] == DELETED_FLAG)
415 /* OK, at this point we know that base is not longer than 8 symbols,
416 * ext is not longer than 3, base is nonempty, both don't contain
417 * any bad symbols (lowercase transformed to uppercase).
420 memset(name_res, ' ', MSDOS_NAME);
421 memcpy(name_res, base, baselen);
422 memcpy(name_res + 8, ext, extlen);
424 if (is_shortname && base_info.valid && ext_info.valid) {
425 if (vfat_find_form(dir, name_res) == 0)
428 if (opt_shortname & VFAT_SFN_CREATE_WIN95) {
429 return (base_info.upper && ext_info.upper);
430 } else if (opt_shortname & VFAT_SFN_CREATE_WINNT) {
431 if ((base_info.upper || base_info.lower) &&
432 (ext_info.upper || ext_info.lower)) {
433 if (!base_info.upper && base_info.lower)
434 *lcase |= CASE_LOWER_BASE;
435 if (!ext_info.upper && ext_info.lower)
436 *lcase |= CASE_LOWER_EXT;
445 if (MSDOS_SB(dir->i_sb)->options.numtail == 0)
446 if (vfat_find_form(dir, name_res) < 0)
450 * Try to find a unique extension. This used to
451 * iterate through all possibilities sequentially,
452 * but that gave extremely bad performance. Windows
453 * only tries a few cases before using random
454 * values for part of the base.
458 baselen = numtail_baselen;
461 name_res[baselen] = '~';
462 for (i = 1; i < 10; i++) {
463 name_res[baselen + 1] = i + '0';
464 if (vfat_find_form(dir, name_res) < 0)
468 i = jiffies & 0xffff;
469 sz = (jiffies >> 16) & 0x7;
471 baselen = numtail2_baselen;
474 name_res[baselen + 4] = '~';
475 name_res[baselen + 5] = '1' + sz;
477 sprintf(buf, "%04X", i);
478 memcpy(&name_res[baselen], buf, 4);
479 if (vfat_find_form(dir, name_res) < 0)
486 /* Translate a string, including coded sequences into Unicode */
488 xlate_to_uni(const unsigned char *name, int len, unsigned char *outname,
489 int *longlen, int *outlen, int escape, int utf8,
490 struct nls_table *nls)
492 const unsigned char *ip;
500 int name_len = strlen(name);
502 *outlen = utf8_mbstowcs((wchar_t *)outname, name, PAGE_SIZE);
505 * We stripped '.'s before and set len appropriately,
506 * but utf8_mbstowcs doesn't care about len
508 *outlen -= (name_len - len);
510 op = &outname[*outlen * sizeof(wchar_t)];
513 for (i = 0, ip = name, op = outname, *outlen = 0;
514 i < len && *outlen <= 260;
517 if (escape && (*ip == ':')) {
521 for (k = 1; k < 5; k++) {
524 if (nc >= '0' && nc <= '9') {
528 if (nc >= 'a' && nc <= 'f') {
529 ec |= nc - ('a' - 10);
532 if (nc >= 'A' && nc <= 'F') {
533 ec |= nc - ('A' - 10);
543 if ((charlen = nls->char2uni(ip, len - i, (wchar_t *)op)) < 0)
551 for (i = 0, ip = name, op = outname, *outlen = 0;
552 i < len && *outlen <= 260;
561 return -ENAMETOOLONG;
569 fill = 13 - (*outlen % 13);
570 for (i = 0; i < fill; i++) {
581 static int vfat_build_slots(struct inode *dir, const unsigned char *name,
582 int len, struct msdos_dir_slot *ds,
583 int *slots, int is_dir)
585 struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
586 struct fat_mount_options *opts = &sbi->options;
587 struct msdos_dir_slot *ps;
588 struct msdos_dir_entry *de;
590 unsigned char cksum, lcase;
591 unsigned char msdos_name[MSDOS_NAME];
593 int res, slot, ulen, usize, i;
597 res = vfat_valid_longname(name, len);
601 page = __get_free_page(GFP_KERNEL);
605 uname = (wchar_t *)page;
606 res = xlate_to_uni(name, len, (unsigned char *)uname, &ulen, &usize,
607 opts->unicode_xlate, opts->utf8, sbi->nls_io);
611 res = vfat_is_used_badchars(uname, ulen);
615 res = vfat_create_shortname(dir, sbi->nls_disk, uname, ulen,
620 de = (struct msdos_dir_entry *)ds;
625 /* build the entry of long file name */
627 for (cksum = i = 0; i < 11; i++)
628 cksum = (((cksum&1)<<7)|((cksum&0xfe)>>1)) + msdos_name[i];
630 for (ps = ds, slot = *slots; slot > 0; slot--, ps++) {
634 ps->alias_checksum = cksum;
636 offset = (slot - 1) * 13;
637 fatwchar_to16(ps->name0_4, uname + offset, 5);
638 fatwchar_to16(ps->name5_10, uname + offset + 5, 6);
639 fatwchar_to16(ps->name11_12, uname + offset + 11, 2);
642 de = (struct msdos_dir_entry *)ps;
645 /* build the entry of 8.3 alias name */
647 memcpy(de->name, msdos_name, MSDOS_NAME);
648 de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
650 de->adate = de->cdate = de->date = 0;
651 de->ctime = de->time = 0;
662 static int vfat_add_entry(struct inode *dir, struct qstr *qname,
663 int is_dir, struct vfat_slot_info *sinfo_out,
664 struct buffer_head **bh, struct msdos_dir_entry **de)
666 struct msdos_dir_slot *dir_slots;
668 int res, slots, slot;
670 struct msdos_dir_entry *dummy_de;
671 struct buffer_head *dummy_bh;
674 len = vfat_striptail_len(qname);
678 dir_slots = kmalloc(sizeof(*dir_slots) * MSDOS_SLOTS, GFP_KERNEL);
679 if (dir_slots == NULL)
682 res = vfat_build_slots(dir, qname->name, len,
683 dir_slots, &slots, is_dir);
687 /* build the empty directory entry of number of slots */
689 fat_add_entries(dir, slots, &dummy_bh, &dummy_de, &dummy_i_pos);
696 /* Now create the new entry */
698 for (slot = 0; slot < slots; slot++) {
699 if (fat_get_entry(dir, &offset, bh, de, &sinfo_out->i_pos) < 0) {
703 memcpy(*de, dir_slots + slot, sizeof(struct msdos_dir_slot));
704 mark_buffer_dirty(*bh);
708 /* update timestamp */
709 dir->i_ctime = dir->i_mtime = dir->i_atime = CURRENT_TIME_SEC;
710 mark_inode_dirty(dir);
712 fat_date_unix2dos(dir->i_mtime.tv_sec, &(*de)->time, &(*de)->date);
713 dir->i_mtime.tv_nsec = 0;
714 (*de)->ctime = (*de)->time;
715 (*de)->adate = (*de)->cdate = (*de)->date;
717 mark_buffer_dirty(*bh);
719 /* slots can't be less than 1 */
720 sinfo_out->long_slots = slots - 1;
721 sinfo_out->longname_offset =
722 offset - sizeof(struct msdos_dir_slot) * slots;
729 static int vfat_find(struct inode *dir, struct qstr *qname,
730 struct vfat_slot_info *sinfo, struct buffer_head **last_bh,
731 struct msdos_dir_entry **last_de)
733 struct super_block *sb = dir->i_sb;
738 len = vfat_striptail_len(qname);
742 res = fat_search_long(dir, qname->name, len,
743 (MSDOS_SB(sb)->options.name_check != 's'),
744 &offset, &sinfo->longname_offset);
746 sinfo->long_slots = res - 1;
747 if (fat_get_entry(dir, &offset, last_bh, last_de, &sinfo->i_pos) >= 0)
751 return res ? res : -ENOENT;
754 static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry,
755 struct nameidata *nd)
758 struct vfat_slot_info sinfo;
760 struct dentry *alias;
761 struct buffer_head *bh = NULL;
762 struct msdos_dir_entry *de;
766 table = (MSDOS_SB(dir->i_sb)->options.name_check == 's') ? 2 : 0;
767 dentry->d_op = &vfat_dentry_ops[table];
770 res = vfat_find(dir, &dentry->d_name, &sinfo, &bh, &de);
775 inode = fat_build_inode(dir->i_sb, de, sinfo.i_pos, &res);
781 alias = d_find_alias(inode);
783 if (d_invalidate(alias) == 0)
794 dentry->d_op = &vfat_dentry_ops[table];
795 dentry->d_time = dentry->d_parent->d_inode->i_version;
796 dentry = d_splice_alias(inode, dentry);
798 dentry->d_op = &vfat_dentry_ops[table];
799 dentry->d_time = dentry->d_parent->d_inode->i_version;
804 static int vfat_create(struct inode *dir, struct dentry *dentry, int mode,
805 struct nameidata *nd)
807 struct super_block *sb = dir->i_sb;
808 struct inode *inode = NULL;
809 struct buffer_head *bh = NULL;
810 struct msdos_dir_entry *de;
811 struct vfat_slot_info sinfo;
815 res = vfat_add_entry(dir, &dentry->d_name, 0, &sinfo, &bh, &de);
818 inode = fat_build_inode(sb, de, sinfo.i_pos, &res);
823 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
824 mark_inode_dirty(inode);
827 dentry->d_time = dentry->d_parent->d_inode->i_version;
828 d_instantiate(dentry, inode);
834 static void vfat_remove_entry(struct inode *dir, struct vfat_slot_info *sinfo,
835 struct buffer_head *bh,
836 struct msdos_dir_entry *de)
838 loff_t offset, i_pos;
841 /* remove the shortname */
842 dir->i_mtime = dir->i_atime = CURRENT_TIME_SEC;
844 mark_inode_dirty(dir);
845 de->name[0] = DELETED_FLAG;
846 mark_buffer_dirty(bh);
847 /* remove the longname */
848 offset = sinfo->longname_offset;
850 for (i = sinfo->long_slots; i > 0; --i) {
851 if (fat_get_entry(dir, &offset, &bh, &de, &i_pos) < 0)
853 de->name[0] = DELETED_FLAG;
854 de->attr = ATTR_NONE;
855 mark_buffer_dirty(bh);
860 static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
862 struct inode *inode = dentry->d_inode;
863 struct vfat_slot_info sinfo;
864 struct buffer_head *bh = NULL;
865 struct msdos_dir_entry *de;
869 res = fat_dir_empty(inode);
873 res = vfat_find(dir, &dentry->d_name, &sinfo, &bh, &de);
879 inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
881 mark_inode_dirty(inode);
883 vfat_remove_entry(dir, &sinfo, bh, de);
890 static int vfat_unlink(struct inode *dir, struct dentry *dentry)
892 struct inode *inode = dentry->d_inode;
893 struct vfat_slot_info sinfo;
894 struct buffer_head *bh = NULL;
895 struct msdos_dir_entry *de;
899 res = vfat_find(dir, &dentry->d_name, &sinfo, &bh, &de);
903 inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
905 mark_inode_dirty(inode);
907 vfat_remove_entry(dir, &sinfo, bh, de);
914 static int vfat_mkdir(struct inode *dir, struct dentry *dentry, int mode)
916 struct super_block *sb = dir->i_sb;
917 struct inode *inode = NULL;
918 struct vfat_slot_info sinfo;
919 struct buffer_head *bh = NULL;
920 struct msdos_dir_entry *de;
924 res = vfat_add_entry(dir, &dentry->d_name, 1, &sinfo, &bh, &de);
927 inode = fat_build_inode(sb, de, sinfo.i_pos, &res);
930 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
931 mark_inode_dirty(inode);
935 inode->i_nlink = 2; /* no need to mark them dirty */
936 res = fat_new_dir(inode, dir, 1);
939 dentry->d_time = dentry->d_parent->d_inode->i_version;
940 d_instantiate(dentry, inode);
949 inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
951 mark_inode_dirty(inode);
953 vfat_remove_entry(dir, &sinfo, bh, de);
959 static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
960 struct inode *new_dir, struct dentry *new_dentry)
962 struct buffer_head *old_bh, *new_bh, *dotdot_bh;
963 struct msdos_dir_entry *old_de, *new_de, *dotdot_de;
965 struct inode *old_inode, *new_inode;
967 struct vfat_slot_info old_sinfo, sinfo;
969 old_bh = new_bh = dotdot_bh = NULL;
970 old_inode = old_dentry->d_inode;
971 new_inode = new_dentry->d_inode;
973 res = vfat_find(old_dir, &old_dentry->d_name, &old_sinfo, &old_bh,
978 is_dir = S_ISDIR(old_inode->i_mode);
981 if (fat_scan(old_inode, MSDOS_DOTDOT, &dotdot_bh,
982 &dotdot_de, &dotdot_i_pos) < 0) {
988 if (new_dentry->d_inode) {
989 res = vfat_find(new_dir, &new_dentry->d_name, &sinfo, &new_bh,
991 if (res < 0 || MSDOS_I(new_inode)->i_pos != sinfo.i_pos) {
992 /* WTF??? Cry and fail. */
993 printk(KERN_WARNING "vfat_rename: fs corrupted\n");
998 res = fat_dir_empty(new_inode);
1002 fat_detach(new_inode);
1004 res = vfat_add_entry(new_dir, &new_dentry->d_name, is_dir,
1005 &sinfo, &new_bh, &new_de);
1010 new_dir->i_version++;
1012 /* releases old_bh */
1013 vfat_remove_entry(old_dir, &old_sinfo, old_bh, old_de);
1015 fat_detach(old_inode);
1016 fat_attach(old_inode, sinfo.i_pos);
1017 mark_inode_dirty(old_inode);
1019 old_dir->i_version++;
1020 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
1021 mark_inode_dirty(old_dir);
1023 new_inode->i_nlink--;
1024 new_inode->i_ctime = CURRENT_TIME_SEC;
1028 int start = MSDOS_I(new_dir)->i_logstart;
1029 dotdot_de->start = cpu_to_le16(start);
1030 dotdot_de->starthi = cpu_to_le16(start>>16);
1031 mark_buffer_dirty(dotdot_bh);
1034 new_inode->i_nlink--;
1037 mark_inode_dirty(new_dir);
1049 static struct inode_operations vfat_dir_inode_operations = {
1050 .create = vfat_create,
1051 .lookup = vfat_lookup,
1052 .unlink = vfat_unlink,
1053 .mkdir = vfat_mkdir,
1054 .rmdir = vfat_rmdir,
1055 .rename = vfat_rename,
1056 .setattr = fat_notify_change,
1059 static int vfat_fill_super(struct super_block *sb, void *data, int silent)
1063 res = fat_fill_super(sb, data, silent, &vfat_dir_inode_operations, 1);
1067 if (MSDOS_SB(sb)->options.name_check != 's')
1068 sb->s_root->d_op = &vfat_dentry_ops[0];
1070 sb->s_root->d_op = &vfat_dentry_ops[2];
1075 static struct super_block *vfat_get_sb(struct file_system_type *fs_type,
1076 int flags, const char *dev_name,
1079 return get_sb_bdev(fs_type, flags, dev_name, data, vfat_fill_super);
1082 static struct file_system_type vfat_fs_type = {
1083 .owner = THIS_MODULE,
1085 .get_sb = vfat_get_sb,
1086 .kill_sb = kill_block_super,
1087 .fs_flags = FS_REQUIRES_DEV,
1090 static int __init init_vfat_fs(void)
1092 return register_filesystem(&vfat_fs_type);
1095 static void __exit exit_vfat_fs(void)
1097 unregister_filesystem(&vfat_fs_type);
1100 MODULE_LICENSE("GPL");
1101 MODULE_DESCRIPTION("VFAT filesystem support");
1102 MODULE_AUTHOR("Gordon Chaffee");
1104 module_init(init_vfat_fs)
1105 module_exit(exit_vfat_fs)