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 |
---|
77 | extern "C" |
---|
78 | { |
---|
79 | #endif /* __cplusplus */ |
---|
80 | |
---|
81 | int cxiFindOSNode(void *osVfsP, struct cxiNode_t *, void **osNodePP, |
---|
82 | Boolean); |
---|
83 | int cxiNewOSNode(void *osVfsP, struct cxiNode_t **, void **osNodePP, |
---|
84 | cxiIno_t, int, void *opaqueP); |
---|
85 | int cxiReactivateOSNode(void *osVfsP, struct cxiNode_t *, void **osNodePP); |
---|
86 | |
---|
87 | int cxiRefOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP, int); |
---|
88 | int cxiRefOsNode(void *osVfsP, struct cxiNode_t *, void *osNodeP, int, |
---|
89 | Boolean calledFromRevoke); |
---|
90 | int cxiInactiveOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP, |
---|
91 | Boolean *, Boolean *); |
---|
92 | |
---|
93 | int cxiRegisterCleanup(); |
---|
94 | |
---|
95 | void cxiPutOSNode(void *vP); |
---|
96 | void cxiDestroyOSNode(void *vP); |
---|
97 | void cxiDumpOSNode(struct cxiNode_t *); |
---|
98 | void cxiFreeOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP); |
---|
99 | void cxiReinitOSNode(void *osVfsP, struct cxiNode_t *, void *osNodeP); |
---|
100 | int cxiPruneDCacheEntry(cxiNode_t *cnP); |
---|
101 | int cxiInvalidateDCacheEntry(cxiNode_t *cnP); |
---|
102 | void cxiDropInvalidDCacheEntry(cxiNode_t *cnP); |
---|
103 | int cxiInvalidateNegDCacheEntry(cxiNode_t *cnP); |
---|
104 | void cxiInvalidatePerm(cxiNode_t *cnP); |
---|
105 | void cxiUpdateInode(cxiNode_t *cnP, cxiVattr_t *attrP, int what); |
---|
106 | |
---|
107 | void cxiSetOSNodeType(cxiNode_t *cnP, cxiMode_t mode, cxiDev_t dev); |
---|
108 | void cxiSetOSNode(void *osVfsP, cxiNode_t *cnP, cxiVattr_t *vattrP); |
---|
109 | |
---|
110 | int cxiSetMountInfo(void *osVfsP, cxiDev_t, int bsize, void *osRootNodeP, |
---|
111 | struct cxiNode_t *cnRootP, Boolean *releRootP, |
---|
112 | void *gnRootP, fsid_t fsid); |
---|
113 | int cxiUnmount(void *osVfsP, Boolean force, Boolean doDMEvents); |
---|
114 | int cxiIsVfsMounted(void *osVfsP); |
---|
115 | |
---|
116 | int 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); |
---|
120 | int cxiFcntlReset(void *vfsP, cxiPid_t mmfsd_pid); |
---|
121 | void cxiFcntlUnblock(void *retry_idP); |
---|
122 | int cxiTrace(cxiTrace_t trace); |
---|
123 | void cxiFlockToVFS(eflock_t* lckdatP, void* vP); |
---|
124 | void cxiVFSToFlock(void *vP, eflock_t* lckdatP); |
---|
125 | int cxiVFSCallback(eflock_t* lckreqP, eflock_t* lckdatP, |
---|
126 | int(* callback)(void *, void *, int), int result); |
---|
127 | |
---|
128 | void cxiOpenNFS(void *vP); |
---|
129 | int cxiCloseNFS(void *vP, void *viP); |
---|
130 | void cxiSetNFSCluster(int set); |
---|
131 | void cxiNFSError(int rc, const char *str); |
---|
132 | #define cxiErrorNFS(rc) cxiNFSError(rc, __FUNCTION__) |
---|
133 | |
---|
134 | void *cxiGetNfsP(void *vP); |
---|
135 | void cxiSetNfsP(void *vP, void *newP); |
---|
136 | void *cxiGetCnP(void *vP); |
---|
137 | void *cxiGetPvP(void *vP); |
---|
138 | void *cxiGNPtoVP(void *vP); |
---|
139 | void *cxiGetPrivVfsP(void *vP); |
---|
140 | |
---|
141 | #ifdef _KERNEL |
---|
142 | cxiPid_t cxiStartKProc(struct cxiKProcData_t *); |
---|
143 | void cxiStopKProc(struct cxiKProcData_t *); |
---|
144 | #endif |
---|
145 | void cxiSleep(int ms); |
---|
146 | |
---|
147 | #ifdef SMB_LOCKS |
---|
148 | void *cxiCheckOpen(struct cxiNode_t* cnP); |
---|
149 | int setSMBOpenLockControl(void *vP, void *infoP, int command, int lockmode); |
---|
150 | int setSMBOplock(void *vP, void *infoP, int accessWant, int oplockWant, |
---|
151 | void *breakArgP, int *oplockGrantedP, Boolean isAsync); |
---|
152 | int breakSMBOplock(cxiDev_t dev, cxiIno_t ino, int oplockCurrent, int oplockNew, |
---|
153 | void *breakArgP, void *fileArgP, void *nfs4_cookie, |
---|
154 | int timeoutSeconds); |
---|
155 | int cxiInitBreakQ(); |
---|
156 | int cxiTermBreakQ(); |
---|
157 | int cxiBreakOplock(void *breakArgP, int oplockNew); |
---|
158 | int cxiWaitForBreak(void *fileArgP, int oplockCurrent, int timeoutSeconds); |
---|
159 | int cxiSendBreakMsg(void *ofP); |
---|
160 | #endif |
---|
161 | |
---|
162 | int cxiGetCred(void *bufP, void **uCredPP, void **eCredPP); |
---|
163 | int cxiPutCred(void *userCredP, void *extCredP); |
---|
164 | |
---|
165 | /* Insure that our type definitions match any OS definitions */ |
---|
166 | int cxiCheckTypes(); |
---|
167 | |
---|
168 | #ifdef DISK_LEASE_DMS |
---|
169 | #define MAX_DMS_INDEX 32 |
---|
170 | EXTERNC void cxiStartDMS(int idx, int delay, int (*funcP)(int)); |
---|
171 | EXTERNC void cxiStopDMS(int idx); |
---|
172 | EXTERNC int cxiInitDMS(); |
---|
173 | EXTERNC 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 */ |
---|
215 | EXTERNC int cxiAuditWrite(int numargs, ...); |
---|
216 | |
---|
217 | /* Kernel routine to be called for NFSv4 alarm ACL entries */ |
---|
218 | static 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 | |
---|