2 * (C) 2001 Clemson University and The University of Chicago
4 * See COPYING in top-level directory.
7 #ifndef _PVFS2_DEV_PROTO_H
8 #define _PVFS2_DEV_PROTO_H
11 * types and constants shared between user space and kernel space for
12 * device interaction using a common protocol
16 * valid pvfs2 kernel operation types
18 #define PVFS2_VFS_OP_INVALID 0xFF000000
19 #define PVFS2_VFS_OP_FILE_IO 0xFF000001
20 #define PVFS2_VFS_OP_LOOKUP 0xFF000002
21 #define PVFS2_VFS_OP_CREATE 0xFF000003
22 #define PVFS2_VFS_OP_GETATTR 0xFF000004
23 #define PVFS2_VFS_OP_REMOVE 0xFF000005
24 #define PVFS2_VFS_OP_MKDIR 0xFF000006
25 #define PVFS2_VFS_OP_READDIR 0xFF000007
26 #define PVFS2_VFS_OP_SETATTR 0xFF000008
27 #define PVFS2_VFS_OP_SYMLINK 0xFF000009
28 #define PVFS2_VFS_OP_RENAME 0xFF00000A
29 #define PVFS2_VFS_OP_STATFS 0xFF00000B
30 #define PVFS2_VFS_OP_TRUNCATE 0xFF00000C
31 #define PVFS2_VFS_OP_MMAP_RA_FLUSH 0xFF00000D
32 #define PVFS2_VFS_OP_FS_MOUNT 0xFF00000E
33 #define PVFS2_VFS_OP_FS_UMOUNT 0xFF00000F
34 #define PVFS2_VFS_OP_GETXATTR 0xFF000010
35 #define PVFS2_VFS_OP_SETXATTR 0xFF000011
36 #define PVFS2_VFS_OP_LISTXATTR 0xFF000012
37 #define PVFS2_VFS_OP_REMOVEXATTR 0xFF000013
38 #define PVFS2_VFS_OP_PARAM 0xFF000014
39 #define PVFS2_VFS_OP_PERF_COUNT 0xFF000015
40 #define PVFS2_VFS_OP_CANCEL 0xFF00EE00
41 #define PVFS2_VFS_OP_FSYNC 0xFF00EE01
42 #define PVFS2_VFS_OP_FSKEY 0xFF00EE02
43 #define PVFS2_VFS_OP_READDIRPLUS 0xFF00EE03
44 #define PVFS2_VFS_OP_FILE_IOX 0xFF00EE04
47 * Misc constants. Please retain them as multiples of 8!
48 * Otherwise 32-64 bit interactions will be messed up :)
50 #define PVFS2_NAME_LEN 0x00000100
51 #define PVFS2_MAX_DEBUG_STRING_LEN 0x00000400
52 #define PVFS2_MAX_DEBUG_ARRAY_LEN 0x00000800
55 * MAX_DIRENT_COUNT cannot be larger than PVFS_REQ_LIMIT_LISTATTR.
56 * The value of PVFS_REQ_LIMIT_LISTATTR has been changed from 113 to 60
57 * to accomodate an attribute object with mirrored handles.
58 * MAX_DIRENT_COUNT is replaced by MAX_DIRENT_COUNT_READDIR and
59 * MAX_DIRENT_COUNT_READDIRPLUS, since readdir doesn't trigger a listattr
60 * but readdirplus might.
62 #define MAX_DIRENT_COUNT_READDIR 0x00000060
63 #define MAX_DIRENT_COUNT_READDIRPLUS 0x0000003C
69 * These macros differ from proto macros in that they don't do any
70 * byte-swappings and are used to ensure that kernel-clientcore interactions
71 * don't cause any unaligned accesses etc on 64 bit machines
74 #define roundup4(x) (((x)+3) & ~3)
78 #define roundup8(x) (((x)+7) & ~7)
81 /* strings; decoding just points into existing character data */
82 #define enc_string(pptr, pbuf) do { \
83 __u32 len = strlen(*pbuf); \
84 *(__u32 *) *(pptr) = (len); \
85 memcpy(*(pptr)+4, *pbuf, len+1); \
86 *(pptr) += roundup8(4 + len + 1); \
89 #define dec_string(pptr, pbuf, plen) do { \
90 __u32 len = (*(__u32 *) *(pptr)); \
91 *pbuf = *(pptr) + 4; \
92 *(pptr) += roundup8(4 + len + 1); \