[PATCH] fs/*: use BUILD_BUG_ON

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Mark Fasheh <mark.fasheh@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Alexey Dobriyan 2006-10-11 01:22:05 -07:00 коммит произвёл Linus Torvalds
Родитель fbab41ccc4
Коммит 2ecd05ae68
5 изменённых файлов: 16 добавлений и 25 удалений

Просмотреть файл

@ -211,8 +211,8 @@ static int afs_dir_open(struct inode *inode, struct file *file)
{ {
_enter("{%lu}", inode->i_ino); _enter("{%lu}", inode->i_ino);
BUG_ON(sizeof(union afs_dir_block) != 2048); BUILD_BUG_ON(sizeof(union afs_dir_block) != 2048);
BUG_ON(sizeof(union afs_dirent) != 32); BUILD_BUG_ON(sizeof(union afs_dirent) != 32);
if (AFS_FS_I(inode)->flags & AFS_VNODE_DELETED) if (AFS_FS_I(inode)->flags & AFS_VNODE_DELETED)
return -ENOENT; return -ENOENT;
@ -446,8 +446,8 @@ static struct dentry *afs_dir_lookup(struct inode *dir, struct dentry *dentry,
_enter("{%lu},%p{%s}", dir->i_ino, dentry, dentry->d_name.name); _enter("{%lu},%p{%s}", dir->i_ino, dentry, dentry->d_name.name);
/* insanity checks first */ /* insanity checks first */
BUG_ON(sizeof(union afs_dir_block) != 2048); BUILD_BUG_ON(sizeof(union afs_dir_block) != 2048);
BUG_ON(sizeof(union afs_dirent) != 32); BUILD_BUG_ON(sizeof(union afs_dirent) != 32);
if (dentry->d_name.len > 255) { if (dentry->d_name.len > 255) {
_leave(" = -ENAMETOOLONG"); _leave(" = -ENAMETOOLONG");

Просмотреть файл

@ -334,10 +334,10 @@ static int __init init_jffs2_fs(void)
which means just 'no padding', without the alignment which means just 'no padding', without the alignment
thing. But GCC doesn't have that -- we have to just thing. But GCC doesn't have that -- we have to just
hope the structs are the right sizes, instead. */ hope the structs are the right sizes, instead. */
BUG_ON(sizeof(struct jffs2_unknown_node) != 12); BUILD_BUG_ON(sizeof(struct jffs2_unknown_node) != 12);
BUG_ON(sizeof(struct jffs2_raw_dirent) != 40); BUILD_BUG_ON(sizeof(struct jffs2_raw_dirent) != 40);
BUG_ON(sizeof(struct jffs2_raw_inode) != 68); BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68);
BUG_ON(sizeof(struct jffs2_raw_summary) != 32); BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32);
printk(KERN_INFO "JFFS2 version 2.2." printk(KERN_INFO "JFFS2 version 2.2."
#ifdef CONFIG_JFFS2_FS_WRITEBUFFER #ifdef CONFIG_JFFS2_FS_WRITEBUFFER

Просмотреть файл

@ -149,12 +149,8 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
return -ENOMEM; return -ENOMEM;
s->s_fs_info = sbi; s->s_fs_info = sbi;
/* N.B. These should be compile-time tests. BUILD_BUG_ON(32 != sizeof (struct minix_inode));
Unfortunately that is impossible. */ BUILD_BUG_ON(64 != sizeof(struct minix2_inode));
if (32 != sizeof (struct minix_inode))
panic("bad V1 i-node size");
if (64 != sizeof(struct minix2_inode))
panic("bad V2 i-node size");
if (!sb_set_blocksize(s, BLOCK_SIZE)) if (!sb_set_blocksize(s, BLOCK_SIZE))
goto out_bad_hblock; goto out_bad_hblock;

Просмотреть файл

@ -339,7 +339,7 @@ static unsigned long long ocfs2_max_file_offset(unsigned int blockshift)
#if BITS_PER_LONG == 32 #if BITS_PER_LONG == 32
# if defined(CONFIG_LBD) # if defined(CONFIG_LBD)
BUG_ON(sizeof(sector_t) != 8); BUILD_BUG_ON(sizeof(sector_t) != 8);
pagefactor = PAGE_CACHE_SIZE; pagefactor = PAGE_CACHE_SIZE;
bitshift = BITS_PER_LONG; bitshift = BITS_PER_LONG;
# else # else

Просмотреть файл

@ -358,16 +358,11 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent)
unsigned long blocknr; unsigned long blocknr;
int size = 0, i; int size = 0, i;
if (1024 != sizeof (struct xenix_super_block)) BUILD_BUG_ON(1024 != sizeof (struct xenix_super_block));
panic("Xenix FS: bad superblock size"); BUILD_BUG_ON(512 != sizeof (struct sysv4_super_block));
if (512 != sizeof (struct sysv4_super_block)) BUILD_BUG_ON(512 != sizeof (struct sysv2_super_block));
panic("SystemV FS: bad superblock size"); BUILD_BUG_ON(500 != sizeof (struct coh_super_block));
if (512 != sizeof (struct sysv2_super_block)) BUILD_BUG_ON(64 != sizeof (struct sysv_inode));
panic("SystemV FS: bad superblock size");
if (500 != sizeof (struct coh_super_block))
panic("Coherent FS: bad superblock size");
if (64 != sizeof (struct sysv_inode))
panic("sysv fs: bad inode size");
sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL); sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
if (!sbi) if (!sbi)