From: Andreas Dilger Date: Sun, 9 Jun 2002 23:38:50 +0000 (-0600) Subject: ext2_fs.h: Further minor cleanups of the header. Consolidate X-Git-Tag: E2FSPROGS-1.28-WIP-0626~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7da78ff17df7d2c1eeebbc2b0727106b63c08a68;p=thirdparty%2Fe2fsprogs.git ext2_fs.h: Further minor cleanups of the header. Consolidate some checks for __KERNEL__ into one place. --- diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 6add955fb..77ed4cce6 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,8 @@ +2002-06-09 Andreas Dilger + + * ext2_fs.h: Further minor cleanups of the header. Consolidate + some checks for __KERNEL__ into one place. + 2002-05-22 Andreas Dilger * ext2_fs.h: Remove macros accessing u.ext2_sb field and use diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h index 9309c49c0..c9033b1ab 100644 --- a/lib/ext2fs/ext2_fs.h +++ b/lib/ext2fs/ext2_fs.h @@ -78,32 +78,23 @@ */ #define EXT2_MIN_BLOCK_LOG_SIZE 10 /* 1024 */ #define EXT2_MAX_BLOCK_LOG_SIZE 13 /* 8192 */ -#define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE) -#define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE) -#ifdef __KERNEL__ -# define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize) -#else -# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) -#endif -#define EXT2_ACLE_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_acl_entry)) -#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) -#ifdef __KERNEL__ -# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) -#else -# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) -#endif +#define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE) +#define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE) #ifdef __KERNEL__ +#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize) +#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) #define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->addr_per_block_bits) -#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size) -#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino) +#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size) +#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino) #else +#define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) +#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) #define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ - EXT2_GOOD_OLD_INODE_SIZE : \ - (s)->s_inode_size) + EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size) #define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ - EXT2_GOOD_OLD_FIRST_INO : \ - (s)->s_first_ino) + EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino) #endif +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(__u32)) /* * Macro-instructions used to manage fragments @@ -330,7 +321,7 @@ struct ext2_inode { #define i_fsize osd2.masix2.m_i_fsize #define i_reserved2 osd2.masix2.m_i_reserved2 -#endif /* defined(__KERNEL) || defined(__linux__) */ +#endif /* defined(__KERNEL__) || defined(__linux__) */ /* * File system states