Commit 1b156290 authored by Brian Gerst's avatar Brian Gerst Committed by Linus Torvalds

[PATCH] struct super_block cleanup - ext2

Abstract access to ext2_sb_info.
parent bc846ba4
...@@ -41,7 +41,7 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb, ...@@ -41,7 +41,7 @@ struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
unsigned long group_desc; unsigned long group_desc;
unsigned long offset; unsigned long offset;
struct ext2_group_desc * desc; struct ext2_group_desc * desc;
struct ext2_sb_info *sbi = &sb->u.ext2_sb; struct ext2_sb_info *sbi = EXT2_SB(sb);
if (block_group >= sbi->s_groups_count) { if (block_group >= sbi->s_groups_count) {
ext2_error (sb, "ext2_get_group_desc", ext2_error (sb, "ext2_get_group_desc",
...@@ -110,7 +110,7 @@ static struct buffer_head *read_block_bitmap(struct super_block *sb, ...@@ -110,7 +110,7 @@ static struct buffer_head *read_block_bitmap(struct super_block *sb,
static struct buffer_head *load_block_bitmap(struct super_block * sb, static struct buffer_head *load_block_bitmap(struct super_block * sb,
unsigned int block_group) unsigned int block_group)
{ {
struct ext2_sb_info *sbi = &sb->u.ext2_sb; struct ext2_sb_info *sbi = EXT2_SB(sb);
int i, slot = 0; int i, slot = 0;
struct buffer_head *bh = sbi->s_block_bitmap[0]; struct buffer_head *bh = sbi->s_block_bitmap[0];
...@@ -249,7 +249,7 @@ void ext2_free_blocks (struct inode * inode, unsigned long block, ...@@ -249,7 +249,7 @@ void ext2_free_blocks (struct inode * inode, unsigned long block,
unsigned freed = 0, group_freed; unsigned freed = 0, group_freed;
lock_super (sb); lock_super (sb);
es = sb->u.ext2_sb.s_es; es = EXT2_SB(sb)->s_es;
if (block < le32_to_cpu(es->s_first_data_block) || if (block < le32_to_cpu(es->s_first_data_block) ||
(block + count) > le32_to_cpu(es->s_blocks_count)) { (block + count) > le32_to_cpu(es->s_blocks_count)) {
ext2_error (sb, "ext2_free_blocks", ext2_error (sb, "ext2_free_blocks",
...@@ -285,9 +285,9 @@ void ext2_free_blocks (struct inode * inode, unsigned long block, ...@@ -285,9 +285,9 @@ void ext2_free_blocks (struct inode * inode, unsigned long block,
if (in_range (le32_to_cpu(desc->bg_block_bitmap), block, count) || if (in_range (le32_to_cpu(desc->bg_block_bitmap), block, count) ||
in_range (le32_to_cpu(desc->bg_inode_bitmap), block, count) || in_range (le32_to_cpu(desc->bg_inode_bitmap), block, count) ||
in_range (block, le32_to_cpu(desc->bg_inode_table), in_range (block, le32_to_cpu(desc->bg_inode_table),
sb->u.ext2_sb.s_itb_per_group) || EXT2_SB(sb)->s_itb_per_group) ||
in_range (block + count - 1, le32_to_cpu(desc->bg_inode_table), in_range (block + count - 1, le32_to_cpu(desc->bg_inode_table),
sb->u.ext2_sb.s_itb_per_group)) EXT2_SB(sb)->s_itb_per_group))
ext2_error (sb, "ext2_free_blocks", ext2_error (sb, "ext2_free_blocks",
"Freeing blocks in system zones - " "Freeing blocks in system zones - "
"Block = %lu, count = %lu", "Block = %lu, count = %lu",
...@@ -552,11 +552,11 @@ unsigned long ext2_count_free_blocks (struct super_block * sb) ...@@ -552,11 +552,11 @@ unsigned long ext2_count_free_blocks (struct super_block * sb)
int i; int i;
lock_super (sb); lock_super (sb);
es = sb->u.ext2_sb.s_es; es = EXT2_SB(sb)->s_es;
desc_count = 0; desc_count = 0;
bitmap_count = 0; bitmap_count = 0;
desc = NULL; desc = NULL;
for (i = 0; i < sb->u.ext2_sb.s_groups_count; i++) { for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) {
struct buffer_head *bh; struct buffer_head *bh;
desc = ext2_get_group_desc (sb, i, NULL); desc = ext2_get_group_desc (sb, i, NULL);
if (!desc) if (!desc)
...@@ -576,7 +576,7 @@ unsigned long ext2_count_free_blocks (struct super_block * sb) ...@@ -576,7 +576,7 @@ unsigned long ext2_count_free_blocks (struct super_block * sb)
unlock_super (sb); unlock_super (sb);
return bitmap_count; return bitmap_count;
#else #else
return le32_to_cpu(sb->u.ext2_sb.s_es->s_free_blocks_count); return le32_to_cpu(EXT2_SB(sb)->s_es->s_free_blocks_count);
#endif #endif
} }
...@@ -584,7 +584,7 @@ static inline int block_in_use (unsigned long block, ...@@ -584,7 +584,7 @@ static inline int block_in_use (unsigned long block,
struct super_block * sb, struct super_block * sb,
unsigned char * map) unsigned char * map)
{ {
return ext2_test_bit ((block - le32_to_cpu(sb->u.ext2_sb.s_es->s_first_data_block)) % return ext2_test_bit ((block - le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block)) %
EXT2_BLOCKS_PER_GROUP(sb), map); EXT2_BLOCKS_PER_GROUP(sb), map);
} }
...@@ -651,11 +651,11 @@ void ext2_check_blocks_bitmap (struct super_block * sb) ...@@ -651,11 +651,11 @@ void ext2_check_blocks_bitmap (struct super_block * sb)
struct ext2_group_desc * desc; struct ext2_group_desc * desc;
int i; int i;
es = sb->u.ext2_sb.s_es; es = EXT2_SB(sb)->s_es;
desc_count = 0; desc_count = 0;
bitmap_count = 0; bitmap_count = 0;
desc = NULL; desc = NULL;
for (i = 0; i < sb->u.ext2_sb.s_groups_count; i++) { for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) {
desc = ext2_get_group_desc (sb, i, NULL); desc = ext2_get_group_desc (sb, i, NULL);
if (!desc) if (!desc)
continue; continue;
...@@ -685,7 +685,7 @@ void ext2_check_blocks_bitmap (struct super_block * sb) ...@@ -685,7 +685,7 @@ void ext2_check_blocks_bitmap (struct super_block * sb)
"Inode bitmap for group %d is marked free", "Inode bitmap for group %d is marked free",
i); i);
for (j = 0; j < sb->u.ext2_sb.s_itb_per_group; j++) for (j = 0; j < EXT2_SB(sb)->s_itb_per_group; j++)
if (!block_in_use (le32_to_cpu(desc->bg_inode_table) + j, sb, bh->b_data)) if (!block_in_use (le32_to_cpu(desc->bg_inode_table) + j, sb, bh->b_data))
ext2_error (sb, "ext2_check_blocks_bitmap", ext2_error (sb, "ext2_check_blocks_bitmap",
"Block #%ld of the inode table in " "Block #%ld of the inode table in "
......
...@@ -68,7 +68,7 @@ static void ext2_check_page(struct page *page) ...@@ -68,7 +68,7 @@ static void ext2_check_page(struct page *page)
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
unsigned chunk_size = ext2_chunk_size(dir); unsigned chunk_size = ext2_chunk_size(dir);
char *kaddr = page_address(page); char *kaddr = page_address(page);
u32 max_inumber = le32_to_cpu(sb->u.ext2_sb.s_es->s_inodes_count); u32 max_inumber = le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count);
unsigned offs, rec_len; unsigned offs, rec_len;
unsigned limit = PAGE_CACHE_SIZE; unsigned limit = PAGE_CACHE_SIZE;
ext2_dirent *p; ext2_dirent *p;
......
...@@ -77,7 +77,7 @@ static struct buffer_head *load_inode_bitmap (struct super_block * sb, ...@@ -77,7 +77,7 @@ static struct buffer_head *load_inode_bitmap (struct super_block * sb,
unsigned int block_group) unsigned int block_group)
{ {
int i, slot = 0; int i, slot = 0;
struct ext2_sb_info *sbi = &sb->u.ext2_sb; struct ext2_sb_info *sbi = EXT2_SB(sb);
struct buffer_head *bh = sbi->s_inode_bitmap[0]; struct buffer_head *bh = sbi->s_inode_bitmap[0];
if (block_group >= sbi->s_groups_count) if (block_group >= sbi->s_groups_count)
...@@ -171,7 +171,7 @@ void ext2_free_inode (struct inode * inode) ...@@ -171,7 +171,7 @@ void ext2_free_inode (struct inode * inode)
} }
lock_super (sb); lock_super (sb);
es = sb->u.ext2_sb.s_es; es = EXT2_SB(sb)->s_es;
is_directory = S_ISDIR(inode->i_mode); is_directory = S_ISDIR(inode->i_mode);
/* Do this BEFORE marking the inode not in use or returning an error */ /* Do this BEFORE marking the inode not in use or returning an error */
...@@ -205,7 +205,7 @@ void ext2_free_inode (struct inode * inode) ...@@ -205,7 +205,7 @@ void ext2_free_inode (struct inode * inode)
mark_buffer_dirty(bh2); mark_buffer_dirty(bh2);
es->s_free_inodes_count = es->s_free_inodes_count =
cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) + 1); cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) + 1);
mark_buffer_dirty(sb->u.ext2_sb.s_sbh); mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
} }
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
if (sb->s_flags & MS_SYNCHRONOUS) { if (sb->s_flags & MS_SYNCHRONOUS) {
...@@ -230,8 +230,8 @@ void ext2_free_inode (struct inode * inode) ...@@ -230,8 +230,8 @@ void ext2_free_inode (struct inode * inode)
static int find_group_dir(struct super_block *sb, int parent_group) static int find_group_dir(struct super_block *sb, int parent_group)
{ {
struct ext2_super_block * es = sb->u.ext2_sb.s_es; struct ext2_super_block * es = EXT2_SB(sb)->s_es;
int ngroups = sb->u.ext2_sb.s_groups_count; int ngroups = EXT2_SB(sb)->s_groups_count;
int avefreei = le32_to_cpu(es->s_free_inodes_count) / ngroups; int avefreei = le32_to_cpu(es->s_free_inodes_count) / ngroups;
struct ext2_group_desc *desc, *best_desc = NULL; struct ext2_group_desc *desc, *best_desc = NULL;
struct buffer_head *bh, *best_bh = NULL; struct buffer_head *bh, *best_bh = NULL;
...@@ -263,7 +263,7 @@ static int find_group_dir(struct super_block *sb, int parent_group) ...@@ -263,7 +263,7 @@ static int find_group_dir(struct super_block *sb, int parent_group)
static int find_group_other(struct super_block *sb, int parent_group) static int find_group_other(struct super_block *sb, int parent_group)
{ {
int ngroups = sb->u.ext2_sb.s_groups_count; int ngroups = EXT2_SB(sb)->s_groups_count;
struct ext2_group_desc *desc; struct ext2_group_desc *desc;
struct buffer_head *bh; struct buffer_head *bh;
int group, i; int group, i;
...@@ -330,7 +330,7 @@ struct inode * ext2_new_inode(struct inode * dir, int mode) ...@@ -330,7 +330,7 @@ struct inode * ext2_new_inode(struct inode * dir, int mode)
ei = EXT2_I(inode); ei = EXT2_I(inode);
lock_super (sb); lock_super (sb);
es = sb->u.ext2_sb.s_es; es = EXT2_SB(sb)->s_es;
repeat: repeat:
if (S_ISDIR(mode)) if (S_ISDIR(mode))
group = find_group_dir(sb, EXT2_I(dir)->i_block_group); group = find_group_dir(sb, EXT2_I(dir)->i_block_group);
...@@ -369,7 +369,7 @@ struct inode * ext2_new_inode(struct inode * dir, int mode) ...@@ -369,7 +369,7 @@ struct inode * ext2_new_inode(struct inode * dir, int mode)
es->s_free_inodes_count = es->s_free_inodes_count =
cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) - 1); cpu_to_le32(le32_to_cpu(es->s_free_inodes_count) - 1);
mark_buffer_dirty(sb->u.ext2_sb.s_sbh); mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
sb->s_dirt = 1; sb->s_dirt = 1;
inode->i_uid = current->fsuid; inode->i_uid = current->fsuid;
if (test_opt (sb, GRPID)) if (test_opt (sb, GRPID))
...@@ -405,7 +405,7 @@ struct inode * ext2_new_inode(struct inode * dir, int mode) ...@@ -405,7 +405,7 @@ struct inode * ext2_new_inode(struct inode * dir, int mode)
ei->i_dir_start_lookup = 0; ei->i_dir_start_lookup = 0;
if (ei->i_flags & EXT2_SYNC_FL) if (ei->i_flags & EXT2_SYNC_FL)
inode->i_flags |= S_SYNC; inode->i_flags |= S_SYNC;
inode->i_generation = sb->u.ext2_sb.s_next_generation++; inode->i_generation = EXT2_SB(sb)->s_next_generation++;
insert_inode_hash(inode); insert_inode_hash(inode);
mark_inode_dirty(inode); mark_inode_dirty(inode);
...@@ -457,8 +457,8 @@ unsigned long ext2_count_free_inodes (struct super_block * sb) ...@@ -457,8 +457,8 @@ unsigned long ext2_count_free_inodes (struct super_block * sb)
int i; int i;
lock_super (sb); lock_super (sb);
es = sb->u.ext2_sb.s_es; es = EXT2_SB(sb)->s_es;
for (i = 0; i < sb->u.ext2_sb.s_groups_count; i++) { for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) {
struct ext2_group_desc *desc = ext2_get_group_desc (sb, i, NULL); struct ext2_group_desc *desc = ext2_get_group_desc (sb, i, NULL);
struct buffer_head *bh; struct buffer_head *bh;
unsigned x; unsigned x;
...@@ -480,7 +480,7 @@ unsigned long ext2_count_free_inodes (struct super_block * sb) ...@@ -480,7 +480,7 @@ unsigned long ext2_count_free_inodes (struct super_block * sb)
unlock_super (sb); unlock_super (sb);
return desc_count; return desc_count;
#else #else
return le32_to_cpu(sb->u.ext2_sb.s_es->s_free_inodes_count); return le32_to_cpu(EXT2_SB(sb)->s_es->s_free_inodes_count);
#endif #endif
} }
...@@ -488,11 +488,11 @@ unsigned long ext2_count_free_inodes (struct super_block * sb) ...@@ -488,11 +488,11 @@ unsigned long ext2_count_free_inodes (struct super_block * sb)
/* Called at mount-time, super-block is locked */ /* Called at mount-time, super-block is locked */
void ext2_check_inodes_bitmap (struct super_block * sb) void ext2_check_inodes_bitmap (struct super_block * sb)
{ {
struct ext2_super_block * es = sb->u.ext2_sb.s_es; struct ext2_super_block * es = EXT2_SB(sb)->s_es;
unsigned long desc_count = 0, bitmap_count = 0; unsigned long desc_count = 0, bitmap_count = 0;
int i; int i;
for (i = 0; i < sb->u.ext2_sb.s_groups_count; i++) { for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) {
struct ext2_group_desc *desc = ext2_get_group_desc(sb, i, NULL); struct ext2_group_desc *desc = ext2_get_group_desc(sb, i, NULL);
struct buffer_head *bh; struct buffer_head *bh;
unsigned x; unsigned x;
......
...@@ -303,7 +303,7 @@ static inline unsigned long ext2_find_near(struct inode *inode, Indirect *ind) ...@@ -303,7 +303,7 @@ static inline unsigned long ext2_find_near(struct inode *inode, Indirect *ind)
* the same cylinder group then. * the same cylinder group then.
*/ */
return (ei->i_block_group * EXT2_BLOCKS_PER_GROUP(inode->i_sb)) + return (ei->i_block_group * EXT2_BLOCKS_PER_GROUP(inode->i_sb)) +
le32_to_cpu(inode->i_sb->u.ext2_sb.s_es->s_first_data_block); le32_to_cpu(EXT2_SB(inode->i_sb)->s_es->s_first_data_block);
} }
/** /**
...@@ -886,7 +886,7 @@ static struct ext2_inode *ext2_get_inode(struct super_block *sb, ino_t ino, ...@@ -886,7 +886,7 @@ static struct ext2_inode *ext2_get_inode(struct super_block *sb, ino_t ino,
*p = NULL; *p = NULL;
if ((ino != EXT2_ROOT_INO && ino != EXT2_ACL_IDX_INO && if ((ino != EXT2_ROOT_INO && ino != EXT2_ACL_IDX_INO &&
ino != EXT2_ACL_DATA_INO && ino < EXT2_FIRST_INO(sb)) || ino != EXT2_ACL_DATA_INO && ino < EXT2_FIRST_INO(sb)) ||
ino > le32_to_cpu(sb->u.ext2_sb.s_es->s_inodes_count)) ino > le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count))
goto Einval; goto Einval;
block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb); block_group = (ino - 1) / EXT2_INODES_PER_GROUP(sb);
......
This diff is collapsed.
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
static loff_t presto_e2_freespace(struct presto_cache *cache, static loff_t presto_e2_freespace(struct presto_cache *cache,
struct super_block *sb) struct super_block *sb)
{ {
unsigned long freebl = le32_to_cpu(sb->u.ext2_sb.s_es->s_free_blocks_count); unsigned long freebl = le32_to_cpu(EXT2_SB(sb)->s_es->s_free_blocks_count);
unsigned long avail = freebl - le32_to_cpu(sb->u.ext2_sb.s_es->s_r_blocks_count); unsigned long avail = freebl - le32_to_cpu(EXT2_SB(sb)->s_es->s_r_blocks_count);
return (avail << EXT2_BLOCK_SIZE_BITS(sb)); return (avail << EXT2_BLOCK_SIZE_BITS(sb));
} }
...@@ -41,7 +41,7 @@ static void *presto_e2_trans_start(struct presto_file_set *fset, struct inode *i ...@@ -41,7 +41,7 @@ static void *presto_e2_trans_start(struct presto_file_set *fset, struct inode *i
strcmp(fset->fset_cache->cache_type, "ext2")) strcmp(fset->fset_cache->cache_type, "ext2"))
return NULL; return NULL;
avail_kmlblocks = inode->i_sb->u.ext2_sb.s_es->s_free_blocks_count; avail_kmlblocks = EXT2_SB(inode->i_sb)->s_es->s_free_blocks_count;
if ( avail_kmlblocks < 3 ) { if ( avail_kmlblocks < 3 ) {
return ERR_PTR(-ENOSPC); return ERR_PTR(-ENOSPC);
......
...@@ -70,6 +70,18 @@ ...@@ -70,6 +70,18 @@
*/ */
#define EXT2_SUPER_MAGIC 0xEF53 #define EXT2_SUPER_MAGIC 0xEF53
#ifdef __KERNEL__
static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
{
return &sb->u.ext2_sb;
}
#else
/* Assume that user mode programs are passing in an ext2fs superblock, not
* a kernel struct super_block. This will allow us to call the feature-test
* macros from user land. */
#define EXT2_SB(sb) (sb)
#endif
/* /*
* Maximal count of links to a file * Maximal count of links to a file
*/ */
...@@ -94,9 +106,9 @@ ...@@ -94,9 +106,9 @@
# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) # define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
#endif #endif
#ifdef __KERNEL__ #ifdef __KERNEL__
#define EXT2_ADDR_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_addr_per_block_bits) #define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_addr_per_block_bits)
#define EXT2_INODE_SIZE(s) ((s)->u.ext2_sb.s_inode_size) #define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size)
#define EXT2_FIRST_INO(s) ((s)->u.ext2_sb.s_first_ino) #define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino)
#else #else
#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ #define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
EXT2_GOOD_OLD_INODE_SIZE : \ EXT2_GOOD_OLD_INODE_SIZE : \
...@@ -113,8 +125,8 @@ ...@@ -113,8 +125,8 @@
#define EXT2_MAX_FRAG_SIZE 4096 #define EXT2_MAX_FRAG_SIZE 4096
#define EXT2_MIN_FRAG_LOG_SIZE 10 #define EXT2_MIN_FRAG_LOG_SIZE 10
#ifdef __KERNEL__ #ifdef __KERNEL__
# define EXT2_FRAG_SIZE(s) ((s)->u.ext2_sb.s_frag_size) # define EXT2_FRAG_SIZE(s) (EXT2_SB(s)->s_frag_size)
# define EXT2_FRAGS_PER_BLOCK(s) ((s)->u.ext2_sb.s_frags_per_block) # define EXT2_FRAGS_PER_BLOCK(s) (EXT2_SB(s)->s_frags_per_block)
#else #else
# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size) # define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s)) # define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
...@@ -161,10 +173,10 @@ struct ext2_group_desc ...@@ -161,10 +173,10 @@ struct ext2_group_desc
* Macro-instructions used to manage group descriptors * Macro-instructions used to manage group descriptors
*/ */
#ifdef __KERNEL__ #ifdef __KERNEL__
# define EXT2_BLOCKS_PER_GROUP(s) ((s)->u.ext2_sb.s_blocks_per_group) # define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group)
# define EXT2_DESC_PER_BLOCK(s) ((s)->u.ext2_sb.s_desc_per_block) # define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block)
# define EXT2_INODES_PER_GROUP(s) ((s)->u.ext2_sb.s_inodes_per_group) # define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group)
# define EXT2_DESC_PER_BLOCK_BITS(s) ((s)->u.ext2_sb.s_desc_per_block_bits) # define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits)
#else #else
# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) # define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) # define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
...@@ -317,7 +329,7 @@ struct ext2_inode { ...@@ -317,7 +329,7 @@ struct ext2_inode {
#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
#define set_opt(o, opt) o |= EXT2_MOUNT_##opt #define set_opt(o, opt) o |= EXT2_MOUNT_##opt
#define test_opt(sb, opt) ((sb)->u.ext2_sb.s_mount_opt & \ #define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
EXT2_MOUNT_##opt) EXT2_MOUNT_##opt)
/* /*
* Maximal mount counts between two filesystem checks * Maximal mount counts between two filesystem checks
...@@ -395,15 +407,6 @@ struct ext2_super_block { ...@@ -395,15 +407,6 @@ struct ext2_super_block {
__u32 s_reserved[204]; /* Padding to the end of the block */ __u32 s_reserved[204]; /* Padding to the end of the block */
}; };
#ifdef __KERNEL__
#define EXT2_SB(sb) (&((sb)->u.ext2_sb))
#else
/* Assume that user mode programs are passing in an ext2fs superblock, not
* a kernel struct super_block. This will allow us to call the feature-test
* macros from user land. */
#define EXT2_SB(sb) (sb)
#endif
/* /*
* Codes for operating systems * Codes for operating systems
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment