super.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. /*
  2. * linux/fs/sysv/inode.c
  3. *
  4. * minix/inode.c
  5. * Copyright (C) 1991, 1992 Linus Torvalds
  6. *
  7. * xenix/inode.c
  8. * Copyright (C) 1992 Doug Evans
  9. *
  10. * coh/inode.c
  11. * Copyright (C) 1993 Pascal Haible, Bruno Haible
  12. *
  13. * sysv/inode.c
  14. * Copyright (C) 1993 Paul B. Monday
  15. *
  16. * sysv/inode.c
  17. * Copyright (C) 1993 Bruno Haible
  18. * Copyright (C) 1997, 1998 Krzysztof G. Baranowski
  19. *
  20. * This file contains code for read/parsing the superblock.
  21. */
  22. #include <linux/module.h>
  23. #include <linux/init.h>
  24. #include <linux/slab.h>
  25. #include <linux/buffer_head.h>
  26. #include <linux/parser.h>
  27. #include "sysv.h"
  28. /*
  29. * The following functions try to recognize specific filesystems.
  30. *
  31. * We recognize:
  32. * - Xenix FS by its magic number.
  33. * - SystemV FS by its magic number.
  34. * - Coherent FS by its funny fname/fpack field.
  35. * - SCO AFS by s_nfree == 0xffff
  36. * - V7 FS has no distinguishing features.
  37. *
  38. * We discriminate among SystemV4 and SystemV2 FS by the assumption that
  39. * the time stamp is not < 01-01-1980.
  40. */
  41. enum {
  42. JAN_1_1980 = (10*365 + 2) * 24 * 60 * 60
  43. };
  44. static void detected_xenix(struct sysv_sb_info *sbi)
  45. {
  46. struct buffer_head *bh1 = sbi->s_bh1;
  47. struct buffer_head *bh2 = sbi->s_bh2;
  48. struct xenix_super_block * sbd1;
  49. struct xenix_super_block * sbd2;
  50. if (bh1 != bh2)
  51. sbd1 = sbd2 = (struct xenix_super_block *) bh1->b_data;
  52. else {
  53. /* block size = 512, so bh1 != bh2 */
  54. sbd1 = (struct xenix_super_block *) bh1->b_data;
  55. sbd2 = (struct xenix_super_block *) (bh2->b_data - 512);
  56. }
  57. sbi->s_link_max = XENIX_LINK_MAX;
  58. sbi->s_fic_size = XENIX_NICINOD;
  59. sbi->s_flc_size = XENIX_NICFREE;
  60. sbi->s_sbd1 = (char *)sbd1;
  61. sbi->s_sbd2 = (char *)sbd2;
  62. sbi->s_sb_fic_count = &sbd1->s_ninode;
  63. sbi->s_sb_fic_inodes = &sbd1->s_inode[0];
  64. sbi->s_sb_total_free_inodes = &sbd2->s_tinode;
  65. sbi->s_bcache_count = &sbd1->s_nfree;
  66. sbi->s_bcache = &sbd1->s_free[0];
  67. sbi->s_free_blocks = &sbd2->s_tfree;
  68. sbi->s_sb_time = &sbd2->s_time;
  69. sbi->s_firstdatazone = fs16_to_cpu(sbi, sbd1->s_isize);
  70. sbi->s_nzones = fs32_to_cpu(sbi, sbd1->s_fsize);
  71. }
  72. static void detected_sysv4(struct sysv_sb_info *sbi)
  73. {
  74. struct sysv4_super_block * sbd;
  75. struct buffer_head *bh1 = sbi->s_bh1;
  76. struct buffer_head *bh2 = sbi->s_bh2;
  77. if (bh1 == bh2)
  78. sbd = (struct sysv4_super_block *) (bh1->b_data + BLOCK_SIZE/2);
  79. else
  80. sbd = (struct sysv4_super_block *) bh2->b_data;
  81. sbi->s_link_max = SYSV_LINK_MAX;
  82. sbi->s_fic_size = SYSV_NICINOD;
  83. sbi->s_flc_size = SYSV_NICFREE;
  84. sbi->s_sbd1 = (char *)sbd;
  85. sbi->s_sbd2 = (char *)sbd;
  86. sbi->s_sb_fic_count = &sbd->s_ninode;
  87. sbi->s_sb_fic_inodes = &sbd->s_inode[0];
  88. sbi->s_sb_total_free_inodes = &sbd->s_tinode;
  89. sbi->s_bcache_count = &sbd->s_nfree;
  90. sbi->s_bcache = &sbd->s_free[0];
  91. sbi->s_free_blocks = &sbd->s_tfree;
  92. sbi->s_sb_time = &sbd->s_time;
  93. sbi->s_sb_state = &sbd->s_state;
  94. sbi->s_firstdatazone = fs16_to_cpu(sbi, sbd->s_isize);
  95. sbi->s_nzones = fs32_to_cpu(sbi, sbd->s_fsize);
  96. }
  97. static void detected_sysv2(struct sysv_sb_info *sbi)
  98. {
  99. struct sysv2_super_block *sbd;
  100. struct buffer_head *bh1 = sbi->s_bh1;
  101. struct buffer_head *bh2 = sbi->s_bh2;
  102. if (bh1 == bh2)
  103. sbd = (struct sysv2_super_block *) (bh1->b_data + BLOCK_SIZE/2);
  104. else
  105. sbd = (struct sysv2_super_block *) bh2->b_data;
  106. sbi->s_link_max = SYSV_LINK_MAX;
  107. sbi->s_fic_size = SYSV_NICINOD;
  108. sbi->s_flc_size = SYSV_NICFREE;
  109. sbi->s_sbd1 = (char *)sbd;
  110. sbi->s_sbd2 = (char *)sbd;
  111. sbi->s_sb_fic_count = &sbd->s_ninode;
  112. sbi->s_sb_fic_inodes = &sbd->s_inode[0];
  113. sbi->s_sb_total_free_inodes = &sbd->s_tinode;
  114. sbi->s_bcache_count = &sbd->s_nfree;
  115. sbi->s_bcache = &sbd->s_free[0];
  116. sbi->s_free_blocks = &sbd->s_tfree;
  117. sbi->s_sb_time = &sbd->s_time;
  118. sbi->s_sb_state = &sbd->s_state;
  119. sbi->s_firstdatazone = fs16_to_cpu(sbi, sbd->s_isize);
  120. sbi->s_nzones = fs32_to_cpu(sbi, sbd->s_fsize);
  121. }
  122. static void detected_coherent(struct sysv_sb_info *sbi)
  123. {
  124. struct coh_super_block * sbd;
  125. struct buffer_head *bh1 = sbi->s_bh1;
  126. sbd = (struct coh_super_block *) bh1->b_data;
  127. sbi->s_link_max = COH_LINK_MAX;
  128. sbi->s_fic_size = COH_NICINOD;
  129. sbi->s_flc_size = COH_NICFREE;
  130. sbi->s_sbd1 = (char *)sbd;
  131. sbi->s_sbd2 = (char *)sbd;
  132. sbi->s_sb_fic_count = &sbd->s_ninode;
  133. sbi->s_sb_fic_inodes = &sbd->s_inode[0];
  134. sbi->s_sb_total_free_inodes = &sbd->s_tinode;
  135. sbi->s_bcache_count = &sbd->s_nfree;
  136. sbi->s_bcache = &sbd->s_free[0];
  137. sbi->s_free_blocks = &sbd->s_tfree;
  138. sbi->s_sb_time = &sbd->s_time;
  139. sbi->s_firstdatazone = fs16_to_cpu(sbi, sbd->s_isize);
  140. sbi->s_nzones = fs32_to_cpu(sbi, sbd->s_fsize);
  141. }
  142. static void detected_v7(struct sysv_sb_info *sbi)
  143. {
  144. struct buffer_head *bh2 = sbi->s_bh2;
  145. struct v7_super_block *sbd = (struct v7_super_block *)bh2->b_data;
  146. sbi->s_link_max = V7_LINK_MAX;
  147. sbi->s_fic_size = V7_NICINOD;
  148. sbi->s_flc_size = V7_NICFREE;
  149. sbi->s_sbd1 = (char *)sbd;
  150. sbi->s_sbd2 = (char *)sbd;
  151. sbi->s_sb_fic_count = &sbd->s_ninode;
  152. sbi->s_sb_fic_inodes = &sbd->s_inode[0];
  153. sbi->s_sb_total_free_inodes = &sbd->s_tinode;
  154. sbi->s_bcache_count = &sbd->s_nfree;
  155. sbi->s_bcache = &sbd->s_free[0];
  156. sbi->s_free_blocks = &sbd->s_tfree;
  157. sbi->s_sb_time = &sbd->s_time;
  158. sbi->s_firstdatazone = fs16_to_cpu(sbi, sbd->s_isize);
  159. sbi->s_nzones = fs32_to_cpu(sbi, sbd->s_fsize);
  160. }
  161. static int detect_xenix(struct sysv_sb_info *sbi, struct buffer_head *bh)
  162. {
  163. struct xenix_super_block *sbd = (struct xenix_super_block *)bh->b_data;
  164. if (*(__le32 *)&sbd->s_magic == cpu_to_le32(0x2b5544))
  165. sbi->s_bytesex = BYTESEX_LE;
  166. else if (*(__be32 *)&sbd->s_magic == cpu_to_be32(0x2b5544))
  167. sbi->s_bytesex = BYTESEX_BE;
  168. else
  169. return 0;
  170. switch (fs32_to_cpu(sbi, sbd->s_type)) {
  171. case 1:
  172. sbi->s_type = FSTYPE_XENIX;
  173. return 1;
  174. case 2:
  175. sbi->s_type = FSTYPE_XENIX;
  176. return 2;
  177. default:
  178. return 0;
  179. }
  180. }
  181. static int detect_sysv(struct sysv_sb_info *sbi, struct buffer_head *bh)
  182. {
  183. struct super_block *sb = sbi->s_sb;
  184. /* All relevant fields are at the same offsets in R2 and R4 */
  185. struct sysv4_super_block * sbd;
  186. u32 type;
  187. sbd = (struct sysv4_super_block *) (bh->b_data + BLOCK_SIZE/2);
  188. if (*(__le32 *)&sbd->s_magic == cpu_to_le32(0xfd187e20))
  189. sbi->s_bytesex = BYTESEX_LE;
  190. else if (*(__be32 *)&sbd->s_magic == cpu_to_be32(0xfd187e20))
  191. sbi->s_bytesex = BYTESEX_BE;
  192. else
  193. return 0;
  194. type = fs32_to_cpu(sbi, sbd->s_type);
  195. if (fs16_to_cpu(sbi, sbd->s_nfree) == 0xffff) {
  196. sbi->s_type = FSTYPE_AFS;
  197. sbi->s_forced_ro = 1;
  198. if (!(sb->s_flags & MS_RDONLY)) {
  199. printk("SysV FS: SCO EAFS on %s detected, "
  200. "forcing read-only mode.\n",
  201. sb->s_id);
  202. }
  203. return type;
  204. }
  205. if (fs32_to_cpu(sbi, sbd->s_time) < JAN_1_1980) {
  206. /* this is likely to happen on SystemV2 FS */
  207. if (type > 3 || type < 1)
  208. return 0;
  209. sbi->s_type = FSTYPE_SYSV2;
  210. return type;
  211. }
  212. if ((type > 3 || type < 1) && (type > 0x30 || type < 0x10))
  213. return 0;
  214. /* On Interactive Unix (ISC) Version 4.0/3.x s_type field = 0x10,
  215. 0x20 or 0x30 indicates that symbolic links and the 14-character
  216. filename limit is gone. Due to lack of information about this
  217. feature read-only mode seems to be a reasonable approach... -KGB */
  218. if (type >= 0x10) {
  219. printk("SysV FS: can't handle long file names on %s, "
  220. "forcing read-only mode.\n", sb->s_id);
  221. sbi->s_forced_ro = 1;
  222. }
  223. sbi->s_type = FSTYPE_SYSV4;
  224. return type >= 0x10 ? type >> 4 : type;
  225. }
  226. static int detect_coherent(struct sysv_sb_info *sbi, struct buffer_head *bh)
  227. {
  228. struct coh_super_block * sbd;
  229. sbd = (struct coh_super_block *) (bh->b_data + BLOCK_SIZE/2);
  230. if ((memcmp(sbd->s_fname,"noname",6) && memcmp(sbd->s_fname,"xxxxx ",6))
  231. || (memcmp(sbd->s_fpack,"nopack",6) && memcmp(sbd->s_fpack,"xxxxx\n",6)))
  232. return 0;
  233. sbi->s_bytesex = BYTESEX_PDP;
  234. sbi->s_type = FSTYPE_COH;
  235. return 1;
  236. }
  237. static int detect_sysv_odd(struct sysv_sb_info *sbi, struct buffer_head *bh)
  238. {
  239. int size = detect_sysv(sbi, bh);
  240. return size>2 ? 0 : size;
  241. }
  242. static struct {
  243. int block;
  244. int (*test)(struct sysv_sb_info *, struct buffer_head *);
  245. } flavours[] = {
  246. {1, detect_xenix},
  247. {0, detect_sysv},
  248. {0, detect_coherent},
  249. {9, detect_sysv_odd},
  250. {15,detect_sysv_odd},
  251. {18,detect_sysv},
  252. };
  253. static char *flavour_names[] = {
  254. [FSTYPE_XENIX] = "Xenix",
  255. [FSTYPE_SYSV4] = "SystemV",
  256. [FSTYPE_SYSV2] = "SystemV Release 2",
  257. [FSTYPE_COH] = "Coherent",
  258. [FSTYPE_V7] = "V7",
  259. [FSTYPE_AFS] = "AFS",
  260. };
  261. static void (*flavour_setup[])(struct sysv_sb_info *) = {
  262. [FSTYPE_XENIX] = detected_xenix,
  263. [FSTYPE_SYSV4] = detected_sysv4,
  264. [FSTYPE_SYSV2] = detected_sysv2,
  265. [FSTYPE_COH] = detected_coherent,
  266. [FSTYPE_V7] = detected_v7,
  267. [FSTYPE_AFS] = detected_sysv4,
  268. };
  269. static int complete_read_super(struct super_block *sb, int silent, int size)
  270. {
  271. struct sysv_sb_info *sbi = SYSV_SB(sb);
  272. struct inode *root_inode;
  273. char *found = flavour_names[sbi->s_type];
  274. u_char n_bits = size+8;
  275. int bsize = 1 << n_bits;
  276. int bsize_4 = bsize >> 2;
  277. sbi->s_firstinodezone = 2;
  278. flavour_setup[sbi->s_type](sbi);
  279. sbi->s_truncate = 1;
  280. sbi->s_ndatazones = sbi->s_nzones - sbi->s_firstdatazone;
  281. sbi->s_inodes_per_block = bsize >> 6;
  282. sbi->s_inodes_per_block_1 = (bsize >> 6)-1;
  283. sbi->s_inodes_per_block_bits = n_bits-6;
  284. sbi->s_ind_per_block = bsize_4;
  285. sbi->s_ind_per_block_2 = bsize_4*bsize_4;
  286. sbi->s_toobig_block = 10 + bsize_4 * (1 + bsize_4 * (1 + bsize_4));
  287. sbi->s_ind_per_block_bits = n_bits-2;
  288. sbi->s_ninodes = (sbi->s_firstdatazone - sbi->s_firstinodezone)
  289. << sbi->s_inodes_per_block_bits;
  290. if (!silent)
  291. printk("VFS: Found a %s FS (block size = %ld) on device %s\n",
  292. found, sb->s_blocksize, sb->s_id);
  293. sb->s_magic = SYSV_MAGIC_BASE + sbi->s_type;
  294. /* set up enough so that it can read an inode */
  295. sb->s_op = &sysv_sops;
  296. root_inode = sysv_iget(sb, SYSV_ROOT_INO);
  297. if (IS_ERR(root_inode)) {
  298. printk("SysV FS: get root inode failed\n");
  299. return 0;
  300. }
  301. sb->s_root = d_alloc_root(root_inode);
  302. if (!sb->s_root) {
  303. iput(root_inode);
  304. printk("SysV FS: get root dentry failed\n");
  305. return 0;
  306. }
  307. if (sbi->s_forced_ro)
  308. sb->s_flags |= MS_RDONLY;
  309. if (sbi->s_truncate)
  310. sb->s_root->d_op = &sysv_dentry_operations;
  311. return 1;
  312. }
  313. static int sysv_fill_super(struct super_block *sb, void *data, int silent)
  314. {
  315. struct buffer_head *bh1, *bh = NULL;
  316. struct sysv_sb_info *sbi;
  317. unsigned long blocknr;
  318. int size = 0, i;
  319. BUILD_BUG_ON(1024 != sizeof (struct xenix_super_block));
  320. BUILD_BUG_ON(512 != sizeof (struct sysv4_super_block));
  321. BUILD_BUG_ON(512 != sizeof (struct sysv2_super_block));
  322. BUILD_BUG_ON(500 != sizeof (struct coh_super_block));
  323. BUILD_BUG_ON(64 != sizeof (struct sysv_inode));
  324. sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
  325. if (!sbi)
  326. return -ENOMEM;
  327. sbi->s_sb = sb;
  328. sbi->s_block_base = 0;
  329. sb->s_fs_info = sbi;
  330. sb_set_blocksize(sb, BLOCK_SIZE);
  331. for (i = 0; i < ARRAY_SIZE(flavours) && !size; i++) {
  332. brelse(bh);
  333. bh = sb_bread(sb, flavours[i].block);
  334. if (!bh)
  335. continue;
  336. size = flavours[i].test(SYSV_SB(sb), bh);
  337. }
  338. if (!size)
  339. goto Eunknown;
  340. switch (size) {
  341. case 1:
  342. blocknr = bh->b_blocknr << 1;
  343. brelse(bh);
  344. sb_set_blocksize(sb, 512);
  345. bh1 = sb_bread(sb, blocknr);
  346. bh = sb_bread(sb, blocknr + 1);
  347. break;
  348. case 2:
  349. bh1 = bh;
  350. break;
  351. case 3:
  352. blocknr = bh->b_blocknr >> 1;
  353. brelse(bh);
  354. sb_set_blocksize(sb, 2048);
  355. bh1 = bh = sb_bread(sb, blocknr);
  356. break;
  357. default:
  358. goto Ebadsize;
  359. }
  360. if (bh && bh1) {
  361. sbi->s_bh1 = bh1;
  362. sbi->s_bh2 = bh;
  363. if (complete_read_super(sb, silent, size))
  364. return 0;
  365. }
  366. brelse(bh1);
  367. brelse(bh);
  368. sb_set_blocksize(sb, BLOCK_SIZE);
  369. printk("oldfs: cannot read superblock\n");
  370. failed:
  371. kfree(sbi);
  372. return -EINVAL;
  373. Eunknown:
  374. brelse(bh);
  375. if (!silent)
  376. printk("VFS: unable to find oldfs superblock on device %s\n",
  377. sb->s_id);
  378. goto failed;
  379. Ebadsize:
  380. brelse(bh);
  381. if (!silent)
  382. printk("VFS: oldfs: unsupported block size (%dKb)\n",
  383. 1<<(size-2));
  384. goto failed;
  385. }
  386. static int v7_sanity_check(struct super_block *sb, struct buffer_head *bh)
  387. {
  388. struct v7_super_block *v7sb;
  389. struct sysv_inode *v7i;
  390. struct buffer_head *bh2;
  391. struct sysv_sb_info *sbi;
  392. sbi = sb->s_fs_info;
  393. /* plausibility check on superblock */
  394. v7sb = (struct v7_super_block *) bh->b_data;
  395. if (fs16_to_cpu(sbi, v7sb->s_nfree) > V7_NICFREE ||
  396. fs16_to_cpu(sbi, v7sb->s_ninode) > V7_NICINOD ||
  397. fs32_to_cpu(sbi, v7sb->s_fsize) > V7_MAXSIZE)
  398. return 0;
  399. /* plausibility check on root inode: it is a directory,
  400. with a nonzero size that is a multiple of 16 */
  401. bh2 = sb_bread(sb, 2);
  402. if (bh2 == NULL)
  403. return 0;
  404. v7i = (struct sysv_inode *)(bh2->b_data + 64);
  405. if ((fs16_to_cpu(sbi, v7i->i_mode) & ~0777) != S_IFDIR ||
  406. (fs32_to_cpu(sbi, v7i->i_size) == 0) ||
  407. (fs32_to_cpu(sbi, v7i->i_size) & 017) ||
  408. (fs32_to_cpu(sbi, v7i->i_size) > V7_NFILES *
  409. sizeof(struct sysv_dir_entry))) {
  410. brelse(bh2);
  411. return 0;
  412. }
  413. brelse(bh2);
  414. return 1;
  415. }
  416. static int v7_fill_super(struct super_block *sb, void *data, int silent)
  417. {
  418. struct sysv_sb_info *sbi;
  419. struct buffer_head *bh;
  420. if (440 != sizeof (struct v7_super_block))
  421. panic("V7 FS: bad super-block size");
  422. if (64 != sizeof (struct sysv_inode))
  423. panic("sysv fs: bad i-node size");
  424. sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
  425. if (!sbi)
  426. return -ENOMEM;
  427. sbi->s_sb = sb;
  428. sbi->s_block_base = 0;
  429. sbi->s_type = FSTYPE_V7;
  430. sb->s_fs_info = sbi;
  431. sb_set_blocksize(sb, 512);
  432. if ((bh = sb_bread(sb, 1)) == NULL) {
  433. if (!silent)
  434. printk("VFS: unable to read V7 FS superblock on "
  435. "device %s.\n", sb->s_id);
  436. goto failed;
  437. }
  438. /* Try PDP-11 UNIX */
  439. sbi->s_bytesex = BYTESEX_PDP;
  440. if (v7_sanity_check(sb, bh))
  441. goto detected;
  442. /* Try PC/IX, v7/x86 */
  443. sbi->s_bytesex = BYTESEX_LE;
  444. if (v7_sanity_check(sb, bh))
  445. goto detected;
  446. goto failed;
  447. detected:
  448. sbi->s_bh1 = bh;
  449. sbi->s_bh2 = bh;
  450. if (complete_read_super(sb, silent, 1))
  451. return 0;
  452. failed:
  453. printk(KERN_ERR "VFS: could not find a valid V7 on %s.\n",
  454. sb->s_id);
  455. brelse(bh);
  456. kfree(sbi);
  457. return -EINVAL;
  458. }
  459. /* Every kernel module contains stuff like this. */
  460. static int sysv_get_sb(struct file_system_type *fs_type,
  461. int flags, const char *dev_name, void *data, struct vfsmount *mnt)
  462. {
  463. return get_sb_bdev(fs_type, flags, dev_name, data, sysv_fill_super,
  464. mnt);
  465. }
  466. static int v7_get_sb(struct file_system_type *fs_type,
  467. int flags, const char *dev_name, void *data, struct vfsmount *mnt)
  468. {
  469. return get_sb_bdev(fs_type, flags, dev_name, data, v7_fill_super, mnt);
  470. }
  471. static struct file_system_type sysv_fs_type = {
  472. .owner = THIS_MODULE,
  473. .name = "sysv",
  474. .get_sb = sysv_get_sb,
  475. .kill_sb = kill_block_super,
  476. .fs_flags = FS_REQUIRES_DEV,
  477. };
  478. static struct file_system_type v7_fs_type = {
  479. .owner = THIS_MODULE,
  480. .name = "v7",
  481. .get_sb = v7_get_sb,
  482. .kill_sb = kill_block_super,
  483. .fs_flags = FS_REQUIRES_DEV,
  484. };
  485. static int __init init_sysv_fs(void)
  486. {
  487. int error;
  488. error = sysv_init_icache();
  489. if (error)
  490. goto out;
  491. error = register_filesystem(&sysv_fs_type);
  492. if (error)
  493. goto destroy_icache;
  494. error = register_filesystem(&v7_fs_type);
  495. if (error)
  496. goto unregister;
  497. return 0;
  498. unregister:
  499. unregister_filesystem(&sysv_fs_type);
  500. destroy_icache:
  501. sysv_destroy_icache();
  502. out:
  503. return error;
  504. }
  505. static void __exit exit_sysv_fs(void)
  506. {
  507. unregister_filesystem(&sysv_fs_type);
  508. unregister_filesystem(&v7_fs_type);
  509. sysv_destroy_icache();
  510. }
  511. module_init(init_sysv_fs)
  512. module_exit(exit_sysv_fs)
  513. MODULE_ALIAS("v7");
  514. MODULE_LICENSE("GPL");