1
2
3
4
5
6
7
8 #ifndef AFS_H
9 #define AFS_H
10
11 #include <linux/in.h>
12
13 #define AFS_MAXCELLNAME 64
14 #define AFS_MAXVOLNAME 64
15 #define AFS_MAXNSERVERS 8
16 #define AFS_NMAXNSERVERS 13
17 #define AFS_MAXTYPES 3
18 #define AFSNAMEMAX 256
19 #define AFSPATHMAX 1024
20 #define AFSOPAQUEMAX 1024
21
22 #define AFS_VL_MAX_LIFESPAN (120 * HZ)
23 #define AFS_PROBE_MAX_LIFESPAN (30 * HZ)
24
25 typedef u64 afs_volid_t;
26 typedef u64 afs_vnodeid_t;
27 typedef u64 afs_dataversion_t;
28
29 typedef enum {
30 AFSVL_RWVOL,
31 AFSVL_ROVOL,
32 AFSVL_BACKVOL,
33 } __attribute__((packed)) afs_voltype_t;
34
35 typedef enum {
36 AFS_FTYPE_INVALID = 0,
37 AFS_FTYPE_FILE = 1,
38 AFS_FTYPE_DIR = 2,
39 AFS_FTYPE_SYMLINK = 3,
40 } afs_file_type_t;
41
42 typedef enum {
43 AFS_LOCK_READ = 0,
44 AFS_LOCK_WRITE = 1,
45 } afs_lock_type_t;
46
47 #define AFS_LOCKWAIT (5 * 60)
48
49
50
51
52 struct afs_fid {
53 afs_volid_t vid;
54 afs_vnodeid_t vnode;
55 u32 vnode_hi;
56 u32 unique;
57 };
58
59
60
61
62 typedef enum {
63 AFSCM_CB_UNTYPED = 0,
64 AFSCM_CB_EXCLUSIVE = 1,
65 AFSCM_CB_SHARED = 2,
66 AFSCM_CB_DROPPED = 3,
67 } afs_callback_type_t;
68
69 struct afs_callback {
70 time64_t expires_at;
71
72
73 };
74
75 struct afs_callback_break {
76 struct afs_fid fid;
77
78 };
79
80 #define AFSCBMAX 50
81
82 struct afs_uuid {
83 __be32 time_low;
84 __be16 time_mid;
85 __be16 time_hi_and_version;
86 __s8 clock_seq_hi_and_reserved;
87 __s8 clock_seq_low;
88 __s8 node[6];
89 };
90
91
92
93
94 struct afs_volume_info {
95 afs_volid_t vid;
96 afs_voltype_t type;
97 afs_volid_t type_vids[5];
98
99
100 size_t nservers;
101 struct {
102 struct in_addr addr;
103 } servers[8];
104 };
105
106
107
108
109 typedef u32 afs_access_t;
110 #define AFS_ACE_READ 0x00000001U
111 #define AFS_ACE_WRITE 0x00000002U
112 #define AFS_ACE_INSERT 0x00000004U
113 #define AFS_ACE_LOOKUP 0x00000008U
114 #define AFS_ACE_DELETE 0x00000010U
115 #define AFS_ACE_LOCK 0x00000020U
116 #define AFS_ACE_ADMINISTER 0x00000040U
117 #define AFS_ACE_USER_A 0x01000000U
118 #define AFS_ACE_USER_B 0x02000000U
119 #define AFS_ACE_USER_C 0x04000000U
120 #define AFS_ACE_USER_D 0x08000000U
121 #define AFS_ACE_USER_E 0x10000000U
122 #define AFS_ACE_USER_F 0x20000000U
123 #define AFS_ACE_USER_G 0x40000000U
124 #define AFS_ACE_USER_H 0x80000000U
125
126
127
128
129 struct afs_file_status {
130 u64 size;
131 afs_dataversion_t data_version;
132 struct timespec64 mtime_client;
133 struct timespec64 mtime_server;
134 s64 author;
135 s64 owner;
136 s64 group;
137 afs_access_t caller_access;
138 afs_access_t anon_access;
139 umode_t mode;
140 afs_file_type_t type;
141 u32 nlink;
142 s32 lock_count;
143 u32 abort_code;
144 };
145
146 struct afs_status_cb {
147 struct afs_file_status status;
148 struct afs_callback callback;
149 unsigned int cb_break;
150 bool have_status;
151 bool have_cb;
152 bool have_error;
153 };
154
155
156
157
158
159 #define AFS_SET_MTIME 0x01
160 #define AFS_SET_OWNER 0x02
161 #define AFS_SET_GROUP 0x04
162 #define AFS_SET_MODE 0x08
163 #define AFS_SET_SEG_SIZE 0x10
164
165
166
167
168 struct afs_volsync {
169 time64_t creation;
170 };
171
172
173
174
175 struct afs_volume_status {
176 afs_volid_t vid;
177 afs_volid_t parent_id;
178 u8 online;
179 u8 in_service;
180 u8 blessed;
181 u8 needs_salvage;
182 u32 type;
183 u64 min_quota;
184 u64 max_quota;
185 u64 blocks_in_use;
186 u64 part_blocks_avail;
187 u64 part_max_blocks;
188 s64 vol_copy_date;
189 s64 vol_backup_date;
190 };
191
192 #define AFS_BLOCK_SIZE 1024
193
194
195
196
197 struct afs_uuid__xdr {
198 __be32 time_low;
199 __be32 time_mid;
200 __be32 time_hi_and_version;
201 __be32 clock_seq_hi_and_reserved;
202 __be32 clock_seq_low;
203 __be32 node[6];
204 };
205
206 #endif