/*************************************************************************** * * Copyright (C) 2001 International Business Machines * All rights reserved. * * This file is part of the GPFS mmfslinux kernel module. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *************************************************************************** */ /* @(#)93 1.85 src/avs/fs/mmfs/ts/kernext/ibm-kxi/cxiTypes.h, mmfs, avs_rgpfs24, rgpfs24s001a 3/27/06 10:57:53 */ /* * Basic types used throughout GPFS. Since GPFS shares data between its * daemon and its kernel pieces, types must be defined consistently, rather * than relying on platform-specific include files. This file may be * included in either C or C++ code. * */ #ifndef _h_cxiTypes #define _h_cxiTypes /* Types to use when the number of bits in a word is important. Use these instead of long, short, int, etc. for portability */ typedef short Int16; typedef int Int32; typedef long long Int64; typedef unsigned short UInt16; typedef unsigned int UInt32; typedef unsigned long long UInt64; typedef unsigned char UChar; typedef unsigned short UShort; typedef long Ptrdiff; /* Use these instead of Int or UInt for padding in structures that are sent in RPCs. These types will not be byte-swapped when sent between nodes having different endian value. */ typedef short Pad16; typedef int Pad32; /* Use these for fields send in RPCs that should not be byte-swapped */ typedef int Opaque32; typedef unsigned long long Opaque64; /* Use this as the return value type for functions that return a local system errno value, to make it clear that the function is called from outside of GPFS and does not return a GPFS Errno. */ typedef int IntRC; #define MAX_UINT64 ((UInt64)(0xFFFFFFFFFFFFFFFFuLL)) #define MAX_INT64 ((Int64)(0x7FFFFFFFFFFFFFFFuLL)) #define MAX_UINT32 ((UInt32)0xFFFFFFFF) #define MAX_INT32 ((Int32)0x7FFFFFFF) #define MIN_INT32 ((Int32)0x80000000) #define MAX_UINT16 ((UInt16)0xFFFF) #define MAX_INT16 ((Int16)0x7FFF) #define MIN_INT16 ((Int16)0x8000) /* Macros to fetch the high and low 32 bits of an Int64 */ #define High32(_i) ((Int32) (((UInt64)(_i))>>32)) #define Low32(_i) ((UInt32) ((_i)&0xFFFFFFFF)) /* Use types to safely allow integer to ptr assignment and vice-versa; defined for maximum portability (instead of using intptr_t/uintptr_t) */ typedef signed long IntPtr; typedef unsigned long UIntPtr; /* Define macros to typecast a pointer in a failsafe manner */ #define INTPTR(_p) ((IntPtr)(_p)) #define UINTPTR(_p) ((UIntPtr)(_p)) /* Conversion macros for pointers and 32-bit integers */ /* Use when intentionally converting to/from 32-bit integers and pointers so that useless compiler warnings are suppressed. */ #define PTR_TO_INT32(_p) ((Int32)(IntPtr)(_p)) #define PTR_TO_UINT32(_p) ((UInt32)(UIntPtr)(_p)) #define INT32_TO_PTR(_i) ((void *)(IntPtr)(_i)) #define UINT32_TO_PTR(_i) ((void *)(UIntPtr)(_i)) #define PTR_TO_INT64(_p) ((Int64)(IntPtr)(_p)) #define PTR_TO_UINT64(_p) ((UInt64)(UIntPtr)(_p)) #define UINT64_TO_PTR(_i) ((void *)(UIntPtr)(_i)) /* Lockword type for mutexes */ #ifdef __64BIT__ typedef unsigned long lockWord_t; #else typedef unsigned int lockWord_t; #endif /* 64b */ /* Boolean type */ typedef unsigned int Boolean; typedef char cBoolean; #define false 0 #define FALSE 0 #define true 1 #define TRUE 1 #ifndef EXTERNC #ifdef __cplusplus #define EXTERNC extern "C" #else #define EXTERNC extern #endif #endif /* EXTERNC */ /* Command parameters given to gpfsSetattr() */ #ifndef V_MODE /* set mode */ #define V_MODE 0x01 #endif #ifndef V_OWN /* set owner */ #define V_OWN 0x02 #endif #ifndef V_UTIME /* set atime and mtime */ #define V_UTIME 0x04 #endif #ifndef V_STIME /* set atime, mtime, and ctime */ #define V_STIME 0x08 #endif #ifndef V_NTIME /* set atime, mtime, and ctime to now */ #define V_NTIME 0x10 #endif #ifndef V_SIZE /* set file size */ #define V_SIZE 0x20 #endif #define CXIDEVNONE (cxiDev_t)(-1U) /* AIX SHM_RDONLY sys/shm.h */ #define CXI_SHM_RDONLY 010000 /* Macros to compute minimum and maximum of two numbers */ #ifndef MIN #define MIN(a,b) (((a)<(b))?(a):(b)) #endif #ifndef MAX #define MAX(a,b) (((a)>(b))?(a):(b)) #endif /* Make sure null pointer definition is always available */ #ifndef NULL #define NULL 0 #endif /* Macro to compute the offset of a field within a structure */ #if defined(__GNUC__) && (__GNUC__ >= 3) /* gcc 3.x: avoid warning msg "invalid offsetof from non-POD type: ..." */ #define OFFSET_OF(_field, _struct) \ (Int32) ( (char*)&((_struct *)16)->_field - (char*)16 ) #else #define OFFSET_OF(_field, _struct) ( (long) ( &((_struct *)0)->_field ) ) #endif /* Identifier of a thread. Always 32 bits, even if native thread IDs are longer on some platforms. The value cxiNoThread denotes an invalid thread ID. */ typedef Int32 cxiThreadId; #define cxiNoThread 0 #if !defined(GPFS_LINUX) && defined(__64BIT__) typedef Int64 cxiPid_t; #else typedef Int32 cxiPid_t; #endif typedef Int64 cxiPid64_t; typedef Int32 cxiPid32_t; typedef Int32 cxiKey_t; /* Needed since mode_t is short in linux kernel */ typedef UInt32 cxiMode_t; typedef UInt32 cxiUid_t; typedef UInt32 cxiGid_t; typedef UInt32 cxiIno_t; /* gpfs inode number */ /* Original AIX sizes for dev_t. Special device files continue to * record their major/minor numbers as 32 bits on disk. */ typedef UInt32 cxiDev32_t; typedef UInt32 cxiTime32_t; /* seconds time type */ typedef UInt32 cxiNSec32_t; /* nanoseconds time type */ typedef unsigned long cxiSize_t; /* File system type within cxiStatfs_t */ typedef struct cxiFsid_t { unsigned long val[2]; } cxiFsid_t; /* Interface structure for gpfsStatfs() */ typedef struct cxiStatfs_t { UInt64 f_blocks; /* total data blocks in file system */ UInt64 f_bfree; /* free block in fs */ UInt64 f_bavail; /* free blocks avail to non-superuser */ int f_bsize; /* optimal file system block size */ int f_files; /* total file nodes in file system */ int f_ffree; /* free file nodes in fs */ cxiFsid_t f_fsid; /* file system id */ int f_fsize; /* fundamental file system block size */ char f_fname[32]; /* file system name (usually mount pt.) */ char f_fpack[32]; /* file system pack name */ int f_name_max; /* maximum component name length for posix */ } cxiStatfs_t; /* l_caller values */ #define L_CALLER_NULL 0 #define L_CALLER_LOCKD 1 /* Advisory record locking interface structure */ typedef long long cxiOff64_t; typedef struct cxiFlock_t { short l_type; short l_whence; unsigned int l_sysid; cxiPid_t l_pid; #ifndef GPFS_LINUX int l_vfs; #else int l_caller; #endif cxiOff64_t l_start; cxiOff64_t l_len; void * l_owner; void * l_file; void * l_lmops; unsigned char l_flags; /* defines for l_flags */ #define FL_RECLAIM 64 /* lock reclaim */ } cxiFlock_t; /* flock l_type constants are OS dependent. When sending F_GETLK * results between nodes, they must be mapped to generic constants * and then back to OS-specific values by the receiving node. */ #define GENERIC_F_RDLCK 1 #define GENERIC_F_WRLCK 2 #define GENERIC_F_UNLCK 3 #define L_TYPE_OUT(lt) \ ((lt) == F_RDLCK)? GENERIC_F_RDLCK: \ ((lt) == F_WRLCK)? GENERIC_F_WRLCK: \ ((lt) == F_UNLCK)? GENERIC_F_UNLCK: lt; \ #define L_TYPE_IN(lt) \ ((lt) == GENERIC_F_RDLCK)? F_RDLCK: \ ((lt) == GENERIC_F_WRLCK)? F_WRLCK: \ ((lt) == GENERIC_F_UNLCK)? F_UNLCK: lt; \ #ifndef GPFS_LINUX #define cxiFlock2Common( cxiCommonP, cxiP ) \ { \ (cxiCommonP)->l_type = L_TYPE_OUT((cxiP)->l_type); \ (cxiCommonP)->l_whence = (cxiP)->l_whence; \ (cxiCommonP)->l_sysid = (cxiP)->l_sysid; \ (cxiCommonP)->l_pid = (cxiPid64_t)(cxiP)->l_pid; \ (cxiCommonP)->l_vfs = (cxiP)->l_vfs; \ (cxiCommonP)->l_start = (cxiP)->l_start; \ (cxiCommonP)->l_len = (cxiP)->l_len; \ (cxiCommonP)->l_owner = (UInt64)(cxiP)->l_owner; \ }; #define cxiCommon2Flock( cxiP, cxiCommonP ) \ { \ (cxiP)->l_type = L_TYPE_IN((cxiCommonP)->l_type); \ (cxiP)->l_whence = (cxiCommonP)->l_whence; \ (cxiP)->l_sysid = (cxiCommonP)->l_sysid; \ (cxiP)->l_pid = (cxiPid_t)(cxiCommonP)->l_pid; \ (cxiP)->l_vfs = (cxiCommonP)->l_vfs; \ (cxiP)->l_start = (cxiCommonP)->l_start; \ (cxiP)->l_len = (cxiCommonP)->l_len; \ (cxiP)->l_owner = (void *)(cxiCommonP)->l_owner; \ }; #else #define cxiFlock2Common( cxiCommonP, cxiP ) \ { \ (cxiCommonP)->l_type = L_TYPE_OUT((cxiP)->l_type); \ (cxiCommonP)->l_whence = (cxiP)->l_whence; \ (cxiCommonP)->l_sysid = (cxiP)->l_sysid; \ (cxiCommonP)->l_pid = (cxiPid64_t)(cxiP)->l_pid; \ (cxiCommonP)->l_caller = (cxiP)->l_caller; \ (cxiCommonP)->l_start = (cxiP)->l_start; \ (cxiCommonP)->l_len = (cxiP)->l_len; \ (cxiCommonP)->l_owner = PTR_TO_UINT64((cxiP)->l_owner); \ }; #define cxiCommon2Flock( cxiP, cxiCommonP ) \ { \ (cxiP)->l_type = L_TYPE_IN((cxiCommonP)->l_type); \ (cxiP)->l_whence = (cxiCommonP)->l_whence; \ (cxiP)->l_sysid = (cxiCommonP)->l_sysid; \ (cxiP)->l_pid = (cxiPid_t)(cxiCommonP)->l_pid; \ (cxiP)->l_caller = (cxiCommonP)->l_caller; \ (cxiP)->l_start = (cxiCommonP)->l_start; \ (cxiP)->l_len = (cxiCommonP)->l_len; \ (cxiP)->l_owner = (void *)(UIntPtr)(cxiCommonP)->l_owner; \ }; #endif /* !GPFS_LINUX */ typedef enum cxiTrace_t { cxiTraceNFS = 0, /* trace linux nfs activity via printk */ cxiTraceNFSoff = 1 /* stop tracing of linux nfs activity */ } cxiTrace_t; /* DMAPI operation context */ typedef enum cxiContext_t { unknownOp = 0, /* invalid or unknown operation type */ vnOp = 1, /* vnode operation */ reservedFileOp = 2, /* quota operation (quota check, asyncRecovery) */ generalOp = 3, /* general (not vnop) operation */ /* must place all non-dm contexts above this line */ /* must place dmOp context on next line, and all other dm contexts after it */ dmOp = 4, /* non-file-related DM operation */ dmOpWithToken = 5, /* File-related DM operation with a DM token */ dmOpWithoutToken = 6, /* File-related DM operation without a token */ dmOpInvalidToken = 7, /* File-related DM operation with an invalid token */ dmOpAccessControl = 8 /* DM operation that acquires/releases access rights */ } cxiContext_t; #define CXI_D_NAME_MAX 255 /* _D_NAME_MAX sys/dir.h */ #define CXI_DEV_BSIZE 512 /* DEV_BSIZE AIX sys/dir.h */ #define CXI_MAXNAMLEN 255 /* MAXNAMLEN AIX sys/dir.h */ #define CXI_MAXPATHLEN 1024 /* MAXPATHLEN AIX sys/param.h */ #define CXI_PATH_MAX 1023 /* PATH_MAX AIX sys/limits.h */ /* This macro verifies if a given operation context is one of DMAPI contexts */ #define IS_DM_CONTEXT(opContext) ((opContext < dmOp) ? false : true) /* Operations supported by gpfsReadWrite */ typedef enum cxiRdWr_t { CXI_READ, CXI_WRITE, CXI_READ_NO_MOVE, CXI_WRITE_NO_MOVE } cxiRdWr_t; /* Forward declarations */ struct gpfsVfsData_t; struct ext_cred_t; /* Macros to convert integers of various sizes from big endian to little endian or vice versa. Do not use these directly; use either the ByteSwapxx routines defined in cxiTypes-plat.h or the BigEndToCPUxx/CPUToBigEndxx macros instead. */ #define _ByteSwap16(d) \ ((UInt16)((((UInt16)(d) >> 8) & 0x00FFU) | \ (((UInt16)(d) << 8) & 0xFF00U))) #define _ByteSwap32(d) \ ((UInt32)((((UInt32)(d) >> 24) & 0x000000FFU) | \ (((UInt32)(d) >> 8) & 0x0000FF00U) | \ (((UInt32)(d) << 8) & 0x00FF0000U) | \ (((UInt32)(d) << 24) & 0xFF000000U))) #define _ByteSwap64(d) \ ((UInt64)((((UInt64)(d) >> 56) & 0x00000000000000FFULL) | \ (((UInt64)(d) >> 40) & 0x000000000000FF00ULL) | \ (((UInt64)(d) >> 24) & 0x0000000000FF0000ULL) | \ (((UInt64)(d) >> 8) & 0x00000000FF000000ULL) | \ (((UInt64)(d) << 8) & 0x000000FF00000000ULL) | \ (((UInt64)(d) << 24) & 0x0000FF0000000000ULL) | \ (((UInt64)(d) << 40) & 0x00FF000000000000ULL) | \ (((UInt64)(d) << 56) & 0xFF00000000000000ULL))) /* Include platform specific types */ #include /* Macros to be used when switching data from big endian to * the endian-ness of the CPU */ #ifdef GPFS_LITTLE_ENDIAN #define BigEndToCPU16(d) ByteSwap16(d) #define BigEndToCPU32(d) ByteSwap32(d) #define BigEndToCPU64(d) ByteSwap64(d) #define CPUToBigEnd16(d) ByteSwap16(d) #define CPUToBigEnd32(d) ByteSwap32(d) #define CPUToBigEnd64(d) ByteSwap64(d) #else #define BigEndToCPU16(d) (d) #define BigEndToCPU32(d) (d) #define BigEndToCPU64(d) (d) #define CPUToBigEnd16(d) (d) #define CPUToBigEnd32(d) (d) #define CPUToBigEnd64(d) (d) #endif /* Macros to get the endian-ness and word size of this CPU */ #ifdef GPFS_LITTLE_ENDIAN #define NodeBigEndian false #else #define NodeBigEndian true #endif typedef enum { OSTYPE_AIX, OSTYPE_LINUX } OSType; #define ostypeToStr(T) \ (((T) == OSTYPE_AIX) ? "AIX" : \ ((T) == OSTYPE_LINUX ) ? "Linux" : \ "unknown") #ifdef GPFS_LINUX #define NodeOperatingSystem OSTYPE_LINUX #else #define NodeOperatingSystem OSTYPE_AIX #endif #ifdef __64BIT__ #define NodeWordSize 64 #else #define NodeWordSize 32 #endif /* Retrieve the file type from the mode and translate it to cxiNodeType_t */ #define CXIMODE_TO_NODETYPE(M) (modeToNodeType[((M) & S_IFMT) >> 12]) /* Invariant size time structure. */ typedef struct cxiTimeStruc32_t { cxiTime32_t tv_sec; /* seconds */ cxiNSec32_t tv_nsec; /* nanoseconds */ } cxiTimeStruc32_t; /* May be 32/64 bit specific depending on how OS defines * cxiTime_t (cxiTypes-plat.h). On AIX cxiTime_t (time_t) is * an int32long64 and cxiNSec_t (suseconds_t) is a signed int. * Nanoseconds can always be represented within 32 bits, however * on linux it's a long int, which would change size for 64bits. */ typedef struct cxiTimeStruc_t { cxiTime_t tv_sec; /* seconds */ cxiNSec_t tv_nsec; /* nanoseconds */ } cxiTimeStruc_t; /* Must match struct vattr on AIX */ typedef struct cxiVattr_t { int va_type; /* vnode type */ cxiMode_t va_mode; /* access mode */ cxiUid_t va_uid; /* owner uid */ cxiGid_t va_gid; /* owner gid */ union { cxiDev_t _va_dev; /* id of device containing file */ long _va_fsid; /* fs id (dev for now) */ } _vattr_union; cxiInoSys_t va_serialno; /* file serial (inode) number */ short va_nlink; /* number of links */ short va_flags; /* Flags, see below for define */ long va_mask; /* Initial attribute mask */ cxiOff64_t va_size; /* file size in bytes */ long va_blocksize; /* preferred blocksize for io */ long va_blocks; /* kbytes of disk held by file */ /* The following three fields use the 32/64 bit dependent * cxiTimeStruc_t since the AIX vattr structure defines these * with timestruc_t which has time_t field. */ cxiTimeStruc_t va_atime; /* time of last access */ cxiTimeStruc_t va_mtime; /* time of last data modification */ cxiTimeStruc_t va_ctime; /* time of last status change */ cxiDev_t va_rdev; /* id of device */ /* Fields added for compatability with the fullstat structure */ long va_nid; /* unused (node id on AIX) */ int va_chan; /* unused (channel on AIX) */ char *va_acl; /* unused (Access Control List on AIX) */ cxiSize_t va_xinfo; /* Extended info field (defined below) (AIX: cxiSize_t va_aclsiz (size of ACL)) */ int va_gen; /* inode generation number */ } cxiVattr_t; /* Define bit flags for the extended information field */ #define VA_XPERM 0x0001 // file has extended ACL #define VA_XVOL 0x0002 // dir entry was generated and is volatile /* Macros to recognize artificial, unique inode numbers for snapshot link direcories and snapshot root directories. */ #define SNAPROOTDIR_EXT_INO_BASE 0xFFFF0000 #define IS_SNAPROOTDIR_EXT_INO(ino) ((UInt32)(ino) > SNAPROOTDIR_EXT_INO_BASE) #define IS_SNAPLINKDIR_EXT_INO(ino) ((UInt32)(ino) == SNAPROOTDIR_EXT_INO_BASE) #define SNAPROOTDIR_INT_INO (3) #ifdef va_dev #undef va_dev #endif #ifdef va_fsid #undef va_fsid #endif #define va_dev _vattr_union._va_dev #define va_fsid _vattr_union._va_fsid /* Based on the AIX definition */ typedef struct cxiIovec_t { char *iov_base; cxiSize_t iov_len; } cxiIovec_t; typedef struct cxiErrorLogEntry_t { short logErrorType; /* One of the values #defined below */ /* Fields common for all types of errors */ UInt32 logRecTag; /* Tag to associate related log entries */ char *componentName; /* Name of the malfunctioning component */ char *componentID; char *buildBranch; /* Fields used by logMoreInfo, logGenIF, logShutdownIF */ char *strFileName; /* File in which the error occurred */ UInt32 srcLineNumber; /* Line on which the error occurred */ Int32 retCode; /* return code value */ Int32 reasonCode; /* reason code value */ char *dataStr; /* Data dump string */ char *failingExpr; /* Expression that evaluates to false */ /* Fields used by LOGSPECIFIC */ UInt32 logTemplID; /* Error log template ID (used in AIX only) */ char *formatStr; /* printf-style format string */ void *varargPtrPtr; /* Pointer to the variable argument list (will be casted to va_list *) */ char *kernData; /* Used for copying the logRecData field of the logging kernel mailbox */ int kernDataLength; /* = logRecDataLen */ char *moduleVersion; /* Used only for logging from external progsams */ } cxiErrorLogEntry_t; #ifdef SMB_LOCKS /* Enumeration used to specify whether a file will be read or written. */ enum AccessMode { opAccessNone = 0, opAccessRead = 1, opAccessWrite = 2 }; /* types of oplocks granted to Samba */ enum OplockMode { smbOplockNone = 0, smbOplockShared = 1, smbOplockExclusive = 2 }; /* Check whether oplock olm is in conflict with lock access am: A conflict exists if one of the two is for write/exlucisve and the other one is at least for read/shared. */ #define oplockAccessConflict(olm, am) ((int)(olm) + (int)(am) > 2) #endif #ifdef CCL /* Types of dentry operations tables that can be requested. */ typedef enum DentryOpTableTypes { DOpNormal, DOpOnlyValidIfSamba, DOpInvalidIfSamba } DentryOpTableTypes; #endif #define LOG_ERR_SPECIFIC 0x1 #define LOG_ERR_GENERIC 0x2 #define LOG_ERR_MOREINFO 0x3 #define LOG_ERR_SHUTDOWN 0x4 #define LOG_ERR_TRACEBACK 0x5 #define LOG_ERR_SPECIFIC_KERN 0x6 /* Common part of information about an open file */ typedef struct cxiVinfo_t { cBoolean viInUse; /* True if VInfo is in use by an open file */ cBoolean disconnected; /* True if the daemon died or a forced unmount or SG panic occurred since the file was opened */ cBoolean viIsNFS; /* True if this cxiVinfo_t is embedded inside a struct NFSData */ cBoolean rwPageDone; /* True if paging requests received */ } cxiVinfo_t; #ifdef _KERNEL #ifdef __cplusplus extern "C" { #endif /* Function pointer for main routine of a kernel process */ typedef void (*cxiKProcFunc_t)(void *argP); #ifdef __cplusplus } #endif /* Interface structure to cxiStartKProc() and cxiStopKProc() */ typedef struct cxiKProcData_t { cxiPid_t pid; /* proc pid (returned) */ /* protects startStopEvent and kprocEvent transitions */ cxiBlockingMutex_t lock; /* kproc can sleep here */ cxiWaitEvent_t kprocEvent; /* start or stop request should sleep here waiting on pid transition */ cxiWaitEvent_t startStopEvent; int priority; /* process priority of kproc */ int kprocFlags; /* flags to pass to kernel thread creation routine */ Boolean terminate; /* terminate proc when true */ cxiKProcFunc_t func; /* proc function */ void *fargP; /* proc function arguments */ char *nameP; /* proc name */ char *systemP; /* any system data structure associated with process */ } cxiKProcData_t; #define KPROC_FAILED_PID -1 #define KPROC_UNASSIGNED_PID -2 #define KPROC_RUNNING(KP) ((KP)->pid > 0) #endif /* _KERNEL */ /* Macros to do multiplication, division, and modulo by numbers that are probably powers of two. Depending on which define is set, the operations can be performed using the built-in operators /, *, and %, or using shifts and masks. The _shift parameter of the macros should be log base 2 of _divisor or _multiplier, or 0 if _divisor or _multiplier is not a power of 2. If POW2_COND_SHIFT is defined, the generated code will test _shift for 0, then do either a shift or the general operation. If POW2_FORCE_SHIFT is defined, the generated code will always use shifts. This requires that the subblock size of the file system actually be a power of 2. If neither POW2_COND_SHIFT nor POW2_FORCE_SHIFT are defined, the generated code will use the general operations (/, *, or %). */ #if defined(POW2_FORCE_SHIFT) # define MULT_OR_SHIFT(_multiplicand, _multiplier, _shift) \ ((_multiplicand)<<(_shift)) # define DIV_OR_SHIFT(_dividend, _divisor, _shift) \ ((_dividend)>>(_shift)) # define MOD_OR_MASK(_dividend, _divisor, _shift) \ ((_dividend) & ((1<<(_shift)) - 1)) #elif defined(POW2_COND_SHIFT) # define MULT_OR_SHIFT(_multiplicand, _multiplier, _shift) \ ( ((_shift)!=0) ? \ (_multiplicand) << (_shift) : \ ((_multiplicand)*(_multiplier)) ) # define DIV_OR_SHIFT(_dividend, _divisor, _shift) \ ( ((_shift)!=0) ? \ (_dividend) >> (_shift) : \ ((_dividend)/(_divisor)) ) # define MOD_OR_MASK(_dividend, _divisor, _shift) \ ( ((_shift)!=0) ? \ (_dividend) & ((1<<(_shift)) - 1) : \ ((_dividend)%(_divisor)) ) #else # define MULT_OR_SHIFT(_multiplicand, _multiplier, _shift) \ ((_multiplicand)*(_multiplier)) # define DIV_OR_SHIFT(_dividend, _divisor, _shift) \ ((_dividend)/(_divisor)) # define MOD_OR_MASK(_dividend, _divisor, _shift) \ ((_dividend)%(_divisor)) #endif /* Memory copy macros that use memcpy when aligned data accesses are necessary, and standard pointer typecast copying otherwise. */ #ifdef ALIGNED_DATA_ACCESS #define MCPY(DEST, SRC, TYPE) memcpy((void*) DEST, (void*) SRC, sizeof(TYPE)); #define MCPY_SRCVAR(DEST, SRCVAR, TYPE) memcpy((void*) DEST, (void*) &SRCVAR, sizeof(TYPE)); #define MCPY_DESTVAR(DESTVAR, SRC, TYPE) memcpy((void*) &DESTVAR, (void*) SRC, sizeof(TYPE)); #define MCPY_VAR(DEST, SRC, TYPE) memcpy((void*) &DEST, (void*) &SRC, sizeof(TYPE)); #else #define MCPY(DEST, SRC, TYPE) *((TYPE *)DEST) = *((TYPE *)SRC); #define MCPY_SRCVAR(DEST, SRCVAR, TYPE) *((TYPE *)DEST) = SRCVAR; #define MCPY_DESTVAR(DESTVAR, SRC, TYPE) DESTVAR = *((TYPE *)SRC); #define MCPY_VAR(DEST, SRC, TYPE) DEST = SRC; #endif /* ALIGNED_DATA_ACCESS */ /* Flag values for cxiNode_t::icValid: Indicates whether inode attributes cached in the osNode (struct inode in Linux) are known to be valid. */ #define CXI_IC_PERM 0x00000001 /* permission related inode fields (owner, mode, acl, etc) are valid */ #define CXI_IC_ATTR 0x00000002 /* other inode fields are valid */ /* combinations of bits defined above: */ #define CXI_IC_STAT 0x00000003 /* what needs to be valid for stat() */ #define CXI_IC_ALL 0x00000003 /* OR of all flags above */ typedef Int32 DiskNum_t; typedef Int64 SectorNum_t; typedef Int32 SectorNumHigh_t; typedef UInt32 SectorNumLow_t; typedef Int64 BlkNum_t; #define DiskSizeInit MAX_INT64 #ifndef INODENUM_ROOTDIR_FILE /* Definition needed in portability layer */ #define INODENUM_ROOTDIR_FILE 3 #endif #ifdef GPFS_LINUX #define THROWEMPTY throw() #else #define THROWEMPTY #endif #endif /* _h_cxiTypes */