1 | /* |
2 | * Copyright (c) 2000-2010 Apple Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License |
8 | * Version 2.0 (the 'License'). You may not use this file except in |
9 | * compliance with the License. The rights granted to you under the License |
10 | * may not be used to create, or enable the creation or redistribution of, |
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | * circumvent, violate, or enable the circumvention or violation of, any |
13 | * terms of an Apple operating system software license agreement. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and |
24 | * limitations under the License. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ |
29 | /* |
30 | * Copyright (c) 1989, 1993 |
31 | * The Regents of the University of California. All rights reserved. |
32 | * |
33 | * This code is derived from software contributed to Berkeley by |
34 | * Rick Macklem at The University of Guelph. |
35 | * |
36 | * Redistribution and use in source and binary forms, with or without |
37 | * modification, are permitted provided that the following conditions |
38 | * are met: |
39 | * 1. Redistributions of source code must retain the above copyright |
40 | * notice, this list of conditions and the following disclaimer. |
41 | * 2. Redistributions in binary form must reproduce the above copyright |
42 | * notice, this list of conditions and the following disclaimer in the |
43 | * documentation and/or other materials provided with the distribution. |
44 | * 3. All advertising materials mentioning features or use of this software |
45 | * must display the following acknowledgement: |
46 | * This product includes software developed by the University of |
47 | * California, Berkeley and its contributors. |
48 | * 4. Neither the name of the University nor the names of its contributors |
49 | * may be used to endorse or promote products derived from this software |
50 | * without specific prior written permission. |
51 | * |
52 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
53 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
54 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
55 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
58 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
59 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
60 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
62 | * SUCH DAMAGE. |
63 | * |
64 | * @(#)nfsproto.h 8.2 (Berkeley) 3/30/95 |
65 | * FreeBSD-Id: nfsproto.h,v 1.3 1997/02/22 09:42:50 peter Exp $ |
66 | */ |
67 | |
68 | #ifndef _NFS_NFSPROTO_H_ |
69 | #define _NFS_NFSPROTO_H_ |
70 | |
71 | #include <sys/appleapiopts.h> |
72 | |
73 | #ifdef __APPLE_API_PRIVATE |
74 | |
75 | /* |
76 | * NFS definitions per the various NFS protocol specs: |
77 | * Version 2 (RFC 1094), Version 3 (RFC 1813), and Version 4 (RFC 3530) |
78 | * and various protocol-related implementation definitions. |
79 | */ |
80 | |
81 | /* Only define these if nfs_prot.h hasn't been included */ |
82 | #ifndef NFS_PROGRAM |
83 | |
84 | #define NFS_PORT 2049 |
85 | #define NFS_PROG 100003 |
86 | #define NFS_VER2 2 |
87 | #define NFS_VER3 3 |
88 | #define NFS_VER4 4 |
89 | #define NFS_V2MAXDATA 8192 |
90 | #define NFS_MAXDGRAMDATA 16384 |
91 | #define NFS_PREFDGRAMDATA 8192 |
92 | #define NFS_MAXDATA (1024 * 1024) /* Max data supported by kext is 2MB for x86 and 8MB for AS (8 * 64 * PAGE_SIZE) */ |
93 | #define NFS_MAXPATHLEN 1024 |
94 | #define NFS_MAXNAMLEN 255 |
95 | #define NFS_MAXPACKET (16 * 1024 * 1024) |
96 | #define NFS_UDPSOCKBUF (224 * 1024) |
97 | #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ |
98 | |
99 | #define NFSRV_MAXDATA NFS_MAXDATA |
100 | #define NFSRV_TCPSOCKBUF (2 * NFSRV_MAXDATA) |
101 | |
102 | #define NFS4_CALLBACK_PROG 0x4E465343 /* "NFSC" */ |
103 | #define NFS4_CALLBACK_PROG_VERSION 1 |
104 | |
105 | /* Stat numbers for NFS RPC returns */ |
106 | #define NFS_OK 0 |
107 | #define NFSERR_PERM 1 |
108 | #define NFSERR_NOENT 2 |
109 | #define NFSERR_IO 5 |
110 | #define NFSERR_NXIO 6 |
111 | #define NFSERR_ACCES 13 |
112 | #define NFSERR_EXIST 17 |
113 | #define NFSERR_XDEV 18 /* Version 3 only */ |
114 | #define NFSERR_NODEV 19 |
115 | #define NFSERR_NOTDIR 20 |
116 | #define NFSERR_ISDIR 21 |
117 | #define NFSERR_INVAL 22 /* Version 3 only */ |
118 | #define NFSERR_FBIG 27 |
119 | #define NFSERR_NOSPC 28 |
120 | #define NFSERR_ROFS 30 |
121 | #define NFSERR_MLINK 31 /* Version 3 only */ |
122 | #define NFSERR_NAMETOL 63 |
123 | #define NFSERR_NOTEMPTY 66 |
124 | #define NFSERR_DQUOT 69 |
125 | #define NFSERR_STALE 70 |
126 | #define NFSERR_REMOTE 71 /* Version 3 only */ |
127 | #define NFSERR_WFLUSH 99 /* Version 2 only */ |
128 | #define NFSERR_BADHANDLE 10001 /* The rest Version 3 only */ |
129 | #define NFSERR_NOT_SYNC 10002 |
130 | #define NFSERR_BAD_COOKIE 10003 |
131 | #define NFSERR_NOTSUPP 10004 |
132 | #define NFSERR_TOOSMALL 10005 |
133 | #define NFSERR_SERVERFAULT 10006 |
134 | #define NFSERR_BADTYPE 10007 |
135 | #define NFSERR_JUKEBOX 10008 |
136 | #define NFSERR_TRYLATER NFSERR_JUKEBOX |
137 | #define NFSERR_DELAY NFSERR_JUKEBOX |
138 | #define NFSERR_SAME 10009 /* The rest Version 4 only */ |
139 | #define NFSERR_DENIED 10010 |
140 | #define NFSERR_EXPIRED 10011 |
141 | #define NFSERR_LOCKED 10012 |
142 | #define NFSERR_GRACE 10013 |
143 | #define NFSERR_FHEXPIRED 10014 |
144 | #define NFSERR_SHARE_DENIED 10015 |
145 | #define NFSERR_WRONGSEC 10016 |
146 | #define NFSERR_CLID_INUSE 10017 |
147 | #define NFSERR_RESOURCE 10018 |
148 | #define NFSERR_MOVED 10019 |
149 | #define NFSERR_NOFILEHANDLE 10020 |
150 | #define NFSERR_MINOR_VERS_MISMATCH 10021 |
151 | #define NFSERR_STALE_CLIENTID 10022 |
152 | #define NFSERR_STALE_STATEID 10023 |
153 | #define NFSERR_OLD_STATEID 10024 |
154 | #define NFSERR_BAD_STATEID 10025 |
155 | #define NFSERR_BAD_SEQID 10026 |
156 | #define NFSERR_NOT_SAME 10027 |
157 | #define NFSERR_LOCK_RANGE 10028 |
158 | #define NFSERR_SYMLINK 10029 |
159 | #define NFSERR_RESTOREFH 10030 |
160 | #define NFSERR_LEASE_MOVED 10031 |
161 | #define NFSERR_ATTRNOTSUPP 10032 |
162 | #define NFSERR_NO_GRACE 10033 |
163 | #define NFSERR_RECLAIM_BAD 10034 |
164 | #define NFSERR_RECLAIM_CONFLICT 10035 |
165 | #define NFSERR_BADXDR 10036 |
166 | #define NFSERR_LOCKS_HELD 10037 |
167 | #define NFSERR_OPENMODE 10038 |
168 | #define NFSERR_BADOWNER 10039 |
169 | #define NFSERR_BADCHAR 10040 |
170 | #define NFSERR_BADNAME 10041 |
171 | #define NFSERR_BAD_RANGE 10042 |
172 | #define NFSERR_LOCK_NOTSUPP 10043 |
173 | #define NFSERR_OP_ILLEGAL 10044 |
174 | #define NFSERR_DEADLOCK 10045 |
175 | #define NFSERR_FILE_OPEN 10046 |
176 | #define NFSERR_ADMIN_REVOKED 10047 |
177 | #define NFSERR_CB_PATH_DOWN 10048 |
178 | |
179 | #define NFSERR_STALEWRITEVERF 30001 /* Fake return for nfs_commit() */ |
180 | #define NFSERR_DIRBUFDROPPED 30002 /* Fake return for nfs*_readdir_rpc() */ |
181 | |
182 | /* |
183 | * For gss we would like to return EAUTH when we don't have or can't get credentials, |
184 | * but some callers don't know what to do with it, so we define our own version |
185 | * of EAUTH to be EACCES |
186 | */ |
187 | #define NFSERR_EAUTH EACCES |
188 | |
189 | #define NFSERR_RETVOID 0x20000000 /* Return void, not error */ |
190 | #define NFSERR_AUTHERR 0x40000000 /* Mark an authentication error */ |
191 | #define NFSERR_RETERR 0x80000000 /* Mark an error return for V3 */ |
192 | |
193 | #endif /* !NFS_PROGRAM */ |
194 | |
195 | /* Sizes in bytes of various nfs rpc components */ |
196 | #define NFSX_UNSIGNED 4 |
197 | |
198 | /* specific to NFS Version 2 */ |
199 | #define NFSX_V2FH 32 |
200 | #define NFSX_V2FATTR 68 |
201 | #define NFSX_V2SATTR 32 |
202 | #define NFSX_V2COOKIE 4 |
203 | #define NFSX_V2STATFS 20 |
204 | |
205 | /* specific to NFS Version 3 */ |
206 | #define NFSX_V3FHMAX 64 /* max. allowed by protocol */ |
207 | #define NFSX_V3FATTR 84 |
208 | #define NFSX_V3SATTR 60 /* max. all fields filled in */ |
209 | #define NFSX_V3POSTOPATTR (NFSX_V3FATTR + NFSX_UNSIGNED) |
210 | #define NFSX_V3WCCDATA (NFSX_V3POSTOPATTR + 8 * NFSX_UNSIGNED) |
211 | #define NFSX_V3COOKIEVERF 8 |
212 | #define NFSX_V3WRITEVERF 8 |
213 | #define NFSX_V3CREATEVERF 8 |
214 | #define NFSX_V3STATFS 52 |
215 | #define NFSX_V3FSINFO 48 |
216 | #define NFSX_V3PATHCONF 24 |
217 | |
218 | /* specific to NFS Version 4 */ |
219 | #define NFS4_FHSIZE 128 |
220 | #define NFS4_VERIFIER_SIZE 8 |
221 | #define NFS4_OPAQUE_LIMIT 1024 |
222 | |
223 | /* variants for multiple versions */ |
224 | #define NFSX_FH(V) (((V) == NFS_VER2) ? NFSX_V2FH : (NFSX_UNSIGNED + \ |
225 | (((V) == NFS_VER3) ? NFSX_V3FHMAX : NFS4_FHSIZE))) |
226 | #define NFSX_SRVFH(V, FH) (((V) == NFS_VER2) ? NFSX_V2FH : (FH)->nfh_len) |
227 | #define NFSX_FATTR(V) (((V) == NFS_VER3) ? NFSX_V3FATTR : NFSX_V2FATTR) |
228 | #define NFSX_PREOPATTR(V) (((V) == NFS_VER3) ? (7 * NFSX_UNSIGNED) : 0) |
229 | #define NFSX_POSTOPATTR(V) (((V) == NFS_VER3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : 0) |
230 | #define NFSX_POSTOPORFATTR(V) (((V) == NFS_VER3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : NFSX_V2FATTR) |
231 | #define NFSX_WCCDATA(V) (((V) == NFS_VER3) ? NFSX_V3WCCDATA : 0) |
232 | #define NFSX_WCCORFATTR(V) (((V) == NFS_VER3) ? NFSX_V3WCCDATA : NFSX_V2FATTR) |
233 | #define NFSX_SATTR(V) (((V) == NFS_VER3) ? NFSX_V3SATTR : NFSX_V2SATTR) |
234 | #define NFSX_COOKIEVERF(V) (((V) == NFS_VER3) ? NFSX_V3COOKIEVERF : 0) |
235 | #define NFSX_WRITEVERF(V) (((V) == NFS_VER3) ? NFSX_V3WRITEVERF : 0) |
236 | #define NFSX_READDIR(V) (((V) == NFS_VER3) ? (5 * NFSX_UNSIGNED) : \ |
237 | (2 * NFSX_UNSIGNED)) |
238 | #define NFSX_STATFS(V) (((V) == NFS_VER3) ? NFSX_V3STATFS : NFSX_V2STATFS) |
239 | |
240 | /* Only define these if nfs_prot.h hasn't been included */ |
241 | #ifndef NFS_PROGRAM |
242 | |
243 | /* nfs rpc procedure numbers (before version mapping) */ |
244 | #define NFSPROC_NULL 0 |
245 | #define NFSPROC_GETATTR 1 |
246 | #define NFSPROC_SETATTR 2 |
247 | #define NFSPROC_LOOKUP 3 |
248 | #define NFSPROC_ACCESS 4 |
249 | #define NFSPROC_READLINK 5 |
250 | #define NFSPROC_READ 6 |
251 | #define NFSPROC_WRITE 7 |
252 | #define NFSPROC_CREATE 8 |
253 | #define NFSPROC_MKDIR 9 |
254 | #define NFSPROC_SYMLINK 10 |
255 | #define NFSPROC_MKNOD 11 |
256 | #define NFSPROC_REMOVE 12 |
257 | #define NFSPROC_RMDIR 13 |
258 | #define NFSPROC_RENAME 14 |
259 | #define NFSPROC_LINK 15 |
260 | #define NFSPROC_READDIR 16 |
261 | #define NFSPROC_READDIRPLUS 17 |
262 | #define NFSPROC_FSSTAT 18 |
263 | #define NFSPROC_FSINFO 19 |
264 | #define NFSPROC_PATHCONF 20 |
265 | #define NFSPROC_COMMIT 21 |
266 | |
267 | #endif /* !NFS_PROGRAM */ |
268 | |
269 | #define NFSPROC_NOOP 22 |
270 | #define NFS_NPROCS 23 |
271 | |
272 | /* Actual Version 2 procedure numbers */ |
273 | #define NFSV2PROC_NULL 0 |
274 | #define NFSV2PROC_GETATTR 1 |
275 | #define NFSV2PROC_SETATTR 2 |
276 | #define NFSV2PROC_NOOP 3 |
277 | #define NFSV2PROC_ROOT NFSV2PROC_NOOP /* Obsolete */ |
278 | #define NFSV2PROC_LOOKUP 4 |
279 | #define NFSV2PROC_READLINK 5 |
280 | #define NFSV2PROC_READ 6 |
281 | #define NFSV2PROC_WRITECACHE NFSV2PROC_NOOP /* Obsolete */ |
282 | #define NFSV2PROC_WRITE 8 |
283 | #define NFSV2PROC_CREATE 9 |
284 | #define NFSV2PROC_REMOVE 10 |
285 | #define NFSV2PROC_RENAME 11 |
286 | #define NFSV2PROC_LINK 12 |
287 | #define NFSV2PROC_SYMLINK 13 |
288 | #define NFSV2PROC_MKDIR 14 |
289 | #define NFSV2PROC_RMDIR 15 |
290 | #define NFSV2PROC_READDIR 16 |
291 | #define NFSV2PROC_STATFS 17 |
292 | |
293 | /* |
294 | * Constants used by the Version 3 protocol for various RPCs |
295 | */ |
296 | |
297 | #define NFSV3FSINFO_LINK 0x01 |
298 | #define NFSV3FSINFO_SYMLINK 0x02 |
299 | #define NFSV3FSINFO_HOMOGENEOUS 0x08 |
300 | #define NFSV3FSINFO_CANSETTIME 0x10 |
301 | |
302 | /* time setting constants */ |
303 | #define NFS_TIME_DONT_CHANGE 0 |
304 | #define NFS_TIME_SET_TO_SERVER 1 |
305 | #define NFS_TIME_SET_TO_CLIENT 2 |
306 | #define NFS4_TIME_SET_TO_SERVER 0 |
307 | #define NFS4_TIME_SET_TO_CLIENT 1 |
308 | |
309 | /* access() constants */ |
310 | #define NFS_ACCESS_READ 0x01 |
311 | #define NFS_ACCESS_LOOKUP 0x02 |
312 | #define NFS_ACCESS_MODIFY 0x04 |
313 | #define NFS_ACCESS_EXTEND 0x08 |
314 | #define NFS_ACCESS_DELETE 0x10 |
315 | #define NFS_ACCESS_EXECUTE 0x20 |
316 | #define NFS_ACCESS_ALL (NFS_ACCESS_READ | NFS_ACCESS_MODIFY \ |
317 | | NFS_ACCESS_EXTEND | NFS_ACCESS_EXECUTE \ |
318 | | NFS_ACCESS_DELETE | NFS_ACCESS_LOOKUP) |
319 | |
320 | /* NFS WRITE how constants */ |
321 | #define NFS_WRITE_UNSTABLE 0 |
322 | #define NFS_WRITE_DATASYNC 1 |
323 | #define NFS_WRITE_FILESYNC 2 |
324 | |
325 | /* NFS CREATE types */ |
326 | #define NFS_CREATE_UNCHECKED 0 |
327 | #define NFS_CREATE_GUARDED 1 |
328 | #define NFS_CREATE_EXCLUSIVE 2 |
329 | |
330 | /* Only define these if nfs_prot.h hasn't been included */ |
331 | #ifndef NFS_PROGRAM |
332 | /* NFS object types */ |
333 | typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5, |
334 | NFSOCK=6, NFFIFO=7, NFATTRDIR=8, NFNAMEDATTR=9 } nfstype; |
335 | #endif /* !NFS_PROGRAM */ |
336 | |
337 | /* |
338 | * File Handle (32 bytes for version 2), variable up to 64 for version 3 |
339 | * and variable up to 128 bytes for version 4. |
340 | * File Handles of up to NFS_SMALLFH in size are stored directly in the |
341 | * nfs node, whereas larger ones are malloc'd. (This never happens when |
342 | * NFS_SMALLFH is set to the largest size.) |
343 | * NFS_SMALLFH should be in the range of 32 to 64 and be divisible by 4. |
344 | */ |
345 | #ifndef NFS_SMALLFH |
346 | #define NFS_SMALLFH 64 |
347 | #endif |
348 | |
349 | /* |
350 | * NFS attribute management stuff |
351 | */ |
352 | #define NFS_ATTR_BITMAP_LEN 2 |
353 | #define NFS_BITMAP_SET(B, I) (((uint32_t *)(B))[(I)/32] |= 1U<<((I)%32)) |
354 | #define NFS_BITMAP_CLR(B, I) (((uint32_t *)(B))[(I)/32] &= ~(1U<<((I)%32))) |
355 | #define NFS_BITMAP_ISSET(B, I) (((uint32_t *)(B))[(I)/32] & (1U<<((I)%32))) |
356 | #define NFS_BITMAP_COPY_ATTR(FROM, TO, WHICH, ATTR) \ |
357 | do { \ |
358 | if (NFS_BITMAP_ISSET(((FROM)->nva_bitmap), (NFS_FATTR_##WHICH))) { \ |
359 | (TO)->nva_##ATTR = (FROM)->nva_##ATTR; \ |
360 | NFS_BITMAP_SET(((TO)->nva_bitmap), (NFS_FATTR_##WHICH)); \ |
361 | } \ |
362 | } while (0) |
363 | #define NFS_BITMAP_COPY_TIME(FROM, TO, WHICH, ATTR) \ |
364 | do { \ |
365 | if (NFS_BITMAP_ISSET(((FROM)->nva_bitmap), (NFS_FATTR_TIME_##WHICH))) { \ |
366 | (TO)->nva_timesec[NFSTIME_##ATTR] = (FROM)->nva_timesec[NFSTIME_##ATTR]; \ |
367 | (TO)->nva_timensec[NFSTIME_##ATTR] = (FROM)->nva_timensec[NFSTIME_##ATTR]; \ |
368 | NFS_BITMAP_SET(((TO)->nva_bitmap), (NFS_FATTR_TIME_##WHICH)); \ |
369 | } \ |
370 | } while (0) |
371 | #define NFS_BITMAP_ZERO(B, L) \ |
372 | do { \ |
373 | int __i; \ |
374 | for (__i=0; __i < (L); __i++) \ |
375 | ((uint32_t*)(B))[__i] = 0; \ |
376 | } while (0) |
377 | |
378 | #define NFS_CLEAR_ATTRIBUTES(A) NFS_BITMAP_ZERO((A), NFS_ATTR_BITMAP_LEN) |
379 | #define NFS_COPY_ATTRIBUTES(SRC, DST) \ |
380 | do { \ |
381 | int __i; \ |
382 | for (__i=0; __i < NFS_ATTR_BITMAP_LEN; __i++) \ |
383 | ((uint32_t*)(DST))[__i] = ((uint32_t*)(SRC))[__i]; \ |
384 | } while (0) |
385 | |
386 | /* NFS attributes */ |
387 | #define NFS_FATTR_SUPPORTED_ATTRS 0 |
388 | #define NFS_FATTR_TYPE 1 |
389 | #define NFS_FATTR_FH_EXPIRE_TYPE 2 |
390 | #define NFS_FATTR_CHANGE 3 |
391 | #define NFS_FATTR_SIZE 4 |
392 | #define NFS_FATTR_LINK_SUPPORT 5 |
393 | #define NFS_FATTR_SYMLINK_SUPPORT 6 |
394 | #define NFS_FATTR_NAMED_ATTR 7 |
395 | #define NFS_FATTR_FSID 8 |
396 | #define NFS_FATTR_UNIQUE_HANDLES 9 |
397 | #define NFS_FATTR_LEASE_TIME 10 |
398 | #define NFS_FATTR_RDATTR_ERROR 11 |
399 | #define NFS_FATTR_FILEHANDLE 19 |
400 | #define NFS_FATTR_ACL 12 |
401 | #define NFS_FATTR_ACLSUPPORT 13 |
402 | #define NFS_FATTR_ARCHIVE 14 |
403 | #define NFS_FATTR_CANSETTIME 15 |
404 | #define NFS_FATTR_CASE_INSENSITIVE 16 |
405 | #define NFS_FATTR_CASE_PRESERVING 17 |
406 | #define NFS_FATTR_CHOWN_RESTRICTED 18 |
407 | #define NFS_FATTR_FILEID 20 |
408 | #define NFS_FATTR_FILES_AVAIL 21 |
409 | #define NFS_FATTR_FILES_FREE 22 |
410 | #define NFS_FATTR_FILES_TOTAL 23 |
411 | #define NFS_FATTR_FS_LOCATIONS 24 |
412 | #define NFS_FATTR_HIDDEN 25 |
413 | #define NFS_FATTR_HOMOGENEOUS 26 |
414 | #define NFS_FATTR_MAXFILESIZE 27 |
415 | #define NFS_FATTR_MAXLINK 28 |
416 | #define NFS_FATTR_MAXNAME 29 |
417 | #define NFS_FATTR_MAXREAD 30 |
418 | #define NFS_FATTR_MAXWRITE 31 |
419 | #define NFS_FATTR_MIMETYPE 32 |
420 | #define NFS_FATTR_MODE 33 |
421 | #define NFS_FATTR_NO_TRUNC 34 |
422 | #define NFS_FATTR_NUMLINKS 35 |
423 | #define NFS_FATTR_OWNER 36 |
424 | #define NFS_FATTR_OWNER_GROUP 37 |
425 | #define NFS_FATTR_QUOTA_AVAIL_HARD 38 |
426 | #define NFS_FATTR_QUOTA_AVAIL_SOFT 39 |
427 | #define NFS_FATTR_QUOTA_USED 40 |
428 | #define NFS_FATTR_RAWDEV 41 |
429 | #define NFS_FATTR_SPACE_AVAIL 42 |
430 | #define NFS_FATTR_SPACE_FREE 43 |
431 | #define NFS_FATTR_SPACE_TOTAL 44 |
432 | #define NFS_FATTR_SPACE_USED 45 |
433 | #define NFS_FATTR_SYSTEM 46 |
434 | #define NFS_FATTR_TIME_ACCESS 47 |
435 | #define NFS_FATTR_TIME_ACCESS_SET 48 |
436 | #define NFS_FATTR_TIME_BACKUP 49 |
437 | #define NFS_FATTR_TIME_CREATE 50 |
438 | #define NFS_FATTR_TIME_DELTA 51 |
439 | #define NFS_FATTR_TIME_METADATA 52 |
440 | #define NFS_FATTR_TIME_MODIFY 53 |
441 | #define NFS_FATTR_TIME_MODIFY_SET 54 |
442 | #define NFS_FATTR_MOUNTED_ON_FILEID 55 |
443 | |
444 | #define NFS4_ALL_ATTRIBUTES(A) \ |
445 | do { \ |
446 | /* required: */ \ |
447 | NFS_BITMAP_SET((A), NFS_FATTR_SUPPORTED_ATTRS); \ |
448 | NFS_BITMAP_SET((A), NFS_FATTR_TYPE); \ |
449 | NFS_BITMAP_SET((A), NFS_FATTR_FH_EXPIRE_TYPE); \ |
450 | NFS_BITMAP_SET((A), NFS_FATTR_CHANGE); \ |
451 | NFS_BITMAP_SET((A), NFS_FATTR_SIZE); \ |
452 | NFS_BITMAP_SET((A), NFS_FATTR_LINK_SUPPORT); \ |
453 | NFS_BITMAP_SET((A), NFS_FATTR_SYMLINK_SUPPORT); \ |
454 | NFS_BITMAP_SET((A), NFS_FATTR_NAMED_ATTR); \ |
455 | NFS_BITMAP_SET((A), NFS_FATTR_FSID); \ |
456 | NFS_BITMAP_SET((A), NFS_FATTR_UNIQUE_HANDLES); \ |
457 | NFS_BITMAP_SET((A), NFS_FATTR_LEASE_TIME); \ |
458 | NFS_BITMAP_SET((A), NFS_FATTR_RDATTR_ERROR); \ |
459 | NFS_BITMAP_SET((A), NFS_FATTR_FILEHANDLE); \ |
460 | /* optional: */ \ |
461 | NFS_BITMAP_SET((A), NFS_FATTR_ACL); \ |
462 | NFS_BITMAP_SET((A), NFS_FATTR_ACLSUPPORT); \ |
463 | NFS_BITMAP_SET((A), NFS_FATTR_ARCHIVE); \ |
464 | NFS_BITMAP_SET((A), NFS_FATTR_CANSETTIME); \ |
465 | NFS_BITMAP_SET((A), NFS_FATTR_CASE_INSENSITIVE); \ |
466 | NFS_BITMAP_SET((A), NFS_FATTR_CASE_PRESERVING); \ |
467 | NFS_BITMAP_SET((A), NFS_FATTR_CHOWN_RESTRICTED); \ |
468 | NFS_BITMAP_SET((A), NFS_FATTR_FILEID); \ |
469 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_AVAIL); \ |
470 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_FREE); \ |
471 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_TOTAL); \ |
472 | NFS_BITMAP_SET((A), NFS_FATTR_FS_LOCATIONS); \ |
473 | NFS_BITMAP_SET((A), NFS_FATTR_HIDDEN); \ |
474 | NFS_BITMAP_SET((A), NFS_FATTR_HOMOGENEOUS); \ |
475 | NFS_BITMAP_SET((A), NFS_FATTR_MAXFILESIZE); \ |
476 | NFS_BITMAP_SET((A), NFS_FATTR_MAXLINK); \ |
477 | NFS_BITMAP_SET((A), NFS_FATTR_MAXNAME); \ |
478 | NFS_BITMAP_SET((A), NFS_FATTR_MAXREAD); \ |
479 | NFS_BITMAP_SET((A), NFS_FATTR_MAXWRITE); \ |
480 | NFS_BITMAP_SET((A), NFS_FATTR_MIMETYPE); \ |
481 | NFS_BITMAP_SET((A), NFS_FATTR_MODE); \ |
482 | NFS_BITMAP_SET((A), NFS_FATTR_NO_TRUNC); \ |
483 | NFS_BITMAP_SET((A), NFS_FATTR_NUMLINKS); \ |
484 | NFS_BITMAP_SET((A), NFS_FATTR_OWNER); \ |
485 | NFS_BITMAP_SET((A), NFS_FATTR_OWNER_GROUP); \ |
486 | NFS_BITMAP_SET((A), NFS_FATTR_QUOTA_AVAIL_HARD); \ |
487 | NFS_BITMAP_SET((A), NFS_FATTR_QUOTA_AVAIL_SOFT); \ |
488 | NFS_BITMAP_SET((A), NFS_FATTR_QUOTA_USED); \ |
489 | NFS_BITMAP_SET((A), NFS_FATTR_RAWDEV); \ |
490 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_AVAIL); \ |
491 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_FREE); \ |
492 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_TOTAL); \ |
493 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_USED); \ |
494 | NFS_BITMAP_SET((A), NFS_FATTR_SYSTEM); \ |
495 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_ACCESS); \ |
496 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_ACCESS_SET); \ |
497 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_BACKUP); \ |
498 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_CREATE); \ |
499 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_DELTA); \ |
500 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_METADATA); \ |
501 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_MODIFY); \ |
502 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_MODIFY_SET); \ |
503 | NFS_BITMAP_SET((A), NFS_FATTR_MOUNTED_ON_FILEID); \ |
504 | } while (0) |
505 | |
506 | #define NFS4_PER_OBJECT_ATTRIBUTES(A) \ |
507 | do { \ |
508 | /* required: */ \ |
509 | NFS_BITMAP_SET((A), NFS_FATTR_TYPE); \ |
510 | NFS_BITMAP_SET((A), NFS_FATTR_CHANGE); \ |
511 | NFS_BITMAP_SET((A), NFS_FATTR_SIZE); \ |
512 | NFS_BITMAP_SET((A), NFS_FATTR_NAMED_ATTR); \ |
513 | NFS_BITMAP_SET((A), NFS_FATTR_FSID); \ |
514 | NFS_BITMAP_SET((A), NFS_FATTR_RDATTR_ERROR); \ |
515 | NFS_BITMAP_SET((A), NFS_FATTR_FILEHANDLE); \ |
516 | /* optional: */ \ |
517 | NFS_BITMAP_SET((A), NFS_FATTR_ACL); \ |
518 | NFS_BITMAP_SET((A), NFS_FATTR_ARCHIVE); \ |
519 | NFS_BITMAP_SET((A), NFS_FATTR_FILEID); \ |
520 | NFS_BITMAP_SET((A), NFS_FATTR_HIDDEN); \ |
521 | NFS_BITMAP_SET((A), NFS_FATTR_MAXLINK); \ |
522 | NFS_BITMAP_SET((A), NFS_FATTR_MIMETYPE); \ |
523 | NFS_BITMAP_SET((A), NFS_FATTR_MODE); \ |
524 | NFS_BITMAP_SET((A), NFS_FATTR_NUMLINKS); \ |
525 | NFS_BITMAP_SET((A), NFS_FATTR_OWNER); \ |
526 | NFS_BITMAP_SET((A), NFS_FATTR_OWNER_GROUP); \ |
527 | NFS_BITMAP_SET((A), NFS_FATTR_RAWDEV); \ |
528 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_USED); \ |
529 | NFS_BITMAP_SET((A), NFS_FATTR_SYSTEM); \ |
530 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_ACCESS); \ |
531 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_BACKUP); \ |
532 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_CREATE); \ |
533 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_METADATA); \ |
534 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_MODIFY); \ |
535 | NFS_BITMAP_SET((A), NFS_FATTR_MOUNTED_ON_FILEID); \ |
536 | } while (0) |
537 | |
538 | #define NFS4_PER_FS_ATTRIBUTES(A) \ |
539 | do { \ |
540 | /* required: */ \ |
541 | NFS_BITMAP_SET((A), NFS_FATTR_SUPPORTED_ATTRS); \ |
542 | NFS_BITMAP_SET((A), NFS_FATTR_FH_EXPIRE_TYPE); \ |
543 | NFS_BITMAP_SET((A), NFS_FATTR_LINK_SUPPORT); \ |
544 | NFS_BITMAP_SET((A), NFS_FATTR_SYMLINK_SUPPORT); \ |
545 | NFS_BITMAP_SET((A), NFS_FATTR_UNIQUE_HANDLES); \ |
546 | NFS_BITMAP_SET((A), NFS_FATTR_LEASE_TIME); \ |
547 | /* optional: */ \ |
548 | NFS_BITMAP_SET((A), NFS_FATTR_ACLSUPPORT); \ |
549 | NFS_BITMAP_SET((A), NFS_FATTR_CANSETTIME); \ |
550 | NFS_BITMAP_SET((A), NFS_FATTR_CASE_INSENSITIVE); \ |
551 | NFS_BITMAP_SET((A), NFS_FATTR_CASE_PRESERVING); \ |
552 | NFS_BITMAP_SET((A), NFS_FATTR_CHOWN_RESTRICTED); \ |
553 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_AVAIL); \ |
554 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_FREE); \ |
555 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_TOTAL); \ |
556 | NFS_BITMAP_SET((A), NFS_FATTR_FS_LOCATIONS); \ |
557 | NFS_BITMAP_SET((A), NFS_FATTR_HOMOGENEOUS); \ |
558 | NFS_BITMAP_SET((A), NFS_FATTR_MAXFILESIZE); \ |
559 | NFS_BITMAP_SET((A), NFS_FATTR_MAXNAME); \ |
560 | NFS_BITMAP_SET((A), NFS_FATTR_MAXREAD); \ |
561 | NFS_BITMAP_SET((A), NFS_FATTR_MAXWRITE); \ |
562 | NFS_BITMAP_SET((A), NFS_FATTR_NO_TRUNC); \ |
563 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_AVAIL); \ |
564 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_FREE); \ |
565 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_TOTAL); \ |
566 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_DELTA); \ |
567 | } while (0) |
568 | |
569 | #define NFS4_DEFAULT_ATTRIBUTES(A) \ |
570 | do { \ |
571 | /* required: */ \ |
572 | NFS_BITMAP_SET((A), NFS_FATTR_SUPPORTED_ATTRS); \ |
573 | NFS_BITMAP_SET((A), NFS_FATTR_TYPE); \ |
574 | NFS_BITMAP_SET((A), NFS_FATTR_FH_EXPIRE_TYPE); \ |
575 | NFS_BITMAP_SET((A), NFS_FATTR_CHANGE); \ |
576 | NFS_BITMAP_SET((A), NFS_FATTR_SIZE); \ |
577 | NFS_BITMAP_SET((A), NFS_FATTR_LINK_SUPPORT); \ |
578 | NFS_BITMAP_SET((A), NFS_FATTR_SYMLINK_SUPPORT); \ |
579 | NFS_BITMAP_SET((A), NFS_FATTR_NAMED_ATTR); \ |
580 | NFS_BITMAP_SET((A), NFS_FATTR_FSID); \ |
581 | NFS_BITMAP_SET((A), NFS_FATTR_UNIQUE_HANDLES); \ |
582 | NFS_BITMAP_SET((A), NFS_FATTR_LEASE_TIME); \ |
583 | /* NFS_BITMAP_SET((A), NFS_FATTR_RDATTR_ERROR); */ \ |
584 | /* NFS_BITMAP_SET((A), NFS_FATTR_FILEHANDLE); */ \ |
585 | /* optional: */ \ |
586 | /* NFS_BITMAP_SET((A), NFS_FATTR_ACL); */ \ |
587 | NFS_BITMAP_SET((A), NFS_FATTR_ACLSUPPORT); \ |
588 | NFS_BITMAP_SET((A), NFS_FATTR_ARCHIVE); \ |
589 | /* NFS_BITMAP_SET((A), NFS_FATTR_CANSETTIME); */ \ |
590 | NFS_BITMAP_SET((A), NFS_FATTR_CASE_INSENSITIVE); \ |
591 | NFS_BITMAP_SET((A), NFS_FATTR_CASE_PRESERVING); \ |
592 | NFS_BITMAP_SET((A), NFS_FATTR_CHOWN_RESTRICTED); \ |
593 | NFS_BITMAP_SET((A), NFS_FATTR_FILEID); \ |
594 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_AVAIL); \ |
595 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_FREE); \ |
596 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_TOTAL); \ |
597 | /* NFS_BITMAP_SET((A), NFS_FATTR_FS_LOCATIONS); */ \ |
598 | NFS_BITMAP_SET((A), NFS_FATTR_HIDDEN); \ |
599 | NFS_BITMAP_SET((A), NFS_FATTR_HOMOGENEOUS); \ |
600 | NFS_BITMAP_SET((A), NFS_FATTR_MAXFILESIZE); \ |
601 | NFS_BITMAP_SET((A), NFS_FATTR_MAXLINK); \ |
602 | NFS_BITMAP_SET((A), NFS_FATTR_MAXNAME); \ |
603 | NFS_BITMAP_SET((A), NFS_FATTR_MAXREAD); \ |
604 | NFS_BITMAP_SET((A), NFS_FATTR_MAXWRITE); \ |
605 | /* NFS_BITMAP_SET((A), NFS_FATTR_MIMETYPE); */ \ |
606 | NFS_BITMAP_SET((A), NFS_FATTR_MODE); \ |
607 | NFS_BITMAP_SET((A), NFS_FATTR_NO_TRUNC); \ |
608 | NFS_BITMAP_SET((A), NFS_FATTR_NUMLINKS); \ |
609 | NFS_BITMAP_SET((A), NFS_FATTR_OWNER); \ |
610 | NFS_BITMAP_SET((A), NFS_FATTR_OWNER_GROUP); \ |
611 | /* NFS_BITMAP_SET((A), NFS_FATTR_QUOTA_AVAIL_HARD); */ \ |
612 | /* NFS_BITMAP_SET((A), NFS_FATTR_QUOTA_AVAIL_SOFT); */ \ |
613 | /* NFS_BITMAP_SET((A), NFS_FATTR_QUOTA_USED); */ \ |
614 | NFS_BITMAP_SET((A), NFS_FATTR_RAWDEV); \ |
615 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_AVAIL); \ |
616 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_FREE); \ |
617 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_TOTAL); \ |
618 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_USED); \ |
619 | /* NFS_BITMAP_SET((A), NFS_FATTR_SYSTEM); */ \ |
620 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_ACCESS); \ |
621 | /* NFS_BITMAP_SET((A), NFS_FATTR_TIME_ACCESS_SET); */ \ |
622 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_BACKUP); \ |
623 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_CREATE); \ |
624 | /* NFS_BITMAP_SET((A), NFS_FATTR_TIME_DELTA); */ \ |
625 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_METADATA); \ |
626 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_MODIFY); \ |
627 | /* NFS_BITMAP_SET((A), NFS_FATTR_TIME_MODIFY_SET); */ \ |
628 | NFS_BITMAP_SET((A), NFS_FATTR_MOUNTED_ON_FILEID); \ |
629 | } while (0) |
630 | |
631 | /* |
632 | * NFSv4 WRITE RPCs contain partial GETATTR requests - only type, change, size, metadatatime and modifytime are requested. |
633 | * In such cases, we do not update the time stamp - but the requested attributes. |
634 | */ |
635 | #define NFS4_DEFAULT_WRITE_ATTRIBUTES(A) \ |
636 | do { \ |
637 | /* required: */ \ |
638 | NFS_BITMAP_SET((A), NFS_FATTR_TYPE); \ |
639 | NFS_BITMAP_SET((A), NFS_FATTR_CHANGE); \ |
640 | NFS_BITMAP_SET((A), NFS_FATTR_SIZE); \ |
641 | /* optional: */ \ |
642 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_METADATA); \ |
643 | NFS_BITMAP_SET((A), NFS_FATTR_TIME_MODIFY); \ |
644 | } while (0) |
645 | |
646 | /* attributes requested when we want to do a "statfs" */ |
647 | #define NFS4_STATFS_ATTRIBUTES(A) \ |
648 | do { \ |
649 | /* optional: */ \ |
650 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_AVAIL); \ |
651 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_FREE); \ |
652 | NFS_BITMAP_SET((A), NFS_FATTR_FILES_TOTAL); \ |
653 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_AVAIL); \ |
654 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_FREE); \ |
655 | NFS_BITMAP_SET((A), NFS_FATTR_SPACE_TOTAL); \ |
656 | } while (0) |
657 | |
658 | /* |
659 | * NFS OPEN constants |
660 | */ |
661 | /* open type */ |
662 | #define NFS_OPEN_NOCREATE 0 |
663 | #define NFS_OPEN_CREATE 1 |
664 | /* delegation space limit */ |
665 | #define NFS_LIMIT_SIZE 1 |
666 | #define NFS_LIMIT_BLOCKS 2 |
667 | /* access/deny modes */ |
668 | #define NFS_OPEN_SHARE_ACCESS_NONE 0x00000000 |
669 | #define NFS_OPEN_SHARE_ACCESS_READ 0x00000001 |
670 | #define NFS_OPEN_SHARE_ACCESS_WRITE 0x00000002 |
671 | #define NFS_OPEN_SHARE_ACCESS_BOTH 0x00000003 |
672 | #define NFS_OPEN_SHARE_DENY_NONE 0x00000000 |
673 | #define NFS_OPEN_SHARE_DENY_READ 0x00000001 |
674 | #define NFS_OPEN_SHARE_DENY_WRITE 0x00000002 |
675 | #define NFS_OPEN_SHARE_DENY_BOTH 0x00000003 |
676 | /* delegation types */ |
677 | #define NFS_OPEN_DELEGATE_NONE 0 |
678 | #define NFS_OPEN_DELEGATE_READ 1 |
679 | #define NFS_OPEN_DELEGATE_WRITE 2 |
680 | /* delegation claim types */ |
681 | #define NFS_CLAIM_NULL 0 |
682 | #define NFS_CLAIM_PREVIOUS 1 |
683 | #define NFS_CLAIM_DELEGATE_CUR 2 |
684 | #define NFS_CLAIM_DELEGATE_PREV 3 |
685 | /* open result flags */ |
686 | #define NFS_OPEN_RESULT_CONFIRM 0x00000002 |
687 | #define NFS_OPEN_RESULT_LOCKTYPE_POSIX 0x00000004 |
688 | /* NFS lock types */ |
689 | #define NFS_LOCK_TYPE_READ 1 |
690 | #define NFS_LOCK_TYPE_WRITE 2 |
691 | #define NFS_LOCK_TYPE_READW 3 /* "blocking" */ |
692 | #define NFS_LOCK_TYPE_WRITEW 4 /* "blocking" */ |
693 | |
694 | /* NFSv4 RPC procedures */ |
695 | #define NFSPROC4_NULL 0 |
696 | #define NFSPROC4_COMPOUND 1 |
697 | #define NFSPROC4_CB_NULL 0 |
698 | #define NFSPROC4_CB_COMPOUND 1 |
699 | |
700 | /* NFSv4 opcodes */ |
701 | #define NFS_OP_ACCESS 3 |
702 | #define NFS_OP_CLOSE 4 |
703 | #define NFS_OP_COMMIT 5 |
704 | #define NFS_OP_CREATE 6 |
705 | #define NFS_OP_DELEGPURGE 7 |
706 | #define NFS_OP_DELEGRETURN 8 |
707 | #define NFS_OP_GETATTR 9 |
708 | #define NFS_OP_GETFH 10 |
709 | #define NFS_OP_LINK 11 |
710 | #define NFS_OP_LOCK 12 |
711 | #define NFS_OP_LOCKT 13 |
712 | #define NFS_OP_LOCKU 14 |
713 | #define NFS_OP_LOOKUP 15 |
714 | #define NFS_OP_LOOKUPP 16 |
715 | #define NFS_OP_NVERIFY 17 |
716 | #define NFS_OP_OPEN 18 |
717 | #define NFS_OP_OPENATTR 19 |
718 | #define NFS_OP_OPEN_CONFIRM 20 |
719 | #define NFS_OP_OPEN_DOWNGRADE 21 |
720 | #define NFS_OP_PUTFH 22 |
721 | #define NFS_OP_PUTPUBFH 23 |
722 | #define NFS_OP_PUTROOTFH 24 |
723 | #define NFS_OP_READ 25 |
724 | #define NFS_OP_READDIR 26 |
725 | #define NFS_OP_READLINK 27 |
726 | #define NFS_OP_REMOVE 28 |
727 | #define NFS_OP_RENAME 29 |
728 | #define NFS_OP_RENEW 30 |
729 | #define NFS_OP_RESTOREFH 31 |
730 | #define NFS_OP_SAVEFH 32 |
731 | #define NFS_OP_SECINFO 33 |
732 | #define NFS_OP_SETATTR 34 |
733 | #define NFS_OP_SETCLIENTID 35 |
734 | #define NFS_OP_SETCLIENTID_CONFIRM 36 |
735 | #define NFS_OP_VERIFY 37 |
736 | #define NFS_OP_WRITE 38 |
737 | #define NFS_OP_RELEASE_LOCKOWNER 39 |
738 | #define NFS_OP_ILLEGAL 10044 |
739 | #define NFS_OP_COUNT 40 |
740 | /* NFSv4 callback opcodes */ |
741 | #define NFS_OP_CB_GETATTR 3 |
742 | #define NFS_OP_CB_RECALL 4 |
743 | #define NFS_OP_CB_ILLEGAL 10044 |
744 | |
745 | /* NFSv4 file handle type flags */ |
746 | #define NFS_FH_PERSISTENT 0x00000000 |
747 | #define NFS_FH_NOEXPIRE_WITH_OPEN 0x00000001 |
748 | #define NFS_FH_VOLATILE_ANY 0x00000002 |
749 | #define NFS_FH_VOL_MIGRATION 0x00000004 |
750 | #define NFS_FH_VOL_RENAME 0x00000008 |
751 | |
752 | /* |
753 | * NFSv4 ACL constants |
754 | */ |
755 | /* ACE support mask bits */ |
756 | #define NFS_ACL_SUPPORT_ALLOW_ACL 0x00000001 |
757 | #define NFS_ACL_SUPPORT_DENY_ACL 0x00000002 |
758 | #define NFS_ACL_SUPPORT_AUDIT_ACL 0x00000004 |
759 | #define NFS_ACL_SUPPORT_ALARM_ACL 0x00000008 |
760 | /* ACE types */ |
761 | #define NFS_ACE_ACCESS_ALLOWED_ACE_TYPE 0x00000000 |
762 | #define NFS_ACE_ACCESS_DENIED_ACE_TYPE 0x00000001 |
763 | #define NFS_ACE_SYSTEM_AUDIT_ACE_TYPE 0x00000002 |
764 | #define NFS_ACE_SYSTEM_ALARM_ACE_TYPE 0x00000003 |
765 | /* ACE flags */ |
766 | #define NFS_ACE_FILE_INHERIT_ACE 0x00000001 |
767 | #define NFS_ACE_DIRECTORY_INHERIT_ACE 0x00000002 |
768 | #define NFS_ACE_NO_PROPAGATE_INHERIT_ACE 0x00000004 |
769 | #define NFS_ACE_INHERIT_ONLY_ACE 0x00000008 |
770 | #define NFS_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 |
771 | #define NFS_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020 |
772 | #define NFS_ACE_IDENTIFIER_GROUP 0x00000040 |
773 | #define NFS_ACE_INHERITED_ACE 0x00000080 |
774 | /* ACE mask flags */ |
775 | #define NFS_ACE_READ_DATA 0x00000001 |
776 | #define NFS_ACE_LIST_DIRECTORY 0x00000001 |
777 | #define NFS_ACE_WRITE_DATA 0x00000002 |
778 | #define NFS_ACE_ADD_FILE 0x00000002 |
779 | #define NFS_ACE_APPEND_DATA 0x00000004 |
780 | #define NFS_ACE_ADD_SUBDIRECTORY 0x00000004 |
781 | #define NFS_ACE_READ_NAMED_ATTRS 0x00000008 |
782 | #define NFS_ACE_WRITE_NAMED_ATTRS 0x00000010 |
783 | #define NFS_ACE_EXECUTE 0x00000020 |
784 | #define NFS_ACE_DELETE_CHILD 0x00000040 |
785 | #define NFS_ACE_READ_ATTRIBUTES 0x00000080 |
786 | #define NFS_ACE_WRITE_ATTRIBUTES 0x00000100 |
787 | #define NFS_ACE_DELETE 0x00010000 |
788 | #define NFS_ACE_READ_ACL 0x00020000 |
789 | #define NFS_ACE_WRITE_ACL 0x00040000 |
790 | #define NFS_ACE_WRITE_OWNER 0x00080000 |
791 | #define NFS_ACE_SYNCHRONIZE 0x00100000 |
792 | #define NFS_ACE_GENERIC_READ 0x00120081 |
793 | #define NFS_ACE_GENERIC_WRITE 0x00160106 |
794 | #define NFS_ACE_GENERIC_EXECUTE 0x001200A0 |
795 | |
796 | |
797 | /* |
798 | * Quads are defined as arrays of 2 32-bit values to ensure dense packing |
799 | * for the protocol and to facilitate xdr conversion. |
800 | */ |
801 | struct nfs_uquad { |
802 | u_int32_t nfsuquad[2]; |
803 | }; |
804 | typedef struct nfs_uquad nfsuint64; |
805 | |
806 | /* |
807 | * Used to convert between two u_int32_ts and a u_quad_t. |
808 | */ |
809 | union nfs_quadconvert { |
810 | u_int32_t lval[2]; |
811 | u_quad_t qval; |
812 | }; |
813 | typedef union nfs_quadconvert nfsquad_t; |
814 | |
815 | /* |
816 | * special data/attribute associated with NFBLK/NFCHR |
817 | */ |
818 | struct nfs_specdata { |
819 | uint32_t specdata1; /* major device number */ |
820 | uint32_t specdata2; /* minor device number */ |
821 | }; |
822 | typedef struct nfs_specdata nfs_specdata; |
823 | |
824 | /* |
825 | * an "fsid" large enough to hold an NFSv4 fsid. |
826 | */ |
827 | struct nfs_fsid { |
828 | uint64_t major; |
829 | uint64_t minor; |
830 | }; |
831 | typedef struct nfs_fsid nfs_fsid; |
832 | |
833 | /* |
834 | * NFSv4 stateid structure |
835 | */ |
836 | struct nfs_stateid { |
837 | uint32_t seqid; |
838 | uint32_t other[3]; |
839 | }; |
840 | typedef struct nfs_stateid nfs_stateid; |
841 | |
842 | #endif /* __APPLE_API_PRIVATE */ |
843 | #endif /* _NFS_NFSPROTO_H_ */ |
844 | |