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