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 133575e9461SMike 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) 208*933287daSMartin Brandenburg 209*933287daSMartin Brandenburg #define ORANGEFS_ATTR_SYS_ALL_NOHINT_NOSIZE \ 210*933287daSMartin Brandenburg (ORANGEFS_ATTR_SYS_COMMON_ALL | \ 211*933287daSMartin Brandenburg ORANGEFS_ATTR_SYS_LNK_TARGET | \ 212*933287daSMartin Brandenburg ORANGEFS_ATTR_SYS_DFILE_COUNT | \ 213*933287daSMartin Brandenburg ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT | \ 214*933287daSMartin Brandenburg ORANGEFS_ATTR_SYS_DIRENT_COUNT | \ 215*933287daSMartin Brandenburg ORANGEFS_ATTR_SYS_BLKSIZE) 216*933287daSMartin Brandenburg 2178bb8aefdSYi Liu #define ORANGEFS_XATTR_REPLACE 0x2 2188bb8aefdSYi Liu #define ORANGEFS_XATTR_CREATE 0x1 2198bb8aefdSYi Liu #define ORANGEFS_MAX_SERVER_ADDR_LEN 256 2208bb8aefdSYi Liu #define ORANGEFS_NAME_MAX 256 221f7ab093fSMike Marshall /* 222f7ab093fSMike Marshall * max extended attribute name len as imposed by the VFS and exploited for the 223f7ab093fSMike Marshall * upcall request types. 224f7ab093fSMike Marshall * NOTE: Please retain them as multiples of 8 even if you wish to change them 225f7ab093fSMike Marshall * This is *NECESSARY* for supporting 32 bit user-space binaries on a 64-bit 226f7ab093fSMike Marshall * kernel. Due to implementation within DBPF, this really needs to be 2278bb8aefdSYi Liu * ORANGEFS_NAME_MAX, which it was the same value as, but no reason to let it 228f7ab093fSMike Marshall * break if that changes in the future. 229f7ab093fSMike Marshall */ 2308bb8aefdSYi Liu #define ORANGEFS_MAX_XATTR_NAMELEN ORANGEFS_NAME_MAX /* Not the same as 231f7ab093fSMike Marshall * XATTR_NAME_MAX defined 232f7ab093fSMike Marshall * by <linux/xattr.h> 233f7ab093fSMike Marshall */ 2348bb8aefdSYi Liu #define ORANGEFS_MAX_XATTR_VALUELEN 8192 /* Not the same as XATTR_SIZE_MAX 235f7ab093fSMike Marshall * defined by <linux/xattr.h> 236f7ab093fSMike Marshall */ 2378bb8aefdSYi Liu #define ORANGEFS_MAX_XATTR_LISTLEN 16 /* Not the same as XATTR_LIST_MAX 238f7ab093fSMike Marshall * defined by <linux/xattr.h> 239f7ab093fSMike Marshall */ 240f7ab093fSMike Marshall /* 2418bb8aefdSYi Liu * ORANGEFS I/O operation types, used in both system and server interfaces. 242f7ab093fSMike Marshall */ 2438bb8aefdSYi Liu enum ORANGEFS_io_type { 2448bb8aefdSYi Liu ORANGEFS_IO_READ = 1, 2458bb8aefdSYi Liu ORANGEFS_IO_WRITE = 2 246f7ab093fSMike Marshall }; 247f7ab093fSMike Marshall 248f7ab093fSMike Marshall /* 249f7ab093fSMike Marshall * If this enum is modified the server parameters related to the precreate pool 250f7ab093fSMike Marshall * batch and low threshold sizes may need to be modified to reflect this 251f7ab093fSMike Marshall * change. 252f7ab093fSMike Marshall */ 2538bb8aefdSYi Liu enum orangefs_ds_type { 2548bb8aefdSYi Liu ORANGEFS_TYPE_NONE = 0, 2558bb8aefdSYi Liu ORANGEFS_TYPE_METAFILE = (1 << 0), 2568bb8aefdSYi Liu ORANGEFS_TYPE_DATAFILE = (1 << 1), 2578bb8aefdSYi Liu ORANGEFS_TYPE_DIRECTORY = (1 << 2), 2588bb8aefdSYi Liu ORANGEFS_TYPE_SYMLINK = (1 << 3), 2598bb8aefdSYi Liu ORANGEFS_TYPE_DIRDATA = (1 << 4), 2608bb8aefdSYi Liu ORANGEFS_TYPE_INTERNAL = (1 << 5) /* for the server's private use */ 261f7ab093fSMike Marshall }; 262f7ab093fSMike Marshall 263f7ab093fSMike Marshall /* 2648bb8aefdSYi Liu * ORANGEFS_certificate simply stores a buffer with the buffer size. 265f7ab093fSMike Marshall * The buffer can be converted to an OpenSSL X509 struct for use. 266f7ab093fSMike Marshall */ 2678bb8aefdSYi Liu struct ORANGEFS_certificate { 268f7ab093fSMike Marshall __u32 buf_size; 269f7ab093fSMike Marshall unsigned char *buf; 270f7ab093fSMike Marshall }; 271f7ab093fSMike Marshall 272f7ab093fSMike Marshall /* 273f7ab093fSMike Marshall * A credential identifies a user and is signed by the client/user 274f7ab093fSMike Marshall * private key. 275f7ab093fSMike Marshall */ 2768bb8aefdSYi Liu struct ORANGEFS_credential { 277f7ab093fSMike Marshall __u32 userid; /* user id */ 278f7ab093fSMike Marshall __u32 num_groups; /* length of group_array */ 279f7ab093fSMike Marshall __u32 *group_array; /* groups for which the user is a member */ 280f7ab093fSMike Marshall char *issuer; /* alias of the issuing server */ 281f7ab093fSMike Marshall __u64 timeout; /* seconds after epoch to time out */ 282f7ab093fSMike Marshall __u32 sig_size; /* length of the signature in bytes */ 283f7ab093fSMike Marshall unsigned char *signature; /* digital signature */ 2848bb8aefdSYi Liu struct ORANGEFS_certificate certificate; /* user certificate buffer */ 285f7ab093fSMike Marshall }; 2868bb8aefdSYi Liu #define extra_size_ORANGEFS_credential (ORANGEFS_REQ_LIMIT_GROUPS * \ 287f7ab093fSMike Marshall sizeof(__u32) + \ 2888bb8aefdSYi Liu ORANGEFS_REQ_LIMIT_ISSUER + \ 2898bb8aefdSYi Liu ORANGEFS_REQ_LIMIT_SIGNATURE + \ 2908bb8aefdSYi Liu extra_size_ORANGEFS_certificate) 291f7ab093fSMike Marshall 292f7ab093fSMike Marshall /* This structure is used by the VFS-client interaction alone */ 2938bb8aefdSYi Liu struct ORANGEFS_keyval_pair { 2948bb8aefdSYi Liu char key[ORANGEFS_MAX_XATTR_NAMELEN]; 295f7ab093fSMike Marshall __s32 key_sz; /* __s32 for portable, fixed-size structures */ 296f7ab093fSMike Marshall __s32 val_sz; 2978bb8aefdSYi Liu char val[ORANGEFS_MAX_XATTR_VALUELEN]; 298f7ab093fSMike Marshall }; 299f7ab093fSMike Marshall 300f7ab093fSMike Marshall /* pvfs2-sysint.h ***********************************************************/ 301f7ab093fSMike Marshall /* Describes attributes for a file, directory, or symlink. */ 3028bb8aefdSYi Liu struct ORANGEFS_sys_attr_s { 303f7ab093fSMike Marshall __u32 owner; 304f7ab093fSMike Marshall __u32 group; 305f7ab093fSMike Marshall __u32 perms; 306f7ab093fSMike Marshall __u64 atime; 307f7ab093fSMike Marshall __u64 mtime; 308f7ab093fSMike Marshall __u64 ctime; 309f7ab093fSMike Marshall __s64 size; 310f7ab093fSMike Marshall 311f7ab093fSMike Marshall /* NOTE: caller must free if valid */ 312f7ab093fSMike Marshall char *link_target; 313f7ab093fSMike Marshall 314f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 315f7ab093fSMike Marshall __s32 dfile_count; 316f7ab093fSMike Marshall 317f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 318f7ab093fSMike Marshall __s32 distr_dir_servers_initial; 319f7ab093fSMike Marshall 320f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 321f7ab093fSMike Marshall __s32 distr_dir_servers_max; 322f7ab093fSMike Marshall 323f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 324f7ab093fSMike Marshall __s32 distr_dir_split_size; 325f7ab093fSMike Marshall 326f7ab093fSMike Marshall __u32 mirror_copies_count; 327f7ab093fSMike Marshall 328f7ab093fSMike Marshall /* NOTE: caller must free if valid */ 329f7ab093fSMike Marshall char *dist_name; 330f7ab093fSMike Marshall 331f7ab093fSMike Marshall /* NOTE: caller must free if valid */ 332f7ab093fSMike Marshall char *dist_params; 333f7ab093fSMike Marshall 334f7ab093fSMike Marshall __s64 dirent_count; 3358bb8aefdSYi Liu enum orangefs_ds_type objtype; 336f7ab093fSMike Marshall __u64 flags; 337f7ab093fSMike Marshall __u32 mask; 338f7ab093fSMike Marshall __s64 blksize; 339f7ab093fSMike Marshall }; 340f7ab093fSMike Marshall 3418bb8aefdSYi Liu #define ORANGEFS_LOOKUP_LINK_NO_FOLLOW 0 3428bb8aefdSYi Liu #define ORANGEFS_LOOKUP_LINK_FOLLOW 1 343f7ab093fSMike Marshall 344f7ab093fSMike Marshall /* pint-dev.h ***************************************************************/ 345f7ab093fSMike Marshall 3468bb8aefdSYi Liu /* parameter structure used in ORANGEFS_DEV_DEBUG ioctl command */ 347f7ab093fSMike Marshall struct dev_mask_info_s { 348f7ab093fSMike Marshall enum { 349f7ab093fSMike Marshall KERNEL_MASK, 350f7ab093fSMike Marshall CLIENT_MASK, 351f7ab093fSMike Marshall } mask_type; 352f7ab093fSMike Marshall __u64 mask_value; 353f7ab093fSMike Marshall }; 354f7ab093fSMike Marshall 355f7ab093fSMike Marshall struct dev_mask2_info_s { 356f7ab093fSMike Marshall __u64 mask1_value; 357f7ab093fSMike Marshall __u64 mask2_value; 358f7ab093fSMike Marshall }; 359f7ab093fSMike Marshall 360f7ab093fSMike Marshall /* pvfs2-util.h *************************************************************/ 3618bb8aefdSYi Liu __s32 ORANGEFS_util_translate_mode(int mode); 362f7ab093fSMike Marshall 363f7ab093fSMike Marshall /* pvfs2-debug.h ************************************************************/ 364575e9461SMike Marshall #include "orangefs-debug.h" 365f7ab093fSMike Marshall 366f7ab093fSMike Marshall /* pvfs2-internal.h *********************************************************/ 367f7ab093fSMike Marshall #define llu(x) (unsigned long long)(x) 368f7ab093fSMike Marshall #define lld(x) (long long)(x) 369f7ab093fSMike Marshall 370f7ab093fSMike Marshall /* pint-dev-shared.h ********************************************************/ 3718bb8aefdSYi Liu #define ORANGEFS_DEV_MAGIC 'k' 372f7ab093fSMike Marshall 3738bb8aefdSYi Liu #define ORANGEFS_READDIR_DEFAULT_DESC_COUNT 5 374f7ab093fSMike Marshall 375f7ab093fSMike Marshall #define DEV_GET_MAGIC 0x1 376f7ab093fSMike Marshall #define DEV_GET_MAX_UPSIZE 0x2 377f7ab093fSMike Marshall #define DEV_GET_MAX_DOWNSIZE 0x3 378f7ab093fSMike Marshall #define DEV_MAP 0x4 379f7ab093fSMike Marshall #define DEV_REMOUNT_ALL 0x5 380f7ab093fSMike Marshall #define DEV_DEBUG 0x6 381f7ab093fSMike Marshall #define DEV_UPSTREAM 0x7 382f7ab093fSMike Marshall #define DEV_CLIENT_MASK 0x8 383f7ab093fSMike Marshall #define DEV_CLIENT_STRING 0x9 384f7ab093fSMike Marshall #define DEV_MAX_NR 0xa 385f7ab093fSMike Marshall 386f7ab093fSMike Marshall /* supported ioctls, codes are with respect to user-space */ 387f7ab093fSMike Marshall enum { 3888bb8aefdSYi Liu ORANGEFS_DEV_GET_MAGIC = _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAGIC, __s32), 3898bb8aefdSYi Liu ORANGEFS_DEV_GET_MAX_UPSIZE = 3908bb8aefdSYi Liu _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32), 3918bb8aefdSYi Liu ORANGEFS_DEV_GET_MAX_DOWNSIZE = 3928bb8aefdSYi Liu _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32), 3938bb8aefdSYi Liu ORANGEFS_DEV_MAP = _IO(ORANGEFS_DEV_MAGIC, DEV_MAP), 3948bb8aefdSYi Liu ORANGEFS_DEV_REMOUNT_ALL = _IO(ORANGEFS_DEV_MAGIC, DEV_REMOUNT_ALL), 3958bb8aefdSYi Liu ORANGEFS_DEV_DEBUG = _IOR(ORANGEFS_DEV_MAGIC, DEV_DEBUG, __s32), 3968bb8aefdSYi Liu ORANGEFS_DEV_UPSTREAM = _IOW(ORANGEFS_DEV_MAGIC, DEV_UPSTREAM, int), 3978bb8aefdSYi Liu ORANGEFS_DEV_CLIENT_MASK = _IOW(ORANGEFS_DEV_MAGIC, 398f7ab093fSMike Marshall DEV_CLIENT_MASK, 399f7ab093fSMike Marshall struct dev_mask2_info_s), 4008bb8aefdSYi Liu ORANGEFS_DEV_CLIENT_STRING = _IOW(ORANGEFS_DEV_MAGIC, 401f7ab093fSMike Marshall DEV_CLIENT_STRING, 402f7ab093fSMike Marshall char *), 4038bb8aefdSYi Liu ORANGEFS_DEV_MAXNR = DEV_MAX_NR, 404f7ab093fSMike Marshall }; 405f7ab093fSMike Marshall 406f7ab093fSMike Marshall /* 407f7ab093fSMike Marshall * version number for use in communicating between kernel space and user 40854804949SMike Marshall * space. Zero signifies the upstream version of the kernel module. 409f7ab093fSMike Marshall */ 4108bb8aefdSYi Liu #define ORANGEFS_KERNEL_PROTO_VERSION 0 411569dbfc6SMike Marshall #define ORANGEFS_MINIMUM_USERSPACE_VERSION 20904 412f7ab093fSMike Marshall 413f7ab093fSMike Marshall /* 4148bb8aefdSYi Liu * describes memory regions to map in the ORANGEFS_DEV_MAP ioctl. 415575e9461SMike Marshall * NOTE: See devorangefs-req.c for 32 bit compat structure. 416f7ab093fSMike Marshall * Since this structure has a variable-sized layout that is different 417f7ab093fSMike Marshall * on 32 and 64 bit platforms, we need to normalize to a 64 bit layout 418f7ab093fSMike Marshall * on such systems before servicing ioctl calls from user-space binaries 419f7ab093fSMike Marshall * that may be 32 bit! 420f7ab093fSMike Marshall */ 4218bb8aefdSYi Liu struct ORANGEFS_dev_map_desc { 422f7ab093fSMike Marshall void *ptr; 423f7ab093fSMike Marshall __s32 total_size; 424f7ab093fSMike Marshall __s32 size; 425f7ab093fSMike Marshall __s32 count; 426f7ab093fSMike Marshall }; 427f7ab093fSMike Marshall 428f7ab093fSMike Marshall /* gossip.h *****************************************************************/ 429f7ab093fSMike Marshall 430f7ab093fSMike Marshall #ifdef GOSSIP_DISABLE_DEBUG 431f7ab093fSMike Marshall #define gossip_debug(mask, format, f...) do {} while (0) 432f7ab093fSMike Marshall #else 433f7ab093fSMike Marshall extern __u64 gossip_debug_mask; 434f7ab093fSMike Marshall extern struct client_debug_mask client_debug_mask; 435f7ab093fSMike Marshall 436f7ab093fSMike Marshall /* try to avoid function call overhead by checking masks in macro */ 437f7ab093fSMike Marshall #define gossip_debug(mask, format, f...) \ 438f7ab093fSMike Marshall do { \ 439f7ab093fSMike Marshall if (gossip_debug_mask & mask) \ 440f7ab093fSMike Marshall printk(format, ##f); \ 441f7ab093fSMike Marshall } while (0) 442f7ab093fSMike Marshall #endif /* GOSSIP_DISABLE_DEBUG */ 443f7ab093fSMike Marshall 444f7ab093fSMike Marshall /* do file and line number printouts w/ the GNU preprocessor */ 445f7ab093fSMike Marshall #define gossip_ldebug(mask, format, f...) \ 446f7ab093fSMike Marshall gossip_debug(mask, "%s: " format, __func__, ##f) 447f7ab093fSMike Marshall 448f7ab093fSMike Marshall #define gossip_err printk 449f7ab093fSMike Marshall #define gossip_lerr(format, f...) \ 450f7ab093fSMike Marshall gossip_err("%s line %d: " format, \ 451f7ab093fSMike Marshall __FILE__, \ 452f7ab093fSMike Marshall __LINE__, \ 453f7ab093fSMike Marshall ##f) 454