OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/afs/FBSD/osi_inode.h
00001 /*
00002  * Copyright 2000, International Business Machines Corporation and others.
00003  * All Rights Reserved.
00004  *
00005  * This software has been released under the terms of the IBM Public
00006  * License.  For details, see the LICENSE file in the top-level source
00007  * directory or online at http://www.openafs.org/dl/license10.html
00008  */
00009 
00010 /*
00011  * osi_inode.h
00012  *
00013  * Inode information required for FreeBSD servers and salvager.
00014  */
00015 #ifndef _OSI_INODE_H_
00016 #define _OSI_INODE_H_
00017 
00018 #define BAD_IGET        -1000
00019 
00020 #define VICEMAGIC       0xb61cfa84
00021 
00022 #define DI_VICEP3(p) \
00023         ( ((u_int)((p)->di_vicep3a)) << 16 | ((u_int)((p)->di_vicep3b)) )
00024 #define I_VICE3(p) \
00025         ( ((u_int)((p)->i_vicep3a)) << 16 | ((u_int)((p)->i_vicep3b)) )
00026 
00027 #define FAKE_INODE_SIZE    (sizeof(struct vnode)+sizeof(struct inode))
00028 #define MOUNTLIST_UNLOCK() simple_lock_unlock(&mountlist_slock)
00029 #define MOUNTLIST_LOCK()   simple_lock(&mountlist_slock)
00030 
00031 /* FreeBSD doesn't actually have a di_proplb, so we use di_spare[0] */
00032 #define di_proplb       di_spare[0]
00033 /* For some reason, they're called "oldids" instead of "bc_{u,g}id" */
00034 #define di_bcuid        di_u.oldids[0]
00035 #define di_bcgid        di_u.oldids[1]
00036 
00037 #define i_vicemagic     i_din.di_spare[0]
00038 #define i_vicep1        i_din.di_uid
00039 #define i_vicep2        i_din.di_gid
00040 #define i_vicep3a       i_din.di_u.oldids[0]
00041 #define i_vicep3b       i_din.di_u.oldids[1]
00042 #define i_vicep4        i_din.di_spare[1]       /* not used */
00043 
00044 #define di_vicemagic    di_spare[0]
00045 #define di_vicep1       di_uid
00046 #define di_vicep2       di_gid
00047 #define di_vicep3a      di_u.oldids[0]
00048 #define di_vicep3b      di_u.oldids[1]
00049 #define di_vicep4       di_spare[1]     /* not used */
00050 
00051 /*
00052  * Macros for handling inode numbers:
00053  *     inode number to file system block offset.
00054  *     inode number to cylinder group number.
00055  *     inode number to file system block address.
00056  */
00057 #define itoo(fs, x)     ((x) % INOPB(fs))
00058 #define itog(fs, x)     ((x) / (fs)->fs_ipg)
00059 #define itod(fs, x) \
00060         ((daddr_t)(cgimin(fs, itog(fs, x)) + \
00061         (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs))))))
00062 
00063 
00064 #define  IS_VICEMAGIC(ip)        ((ip)->i_vicemagic == VICEMAGIC)
00065 #define  IS_DVICEMAGIC(dp)       ((dp)->di_vicemagic == VICEMAGIC)
00066 
00067 #define  CLEAR_VICEMAGIC(ip)     (ip)->i_vicemagic = 0
00068 #define  CLEAR_DVICEMAGIC(dp)    (dp)->di_vicemagic = 0
00069 
00070 #endif /* _OSI_INODE_H_ */
 All Data Structures Files Functions Variables