Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / vol / volinodes.h
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 System: VICE-TWO
12 Module: volinodes.h
13 Institution: The Information Technology Center, Carnegie-Mellon University
14
15 */
16
17 #ifndef __volinodes_h_
18 #define __volinodes_h_
19
20 #include <stddef.h>
21
22 /* Used by vutil.c and salvager.c */
23
24 #ifdef AFS_NAMEI_ENV
25 #define NO_LINK_TABLE 0
26 #else
27 #define NO_LINK_TABLE 1
28 #endif
29
30 #define MAXINODETYPE VI_LINKTABLE
31 static struct afs_inode_info {
32 struct versionStamp stamp;
33 bit32 inodeType;
34 int size; /* size of any fixed size portion of the header */
35 Inode *inode;
36 char *description;
37 /* if this is 1, then this inode is obsolete--
38 * salvager may delete it, and shouldn't complain
39 * if it isn't there; create can not bother to create it */
40 int obsolete;
41 } afs_common_inode_info[MAXINODETYPE] = {
42 {
43 {VOLUMEINFOMAGIC, VOLUMEINFOVERSION},
44 VI_VOLINFO,
45 sizeof(VolumeDiskData),
46 (Inode*)offsetof(struct VolumeHeader, volumeInfo),
47 "Volume information",
48 0
49 },
50 {
51 {SMALLINDEXMAGIC, SMALLINDEXVERSION},
52 VI_SMALLINDEX,
53 sizeof(struct versionStamp),
54 (Inode*)offsetof(struct VolumeHeader, smallVnodeIndex),
55 "small inode index",
56 0
57 },
58 {
59 {LARGEINDEXMAGIC, LARGEINDEXVERSION},
60 VI_LARGEINDEX,
61 sizeof(struct versionStamp),
62 (Inode*)offsetof(struct VolumeHeader, largeVnodeIndex),
63 "large inode index",
64 0
65 },
66 {
67 {ACLMAGIC, ACLVERSION},
68 VI_ACL,
69 sizeof(struct versionStamp),
70 (Inode*)offsetof(struct VolumeHeader, volumeAcl),
71 "access control list",
72 1
73 },
74 {
75 {MOUNTMAGIC, MOUNTVERSION},
76 VI_MOUNTTABLE,
77 sizeof(struct versionStamp),
78 (Inode*)offsetof(struct VolumeHeader, volumeMountTable),
79 "mount table",
80 1
81 },
82 {
83 {LINKTABLEMAGIC, LINKTABLEVERSION},
84 VI_LINKTABLE,
85 sizeof(struct versionStamp),
86 (Inode*)offsetof(struct VolumeHeader, linkTable),
87 "link table",
88 NO_LINK_TABLE
89 },
90 };
91 /* inodeType is redundant in the above table; it used to be useful, but now
92 we require the table to be ordered */
93
94 /**
95 * initialize a struct afs_inode_info
96 *
97 * @param[in] header the volume header struct to use when referencing volume
98 * header fields in 'stuff'
99 * @param[out] stuff the struct afs_inode_info to initialize
100 *
101 */
102 static_inline void
103 init_inode_info(struct VolumeHeader *header,
104 struct afs_inode_info *stuff)
105 {
106 int i;
107 memcpy(stuff, afs_common_inode_info, sizeof(afs_common_inode_info));
108 for (i = 0; i < MAXINODETYPE; i++) {
109 stuff[i].inode = (Inode*)((char*)header + (uintptr_t)stuff[i].inode);
110 }
111 }
112
113 #endif /* __volinodes_h_ */