/*************************************************************************** * * 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. * *************************************************************************** */ /* @(#)92 1.77.1.1 src/avs/fs/mmfs/ts/kernext/ibm-kxi/cxiSystem.h, mmfs, avs_rgpfs24, rgpfs24s005a 7/25/06 19:21:11 */ /* * Interface definitions for basic common services, platform independent * version. Interfaces in the first section of this file may be used by code * running either in a process or in the kernel, while interfaces defined * in the second section of this file may only be used by code running in the * kernel. * * Process and kernel interfaces: * cxiGetThreadId - get thread identifier * * Kernel-only memory allocation services: * void* cxiMallocPinned(int nBytes) * void* cxiMallocUnpinned(int nBytes) * void cxiFreePinned(void* p) * void cxiFreeUnpinned(void* p) * * Kernel-only interfaces: * cxiIsSuperUser - return true if caller has maximum authorization * cxiGetMaxFileSize - return the maximum file size the calling process * is allowed to create. A value of cxiUnlimitedFileSize means file * sizes are not limited. * cxiUiomove - transfer data from buffer(s) in user space to or from * a buffer in the kernel. * */ #ifndef _h_cxiSystem #define _h_cxiSystem #include #ifdef NFS4_CLUSTER #if LINUX_KERNEL_VERSION >= 2061500 # define NFS_CLUSTER_LOCKS #endif #endif /* Prototypes for OS dependent entry points called by GPFS. * If any of these should become macros for certain OSes then * this definition will have to move into the platform specific * system file. */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ int cxiFindOSNode(void *osVfsP, struct cxiNode_t *, void **osNodePP, Boolean); int cxiNewOSNode(void *osVfsP, struct cxiNode_t **, void **osNodePP, cxiIno_t, int, void *opaqueP); int cxiReactivateOSNode(void *osVfsP, struct cxiNode_t *, void **osNodePP); int cxiRefOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP, int); int cxiRefOsNode(void *osVfsP, struct cxiNode_t *, void *osNodeP, int, Boolean calledFromRevoke); int cxiInactiveOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP, Boolean *, Boolean *); int cxiRegisterCleanup(); void cxiPutOSNode(void *vP); void cxiDestroyOSNode(void *vP); void cxiDumpOSNode(struct cxiNode_t *); void cxiFreeOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP); void cxiReinitOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP); int cxiPruneDCacheEntry(cxiNode_t *cnP); int cxiInvalidateDCacheEntry(cxiNode_t *cnP); void cxiDropInvalidDCacheEntry(cxiNode_t *cnP); int cxiInvalidateNegDCacheEntry(cxiNode_t *cnP); void cxiInvalidatePerm(cxiNode_t *cnP); void cxiUpdateInode(cxiNode_t *cnP, cxiVattr_t *attrP, int what); void cxiSetOSNodeType(cxiNode_t *cnP, cxiMode_t mode, cxiDev_t dev); void cxiSetOSNode(void *osVfsP, cxiNode_t *cnP, cxiVattr_t *vattrP); int cxiSetMountInfo(void *osVfsP, cxiDev_t, int bsize, void *osRootNodeP, struct cxiNode_t *cnRootP, Boolean *releRootP, void *gnRootP, fsid_t fsid); int cxiUnmount(void *osVfsP, Boolean force, Boolean doDMEvents); int cxiIsVfsMounted(void *osVfsP); int cxiFcntlLock(void *fP, int cmd, void *flP, cxiFlock_t *flockP, int (*retryCB)(), cxiOff64_t size, cxiOff64_t offset, unsigned long *retry_idP); int cxiFcntlReset(void *vfsP, cxiPid_t mmfsd_pid); void cxiFcntlUnblock(void *retry_idP); int cxiTrace(cxiTrace_t trace); void cxiFlockToVFS(eflock_t* lckdatP, void* vP); void cxiVFSToFlock(void *vP, eflock_t* lckdatP); int cxiVFSCallback(eflock_t* lckreqP, eflock_t* lckdatP, int(* callback)(void *, void *, int), int result); void cxiOpenNFS(void *vP); int cxiCloseNFS(void *vP, void *viP); void cxiSetNFSCluster(int set); void cxiNFSError(int rc, const char *str); #define cxiErrorNFS(rc) cxiNFSError(rc, __FUNCTION__) void *cxiGetNfsP(void *vP); void cxiSetNfsP(void *vP, void *newP); void *cxiGetCnP(void *vP); void *cxiGetPvP(void *vP); void *cxiGNPtoVP(void *vP); void *cxiGetPrivVfsP(void *vP); #ifdef _KERNEL cxiPid_t cxiStartKProc(struct cxiKProcData_t *); void cxiStopKProc(struct cxiKProcData_t *); #endif void cxiSleep(int ms); #ifdef SMB_LOCKS void *cxiCheckOpen(struct cxiNode_t* cnP); int setSMBOpenLockControl(void *vP, void *infoP, int command, int lockmode); int setSMBOplock(void *vP, void *infoP, int accessWant, int oplockWant, void *breakArgP, int *oplockGrantedP, Boolean isAsync); int breakSMBOplock(cxiDev_t dev, cxiIno_t ino, int oplockCurrent, int oplockNew, void *breakArgP, void *fileArgP, void *nfs4_cookie, int timeoutSeconds); int cxiInitBreakQ(); int cxiTermBreakQ(); int cxiBreakOplock(void *breakArgP, int oplockNew); int cxiWaitForBreak(void *fileArgP, int oplockCurrent, int timeoutSeconds); int cxiSendBreakMsg(void *ofP); #endif int cxiGetCred(void *bufP, void **uCredPP, void **eCredPP); int cxiPutCred(void *userCredP, void *extCredP); /* Insure that our type definitions match any OS definitions */ int cxiCheckTypes(); #ifdef DISK_LEASE_DMS #define MAX_DMS_INDEX 32 EXTERNC void cxiStartDMS(int idx, int delay, int (*funcP)(int)); EXTERNC void cxiStopDMS(int idx); EXTERNC int cxiInitDMS(); EXTERNC void cxiShutdownDMS(); #else #define MAX_DMS_INDEX 1 #endif #ifdef __cplusplus } #endif /* __cplusplus */ /* Values for 'what' parameter to cxiUpdateInode and statUpdateOSNode: Selectively updated the OS node attributes. */ #define CXIUP_NLINK 0x00000001 /* update nlink */ #define CXIUP_MODE 0x00000002 /* update mode and ctime */ #define CXIUP_OWN 0x00000004 /* update mode,uid,gid and ctime */ #define CXIUP_SIZE 0x00000008 /* update fsize */ #define CXIUP_SIZE_BIG 0x00000010 /* update fsize if bigger */ #define CXIUP_TIMES 0x00000020 /* update all times */ #define CXIUP_ATIME 0x00000040 /* update atime only, other flags are not checked */ #define CXIUP_PERM 0x00000080 /* update fields needed for permission checking */ #define cxiDev32Major(x) (Int32)((unsigned)(x)>>16) #define cxiDev32Minor(x) (Int32)((x)&0xFFFF) /* Maximum number of simultaneous threads (must be a power of 2) */ #ifdef __64BIT__ #define MAX_GPFS_THREADS 1024 #define MAX_RCVWORKER_POOL 256 #else #define MAX_GPFS_THREADS 512 #define MAX_RCVWORKER_POOL 128 #endif /* Include platform-specific versions of interfaces to common exported services */ #include #define MAX_READDIR_BUF_SIZE 65536 #ifdef NFS4_ACL /* Kernel routine to be called for NFSv4 audit ACL entries */ EXTERNC int cxiAuditWrite(int numargs, ...); /* Kernel routine to be called for NFSv4 alarm ACL entries */ static int cxiAlarmWrite(int numargs, ...) { return -1; } /* Values for gpfsOpen internal flags (iflags) argument */ #define GPFS_OPEN_NO_SMBLOCK 0x00000001 /* Don't obtain OpenLk */ #define GPFS_OPEN_VCM_OBJECT 0x00000002 /* No SMB locking */ #endif /* NFS4_ACL */ #endif /* _h_cxiSystem */