Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / sys / xfsattrs.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 #ifndef AFS_XFSATTRS_H
11 #define AFS_XFSATTRS_H
12 #ifdef AFS_SGI_XFS_IOPS_ENV
13
14 /* This header file contains the definitions of the XFS attributes used to
15 * implement vice inodes for the XFS fileserver.
16 */
17
18 #include <sys/attributes.h>
19
20 /* Parameters in at_param are:
21 * volume special file:
22 * 0 volume
23 * 1 INODESPECIAL
24 * 2 special file type
25 * 3 parent volume
26 *
27 * regular AFS file:
28 * 0 RW volume
29 * 1 vnode
30 * 2 uniquifier
31 * 3 data version
32 */
33 typedef int afs_inode_params_t[4]; /* Use to pass param[4] to kernel. */
34
35 /* XFS attribute must be at most 36 bytes to fit in inode. This includes
36 * the null terminated name of the attribute.
37 */
38
39 #define AFS_XFS_ATTR "AFS"
40 /* The version number covers all of the attribute of the vice inode including
41 * mode, uid and gid.
42 */
43 #define AFS_XFS_ATTR_VERS ((char)1)
44
45 /* The name version is the version of the scheme used to name vice inodes.
46 * version 1 is /vicepX/.<volume-id>/.<uniquifier>.<tag> All numbers are
47 * in base 64. Use the utilities in util/base64.c for conversion.
48 * Version 2 is /vicepX/.afsinodes.<volume-id>/.<uniquifier>.<tag>
49 */
50 #define AFS_XFS_NAME_VERS1 ((char)1)
51 #define AFS_XFS_NAME_VERS2 ((char)2)
52 #define AFS_XFS_NAME_VERS AFS_XFS_NAME_VERS2
53 #define AFS_INODE_DIR_NAME ".afsinodes."
54
55 /* Unfortunately, to get all this in 39 bytes requires proper packing.
56 * So, the version number is at an offset instead of first.
57 */
58 typedef struct {
59 #ifdef KERNEL
60 ino_t at_pino; /* inode# of parent directory. */
61 #else
62 uint64_t at_pino; /* inode# of parent directory. */
63 #endif
64 u_char at_attr_version; /* version number of struct, currently 0. */
65 u_char at_name_version; /* version number of file names. */
66 u_short at_tag; /* guarantees unique file names. */
67 afs_inode_params_t at_param; /* vice parameters. */
68 } afs_xfs_attr_t;
69
70 /* Use this for getting and setting attr. sizeof struct is too large. */
71 #define SIZEOF_XFS_ATTR_T (7*sizeof(int))
72
73 /* Additional info is stored in inode standard attributes:
74 * mode - low 7 bits are link count.
75 * uid - clipped volume id (inode_p1)
76 * gid - XFS_VICEMAGIC
77 * Only set low 31 bits of uid and gid so chown can fix in xfs_ListViceInodes.
78 */
79 #define AFS_XFS_MODE_LINK_MASK 0x7
80 #define AFS_XFS_VNO_CLIP(V) (V & 0x7fffffff)
81
82 /* AFS_XFS_DATTR is used by ListViceInodes to restrict it's search to
83 * AFS directories. Using an attribute, since it can't inadvertantly be
84 * changed by Unix syscalls.
85 */
86 #define AFS_XFS_DATTR "AFSDIR"
87 typedef struct {
88 #define AFS_XFS_ATD_VERS 1
89 char atd_version;
90 char atd_spare[3];
91 int atd_volume; /* RW volume id */
92 } afs_xfs_dattr_t;
93 #define SIZEOF_XFS_DATTR_T sizeof(afs_xfs_dattr_t)
94
95 /* vice_inode_info_t must match ViceInodeInfo for the salvager.
96 * vice_inode_info_t and i_list_inode_t are used to get the inode
97 * information from XFS partitions. The ili_name_version is
98 * used to ensure we're using the correct naming algorithm
99 * to fix file names in ListViceInodes.
100 */
101 typedef struct {
102 uint64_t inodeNumber;
103 int byteCount;
104 int linkCount;
105 int param[4];
106 } vice_inode_info_t;
107
108 typedef struct {
109 #define AFS_XFS_ILI_VERSION 1
110 u_int ili_version; /* input is requested struct version. */
111 u_char ili_attr_version; /* attr's version */
112 u_char ili_name_version; /* attr's name version */
113 u_short ili_tag; /* at_tag number. */
114 uint64_t ili_pino; /* parent inode number. */
115 vice_inode_info_t ili_info; /* Must be at a 64 bit offset. */
116 u_int ili_vno, ili_magic;
117 } i_list_inode_t;
118
119
120 #endif /* AFS_SGI_XFS_IOPS_ENV */
121 #endif /* AFS_XFSATTRS_H */