source: gpfs_3.1_ker2.6.20/lpp/mmfs/src/ibm-kxi/cxiSystem.h @ 214

Last change on this file since 214 was 16, checked in by rock, 17 years ago
File size: 8.6 KB
Line 
1/***************************************************************************
2 *
3 * Copyright (C) 2001 International Business Machines
4 * All rights reserved.
5 *
6 * This file is part of the GPFS mmfslinux kernel module.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 *  1. Redistributions of source code must retain the above copyright notice,
13 *     this list of conditions and the following disclaimer.
14 *  2. Redistributions in binary form must reproduce the above copyright
15 *     notice, this list of conditions and the following disclaimer in the
16 *     documentation and/or other materials provided with the distribution.
17 *  3. The name of the author may not be used to endorse or promote products
18 *     derived from this software without specific prior written
19 *     permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 *************************************************************************** */
33/* @(#)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 */
34/*
35 * Interface definitions for basic common services, platform independent
36 * version. Interfaces in the first section of this file may be used by code
37 * running either in a process or in the kernel, while interfaces defined
38 * in the second section of this file may only be used by code running in the
39 * kernel.
40 *
41 * Process and kernel interfaces:
42 *   cxiGetThreadId - get thread identifier
43 *
44 * Kernel-only memory allocation services:
45 *   void* cxiMallocPinned(int nBytes)
46 *   void* cxiMallocUnpinned(int nBytes)
47 *   void cxiFreePinned(void* p)
48 *   void cxiFreeUnpinned(void* p)
49 *
50 * Kernel-only interfaces:
51 *   cxiIsSuperUser - return true if caller has maximum authorization
52 *   cxiGetMaxFileSize - return the maximum file size the calling process
53 *     is allowed to create.  A value of cxiUnlimitedFileSize means file
54 *     sizes are not limited.
55 *   cxiUiomove - transfer data from buffer(s) in user space to or from
56 *     a buffer in the kernel.
57 *
58 */
59
60#ifndef _h_cxiSystem
61#define _h_cxiSystem
62
63#include <cxiTypes.h>
64
65#ifdef NFS4_CLUSTER
66#if LINUX_KERNEL_VERSION >= 2061500
67# define NFS_CLUSTER_LOCKS
68#endif
69#endif
70
71/* Prototypes for OS dependent entry points called by GPFS.
72 * If any of these should become macros for certain OSes then
73 * this definition will have to move into the platform specific
74 * system file.
75 */
76#ifdef __cplusplus
77extern "C"
78{
79#endif /* __cplusplus */
80
81int cxiFindOSNode(void *osVfsP, struct cxiNode_t *, void **osNodePP,
82                  Boolean);
83int cxiNewOSNode(void *osVfsP, struct cxiNode_t **, void **osNodePP,
84                 cxiIno_t, int, void *opaqueP);
85int cxiReactivateOSNode(void *osVfsP, struct cxiNode_t *, void **osNodePP);
86
87int cxiRefOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP, int);
88int cxiRefOsNode(void *osVfsP, struct cxiNode_t *, void *osNodeP, int,
89                 Boolean calledFromRevoke);
90int cxiInactiveOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP,
91                      Boolean *, Boolean *);
92
93int  cxiRegisterCleanup();
94
95void cxiPutOSNode(void *vP);
96void cxiDestroyOSNode(void *vP);
97void cxiDumpOSNode(struct cxiNode_t *);
98void cxiFreeOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP);
99void cxiReinitOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP);
100int  cxiPruneDCacheEntry(cxiNode_t *cnP);
101int  cxiInvalidateDCacheEntry(cxiNode_t *cnP);
102void cxiDropInvalidDCacheEntry(cxiNode_t *cnP);
103int  cxiInvalidateNegDCacheEntry(cxiNode_t *cnP);
104void cxiInvalidatePerm(cxiNode_t *cnP);
105void cxiUpdateInode(cxiNode_t *cnP, cxiVattr_t *attrP, int what);
106
107void cxiSetOSNodeType(cxiNode_t *cnP, cxiMode_t mode, cxiDev_t dev);
108void cxiSetOSNode(void *osVfsP, cxiNode_t *cnP, cxiVattr_t *vattrP);
109
110int cxiSetMountInfo(void *osVfsP, cxiDev_t, int bsize, void *osRootNodeP,
111                    struct cxiNode_t *cnRootP, Boolean *releRootP,
112                    void *gnRootP, fsid_t fsid);
113int cxiUnmount(void *osVfsP, Boolean force, Boolean doDMEvents);
114int cxiIsVfsMounted(void *osVfsP);
115
116int cxiFcntlLock(void *fP, int cmd, void *flP,
117                 cxiFlock_t *flockP, int (*retryCB)(),
118                 cxiOff64_t size, cxiOff64_t offset,
119                 unsigned long *retry_idP);
120int cxiFcntlReset(void *vfsP, cxiPid_t mmfsd_pid);
121void cxiFcntlUnblock(void *retry_idP);
122int cxiTrace(cxiTrace_t trace);
123void cxiFlockToVFS(eflock_t* lckdatP, void* vP);
124void cxiVFSToFlock(void *vP, eflock_t* lckdatP);
125int cxiVFSCallback(eflock_t* lckreqP, eflock_t* lckdatP,
126      int(* callback)(void *, void *, int), int result);
127
128void cxiOpenNFS(void *vP);
129int cxiCloseNFS(void *vP, void *viP);
130void cxiSetNFSCluster(int set);
131void cxiNFSError(int rc, const char *str);
132#define cxiErrorNFS(rc) cxiNFSError(rc, __FUNCTION__)
133
134void *cxiGetNfsP(void *vP);
135void  cxiSetNfsP(void *vP, void *newP);
136void *cxiGetCnP(void *vP);
137void *cxiGetPvP(void *vP);
138void *cxiGNPtoVP(void *vP);
139void *cxiGetPrivVfsP(void *vP);
140
141#ifdef _KERNEL
142cxiPid_t cxiStartKProc(struct cxiKProcData_t *);
143void cxiStopKProc(struct cxiKProcData_t *);
144#endif
145void cxiSleep(int ms);
146
147#ifdef SMB_LOCKS
148void *cxiCheckOpen(struct cxiNode_t* cnP);
149int setSMBOpenLockControl(void *vP, void *infoP, int command, int lockmode);
150int setSMBOplock(void *vP, void *infoP, int accessWant, int oplockWant,
151                 void *breakArgP, int *oplockGrantedP, Boolean isAsync);
152int breakSMBOplock(cxiDev_t dev, cxiIno_t ino, int oplockCurrent, int oplockNew,
153                   void *breakArgP, void *fileArgP, void *nfs4_cookie,
154                   int timeoutSeconds);
155int cxiInitBreakQ();
156int cxiTermBreakQ();
157int cxiBreakOplock(void *breakArgP, int oplockNew);
158int cxiWaitForBreak(void *fileArgP, int oplockCurrent, int timeoutSeconds);
159int cxiSendBreakMsg(void *ofP);
160#endif
161
162int cxiGetCred(void *bufP, void **uCredPP, void **eCredPP);
163int cxiPutCred(void *userCredP, void *extCredP);
164
165/* Insure that our type definitions match any OS definitions */
166int cxiCheckTypes();
167
168#ifdef DISK_LEASE_DMS
169#define MAX_DMS_INDEX 32
170EXTERNC void cxiStartDMS(int idx, int delay, int (*funcP)(int));
171EXTERNC void cxiStopDMS(int idx);
172EXTERNC int cxiInitDMS();
173EXTERNC void cxiShutdownDMS();
174#else
175#define MAX_DMS_INDEX 1
176#endif
177
178#ifdef __cplusplus
179}
180#endif /* __cplusplus */
181
182/* Values for 'what' parameter to cxiUpdateInode and statUpdateOSNode:
183   Selectively updated the OS node attributes. */
184#define CXIUP_NLINK    0x00000001   /* update nlink */
185#define CXIUP_MODE     0x00000002   /* update mode and ctime */
186#define CXIUP_OWN      0x00000004   /* update mode,uid,gid and ctime */
187#define CXIUP_SIZE     0x00000008   /* update fsize */
188#define CXIUP_SIZE_BIG 0x00000010   /* update fsize if bigger */
189#define CXIUP_TIMES    0x00000020   /* update all times */
190#define CXIUP_ATIME    0x00000040   /* update atime only, other flags are not
191                                         checked */
192#define CXIUP_PERM     0x00000080   /* update fields needed for permission
193                                         checking */
194
195#define cxiDev32Major(x) (Int32)((unsigned)(x)>>16)
196#define cxiDev32Minor(x) (Int32)((x)&0xFFFF)
197
198/* Maximum number of simultaneous threads (must be a power of 2) */
199#ifdef __64BIT__
200#define MAX_GPFS_THREADS 1024
201#define MAX_RCVWORKER_POOL 256
202#else
203#define MAX_GPFS_THREADS 512
204#define MAX_RCVWORKER_POOL 128
205#endif
206
207/* Include platform-specific versions of interfaces to common exported
208   services */
209#include <cxiSystem-plat.h>
210
211#define MAX_READDIR_BUF_SIZE 65536
212
213#ifdef NFS4_ACL
214/* Kernel routine to be called for NFSv4 audit ACL entries */
215EXTERNC int cxiAuditWrite(int numargs, ...);
216
217/* Kernel routine to be called for NFSv4 alarm ACL entries */
218static int cxiAlarmWrite(int numargs, ...) { return -1; }
219
220/* Values for gpfsOpen internal flags (iflags) argument  */
221#define GPFS_OPEN_NO_SMBLOCK 0x00000001 /* Don't obtain OpenLk */
222#define GPFS_OPEN_VCM_OBJECT 0x00000002 /* No SMB locking      */
223#endif /* NFS4_ACL */
224
225#endif  /* _h_cxiSystem */
226
Note: See TracBrowser for help on using the repository browser.