aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2006-10-11 04:22:05 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-11 14:14:23 -0400
commit2ecd05ae68a903761e736e9e0aca40d6ace4319e (patch)
tree4bb0a178362e954191a6e6cee351745cd2dbe685 /fs
parentfbab41ccc479b6b0ba15c137af9e0b1c100bff24 (diff)
[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>
Diffstat (limited to 'fs')
-rw-r--r--fs/afs/dir.c8
-rw-r--r--fs/jffs2/super.c8
-rw-r--r--fs/minix/inode.c8
-rw-r--r--fs/ocfs2/super.c2
-rw-r--r--fs/sysv/super.c15
5 files changed, 16 insertions, 25 deletions
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index cf8a2cb28505..a6ec75c56fcf 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -211,8 +211,8 @@ static int afs_dir_open(struct inode *inode, struct file *file)
211{ 211{
212 _enter("{%lu}", inode->i_ino); 212 _enter("{%lu}", inode->i_ino);
213 213
214 BUG_ON(sizeof(union afs_dir_block) != 2048); 214 BUILD_BUG_ON(sizeof(union afs_dir_block) != 2048);
215 BUG_ON(sizeof(union afs_dirent) != 32); 215 BUILD_BUG_ON(sizeof(union afs_dirent) != 32);
216 216
217 if (AFS_FS_I(inode)->flags & AFS_VNODE_DELETED) 217 if (AFS_FS_I(inode)->flags & AFS_VNODE_DELETED)
218 return -ENOENT; 218 return -ENOENT;
@@ -446,8 +446,8 @@ static struct dentry *afs_dir_lookup(struct inode *dir, struct dentry *dentry,
446 _enter("{%lu},%p{%s}", dir->i_ino, dentry, dentry->d_name.name); 446 _enter("{%lu},%p{%s}", dir->i_ino, dentry, dentry->d_name.name);
447 447
448 /* insanity checks first */ 448 /* insanity checks first */
449 BUG_ON(sizeof(union afs_dir_block) != 2048); 449 BUILD_BUG_ON(sizeof(union afs_dir_block) != 2048);
450 BUG_ON(sizeof(union afs_dirent) != 32); 450 BUILD_BUG_ON(sizeof(union afs_dirent) != 32);
451 451
452 if (dentry->d_name.len > 255) { 452 if (dentry->d_name.len > 255) {
453 _leave(" = -ENAMETOOLONG"); 453 _leave(" = -ENAMETOOLONG");
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 6de374513c01..bc4b8106a490 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -334,10 +334,10 @@ static int __init init_jffs2_fs(void)
334 which means just 'no padding', without the alignment 334 which means just 'no padding', without the alignment
335 thing. But GCC doesn't have that -- we have to just 335 thing. But GCC doesn't have that -- we have to just
336 hope the structs are the right sizes, instead. */ 336 hope the structs are the right sizes, instead. */
337 BUG_ON(sizeof(struct jffs2_unknown_node) != 12); 337 BUILD_BUG_ON(sizeof(struct jffs2_unknown_node) != 12);
338 BUG_ON(sizeof(struct jffs2_raw_dirent) != 40); 338 BUILD_BUG_ON(sizeof(struct jffs2_raw_dirent) != 40);
339 BUG_ON(sizeof(struct jffs2_raw_inode) != 68); 339 BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68);
340 BUG_ON(sizeof(struct jffs2_raw_summary) != 32); 340 BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32);
341 341
342 printk(KERN_INFO "JFFS2 version 2.2." 342 printk(KERN_INFO "JFFS2 version 2.2."
343#ifdef CONFIG_JFFS2_FS_WRITEBUFFER 343#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index c11a4b9fb863..1e36bae4d0eb 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -149,12 +149,8 @@ static int minix_fill_super(struct super_block *s, void *data, int silent)
149 return -ENOMEM; 149 return -ENOMEM;
150 s->s_fs_info = sbi; 150 s->s_fs_info = sbi;
151 151
152 /* N.B. These should be compile-time tests. 152 BUILD_BUG_ON(32 != sizeof (struct minix_inode));
153 Unfortunately that is impossible. */ 153 BUILD_BUG_ON(64 != sizeof(struct minix2_inode));
154 if (32 != sizeof (struct minix_inode))
155 panic("bad V1 i-node size");
156 if (64 != sizeof(struct minix2_inode))
157 panic("bad V2 i-node size");
158 154
159 if (!sb_set_blocksize(s, BLOCK_SIZE)) 155 if (!sb_set_blocksize(s, BLOCK_SIZE))
160 goto out_bad_hblock; 156 goto out_bad_hblock;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 4c29cd7cc8e6..76b46ebbb10c 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -339,7 +339,7 @@ static unsigned long long ocfs2_max_file_offset(unsigned int blockshift)
339 339
340#if BITS_PER_LONG == 32 340#if BITS_PER_LONG == 32
341# if defined(CONFIG_LBD) 341# if defined(CONFIG_LBD)
342 BUG_ON(sizeof(sector_t) != 8); 342 BUILD_BUG_ON(sizeof(sector_t) != 8);
343 pagefactor = PAGE_CACHE_SIZE; 343 pagefactor = PAGE_CACHE_SIZE;
344 bitshift = BITS_PER_LONG; 344 bitshift = BITS_PER_LONG;
345# else 345# else
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index 350cba5d6803..dc9e7dc07fb7 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -358,16 +358,11 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent)
358 unsigned long blocknr; 358 unsigned long blocknr;
359 int size = 0, i; 359 int size = 0, i;
360 360
361 if (1024 != sizeof (struct xenix_super_block)) 361 BUILD_BUG_ON(1024 != sizeof (struct xenix_super_block));
362 panic("Xenix FS: bad superblock size"); 362 BUILD_BUG_ON(512 != sizeof (struct sysv4_super_block));
363 if (512 != sizeof (struct sysv4_super_block)) 363 BUILD_BUG_ON(512 != sizeof (struct sysv2_super_block));
364 panic("SystemV FS: bad superblock size"); 364 BUILD_BUG_ON(500 != sizeof (struct coh_super_block));
365 if (512 != sizeof (struct sysv2_super_block)) 365 BUILD_BUG_ON(64 != sizeof (struct sysv_inode));
366 panic("SystemV FS: bad superblock size");
367 if (500 != sizeof (struct coh_super_block))
368 panic("Coherent FS: bad superblock size");
369 if (64 != sizeof (struct sysv_inode))
370 panic("sysv fs: bad inode size");
371 366
372 sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL); 367 sbi = kzalloc(sizeof(struct sysv_sb_info), GFP_KERNEL);
373 if (!sbi) 368 if (!sbi)