Commit | Line | Data |
---|---|---|
805e021f CE |
1 | /* |
2 | * Copyright 2000, International Business Machines Corporation and others. | |
3 | * All Rights Reserved. | |
4 | * | |
5 | * This software has been released under the terms of the IBM Public | |
6 | * License. For details, see the LICENSE file in the top-level source | |
7 | * directory or online at http://www.openafs.org/dl/license10.html | |
8 | */ | |
9 | ||
10 | /* | |
11 | * osi_inode.h | |
12 | * | |
13 | * Inode information required for FreeBSD servers and salvager. | |
14 | */ | |
15 | #ifndef _OSI_INODE_H_ | |
16 | #define _OSI_INODE_H_ | |
17 | ||
18 | #define BAD_IGET -1000 | |
19 | ||
20 | #define VICEMAGIC 0xb61cfa84 | |
21 | ||
22 | #define DI_VICEP3(p) \ | |
23 | ( ((u_int)((p)->di_vicep3a)) << 16 | ((u_int)((p)->di_vicep3b)) ) | |
24 | #define I_VICE3(p) \ | |
25 | ( ((u_int)((p)->i_vicep3a)) << 16 | ((u_int)((p)->i_vicep3b)) ) | |
26 | ||
27 | #define FAKE_INODE_SIZE (sizeof(struct vnode)+sizeof(struct inode)) | |
28 | #define MOUNTLIST_UNLOCK() simple_lock_unlock(&mountlist_slock) | |
29 | #define MOUNTLIST_LOCK() simple_lock(&mountlist_slock) | |
30 | ||
31 | /* FreeBSD doesn't actually have a di_proplb, so we use di_spare[0] */ | |
32 | #define di_proplb di_spare[0] | |
33 | /* For some reason, they're called "oldids" instead of "bc_{u,g}id" */ | |
34 | #define di_bcuid di_u.oldids[0] | |
35 | #define di_bcgid di_u.oldids[1] | |
36 | ||
37 | #define i_vicemagic i_din.di_spare[0] | |
38 | #define i_vicep1 i_din.di_uid | |
39 | #define i_vicep2 i_din.di_gid | |
40 | #define i_vicep3a i_din.di_u.oldids[0] | |
41 | #define i_vicep3b i_din.di_u.oldids[1] | |
42 | #define i_vicep4 i_din.di_spare[1] /* not used */ | |
43 | ||
44 | #define di_vicemagic di_spare[0] | |
45 | #define di_vicep1 di_uid | |
46 | #define di_vicep2 di_gid | |
47 | #define di_vicep3a di_u.oldids[0] | |
48 | #define di_vicep3b di_u.oldids[1] | |
49 | #define di_vicep4 di_spare[1] /* not used */ | |
50 | ||
51 | /* | |
52 | * Macros for handling inode numbers: | |
53 | * inode number to file system block offset. | |
54 | * inode number to cylinder group number. | |
55 | * inode number to file system block address. | |
56 | */ | |
57 | #define itoo(fs, x) ((x) % INOPB(fs)) | |
58 | #define itog(fs, x) ((x) / (fs)->fs_ipg) | |
59 | #define itod(fs, x) \ | |
60 | ((daddr_t)(cgimin(fs, itog(fs, x)) + \ | |
61 | (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) | |
62 | ||
63 | ||
64 | #define IS_VICEMAGIC(ip) ((ip)->i_vicemagic == VICEMAGIC) | |
65 | #define IS_DVICEMAGIC(dp) ((dp)->di_vicemagic == VICEMAGIC) | |
66 | ||
67 | #define CLEAR_VICEMAGIC(ip) (ip)->i_vicemagic = 0 | |
68 | #define CLEAR_DVICEMAGIC(dp) (dp)->di_vicemagic = 0 | |
69 | ||
70 | #endif /* _OSI_INODE_H_ */ |