ca7cef9590d3fde6ae6b61dfedc9447fb7c4fad7
[deliverable/linux.git] / fs / orangefs / protocol.h
1 #include <linux/spinlock_types.h>
2 #include <linux/types.h>
3 #include <linux/slab.h>
4 #include <linux/ioctl.h>
5
6 extern struct client_debug_mask *cdm_array;
7 extern char *debug_help_string;
8 extern int help_string_initialized;
9 extern struct dentry *debug_dir;
10 extern struct dentry *help_file_dentry;
11 extern struct dentry *client_debug_dentry;
12 extern const struct file_operations debug_help_fops;
13 extern int client_all_index;
14 extern int client_verbose_index;
15 extern int cdm_element_count;
16 #define DEBUG_HELP_STRING_SIZE 4096
17 #define HELP_STRING_UNINITIALIZED \
18 "Client Debug Keywords are unknown until the first time\n" \
19 "the client is started after boot.\n"
20 #define ORANGEFS_KMOD_DEBUG_HELP_FILE "debug-help"
21 #define ORANGEFS_KMOD_DEBUG_FILE "kernel-debug"
22 #define ORANGEFS_CLIENT_DEBUG_FILE "client-debug"
23 #define PVFS2_VERBOSE "verbose"
24 #define PVFS2_ALL "all"
25
26 /* pvfs2-config.h ***********************************************************/
27 #define PVFS2_VERSION_MAJOR 2
28 #define PVFS2_VERSION_MINOR 9
29 #define PVFS2_VERSION_SUB 0
30
31 /* khandle stuff ***********************************************************/
32
33 /*
34 * The 2.9 core will put 64 bit handles in here like this:
35 * 1234 0000 0000 5678
36 * The 3.0 and beyond cores will put 128 bit handles in here like this:
37 * 1234 5678 90AB CDEF
38 * The kernel module will always use the first four bytes and
39 * the last four bytes as an inum.
40 */
41 struct pvfs2_khandle {
42 unsigned char u[16];
43 } __aligned(8);
44
45 /*
46 * kernel version of an object ref.
47 */
48 struct pvfs2_object_kref {
49 struct pvfs2_khandle khandle;
50 __s32 fs_id;
51 __s32 __pad1;
52 };
53
54 /*
55 * compare 2 khandles assumes little endian thus from large address to
56 * small address
57 */
58 static inline int PVFS_khandle_cmp(const struct pvfs2_khandle *kh1,
59 const struct pvfs2_khandle *kh2)
60 {
61 int i;
62
63 for (i = 15; i >= 0; i--) {
64 if (kh1->u[i] > kh2->u[i])
65 return 1;
66 if (kh1->u[i] < kh2->u[i])
67 return -1;
68 }
69
70 return 0;
71 }
72
73 /* copy a khandle to a field of arbitrary size */
74 static inline void PVFS_khandle_to(const struct pvfs2_khandle *kh,
75 void *p, int size)
76 {
77 int i;
78 unsigned char *c = p;
79
80 memset(p, 0, size);
81
82 for (i = 0; i < 16 && i < size; i++)
83 c[i] = kh->u[i];
84 }
85
86 /* copy a khandle from a field of arbitrary size */
87 static inline void PVFS_khandle_from(struct pvfs2_khandle *kh,
88 void *p, int size)
89 {
90 int i;
91 unsigned char *c = p;
92
93 memset(kh, 0, 16);
94
95 for (i = 0; i < 16 && i < size; i++)
96 kh->u[i] = c[i];
97 }
98
99 /* pvfs2-types.h ************************************************************/
100 typedef __u32 PVFS_uid;
101 typedef __u32 PVFS_gid;
102 typedef __s32 PVFS_fs_id;
103 typedef __u32 PVFS_permissions;
104 typedef __u64 PVFS_time;
105 typedef __s64 PVFS_size;
106 typedef __u64 PVFS_flags;
107 typedef __u64 PVFS_ds_position;
108 typedef __s32 PVFS_error;
109 typedef __s64 PVFS_offset;
110
111 #define PVFS2_SUPER_MAGIC 0x20030528
112 #define PVFS_ERROR_BIT (1 << 30)
113 #define PVFS_NON_ERRNO_ERROR_BIT (1 << 29)
114 #define IS_PVFS_ERROR(__error) ((__error)&(PVFS_ERROR_BIT))
115 #define IS_PVFS_NON_ERRNO_ERROR(__error) \
116 (((__error)&(PVFS_NON_ERRNO_ERROR_BIT)) && IS_PVFS_ERROR(__error))
117 #define PVFS_ERROR_TO_ERRNO(__error) PVFS_get_errno_mapping(__error)
118
119 /* 7 bits are used for the errno mapped error codes */
120 #define PVFS_ERROR_CODE(__error) \
121 ((__error) & (__s32)(0x7f|PVFS_ERROR_BIT))
122 #define PVFS_ERROR_CLASS(__error) \
123 ((__error) & ~((__s32)(0x7f|PVFS_ERROR_BIT|PVFS_NON_ERRNO_ERROR_BIT)))
124 #define PVFS_NON_ERRNO_ERROR_CODE(__error) \
125 ((__error) & (__s32)(127|PVFS_ERROR_BIT|PVFS_NON_ERRNO_ERROR_BIT))
126
127 /* PVFS2 error codes, compliments of asm/errno.h */
128 #define PVFS_EPERM E(1) /* Operation not permitted */
129 #define PVFS_ENOENT E(2) /* No such file or directory */
130 #define PVFS_EINTR E(3) /* Interrupted system call */
131 #define PVFS_EIO E(4) /* I/O error */
132 #define PVFS_ENXIO E(5) /* No such device or address */
133 #define PVFS_EBADF E(6) /* Bad file number */
134 #define PVFS_EAGAIN E(7) /* Try again */
135 #define PVFS_ENOMEM E(8) /* Out of memory */
136 #define PVFS_EFAULT E(9) /* Bad address */
137 #define PVFS_EBUSY E(10) /* Device or resource busy */
138 #define PVFS_EEXIST E(11) /* File exists */
139 #define PVFS_ENODEV E(12) /* No such device */
140 #define PVFS_ENOTDIR E(13) /* Not a directory */
141 #define PVFS_EISDIR E(14) /* Is a directory */
142 #define PVFS_EINVAL E(15) /* Invalid argument */
143 #define PVFS_EMFILE E(16) /* Too many open files */
144 #define PVFS_EFBIG E(17) /* File too large */
145 #define PVFS_ENOSPC E(18) /* No space left on device */
146 #define PVFS_EROFS E(19) /* Read-only file system */
147 #define PVFS_EMLINK E(20) /* Too many links */
148 #define PVFS_EPIPE E(21) /* Broken pipe */
149 #define PVFS_EDEADLK E(22) /* Resource deadlock would occur */
150 #define PVFS_ENAMETOOLONG E(23) /* File name too long */
151 #define PVFS_ENOLCK E(24) /* No record locks available */
152 #define PVFS_ENOSYS E(25) /* Function not implemented */
153 #define PVFS_ENOTEMPTY E(26) /* Directory not empty */
154 /*
155 #define PVFS_ELOOP E(27) * Too many symbolic links encountered
156 */
157 #define PVFS_EWOULDBLOCK E(28) /* Operation would block */
158 #define PVFS_ENOMSG E(29) /* No message of desired type */
159 #define PVFS_EUNATCH E(30) /* Protocol driver not attached */
160 #define PVFS_EBADR E(31) /* Invalid request descriptor */
161 #define PVFS_EDEADLOCK E(32)
162 #define PVFS_ENODATA E(33) /* No data available */
163 #define PVFS_ETIME E(34) /* Timer expired */
164 #define PVFS_ENONET E(35) /* Machine is not on the network */
165 #define PVFS_EREMOTE E(36) /* Object is remote */
166 #define PVFS_ECOMM E(37) /* Communication error on send */
167 #define PVFS_EPROTO E(38) /* Protocol error */
168 #define PVFS_EBADMSG E(39) /* Not a data message */
169 /*
170 #define PVFS_EOVERFLOW E(40) * Value too large for defined data
171 * type
172 */
173 /*
174 #define PVFS_ERESTART E(41) * Interrupted system call should be
175 * restarted
176 */
177 #define PVFS_EMSGSIZE E(42) /* Message too long */
178 #define PVFS_EPROTOTYPE E(43) /* Protocol wrong type for socket */
179 #define PVFS_ENOPROTOOPT E(44) /* Protocol not available */
180 #define PVFS_EPROTONOSUPPORT E(45) /* Protocol not supported */
181 /*
182 #define PVFS_EOPNOTSUPP E(46) * Operation not supported on transport
183 * endpoint
184 */
185 #define PVFS_EADDRINUSE E(47) /* Address already in use */
186 #define PVFS_EADDRNOTAVAIL E(48) /* Cannot assign requested address */
187 #define PVFS_ENETDOWN E(49) /* Network is down */
188 #define PVFS_ENETUNREACH E(50) /* Network is unreachable */
189 /*
190 #define PVFS_ENETRESET E(51) * Network dropped connection because
191 * of reset
192 */
193 #define PVFS_ENOBUFS E(52) /* No buffer space available */
194 #define PVFS_ETIMEDOUT E(53) /* Connection timed out */
195 #define PVFS_ECONNREFUSED E(54) /* Connection refused */
196 #define PVFS_EHOSTDOWN E(55) /* Host is down */
197 #define PVFS_EHOSTUNREACH E(56) /* No route to host */
198 #define PVFS_EALREADY E(57) /* Operation already in progress */
199 #define PVFS_EACCES E(58) /* Access not allowed */
200 #define PVFS_ECONNRESET E(59) /* Connection reset by peer */
201 #define PVFS_ERANGE E(60) /* Math out of range or buf too small */
202
203 /***************** non-errno/pvfs2 specific error codes *****************/
204 #define PVFS_ECANCEL (1|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
205 #define PVFS_EDEVINIT (2|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
206 #define PVFS_EDETAIL (3|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
207 #define PVFS_EHOSTNTFD (4|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
208 #define PVFS_EADDRNTFD (5|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
209 #define PVFS_ENORECVR (6|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
210 #define PVFS_ETRYAGAIN (7|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
211 #define PVFS_ENOTPVFS (8|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
212 #define PVFS_ESECURITY (9|(PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT))
213
214 /*
215 * NOTE: PLEASE DO NOT ARBITRARILY ADD NEW ERRNO ERROR CODES!
216 *
217 * IF YOU CHOOSE TO ADD A NEW ERROR CODE (DESPITE OUR PLEA), YOU ALSO
218 * NEED TO INCREMENT PVFS_ERRNO MAX (BELOW) AND ADD A MAPPING TO A
219 * UNIX ERRNO VALUE IN THE MACROS BELOW (USED IN
220 * src/common/misc/errno-mapping.c and the kernel module)
221 */
222 #define PVFS_ERRNO_MAX 61
223
224 #define PVFS_ERROR_BMI (1 << 7) /* BMI-specific error */
225 #define PVFS_ERROR_TROVE (2 << 7) /* Trove-specific error */
226 #define PVFS_ERROR_FLOW (3 << 7)
227 #define PVFS_ERROR_SM (4 << 7) /* state machine specific error */
228 #define PVFS_ERROR_SCHED (5 << 7)
229 #define PVFS_ERROR_CLIENT (6 << 7)
230 #define PVFS_ERROR_DEV (7 << 7) /* device file interaction */
231
232 #define PVFS_ERROR_CLASS_BITS \
233 (PVFS_ERROR_BMI | \
234 PVFS_ERROR_TROVE | \
235 PVFS_ERROR_FLOW | \
236 PVFS_ERROR_SM | \
237 PVFS_ERROR_SCHED | \
238 PVFS_ERROR_CLIENT | \
239 PVFS_ERROR_DEV)
240
241 #define DECLARE_ERRNO_MAPPING() \
242 __s32 PINT_errno_mapping[PVFS_ERRNO_MAX + 1] = { \
243 0, /* leave this one empty */ \
244 EPERM, /* 1 */ \
245 ENOENT, \
246 EINTR, \
247 EIO, \
248 ENXIO, \
249 EBADF, \
250 EAGAIN, \
251 ENOMEM, \
252 EFAULT, \
253 EBUSY, /* 10 */ \
254 EEXIST, \
255 ENODEV, \
256 ENOTDIR, \
257 EISDIR, \
258 EINVAL, \
259 EMFILE, \
260 EFBIG, \
261 ENOSPC, \
262 EROFS, \
263 EMLINK, /* 20 */ \
264 EPIPE, \
265 EDEADLK, \
266 ENAMETOOLONG, \
267 ENOLCK, \
268 ENOSYS, \
269 ENOTEMPTY, \
270 ELOOP, \
271 EWOULDBLOCK, \
272 ENOMSG, \
273 EUNATCH, /* 30 */ \
274 EBADR, \
275 EDEADLOCK, \
276 ENODATA, \
277 ETIME, \
278 ENONET, \
279 EREMOTE, \
280 ECOMM, \
281 EPROTO, \
282 EBADMSG, \
283 EOVERFLOW, /* 40 */ \
284 ERESTART, \
285 EMSGSIZE, \
286 EPROTOTYPE, \
287 ENOPROTOOPT, \
288 EPROTONOSUPPORT, \
289 EOPNOTSUPP, \
290 EADDRINUSE, \
291 EADDRNOTAVAIL, \
292 ENETDOWN, \
293 ENETUNREACH, /* 50 */ \
294 ENETRESET, \
295 ENOBUFS, \
296 ETIMEDOUT, \
297 ECONNREFUSED, \
298 EHOSTDOWN, \
299 EHOSTUNREACH, \
300 EALREADY, \
301 EACCES, \
302 ECONNRESET, /* 59 */ \
303 ERANGE, \
304 0 /* PVFS_ERRNO_MAX */ \
305 }; \
306 const char *PINT_non_errno_strerror_mapping[] = { \
307 "Success", /* 0 */ \
308 "Operation cancelled (possibly due to timeout)", \
309 "Device initialization failed", \
310 "Detailed per-server errors are available", \
311 "Unknown host", \
312 "No address associated with name", \
313 "Unknown server error", \
314 "Host name lookup failure", \
315 "Path contains non-PVFS elements", \
316 "Security error", \
317 }; \
318 __s32 PINT_non_errno_mapping[] = { \
319 0, /* leave this one empty */ \
320 PVFS_ECANCEL, /* 1 */ \
321 PVFS_EDEVINIT, /* 2 */ \
322 PVFS_EDETAIL, /* 3 */ \
323 PVFS_EHOSTNTFD, /* 4 */ \
324 PVFS_EADDRNTFD, /* 5 */ \
325 PVFS_ENORECVR, /* 6 */ \
326 PVFS_ETRYAGAIN, /* 7 */ \
327 PVFS_ENOTPVFS, /* 8 */ \
328 PVFS_ESECURITY, /* 9 */ \
329 }
330
331 /*
332 * NOTE: PVFS_get_errno_mapping will convert a PVFS_ERROR_CODE to an
333 * errno value. If the error code is a pvfs2 specific error code
334 * (i.e. a PVFS_NON_ERRNO_ERROR_CODE), PVFS_get_errno_mapping will
335 * return an index into the PINT_non_errno_strerror_mapping array which
336 * can be used for getting the pvfs2 specific strerror message given
337 * the error code. if the value is not a recognized error code, the
338 * passed in value will be returned unchanged.
339 */
340 #define DECLARE_ERRNO_MAPPING_AND_FN() \
341 extern __s32 PINT_errno_mapping[]; \
342 extern __s32 PINT_non_errno_mapping[]; \
343 extern const char *PINT_non_errno_strerror_mapping[]; \
344 static __s32 PVFS_get_errno_mapping(__s32 error) \
345 { \
346 __s32 ret = error, mask = 0; \
347 __s32 positive = ((error > -1) ? 1 : 0); \
348 if (IS_PVFS_NON_ERRNO_ERROR((positive ? error : -error))) { \
349 mask = (PVFS_NON_ERRNO_ERROR_BIT | \
350 PVFS_ERROR_BIT | \
351 PVFS_ERROR_CLASS_BITS); \
352 ret = PVFS_NON_ERRNO_ERROR_CODE(((positive ? \
353 error : \
354 abs(error))) & \
355 ~mask); \
356 } \
357 else if (IS_PVFS_ERROR((positive ? error : -error))) { \
358 mask = (PVFS_ERROR_BIT | \
359 PVFS_ERROR_CLASS_BITS); \
360 ret = PINT_errno_mapping[PVFS_ERROR_CODE(((positive ? \
361 error : \
362 abs(error))) & \
363 ~mask)]; \
364 } \
365 return ret; \
366 } \
367 DECLARE_ERRNO_MAPPING()
368
369 /* permission bits */
370 #define PVFS_O_EXECUTE (1 << 0)
371 #define PVFS_O_WRITE (1 << 1)
372 #define PVFS_O_READ (1 << 2)
373 #define PVFS_G_EXECUTE (1 << 3)
374 #define PVFS_G_WRITE (1 << 4)
375 #define PVFS_G_READ (1 << 5)
376 #define PVFS_U_EXECUTE (1 << 6)
377 #define PVFS_U_WRITE (1 << 7)
378 #define PVFS_U_READ (1 << 8)
379 /* no PVFS_U_VTX (sticky bit) */
380 #define PVFS_G_SGID (1 << 10)
381 #define PVFS_U_SUID (1 << 11)
382
383 /* definition taken from stdint.h */
384 #define INT32_MAX (2147483647)
385 #define PVFS_ITERATE_START (INT32_MAX - 1)
386 #define PVFS_ITERATE_END (INT32_MAX - 2)
387 #define PVFS_READDIR_START PVFS_ITERATE_START
388 #define PVFS_READDIR_END PVFS_ITERATE_END
389 #define PVFS_IMMUTABLE_FL FS_IMMUTABLE_FL
390 #define PVFS_APPEND_FL FS_APPEND_FL
391 #define PVFS_NOATIME_FL FS_NOATIME_FL
392 #define PVFS_MIRROR_FL 0x01000000ULL
393 #define PVFS_O_EXECUTE (1 << 0)
394 #define PVFS_FS_ID_NULL ((__s32)0)
395 #define PVFS_ATTR_SYS_UID (1 << 0)
396 #define PVFS_ATTR_SYS_GID (1 << 1)
397 #define PVFS_ATTR_SYS_PERM (1 << 2)
398 #define PVFS_ATTR_SYS_ATIME (1 << 3)
399 #define PVFS_ATTR_SYS_CTIME (1 << 4)
400 #define PVFS_ATTR_SYS_MTIME (1 << 5)
401 #define PVFS_ATTR_SYS_TYPE (1 << 6)
402 #define PVFS_ATTR_SYS_ATIME_SET (1 << 7)
403 #define PVFS_ATTR_SYS_MTIME_SET (1 << 8)
404 #define PVFS_ATTR_SYS_SIZE (1 << 20)
405 #define PVFS_ATTR_SYS_LNK_TARGET (1 << 24)
406 #define PVFS_ATTR_SYS_DFILE_COUNT (1 << 25)
407 #define PVFS_ATTR_SYS_DIRENT_COUNT (1 << 26)
408 #define PVFS_ATTR_SYS_BLKSIZE (1 << 28)
409 #define PVFS_ATTR_SYS_MIRROR_COPIES_COUNT (1 << 29)
410 #define PVFS_ATTR_SYS_COMMON_ALL \
411 (PVFS_ATTR_SYS_UID | \
412 PVFS_ATTR_SYS_GID | \
413 PVFS_ATTR_SYS_PERM | \
414 PVFS_ATTR_SYS_ATIME | \
415 PVFS_ATTR_SYS_CTIME | \
416 PVFS_ATTR_SYS_MTIME | \
417 PVFS_ATTR_SYS_TYPE)
418
419 #define PVFS_ATTR_SYS_ALL_SETABLE \
420 (PVFS_ATTR_SYS_COMMON_ALL-PVFS_ATTR_SYS_TYPE)
421
422 #define PVFS_ATTR_SYS_ALL_NOHINT \
423 (PVFS_ATTR_SYS_COMMON_ALL | \
424 PVFS_ATTR_SYS_SIZE | \
425 PVFS_ATTR_SYS_LNK_TARGET | \
426 PVFS_ATTR_SYS_DFILE_COUNT | \
427 PVFS_ATTR_SYS_MIRROR_COPIES_COUNT | \
428 PVFS_ATTR_SYS_DIRENT_COUNT | \
429 PVFS_ATTR_SYS_BLKSIZE)
430 #define PVFS_XATTR_REPLACE 0x2
431 #define PVFS_XATTR_CREATE 0x1
432 #define PVFS_MAX_SERVER_ADDR_LEN 256
433 #define PVFS_NAME_MAX 256
434 /*
435 * max extended attribute name len as imposed by the VFS and exploited for the
436 * upcall request types.
437 * NOTE: Please retain them as multiples of 8 even if you wish to change them
438 * This is *NECESSARY* for supporting 32 bit user-space binaries on a 64-bit
439 * kernel. Due to implementation within DBPF, this really needs to be
440 * PVFS_NAME_MAX, which it was the same value as, but no reason to let it
441 * break if that changes in the future.
442 */
443 #define PVFS_MAX_XATTR_NAMELEN PVFS_NAME_MAX /* Not the same as
444 * XATTR_NAME_MAX defined
445 * by <linux/xattr.h>
446 */
447 #define PVFS_MAX_XATTR_VALUELEN 8192 /* Not the same as XATTR_SIZE_MAX
448 * defined by <linux/xattr.h>
449 */
450 #define PVFS_MAX_XATTR_LISTLEN 16 /* Not the same as XATTR_LIST_MAX
451 * defined by <linux/xattr.h>
452 */
453 /*
454 * PVFS I/O operation types, used in both system and server interfaces.
455 */
456 enum PVFS_io_type {
457 PVFS_IO_READ = 1,
458 PVFS_IO_WRITE = 2
459 };
460
461 /*
462 * If this enum is modified the server parameters related to the precreate pool
463 * batch and low threshold sizes may need to be modified to reflect this
464 * change.
465 */
466 enum pvfs2_ds_type {
467 PVFS_TYPE_NONE = 0,
468 PVFS_TYPE_METAFILE = (1 << 0),
469 PVFS_TYPE_DATAFILE = (1 << 1),
470 PVFS_TYPE_DIRECTORY = (1 << 2),
471 PVFS_TYPE_SYMLINK = (1 << 3),
472 PVFS_TYPE_DIRDATA = (1 << 4),
473 PVFS_TYPE_INTERNAL = (1 << 5) /* for the server's private use */
474 };
475
476 /*
477 * PVFS_certificate simply stores a buffer with the buffer size.
478 * The buffer can be converted to an OpenSSL X509 struct for use.
479 */
480 struct PVFS_certificate {
481 __u32 buf_size;
482 unsigned char *buf;
483 };
484
485 /*
486 * A credential identifies a user and is signed by the client/user
487 * private key.
488 */
489 struct PVFS_credential {
490 __u32 userid; /* user id */
491 __u32 num_groups; /* length of group_array */
492 __u32 *group_array; /* groups for which the user is a member */
493 char *issuer; /* alias of the issuing server */
494 __u64 timeout; /* seconds after epoch to time out */
495 __u32 sig_size; /* length of the signature in bytes */
496 unsigned char *signature; /* digital signature */
497 struct PVFS_certificate certificate; /* user certificate buffer */
498 };
499 #define extra_size_PVFS_credential (PVFS_REQ_LIMIT_GROUPS * \
500 sizeof(__u32) + \
501 PVFS_REQ_LIMIT_ISSUER + \
502 PVFS_REQ_LIMIT_SIGNATURE + \
503 extra_size_PVFS_certificate)
504
505 /* This structure is used by the VFS-client interaction alone */
506 struct PVFS_keyval_pair {
507 char key[PVFS_MAX_XATTR_NAMELEN];
508 __s32 key_sz; /* __s32 for portable, fixed-size structures */
509 __s32 val_sz;
510 char val[PVFS_MAX_XATTR_VALUELEN];
511 };
512
513 /* pvfs2-sysint.h ***********************************************************/
514 /* Describes attributes for a file, directory, or symlink. */
515 struct PVFS_sys_attr_s {
516 __u32 owner;
517 __u32 group;
518 __u32 perms;
519 __u64 atime;
520 __u64 mtime;
521 __u64 ctime;
522 __s64 size;
523
524 /* NOTE: caller must free if valid */
525 char *link_target;
526
527 /* Changed to __s32 so that size of structure does not change */
528 __s32 dfile_count;
529
530 /* Changed to __s32 so that size of structure does not change */
531 __s32 distr_dir_servers_initial;
532
533 /* Changed to __s32 so that size of structure does not change */
534 __s32 distr_dir_servers_max;
535
536 /* Changed to __s32 so that size of structure does not change */
537 __s32 distr_dir_split_size;
538
539 __u32 mirror_copies_count;
540
541 /* NOTE: caller must free if valid */
542 char *dist_name;
543
544 /* NOTE: caller must free if valid */
545 char *dist_params;
546
547 __s64 dirent_count;
548 enum pvfs2_ds_type objtype;
549 __u64 flags;
550 __u32 mask;
551 __s64 blksize;
552 };
553
554 #define PVFS2_LOOKUP_LINK_NO_FOLLOW 0
555 #define PVFS2_LOOKUP_LINK_FOLLOW 1
556
557 /* pint-dev.h ***************************************************************/
558
559 /* parameter structure used in PVFS_DEV_DEBUG ioctl command */
560 struct dev_mask_info_s {
561 enum {
562 KERNEL_MASK,
563 CLIENT_MASK,
564 } mask_type;
565 __u64 mask_value;
566 };
567
568 struct dev_mask2_info_s {
569 __u64 mask1_value;
570 __u64 mask2_value;
571 };
572
573 /* pvfs2-util.h *************************************************************/
574 #define PVFS_util_min(x1, x2) (((x1) > (x2)) ? (x2) : (x1))
575 __s32 PVFS_util_translate_mode(int mode);
576
577 /* pvfs2-debug.h ************************************************************/
578 #include "pvfs2-debug.h"
579
580 /* pvfs2-internal.h *********************************************************/
581 #define llu(x) (unsigned long long)(x)
582 #define lld(x) (long long)(x)
583
584 /* pint-dev-shared.h ********************************************************/
585 #define PVFS_DEV_MAGIC 'k'
586
587 #define PVFS2_READDIR_DEFAULT_DESC_COUNT 5
588
589 #define DEV_GET_MAGIC 0x1
590 #define DEV_GET_MAX_UPSIZE 0x2
591 #define DEV_GET_MAX_DOWNSIZE 0x3
592 #define DEV_MAP 0x4
593 #define DEV_REMOUNT_ALL 0x5
594 #define DEV_DEBUG 0x6
595 #define DEV_UPSTREAM 0x7
596 #define DEV_CLIENT_MASK 0x8
597 #define DEV_CLIENT_STRING 0x9
598 #define DEV_MAX_NR 0xa
599
600 /* supported ioctls, codes are with respect to user-space */
601 enum {
602 PVFS_DEV_GET_MAGIC = _IOW(PVFS_DEV_MAGIC, DEV_GET_MAGIC, __s32),
603 PVFS_DEV_GET_MAX_UPSIZE =
604 _IOW(PVFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32),
605 PVFS_DEV_GET_MAX_DOWNSIZE =
606 _IOW(PVFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32),
607 PVFS_DEV_MAP = _IO(PVFS_DEV_MAGIC, DEV_MAP),
608 PVFS_DEV_REMOUNT_ALL = _IO(PVFS_DEV_MAGIC, DEV_REMOUNT_ALL),
609 PVFS_DEV_DEBUG = _IOR(PVFS_DEV_MAGIC, DEV_DEBUG, __s32),
610 PVFS_DEV_UPSTREAM = _IOW(PVFS_DEV_MAGIC, DEV_UPSTREAM, int),
611 PVFS_DEV_CLIENT_MASK = _IOW(PVFS_DEV_MAGIC,
612 DEV_CLIENT_MASK,
613 struct dev_mask2_info_s),
614 PVFS_DEV_CLIENT_STRING = _IOW(PVFS_DEV_MAGIC,
615 DEV_CLIENT_STRING,
616 char *),
617 PVFS_DEV_MAXNR = DEV_MAX_NR,
618 };
619
620 /*
621 * version number for use in communicating between kernel space and user
622 * space
623 */
624 /*
625 #define PVFS_KERNEL_PROTO_VERSION \
626 ((PVFS2_VERSION_MAJOR * 10000) + \
627 (PVFS2_VERSION_MINOR * 100) + \
628 PVFS2_VERSION_SUB)
629 */
630 #define PVFS_KERNEL_PROTO_VERSION 0
631
632 /*
633 * describes memory regions to map in the PVFS_DEV_MAP ioctl.
634 * NOTE: See devpvfs2-req.c for 32 bit compat structure.
635 * Since this structure has a variable-sized layout that is different
636 * on 32 and 64 bit platforms, we need to normalize to a 64 bit layout
637 * on such systems before servicing ioctl calls from user-space binaries
638 * that may be 32 bit!
639 */
640 struct PVFS_dev_map_desc {
641 void *ptr;
642 __s32 total_size;
643 __s32 size;
644 __s32 count;
645 };
646
647 /* gossip.h *****************************************************************/
648
649 #ifdef GOSSIP_DISABLE_DEBUG
650 #define gossip_debug(mask, format, f...) do {} while (0)
651 #else
652 extern __u64 gossip_debug_mask;
653 extern struct client_debug_mask client_debug_mask;
654
655 /* try to avoid function call overhead by checking masks in macro */
656 #define gossip_debug(mask, format, f...) \
657 do { \
658 if (gossip_debug_mask & mask) \
659 printk(format, ##f); \
660 } while (0)
661 #endif /* GOSSIP_DISABLE_DEBUG */
662
663 /* do file and line number printouts w/ the GNU preprocessor */
664 #define gossip_ldebug(mask, format, f...) \
665 gossip_debug(mask, "%s: " format, __func__, ##f)
666
667 #define gossip_err printk
668 #define gossip_lerr(format, f...) \
669 gossip_err("%s line %d: " format, \
670 __FILE__, \
671 __LINE__, \
672 ##f)
This page took 0.04327 seconds and 4 git commands to generate.