struct super_block cleanup - adfs
PATCH 1/1 struct super_block cleanup - adfs
Seperate adfs_sb_info from struct super_block.
Signature · 1 line
Brian Gerst
fs/adfs/adfs.h +1 -1
@@ -130,7 +130,7 @@unsigned int off; off = (object_id &255 ) -1 ; - block += off << sb->u.adfs_sb.s_log2sharesize; + block += off <<ADFS_SB (sb)->s_log2sharesize; }return adfs_map_lookup (sb, object_id >>8 , block);
fs/adfs/dir.c +4 -4
@@ -31,7 +31,7 @@ {struct inode *inode = filp->f_dentry->d_inode;struct super_block *sb = inode->i_sb; -struct adfs_dir_ops *ops = sb->u.adfs_sb.s_dir; +struct adfs_dir_ops *ops =ADFS_SB (sb)->s_dir;struct object_info obj;struct adfs_dir dir;int ret =0 ;
@@ -85,7 +85,7 @@ {int ret = -EINVAL ;#ifdef CONFIG_ADFS_FS_RW -struct adfs_dir_ops *ops = sb->u.adfs_sb.s_dir; +struct adfs_dir_ops *ops =ADFS_SB (sb)->s_dir;struct adfs_dir dir; printk(KERN_INFO "adfs_dir_update: object %06X in dir %06X\n",
@@ -139,7 +139,7 @@ adfs_dir_lookup_byname(struct inode *inode, struct qstr *name, struct object_info *obj) { struct super_block *sb = inode->i_sb; -struct adfs_dir_ops *ops = sb->u.adfs_sb.s_dir; +struct adfs_dir_ops *ops =ADFS_SB (sb)->s_dir;struct adfs_dir dir;int ret;
@@ -202,7 +202,7 @@static int adfs_hash (struct dentry *parent,struct qstr *qstr) { -const unsigned int name_len = parent->d_sb->u.adfs_sb.s_namelen; +const unsigned int name_len =ADFS_SB (parent->d_sb)->s_namelen;const unsigned char *name;unsigned long hash;int i;
fs/adfs/file.c +1 -0
@@ -25,6 +25,7 @@#include <linux/fcntl.h> #include <linux/time.h> #include <linux/stat.h> +#include <linux/adfs_fs.h> #include "adfs.h"
fs/adfs/inode.c +14 -12
@@ -103,9 +103,10 @@ {unsigned int filetype, attr =ADFS_I (inode)->attr;umode_t mode, rmask; +struct adfs_sb_info *asb =ADFS_SB (sb);if (attr &ADFS_NDA_DIRECTORY ) { - mode =S_IRUGO & sb->u.adfs_sb.s_owner_mask; + mode =S_IRUGO & asb->s_owner_mask;return S_IFDIR |S_IXUGO | mode; }
@@ -126,16 +127,16 @@ mode =S_IFREG ;if (attr &ADFS_NDA_OWNER_READ ) - mode |= rmask & sb->u.adfs_sb.s_owner_mask; + mode |= rmask & asb->s_owner_mask;if (attr &ADFS_NDA_OWNER_WRITE ) - mode |=S_IWUGO & sb->u.adfs_sb.s_owner_mask; + mode |=S_IWUGO & asb->s_owner_mask;if (attr &ADFS_NDA_PUBLIC_READ ) - mode |= rmask & sb->u.adfs_sb.s_other_mask; + mode |= rmask & asb->s_other_mask;if (attr &ADFS_NDA_PUBLIC_WRITE ) - mode |=S_IWUGO & sb->u.adfs_sb.s_other_mask; + mode |=S_IWUGO & asb->s_other_mask;return mode; }
@@ -148,6 +149,7 @@ {umode_t mode;int attr; +struct adfs_sb_info *asb =ADFS_SB (sb);/* FIXME: should we be able to alter a link? */ if (S_ISLNK (inode->i_mode))
@@ -158,14 +160,14 @@else attr =0 ; - mode = inode->i_mode & sb->u.adfs_sb.s_owner_mask; + mode = inode->i_mode & asb->s_owner_mask;if (mode &S_IRUGO ) attr |=ADFS_NDA_OWNER_READ ;if (mode &S_IWUGO ) attr |=ADFS_NDA_OWNER_WRITE ; - mode = inode->i_mode & sb->u.adfs_sb.s_other_mask; - mode &= ~sb->u.adfs_sb.s_owner_mask; + mode = inode->i_mode & asb->s_other_mask; + mode &= ~asb->s_owner_mask;if (mode &S_IRUGO ) attr |=ADFS_NDA_PUBLIC_READ ;if (mode &S_IWUGO )
@@ -248,8 +250,8 @@if (!inode) goto out; - inode->i_uid = sb->u.adfs_sb.s_uid; - inode->i_gid = sb->u.adfs_sb.s_gid; + inode->i_uid =ADFS_SB (sb)->s_uid; + inode->i_gid =ADFS_SB (sb)->s_gid; inode->i_ino = obj->file_id; inode->i_size = obj->size; inode->i_nlink =2 ;
@@ -309,8 +311,8 @@* we can't change the UID or GID of any file - * we have a global UID/GID in the superblock */ -if ((ia_valid &ATTR_UID && attr->ia_uid != sb->u.adfs_sb.s_uid) || - (ia_valid &ATTR_GID && attr->ia_gid != sb->u.adfs_sb.s_gid)) +if ((ia_valid &ATTR_UID && attr->ia_uid !=ADFS_SB (sb)->s_uid) || + (ia_valid &ATTR_GID && attr->ia_gid !=ADFS_SB (sb)->s_gid)) error = -EPERM ;if (error)
fs/adfs/map.c +2 -2
@@ -197,7 +197,7 @@unsigned int adfs_map_free (struct super_block *sb) { -struct adfs_sb_info *asb = &sb->u.adfs_sb; +struct adfs_sb_info *asb =ADFS_SB (sb);struct adfs_discmap *dm;unsigned int total =0 ;unsigned int zone;
@@ -214,7 +214,7 @@int adfs_map_lookup (struct super_block *sb,int frag_id,int offset) { -struct adfs_sb_info *asb = &sb->u.adfs_sb; +struct adfs_sb_info *asb =ADFS_SB (sb);unsigned int zone, mapoff;int result;
fs/adfs/super.c +48 -34
182 lines not on this page · raw message
include/linux/adfs_fs.h +6 -0
@@ -42,6 +42,7 @@#ifdef __KERNEL__#include <linux/adfs_fs_i.h> +#include <linux/adfs_fs_sb.h> /* * Calculate the boot block checksum on an ADFS drive. Note that this will * appear to be correct if the sector contains all zeros, so also check that
@@ -60,6 +61,11 @@return (result &0xff ) != ptr[511 ]; } +static inline struct adfs_sb_info *ADFS_SB (struct super_block *sb) +{ +return sb->u.generic_sbp; +} +static inline struct adfs_inode_info *ADFS_I (struct inode *inode) { return list_entry(inode, struct adfs_inode_info, vfs_inode);
include/linux/fs.h +0 -2
@@ -662,7 +662,6 @@#include <linux/romfs_fs_sb.h> #include <linux/smb_fs_sb.h> #include <linux/hfs_fs_sb.h> -#include <linux/adfs_fs_sb.h> #include <linux/qnx4_fs_sb.h> #include <linux/reiserfs_fs_sb.h> #include <linux/bfs_fs_sb.h>
@@ -719,7 +718,6 @@struct romfs_sb_info romfs_sb;struct smb_sb_info smbfs_sb;struct hfs_sb_info hfs_sb; -struct adfs_sb_info adfs_sb;struct qnx4_sb_info qnx4_sb;struct reiserfs_sb_info reiserfs_sb;struct bfs_sb_info bfs_sb;