The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/fs/befs/inode.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * inode.c
    3  * 
    4  * Copyright (C) 2001 Will Dyson <will_dyson@pobox.com>
    5  */
    6 
    7 #include <linux/fs.h>
    8 
    9 #include "befs.h"
   10 #include "inode.h"
   11 #include "endian.h"
   12 
   13 /*
   14         Validates the correctness of the befs inode
   15         Returns BEFS_OK if the inode should be used, otherwise
   16         returns BEFS_BAD_INODE
   17 */
   18 int
   19 befs_check_inode(struct super_block *sb, befs_inode * raw_inode,
   20                  befs_blocknr_t inode)
   21 {
   22         u32 magic1 = fs32_to_cpu(sb, raw_inode->magic1);
   23         befs_inode_addr ino_num = fsrun_to_cpu(sb, raw_inode->inode_num);
   24         u32 flags = fs32_to_cpu(sb, raw_inode->flags);
   25 
   26         /* check magic header. */
   27         if (magic1 != BEFS_INODE_MAGIC1) {
   28                 befs_error(sb,
   29                            "Inode has a bad magic header - inode = %lu", inode);
   30                 return BEFS_BAD_INODE;
   31         }
   32 
   33         /*
   34          * Sanity check2: inodes store their own block address. Check it.
   35          */
   36         if (inode != iaddr2blockno(sb, &ino_num)) {
   37                 befs_error(sb, "inode blocknr field disagrees with vfs "
   38                            "VFS: %lu, Inode %lu",
   39                            inode, iaddr2blockno(sb, &ino_num));
   40                 return BEFS_BAD_INODE;
   41         }
   42 
   43         /*
   44          * check flag
   45          */
   46 
   47         if (!(flags & BEFS_INODE_IN_USE)) {
   48                 befs_error(sb, "inode is not used - inode = %lu", inode);
   49                 return BEFS_BAD_INODE;
   50         }
   51 
   52         return BEFS_OK;
   53 }

Cache object: 7bb55def5edbe7f72e1856ac8121a835


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.