diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-03-02 02:36:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-03-02 02:36:47 +0000 |
commit | 8624512aa908741ba2795200133eae0d7f4557ea (patch) | |
tree | d5d3036fccf2604f4c98dedc11e8adb929d6b52e /fs/romfs | |
parent | 7b8f5d6f1d45d9f9de1d26e7d3c32aa5af11b488 (diff) |
Merge with 2.3.48.
Diffstat (limited to 'fs/romfs')
-rw-r--r-- | fs/romfs/inode.c | 77 |
1 files changed, 28 insertions, 49 deletions
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c index ab5972591..b95dfa219 100644 --- a/fs/romfs/inode.c +++ b/fs/romfs/inode.c @@ -450,27 +450,13 @@ static struct address_space_operations romfs_aops = { readpage: romfs_readpage }; -static struct file_operations romfs_file_operations = { - read: generic_file_read, - mmap: generic_file_mmap, -}; - -static struct inode_operations romfs_file_inode_operations = { - &romfs_file_operations, -}; - static struct file_operations romfs_dir_operations = { + read: generic_read_dir, readdir: romfs_readdir, }; -/* Merged dir/symlink op table. readdir/lookup/readlink/follow_link - * will protect from type mismatch. - */ - static struct inode_operations romfs_dir_inode_operations = { - &romfs_dir_operations, - NULL, /* create */ - romfs_lookup, /* lookup */ + lookup: romfs_lookup, }; static mode_t romfs_modemap[] = @@ -479,18 +465,6 @@ static mode_t romfs_modemap[] = S_IFBLK+0600, S_IFCHR+0600, S_IFSOCK+0644, S_IFIFO+0644 }; -static struct inode_operations *romfs_inoops[] = -{ - NULL, /* hardlink, handled elsewhere */ - &romfs_dir_inode_operations, - &romfs_file_inode_operations, - &page_symlink_inode_operations, - NULL, /* device/fifo/socket nodes, */ - NULL, /* set by init_special_inode */ - NULL, - NULL, -}; - static void romfs_read_inode(struct inode *i) { @@ -498,7 +472,6 @@ romfs_read_inode(struct inode *i) struct romfs_inode ri; ino = i->i_ino & ROMFH_MASK; - i->i_op = NULL; i->i_mode = 0; /* Loop for finding the real hard link */ @@ -534,32 +507,38 @@ romfs_read_inode(struct inode *i) /* Compute permissions */ ino = romfs_modemap[nextfh & ROMFH_TYPE]; /* only "normal" files have ops */ - if ((i->i_op = romfs_inoops[nextfh & ROMFH_TYPE])) { - if (nextfh & ROMFH_EXEC) - ino |= S_IXUGO; - i->i_mode = ino; - if (S_ISDIR(ino)) + switch (nextfh & ROMFH_TYPE) { + case 1: i->i_size = i->u.romfs_i.i_metasize; - else + i->i_op = &romfs_dir_inode_operations; + i->i_fop = &romfs_dir_operations; + if (nextfh & ROMFH_EXEC) + ino |= S_IXUGO; + i->i_mode = ino; + break; + case 2: + i->i_fop = &generic_ro_fops; i->i_data.a_ops = &romfs_aops; - } else { - /* depending on MBZ for sock/fifos */ - nextfh = ntohl(ri.spec); - nextfh = kdev_t_to_nr(MKDEV(nextfh>>16,nextfh&0xffff)); - init_special_inode(i, ino, nextfh); + if (nextfh & ROMFH_EXEC) + ino |= S_IXUGO; + i->i_mode = ino; + break; + case 3: + i->i_op = &page_symlink_inode_operations; + i->i_mode = S_IRWXUGO; + break; + default: + /* depending on MBZ for sock/fifos */ + nextfh = ntohl(ri.spec); + nextfh = kdev_t_to_nr(MKDEV(nextfh>>16,nextfh&0xffff)); + init_special_inode(i, ino, nextfh); } } static struct super_operations romfs_ops = { - romfs_read_inode, /* read inode */ - NULL, /* write inode */ - NULL, /* put inode */ - NULL, /* delete inode */ - NULL, /* notify change */ - romfs_put_super, /* put super */ - NULL, /* write super */ - romfs_statfs, /* statfs */ - NULL /* remount */ + read_inode: romfs_read_inode, + put_super: romfs_put_super, + statfs: romfs_statfs, }; static struct file_system_type romfs_fs_type = { |