original development tree for Linux kernel GTP module; now long in mainline.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

552 lines
13 KiB

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
12 years ago
fs: Limit sys_mount to only request filesystem modules. Modify the request_module to prefix the file system type with "fs-" and add aliases to all of the filesystems that can be built as modules to match. A common practice is to build all of the kernel code and leave code that is not commonly needed as modules, with the result that many users are exposed to any bug anywhere in the kernel. Looking for filesystems with a fs- prefix limits the pool of possible modules that can be loaded by mount to just filesystems trivially making things safer with no real cost. Using aliases means user space can control the policy of which filesystem modules are auto-loaded by editing /etc/modprobe.d/*.conf with blacklist and alias directives. Allowing simple, safe, well understood work-arounds to known problematic software. This also addresses a rare but unfortunate problem where the filesystem name is not the same as it's module name and module auto-loading would not work. While writing this patch I saw a handful of such cases. The most significant being autofs that lives in the module autofs4. This is relevant to user namespaces because we can reach the request module in get_fs_type() without having any special permissions, and people get uncomfortable when a user specified string (in this case the filesystem type) goes all of the way to request_module. After having looked at this issue I don't think there is any particular reason to perform any filtering or permission checks beyond making it clear in the module request that we want a filesystem module. The common pattern in the kernel is to call request_module() without regards to the users permissions. In general all a filesystem module does once loaded is call register_filesystem() and go to sleep. Which means there is not much attack surface exposed by loading a filesytem module unless the filesystem is mounted. In a user namespace filesystems are not mounted unless .fs_flags = FS_USERNS_MOUNT, which most filesystems do not set today. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Acked-by: Kees Cook <keescook@chromium.org> Reported-by: Kees Cook <keescook@google.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
9 years ago
  1. /*
  2. * linux/fs/adfs/super.c
  3. *
  4. * Copyright (C) 1997-1999 Russell King
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/module.h>
  11. #include <linux/init.h>
  12. #include <linux/buffer_head.h>
  13. #include <linux/parser.h>
  14. #include <linux/mount.h>
  15. #include <linux/seq_file.h>
  16. #include <linux/slab.h>
  17. #include <linux/statfs.h>
  18. #include <linux/user_namespace.h>
  19. #include "adfs.h"
  20. #include "dir_f.h"
  21. #include "dir_fplus.h"
  22. #define ADFS_DEFAULT_OWNER_MASK S_IRWXU
  23. #define ADFS_DEFAULT_OTHER_MASK (S_IRWXG | S_IRWXO)
  24. void __adfs_error(struct super_block *sb, const char *function, const char *fmt, ...)
  25. {
  26. char error_buf[128];
  27. va_list args;
  28. va_start(args, fmt);
  29. vsnprintf(error_buf, sizeof(error_buf), fmt, args);
  30. va_end(args);
  31. printk(KERN_CRIT "ADFS-fs error (device %s)%s%s: %s\n",
  32. sb->s_id, function ? ": " : "",
  33. function ? function : "", error_buf);
  34. }
  35. static int adfs_checkdiscrecord(struct adfs_discrecord *dr)
  36. {
  37. int i;
  38. /* sector size must be 256, 512 or 1024 bytes */
  39. if (dr->log2secsize != 8 &&
  40. dr->log2secsize != 9 &&
  41. dr->log2secsize != 10)
  42. return 1;
  43. /* idlen must be at least log2secsize + 3 */
  44. if (dr->idlen < dr->log2secsize + 3)
  45. return 1;
  46. /* we cannot have such a large disc that we
  47. * are unable to represent sector offsets in
  48. * 32 bits. This works out at 2.0 TB.
  49. */
  50. if (le32_to_cpu(dr->disc_size_high) >> dr->log2secsize)
  51. return 1;
  52. /* idlen must be no greater than 19 v2 [1.0] */
  53. if (dr->idlen > 19)
  54. return 1;
  55. /* reserved bytes should be zero */
  56. for (i = 0; i < sizeof(dr->unused52); i++)
  57. if (dr->unused52[i] != 0)
  58. return 1;
  59. return 0;
  60. }
  61. static unsigned char adfs_calczonecheck(struct super_block *sb, unsigned char *map)
  62. {
  63. unsigned int v0, v1, v2, v3;
  64. int i;
  65. v0 = v1 = v2 = v3 = 0;
  66. for (i = sb->s_blocksize - 4; i; i -= 4) {
  67. v0 += map[i] + (v3 >> 8);
  68. v3 &= 0xff;
  69. v1 += map[i + 1] + (v0 >> 8);
  70. v0 &= 0xff;
  71. v2 += map[i + 2] + (v1 >> 8);
  72. v1 &= 0xff;
  73. v3 += map[i + 3] + (v2 >> 8);
  74. v2 &= 0xff;
  75. }
  76. v0 += v3 >> 8;
  77. v1 += map[1] + (v0 >> 8);
  78. v2 += map[2] + (v1 >> 8);
  79. v3 += map[3] + (v2 >> 8);
  80. return v0 ^ v1 ^ v2 ^ v3;
  81. }
  82. static int adfs_checkmap(struct super_block *sb, struct adfs_discmap *dm)
  83. {
  84. unsigned char crosscheck = 0, zonecheck = 1;
  85. int i;
  86. for (i = 0; i < ADFS_SB(sb)->s_map_size; i++) {
  87. unsigned char *map;
  88. map = dm[i].dm_bh->b_data;
  89. if (adfs_calczonecheck(sb, map) != map[0]) {
  90. adfs_error(sb, "zone %d fails zonecheck", i);
  91. zonecheck = 0;
  92. }
  93. crosscheck ^= map[3];
  94. }
  95. if (crosscheck != 0xff)
  96. adfs_error(sb, "crosscheck != 0xff");
  97. return crosscheck == 0xff && zonecheck;
  98. }
  99. static void adfs_put_super(struct super_block *sb)
  100. {
  101. int i;
  102. struct adfs_sb_info *asb = ADFS_SB(sb);
  103. for (i = 0; i < asb->s_map_size; i++)
  104. brelse(asb->s_map[i].dm_bh);
  105. kfree(asb->s_map);
  106. kfree(asb);
  107. sb->s_fs_info = NULL;
  108. }
  109. static int adfs_show_options(struct seq_file *seq, struct dentry *root)
  110. {
  111. struct adfs_sb_info *asb = ADFS_SB(root->d_sb);
  112. if (!uid_eq(asb->s_uid, GLOBAL_ROOT_UID))
  113. seq_printf(seq, ",uid=%u", from_kuid_munged(&init_user_ns, asb->s_uid));
  114. if (!gid_eq(asb->s_gid, GLOBAL_ROOT_GID))
  115. seq_printf(seq, ",gid=%u", from_kgid_munged(&init_user_ns, asb->s_gid));
  116. if (asb->s_owner_mask != ADFS_DEFAULT_OWNER_MASK)
  117. seq_printf(seq, ",ownmask=%o", asb->s_owner_mask);
  118. if (asb->s_other_mask != ADFS_DEFAULT_OTHER_MASK)
  119. seq_printf(seq, ",othmask=%o", asb->s_other_mask);
  120. if (asb->s_ftsuffix != 0)
  121. seq_printf(seq, ",ftsuffix=%u", asb->s_ftsuffix);
  122. return 0;
  123. }
  124. enum {Opt_uid, Opt_gid, Opt_ownmask, Opt_othmask, Opt_ftsuffix, Opt_err};
  125. static const match_table_t tokens = {
  126. {Opt_uid, "uid=%u"},
  127. {Opt_gid, "gid=%u"},
  128. {Opt_ownmask, "ownmask=%o"},
  129. {Opt_othmask, "othmask=%o"},
  130. {Opt_ftsuffix, "ftsuffix=%u"},
  131. {Opt_err, NULL}
  132. };
  133. static int parse_options(struct super_block *sb, char *options)
  134. {
  135. char *p;
  136. struct adfs_sb_info *asb = ADFS_SB(sb);
  137. int option;
  138. if (!options)
  139. return 0;
  140. while ((p = strsep(&options, ",")) != NULL) {
  141. substring_t args[MAX_OPT_ARGS];
  142. int token;
  143. if (!*p)
  144. continue;
  145. token = match_token(p, tokens, args);
  146. switch (token) {
  147. case Opt_uid:
  148. if (match_int(args, &option))
  149. return -EINVAL;
  150. asb->s_uid = make_kuid(current_user_ns(), option);
  151. if (!uid_valid(asb->s_uid))
  152. return -EINVAL;
  153. break;
  154. case Opt_gid:
  155. if (match_int(args, &option))
  156. return -EINVAL;
  157. asb->s_gid = make_kgid(current_user_ns(), option);
  158. if (!gid_valid(asb->s_gid))
  159. return -EINVAL;
  160. break;
  161. case Opt_ownmask:
  162. if (match_octal(args, &option))
  163. return -EINVAL;
  164. asb->s_owner_mask = option;
  165. break;
  166. case Opt_othmask:
  167. if (match_octal(args, &option))
  168. return -EINVAL;
  169. asb->s_other_mask = option;
  170. break;
  171. case Opt_ftsuffix:
  172. if (match_int(args, &option))
  173. return -EINVAL;
  174. asb->s_ftsuffix = option;
  175. break;
  176. default:
  177. printk("ADFS-fs: unrecognised mount option \"%s\" "
  178. "or missing value\n", p);
  179. return -EINVAL;
  180. }
  181. }
  182. return 0;
  183. }
  184. static int adfs_remount(struct super_block *sb, int *flags, char *data)
  185. {
  186. *flags |= MS_NODIRATIME;
  187. return parse_options(sb, data);
  188. }
  189. static int adfs_statfs(struct dentry *dentry, struct kstatfs *buf)
  190. {
  191. struct super_block *sb = dentry->d_sb;
  192. struct adfs_sb_info *sbi = ADFS_SB(sb);
  193. u64 id = huge_encode_dev(sb->s_bdev->bd_dev);
  194. buf->f_type = ADFS_SUPER_MAGIC;
  195. buf->f_namelen = sbi->s_namelen;
  196. buf->f_bsize = sb->s_blocksize;
  197. buf->f_blocks = sbi->s_size;
  198. buf->f_files = sbi->s_ids_per_zone * sbi->s_map_size;
  199. buf->f_bavail =
  200. buf->f_bfree = adfs_map_free(sb);
  201. buf->f_ffree = (long)(buf->f_bfree * buf->f_files) / (long)buf->f_blocks;
  202. buf->f_fsid.val[0] = (u32)id;
  203. buf->f_fsid.val[1] = (u32)(id >> 32);
  204. return 0;
  205. }
  206. static struct kmem_cache *adfs_inode_cachep;
  207. static struct inode *adfs_alloc_inode(struct super_block *sb)
  208. {
  209. struct adfs_inode_info *ei;
  210. ei = (struct adfs_inode_info *)kmem_cache_alloc(adfs_inode_cachep, GFP_KERNEL);
  211. if (!ei)
  212. return NULL;
  213. return &ei->vfs_inode;
  214. }
  215. static void adfs_i_callback(struct rcu_head *head)
  216. {
  217. struct inode *inode = container_of(head, struct inode, i_rcu);
  218. kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
  219. }
  220. static void adfs_destroy_inode(struct inode *inode)
  221. {
  222. call_rcu(&inode->i_rcu, adfs_i_callback);
  223. }
  224. static void init_once(void *foo)
  225. {
  226. struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
  227. inode_init_once(&ei->vfs_inode);
  228. }
  229. static int init_inodecache(void)
  230. {
  231. adfs_inode_cachep = kmem_cache_create("adfs_inode_cache",
  232. sizeof(struct adfs_inode_info),
  233. 0, (SLAB_RECLAIM_ACCOUNT|
  234. SLAB_MEM_SPREAD),
  235. init_once);
  236. if (adfs_inode_cachep == NULL)
  237. return -ENOMEM;
  238. return 0;
  239. }
  240. static void destroy_inodecache(void)
  241. {
  242. /*
  243. * Make sure all delayed rcu free inodes are flushed before we
  244. * destroy cache.
  245. */
  246. rcu_barrier();
  247. kmem_cache_destroy(adfs_inode_cachep);
  248. }
  249. static const struct super_operations adfs_sops = {
  250. .alloc_inode = adfs_alloc_inode,
  251. .destroy_inode = adfs_destroy_inode,
  252. .write_inode = adfs_write_inode,
  253. .put_super = adfs_put_super,
  254. .statfs = adfs_statfs,
  255. .remount_fs = adfs_remount,
  256. .show_options = adfs_show_options,
  257. };
  258. static struct adfs_discmap *adfs_read_map(struct super_block *sb, struct adfs_discrecord *dr)
  259. {
  260. struct adfs_discmap *dm;
  261. unsigned int map_addr, zone_size, nzones;
  262. int i, zone;
  263. struct adfs_sb_info *asb = ADFS_SB(sb);
  264. nzones = asb->s_map_size;
  265. zone_size = (8 << dr->log2secsize) - le16_to_cpu(dr->zone_spare);
  266. map_addr = (nzones >> 1) * zone_size -
  267. ((nzones > 1) ? ADFS_DR_SIZE_BITS : 0);
  268. map_addr = signed_asl(map_addr, asb->s_map2blk);
  269. asb->s_ids_per_zone = zone_size / (asb->s_idlen + 1);
  270. dm = kmalloc(nzones * sizeof(*dm), GFP_KERNEL);
  271. if (dm == NULL) {
  272. adfs_error(sb, "not enough memory");
  273. return NULL;
  274. }
  275. for (zone = 0; zone < nzones; zone++, map_addr++) {
  276. dm[zone].dm_startbit = 0;
  277. dm[zone].dm_endbit = zone_size;
  278. dm[zone].dm_startblk = zone * zone_size - ADFS_DR_SIZE_BITS;
  279. dm[zone].dm_bh = sb_bread(sb, map_addr);
  280. if (!dm[zone].dm_bh) {
  281. adfs_error(sb, "unable to read map");
  282. goto error_free;
  283. }
  284. }
  285. /* adjust the limits for the first and last map zones */
  286. i = zone - 1;
  287. dm[0].dm_startblk = 0;
  288. dm[0].dm_startbit = ADFS_DR_SIZE_BITS;
  289. dm[i].dm_endbit = (le32_to_cpu(dr->disc_size_high) << (32 - dr->log2bpmb)) +
  290. (le32_to_cpu(dr->disc_size) >> dr->log2bpmb) +
  291. (ADFS_DR_SIZE_BITS - i * zone_size);
  292. if (adfs_checkmap(sb, dm))
  293. return dm;
  294. adfs_error(sb, "map corrupted");
  295. error_free:
  296. while (--zone >= 0)
  297. brelse(dm[zone].dm_bh);
  298. kfree(dm);
  299. return NULL;
  300. }
  301. static inline unsigned long adfs_discsize(struct adfs_discrecord *dr, int block_bits)
  302. {
  303. unsigned long discsize;
  304. discsize = le32_to_cpu(dr->disc_size_high) << (32 - block_bits);
  305. discsize |= le32_to_cpu(dr->disc_size) >> block_bits;
  306. return discsize;
  307. }
  308. static int adfs_fill_super(struct super_block *sb, void *data, int silent)
  309. {
  310. struct adfs_discrecord *dr;
  311. struct buffer_head *bh;
  312. struct object_info root_obj;
  313. unsigned char *b_data;
  314. struct adfs_sb_info *asb;
  315. struct inode *root;
  316. sb->s_flags |= MS_NODIRATIME;
  317. asb = kzalloc(sizeof(*asb), GFP_KERNEL);
  318. if (!asb)
  319. return -ENOMEM;
  320. sb->s_fs_info = asb;
  321. /* set default options */
  322. asb->s_uid = GLOBAL_ROOT_UID;
  323. asb->s_gid = GLOBAL_ROOT_GID;
  324. asb->s_owner_mask = ADFS_DEFAULT_OWNER_MASK;
  325. asb->s_other_mask = ADFS_DEFAULT_OTHER_MASK;
  326. asb->s_ftsuffix = 0;
  327. if (parse_options(sb, data))
  328. goto error;
  329. sb_set_blocksize(sb, BLOCK_SIZE);
  330. if (!(bh = sb_bread(sb, ADFS_DISCRECORD / BLOCK_SIZE))) {
  331. adfs_error(sb, "unable to read superblock");
  332. goto error;
  333. }
  334. b_data = bh->b_data + (ADFS_DISCRECORD % BLOCK_SIZE);
  335. if (adfs_checkbblk(b_data)) {
  336. if (!silent)
  337. printk("VFS: Can't find an adfs filesystem on dev "
  338. "%s.\n", sb->s_id);
  339. goto error_free_bh;
  340. }
  341. dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET);
  342. /*
  343. * Do some sanity checks on the ADFS disc record
  344. */
  345. if (adfs_checkdiscrecord(dr)) {
  346. if (!silent)
  347. printk("VPS: Can't find an adfs filesystem on dev "
  348. "%s.\n", sb->s_id);
  349. goto error_free_bh;
  350. }
  351. brelse(bh);
  352. if (sb_set_blocksize(sb, 1 << dr->log2secsize)) {
  353. bh = sb_bread(sb, ADFS_DISCRECORD / sb->s_blocksize);
  354. if (!bh) {
  355. adfs_error(sb, "couldn't read superblock on "
  356. "2nd try.");
  357. goto error;
  358. }
  359. b_data = bh->b_data + (ADFS_DISCRECORD % sb->s_blocksize);
  360. if (adfs_checkbblk(b_data)) {
  361. adfs_error(sb, "disc record mismatch, very weird!");
  362. goto error_free_bh;
  363. }
  364. dr = (struct adfs_discrecord *)(b_data + ADFS_DR_OFFSET);
  365. } else {
  366. if (!silent)
  367. printk(KERN_ERR "VFS: Unsupported blocksize on dev "
  368. "%s.\n", sb->s_id);
  369. goto error;
  370. }
  371. /*
  372. * blocksize on this device should now be set to the ADFS log2secsize
  373. */
  374. sb->s_magic = ADFS_SUPER_MAGIC;
  375. asb->s_idlen = dr->idlen;
  376. asb->s_map_size = dr->nzones | (dr->nzones_high << 8);
  377. asb->s_map2blk = dr->log2bpmb - dr->log2secsize;
  378. asb->s_size = adfs_discsize(dr, sb->s_blocksize_bits);
  379. asb->s_version = dr->format_version;
  380. asb->s_log2sharesize = dr->log2sharesize;
  381. asb->s_map = adfs_read_map(sb, dr);
  382. if (!asb->s_map)
  383. goto error_free_bh;
  384. brelse(bh);
  385. /*
  386. * set up enough so that we can read an inode
  387. */
  388. sb->s_op = &adfs_sops;
  389. dr = (struct adfs_discrecord *)(asb->s_map[0].dm_bh->b_data + 4);
  390. root_obj.parent_id = root_obj.file_id = le32_to_cpu(dr->root);
  391. root_obj.name_len = 0;
  392. /* Set root object date as 01 Jan 1987 00:00:00 */
  393. root_obj.loadaddr = 0xfff0003f;
  394. root_obj.execaddr = 0xec22c000;
  395. root_obj.size = ADFS_NEWDIR_SIZE;
  396. root_obj.attr = ADFS_NDA_DIRECTORY | ADFS_NDA_OWNER_READ |
  397. ADFS_NDA_OWNER_WRITE | ADFS_NDA_PUBLIC_READ;
  398. root_obj.filetype = -1;
  399. /*
  400. * If this is a F+ disk with variable length directories,
  401. * get the root_size from the disc record.
  402. */
  403. if (asb->s_version) {
  404. root_obj.size = le32_to_cpu(dr->root_size);
  405. asb->s_dir = &adfs_fplus_dir_ops;
  406. asb->s_namelen = ADFS_FPLUS_NAME_LEN;
  407. } else {
  408. asb->s_dir = &adfs_f_dir_ops;
  409. asb->s_namelen = ADFS_F_NAME_LEN;
  410. }
  411. /*
  412. * ,xyz hex filetype suffix may be added by driver
  413. * to files that have valid RISC OS filetype
  414. */
  415. if (asb->s_ftsuffix)
  416. asb->s_namelen += 4;
  417. sb->s_d_op = &adfs_dentry_operations;
  418. root = adfs_iget(sb, &root_obj);
  419. sb->s_root = d_make_root(root);
  420. if (!sb->s_root) {
  421. int i;
  422. for (i = 0; i < asb->s_map_size; i++)
  423. brelse(asb->s_map[i].dm_bh);
  424. kfree(asb->s_map);
  425. adfs_error(sb, "get root inode failed\n");
  426. goto error;
  427. }
  428. return 0;
  429. error_free_bh:
  430. brelse(bh);
  431. error:
  432. sb->s_fs_info = NULL;
  433. kfree(asb);
  434. return -EINVAL;
  435. }
  436. static struct dentry *adfs_mount(struct file_system_type *fs_type,
  437. int flags, const char *dev_name, void *data)
  438. {
  439. return mount_bdev(fs_type, flags, dev_name, data, adfs_fill_super);
  440. }
  441. static struct file_system_type adfs_fs_type = {
  442. .owner = THIS_MODULE,
  443. .name = "adfs",
  444. .mount = adfs_mount,
  445. .kill_sb = kill_block_super,
  446. .fs_flags = FS_REQUIRES_DEV,
  447. };
  448. MODULE_ALIAS_FS("adfs");
  449. static int __init init_adfs_fs(void)
  450. {
  451. int err = init_inodecache();
  452. if (err)
  453. goto out1;
  454. err = register_filesystem(&adfs_fs_type);
  455. if (err)
  456. goto out;
  457. return 0;
  458. out:
  459. destroy_inodecache();
  460. out1:
  461. return err;
  462. }
  463. static void __exit exit_adfs_fs(void)
  464. {
  465. unregister_filesystem(&adfs_fs_type);
  466. destroy_inodecache();
  467. }
  468. module_init(init_adfs_fs)
  469. module_exit(exit_adfs_fs)
  470. MODULE_LICENSE("GPL");