Staging: comedi: fix brace and printk coding style issue in serial2002.c
[linux-2.6/next.git] / fs / befs / inode.c
blob94c17f9a95767ca7a4d775bb5b662c9cd279f9ff
1 /*
2 * inode.c
3 *
4 * Copyright (C) 2001 Will Dyson <will_dyson@pobox.com>
5 */
7 #include <linux/fs.h>
9 #include "befs.h"
10 #include "inode.h"
13 Validates the correctness of the befs inode
14 Returns BEFS_OK if the inode should be used, otherwise
15 returns BEFS_BAD_INODE
17 int
18 befs_check_inode(struct super_block *sb, befs_inode * raw_inode,
19 befs_blocknr_t inode)
21 u32 magic1 = fs32_to_cpu(sb, raw_inode->magic1);
22 befs_inode_addr ino_num = fsrun_to_cpu(sb, raw_inode->inode_num);
23 u32 flags = fs32_to_cpu(sb, raw_inode->flags);
25 /* check magic header. */
26 if (magic1 != BEFS_INODE_MAGIC1) {
27 befs_error(sb,
28 "Inode has a bad magic header - inode = %lu", inode);
29 return BEFS_BAD_INODE;
33 * Sanity check2: inodes store their own block address. Check it.
35 if (inode != iaddr2blockno(sb, &ino_num)) {
36 befs_error(sb, "inode blocknr field disagrees with vfs "
37 "VFS: %lu, Inode %lu",
38 inode, iaddr2blockno(sb, &ino_num));
39 return BEFS_BAD_INODE;
43 * check flag
46 if (!(flags & BEFS_INODE_IN_USE)) {
47 befs_error(sb, "inode is not used - inode = %lu", inode);
48 return BEFS_BAD_INODE;
51 return BEFS_OK;