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