1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21917a693SJoe Perches #include <linux/kernel.h>
3f7ab093fSMike Marshall #include <linux/types.h>
481b784b1SGuenter Roeck #include <linux/spinlock_types.h>
5f7ab093fSMike Marshall #include <linux/slab.h>
62c590d5fSMike Marshall #include <linux/ioctl.h>
7f7ab093fSMike Marshall
8f7ab093fSMike Marshall /* khandle stuff ***********************************************************/
9f7ab093fSMike Marshall
10f7ab093fSMike Marshall /*
11f7ab093fSMike Marshall * The 2.9 core will put 64 bit handles in here like this:
12f7ab093fSMike Marshall * 1234 0000 0000 5678
13f7ab093fSMike Marshall * The 3.0 and beyond cores will put 128 bit handles in here like this:
14f7ab093fSMike Marshall * 1234 5678 90AB CDEF
15f7ab093fSMike Marshall * The kernel module will always use the first four bytes and
16f7ab093fSMike Marshall * the last four bytes as an inum.
17f7ab093fSMike Marshall */
188bb8aefdSYi Liu struct orangefs_khandle {
19f7ab093fSMike Marshall unsigned char u[16];
20f7ab093fSMike Marshall } __aligned(8);
21f7ab093fSMike Marshall
22f7ab093fSMike Marshall /*
23f7ab093fSMike Marshall * kernel version of an object ref.
24f7ab093fSMike Marshall */
258bb8aefdSYi Liu struct orangefs_object_kref {
268bb8aefdSYi Liu struct orangefs_khandle khandle;
27f7ab093fSMike Marshall __s32 fs_id;
28f7ab093fSMike Marshall __s32 __pad1;
29f7ab093fSMike Marshall };
30f7ab093fSMike Marshall
31f7ab093fSMike Marshall /*
32f7ab093fSMike Marshall * compare 2 khandles assumes little endian thus from large address to
33f7ab093fSMike Marshall * small address
34f7ab093fSMike Marshall */
ORANGEFS_khandle_cmp(const struct orangefs_khandle * kh1,const struct orangefs_khandle * kh2)358bb8aefdSYi Liu static inline int ORANGEFS_khandle_cmp(const struct orangefs_khandle *kh1,
368bb8aefdSYi Liu const struct orangefs_khandle *kh2)
37f7ab093fSMike Marshall {
38f7ab093fSMike Marshall int i;
39f7ab093fSMike Marshall
40f7ab093fSMike Marshall for (i = 15; i >= 0; i--) {
41f7ab093fSMike Marshall if (kh1->u[i] > kh2->u[i])
42f7ab093fSMike Marshall return 1;
43f7ab093fSMike Marshall if (kh1->u[i] < kh2->u[i])
44f7ab093fSMike Marshall return -1;
45f7ab093fSMike Marshall }
46f7ab093fSMike Marshall
47f7ab093fSMike Marshall return 0;
48f7ab093fSMike Marshall }
49f7ab093fSMike Marshall
ORANGEFS_khandle_to(const struct orangefs_khandle * kh,void * p,int size)508bb8aefdSYi Liu static inline void ORANGEFS_khandle_to(const struct orangefs_khandle *kh,
51f7ab093fSMike Marshall void *p, int size)
52f7ab093fSMike Marshall {
53f7ab093fSMike Marshall
5450e01586SMike Marshall memcpy(p, kh->u, 16);
55a9bb3ba8SMike Marshall memset(p + 16, 0, size - 16);
56f7ab093fSMike Marshall
57f7ab093fSMike Marshall }
58f7ab093fSMike Marshall
ORANGEFS_khandle_from(struct orangefs_khandle * kh,void * p,int size)598bb8aefdSYi Liu static inline void ORANGEFS_khandle_from(struct orangefs_khandle *kh,
60f7ab093fSMike Marshall void *p, int size)
61f7ab093fSMike Marshall {
62f7ab093fSMike Marshall memset(kh, 0, 16);
6350e01586SMike Marshall memcpy(kh->u, p, 16);
64f7ab093fSMike Marshall
65f7ab093fSMike Marshall }
66f7ab093fSMike Marshall
67f7ab093fSMike Marshall /* pvfs2-types.h ************************************************************/
68f7ab093fSMike Marshall
698bb8aefdSYi Liu #define ORANGEFS_SUPER_MAGIC 0x20030528
70894ac432SMartin Brandenburg
7154804949SMike Marshall /*
728bb8aefdSYi Liu * ORANGEFS error codes are a signed 32-bit integer. Error codes are negative, but
7354804949SMike Marshall * the sign is stripped before decoding.
7454804949SMike Marshall */
75894ac432SMartin Brandenburg
76894ac432SMartin Brandenburg /* Bit 31 is not used since it is the sign. */
77894ac432SMartin Brandenburg
7854804949SMike Marshall /*
798bb8aefdSYi Liu * Bit 30 specifies that this is a ORANGEFS error. A ORANGEFS error is either an
808bb8aefdSYi Liu * encoded errno value or a ORANGEFS protocol error.
8154804949SMike Marshall */
828bb8aefdSYi Liu #define ORANGEFS_ERROR_BIT (1 << 30)
83894ac432SMartin Brandenburg
8454804949SMike Marshall /*
858bb8aefdSYi Liu * Bit 29 specifies that this is a ORANGEFS protocol error and not an encoded
8654804949SMike Marshall * errno value.
8754804949SMike Marshall */
888bb8aefdSYi Liu #define ORANGEFS_NON_ERRNO_ERROR_BIT (1 << 29)
89f7ab093fSMike Marshall
9054804949SMike Marshall /*
9154804949SMike Marshall * Bits 9, 8, and 7 specify the error class, which encodes the section of
92894ac432SMartin Brandenburg * server code the error originated in for logging purposes. It is not used
9354804949SMike Marshall * in the kernel except to be masked out.
9454804949SMike Marshall */
958bb8aefdSYi Liu #define ORANGEFS_ERROR_CLASS_BITS 0x380
96f7ab093fSMike Marshall
97894ac432SMartin Brandenburg /* Bits 6 - 0 are reserved for the actual error code. */
988bb8aefdSYi Liu #define ORANGEFS_ERROR_NUMBER_BITS 0x7f
99f7ab093fSMike Marshall
100575e9461SMike Marshall /* Encoded errno values decoded by PINT_errno_mapping in orangefs-utils.c. */
101f7ab093fSMike Marshall
1028bb8aefdSYi Liu /* Our own ORANGEFS protocol error codes. */
1038bb8aefdSYi Liu #define ORANGEFS_ECANCEL (1|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
1048bb8aefdSYi Liu #define ORANGEFS_EDEVINIT (2|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
1058bb8aefdSYi Liu #define ORANGEFS_EDETAIL (3|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
1068bb8aefdSYi Liu #define ORANGEFS_EHOSTNTFD (4|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
1078bb8aefdSYi Liu #define ORANGEFS_EADDRNTFD (5|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
1088bb8aefdSYi Liu #define ORANGEFS_ENORECVR (6|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
1098bb8aefdSYi Liu #define ORANGEFS_ETRYAGAIN (7|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
1108bb8aefdSYi Liu #define ORANGEFS_ENOTPVFS (8|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
1118bb8aefdSYi Liu #define ORANGEFS_ESECURITY (9|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
112f7ab093fSMike Marshall
113f7ab093fSMike Marshall /* permission bits */
1148bb8aefdSYi Liu #define ORANGEFS_O_EXECUTE (1 << 0)
1158bb8aefdSYi Liu #define ORANGEFS_O_WRITE (1 << 1)
1168bb8aefdSYi Liu #define ORANGEFS_O_READ (1 << 2)
1178bb8aefdSYi Liu #define ORANGEFS_G_EXECUTE (1 << 3)
1188bb8aefdSYi Liu #define ORANGEFS_G_WRITE (1 << 4)
1198bb8aefdSYi Liu #define ORANGEFS_G_READ (1 << 5)
1208bb8aefdSYi Liu #define ORANGEFS_U_EXECUTE (1 << 6)
1218bb8aefdSYi Liu #define ORANGEFS_U_WRITE (1 << 7)
1228bb8aefdSYi Liu #define ORANGEFS_U_READ (1 << 8)
1238bb8aefdSYi Liu /* no ORANGEFS_U_VTX (sticky bit) */
1248bb8aefdSYi Liu #define ORANGEFS_G_SGID (1 << 10)
1258bb8aefdSYi Liu #define ORANGEFS_U_SUID (1 << 11)
126f7ab093fSMike Marshall
1277b796ae3SMartin Brandenburg #define ORANGEFS_ITERATE_START 2147483646
1287b796ae3SMartin Brandenburg #define ORANGEFS_ITERATE_END 2147483645
1298bb8aefdSYi Liu #define ORANGEFS_IMMUTABLE_FL FS_IMMUTABLE_FL
1308bb8aefdSYi Liu #define ORANGEFS_APPEND_FL FS_APPEND_FL
1318bb8aefdSYi Liu #define ORANGEFS_NOATIME_FL FS_NOATIME_FL
1328bb8aefdSYi Liu #define ORANGEFS_MIRROR_FL 0x01000000ULL
1338bb8aefdSYi Liu #define ORANGEFS_FS_ID_NULL ((__s32)0)
1348bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_UID (1 << 0)
1358bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_GID (1 << 1)
1368bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_PERM (1 << 2)
1378bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_ATIME (1 << 3)
1388bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_CTIME (1 << 4)
1398bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_MTIME (1 << 5)
1408bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_TYPE (1 << 6)
1418bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_ATIME_SET (1 << 7)
1428bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_MTIME_SET (1 << 8)
1438bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_SIZE (1 << 20)
1448bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_LNK_TARGET (1 << 24)
1458bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_DFILE_COUNT (1 << 25)
1468bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_DIRENT_COUNT (1 << 26)
1478bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_BLKSIZE (1 << 28)
1488bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT (1 << 29)
1498bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_COMMON_ALL \
1508bb8aefdSYi Liu (ORANGEFS_ATTR_SYS_UID | \
1518bb8aefdSYi Liu ORANGEFS_ATTR_SYS_GID | \
1528bb8aefdSYi Liu ORANGEFS_ATTR_SYS_PERM | \
1538bb8aefdSYi Liu ORANGEFS_ATTR_SYS_ATIME | \
1548bb8aefdSYi Liu ORANGEFS_ATTR_SYS_CTIME | \
1558bb8aefdSYi Liu ORANGEFS_ATTR_SYS_MTIME | \
1568bb8aefdSYi Liu ORANGEFS_ATTR_SYS_TYPE)
157f7ab093fSMike Marshall
1588bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_ALL_SETABLE \
1598bb8aefdSYi Liu (ORANGEFS_ATTR_SYS_COMMON_ALL-ORANGEFS_ATTR_SYS_TYPE)
160f7ab093fSMike Marshall
1618bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_ALL_NOHINT \
1628bb8aefdSYi Liu (ORANGEFS_ATTR_SYS_COMMON_ALL | \
1638bb8aefdSYi Liu ORANGEFS_ATTR_SYS_SIZE | \
1648bb8aefdSYi Liu ORANGEFS_ATTR_SYS_LNK_TARGET | \
1658bb8aefdSYi Liu ORANGEFS_ATTR_SYS_DFILE_COUNT | \
1668bb8aefdSYi Liu ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT | \
1678bb8aefdSYi Liu ORANGEFS_ATTR_SYS_DIRENT_COUNT | \
1688bb8aefdSYi Liu ORANGEFS_ATTR_SYS_BLKSIZE)
169933287daSMartin Brandenburg
1708bb8aefdSYi Liu #define ORANGEFS_XATTR_REPLACE 0x2
1718bb8aefdSYi Liu #define ORANGEFS_XATTR_CREATE 0x1
1728bb8aefdSYi Liu #define ORANGEFS_MAX_SERVER_ADDR_LEN 256
1738bb8aefdSYi Liu #define ORANGEFS_NAME_MAX 256
174f7ab093fSMike Marshall /*
175f7ab093fSMike Marshall * max extended attribute name len as imposed by the VFS and exploited for the
176f7ab093fSMike Marshall * upcall request types.
177f7ab093fSMike Marshall * NOTE: Please retain them as multiples of 8 even if you wish to change them
178f7ab093fSMike Marshall * This is *NECESSARY* for supporting 32 bit user-space binaries on a 64-bit
179f7ab093fSMike Marshall * kernel. Due to implementation within DBPF, this really needs to be
1808bb8aefdSYi Liu * ORANGEFS_NAME_MAX, which it was the same value as, but no reason to let it
181f7ab093fSMike Marshall * break if that changes in the future.
182f7ab093fSMike Marshall */
1838bb8aefdSYi Liu #define ORANGEFS_MAX_XATTR_NAMELEN ORANGEFS_NAME_MAX /* Not the same as
184f7ab093fSMike Marshall * XATTR_NAME_MAX defined
185f7ab093fSMike Marshall * by <linux/xattr.h>
186f7ab093fSMike Marshall */
1878bb8aefdSYi Liu #define ORANGEFS_MAX_XATTR_VALUELEN 8192 /* Not the same as XATTR_SIZE_MAX
188f7ab093fSMike Marshall * defined by <linux/xattr.h>
189f7ab093fSMike Marshall */
1908bb8aefdSYi Liu #define ORANGEFS_MAX_XATTR_LISTLEN 16 /* Not the same as XATTR_LIST_MAX
191f7ab093fSMike Marshall * defined by <linux/xattr.h>
192f7ab093fSMike Marshall */
193f7ab093fSMike Marshall /*
1948bb8aefdSYi Liu * ORANGEFS I/O operation types, used in both system and server interfaces.
195f7ab093fSMike Marshall */
1968bb8aefdSYi Liu enum ORANGEFS_io_type {
1978bb8aefdSYi Liu ORANGEFS_IO_READ = 1,
1988bb8aefdSYi Liu ORANGEFS_IO_WRITE = 2
199f7ab093fSMike Marshall };
200f7ab093fSMike Marshall
201f7ab093fSMike Marshall /*
202f7ab093fSMike Marshall * If this enum is modified the server parameters related to the precreate pool
203f7ab093fSMike Marshall * batch and low threshold sizes may need to be modified to reflect this
204f7ab093fSMike Marshall * change.
205f7ab093fSMike Marshall */
2068bb8aefdSYi Liu enum orangefs_ds_type {
2078bb8aefdSYi Liu ORANGEFS_TYPE_NONE = 0,
2088bb8aefdSYi Liu ORANGEFS_TYPE_METAFILE = (1 << 0),
2098bb8aefdSYi Liu ORANGEFS_TYPE_DATAFILE = (1 << 1),
2108bb8aefdSYi Liu ORANGEFS_TYPE_DIRECTORY = (1 << 2),
2118bb8aefdSYi Liu ORANGEFS_TYPE_SYMLINK = (1 << 3),
2128bb8aefdSYi Liu ORANGEFS_TYPE_DIRDATA = (1 << 4),
2138bb8aefdSYi Liu ORANGEFS_TYPE_INTERNAL = (1 << 5) /* for the server's private use */
214f7ab093fSMike Marshall };
215f7ab093fSMike Marshall
216f7ab093fSMike Marshall /* This structure is used by the VFS-client interaction alone */
2178bb8aefdSYi Liu struct ORANGEFS_keyval_pair {
2188bb8aefdSYi Liu char key[ORANGEFS_MAX_XATTR_NAMELEN];
219f7ab093fSMike Marshall __s32 key_sz; /* __s32 for portable, fixed-size structures */
220f7ab093fSMike Marshall __s32 val_sz;
2218bb8aefdSYi Liu char val[ORANGEFS_MAX_XATTR_VALUELEN];
222f7ab093fSMike Marshall };
223f7ab093fSMike Marshall
224f7ab093fSMike Marshall /* pvfs2-sysint.h ***********************************************************/
225f7ab093fSMike Marshall /* Describes attributes for a file, directory, or symlink. */
2268bb8aefdSYi Liu struct ORANGEFS_sys_attr_s {
227f7ab093fSMike Marshall __u32 owner;
228f7ab093fSMike Marshall __u32 group;
229f7ab093fSMike Marshall __u32 perms;
230f7ab093fSMike Marshall __u64 atime;
231f7ab093fSMike Marshall __u64 mtime;
232f7ab093fSMike Marshall __u64 ctime;
233f7ab093fSMike Marshall __s64 size;
234f7ab093fSMike Marshall
235f7ab093fSMike Marshall /* NOTE: caller must free if valid */
236f7ab093fSMike Marshall char *link_target;
237f7ab093fSMike Marshall
238f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */
239f7ab093fSMike Marshall __s32 dfile_count;
240f7ab093fSMike Marshall
241f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */
242f7ab093fSMike Marshall __s32 distr_dir_servers_initial;
243f7ab093fSMike Marshall
244f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */
245f7ab093fSMike Marshall __s32 distr_dir_servers_max;
246f7ab093fSMike Marshall
247f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */
248f7ab093fSMike Marshall __s32 distr_dir_split_size;
249f7ab093fSMike Marshall
250f7ab093fSMike Marshall __u32 mirror_copies_count;
251f7ab093fSMike Marshall
252f7ab093fSMike Marshall /* NOTE: caller must free if valid */
253f7ab093fSMike Marshall char *dist_name;
254f7ab093fSMike Marshall
255f7ab093fSMike Marshall /* NOTE: caller must free if valid */
256f7ab093fSMike Marshall char *dist_params;
257f7ab093fSMike Marshall
258f7ab093fSMike Marshall __s64 dirent_count;
2598bb8aefdSYi Liu enum orangefs_ds_type objtype;
260f7ab093fSMike Marshall __u64 flags;
261f7ab093fSMike Marshall __u32 mask;
262f7ab093fSMike Marshall __s64 blksize;
263f7ab093fSMike Marshall };
264f7ab093fSMike Marshall
2658bb8aefdSYi Liu #define ORANGEFS_LOOKUP_LINK_NO_FOLLOW 0
266f7ab093fSMike Marshall
267f7ab093fSMike Marshall /* pint-dev.h ***************************************************************/
268f7ab093fSMike Marshall
2698bb8aefdSYi Liu /* parameter structure used in ORANGEFS_DEV_DEBUG ioctl command */
270f7ab093fSMike Marshall struct dev_mask_info_s {
271f7ab093fSMike Marshall enum {
272f7ab093fSMike Marshall KERNEL_MASK,
273f7ab093fSMike Marshall CLIENT_MASK,
274f7ab093fSMike Marshall } mask_type;
275f7ab093fSMike Marshall __u64 mask_value;
276f7ab093fSMike Marshall };
277f7ab093fSMike Marshall
278f7ab093fSMike Marshall struct dev_mask2_info_s {
279f7ab093fSMike Marshall __u64 mask1_value;
280f7ab093fSMike Marshall __u64 mask2_value;
281f7ab093fSMike Marshall };
282f7ab093fSMike Marshall
283f7ab093fSMike Marshall /* pvfs2-util.h *************************************************************/
2848bb8aefdSYi Liu __s32 ORANGEFS_util_translate_mode(int mode);
285f7ab093fSMike Marshall
286f7ab093fSMike Marshall /* pvfs2-debug.h ************************************************************/
287575e9461SMike Marshall #include "orangefs-debug.h"
288f7ab093fSMike Marshall
289f7ab093fSMike Marshall /* pvfs2-internal.h *********************************************************/
290f7ab093fSMike Marshall #define llu(x) (unsigned long long)(x)
291f7ab093fSMike Marshall #define lld(x) (long long)(x)
292f7ab093fSMike Marshall
293f7ab093fSMike Marshall /* pint-dev-shared.h ********************************************************/
2948bb8aefdSYi Liu #define ORANGEFS_DEV_MAGIC 'k'
295f7ab093fSMike Marshall
2968bb8aefdSYi Liu #define ORANGEFS_READDIR_DEFAULT_DESC_COUNT 5
297f7ab093fSMike Marshall
298f7ab093fSMike Marshall #define DEV_GET_MAGIC 0x1
299f7ab093fSMike Marshall #define DEV_GET_MAX_UPSIZE 0x2
300f7ab093fSMike Marshall #define DEV_GET_MAX_DOWNSIZE 0x3
301f7ab093fSMike Marshall #define DEV_MAP 0x4
302f7ab093fSMike Marshall #define DEV_REMOUNT_ALL 0x5
303f7ab093fSMike Marshall #define DEV_DEBUG 0x6
304f7ab093fSMike Marshall #define DEV_UPSTREAM 0x7
305f7ab093fSMike Marshall #define DEV_CLIENT_MASK 0x8
306f7ab093fSMike Marshall #define DEV_CLIENT_STRING 0x9
307f7ab093fSMike Marshall #define DEV_MAX_NR 0xa
308f7ab093fSMike Marshall
309f7ab093fSMike Marshall /* supported ioctls, codes are with respect to user-space */
310f7ab093fSMike Marshall enum {
3118bb8aefdSYi Liu ORANGEFS_DEV_GET_MAGIC = _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAGIC, __s32),
3128bb8aefdSYi Liu ORANGEFS_DEV_GET_MAX_UPSIZE =
3138bb8aefdSYi Liu _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32),
3148bb8aefdSYi Liu ORANGEFS_DEV_GET_MAX_DOWNSIZE =
3158bb8aefdSYi Liu _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32),
3168bb8aefdSYi Liu ORANGEFS_DEV_MAP = _IO(ORANGEFS_DEV_MAGIC, DEV_MAP),
3178bb8aefdSYi Liu ORANGEFS_DEV_REMOUNT_ALL = _IO(ORANGEFS_DEV_MAGIC, DEV_REMOUNT_ALL),
3188bb8aefdSYi Liu ORANGEFS_DEV_DEBUG = _IOR(ORANGEFS_DEV_MAGIC, DEV_DEBUG, __s32),
3198bb8aefdSYi Liu ORANGEFS_DEV_UPSTREAM = _IOW(ORANGEFS_DEV_MAGIC, DEV_UPSTREAM, int),
3208bb8aefdSYi Liu ORANGEFS_DEV_CLIENT_MASK = _IOW(ORANGEFS_DEV_MAGIC,
321f7ab093fSMike Marshall DEV_CLIENT_MASK,
322f7ab093fSMike Marshall struct dev_mask2_info_s),
3238bb8aefdSYi Liu ORANGEFS_DEV_CLIENT_STRING = _IOW(ORANGEFS_DEV_MAGIC,
324f7ab093fSMike Marshall DEV_CLIENT_STRING,
325f7ab093fSMike Marshall char *),
3268bb8aefdSYi Liu ORANGEFS_DEV_MAXNR = DEV_MAX_NR,
327f7ab093fSMike Marshall };
328f7ab093fSMike Marshall
329f7ab093fSMike Marshall /*
330f7ab093fSMike Marshall * version number for use in communicating between kernel space and user
33154804949SMike Marshall * space. Zero signifies the upstream version of the kernel module.
332f7ab093fSMike Marshall */
3338bb8aefdSYi Liu #define ORANGEFS_KERNEL_PROTO_VERSION 0
334878dfd32SMartin Brandenburg #define ORANGEFS_MINIMUM_USERSPACE_VERSION 20903
335f7ab093fSMike Marshall
336f7ab093fSMike Marshall /*
3378bb8aefdSYi Liu * describes memory regions to map in the ORANGEFS_DEV_MAP ioctl.
338575e9461SMike Marshall * NOTE: See devorangefs-req.c for 32 bit compat structure.
339f7ab093fSMike Marshall * Since this structure has a variable-sized layout that is different
340f7ab093fSMike Marshall * on 32 and 64 bit platforms, we need to normalize to a 64 bit layout
341f7ab093fSMike Marshall * on such systems before servicing ioctl calls from user-space binaries
342f7ab093fSMike Marshall * that may be 32 bit!
343f7ab093fSMike Marshall */
3448bb8aefdSYi Liu struct ORANGEFS_dev_map_desc {
345*817e9b4dSMike Marshall void __user *ptr;
346f7ab093fSMike Marshall __s32 total_size;
347f7ab093fSMike Marshall __s32 size;
348f7ab093fSMike Marshall __s32 count;
349f7ab093fSMike Marshall };
350f7ab093fSMike Marshall
351f7ab093fSMike Marshall /* gossip.h *****************************************************************/
352f7ab093fSMike Marshall
35344f46410SMartin Brandenburg extern __u64 orangefs_gossip_debug_mask;
354f7ab093fSMike Marshall
355f7ab093fSMike Marshall /* try to avoid function call overhead by checking masks in macro */
3561917a693SJoe Perches #define gossip_debug(mask, fmt, ...) \
357f7ab093fSMike Marshall do { \
35844f46410SMartin Brandenburg if (orangefs_gossip_debug_mask & (mask)) \
3591917a693SJoe Perches printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
360f7ab093fSMike Marshall } while (0)
361f7ab093fSMike Marshall
3621917a693SJoe Perches #define gossip_err pr_err
363