13 #include <linux/module.h>
17 #include <linux/magic.h>
18 #include <linux/sched.h>
19 #include <linux/slab.h>
62 affs_commit_super(sb, wait);
78 affs_commit_super(sb, 1);
122 static void affs_destroy_inode(
struct inode *inode)
127 static void init_once(
void *
foo)
136 static int init_inodecache(
void)
143 if (affs_inode_cachep ==
NULL)
148 static void destroy_inodecache(
void)
159 .alloc_inode = affs_alloc_inode,
160 .destroy_inode = affs_destroy_inode,
163 .put_super = affs_put_super,
164 .sync_fs = affs_sync_fs,
165 .statfs = affs_statfs,
166 .remount_fs = affs_remount,
197 int *blocksize,
char **
prefix,
char *
volume,
unsigned long *mount_opts)
225 if (n != 512 && n != 1024 && n != 2048
227 printk (
"AFFS: Invalid blocksize (512, 1024, 2048, 4096 allowed)\n");
235 *mode = option & 0777;
262 if (!gid_valid(*gid))
270 if (!uid_valid(*uid))
289 printk(
"AFFS: Unrecognized mount option \"%s\" "
290 "or missing value\n", p);
301 static int affs_fill_super(
struct super_block *sb,
void *
data,
int silent)
304 struct buffer_head *root_bh =
NULL;
305 struct buffer_head *boot_bh;
306 struct inode *root_inode =
NULL;
316 unsigned long mount_flags;
323 pr_debug(
"AFFS: read_super(%s)\n",data ? (
const char *)data :
"no options");
326 sb->
s_op = &affs_sops;
340 if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
361 size = sb->
s_bdev->bd_inode->i_size >> 9;
362 pr_debug(
"AFFS: initial blocksize=%d, #blocks=%d\n", 512, size);
371 size = size / (blocksize / 512);
373 for (blocksize = i, key = 0; blocksize <= j; blocksize <<= 1, size >>= 1) {
377 pr_debug(
"AFFS: setting blocksize to %d\n", blocksize);
378 affs_set_blocksize(sb, blocksize);
391 for (num_bm = 0; num_bm < 2; num_bm++) {
392 pr_debug(
"AFFS: Dev %s, trying root=%u, bs=%d, "
393 "size=%d, reserved=%d\n",
396 blocksize, size, reserved);
408 affs_brelse(root_bh);
422 boot_bh = sb_bread(sb, 0);
427 memcpy(sig, boot_bh->b_data, 4);
479 printk(
KERN_NOTICE "AFFS: Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n",
482 sig, sig[3] +
'0', blocksize);
503 if (IS_ERR(root_inode)) {
504 ret = PTR_ERR(root_inode);
527 affs_brelse(root_bh);
544 unsigned long mount_flags;
550 pr_debug(
"AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data);
555 if (!parse_options(data, &uid, &gid, &mode, &reserved, &root_block,
556 &blocksize, &prefix, volume,
582 if (*flags & MS_RDONLY)
595 u64 id = huge_encode_dev(sb->
s_bdev->bd_dev);
597 pr_debug(
"AFFS: statfs() partsize=%d, reserved=%d\n",AFFS_SB(sb)->s_partition_size,
598 AFFS_SB(sb)->s_reserved);
603 buf->
f_blocks = AFFS_SB(sb)->s_partition_size - AFFS_SB(sb)->s_reserved;
613 int flags,
const char *dev_name,
void *data)
615 return mount_bdev(fs_type, flags, dev_name, data, affs_fill_super);
626 static int __init init_affs_fs(
void)
628 int err = init_inodecache();
636 destroy_inodecache();
641 static void __exit exit_affs_fs(
void)
644 destroy_inodecache();