This source file includes following definitions.
- ORANGEFS_khandle_cmp
- ORANGEFS_khandle_to
- ORANGEFS_khandle_from
1
2 #include <linux/kernel.h>
3 #include <linux/types.h>
4 #include <linux/spinlock_types.h>
5 #include <linux/slab.h>
6 #include <linux/ioctl.h>
7
8
9
10
11
12
13
14
15
16
17
18 struct orangefs_khandle {
19 unsigned char u[16];
20 } __aligned(8);
21
22
23
24
25 struct orangefs_object_kref {
26 struct orangefs_khandle khandle;
27 __s32 fs_id;
28 __s32 __pad1;
29 };
30
31
32
33
34
35 static inline int ORANGEFS_khandle_cmp(const struct orangefs_khandle *kh1,
36 const struct orangefs_khandle *kh2)
37 {
38 int i;
39
40 for (i = 15; i >= 0; i--) {
41 if (kh1->u[i] > kh2->u[i])
42 return 1;
43 if (kh1->u[i] < kh2->u[i])
44 return -1;
45 }
46
47 return 0;
48 }
49
50 static inline void ORANGEFS_khandle_to(const struct orangefs_khandle *kh,
51 void *p, int size)
52 {
53
54 memcpy(p, kh->u, 16);
55 memset(p + 16, 0, size - 16);
56
57 }
58
59 static inline void ORANGEFS_khandle_from(struct orangefs_khandle *kh,
60 void *p, int size)
61 {
62 memset(kh, 0, 16);
63 memcpy(kh->u, p, 16);
64
65 }
66
67
68
69 #define ORANGEFS_SUPER_MAGIC 0x20030528
70
71
72
73
74
75
76
77
78
79
80
81
82 #define ORANGEFS_ERROR_BIT (1 << 30)
83
84
85
86
87
88 #define ORANGEFS_NON_ERRNO_ERROR_BIT (1 << 29)
89
90
91
92
93
94
95 #define ORANGEFS_ERROR_CLASS_BITS 0x380
96
97
98 #define ORANGEFS_ERROR_NUMBER_BITS 0x7f
99
100
101
102
103 #define ORANGEFS_ECANCEL (1|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
104 #define ORANGEFS_EDEVINIT (2|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
105 #define ORANGEFS_EDETAIL (3|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
106 #define ORANGEFS_EHOSTNTFD (4|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
107 #define ORANGEFS_EADDRNTFD (5|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
108 #define ORANGEFS_ENORECVR (6|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
109 #define ORANGEFS_ETRYAGAIN (7|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
110 #define ORANGEFS_ENOTPVFS (8|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
111 #define ORANGEFS_ESECURITY (9|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
112
113
114 #define ORANGEFS_O_EXECUTE (1 << 0)
115 #define ORANGEFS_O_WRITE (1 << 1)
116 #define ORANGEFS_O_READ (1 << 2)
117 #define ORANGEFS_G_EXECUTE (1 << 3)
118 #define ORANGEFS_G_WRITE (1 << 4)
119 #define ORANGEFS_G_READ (1 << 5)
120 #define ORANGEFS_U_EXECUTE (1 << 6)
121 #define ORANGEFS_U_WRITE (1 << 7)
122 #define ORANGEFS_U_READ (1 << 8)
123
124 #define ORANGEFS_G_SGID (1 << 10)
125 #define ORANGEFS_U_SUID (1 << 11)
126
127 #define ORANGEFS_ITERATE_START 2147483646
128 #define ORANGEFS_ITERATE_END 2147483645
129 #define ORANGEFS_IMMUTABLE_FL FS_IMMUTABLE_FL
130 #define ORANGEFS_APPEND_FL FS_APPEND_FL
131 #define ORANGEFS_NOATIME_FL FS_NOATIME_FL
132 #define ORANGEFS_MIRROR_FL 0x01000000ULL
133 #define ORANGEFS_FS_ID_NULL ((__s32)0)
134 #define ORANGEFS_ATTR_SYS_UID (1 << 0)
135 #define ORANGEFS_ATTR_SYS_GID (1 << 1)
136 #define ORANGEFS_ATTR_SYS_PERM (1 << 2)
137 #define ORANGEFS_ATTR_SYS_ATIME (1 << 3)
138 #define ORANGEFS_ATTR_SYS_CTIME (1 << 4)
139 #define ORANGEFS_ATTR_SYS_MTIME (1 << 5)
140 #define ORANGEFS_ATTR_SYS_TYPE (1 << 6)
141 #define ORANGEFS_ATTR_SYS_ATIME_SET (1 << 7)
142 #define ORANGEFS_ATTR_SYS_MTIME_SET (1 << 8)
143 #define ORANGEFS_ATTR_SYS_SIZE (1 << 20)
144 #define ORANGEFS_ATTR_SYS_LNK_TARGET (1 << 24)
145 #define ORANGEFS_ATTR_SYS_DFILE_COUNT (1 << 25)
146 #define ORANGEFS_ATTR_SYS_DIRENT_COUNT (1 << 26)
147 #define ORANGEFS_ATTR_SYS_BLKSIZE (1 << 28)
148 #define ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT (1 << 29)
149 #define ORANGEFS_ATTR_SYS_COMMON_ALL \
150 (ORANGEFS_ATTR_SYS_UID | \
151 ORANGEFS_ATTR_SYS_GID | \
152 ORANGEFS_ATTR_SYS_PERM | \
153 ORANGEFS_ATTR_SYS_ATIME | \
154 ORANGEFS_ATTR_SYS_CTIME | \
155 ORANGEFS_ATTR_SYS_MTIME | \
156 ORANGEFS_ATTR_SYS_TYPE)
157
158 #define ORANGEFS_ATTR_SYS_ALL_SETABLE \
159 (ORANGEFS_ATTR_SYS_COMMON_ALL-ORANGEFS_ATTR_SYS_TYPE)
160
161 #define ORANGEFS_ATTR_SYS_ALL_NOHINT \
162 (ORANGEFS_ATTR_SYS_COMMON_ALL | \
163 ORANGEFS_ATTR_SYS_SIZE | \
164 ORANGEFS_ATTR_SYS_LNK_TARGET | \
165 ORANGEFS_ATTR_SYS_DFILE_COUNT | \
166 ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT | \
167 ORANGEFS_ATTR_SYS_DIRENT_COUNT | \
168 ORANGEFS_ATTR_SYS_BLKSIZE)
169
170 #define ORANGEFS_XATTR_REPLACE 0x2
171 #define ORANGEFS_XATTR_CREATE 0x1
172 #define ORANGEFS_MAX_SERVER_ADDR_LEN 256
173 #define ORANGEFS_NAME_MAX 256
174
175
176
177
178
179
180
181
182
183 #define ORANGEFS_MAX_XATTR_NAMELEN ORANGEFS_NAME_MAX
184
185
186
187 #define ORANGEFS_MAX_XATTR_VALUELEN 8192
188
189
190 #define ORANGEFS_MAX_XATTR_LISTLEN 16
191
192
193
194
195
196 enum ORANGEFS_io_type {
197 ORANGEFS_IO_READ = 1,
198 ORANGEFS_IO_WRITE = 2
199 };
200
201
202
203
204
205
206 enum orangefs_ds_type {
207 ORANGEFS_TYPE_NONE = 0,
208 ORANGEFS_TYPE_METAFILE = (1 << 0),
209 ORANGEFS_TYPE_DATAFILE = (1 << 1),
210 ORANGEFS_TYPE_DIRECTORY = (1 << 2),
211 ORANGEFS_TYPE_SYMLINK = (1 << 3),
212 ORANGEFS_TYPE_DIRDATA = (1 << 4),
213 ORANGEFS_TYPE_INTERNAL = (1 << 5)
214 };
215
216
217 struct ORANGEFS_keyval_pair {
218 char key[ORANGEFS_MAX_XATTR_NAMELEN];
219 __s32 key_sz;
220 __s32 val_sz;
221 char val[ORANGEFS_MAX_XATTR_VALUELEN];
222 };
223
224
225
226 struct ORANGEFS_sys_attr_s {
227 __u32 owner;
228 __u32 group;
229 __u32 perms;
230 __u64 atime;
231 __u64 mtime;
232 __u64 ctime;
233 __s64 size;
234
235
236 char *link_target;
237
238
239 __s32 dfile_count;
240
241
242 __s32 distr_dir_servers_initial;
243
244
245 __s32 distr_dir_servers_max;
246
247
248 __s32 distr_dir_split_size;
249
250 __u32 mirror_copies_count;
251
252
253 char *dist_name;
254
255
256 char *dist_params;
257
258 __s64 dirent_count;
259 enum orangefs_ds_type objtype;
260 __u64 flags;
261 __u32 mask;
262 __s64 blksize;
263 };
264
265 #define ORANGEFS_LOOKUP_LINK_NO_FOLLOW 0
266
267
268
269
270 struct dev_mask_info_s {
271 enum {
272 KERNEL_MASK,
273 CLIENT_MASK,
274 } mask_type;
275 __u64 mask_value;
276 };
277
278 struct dev_mask2_info_s {
279 __u64 mask1_value;
280 __u64 mask2_value;
281 };
282
283
284 __s32 ORANGEFS_util_translate_mode(int mode);
285
286
287 #include "orangefs-debug.h"
288
289
290 #define llu(x) (unsigned long long)(x)
291 #define lld(x) (long long)(x)
292
293
294 #define ORANGEFS_DEV_MAGIC 'k'
295
296 #define ORANGEFS_READDIR_DEFAULT_DESC_COUNT 5
297
298 #define DEV_GET_MAGIC 0x1
299 #define DEV_GET_MAX_UPSIZE 0x2
300 #define DEV_GET_MAX_DOWNSIZE 0x3
301 #define DEV_MAP 0x4
302 #define DEV_REMOUNT_ALL 0x5
303 #define DEV_DEBUG 0x6
304 #define DEV_UPSTREAM 0x7
305 #define DEV_CLIENT_MASK 0x8
306 #define DEV_CLIENT_STRING 0x9
307 #define DEV_MAX_NR 0xa
308
309
310 enum {
311 ORANGEFS_DEV_GET_MAGIC = _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAGIC, __s32),
312 ORANGEFS_DEV_GET_MAX_UPSIZE =
313 _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32),
314 ORANGEFS_DEV_GET_MAX_DOWNSIZE =
315 _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32),
316 ORANGEFS_DEV_MAP = _IO(ORANGEFS_DEV_MAGIC, DEV_MAP),
317 ORANGEFS_DEV_REMOUNT_ALL = _IO(ORANGEFS_DEV_MAGIC, DEV_REMOUNT_ALL),
318 ORANGEFS_DEV_DEBUG = _IOR(ORANGEFS_DEV_MAGIC, DEV_DEBUG, __s32),
319 ORANGEFS_DEV_UPSTREAM = _IOW(ORANGEFS_DEV_MAGIC, DEV_UPSTREAM, int),
320 ORANGEFS_DEV_CLIENT_MASK = _IOW(ORANGEFS_DEV_MAGIC,
321 DEV_CLIENT_MASK,
322 struct dev_mask2_info_s),
323 ORANGEFS_DEV_CLIENT_STRING = _IOW(ORANGEFS_DEV_MAGIC,
324 DEV_CLIENT_STRING,
325 char *),
326 ORANGEFS_DEV_MAXNR = DEV_MAX_NR,
327 };
328
329
330
331
332
333 #define ORANGEFS_KERNEL_PROTO_VERSION 0
334 #define ORANGEFS_MINIMUM_USERSPACE_VERSION 20903
335
336
337
338
339
340
341
342
343
344 struct ORANGEFS_dev_map_desc {
345 void __user *ptr;
346 __s32 total_size;
347 __s32 size;
348 __s32 count;
349 };
350
351
352
353 extern __u64 orangefs_gossip_debug_mask;
354
355
356 #define gossip_debug(mask, fmt, ...) \
357 do { \
358 if (orangefs_gossip_debug_mask & (mask)) \
359 printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
360 } while (0)
361
362 #define gossip_err pr_err