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); 7850e01586SMike 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); 8650e01586SMike 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 103*894ac432SMartin Brandenburg 104*894ac432SMartin Brandenburg /* PVFS2 error codes are a signed 32-bit integer. Error codes are negative, but 105*894ac432SMartin Brandenburg * the sign is stripped before decoding. */ 106*894ac432SMartin Brandenburg 107*894ac432SMartin Brandenburg /* Bit 31 is not used since it is the sign. */ 108*894ac432SMartin Brandenburg 109*894ac432SMartin Brandenburg /* Bit 30 specifies that this is a PVFS2 error. A PVFS2 error is either an 110*894ac432SMartin Brandenburg * encoded errno value or a PVFS2 protocol error. */ 111f7ab093fSMike Marshall #define PVFS_ERROR_BIT (1 << 30) 112*894ac432SMartin Brandenburg 113*894ac432SMartin Brandenburg /* Bit 29 specifies that this is a PVFS2 protocol error and not an encoded 114*894ac432SMartin Brandenburg * errno value. */ 115f7ab093fSMike Marshall #define PVFS_NON_ERRNO_ERROR_BIT (1 << 29) 116f7ab093fSMike Marshall 117*894ac432SMartin Brandenburg /* Bits 9, 8, and 7 specify the error class, which encodes the section of 118*894ac432SMartin Brandenburg * server code the error originated in for logging purposes. It is not used 119*894ac432SMartin Brandenburg * in the kernel except to be masked out. */ 120*894ac432SMartin Brandenburg #define PVFS_ERROR_CLASS_BITS 0x380 121f7ab093fSMike Marshall 122*894ac432SMartin Brandenburg /* Bits 6 - 0 are reserved for the actual error code. */ 123*894ac432SMartin Brandenburg #define PVFS_ERROR_NUMBER_BITS 0x7f 124f7ab093fSMike Marshall 125*894ac432SMartin Brandenburg /* Encoded errno values are decoded by PINT_errno_mapping in pvfs2-utils.c. */ 126f7ab093fSMike Marshall 127*894ac432SMartin Brandenburg /* Our own PVFS2 protocol error codes. */ 128*894ac432SMartin Brandenburg #define PVFS_ECANCEL (1|PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT) 129*894ac432SMartin Brandenburg #define PVFS_EDEVINIT (2|PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT) 130*894ac432SMartin Brandenburg #define PVFS_EDETAIL (3|PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT) 131*894ac432SMartin Brandenburg #define PVFS_EHOSTNTFD (4|PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT) 132*894ac432SMartin Brandenburg #define PVFS_EADDRNTFD (5|PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT) 133*894ac432SMartin Brandenburg #define PVFS_ENORECVR (6|PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT) 134*894ac432SMartin Brandenburg #define PVFS_ETRYAGAIN (7|PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT) 135*894ac432SMartin Brandenburg #define PVFS_ENOTPVFS (8|PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT) 136*894ac432SMartin Brandenburg #define PVFS_ESECURITY (9|PVFS_NON_ERRNO_ERROR_BIT|PVFS_ERROR_BIT) 137f7ab093fSMike Marshall 138f7ab093fSMike Marshall /* permission bits */ 139f7ab093fSMike Marshall #define PVFS_O_EXECUTE (1 << 0) 140f7ab093fSMike Marshall #define PVFS_O_WRITE (1 << 1) 141f7ab093fSMike Marshall #define PVFS_O_READ (1 << 2) 142f7ab093fSMike Marshall #define PVFS_G_EXECUTE (1 << 3) 143f7ab093fSMike Marshall #define PVFS_G_WRITE (1 << 4) 144f7ab093fSMike Marshall #define PVFS_G_READ (1 << 5) 145f7ab093fSMike Marshall #define PVFS_U_EXECUTE (1 << 6) 146f7ab093fSMike Marshall #define PVFS_U_WRITE (1 << 7) 147f7ab093fSMike Marshall #define PVFS_U_READ (1 << 8) 148f7ab093fSMike Marshall /* no PVFS_U_VTX (sticky bit) */ 149f7ab093fSMike Marshall #define PVFS_G_SGID (1 << 10) 150f7ab093fSMike Marshall #define PVFS_U_SUID (1 << 11) 151f7ab093fSMike Marshall 152f7ab093fSMike Marshall /* definition taken from stdint.h */ 153f7ab093fSMike Marshall #define INT32_MAX (2147483647) 154f7ab093fSMike Marshall #define PVFS_ITERATE_START (INT32_MAX - 1) 155f7ab093fSMike Marshall #define PVFS_ITERATE_END (INT32_MAX - 2) 15688309aaeSMike Marshall #define PVFS_ITERATE_NEXT (INT32_MAX - 3) 157f7ab093fSMike Marshall #define PVFS_READDIR_START PVFS_ITERATE_START 158f7ab093fSMike Marshall #define PVFS_READDIR_END PVFS_ITERATE_END 159f7ab093fSMike Marshall #define PVFS_IMMUTABLE_FL FS_IMMUTABLE_FL 160f7ab093fSMike Marshall #define PVFS_APPEND_FL FS_APPEND_FL 161f7ab093fSMike Marshall #define PVFS_NOATIME_FL FS_NOATIME_FL 162f7ab093fSMike Marshall #define PVFS_MIRROR_FL 0x01000000ULL 163f7ab093fSMike Marshall #define PVFS_O_EXECUTE (1 << 0) 164f7ab093fSMike Marshall #define PVFS_FS_ID_NULL ((__s32)0) 165f7ab093fSMike Marshall #define PVFS_ATTR_SYS_UID (1 << 0) 166f7ab093fSMike Marshall #define PVFS_ATTR_SYS_GID (1 << 1) 167f7ab093fSMike Marshall #define PVFS_ATTR_SYS_PERM (1 << 2) 168f7ab093fSMike Marshall #define PVFS_ATTR_SYS_ATIME (1 << 3) 169f7ab093fSMike Marshall #define PVFS_ATTR_SYS_CTIME (1 << 4) 170f7ab093fSMike Marshall #define PVFS_ATTR_SYS_MTIME (1 << 5) 171f7ab093fSMike Marshall #define PVFS_ATTR_SYS_TYPE (1 << 6) 172f7ab093fSMike Marshall #define PVFS_ATTR_SYS_ATIME_SET (1 << 7) 173f7ab093fSMike Marshall #define PVFS_ATTR_SYS_MTIME_SET (1 << 8) 174f7ab093fSMike Marshall #define PVFS_ATTR_SYS_SIZE (1 << 20) 175f7ab093fSMike Marshall #define PVFS_ATTR_SYS_LNK_TARGET (1 << 24) 176f7ab093fSMike Marshall #define PVFS_ATTR_SYS_DFILE_COUNT (1 << 25) 177f7ab093fSMike Marshall #define PVFS_ATTR_SYS_DIRENT_COUNT (1 << 26) 178f7ab093fSMike Marshall #define PVFS_ATTR_SYS_BLKSIZE (1 << 28) 179f7ab093fSMike Marshall #define PVFS_ATTR_SYS_MIRROR_COPIES_COUNT (1 << 29) 180f7ab093fSMike Marshall #define PVFS_ATTR_SYS_COMMON_ALL \ 181f7ab093fSMike Marshall (PVFS_ATTR_SYS_UID | \ 182f7ab093fSMike Marshall PVFS_ATTR_SYS_GID | \ 183f7ab093fSMike Marshall PVFS_ATTR_SYS_PERM | \ 184f7ab093fSMike Marshall PVFS_ATTR_SYS_ATIME | \ 185f7ab093fSMike Marshall PVFS_ATTR_SYS_CTIME | \ 186f7ab093fSMike Marshall PVFS_ATTR_SYS_MTIME | \ 187f7ab093fSMike Marshall PVFS_ATTR_SYS_TYPE) 188f7ab093fSMike Marshall 189f7ab093fSMike Marshall #define PVFS_ATTR_SYS_ALL_SETABLE \ 190f7ab093fSMike Marshall (PVFS_ATTR_SYS_COMMON_ALL-PVFS_ATTR_SYS_TYPE) 191f7ab093fSMike Marshall 192f7ab093fSMike Marshall #define PVFS_ATTR_SYS_ALL_NOHINT \ 193f7ab093fSMike Marshall (PVFS_ATTR_SYS_COMMON_ALL | \ 194f7ab093fSMike Marshall PVFS_ATTR_SYS_SIZE | \ 195f7ab093fSMike Marshall PVFS_ATTR_SYS_LNK_TARGET | \ 196f7ab093fSMike Marshall PVFS_ATTR_SYS_DFILE_COUNT | \ 197f7ab093fSMike Marshall PVFS_ATTR_SYS_MIRROR_COPIES_COUNT | \ 198f7ab093fSMike Marshall PVFS_ATTR_SYS_DIRENT_COUNT | \ 199f7ab093fSMike Marshall PVFS_ATTR_SYS_BLKSIZE) 200f7ab093fSMike Marshall #define PVFS_XATTR_REPLACE 0x2 201f7ab093fSMike Marshall #define PVFS_XATTR_CREATE 0x1 202f7ab093fSMike Marshall #define PVFS_MAX_SERVER_ADDR_LEN 256 203f7ab093fSMike Marshall #define PVFS_NAME_MAX 256 204f7ab093fSMike Marshall /* 205f7ab093fSMike Marshall * max extended attribute name len as imposed by the VFS and exploited for the 206f7ab093fSMike Marshall * upcall request types. 207f7ab093fSMike Marshall * NOTE: Please retain them as multiples of 8 even if you wish to change them 208f7ab093fSMike Marshall * This is *NECESSARY* for supporting 32 bit user-space binaries on a 64-bit 209f7ab093fSMike Marshall * kernel. Due to implementation within DBPF, this really needs to be 210f7ab093fSMike Marshall * PVFS_NAME_MAX, which it was the same value as, but no reason to let it 211f7ab093fSMike Marshall * break if that changes in the future. 212f7ab093fSMike Marshall */ 213f7ab093fSMike Marshall #define PVFS_MAX_XATTR_NAMELEN PVFS_NAME_MAX /* Not the same as 214f7ab093fSMike Marshall * XATTR_NAME_MAX defined 215f7ab093fSMike Marshall * by <linux/xattr.h> 216f7ab093fSMike Marshall */ 217f7ab093fSMike Marshall #define PVFS_MAX_XATTR_VALUELEN 8192 /* Not the same as XATTR_SIZE_MAX 218f7ab093fSMike Marshall * defined by <linux/xattr.h> 219f7ab093fSMike Marshall */ 220f7ab093fSMike Marshall #define PVFS_MAX_XATTR_LISTLEN 16 /* Not the same as XATTR_LIST_MAX 221f7ab093fSMike Marshall * defined by <linux/xattr.h> 222f7ab093fSMike Marshall */ 223f7ab093fSMike Marshall /* 224f7ab093fSMike Marshall * PVFS I/O operation types, used in both system and server interfaces. 225f7ab093fSMike Marshall */ 226f7ab093fSMike Marshall enum PVFS_io_type { 227f7ab093fSMike Marshall PVFS_IO_READ = 1, 228f7ab093fSMike Marshall PVFS_IO_WRITE = 2 229f7ab093fSMike Marshall }; 230f7ab093fSMike Marshall 231f7ab093fSMike Marshall /* 232f7ab093fSMike Marshall * If this enum is modified the server parameters related to the precreate pool 233f7ab093fSMike Marshall * batch and low threshold sizes may need to be modified to reflect this 234f7ab093fSMike Marshall * change. 235f7ab093fSMike Marshall */ 236f7ab093fSMike Marshall enum pvfs2_ds_type { 237f7ab093fSMike Marshall PVFS_TYPE_NONE = 0, 238f7ab093fSMike Marshall PVFS_TYPE_METAFILE = (1 << 0), 239f7ab093fSMike Marshall PVFS_TYPE_DATAFILE = (1 << 1), 240f7ab093fSMike Marshall PVFS_TYPE_DIRECTORY = (1 << 2), 241f7ab093fSMike Marshall PVFS_TYPE_SYMLINK = (1 << 3), 242f7ab093fSMike Marshall PVFS_TYPE_DIRDATA = (1 << 4), 243f7ab093fSMike Marshall PVFS_TYPE_INTERNAL = (1 << 5) /* for the server's private use */ 244f7ab093fSMike Marshall }; 245f7ab093fSMike Marshall 246f7ab093fSMike Marshall /* 247f7ab093fSMike Marshall * PVFS_certificate simply stores a buffer with the buffer size. 248f7ab093fSMike Marshall * The buffer can be converted to an OpenSSL X509 struct for use. 249f7ab093fSMike Marshall */ 250f7ab093fSMike Marshall struct PVFS_certificate { 251f7ab093fSMike Marshall __u32 buf_size; 252f7ab093fSMike Marshall unsigned char *buf; 253f7ab093fSMike Marshall }; 254f7ab093fSMike Marshall 255f7ab093fSMike Marshall /* 256f7ab093fSMike Marshall * A credential identifies a user and is signed by the client/user 257f7ab093fSMike Marshall * private key. 258f7ab093fSMike Marshall */ 259f7ab093fSMike Marshall struct PVFS_credential { 260f7ab093fSMike Marshall __u32 userid; /* user id */ 261f7ab093fSMike Marshall __u32 num_groups; /* length of group_array */ 262f7ab093fSMike Marshall __u32 *group_array; /* groups for which the user is a member */ 263f7ab093fSMike Marshall char *issuer; /* alias of the issuing server */ 264f7ab093fSMike Marshall __u64 timeout; /* seconds after epoch to time out */ 265f7ab093fSMike Marshall __u32 sig_size; /* length of the signature in bytes */ 266f7ab093fSMike Marshall unsigned char *signature; /* digital signature */ 267f7ab093fSMike Marshall struct PVFS_certificate certificate; /* user certificate buffer */ 268f7ab093fSMike Marshall }; 269f7ab093fSMike Marshall #define extra_size_PVFS_credential (PVFS_REQ_LIMIT_GROUPS * \ 270f7ab093fSMike Marshall sizeof(__u32) + \ 271f7ab093fSMike Marshall PVFS_REQ_LIMIT_ISSUER + \ 272f7ab093fSMike Marshall PVFS_REQ_LIMIT_SIGNATURE + \ 273f7ab093fSMike Marshall extra_size_PVFS_certificate) 274f7ab093fSMike Marshall 275f7ab093fSMike Marshall /* This structure is used by the VFS-client interaction alone */ 276f7ab093fSMike Marshall struct PVFS_keyval_pair { 277f7ab093fSMike Marshall char key[PVFS_MAX_XATTR_NAMELEN]; 278f7ab093fSMike Marshall __s32 key_sz; /* __s32 for portable, fixed-size structures */ 279f7ab093fSMike Marshall __s32 val_sz; 280f7ab093fSMike Marshall char val[PVFS_MAX_XATTR_VALUELEN]; 281f7ab093fSMike Marshall }; 282f7ab093fSMike Marshall 283f7ab093fSMike Marshall /* pvfs2-sysint.h ***********************************************************/ 284f7ab093fSMike Marshall /* Describes attributes for a file, directory, or symlink. */ 285f7ab093fSMike Marshall struct PVFS_sys_attr_s { 286f7ab093fSMike Marshall __u32 owner; 287f7ab093fSMike Marshall __u32 group; 288f7ab093fSMike Marshall __u32 perms; 289f7ab093fSMike Marshall __u64 atime; 290f7ab093fSMike Marshall __u64 mtime; 291f7ab093fSMike Marshall __u64 ctime; 292f7ab093fSMike Marshall __s64 size; 293f7ab093fSMike Marshall 294f7ab093fSMike Marshall /* NOTE: caller must free if valid */ 295f7ab093fSMike Marshall char *link_target; 296f7ab093fSMike Marshall 297f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 298f7ab093fSMike Marshall __s32 dfile_count; 299f7ab093fSMike Marshall 300f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 301f7ab093fSMike Marshall __s32 distr_dir_servers_initial; 302f7ab093fSMike Marshall 303f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 304f7ab093fSMike Marshall __s32 distr_dir_servers_max; 305f7ab093fSMike Marshall 306f7ab093fSMike Marshall /* Changed to __s32 so that size of structure does not change */ 307f7ab093fSMike Marshall __s32 distr_dir_split_size; 308f7ab093fSMike Marshall 309f7ab093fSMike Marshall __u32 mirror_copies_count; 310f7ab093fSMike Marshall 311f7ab093fSMike Marshall /* NOTE: caller must free if valid */ 312f7ab093fSMike Marshall char *dist_name; 313f7ab093fSMike Marshall 314f7ab093fSMike Marshall /* NOTE: caller must free if valid */ 315f7ab093fSMike Marshall char *dist_params; 316f7ab093fSMike Marshall 317f7ab093fSMike Marshall __s64 dirent_count; 318f7ab093fSMike Marshall enum pvfs2_ds_type objtype; 319f7ab093fSMike Marshall __u64 flags; 320f7ab093fSMike Marshall __u32 mask; 321f7ab093fSMike Marshall __s64 blksize; 322f7ab093fSMike Marshall }; 323f7ab093fSMike Marshall 324f7ab093fSMike Marshall #define PVFS2_LOOKUP_LINK_NO_FOLLOW 0 325f7ab093fSMike Marshall #define PVFS2_LOOKUP_LINK_FOLLOW 1 326f7ab093fSMike Marshall 327f7ab093fSMike Marshall /* pint-dev.h ***************************************************************/ 328f7ab093fSMike Marshall 329f7ab093fSMike Marshall /* parameter structure used in PVFS_DEV_DEBUG ioctl command */ 330f7ab093fSMike Marshall struct dev_mask_info_s { 331f7ab093fSMike Marshall enum { 332f7ab093fSMike Marshall KERNEL_MASK, 333f7ab093fSMike Marshall CLIENT_MASK, 334f7ab093fSMike Marshall } mask_type; 335f7ab093fSMike Marshall __u64 mask_value; 336f7ab093fSMike Marshall }; 337f7ab093fSMike Marshall 338f7ab093fSMike Marshall struct dev_mask2_info_s { 339f7ab093fSMike Marshall __u64 mask1_value; 340f7ab093fSMike Marshall __u64 mask2_value; 341f7ab093fSMike Marshall }; 342f7ab093fSMike Marshall 343f7ab093fSMike Marshall /* pvfs2-util.h *************************************************************/ 344f7ab093fSMike Marshall __s32 PVFS_util_translate_mode(int mode); 345f7ab093fSMike Marshall 346f7ab093fSMike Marshall /* pvfs2-debug.h ************************************************************/ 347f7ab093fSMike Marshall #include "pvfs2-debug.h" 348f7ab093fSMike Marshall 349f7ab093fSMike Marshall /* pvfs2-internal.h *********************************************************/ 350f7ab093fSMike Marshall #define llu(x) (unsigned long long)(x) 351f7ab093fSMike Marshall #define lld(x) (long long)(x) 352f7ab093fSMike Marshall 353f7ab093fSMike Marshall /* pint-dev-shared.h ********************************************************/ 354f7ab093fSMike Marshall #define PVFS_DEV_MAGIC 'k' 355f7ab093fSMike Marshall 356f7ab093fSMike Marshall #define PVFS2_READDIR_DEFAULT_DESC_COUNT 5 357f7ab093fSMike Marshall 358f7ab093fSMike Marshall #define DEV_GET_MAGIC 0x1 359f7ab093fSMike Marshall #define DEV_GET_MAX_UPSIZE 0x2 360f7ab093fSMike Marshall #define DEV_GET_MAX_DOWNSIZE 0x3 361f7ab093fSMike Marshall #define DEV_MAP 0x4 362f7ab093fSMike Marshall #define DEV_REMOUNT_ALL 0x5 363f7ab093fSMike Marshall #define DEV_DEBUG 0x6 364f7ab093fSMike Marshall #define DEV_UPSTREAM 0x7 365f7ab093fSMike Marshall #define DEV_CLIENT_MASK 0x8 366f7ab093fSMike Marshall #define DEV_CLIENT_STRING 0x9 367f7ab093fSMike Marshall #define DEV_MAX_NR 0xa 368f7ab093fSMike Marshall 369f7ab093fSMike Marshall /* supported ioctls, codes are with respect to user-space */ 370f7ab093fSMike Marshall enum { 371f7ab093fSMike Marshall PVFS_DEV_GET_MAGIC = _IOW(PVFS_DEV_MAGIC, DEV_GET_MAGIC, __s32), 372f7ab093fSMike Marshall PVFS_DEV_GET_MAX_UPSIZE = 373f7ab093fSMike Marshall _IOW(PVFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32), 374f7ab093fSMike Marshall PVFS_DEV_GET_MAX_DOWNSIZE = 375f7ab093fSMike Marshall _IOW(PVFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32), 376f7ab093fSMike Marshall PVFS_DEV_MAP = _IO(PVFS_DEV_MAGIC, DEV_MAP), 377f7ab093fSMike Marshall PVFS_DEV_REMOUNT_ALL = _IO(PVFS_DEV_MAGIC, DEV_REMOUNT_ALL), 378f7ab093fSMike Marshall PVFS_DEV_DEBUG = _IOR(PVFS_DEV_MAGIC, DEV_DEBUG, __s32), 379f7ab093fSMike Marshall PVFS_DEV_UPSTREAM = _IOW(PVFS_DEV_MAGIC, DEV_UPSTREAM, int), 380f7ab093fSMike Marshall PVFS_DEV_CLIENT_MASK = _IOW(PVFS_DEV_MAGIC, 381f7ab093fSMike Marshall DEV_CLIENT_MASK, 382f7ab093fSMike Marshall struct dev_mask2_info_s), 383f7ab093fSMike Marshall PVFS_DEV_CLIENT_STRING = _IOW(PVFS_DEV_MAGIC, 384f7ab093fSMike Marshall DEV_CLIENT_STRING, 385f7ab093fSMike Marshall char *), 386f7ab093fSMike Marshall PVFS_DEV_MAXNR = DEV_MAX_NR, 387f7ab093fSMike Marshall }; 388f7ab093fSMike Marshall 389f7ab093fSMike Marshall /* 390f7ab093fSMike Marshall * version number for use in communicating between kernel space and user 391f7ab093fSMike Marshall * space 392f7ab093fSMike Marshall */ 393f7ab093fSMike Marshall /* 394f7ab093fSMike Marshall #define PVFS_KERNEL_PROTO_VERSION \ 395f7ab093fSMike Marshall ((PVFS2_VERSION_MAJOR * 10000) + \ 396f7ab093fSMike Marshall (PVFS2_VERSION_MINOR * 100) + \ 397f7ab093fSMike Marshall PVFS2_VERSION_SUB) 398f7ab093fSMike Marshall */ 399f7ab093fSMike Marshall #define PVFS_KERNEL_PROTO_VERSION 0 400f7ab093fSMike Marshall 401f7ab093fSMike Marshall /* 402f7ab093fSMike Marshall * describes memory regions to map in the PVFS_DEV_MAP ioctl. 403f7ab093fSMike Marshall * NOTE: See devpvfs2-req.c for 32 bit compat structure. 404f7ab093fSMike Marshall * Since this structure has a variable-sized layout that is different 405f7ab093fSMike Marshall * on 32 and 64 bit platforms, we need to normalize to a 64 bit layout 406f7ab093fSMike Marshall * on such systems before servicing ioctl calls from user-space binaries 407f7ab093fSMike Marshall * that may be 32 bit! 408f7ab093fSMike Marshall */ 409f7ab093fSMike Marshall struct PVFS_dev_map_desc { 410f7ab093fSMike Marshall void *ptr; 411f7ab093fSMike Marshall __s32 total_size; 412f7ab093fSMike Marshall __s32 size; 413f7ab093fSMike Marshall __s32 count; 414f7ab093fSMike Marshall }; 415f7ab093fSMike Marshall 416f7ab093fSMike Marshall /* gossip.h *****************************************************************/ 417f7ab093fSMike Marshall 418f7ab093fSMike Marshall #ifdef GOSSIP_DISABLE_DEBUG 419f7ab093fSMike Marshall #define gossip_debug(mask, format, f...) do {} while (0) 420f7ab093fSMike Marshall #else 421f7ab093fSMike Marshall extern __u64 gossip_debug_mask; 422f7ab093fSMike Marshall extern struct client_debug_mask client_debug_mask; 423f7ab093fSMike Marshall 424f7ab093fSMike Marshall /* try to avoid function call overhead by checking masks in macro */ 425f7ab093fSMike Marshall #define gossip_debug(mask, format, f...) \ 426f7ab093fSMike Marshall do { \ 427f7ab093fSMike Marshall if (gossip_debug_mask & mask) \ 428f7ab093fSMike Marshall printk(format, ##f); \ 429f7ab093fSMike Marshall } while (0) 430f7ab093fSMike Marshall #endif /* GOSSIP_DISABLE_DEBUG */ 431f7ab093fSMike Marshall 432f7ab093fSMike Marshall /* do file and line number printouts w/ the GNU preprocessor */ 433f7ab093fSMike Marshall #define gossip_ldebug(mask, format, f...) \ 434f7ab093fSMike Marshall gossip_debug(mask, "%s: " format, __func__, ##f) 435f7ab093fSMike Marshall 436f7ab093fSMike Marshall #define gossip_err printk 437f7ab093fSMike Marshall #define gossip_lerr(format, f...) \ 438f7ab093fSMike Marshall gossip_err("%s line %d: " format, \ 439f7ab093fSMike Marshall __FILE__, \ 440f7ab093fSMike Marshall __LINE__, \ 441f7ab093fSMike Marshall ##f) 442