PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/fs/fat/namei_msdos.c

https://github.com/mstsirkin/linux
C | 693 lines | 559 code | 71 blank | 63 comment | 155 complexity | b875a1815289ba2f48009f1cb236cb5a MD5 | raw file
  1. /*
  2. * linux/fs/msdos/namei.c
  3. *
  4. * Written 1992,1993 by Werner Almesberger
  5. * Hidden files 1995 by Albert Cahalan <albert@ccs.neu.edu> <adc@coe.neu.edu>
  6. * Rewritten for constant inumbers 1999 by Al Viro
  7. */
  8. #include <linux/module.h>
  9. #include <linux/time.h>
  10. #include <linux/buffer_head.h>
  11. #include "fat.h"
  12. /* Characters that are undesirable in an MS-DOS file name */
  13. static unsigned char bad_chars[] = "*?<>|\"";
  14. static unsigned char bad_if_strict[] = "+=,; ";
  15. /***** Formats an MS-DOS file name. Rejects invalid names. */
  16. static int msdos_format_name(const unsigned char *name, int len,
  17. unsigned char *res, struct fat_mount_options *opts)
  18. /*
  19. * name is the proposed name, len is its length, res is
  20. * the resulting name, opts->name_check is either (r)elaxed,
  21. * (n)ormal or (s)trict, opts->dotsOK allows dots at the
  22. * beginning of name (for hidden files)
  23. */
  24. {
  25. unsigned char *walk;
  26. unsigned char c;
  27. int space;
  28. if (name[0] == '.') { /* dotfile because . and .. already done */
  29. if (opts->dotsOK) {
  30. /* Get rid of dot - test for it elsewhere */
  31. name++;
  32. len--;
  33. } else
  34. return -EINVAL;
  35. }
  36. /*
  37. * disallow names that _really_ start with a dot
  38. */
  39. space = 1;
  40. c = 0;
  41. for (walk = res; len && walk - res < 8; walk++) {
  42. c = *name++;
  43. len--;
  44. if (opts->name_check != 'r' && strchr(bad_chars, c))
  45. return -EINVAL;
  46. if (opts->name_check == 's' && strchr(bad_if_strict, c))
  47. return -EINVAL;
  48. if (c >= 'A' && c <= 'Z' && opts->name_check == 's')
  49. return -EINVAL;
  50. if (c < ' ' || c == ':' || c == '\\')
  51. return -EINVAL;
  52. /*
  53. * 0xE5 is legal as a first character, but we must substitute
  54. * 0x05 because 0xE5 marks deleted files. Yes, DOS really
  55. * does this.
  56. * It seems that Microsoft hacked DOS to support non-US
  57. * characters after the 0xE5 character was already in use to
  58. * mark deleted files.
  59. */
  60. if ((res == walk) && (c == 0xE5))
  61. c = 0x05;
  62. if (c == '.')
  63. break;
  64. space = (c == ' ');
  65. *walk = (!opts->nocase && c >= 'a' && c <= 'z') ? c - 32 : c;
  66. }
  67. if (space)
  68. return -EINVAL;
  69. if (opts->name_check == 's' && len && c != '.') {
  70. c = *name++;
  71. len--;
  72. if (c != '.')
  73. return -EINVAL;
  74. }
  75. while (c != '.' && len--)
  76. c = *name++;
  77. if (c == '.') {
  78. while (walk - res < 8)
  79. *walk++ = ' ';
  80. while (len > 0 && walk - res < MSDOS_NAME) {
  81. c = *name++;
  82. len--;
  83. if (opts->name_check != 'r' && strchr(bad_chars, c))
  84. return -EINVAL;
  85. if (opts->name_check == 's' &&
  86. strchr(bad_if_strict, c))
  87. return -EINVAL;
  88. if (c < ' ' || c == ':' || c == '\\')
  89. return -EINVAL;
  90. if (c == '.') {
  91. if (opts->name_check == 's')
  92. return -EINVAL;
  93. break;
  94. }
  95. if (c >= 'A' && c <= 'Z' && opts->name_check == 's')
  96. return -EINVAL;
  97. space = c == ' ';
  98. if (!opts->nocase && c >= 'a' && c <= 'z')
  99. *walk++ = c - 32;
  100. else
  101. *walk++ = c;
  102. }
  103. if (space)
  104. return -EINVAL;
  105. if (opts->name_check == 's' && len)
  106. return -EINVAL;
  107. }
  108. while (walk - res < MSDOS_NAME)
  109. *walk++ = ' ';
  110. return 0;
  111. }
  112. /***** Locates a directory entry. Uses unformatted name. */
  113. static int msdos_find(struct inode *dir, const unsigned char *name, int len,
  114. struct fat_slot_info *sinfo)
  115. {
  116. struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
  117. unsigned char msdos_name[MSDOS_NAME];
  118. int err;
  119. err = msdos_format_name(name, len, msdos_name, &sbi->options);
  120. if (err)
  121. return -ENOENT;
  122. err = fat_scan(dir, msdos_name, sinfo);
  123. if (!err && sbi->options.dotsOK) {
  124. if (name[0] == '.') {
  125. if (!(sinfo->de->attr & ATTR_HIDDEN))
  126. err = -ENOENT;
  127. } else {
  128. if (sinfo->de->attr & ATTR_HIDDEN)
  129. err = -ENOENT;
  130. }
  131. if (err)
  132. brelse(sinfo->bh);
  133. }
  134. return err;
  135. }
  136. /*
  137. * Compute the hash for the msdos name corresponding to the dentry.
  138. * Note: if the name is invalid, we leave the hash code unchanged so
  139. * that the existing dentry can be used. The msdos fs routines will
  140. * return ENOENT or EINVAL as appropriate.
  141. */
  142. static int msdos_hash(const struct dentry *dentry, const struct inode *inode,
  143. struct qstr *qstr)
  144. {
  145. struct fat_mount_options *options = &MSDOS_SB(dentry->d_sb)->options;
  146. unsigned char msdos_name[MSDOS_NAME];
  147. int error;
  148. error = msdos_format_name(qstr->name, qstr->len, msdos_name, options);
  149. if (!error)
  150. qstr->hash = full_name_hash(msdos_name, MSDOS_NAME);
  151. return 0;
  152. }
  153. /*
  154. * Compare two msdos names. If either of the names are invalid,
  155. * we fall back to doing the standard name comparison.
  156. */
  157. static int msdos_cmp(const struct dentry *parent, const struct inode *pinode,
  158. const struct dentry *dentry, const struct inode *inode,
  159. unsigned int len, const char *str, const struct qstr *name)
  160. {
  161. struct fat_mount_options *options = &MSDOS_SB(parent->d_sb)->options;
  162. unsigned char a_msdos_name[MSDOS_NAME], b_msdos_name[MSDOS_NAME];
  163. int error;
  164. error = msdos_format_name(name->name, name->len, a_msdos_name, options);
  165. if (error)
  166. goto old_compare;
  167. error = msdos_format_name(str, len, b_msdos_name, options);
  168. if (error)
  169. goto old_compare;
  170. error = memcmp(a_msdos_name, b_msdos_name, MSDOS_NAME);
  171. out:
  172. return error;
  173. old_compare:
  174. error = 1;
  175. if (name->len == len)
  176. error = memcmp(name->name, str, len);
  177. goto out;
  178. }
  179. static const struct dentry_operations msdos_dentry_operations = {
  180. .d_hash = msdos_hash,
  181. .d_compare = msdos_cmp,
  182. };
  183. /*
  184. * AV. Wrappers for FAT sb operations. Is it wise?
  185. */
  186. /***** Get inode using directory and name */
  187. static struct dentry *msdos_lookup(struct inode *dir, struct dentry *dentry,
  188. struct nameidata *nd)
  189. {
  190. struct super_block *sb = dir->i_sb;
  191. struct fat_slot_info sinfo;
  192. struct inode *inode;
  193. int err;
  194. lock_super(sb);
  195. err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo);
  196. switch (err) {
  197. case -ENOENT:
  198. inode = NULL;
  199. break;
  200. case 0:
  201. inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
  202. brelse(sinfo.bh);
  203. break;
  204. default:
  205. inode = ERR_PTR(err);
  206. }
  207. unlock_super(sb);
  208. return d_splice_alias(inode, dentry);
  209. }
  210. /***** Creates a directory entry (name is already formatted). */
  211. static int msdos_add_entry(struct inode *dir, const unsigned char *name,
  212. int is_dir, int is_hid, int cluster,
  213. struct timespec *ts, struct fat_slot_info *sinfo)
  214. {
  215. struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
  216. struct msdos_dir_entry de;
  217. __le16 time, date;
  218. int err;
  219. memcpy(de.name, name, MSDOS_NAME);
  220. de.attr = is_dir ? ATTR_DIR : ATTR_ARCH;
  221. if (is_hid)
  222. de.attr |= ATTR_HIDDEN;
  223. de.lcase = 0;
  224. fat_time_unix2fat(sbi, ts, &time, &date, NULL);
  225. de.cdate = de.adate = 0;
  226. de.ctime = 0;
  227. de.ctime_cs = 0;
  228. de.time = time;
  229. de.date = date;
  230. de.start = cpu_to_le16(cluster);
  231. de.starthi = cpu_to_le16(cluster >> 16);
  232. de.size = 0;
  233. err = fat_add_entries(dir, &de, 1, sinfo);
  234. if (err)
  235. return err;
  236. dir->i_ctime = dir->i_mtime = *ts;
  237. if (IS_DIRSYNC(dir))
  238. (void)fat_sync_inode(dir);
  239. else
  240. mark_inode_dirty(dir);
  241. return 0;
  242. }
  243. /***** Create a file */
  244. static int msdos_create(struct inode *dir, struct dentry *dentry, int mode,
  245. struct nameidata *nd)
  246. {
  247. struct super_block *sb = dir->i_sb;
  248. struct inode *inode = NULL;
  249. struct fat_slot_info sinfo;
  250. struct timespec ts;
  251. unsigned char msdos_name[MSDOS_NAME];
  252. int err, is_hid;
  253. lock_super(sb);
  254. err = msdos_format_name(dentry->d_name.name, dentry->d_name.len,
  255. msdos_name, &MSDOS_SB(sb)->options);
  256. if (err)
  257. goto out;
  258. is_hid = (dentry->d_name.name[0] == '.') && (msdos_name[0] != '.');
  259. /* Have to do it due to foo vs. .foo conflicts */
  260. if (!fat_scan(dir, msdos_name, &sinfo)) {
  261. brelse(sinfo.bh);
  262. err = -EINVAL;
  263. goto out;
  264. }
  265. ts = CURRENT_TIME_SEC;
  266. err = msdos_add_entry(dir, msdos_name, 0, is_hid, 0, &ts, &sinfo);
  267. if (err)
  268. goto out;
  269. inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
  270. brelse(sinfo.bh);
  271. if (IS_ERR(inode)) {
  272. err = PTR_ERR(inode);
  273. goto out;
  274. }
  275. inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
  276. /* timestamp is already written, so mark_inode_dirty() is unneeded. */
  277. d_instantiate(dentry, inode);
  278. out:
  279. unlock_super(sb);
  280. if (!err)
  281. err = fat_flush_inodes(sb, dir, inode);
  282. return err;
  283. }
  284. /***** Remove a directory */
  285. static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
  286. {
  287. struct super_block *sb = dir->i_sb;
  288. struct inode *inode = dentry->d_inode;
  289. struct fat_slot_info sinfo;
  290. int err;
  291. lock_super(sb);
  292. /*
  293. * Check whether the directory is not in use, then check
  294. * whether it is empty.
  295. */
  296. err = fat_dir_empty(inode);
  297. if (err)
  298. goto out;
  299. err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo);
  300. if (err)
  301. goto out;
  302. err = fat_remove_entries(dir, &sinfo); /* and releases bh */
  303. if (err)
  304. goto out;
  305. drop_nlink(dir);
  306. clear_nlink(inode);
  307. inode->i_ctime = CURRENT_TIME_SEC;
  308. fat_detach(inode);
  309. out:
  310. unlock_super(sb);
  311. if (!err)
  312. err = fat_flush_inodes(sb, dir, inode);
  313. return err;
  314. }
  315. /***** Make a directory */
  316. static int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode)
  317. {
  318. struct super_block *sb = dir->i_sb;
  319. struct fat_slot_info sinfo;
  320. struct inode *inode;
  321. unsigned char msdos_name[MSDOS_NAME];
  322. struct timespec ts;
  323. int err, is_hid, cluster;
  324. lock_super(sb);
  325. err = msdos_format_name(dentry->d_name.name, dentry->d_name.len,
  326. msdos_name, &MSDOS_SB(sb)->options);
  327. if (err)
  328. goto out;
  329. is_hid = (dentry->d_name.name[0] == '.') && (msdos_name[0] != '.');
  330. /* foo vs .foo situation */
  331. if (!fat_scan(dir, msdos_name, &sinfo)) {
  332. brelse(sinfo.bh);
  333. err = -EINVAL;
  334. goto out;
  335. }
  336. ts = CURRENT_TIME_SEC;
  337. cluster = fat_alloc_new_dir(dir, &ts);
  338. if (cluster < 0) {
  339. err = cluster;
  340. goto out;
  341. }
  342. err = msdos_add_entry(dir, msdos_name, 1, is_hid, cluster, &ts, &sinfo);
  343. if (err)
  344. goto out_free;
  345. inc_nlink(dir);
  346. inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
  347. brelse(sinfo.bh);
  348. if (IS_ERR(inode)) {
  349. err = PTR_ERR(inode);
  350. /* the directory was completed, just return a error */
  351. goto out;
  352. }
  353. inode->i_nlink = 2;
  354. inode->i_mtime = inode->i_atime = inode->i_ctime = ts;
  355. /* timestamp is already written, so mark_inode_dirty() is unneeded. */
  356. d_instantiate(dentry, inode);
  357. unlock_super(sb);
  358. fat_flush_inodes(sb, dir, inode);
  359. return 0;
  360. out_free:
  361. fat_free_clusters(dir, cluster);
  362. out:
  363. unlock_super(sb);
  364. return err;
  365. }
  366. /***** Unlink a file */
  367. static int msdos_unlink(struct inode *dir, struct dentry *dentry)
  368. {
  369. struct inode *inode = dentry->d_inode;
  370. struct super_block *sb= inode->i_sb;
  371. struct fat_slot_info sinfo;
  372. int err;
  373. lock_super(sb);
  374. err = msdos_find(dir, dentry->d_name.name, dentry->d_name.len, &sinfo);
  375. if (err)
  376. goto out;
  377. err = fat_remove_entries(dir, &sinfo); /* and releases bh */
  378. if (err)
  379. goto out;
  380. clear_nlink(inode);
  381. inode->i_ctime = CURRENT_TIME_SEC;
  382. fat_detach(inode);
  383. out:
  384. unlock_super(sb);
  385. if (!err)
  386. err = fat_flush_inodes(sb, dir, inode);
  387. return err;
  388. }
  389. static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
  390. struct dentry *old_dentry,
  391. struct inode *new_dir, unsigned char *new_name,
  392. struct dentry *new_dentry, int is_hid)
  393. {
  394. struct buffer_head *dotdot_bh;
  395. struct msdos_dir_entry *dotdot_de;
  396. struct inode *old_inode, *new_inode;
  397. struct fat_slot_info old_sinfo, sinfo;
  398. struct timespec ts;
  399. loff_t dotdot_i_pos, new_i_pos;
  400. int err, old_attrs, is_dir, update_dotdot, corrupt = 0;
  401. old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
  402. old_inode = old_dentry->d_inode;
  403. new_inode = new_dentry->d_inode;
  404. err = fat_scan(old_dir, old_name, &old_sinfo);
  405. if (err) {
  406. err = -EIO;
  407. goto out;
  408. }
  409. is_dir = S_ISDIR(old_inode->i_mode);
  410. update_dotdot = (is_dir && old_dir != new_dir);
  411. if (update_dotdot) {
  412. if (fat_get_dotdot_entry(old_inode, &dotdot_bh, &dotdot_de,
  413. &dotdot_i_pos) < 0) {
  414. err = -EIO;
  415. goto out;
  416. }
  417. }
  418. old_attrs = MSDOS_I(old_inode)->i_attrs;
  419. err = fat_scan(new_dir, new_name, &sinfo);
  420. if (!err) {
  421. if (!new_inode) {
  422. /* "foo" -> ".foo" case. just change the ATTR_HIDDEN */
  423. if (sinfo.de != old_sinfo.de) {
  424. err = -EINVAL;
  425. goto out;
  426. }
  427. if (is_hid)
  428. MSDOS_I(old_inode)->i_attrs |= ATTR_HIDDEN;
  429. else
  430. MSDOS_I(old_inode)->i_attrs &= ~ATTR_HIDDEN;
  431. if (IS_DIRSYNC(old_dir)) {
  432. err = fat_sync_inode(old_inode);
  433. if (err) {
  434. MSDOS_I(old_inode)->i_attrs = old_attrs;
  435. goto out;
  436. }
  437. } else
  438. mark_inode_dirty(old_inode);
  439. old_dir->i_version++;
  440. old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
  441. if (IS_DIRSYNC(old_dir))
  442. (void)fat_sync_inode(old_dir);
  443. else
  444. mark_inode_dirty(old_dir);
  445. goto out;
  446. }
  447. }
  448. ts = CURRENT_TIME_SEC;
  449. if (new_inode) {
  450. if (err)
  451. goto out;
  452. if (is_dir) {
  453. err = fat_dir_empty(new_inode);
  454. if (err)
  455. goto out;
  456. }
  457. new_i_pos = MSDOS_I(new_inode)->i_pos;
  458. fat_detach(new_inode);
  459. } else {
  460. err = msdos_add_entry(new_dir, new_name, is_dir, is_hid, 0,
  461. &ts, &sinfo);
  462. if (err)
  463. goto out;
  464. new_i_pos = sinfo.i_pos;
  465. }
  466. new_dir->i_version++;
  467. fat_detach(old_inode);
  468. fat_attach(old_inode, new_i_pos);
  469. if (is_hid)
  470. MSDOS_I(old_inode)->i_attrs |= ATTR_HIDDEN;
  471. else
  472. MSDOS_I(old_inode)->i_attrs &= ~ATTR_HIDDEN;
  473. if (IS_DIRSYNC(new_dir)) {
  474. err = fat_sync_inode(old_inode);
  475. if (err)
  476. goto error_inode;
  477. } else
  478. mark_inode_dirty(old_inode);
  479. if (update_dotdot) {
  480. int start = MSDOS_I(new_dir)->i_logstart;
  481. dotdot_de->start = cpu_to_le16(start);
  482. dotdot_de->starthi = cpu_to_le16(start >> 16);
  483. mark_buffer_dirty_inode(dotdot_bh, old_inode);
  484. if (IS_DIRSYNC(new_dir)) {
  485. err = sync_dirty_buffer(dotdot_bh);
  486. if (err)
  487. goto error_dotdot;
  488. }
  489. drop_nlink(old_dir);
  490. if (!new_inode)
  491. inc_nlink(new_dir);
  492. }
  493. err = fat_remove_entries(old_dir, &old_sinfo); /* and releases bh */
  494. old_sinfo.bh = NULL;
  495. if (err)
  496. goto error_dotdot;
  497. old_dir->i_version++;
  498. old_dir->i_ctime = old_dir->i_mtime = ts;
  499. if (IS_DIRSYNC(old_dir))
  500. (void)fat_sync_inode(old_dir);
  501. else
  502. mark_inode_dirty(old_dir);
  503. if (new_inode) {
  504. drop_nlink(new_inode);
  505. if (is_dir)
  506. drop_nlink(new_inode);
  507. new_inode->i_ctime = ts;
  508. }
  509. out:
  510. brelse(sinfo.bh);
  511. brelse(dotdot_bh);
  512. brelse(old_sinfo.bh);
  513. return err;
  514. error_dotdot:
  515. /* data cluster is shared, serious corruption */
  516. corrupt = 1;
  517. if (update_dotdot) {
  518. int start = MSDOS_I(old_dir)->i_logstart;
  519. dotdot_de->start = cpu_to_le16(start);
  520. dotdot_de->starthi = cpu_to_le16(start >> 16);
  521. mark_buffer_dirty_inode(dotdot_bh, old_inode);
  522. corrupt |= sync_dirty_buffer(dotdot_bh);
  523. }
  524. error_inode:
  525. fat_detach(old_inode);
  526. fat_attach(old_inode, old_sinfo.i_pos);
  527. MSDOS_I(old_inode)->i_attrs = old_attrs;
  528. if (new_inode) {
  529. fat_attach(new_inode, new_i_pos);
  530. if (corrupt)
  531. corrupt |= fat_sync_inode(new_inode);
  532. } else {
  533. /*
  534. * If new entry was not sharing the data cluster, it
  535. * shouldn't be serious corruption.
  536. */
  537. int err2 = fat_remove_entries(new_dir, &sinfo);
  538. if (corrupt)
  539. corrupt |= err2;
  540. sinfo.bh = NULL;
  541. }
  542. if (corrupt < 0) {
  543. fat_fs_error(new_dir->i_sb,
  544. "%s: Filesystem corrupted (i_pos %lld)",
  545. __func__, sinfo.i_pos);
  546. }
  547. goto out;
  548. }
  549. /***** Rename, a wrapper for rename_same_dir & rename_diff_dir */
  550. static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry,
  551. struct inode *new_dir, struct dentry *new_dentry)
  552. {
  553. struct super_block *sb = old_dir->i_sb;
  554. unsigned char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME];
  555. int err, is_hid;
  556. lock_super(sb);
  557. err = msdos_format_name(old_dentry->d_name.name,
  558. old_dentry->d_name.len, old_msdos_name,
  559. &MSDOS_SB(old_dir->i_sb)->options);
  560. if (err)
  561. goto out;
  562. err = msdos_format_name(new_dentry->d_name.name,
  563. new_dentry->d_name.len, new_msdos_name,
  564. &MSDOS_SB(new_dir->i_sb)->options);
  565. if (err)
  566. goto out;
  567. is_hid =
  568. (new_dentry->d_name.name[0] == '.') && (new_msdos_name[0] != '.');
  569. err = do_msdos_rename(old_dir, old_msdos_name, old_dentry,
  570. new_dir, new_msdos_name, new_dentry, is_hid);
  571. out:
  572. unlock_super(sb);
  573. if (!err)
  574. err = fat_flush_inodes(sb, old_dir, new_dir);
  575. return err;
  576. }
  577. static const struct inode_operations msdos_dir_inode_operations = {
  578. .create = msdos_create,
  579. .lookup = msdos_lookup,
  580. .unlink = msdos_unlink,
  581. .mkdir = msdos_mkdir,
  582. .rmdir = msdos_rmdir,
  583. .rename = msdos_rename,
  584. .setattr = fat_setattr,
  585. .getattr = fat_getattr,
  586. };
  587. static void setup(struct super_block *sb)
  588. {
  589. MSDOS_SB(sb)->dir_ops = &msdos_dir_inode_operations;
  590. sb->s_d_op = &msdos_dentry_operations;
  591. sb->s_flags |= MS_NOATIME;
  592. }
  593. static int msdos_fill_super(struct super_block *sb, void *data, int silent)
  594. {
  595. return fat_fill_super(sb, data, silent, 0, setup);
  596. }
  597. static struct dentry *msdos_mount(struct file_system_type *fs_type,
  598. int flags, const char *dev_name,
  599. void *data)
  600. {
  601. return mount_bdev(fs_type, flags, dev_name, data, msdos_fill_super);
  602. }
  603. static struct file_system_type msdos_fs_type = {
  604. .owner = THIS_MODULE,
  605. .name = "msdos",
  606. .mount = msdos_mount,
  607. .kill_sb = kill_block_super,
  608. .fs_flags = FS_REQUIRES_DEV,
  609. };
  610. static int __init init_msdos_fs(void)
  611. {
  612. return register_filesystem(&msdos_fs_type);
  613. }
  614. static void __exit exit_msdos_fs(void)
  615. {
  616. unregister_filesystem(&msdos_fs_type);
  617. }
  618. MODULE_LICENSE("GPL");
  619. MODULE_AUTHOR("Werner Almesberger");
  620. MODULE_DESCRIPTION("MS-DOS filesystem support");
  621. module_init(init_msdos_fs)
  622. module_exit(exit_msdos_fs)