1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * linux/fs/affs/inode.c 4 * 5 * (c) 1996 Hans-Joachim Widmaier - Rewritten 6 * 7 * (C) 1993 Ray Burr - Modified for Amiga FFS filesystem. 8 * 9 * (C) 1992 Eric Youngdale Modified for ISO 9660 filesystem. 10 * 11 * (C) 1991 Linus Torvalds - minix filesystem 12 */ 13 14 #include <linux/module.h> 15 #include <linux/init.h> 16 #include <linux/statfs.h> 17 #include <linux/fs_parser.h> 18 #include <linux/fs_context.h> 19 #include <linux/magic.h> 20 #include <linux/sched.h> 21 #include <linux/cred.h> 22 #include <linux/slab.h> 23 #include <linux/writeback.h> 24 #include <linux/blkdev.h> 25 #include <linux/seq_file.h> 26 #include <linux/iversion.h> 27 #include "affs.h" 28 29 static int affs_statfs(struct dentry *dentry, struct kstatfs *buf); 30 static int affs_show_options(struct seq_file *m, struct dentry *root); 31 32 static void 33 affs_commit_super(struct super_block *sb, int wait) 34 { 35 struct affs_sb_info *sbi = AFFS_SB(sb); 36 struct buffer_head *bh = sbi->s_root_bh; 37 struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh); 38 39 lock_buffer(bh); 40 affs_secs_to_datestamp(ktime_get_real_seconds(), &tail->disk_change); 41 affs_fix_checksum(sb, bh); 42 unlock_buffer(bh); 43 44 mark_buffer_dirty(bh); 45 if (wait) 46 sync_dirty_buffer(bh); 47 } 48 49 static void 50 affs_put_super(struct super_block *sb) 51 { 52 struct affs_sb_info *sbi = AFFS_SB(sb); 53 pr_debug("%s()\n", __func__); 54 55 cancel_delayed_work_sync(&sbi->sb_work); 56 } 57 58 static int 59 affs_sync_fs(struct super_block *sb, int wait) 60 { 61 affs_commit_super(sb, wait); 62 return 0; 63 } 64 65 static void flush_superblock(struct work_struct *work) 66 { 67 struct affs_sb_info *sbi; 68 struct super_block *sb; 69 70 sbi = container_of(work, struct affs_sb_info, sb_work.work); 71 sb = sbi->sb; 72 73 spin_lock(&sbi->work_lock); 74 sbi->work_queued = 0; 75 spin_unlock(&sbi->work_lock); 76 77 affs_commit_super(sb, 1); 78 } 79 80 void affs_mark_sb_dirty(struct super_block *sb) 81 { 82 struct affs_sb_info *sbi = AFFS_SB(sb); 83 unsigned long delay; 84 85 if (sb_rdonly(sb)) 86 return; 87 88 spin_lock(&sbi->work_lock); 89 if (!sbi->work_queued) { 90 delay = msecs_to_jiffies(dirty_writeback_interval * 10); 91 queue_delayed_work(system_long_wq, &sbi->sb_work, delay); 92 sbi->work_queued = 1; 93 } 94 spin_unlock(&sbi->work_lock); 95 } 96 97 static struct kmem_cache * affs_inode_cachep; 98 99 static struct inode *affs_alloc_inode(struct super_block *sb) 100 { 101 struct affs_inode_info *i; 102 103 i = alloc_inode_sb(sb, affs_inode_cachep, GFP_KERNEL); 104 if (!i) 105 return NULL; 106 107 inode_set_iversion(&i->vfs_inode, 1); 108 i->i_lc = NULL; 109 i->i_ext_bh = NULL; 110 i->i_pa_cnt = 0; 111 mmb_init(&i->i_metadata_bhs, &i->vfs_inode.i_data); 112 113 return &i->vfs_inode; 114 } 115 116 static void affs_free_inode(struct inode *inode) 117 { 118 kmem_cache_free(affs_inode_cachep, AFFS_I(inode)); 119 } 120 121 static void init_once(void *foo) 122 { 123 struct affs_inode_info *ei = (struct affs_inode_info *) foo; 124 125 mutex_init(&ei->i_link_lock); 126 mutex_init(&ei->i_ext_lock); 127 inode_init_once(&ei->vfs_inode); 128 } 129 130 static int __init init_inodecache(void) 131 { 132 affs_inode_cachep = kmem_cache_create("affs_inode_cache", 133 sizeof(struct affs_inode_info), 134 0, (SLAB_RECLAIM_ACCOUNT | SLAB_ACCOUNT), 135 init_once); 136 if (affs_inode_cachep == NULL) 137 return -ENOMEM; 138 return 0; 139 } 140 141 static void destroy_inodecache(void) 142 { 143 /* 144 * Make sure all delayed rcu free inodes are flushed before we 145 * destroy cache. 146 */ 147 rcu_barrier(); 148 kmem_cache_destroy(affs_inode_cachep); 149 } 150 151 static const struct super_operations affs_sops = { 152 .alloc_inode = affs_alloc_inode, 153 .free_inode = affs_free_inode, 154 .write_inode = affs_write_inode, 155 .evict_inode = affs_evict_inode, 156 .put_super = affs_put_super, 157 .sync_fs = affs_sync_fs, 158 .statfs = affs_statfs, 159 .show_options = affs_show_options, 160 }; 161 162 enum { 163 Opt_bs, Opt_mode, Opt_mufs, Opt_notruncate, Opt_prefix, Opt_protect, 164 Opt_reserved, Opt_root, Opt_setgid, Opt_setuid, 165 Opt_verbose, Opt_volume, Opt_ignore, 166 }; 167 168 struct affs_context { 169 kuid_t uid; /* uid to override */ 170 kgid_t gid; /* gid to override */ 171 unsigned int mode; /* mode to override */ 172 unsigned int reserved; /* Number of reserved blocks */ 173 int root_block; /* FFS root block number */ 174 int blocksize; /* Initial device blksize */ 175 char *prefix; /* Prefix for volumes and assigns */ 176 char volume[32]; /* Vol. prefix for absolute symlinks */ 177 unsigned long mount_flags; /* Options */ 178 }; 179 180 static const struct fs_parameter_spec affs_param_spec[] = { 181 fsparam_u32 ("bs", Opt_bs), 182 fsparam_u32oct ("mode", Opt_mode), 183 fsparam_flag ("mufs", Opt_mufs), 184 fsparam_flag ("nofilenametruncate", Opt_notruncate), 185 fsparam_string ("prefix", Opt_prefix), 186 fsparam_flag ("protect", Opt_protect), 187 fsparam_u32 ("reserved", Opt_reserved), 188 fsparam_u32 ("root", Opt_root), 189 fsparam_gid ("setgid", Opt_setgid), 190 fsparam_uid ("setuid", Opt_setuid), 191 fsparam_flag ("verbose", Opt_verbose), 192 fsparam_string ("volume", Opt_volume), 193 fsparam_flag ("grpquota", Opt_ignore), 194 fsparam_flag ("noquota", Opt_ignore), 195 fsparam_flag ("quota", Opt_ignore), 196 fsparam_flag ("usrquota", Opt_ignore), 197 {}, 198 }; 199 200 static int affs_parse_param(struct fs_context *fc, struct fs_parameter *param) 201 { 202 struct affs_context *ctx = fc->fs_private; 203 struct fs_parse_result result; 204 int n; 205 int opt; 206 207 opt = fs_parse(fc, affs_param_spec, param, &result); 208 if (opt < 0) 209 return opt; 210 211 switch (opt) { 212 case Opt_bs: 213 n = result.uint_32; 214 if (n != 512 && n != 1024 && n != 2048 215 && n != 4096) { 216 pr_warn("Invalid blocksize (512, 1024, 2048, 4096 allowed)\n"); 217 return -EINVAL; 218 } 219 ctx->blocksize = n; 220 break; 221 case Opt_mode: 222 ctx->mode = result.uint_32 & 0777; 223 affs_set_opt(ctx->mount_flags, SF_SETMODE); 224 break; 225 case Opt_mufs: 226 affs_set_opt(ctx->mount_flags, SF_MUFS); 227 break; 228 case Opt_notruncate: 229 affs_set_opt(ctx->mount_flags, SF_NO_TRUNCATE); 230 break; 231 case Opt_prefix: 232 kfree(ctx->prefix); 233 ctx->prefix = param->string; 234 param->string = NULL; 235 affs_set_opt(ctx->mount_flags, SF_PREFIX); 236 break; 237 case Opt_protect: 238 affs_set_opt(ctx->mount_flags, SF_IMMUTABLE); 239 break; 240 case Opt_reserved: 241 ctx->reserved = result.uint_32; 242 break; 243 case Opt_root: 244 ctx->root_block = result.uint_32; 245 break; 246 case Opt_setgid: 247 ctx->gid = result.gid; 248 affs_set_opt(ctx->mount_flags, SF_SETGID); 249 break; 250 case Opt_setuid: 251 ctx->uid = result.uid; 252 affs_set_opt(ctx->mount_flags, SF_SETUID); 253 break; 254 case Opt_verbose: 255 affs_set_opt(ctx->mount_flags, SF_VERBOSE); 256 break; 257 case Opt_volume: 258 strscpy(ctx->volume, param->string, 32); 259 break; 260 case Opt_ignore: 261 /* Silently ignore the quota options */ 262 break; 263 default: 264 return -EINVAL; 265 } 266 return 0; 267 } 268 269 static int affs_show_options(struct seq_file *m, struct dentry *root) 270 { 271 struct super_block *sb = root->d_sb; 272 struct affs_sb_info *sbi = AFFS_SB(sb); 273 274 if (sb->s_blocksize) 275 seq_printf(m, ",bs=%lu", sb->s_blocksize); 276 if (affs_test_opt(sbi->s_flags, SF_SETMODE)) 277 seq_printf(m, ",mode=%o", sbi->s_mode); 278 if (affs_test_opt(sbi->s_flags, SF_MUFS)) 279 seq_puts(m, ",mufs"); 280 if (affs_test_opt(sbi->s_flags, SF_NO_TRUNCATE)) 281 seq_puts(m, ",nofilenametruncate"); 282 if (affs_test_opt(sbi->s_flags, SF_PREFIX)) 283 seq_printf(m, ",prefix=%s", sbi->s_prefix); 284 if (affs_test_opt(sbi->s_flags, SF_IMMUTABLE)) 285 seq_puts(m, ",protect"); 286 if (sbi->s_reserved != 2) 287 seq_printf(m, ",reserved=%u", sbi->s_reserved); 288 if (sbi->s_root_block != (sbi->s_reserved + sbi->s_partition_size - 1) / 2) 289 seq_printf(m, ",root=%u", sbi->s_root_block); 290 if (affs_test_opt(sbi->s_flags, SF_SETGID)) 291 seq_printf(m, ",setgid=%u", 292 from_kgid_munged(&init_user_ns, sbi->s_gid)); 293 if (affs_test_opt(sbi->s_flags, SF_SETUID)) 294 seq_printf(m, ",setuid=%u", 295 from_kuid_munged(&init_user_ns, sbi->s_uid)); 296 if (affs_test_opt(sbi->s_flags, SF_VERBOSE)) 297 seq_puts(m, ",verbose"); 298 if (sbi->s_volume[0]) 299 seq_printf(m, ",volume=%s", sbi->s_volume); 300 return 0; 301 } 302 303 /* This function definitely needs to be split up. Some fine day I'll 304 * hopefully have the guts to do so. Until then: sorry for the mess. 305 */ 306 307 static int affs_fill_super(struct super_block *sb, struct fs_context *fc) 308 { 309 struct affs_sb_info *sbi; 310 struct affs_context *ctx = fc->fs_private; 311 struct buffer_head *root_bh = NULL; 312 struct buffer_head *boot_bh; 313 struct inode *root_inode = NULL; 314 int silent = fc->sb_flags & SB_SILENT; 315 int size, blocksize; 316 u32 chksum; 317 int num_bm; 318 int i, j; 319 int tmp_flags; /* fix remount prototype... */ 320 u8 sig[4]; 321 int ret; 322 323 sb->s_magic = AFFS_SUPER_MAGIC; 324 sb->s_op = &affs_sops; 325 sb->s_flags |= SB_NODIRATIME; 326 327 sb->s_time_gran = NSEC_PER_SEC; 328 sb->s_time_min = sys_tz.tz_minuteswest * 60 + AFFS_EPOCH_DELTA; 329 sb->s_time_max = 86400LL * U32_MAX + 86400 + sb->s_time_min; 330 331 sbi = kzalloc_obj(struct affs_sb_info); 332 if (!sbi) 333 return -ENOMEM; 334 335 sb->s_fs_info = sbi; 336 sbi->sb = sb; 337 mutex_init(&sbi->s_bmlock); 338 spin_lock_init(&sbi->symlink_lock); 339 spin_lock_init(&sbi->work_lock); 340 INIT_DELAYED_WORK(&sbi->sb_work, flush_superblock); 341 342 sbi->s_flags = ctx->mount_flags; 343 sbi->s_mode = ctx->mode; 344 sbi->s_uid = ctx->uid; 345 sbi->s_gid = ctx->gid; 346 sbi->s_reserved = ctx->reserved; 347 sbi->s_prefix = ctx->prefix; 348 ctx->prefix = NULL; 349 memcpy(sbi->s_volume, ctx->volume, 32); 350 351 /* N.B. after this point s_prefix must be released */ 352 353 /* Get the size of the device in 512-byte blocks. 354 * If we later see that the partition uses bigger 355 * blocks, we will have to change it. 356 */ 357 358 size = bdev_nr_sectors(sb->s_bdev); 359 pr_debug("initial blocksize=%d, #blocks=%d\n", 512, size); 360 361 affs_set_blocksize(sb, PAGE_SIZE); 362 /* Try to find root block. Its location depends on the block size. */ 363 364 i = bdev_logical_block_size(sb->s_bdev); 365 j = PAGE_SIZE; 366 blocksize = ctx->blocksize; 367 if (blocksize > 0) { 368 i = j = blocksize; 369 size = size / (blocksize / 512); 370 } 371 372 for (blocksize = i; blocksize <= j; blocksize <<= 1, size >>= 1) { 373 sbi->s_root_block = ctx->root_block; 374 if (ctx->root_block < 0) 375 sbi->s_root_block = (ctx->reserved + size - 1) / 2; 376 pr_debug("setting blocksize to %d\n", blocksize); 377 affs_set_blocksize(sb, blocksize); 378 sbi->s_partition_size = size; 379 380 /* The root block location that was calculated above is not 381 * correct if the partition size is an odd number of 512- 382 * byte blocks, which will be rounded down to a number of 383 * 1024-byte blocks, and if there were an even number of 384 * reserved blocks. Ideally, all partition checkers should 385 * report the real number of blocks of the real blocksize, 386 * but since this just cannot be done, we have to try to 387 * find the root block anyways. In the above case, it is one 388 * block behind the calculated one. So we check this one, too. 389 */ 390 for (num_bm = 0; num_bm < 2; num_bm++) { 391 pr_debug("Dev %s, trying root=%u, bs=%d, " 392 "size=%d, reserved=%d\n", 393 sb->s_id, 394 sbi->s_root_block + num_bm, 395 ctx->blocksize, size, ctx->reserved); 396 root_bh = affs_bread(sb, sbi->s_root_block + num_bm); 397 if (!root_bh) 398 continue; 399 if (!affs_checksum_block(sb, root_bh) && 400 be32_to_cpu(AFFS_ROOT_HEAD(root_bh)->ptype) == T_SHORT && 401 be32_to_cpu(AFFS_ROOT_TAIL(sb, root_bh)->stype) == ST_ROOT) { 402 sbi->s_hashsize = blocksize / 4 - 56; 403 sbi->s_root_block += num_bm; 404 goto got_root; 405 } 406 affs_brelse(root_bh); 407 root_bh = NULL; 408 } 409 } 410 if (!silent) 411 pr_err("No valid root block on device %s\n", sb->s_id); 412 return -EINVAL; 413 414 /* N.B. after this point bh must be released */ 415 got_root: 416 /* Keep super block in cache */ 417 sbi->s_root_bh = root_bh; 418 ctx->root_block = sbi->s_root_block; 419 420 /* Find out which kind of FS we have */ 421 boot_bh = sb_bread(sb, 0); 422 if (!boot_bh) { 423 pr_err("Cannot read boot block\n"); 424 return -EINVAL; 425 } 426 memcpy(sig, boot_bh->b_data, 4); 427 brelse(boot_bh); 428 chksum = be32_to_cpu(*(__be32 *)sig); 429 430 /* Dircache filesystems are compatible with non-dircache ones 431 * when reading. As long as they aren't supported, writing is 432 * not recommended. 433 */ 434 if ((chksum == FS_DCFFS || chksum == MUFS_DCFFS || chksum == FS_DCOFS 435 || chksum == MUFS_DCOFS) && !sb_rdonly(sb)) { 436 pr_notice("Dircache FS - mounting %s read only\n", sb->s_id); 437 sb->s_flags |= SB_RDONLY; 438 } 439 switch (chksum) { 440 case MUFS_FS: 441 case MUFS_INTLFFS: 442 case MUFS_DCFFS: 443 affs_set_opt(sbi->s_flags, SF_MUFS); 444 fallthrough; 445 case FS_INTLFFS: 446 case FS_DCFFS: 447 affs_set_opt(sbi->s_flags, SF_INTL); 448 break; 449 case MUFS_FFS: 450 affs_set_opt(sbi->s_flags, SF_MUFS); 451 break; 452 case FS_FFS: 453 break; 454 case MUFS_OFS: 455 affs_set_opt(sbi->s_flags, SF_MUFS); 456 fallthrough; 457 case FS_OFS: 458 affs_set_opt(sbi->s_flags, SF_OFS); 459 sb->s_flags |= SB_NOEXEC; 460 break; 461 case MUFS_DCOFS: 462 case MUFS_INTLOFS: 463 affs_set_opt(sbi->s_flags, SF_MUFS); 464 fallthrough; 465 case FS_DCOFS: 466 case FS_INTLOFS: 467 affs_set_opt(sbi->s_flags, SF_INTL); 468 affs_set_opt(sbi->s_flags, SF_OFS); 469 sb->s_flags |= SB_NOEXEC; 470 break; 471 default: 472 pr_err("Unknown filesystem on device %s: %08X\n", 473 sb->s_id, chksum); 474 return -EINVAL; 475 } 476 477 if (affs_test_opt(ctx->mount_flags, SF_VERBOSE)) { 478 u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0]; 479 pr_notice("Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n", 480 len > 31 ? 31 : len, 481 AFFS_ROOT_TAIL(sb, root_bh)->disk_name + 1, 482 sig, sig[3] + '0', blocksize); 483 } 484 485 sb->s_flags |= SB_NODEV | SB_NOSUID; 486 487 sbi->s_data_blksize = sb->s_blocksize; 488 if (affs_test_opt(sbi->s_flags, SF_OFS)) 489 sbi->s_data_blksize -= 24; 490 491 tmp_flags = sb->s_flags; 492 ret = affs_init_bitmap(sb, &tmp_flags); 493 if (ret) 494 return ret; 495 sb->s_flags = tmp_flags; 496 497 /* set up enough so that it can read an inode */ 498 499 root_inode = affs_iget(sb, ctx->root_block); 500 if (IS_ERR(root_inode)) 501 return PTR_ERR(root_inode); 502 503 if (affs_test_opt(AFFS_SB(sb)->s_flags, SF_INTL)) 504 set_default_d_op(sb, &affs_intl_dentry_operations); 505 else 506 set_default_d_op(sb, &affs_dentry_operations); 507 508 sb->s_root = d_make_root(root_inode); 509 if (!sb->s_root) { 510 pr_err("AFFS: Get root inode failed\n"); 511 return -ENOMEM; 512 } 513 514 sb->s_export_op = &affs_export_ops; 515 pr_debug("s_flags=%lX\n", sb->s_flags); 516 return 0; 517 } 518 519 static int affs_reconfigure(struct fs_context *fc) 520 { 521 struct super_block *sb = fc->root->d_sb; 522 struct affs_context *ctx = fc->fs_private; 523 struct affs_sb_info *sbi = AFFS_SB(sb); 524 int res = 0; 525 526 sync_filesystem(sb); 527 fc->sb_flags |= SB_NODIRATIME; 528 529 flush_delayed_work(&sbi->sb_work); 530 531 /* 532 * NB: Historically, only mount_flags, mode, uid, gic, prefix, 533 * and volume are accepted during remount. 534 */ 535 sbi->s_flags = ctx->mount_flags; 536 sbi->s_mode = ctx->mode; 537 sbi->s_uid = ctx->uid; 538 sbi->s_gid = ctx->gid; 539 /* protect against readers */ 540 spin_lock(&sbi->symlink_lock); 541 if (ctx->prefix) { 542 kfree(sbi->s_prefix); 543 sbi->s_prefix = ctx->prefix; 544 ctx->prefix = NULL; 545 } 546 memcpy(sbi->s_volume, ctx->volume, 32); 547 spin_unlock(&sbi->symlink_lock); 548 549 if ((bool)(fc->sb_flags & SB_RDONLY) == sb_rdonly(sb)) 550 return 0; 551 552 if (fc->sb_flags & SB_RDONLY) 553 affs_free_bitmap(sb); 554 else 555 res = affs_init_bitmap(sb, &fc->sb_flags); 556 557 return res; 558 } 559 560 static int 561 affs_statfs(struct dentry *dentry, struct kstatfs *buf) 562 { 563 struct super_block *sb = dentry->d_sb; 564 int free; 565 u64 id = huge_encode_dev(sb->s_bdev->bd_dev); 566 567 pr_debug("%s() partsize=%d, reserved=%d\n", 568 __func__, AFFS_SB(sb)->s_partition_size, 569 AFFS_SB(sb)->s_reserved); 570 571 free = affs_count_free_blocks(sb); 572 buf->f_type = AFFS_SUPER_MAGIC; 573 buf->f_bsize = sb->s_blocksize; 574 buf->f_blocks = AFFS_SB(sb)->s_partition_size - AFFS_SB(sb)->s_reserved; 575 buf->f_bfree = free; 576 buf->f_bavail = free; 577 buf->f_fsid = u64_to_fsid(id); 578 buf->f_namelen = AFFSNAMEMAX; 579 return 0; 580 } 581 582 static int affs_get_tree(struct fs_context *fc) 583 { 584 return get_tree_bdev(fc, affs_fill_super); 585 } 586 587 static void affs_kill_sb(struct super_block *sb) 588 { 589 struct affs_sb_info *sbi = AFFS_SB(sb); 590 kill_block_super(sb); 591 if (sbi) { 592 affs_free_bitmap(sb); 593 affs_brelse(sbi->s_root_bh); 594 kfree(sbi->s_prefix); 595 mutex_destroy(&sbi->s_bmlock); 596 kfree_rcu(sbi, rcu); 597 } 598 } 599 600 static void affs_free_fc(struct fs_context *fc) 601 { 602 struct affs_context *ctx = fc->fs_private; 603 604 kfree(ctx->prefix); 605 kfree(ctx); 606 } 607 608 static const struct fs_context_operations affs_context_ops = { 609 .parse_param = affs_parse_param, 610 .get_tree = affs_get_tree, 611 .reconfigure = affs_reconfigure, 612 .free = affs_free_fc, 613 }; 614 615 static int affs_init_fs_context(struct fs_context *fc) 616 { 617 struct affs_context *ctx; 618 619 ctx = kzalloc_obj(struct affs_context); 620 if (!ctx) 621 return -ENOMEM; 622 623 if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) { 624 struct super_block *sb = fc->root->d_sb; 625 struct affs_sb_info *sbi = AFFS_SB(sb); 626 627 /* 628 * NB: historically, no options other than volume were 629 * preserved across a remount unless they were explicitly 630 * passed in. 631 */ 632 memcpy(ctx->volume, sbi->s_volume, 32); 633 } else { 634 ctx->uid = current_uid(); 635 ctx->gid = current_gid(); 636 ctx->reserved = 2; 637 ctx->root_block = -1; 638 ctx->blocksize = -1; 639 ctx->volume[0] = ':'; 640 } 641 642 fc->ops = &affs_context_ops; 643 fc->fs_private = ctx; 644 645 return 0; 646 } 647 648 static struct file_system_type affs_fs_type = { 649 .owner = THIS_MODULE, 650 .name = "affs", 651 .kill_sb = affs_kill_sb, 652 .fs_flags = FS_REQUIRES_DEV, 653 .init_fs_context = affs_init_fs_context, 654 .parameters = affs_param_spec, 655 }; 656 MODULE_ALIAS_FS("affs"); 657 658 static int __init init_affs_fs(void) 659 { 660 int err = init_inodecache(); 661 if (err) 662 goto out1; 663 err = register_filesystem(&affs_fs_type); 664 if (err) 665 goto out; 666 return 0; 667 out: 668 destroy_inodecache(); 669 out1: 670 return err; 671 } 672 673 static void __exit exit_affs_fs(void) 674 { 675 unregister_filesystem(&affs_fs_type); 676 destroy_inodecache(); 677 } 678 679 MODULE_DESCRIPTION("Amiga filesystem support for Linux"); 680 MODULE_LICENSE("GPL"); 681 682 module_init(init_affs_fs) 683 module_exit(exit_affs_fs) 684