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" 238bb8aefdSYi Liu #define ORANGEFS_VERBOSE "verbose" 248bb8aefdSYi Liu #define ORANGEFS_ALL "all" 25f7ab093fSMike Marshall 26f7ab093fSMike Marshall /* pvfs2-config.h ***********************************************************/ 278bb8aefdSYi Liu #define ORANGEFS_VERSION_MAJOR 2 288bb8aefdSYi Liu #define ORANGEFS_VERSION_MINOR 9 298bb8aefdSYi Liu #define ORANGEFS_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 */ 418bb8aefdSYi Liu struct orangefs_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 */ 488bb8aefdSYi Liu struct orangefs_object_kref { 498bb8aefdSYi Liu struct orangefs_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 */ 588bb8aefdSYi Liu static inline int ORANGEFS_khandle_cmp(const struct orangefs_khandle *kh1, 598bb8aefdSYi Liu const struct orangefs_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 738bb8aefdSYi Liu static inline void ORANGEFS_khandle_to(const struct orangefs_khandle *kh, 74f7ab093fSMike Marshall void *p, int size) 75f7ab093fSMike Marshall { 76f7ab093fSMike Marshall 77f7ab093fSMike Marshall memset(p, 0, size); 7850e01586SMike Marshall memcpy(p, kh->u, 16); 79f7ab093fSMike Marshall 80f7ab093fSMike Marshall } 81f7ab093fSMike Marshall 828bb8aefdSYi Liu static inline void ORANGEFS_khandle_from(struct orangefs_khandle *kh, 83f7ab093fSMike Marshall void *p, int size) 84f7ab093fSMike Marshall { 85f7ab093fSMike Marshall memset(kh, 0, 16); 8650e01586SMike Marshall memcpy(kh->u, p, 16); 87f7ab093fSMike Marshall 88f7ab093fSMike Marshall } 89f7ab093fSMike Marshall 90f7ab093fSMike Marshall /* pvfs2-types.h ************************************************************/ 918bb8aefdSYi Liu typedef __u32 ORANGEFS_uid; 928bb8aefdSYi Liu typedef __u32 ORANGEFS_gid; 938bb8aefdSYi Liu typedef __s32 ORANGEFS_fs_id; 948bb8aefdSYi Liu typedef __u32 ORANGEFS_permissions; 958bb8aefdSYi Liu typedef __u64 ORANGEFS_time; 968bb8aefdSYi Liu typedef __s64 ORANGEFS_size; 978bb8aefdSYi Liu typedef __u64 ORANGEFS_flags; 988bb8aefdSYi Liu typedef __u64 ORANGEFS_ds_position; 998bb8aefdSYi Liu typedef __s32 ORANGEFS_error; 1008bb8aefdSYi Liu typedef __s64 ORANGEFS_offset; 101f7ab093fSMike Marshall 1028bb8aefdSYi Liu #define ORANGEFS_SUPER_MAGIC 0x20030528 103894ac432SMartin Brandenburg 10454804949SMike Marshall /* 1058bb8aefdSYi Liu * ORANGEFS error codes are a signed 32-bit integer. Error codes are negative, but 10654804949SMike Marshall * the sign is stripped before decoding. 10754804949SMike Marshall */ 108894ac432SMartin Brandenburg 109894ac432SMartin Brandenburg /* Bit 31 is not used since it is the sign. */ 110894ac432SMartin Brandenburg 11154804949SMike Marshall /* 1128bb8aefdSYi Liu * Bit 30 specifies that this is a ORANGEFS error. A ORANGEFS error is either an 1138bb8aefdSYi Liu * encoded errno value or a ORANGEFS protocol error. 11454804949SMike Marshall */ 1158bb8aefdSYi Liu #define ORANGEFS_ERROR_BIT (1 << 30) 116894ac432SMartin Brandenburg 11754804949SMike Marshall /* 1188bb8aefdSYi Liu * Bit 29 specifies that this is a ORANGEFS protocol error and not an encoded 11954804949SMike Marshall * errno value. 12054804949SMike Marshall */ 1218bb8aefdSYi Liu #define ORANGEFS_NON_ERRNO_ERROR_BIT (1 << 29) 122f7ab093fSMike Marshall 12354804949SMike Marshall /* 12454804949SMike Marshall * Bits 9, 8, and 7 specify the error class, which encodes the section of 125894ac432SMartin Brandenburg * server code the error originated in for logging purposes. It is not used 12654804949SMike Marshall * in the kernel except to be masked out. 12754804949SMike Marshall */ 1288bb8aefdSYi Liu #define ORANGEFS_ERROR_CLASS_BITS 0x380 129f7ab093fSMike Marshall 130894ac432SMartin Brandenburg /* Bits 6 - 0 are reserved for the actual error code. */ 1318bb8aefdSYi Liu #define ORANGEFS_ERROR_NUMBER_BITS 0x7f 132f7ab093fSMike Marshall 133*575e9461SMike Marshall /* Encoded errno values decoded by PINT_errno_mapping in orangefs-utils.c. */ 134f7ab093fSMike Marshall 1358bb8aefdSYi Liu /* Our own ORANGEFS protocol error codes. */ 1368bb8aefdSYi Liu #define ORANGEFS_ECANCEL (1|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) 1378bb8aefdSYi Liu #define ORANGEFS_EDEVINIT (2|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) 1388bb8aefdSYi Liu #define ORANGEFS_EDETAIL (3|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) 1398bb8aefdSYi Liu #define ORANGEFS_EHOSTNTFD (4|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) 1408bb8aefdSYi Liu #define ORANGEFS_EADDRNTFD (5|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) 1418bb8aefdSYi Liu #define ORANGEFS_ENORECVR (6|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) 1428bb8aefdSYi Liu #define ORANGEFS_ETRYAGAIN (7|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) 1438bb8aefdSYi Liu #define ORANGEFS_ENOTPVFS (8|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) 1448bb8aefdSYi Liu #define ORANGEFS_ESECURITY (9|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) 145f7ab093fSMike Marshall 146f7ab093fSMike Marshall /* permission bits */ 1478bb8aefdSYi Liu #define ORANGEFS_O_EXECUTE (1 << 0) 1488bb8aefdSYi Liu #define ORANGEFS_O_WRITE (1 << 1) 1498bb8aefdSYi Liu #define ORANGEFS_O_READ (1 << 2) 1508bb8aefdSYi Liu #define ORANGEFS_G_EXECUTE (1 << 3) 1518bb8aefdSYi Liu #define ORANGEFS_G_WRITE (1 << 4) 1528bb8aefdSYi Liu #define ORANGEFS_G_READ (1 << 5) 1538bb8aefdSYi Liu #define ORANGEFS_U_EXECUTE (1 << 6) 1548bb8aefdSYi Liu #define ORANGEFS_U_WRITE (1 << 7) 1558bb8aefdSYi Liu #define ORANGEFS_U_READ (1 << 8) 1568bb8aefdSYi Liu /* no ORANGEFS_U_VTX (sticky bit) */ 1578bb8aefdSYi Liu #define ORANGEFS_G_SGID (1 << 10) 1588bb8aefdSYi Liu #define ORANGEFS_U_SUID (1 << 11) 159f7ab093fSMike Marshall 160f7ab093fSMike Marshall /* definition taken from stdint.h */ 161f7ab093fSMike Marshall #define INT32_MAX (2147483647) 1628bb8aefdSYi Liu #define ORANGEFS_ITERATE_START (INT32_MAX - 1) 1638bb8aefdSYi Liu #define ORANGEFS_ITERATE_END (INT32_MAX - 2) 1648bb8aefdSYi Liu #define ORANGEFS_ITERATE_NEXT (INT32_MAX - 3) 1658bb8aefdSYi Liu #define ORANGEFS_READDIR_START ORANGEFS_ITERATE_START 1668bb8aefdSYi Liu #define ORANGEFS_READDIR_END ORANGEFS_ITERATE_END 1678bb8aefdSYi Liu #define ORANGEFS_IMMUTABLE_FL FS_IMMUTABLE_FL 1688bb8aefdSYi Liu #define ORANGEFS_APPEND_FL FS_APPEND_FL 1698bb8aefdSYi Liu #define ORANGEFS_NOATIME_FL FS_NOATIME_FL 1708bb8aefdSYi Liu #define ORANGEFS_MIRROR_FL 0x01000000ULL 1718bb8aefdSYi Liu #define ORANGEFS_O_EXECUTE (1 << 0) 1728bb8aefdSYi Liu #define ORANGEFS_FS_ID_NULL ((__s32)0) 1738bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_UID (1 << 0) 1748bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_GID (1 << 1) 1758bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_PERM (1 << 2) 1768bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_ATIME (1 << 3) 1778bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_CTIME (1 << 4) 1788bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_MTIME (1 << 5) 1798bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_TYPE (1 << 6) 1808bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_ATIME_SET (1 << 7) 1818bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_MTIME_SET (1 << 8) 1828bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_SIZE (1 << 20) 1838bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_LNK_TARGET (1 << 24) 1848bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_DFILE_COUNT (1 << 25) 1858bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_DIRENT_COUNT (1 << 26) 1868bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_BLKSIZE (1 << 28) 1878bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT (1 << 29) 1888bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_COMMON_ALL \ 1898bb8aefdSYi Liu (ORANGEFS_ATTR_SYS_UID | \ 1908bb8aefdSYi Liu ORANGEFS_ATTR_SYS_GID | \ 1918bb8aefdSYi Liu ORANGEFS_ATTR_SYS_PERM | \ 1928bb8aefdSYi Liu ORANGEFS_ATTR_SYS_ATIME | \ 1938bb8aefdSYi Liu ORANGEFS_ATTR_SYS_CTIME | \ 1948bb8aefdSYi Liu ORANGEFS_ATTR_SYS_MTIME | \ 1958bb8aefdSYi Liu ORANGEFS_ATTR_SYS_TYPE) 196f7ab093fSMike Marshall 1978bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_ALL_SETABLE \ 1988bb8aefdSYi Liu (ORANGEFS_ATTR_SYS_COMMON_ALL-ORANGEFS_ATTR_SYS_TYPE) 199f7ab093fSMike Marshall 2008bb8aefdSYi Liu #define ORANGEFS_ATTR_SYS_ALL_NOHINT \ 2018bb8aefdSYi Liu (ORANGEFS_ATTR_SYS_COMMON_ALL | \ 2028bb8aefdSYi Liu ORANGEFS_ATTR_SYS_SIZE | \ 2038bb8aefdSYi Liu ORANGEFS_ATTR_SYS_LNK_TARGET | \ 2048bb8aefdSYi Liu ORANGEFS_ATTR_SYS_DFILE_COUNT | \ 2058bb8aefdSYi Liu ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT | \ 2068bb8aefdSYi Liu ORANGEFS_ATTR_SYS_DIRENT_COUNT | \ 2078bb8aefdSYi Liu ORANGEFS_ATTR_SYS_BLKSIZE) 2088bb8aefdSYi Liu #define ORANGEFS_XATTR_REPLACE 0x2 2098bb8aefdSYi Liu #define ORANGEFS_XATTR_CREATE 0x1 2108bb8aefdSYi Liu #define ORANGEFS_MAX_SERVER_ADDR_LEN 256 2118bb8aefdSYi Liu #define ORANGEFS_NAME_MAX 256 212f7ab093fSMike Marshall /* 213f7ab093fSMike Marshall * max extended attribute name len as imposed by the VFS and exploited for the 214f7ab093fSMike Marshall * upcall request types. 215f7ab093fSMike Marshall * NOTE: Please retain them as multiples of 8 even if you wish to change them 216f7ab093fSMike Marshall * This is *NECESSARY* for supporting 32 bit user-space binaries on a 64-bit 217f7ab093fSMike Marshall * kernel. Due to implementation within DBPF, this really needs to be 2188bb8aefdSYi Liu * ORANGEFS_NAME_MAX, which it was the same value as, but no reason to let it 219f7ab093fSMike Marshall * break if that changes in the future. 220f7ab093fSMike Marshall */ 2218bb8aefdSYi Liu #define ORANGEFS_MAX_XATTR_NAMELEN ORANGEFS_NAME_MAX /* Not the same as 222f7ab093fSMike Marshall * XATTR_NAME_MAX defined 223f7ab093fSMike Marshall * by <linux/xattr.h> 224f7ab093fSMike Marshall */ 2258bb8aefdSYi Liu #define ORANGEFS_MAX_XATTR_VALUELEN 8192 /* Not the same as XATTR_SIZE_MAX 226f7ab093fSMike Marshall * defined by <linux/xattr.h> 227f7ab093fSMike Marshall */ 2288bb8aefdSYi Liu #define ORANGEFS_MAX_XATTR_LISTLEN 16 /* Not the same as XATTR_LIST_MAX 229f7ab093fSMike Marshall * defined by <linux/xattr.h> 230f7ab093fSMike Marshall */ 231f7ab093fSMike Marshall /* 2328bb8aefdSYi Liu * ORANGEFS I/O operation types, used in both system and server interfaces. 233f7ab093fSMike Marshall */ 2348bb8aefdSYi Liu enum ORANGEFS_io_type { 2358bb8aefdSYi Liu ORANGEFS_IO_READ = 1, 2368bb8aefdSYi Liu ORANGEFS_IO_WRITE = 2 237f7ab093fSMike Marshall }; 238f7ab093fSMike Marshall 239f7ab093fSMike Marshall /* 240f7ab093fSMike Marshall * If this enum is modified the server parameters related to the precreate pool 241f7ab093fSMike Marshall * batch and low threshold sizes may need to be modified to reflect this 242f7ab093fSMike Marshall * change. 243f7ab093fSMike Marshall */ 2448bb8aefdSYi Liu enum orangefs_ds_type { 2458bb8aefdSYi Liu ORANGEFS_TYPE_NONE = 0, 2468bb8aefdSYi Liu ORANGEFS_TYPE_METAFILE = (1 << 0), 2478bb8aefdSYi Liu ORANGEFS_TYPE_DATAFILE = (1 << 1), 2488bb8aefdSYi Liu ORANGEFS_TYPE_DIRECTORY = (1 << 2), 2498bb8aefdSYi Liu ORANGEFS_TYPE_SYMLINK = (1 << 3), 2508bb8aefdSYi Liu ORANGEFS_TYPE_DIRDATA = (1 << 4), 2518bb8aefdSYi Liu ORANGEFS_TYPE_INTERNAL = (1 << 5) /* for the server's private use */ 252f7ab093fSMike Marshall }; 253f7ab093fSMike Marshall 254f7ab093fSMike Marshall /* 2558bb8aefdSYi Liu * ORANGEFS_certificate simply stores a buffer with the buffer size. 256f7ab093fSMike Marshall * The buffer can be converted to an OpenSSL X509 struct for use. 257f7ab093fSMike Marshall */ 2588bb8aefdSYi Liu struct ORANGEFS_certificate { 259f7ab093fSMike Marshall __u32 buf_size; 260f7ab093fSMike Marshall unsigned char *buf; 261f7ab093fSMike Marshall }; 262f7ab093fSMike Marshall 263f7ab093fSMike Marshall /* 264f7ab093fSMike Marshall * A credential identifies a user and is signed by the client/user 265f7ab093fSMike Marshall * private key. 266f7ab093fSMike Marshall */ 2678bb8aefdSYi Liu struct ORANGEFS_credential { 268f7ab093fSMike Marshall __u32 userid; /* user id */ 269f7ab093fSMike Marshall __u32 num_groups; /* length of group_array */ 270f7ab093fSMike Marshall __u32 *group_array; /* groups for which the user is a member */ 271f7ab093fSMike Marshall char *issuer; /* alias of the issuing server */ 272f7ab093fSMike Marshall __u64 timeout; /* seconds after epoch to time out */ 273f7ab093fSMike Marshall __u32 sig_size; /* length of the signature in bytes */ 274f7ab093fSMike Marshall unsigned char *signature; /* digital signature */ 2758bb8aefdSYi Liu struct ORANGEFS_certificate certificate; /* user certificate buffer */ 276f7ab093fSMike Marshall }; 2778bb8aefdSYi Liu #define extra_size_ORANGEFS_credential (ORANGEFS_REQ_LIMIT_GROUPS * \ 278f7ab093fSMike Marshall sizeof(__u32) + \ 2798bb8aefdSYi Liu ORANGEFS_REQ_LIMIT_ISSUER + \ 2808bb8aefdSYi Liu ORANGEFS_REQ_LIMIT_SIGNATURE + \ 2818bb8aefdSYi Liu extra_size_ORANGEFS_certificate) 282f7ab093fSMike Marshall 283f7ab093fSMike Marshall /* This structure is used by the VFS-client interaction alone */ 2848bb8aefdSYi Liu struct ORANGEFS_keyval_pair { 2858bb8aefdSYi Liu char key[ORANGEFS_MAX_XATTR_NAMELEN]; 286f7ab093fSMike Marshall __s32 key_sz; /* __s32 for portable, fixed-size structures */ 287f7ab093fSMike Marshall __s32 val_sz; 2888bb8aefdSYi Liu char val[ORANGEFS_MAX_XATTR_VALUELEN]; 289f7ab093fSMike Marshall }; 290f7ab093fSMike Marshall 291f7ab093fSMike Marshall /* pvfs2-sysint.h ***********************************************************/ 292f7ab093fSMike Marshall /* Describes attributes for a file, directory, or symlink. */ 2938bb8aefdSYi Liu struct ORANGEFS_sys_attr_s { 294f7ab093fSMike Marshall __u32 owner; 295f7ab093fSMike Marshall __u32 group; 296f7ab093fSMike Marshall __u32 perms; 297f7ab093fSMike Marshall __u64 atime; 298f7ab093fSMike Marshall __u64 mtime; 299f7ab093fSMike Marshall __u64 ctime; 300f7ab093fSMike Marshall __s64 size; 301f7ab093fSMike Marshall 302f7ab093fSMike Marshall /* NOTE: caller must free if valid */ 303f7ab093fSMike Marshall char *link_target; 304f7ab093fSMike Marshall 305f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 306f7ab093fSMike Marshall __s32 dfile_count; 307f7ab093fSMike Marshall 308f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 309f7ab093fSMike Marshall __s32 distr_dir_servers_initial; 310f7ab093fSMike Marshall 311f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 312f7ab093fSMike Marshall __s32 distr_dir_servers_max; 313f7ab093fSMike Marshall 314f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 315f7ab093fSMike Marshall __s32 distr_dir_split_size; 316f7ab093fSMike Marshall 317f7ab093fSMike Marshall __u32 mirror_copies_count; 318f7ab093fSMike Marshall 319f7ab093fSMike Marshall /* NOTE: caller must free if valid */ 320f7ab093fSMike Marshall char *dist_name; 321f7ab093fSMike Marshall 322f7ab093fSMike Marshall /* NOTE: caller must free if valid */ 323f7ab093fSMike Marshall char *dist_params; 324f7ab093fSMike Marshall 325f7ab093fSMike Marshall __s64 dirent_count; 3268bb8aefdSYi Liu enum orangefs_ds_type objtype; 327f7ab093fSMike Marshall __u64 flags; 328f7ab093fSMike Marshall __u32 mask; 329f7ab093fSMike Marshall __s64 blksize; 330f7ab093fSMike Marshall }; 331f7ab093fSMike Marshall 3328bb8aefdSYi Liu #define ORANGEFS_LOOKUP_LINK_NO_FOLLOW 0 3338bb8aefdSYi Liu #define ORANGEFS_LOOKUP_LINK_FOLLOW 1 334f7ab093fSMike Marshall 335f7ab093fSMike Marshall /* pint-dev.h ***************************************************************/ 336f7ab093fSMike Marshall 3378bb8aefdSYi Liu /* parameter structure used in ORANGEFS_DEV_DEBUG ioctl command */ 338f7ab093fSMike Marshall struct dev_mask_info_s { 339f7ab093fSMike Marshall enum { 340f7ab093fSMike Marshall KERNEL_MASK, 341f7ab093fSMike Marshall CLIENT_MASK, 342f7ab093fSMike Marshall } mask_type; 343f7ab093fSMike Marshall __u64 mask_value; 344f7ab093fSMike Marshall }; 345f7ab093fSMike Marshall 346f7ab093fSMike Marshall struct dev_mask2_info_s { 347f7ab093fSMike Marshall __u64 mask1_value; 348f7ab093fSMike Marshall __u64 mask2_value; 349f7ab093fSMike Marshall }; 350f7ab093fSMike Marshall 351f7ab093fSMike Marshall /* pvfs2-util.h *************************************************************/ 3528bb8aefdSYi Liu __s32 ORANGEFS_util_translate_mode(int mode); 353f7ab093fSMike Marshall 354f7ab093fSMike Marshall /* pvfs2-debug.h ************************************************************/ 355*575e9461SMike Marshall #include "orangefs-debug.h" 356f7ab093fSMike Marshall 357f7ab093fSMike Marshall /* pvfs2-internal.h *********************************************************/ 358f7ab093fSMike Marshall #define llu(x) (unsigned long long)(x) 359f7ab093fSMike Marshall #define lld(x) (long long)(x) 360f7ab093fSMike Marshall 361f7ab093fSMike Marshall /* pint-dev-shared.h ********************************************************/ 3628bb8aefdSYi Liu #define ORANGEFS_DEV_MAGIC 'k' 363f7ab093fSMike Marshall 3648bb8aefdSYi Liu #define ORANGEFS_READDIR_DEFAULT_DESC_COUNT 5 365f7ab093fSMike Marshall 366f7ab093fSMike Marshall #define DEV_GET_MAGIC 0x1 367f7ab093fSMike Marshall #define DEV_GET_MAX_UPSIZE 0x2 368f7ab093fSMike Marshall #define DEV_GET_MAX_DOWNSIZE 0x3 369f7ab093fSMike Marshall #define DEV_MAP 0x4 370f7ab093fSMike Marshall #define DEV_REMOUNT_ALL 0x5 371f7ab093fSMike Marshall #define DEV_DEBUG 0x6 372f7ab093fSMike Marshall #define DEV_UPSTREAM 0x7 373f7ab093fSMike Marshall #define DEV_CLIENT_MASK 0x8 374f7ab093fSMike Marshall #define DEV_CLIENT_STRING 0x9 375f7ab093fSMike Marshall #define DEV_MAX_NR 0xa 376f7ab093fSMike Marshall 377f7ab093fSMike Marshall /* supported ioctls, codes are with respect to user-space */ 378f7ab093fSMike Marshall enum { 3798bb8aefdSYi Liu ORANGEFS_DEV_GET_MAGIC = _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAGIC, __s32), 3808bb8aefdSYi Liu ORANGEFS_DEV_GET_MAX_UPSIZE = 3818bb8aefdSYi Liu _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32), 3828bb8aefdSYi Liu ORANGEFS_DEV_GET_MAX_DOWNSIZE = 3838bb8aefdSYi Liu _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32), 3848bb8aefdSYi Liu ORANGEFS_DEV_MAP = _IO(ORANGEFS_DEV_MAGIC, DEV_MAP), 3858bb8aefdSYi Liu ORANGEFS_DEV_REMOUNT_ALL = _IO(ORANGEFS_DEV_MAGIC, DEV_REMOUNT_ALL), 3868bb8aefdSYi Liu ORANGEFS_DEV_DEBUG = _IOR(ORANGEFS_DEV_MAGIC, DEV_DEBUG, __s32), 3878bb8aefdSYi Liu ORANGEFS_DEV_UPSTREAM = _IOW(ORANGEFS_DEV_MAGIC, DEV_UPSTREAM, int), 3888bb8aefdSYi Liu ORANGEFS_DEV_CLIENT_MASK = _IOW(ORANGEFS_DEV_MAGIC, 389f7ab093fSMike Marshall DEV_CLIENT_MASK, 390f7ab093fSMike Marshall struct dev_mask2_info_s), 3918bb8aefdSYi Liu ORANGEFS_DEV_CLIENT_STRING = _IOW(ORANGEFS_DEV_MAGIC, 392f7ab093fSMike Marshall DEV_CLIENT_STRING, 393f7ab093fSMike Marshall char *), 3948bb8aefdSYi Liu ORANGEFS_DEV_MAXNR = DEV_MAX_NR, 395f7ab093fSMike Marshall }; 396f7ab093fSMike Marshall 397f7ab093fSMike Marshall /* 398f7ab093fSMike Marshall * version number for use in communicating between kernel space and user 39954804949SMike Marshall * space. Zero signifies the upstream version of the kernel module. 400f7ab093fSMike Marshall */ 4018bb8aefdSYi Liu #define ORANGEFS_KERNEL_PROTO_VERSION 0 402f7ab093fSMike Marshall 403f7ab093fSMike Marshall /* 4048bb8aefdSYi Liu * describes memory regions to map in the ORANGEFS_DEV_MAP ioctl. 405*575e9461SMike Marshall * NOTE: See devorangefs-req.c for 32 bit compat structure. 406f7ab093fSMike Marshall * Since this structure has a variable-sized layout that is different 407f7ab093fSMike Marshall * on 32 and 64 bit platforms, we need to normalize to a 64 bit layout 408f7ab093fSMike Marshall * on such systems before servicing ioctl calls from user-space binaries 409f7ab093fSMike Marshall * that may be 32 bit! 410f7ab093fSMike Marshall */ 4118bb8aefdSYi Liu struct ORANGEFS_dev_map_desc { 412f7ab093fSMike Marshall void *ptr; 413f7ab093fSMike Marshall __s32 total_size; 414f7ab093fSMike Marshall __s32 size; 415f7ab093fSMike Marshall __s32 count; 416f7ab093fSMike Marshall }; 417f7ab093fSMike Marshall 418f7ab093fSMike Marshall /* gossip.h *****************************************************************/ 419f7ab093fSMike Marshall 420f7ab093fSMike Marshall #ifdef GOSSIP_DISABLE_DEBUG 421f7ab093fSMike Marshall #define gossip_debug(mask, format, f...) do {} while (0) 422f7ab093fSMike Marshall #else 423f7ab093fSMike Marshall extern __u64 gossip_debug_mask; 424f7ab093fSMike Marshall extern struct client_debug_mask client_debug_mask; 425f7ab093fSMike Marshall 426f7ab093fSMike Marshall /* try to avoid function call overhead by checking masks in macro */ 427f7ab093fSMike Marshall #define gossip_debug(mask, format, f...) \ 428f7ab093fSMike Marshall do { \ 429f7ab093fSMike Marshall if (gossip_debug_mask & mask) \ 430f7ab093fSMike Marshall printk(format, ##f); \ 431f7ab093fSMike Marshall } while (0) 432f7ab093fSMike Marshall #endif /* GOSSIP_DISABLE_DEBUG */ 433f7ab093fSMike Marshall 434f7ab093fSMike Marshall /* do file and line number printouts w/ the GNU preprocessor */ 435f7ab093fSMike Marshall #define gossip_ldebug(mask, format, f...) \ 436f7ab093fSMike Marshall gossip_debug(mask, "%s: " format, __func__, ##f) 437f7ab093fSMike Marshall 438f7ab093fSMike Marshall #define gossip_err printk 439f7ab093fSMike Marshall #define gossip_lerr(format, f...) \ 440f7ab093fSMike Marshall gossip_err("%s line %d: " format, \ 441f7ab093fSMike Marshall __FILE__, \ 442f7ab093fSMike Marshall __LINE__, \ 443f7ab093fSMike Marshall ##f) 444