xref: /xnu-12377.1.9/bsd/nfs/nfsproto.h (revision f6217f891ac0bb64f3d375211650a4c1ff8ca1ea)
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 NFSV4_MINORVERSION              0   /* V4.0 Minor version */
103 #define NFSV41_MINORVERSION             1   /* V4.1 Minor version */
104 
105 #define NFS4_CALLBACK_PROG              0x40000000
106 #define NFS4_CALLBACK_PROG_VERSION      1
107 
108 /* Stat numbers for NFS RPC returns */
109 #define NFS_OK                          0
110 #define NFSERR_PERM                     1
111 #define NFSERR_NOENT                    2
112 #define NFSERR_IO                       5
113 #define NFSERR_NXIO                     6
114 #define NFSERR_ACCES                    13
115 #define NFSERR_EXIST                    17
116 #define NFSERR_XDEV                     18      /* Version 3 only */
117 #define NFSERR_NODEV                    19
118 #define NFSERR_NOTDIR                   20
119 #define NFSERR_ISDIR                    21
120 #define NFSERR_INVAL                    22      /* Version 3 only */
121 #define NFSERR_FBIG                     27
122 #define NFSERR_NOSPC                    28
123 #define NFSERR_ROFS                     30
124 #define NFSERR_MLINK                    31      /* Version 3 only */
125 #define NFSERR_NAMETOL                  63
126 #define NFSERR_NOTEMPTY                 66
127 #define NFSERR_DQUOT                    69
128 #define NFSERR_STALE                    70
129 #define NFSERR_REMOTE                   71      /* Version 3 only */
130 #define NFSERR_WFLUSH                   99      /* Version 2 only */
131 
132 /* NFSv3 specific errors */
133 #define NFSERR_BADHANDLE                10001
134 #define NFSERR_NOT_SYNC                 10002
135 #define NFSERR_BAD_COOKIE               10003
136 #define NFSERR_NOTSUPP                  10004
137 #define NFSERR_TOOSMALL                 10005
138 #define NFSERR_SERVERFAULT              10006
139 #define NFSERR_BADTYPE                  10007
140 #define NFSERR_JUKEBOX                  10008
141 #define NFSERR_TRYLATER                 NFSERR_JUKEBOX
142 #define NFSERR_DELAY                    NFSERR_JUKEBOX
143 
144 /* NFSv4.0 specific errors */
145 #define NFSERR_SAME                     10009
146 #define NFSERR_DENIED                   10010
147 #define NFSERR_EXPIRED                  10011
148 #define NFSERR_LOCKED                   10012
149 #define NFSERR_GRACE                    10013
150 #define NFSERR_FHEXPIRED                10014
151 #define NFSERR_SHARE_DENIED             10015
152 #define NFSERR_WRONGSEC                 10016
153 #define NFSERR_CLID_INUSE               10017
154 #define NFSERR_RESOURCE                 10018
155 #define NFSERR_MOVED                    10019
156 #define NFSERR_NOFILEHANDLE             10020
157 #define NFSERR_MINOR_VERS_MISMATCH      10021
158 #define NFSERR_STALE_CLIENTID           10022
159 #define NFSERR_STALE_STATEID            10023
160 #define NFSERR_OLD_STATEID              10024
161 #define NFSERR_BAD_STATEID              10025
162 #define NFSERR_BAD_SEQID                10026
163 #define NFSERR_NOT_SAME                 10027
164 #define NFSERR_LOCK_RANGE               10028
165 #define NFSERR_SYMLINK                  10029
166 #define NFSERR_RESTOREFH                10030
167 #define NFSERR_LEASE_MOVED              10031
168 #define NFSERR_ATTRNOTSUPP              10032
169 #define NFSERR_NO_GRACE                 10033
170 #define NFSERR_RECLAIM_BAD              10034
171 #define NFSERR_RECLAIM_CONFLICT         10035
172 #define NFSERR_BADXDR                   10036
173 #define NFSERR_LOCKS_HELD               10037
174 #define NFSERR_OPENMODE                 10038
175 #define NFSERR_BADOWNER                 10039
176 #define NFSERR_BADCHAR                  10040
177 #define NFSERR_BADNAME                  10041
178 #define NFSERR_BAD_RANGE                10042
179 #define NFSERR_LOCK_NOTSUPP             10043
180 #define NFSERR_OP_ILLEGAL               10044
181 #define NFSERR_DEADLOCK                 10045
182 #define NFSERR_FILE_OPEN                10046
183 #define NFSERR_ADMIN_REVOKED            10047
184 #define NFSERR_CB_PATH_DOWN             10048
185 
186 /* NFSv4.1 specific errors */
187 #define NFSERR_BADIOMODE                10049
188 #define NFSERR_BADLAYOUT                10050
189 #define NFSERR_BADSESSIONDIGEST         10051
190 #define NFSERR_BADSESSION               10052
191 #define NFSERR_BADSLOT                  10053
192 #define NFSERR_COMPLETEALREADY          10054
193 #define NFSERR_NOTBNDTOSESS             10055
194 #define NFSERR_DELEGALREADYWANT         10056
195 #define NFSERR_BACKCHANBUSY             10057
196 #define NFSERR_LAYOUTTRYLATER           10058
197 #define NFSERR_LAYOUTUNAVAIL            10059
198 #define NFSERR_NOMATCHLAYOUT            10060
199 #define NFSERR_RECALLCONFLICT           10061
200 #define NFSERR_UNKNLAYOUTTYPE           10062
201 #define NFSERR_SEQMISORDERED            10063
202 #define NFSERR_SEQUENCEPOS              10064
203 #define NFSERR_REQTOOBIG                10065
204 #define NFSERR_REPTOOBIG                10066
205 #define NFSERR_REPTOOBIGTOCACHE         10067
206 #define NFSERR_RETRYUNCACHEDREP         10068
207 #define NFSERR_UNSAFECOMPOUND           10069
208 #define NFSERR_TOOMANYOPS               10070
209 #define NFSERR_OPNOTINSESS              10071
210 #define NFSERR_HASHALGUNSUPP            10072
211 #define NFSERR_CLIENTIDBUSY             10074
212 #define NFSERR_PNFSIOHOLE               10075
213 #define NFSERR_SEQFALSERETRY            10076
214 #define NFSERR_BADHIGHSLOT              10077
215 #define NFSERR_DEADSESSION              10078
216 #define NFSERR_ENCRALGUNSUPP            10079
217 #define NFSERR_PNFSNOLAYOUT             10080
218 #define NFSERR_NOTONLYOP                10081
219 #define NFSERR_WRONGCRED                10082
220 #define NFSERR_WRONGTYPE                10083
221 #define NFSERR_DIRDELEGUNAVAIL          10084
222 #define NFSERR_REJECTDELEG              10085
223 #define NFSERR_RETURNCONFLICT           10086
224 #define NFSERR_DELEGREVOKED             10087
225 
226 #define NFSERR_STALEWRITEVERF           30001   /* Fake return for nfs_commit() */
227 #define NFSERR_DIRBUFDROPPED            30002   /* Fake return for nfs*_readdir_rpc() */
228 #define NFSERR_REPLYFROMCACHE           30003   /* Fake return for nfs41_sequence_cb_get() */
229 #define NFSERR_SEQSTATUSERR             30004   /* Fake return for nfs41_sequence_get() */
230 
231 /*
232  * For gss we would like to return EAUTH when we don't have or can't get credentials,
233  * but some callers don't know what to do with it, so we define our own version
234  * of EAUTH to be EACCES
235  */
236 #define NFSERR_EAUTH            EACCES
237 
238 #define NFSERR_RETVOID          0x20000000 /* Return void, not error */
239 #define NFSERR_AUTHERR          0x40000000 /* Mark an authentication error */
240 #define NFSERR_RETERR           0x80000000 /* Mark an error return for V3 */
241 
242 #endif /* !NFS_PROGRAM */
243 
244 /* Sizes in bytes of various nfs rpc components */
245 #define NFSX_UNSIGNED   4
246 
247 /* specific to NFS Version 2 */
248 #define NFSX_V2FH       32
249 #define NFSX_V2FATTR    68
250 #define NFSX_V2SATTR    32
251 #define NFSX_V2COOKIE   4
252 #define NFSX_V2STATFS   20
253 
254 /* specific to NFS Version 3 */
255 #define NFSX_V3FHMAX            64      /* max. allowed by protocol */
256 #define NFSX_V3FATTR            84
257 #define NFSX_V3SATTR            60      /* max. all fields filled in */
258 #define NFSX_V3POSTOPATTR       (NFSX_V3FATTR + NFSX_UNSIGNED)
259 #define NFSX_V3WCCDATA          (NFSX_V3POSTOPATTR + 8 * NFSX_UNSIGNED)
260 #define NFSX_V3COOKIEVERF       8
261 #define NFSX_V3WRITEVERF        8
262 #define NFSX_V3CREATEVERF       8
263 #define NFSX_V3STATFS           52
264 #define NFSX_V3FSINFO           48
265 #define NFSX_V3PATHCONF         24
266 
267 /* specific to NFS Version 4 */
268 #define NFS4_FHSIZE             128
269 #define NFS4_VERIFIER_SIZE      8
270 #define NFS4_OPAQUE_LIMIT       1024
271 #define NFS4_SESSIONID_SIZE     16
272 
273 /* variants for multiple versions */
274 #define NFSX_FH(V)              (((V) == NFS_VER2) ? NFSX_V2FH : (NFSX_UNSIGNED + \
275 	                         (((V) == NFS_VER3) ? NFSX_V3FHMAX : NFS4_FHSIZE)))
276 #define NFSX_SRVFH(V, FH)        (((V) == NFS_VER2) ? NFSX_V2FH : (FH)->nfh_len)
277 #define NFSX_FATTR(V)           (((V) == NFS_VER3) ? NFSX_V3FATTR : NFSX_V2FATTR)
278 #define NFSX_PREOPATTR(V)       (((V) == NFS_VER3) ? (7 * NFSX_UNSIGNED) : 0)
279 #define NFSX_POSTOPATTR(V)      (((V) == NFS_VER3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : 0)
280 #define NFSX_POSTOPORFATTR(V)   (((V) == NFS_VER3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : NFSX_V2FATTR)
281 #define NFSX_WCCDATA(V)         (((V) == NFS_VER3) ? NFSX_V3WCCDATA : 0)
282 #define NFSX_WCCORFATTR(V)      (((V) == NFS_VER3) ? NFSX_V3WCCDATA : NFSX_V2FATTR)
283 #define NFSX_SATTR(V)           (((V) == NFS_VER3) ? NFSX_V3SATTR : NFSX_V2SATTR)
284 #define NFSX_COOKIEVERF(V)      (((V) == NFS_VER3) ? NFSX_V3COOKIEVERF : 0)
285 #define NFSX_WRITEVERF(V)       (((V) == NFS_VER3) ? NFSX_V3WRITEVERF : 0)
286 #define NFSX_READDIR(V)         (((V) == NFS_VER3) ? (5 * NFSX_UNSIGNED) : \
287 	                                (2 * NFSX_UNSIGNED))
288 #define NFSX_STATFS(V)          (((V) == NFS_VER3) ? NFSX_V3STATFS : NFSX_V2STATFS)
289 
290 /* Only define these if nfs_prot.h hasn't been included */
291 #ifndef NFS_PROGRAM
292 
293 /* nfs rpc procedure numbers (before version mapping) */
294 #define NFSPROC_NULL            0
295 #define NFSPROC_GETATTR         1
296 #define NFSPROC_SETATTR         2
297 #define NFSPROC_LOOKUP          3
298 #define NFSPROC_ACCESS          4
299 #define NFSPROC_READLINK        5
300 #define NFSPROC_READ            6
301 #define NFSPROC_WRITE           7
302 #define NFSPROC_CREATE          8
303 #define NFSPROC_MKDIR           9
304 #define NFSPROC_SYMLINK         10
305 #define NFSPROC_MKNOD           11
306 #define NFSPROC_REMOVE          12
307 #define NFSPROC_RMDIR           13
308 #define NFSPROC_RENAME          14
309 #define NFSPROC_LINK            15
310 #define NFSPROC_READDIR         16
311 #define NFSPROC_READDIRPLUS     17
312 #define NFSPROC_FSSTAT          18
313 #define NFSPROC_FSINFO          19
314 #define NFSPROC_PATHCONF        20
315 #define NFSPROC_COMMIT          21
316 
317 #endif /* !NFS_PROGRAM */
318 
319 #define NFSPROC_NOOP            22
320 #define NFS_NPROCS              23
321 
322 /* Actual Version 2 procedure numbers */
323 #define NFSV2PROC_NULL          0
324 #define NFSV2PROC_GETATTR       1
325 #define NFSV2PROC_SETATTR       2
326 #define NFSV2PROC_NOOP          3
327 #define NFSV2PROC_ROOT          NFSV2PROC_NOOP  /* Obsolete */
328 #define NFSV2PROC_LOOKUP        4
329 #define NFSV2PROC_READLINK      5
330 #define NFSV2PROC_READ          6
331 #define NFSV2PROC_WRITECACHE    NFSV2PROC_NOOP  /* Obsolete */
332 #define NFSV2PROC_WRITE         8
333 #define NFSV2PROC_CREATE        9
334 #define NFSV2PROC_REMOVE        10
335 #define NFSV2PROC_RENAME        11
336 #define NFSV2PROC_LINK          12
337 #define NFSV2PROC_SYMLINK       13
338 #define NFSV2PROC_MKDIR         14
339 #define NFSV2PROC_RMDIR         15
340 #define NFSV2PROC_READDIR       16
341 #define NFSV2PROC_STATFS        17
342 
343 /*
344  * Constants used by the Version 3 protocol for various RPCs
345  */
346 
347 #define NFSV3FSINFO_LINK                0x01
348 #define NFSV3FSINFO_SYMLINK             0x02
349 #define NFSV3FSINFO_HOMOGENEOUS         0x08
350 #define NFSV3FSINFO_CANSETTIME          0x10
351 
352 /* time setting constants */
353 #define NFS_TIME_DONT_CHANGE            0
354 #define NFS_TIME_SET_TO_SERVER          1
355 #define NFS_TIME_SET_TO_CLIENT          2
356 #define NFS4_TIME_SET_TO_SERVER         0
357 #define NFS4_TIME_SET_TO_CLIENT         1
358 
359 /* access() constants */
360 #define NFS_ACCESS_READ                 0x01
361 #define NFS_ACCESS_LOOKUP               0x02
362 #define NFS_ACCESS_MODIFY               0x04
363 #define NFS_ACCESS_EXTEND               0x08
364 #define NFS_ACCESS_DELETE               0x10
365 #define NFS_ACCESS_EXECUTE              0x20
366 #define NFS_ACCESS_ALL (NFS_ACCESS_READ | NFS_ACCESS_MODIFY             \
367 	                 | NFS_ACCESS_EXTEND | NFS_ACCESS_EXECUTE       \
368 	                 | NFS_ACCESS_DELETE | NFS_ACCESS_LOOKUP)
369 
370 /* NFS WRITE how constants */
371 #define NFS_WRITE_UNSTABLE              0
372 #define NFS_WRITE_DATASYNC              1
373 #define NFS_WRITE_FILESYNC              2
374 
375 /* NFS CREATE types */
376 #define NFS_CREATE_UNCHECKED            0
377 #define NFS_CREATE_GUARDED              1
378 #define NFS_CREATE_EXCLUSIVE            2 /* Deprecated in NFSv4.1. */
379 #define NFS_CREATE_EXCLUSIVE4_1         3 /* New to NFSv4.1 */
380 
381 /* Only define these if nfs_prot.h hasn't been included */
382 #ifndef NFS_PROGRAM
383 /* NFS object types */
384 typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5,
385 	       NFSOCK=6, NFFIFO=7, NFATTRDIR=8, NFNAMEDATTR=9 } nfstype;
386 #endif /* !NFS_PROGRAM */
387 
388 /*
389  * File Handle (32 bytes for version 2), variable up to 64 for version 3
390  * and variable up to 128 bytes for version 4.
391  * File Handles of up to NFS_SMALLFH in size are stored directly in the
392  * nfs node, whereas larger ones are malloc'd. (This never happens when
393  * NFS_SMALLFH is set to the largest size.)
394  * NFS_SMALLFH should be in the range of 32 to 64 and be divisible by 4.
395  */
396 #ifndef NFS_SMALLFH
397 #define NFS_SMALLFH     64
398 #endif
399 
400 /*
401  * NFS attribute management stuff
402  */
403 #define NFS_ATTR_BITMAP_LEN     3
404 #define NFS_BITMAP_SET(B, I)    (((uint32_t *)(B))[(I)/32] |= 1U<<((I)%32))
405 #define NFS_BITMAP_CLR(B, I)    (((uint32_t *)(B))[(I)/32] &= ~(1U<<((I)%32)))
406 #define NFS_BITMAP_ISSET(B, I)  (((uint32_t *)(B))[(I)/32] & (1U<<((I)%32)))
407 #define NFS_BITMAP_COPY_ATTR(FROM, TO, WHICH, ATTR) \
408 	do { \
409 	        if (NFS_BITMAP_ISSET(((FROM)->nva_bitmap), (NFS_FATTR_##WHICH))) { \
410 	                (TO)->nva_##ATTR = (FROM)->nva_##ATTR; \
411 	                NFS_BITMAP_SET(((TO)->nva_bitmap), (NFS_FATTR_##WHICH)); \
412 	        } \
413 	} while (0)
414 #define NFS_BITMAP_COPY_TIME(FROM, TO, WHICH, ATTR) \
415 	do { \
416 	        if (NFS_BITMAP_ISSET(((FROM)->nva_bitmap), (NFS_FATTR_TIME_##WHICH))) { \
417 	                (TO)->nva_timesec[NFSTIME_##ATTR] = (FROM)->nva_timesec[NFSTIME_##ATTR]; \
418 	                (TO)->nva_timensec[NFSTIME_##ATTR] = (FROM)->nva_timensec[NFSTIME_##ATTR]; \
419 	                NFS_BITMAP_SET(((TO)->nva_bitmap), (NFS_FATTR_TIME_##WHICH)); \
420 	        } \
421 	} while (0)
422 #define NFS_BITMAP_ZERO(B, L) \
423 	do { \
424 	        int __i; \
425 	        for (__i=0; __i < (L); __i++) \
426 	                ((uint32_t*)(B))[__i] = 0; \
427 	} while (0)
428 
429 #define NFS_CLEAR_ATTRIBUTES(A) NFS_BITMAP_ZERO((A), NFS_ATTR_BITMAP_LEN)
430 #define NFS_COPY_ATTRIBUTES(SRC, DST) \
431 	do { \
432 	int __i; \
433 	for (__i=0; __i < NFS_ATTR_BITMAP_LEN; __i++) \
434 	        ((uint32_t*)(DST))[__i] = ((uint32_t*)(SRC))[__i]; \
435 	} while (0)
436 
437 /* NFS attributes */
438 #define NFS_FATTR_SUPPORTED_ATTRS               0
439 #define NFS_FATTR_TYPE                          1
440 #define NFS_FATTR_FH_EXPIRE_TYPE                2
441 #define NFS_FATTR_CHANGE                        3
442 #define NFS_FATTR_SIZE                          4
443 #define NFS_FATTR_LINK_SUPPORT                  5
444 #define NFS_FATTR_SYMLINK_SUPPORT               6
445 #define NFS_FATTR_NAMED_ATTR                    7
446 #define NFS_FATTR_FSID                          8
447 #define NFS_FATTR_UNIQUE_HANDLES                9
448 #define NFS_FATTR_LEASE_TIME                    10
449 #define NFS_FATTR_RDATTR_ERROR                  11
450 #define NFS_FATTR_FILEHANDLE                    19
451 #define NFS_FATTR_ACL                           12
452 #define NFS_FATTR_ACLSUPPORT                    13
453 #define NFS_FATTR_ARCHIVE                       14
454 #define NFS_FATTR_CANSETTIME                    15
455 #define NFS_FATTR_CASE_INSENSITIVE              16
456 #define NFS_FATTR_CASE_PRESERVING               17
457 #define NFS_FATTR_CHOWN_RESTRICTED              18
458 #define NFS_FATTR_FILEID                        20
459 #define NFS_FATTR_FILES_AVAIL                   21
460 #define NFS_FATTR_FILES_FREE                    22
461 #define NFS_FATTR_FILES_TOTAL                   23
462 #define NFS_FATTR_FS_LOCATIONS                  24
463 #define NFS_FATTR_HIDDEN                        25
464 #define NFS_FATTR_HOMOGENEOUS                   26
465 #define NFS_FATTR_MAXFILESIZE                   27
466 #define NFS_FATTR_MAXLINK                       28
467 #define NFS_FATTR_MAXNAME                       29
468 #define NFS_FATTR_MAXREAD                       30
469 #define NFS_FATTR_MAXWRITE                      31
470 #define NFS_FATTR_MIMETYPE                      32
471 #define NFS_FATTR_MODE                          33
472 #define NFS_FATTR_NO_TRUNC                      34
473 #define NFS_FATTR_NUMLINKS                      35
474 #define NFS_FATTR_OWNER                         36
475 #define NFS_FATTR_OWNER_GROUP                   37
476 #define NFS_FATTR_QUOTA_AVAIL_HARD              38
477 #define NFS_FATTR_QUOTA_AVAIL_SOFT              39
478 #define NFS_FATTR_QUOTA_USED                    40
479 #define NFS_FATTR_RAWDEV                        41
480 #define NFS_FATTR_SPACE_AVAIL                   42
481 #define NFS_FATTR_SPACE_FREE                    43
482 #define NFS_FATTR_SPACE_TOTAL                   44
483 #define NFS_FATTR_SPACE_USED                    45
484 #define NFS_FATTR_SYSTEM                        46
485 #define NFS_FATTR_TIME_ACCESS                   47
486 #define NFS_FATTR_TIME_ACCESS_SET               48
487 #define NFS_FATTR_TIME_BACKUP                   49
488 #define NFS_FATTR_TIME_CREATE                   50
489 #define NFS_FATTR_TIME_DELTA                    51
490 #define NFS_FATTR_TIME_METADATA                 52
491 #define NFS_FATTR_TIME_MODIFY                   53
492 #define NFS_FATTR_TIME_MODIFY_SET               54
493 #define NFS_FATTR_MOUNTED_ON_FILEID             55
494 #define NFS_FATTR_DIR_NOTIF_DELAY               56
495 #define NFS_FATTR_DIRENT_NOTIF_DELAY            57
496 #define NFS_FATTR_DACL                          58
497 #define NFS_FATTR_SACL                          59
498 #define NFS_FATTR_CHANGE_POLICY                 60
499 #define NFS_FATTR_FS_STATUS                     61
500 #define NFS_FATTR_FS_LAYOUT_TYPE                62
501 #define NFS_FATTR_LAYOUT_HINT                   63
502 #define NFS_FATTR_LAYOUT_TYPE                   64
503 #define NFS_FATTR_LAYOUT_BLKSIZE                65
504 #define NFS_FATTR_LAYOUT_ALIGNMENT              66
505 #define NFS_FATTR_FS_LOCATIONS_INFO             67
506 #define NFS_FATTR_MDSTHRESHOLD                  68
507 #define NFS_FATTR_RETENTION_GET                 69
508 #define NFS_FATTR_RETENTION_SET                 70
509 #define NFS_FATTR_RETENTEVT_GET                 71
510 #define NFS_FATTR_RETENTEVT_SET                 72
511 #define NFS_FATTR_RETENTION_HOLD                73
512 #define NFS_FATTR_MODE_SET_MASKED               74
513 #define NFS_FATTR_SUPPATTR_EXCLCREAT            75
514 #define NFS_FATTR_FS_CHARSET_CAP                76
515 
516 /*
517  * NFS OPEN constants
518  */
519 /* open type */
520 #define NFS_OPEN_NOCREATE                       0
521 #define NFS_OPEN_CREATE                         1
522 
523 /* delegation space limit */
524 #define NFS_LIMIT_SIZE                          1
525 #define NFS_LIMIT_BLOCKS                        2
526 
527 /* access/deny modes */
528 #define NFS_OPEN_SHARE_ACCESS_NONE              0x00000000
529 #define NFS_OPEN_SHARE_ACCESS_READ              0x00000001
530 #define NFS_OPEN_SHARE_ACCESS_WRITE             0x00000002
531 #define NFS_OPEN_SHARE_ACCESS_BOTH              0x00000003
532 #define NFS_OPEN_SHARE_DENY_NONE                0x00000000
533 #define NFS_OPEN_SHARE_DENY_READ                0x00000001
534 #define NFS_OPEN_SHARE_DENY_WRITE               0x00000002
535 #define NFS_OPEN_SHARE_DENY_BOTH                0x00000003
536 
537 /* flags for share_access field of OPEN4args */
538 #define NFS_OPEN4_SHARE_ACCESS_WANT_DELEG_MASK                    0x0FF00
539 #define NFS_OPEN4_SHARE_ACCESS_WANT_NO_PREFERENCE                 0x00000
540 #define NFS_OPEN4_SHARE_ACCESS_WANT_READ_DELEG                    0x00100
541 #define NFS_OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG                   0x00200
542 #define NFS_OPEN4_SHARE_ACCESS_WANT_ANY_DELEG                     0x00300
543 #define NFS_OPEN4_SHARE_ACCESS_WANT_NO_DELEG                      0x00400
544 #define NFS_OPEN4_SHARE_ACCESS_WANT_CANCEL                        0x00500
545 #define NFS_OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000
546 #define NFS_OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED   0x20000
547 
548 /* delegation types */
549 #define NFS_OPEN_DELEGATE_NONE                  0
550 #define NFS_OPEN_DELEGATE_READ                  1
551 #define NFS_OPEN_DELEGATE_WRITE                 2
552 #define NFS_OPEN_DELEGATE_NONE_EXT              3 /* New to v4.1 */
553 
554 /* delegation claim types */
555 #define NFS_CLAIM_NULL                          0
556 #define NFS_CLAIM_PREVIOUS                      1
557 #define NFS_CLAIM_DELEGATE_CUR                  2
558 #define NFS_CLAIM_DELEGATE_PREV                 3
559 #define NFS_CLAIM_FH                            4 /* New to v4.1 */
560 #define NFS_CLAIM_DELEG_CUR_FH                  5 /* New to v4.1 */
561 #define NFS_CLAIM_DELEG_PREV_FH                 6 /* New to v4.1 */
562 
563 /* why_no_delegation4 */
564 #define NFS_WND4_NOT_WANTED                     0
565 #define NFS_WND4_CONTENTION                     1
566 #define NFS_WND4_RESOURCE                       2
567 #define NFS_WND4_NOT_SUPP_FTYPE                 3
568 #define NFS_WND4_WRITE_DELEG_NOT_SUPP_FTYPE     4
569 #define NFS_WND4_NOT_SUPP_UPGRADE               5
570 #define NFS_WND4_NOT_SUPP_DOWNGRADE             6
571 #define NFS_WND4_CANCELLED                      7
572 #define NFS_WND4_IS_DIR                         8
573 
574 /* open result flags */
575 #define NFS_OPEN_RESULT_CONFIRM                 0x00000002
576 #define NFS_OPEN_RESULT_LOCKTYPE_POSIX          0x00000004
577 #define NFS_OPEN_RESULT_PRESERVE_UNLINKED       0x00000008
578 #define NFS_OPEN_RESULT_MAY_NOTIFY_LOCK         0x00000020
579 
580 /* NFS lock types */
581 #define NFS_LOCK_TYPE_READ                      1
582 #define NFS_LOCK_TYPE_WRITE                     2
583 #define NFS_LOCK_TYPE_READW                     3 /* "blocking" */
584 #define NFS_LOCK_TYPE_WRITEW                    4 /* "blocking" */
585 
586 /* NFSv4 RPC procedures */
587 #define NFSPROC4_NULL                           0
588 #define NFSPROC4_COMPOUND                       1
589 #define NFSPROC4_CB_NULL                        0
590 #define NFSPROC4_CB_COMPOUND                    1
591 
592 /* NFSv4 opcodes */
593 #define NFS_OP_ACCESS                           3
594 #define NFS_OP_CLOSE                            4
595 #define NFS_OP_COMMIT                           5
596 #define NFS_OP_CREATE                           6
597 #define NFS_OP_DELEGPURGE                       7
598 #define NFS_OP_DELEGRETURN                      8
599 #define NFS_OP_GETATTR                          9
600 #define NFS_OP_GETFH                            10
601 #define NFS_OP_LINK                             11
602 #define NFS_OP_LOCK                             12
603 #define NFS_OP_LOCKT                            13
604 #define NFS_OP_LOCKU                            14
605 #define NFS_OP_LOOKUP                           15
606 #define NFS_OP_LOOKUPP                          16
607 #define NFS_OP_NVERIFY                          17
608 #define NFS_OP_OPEN                             18
609 #define NFS_OP_OPENATTR                         19
610 #define NFS_OP_OPEN_CONFIRM                     20
611 #define NFS_OP_OPEN_DOWNGRADE                   21
612 #define NFS_OP_PUTFH                            22
613 #define NFS_OP_PUTPUBFH                         23
614 #define NFS_OP_PUTROOTFH                        24
615 #define NFS_OP_READ                             25
616 #define NFS_OP_READDIR                          26
617 #define NFS_OP_READLINK                         27
618 #define NFS_OP_REMOVE                           28
619 #define NFS_OP_RENAME                           29
620 #define NFS_OP_RENEW                            30
621 #define NFS_OP_RESTOREFH                        31
622 #define NFS_OP_SAVEFH                           32
623 #define NFS_OP_SECINFO                          33
624 #define NFS_OP_SETATTR                          34
625 #define NFS_OP_SETCLIENTID                      35
626 #define NFS_OP_SETCLIENTID_CONFIRM              36
627 #define NFS_OP_VERIFY                           37
628 #define NFS_OP_WRITE                            38
629 #define NFS_OP_RELEASE_LOCKOWNER                39
630 
631 /* NFSv4 opcodes */
632 #define NFS_V4_OP_COUNT                         40
633 
634 /* NFSv4.1 opcodes */
635 #define NFS_OP_BACKCHANNELCTL                   40
636 #define NFS_OP_BINDCONNTOSESS                   41
637 #define NFS_OP_EXCHANGEID                       42
638 #define NFS_OP_CREATESESSION                    43
639 #define NFS_OP_DESTROYSESSION                   44
640 #define NFS_OP_FREESTATEID                      45
641 #define NFS_OP_GETDIRDELEG                      46
642 #define NFS_OP_GETDEVINFO                       47
643 #define NFS_OP_GETDEVLIST                       48
644 #define NFS_OP_LAYOUTCOMMIT                     49
645 #define NFS_OP_LAYOUTGET                        50
646 #define NFS_OP_LAYOUTRETURN                     51
647 #define NFS_OP_SECINFONONAME                    52
648 #define NFS_OP_SEQUENCE                         53
649 #define NFS_OP_SETSSV                           54
650 #define NFS_OP_TESTSTATEID                      55
651 #define NFS_OP_WANTDELEG                        56
652 #define NFS_OP_DESTROYCLIENTID                  57
653 #define NFS_OP_RECLAIMCOMPL                     58
654 
655 /* NFSv4.1 opcodes */
656 #define NFS_V41_OP_COUNT                        59
657 
658 /* illegal op code */
659 #define NFS_OP_ILLEGAL                          10044
660 
661 /* NFSv4 callback opcodes */
662 #define NFS_OP_CB_GETATTR                       3
663 #define NFS_OP_CB_RECALL                        4
664 
665 /* NFSv4 callback opcodes */
666 #define NFS_V4_OP_CB_COUNT                      5
667 
668 /* NFSv4.1 callback opcodes */
669 #define NFS_OP_CB_LAYOUTRECALL                  5
670 #define NFS_OP_CB_NOTIFY                        6
671 #define NFS_OP_CB_PUSHDELEG                     7
672 #define NFS_OP_CB_RECALLANY                     8
673 #define NFS_OP_CB_RECALLOBJAVAIL                9
674 #define NFS_OP_CB_RECALLSLOT                    10
675 #define NFS_OP_CB_SEQUENCE                      11
676 #define NFS_OP_CB_WANTCANCELLED                 12
677 #define NFS_OP_CB_NOTIFYLOCK                    13
678 #define NFS_OP_CB_NOTIFYDEVID                   14
679 
680 /* NFSv4.1 callback opcodes */
681 #define NFS_V41_OP_CB_COUNT                     15
682 
683 /* illegal op code */
684 #define NFS_OP_CB_ILLEGAL                       10044
685 
686 /* NFSv4 file handle type flags */
687 #define NFS_FH_PERSISTENT                       0x00000000
688 #define NFS_FH_NOEXPIRE_WITH_OPEN               0x00000001
689 #define NFS_FH_VOLATILE_ANY                     0x00000002
690 #define NFS_FH_VOL_MIGRATION                    0x00000004
691 #define NFS_FH_VOL_RENAME                       0x00000008
692 
693 /* NFSv4.1 Constants */
694 
695 /* BIND_CONN_TO_SESSION - Associate Connection with Session */
696 #define NFS_CDFC4_FORE                          0x1
697 #define NFS_CDFC4_BACK                          0x2
698 #define NFS_CDFC4_FORE_OR_BOTH                  0x3
699 #define NFS_CDFC4_BACK_OR_BOTH                  0x7
700 
701 #define NFS_CDFS4_FORE                          0x1
702 #define NFS_CDFS4_BACK                          0x2
703 #define NFS_CDFS4_BOTH                          0x3
704 
705 /* EXCHANGE_ID - Instantiate Client ID */
706 #define NFS_EXCHGID4_FLAG_SUPP_MOVED_REFER       0x00000001
707 #define NFS_EXCHGID4_FLAG_SUPP_MOVED_MIGR        0x00000002
708 #define NFS_EXCHGID4_FLAG_BIND_PRINC_STATEID     0x00000100
709 #define NFS_EXCHGID4_FLAG_USE_NON_PNFS           0x00010000
710 #define NFS_EXCHGID4_FLAG_USE_PNFS_MDS           0x00020000
711 #define NFS_EXCHGID4_FLAG_USE_PNFS_DS            0x00040000
712 #define NFS_EXCHGID4_FLAG_MASK_PNFS              0x00070000
713 #define NFS_EXCHGID4_FLAG_UPD_CONFIRMED_REC_A    0x40000000
714 #define NFS_EXCHGID4_FLAG_CONFIRMED_R            0x80000000
715 
716 #define NFS_EXCHGID4_SP4_NONE                    0
717 #define NFS_EXCHGID4_SP4_MACH_CRED               1
718 #define NFS_EXCHGID4_SP4_SSV                     2
719 
720 /* CREATE_SESSION - Create New Session and Confirm Client ID */
721 #define NFS_CREATE_SESSION4_FLAG_PERSIST         0x00000001
722 #define NFS_CREATE_SESSION4_FLAG_CONN_BACK_CHAN  0x00000002
723 #define NFS_CREATE_SESSION4_FLAG_CONN_RDMA       0x00000004
724 
725 /* GET_DIR_DELEGATION - Get a Directory Delegation */
726 #define NFS_GDD4_OK                              0
727 #define NFS_GDD4_UNAVAIL                         1
728 
729 /* LAYOUTRETURN - Release Layout Information */
730 #define NFS_LAYOUT4_RET_REC_FILE                 1
731 #define NFS_LAYOUT4_RET_REC_FSID                 2
732 #define NFS_LAYOUT4_RET_REC_ALL                  3
733 
734 #define NFS_LAYOUTRETURN4_FILE                   NFS_LAYOUT4_RET_REC_FILE
735 #define NFS_LAYOUTRETURN4_FSID                   NFS_LAYOUT4_RET_REC_FSID
736 #define NFS_LAYOUTRETURN4_ALL                    NFS_LAYOUT4_RET_REC_ALL
737 
738 /* SECINFO_NO_NAME - Get Security on Unnamed Object */
739 #define NFS_SECINFO_STYLE4_CURRENT_FH            0
740 #define NFS_SECINFO_STYLE4_PARENT                1
741 
742 /* SEQUENCE - Supply Per-Procedure Sequencing and Control */
743 #define NFS_SEQ4_STATUS_CB_PATH_DOWN                   0x00000001
744 #define NFS_SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING       0x00000002
745 #define NFS_SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED        0x00000004
746 #define NFS_SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED      0x00000008
747 #define NFS_SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED     0x00000010
748 #define NFS_SEQ4_STATUS_ADMIN_STATE_REVOKED            0x00000020
749 #define NFS_SEQ4_STATUS_RECALLABLE_STATE_REVOKED       0x00000040
750 #define NFS_SEQ4_STATUS_LEASE_MOVED                    0x00000080
751 #define NFS_SEQ4_STATUS_RESTART_RECLAIM_NEEDED         0x00000100
752 #define NFS_SEQ4_STATUS_CB_PATH_DOWN_SESSION           0x00000200
753 #define NFS_SEQ4_STATUS_BACKCHANNEL_FAULT              0x00000400
754 #define NFS_SEQ4_STATUS_DEVID_CHANGED                  0x00000800
755 #define NFS_SEQ4_STATUS_DEVID_DELETED                  0x00001000
756 
757 /* CB_LAYOUTRECALL - Recall Layout from Client */
758 #define NFS_LAYOUTRECALL4_FILE NFS_LAYOUT4_RET_REC_FILE
759 #define NFS_LAYOUTRECALL4_FSID NFS_LAYOUT4_RET_REC_FSID
760 #define NFS_LAYOUTRECALL4_ALL  NFS_LAYOUT4_RET_REC_ALL
761 
762 /* CB_NOTIFY - Notify Client of Directory Changes */
763 #define NFS_NOTIFY4_CHANGE_CHILD_ATTRS        0
764 #define NFS_NOTIFY4_CHANGE_DIR_ATTRS          1
765 #define NFS_NOTIFY4_REMOVE_ENTRY              2
766 #define NFS_NOTIFY4_ADD_ENTRY                 3
767 #define NFS_NOTIFY4_RENAME_ENTRY              4
768 #define NFS_NOTIFY4_CHANGE_COOKIE_VERIFIER    5
769 
770 /* CB_RECALL_ANY - Keep Any N Recallable Objects */
771 #define NFS_RCA4_TYPE_MASK_RDATA_DLG          0
772 #define NFS_RCA4_TYPE_MASK_WDATA_DLG          1
773 #define NFS_RCA4_TYPE_MASK_DIR_DLG            2
774 #define NFS_RCA4_TYPE_MASK_FILE_LAYOUT        3
775 #define NFS_RCA4_TYPE_MASK_BLK_LAYOUT         4
776 #define NFS_RCA4_TYPE_MASK_OBJ_LAYOUT_MIN     8
777 #define NFS_RCA4_TYPE_MASK_OBJ_LAYOUT_MAX     9
778 #define NFS_RCA4_TYPE_MASK_OTHER_LAYOUT_MIN   12
779 #define NFS_RCA4_TYPE_MASK_OTHER_LAYOUT_MAX   15
780 
781 /* CB_NOTIFY_DEVICEID - Notify Client of Device ID Changes */
782 #define NFS_NOTIFY_DEVICEID4_CHANGE           1
783 #define NFS_NOTIFY_DEVICEID4_DELETE           2
784 
785 /*
786  * NFSv4 ACL constants
787  */
788 /* ACE support mask bits */
789 #define NFS_ACL_SUPPORT_ALLOW_ACL               0x00000001
790 #define NFS_ACL_SUPPORT_DENY_ACL                0x00000002
791 #define NFS_ACL_SUPPORT_AUDIT_ACL               0x00000004
792 #define NFS_ACL_SUPPORT_ALARM_ACL               0x00000008
793 
794 /* ACE types */
795 #define NFS_ACE_ACCESS_ALLOWED_ACE_TYPE         0x00000000
796 #define NFS_ACE_ACCESS_DENIED_ACE_TYPE          0x00000001
797 #define NFS_ACE_SYSTEM_AUDIT_ACE_TYPE           0x00000002
798 #define NFS_ACE_SYSTEM_ALARM_ACE_TYPE           0x00000003
799 
800 /* ACE flags */
801 #define NFS_ACE_FILE_INHERIT_ACE                0x00000001
802 #define NFS_ACE_DIRECTORY_INHERIT_ACE           0x00000002
803 #define NFS_ACE_NO_PROPAGATE_INHERIT_ACE        0x00000004
804 #define NFS_ACE_INHERIT_ONLY_ACE                0x00000008
805 #define NFS_ACE_SUCCESSFUL_ACCESS_ACE_FLAG      0x00000010
806 #define NFS_ACE_FAILED_ACCESS_ACE_FLAG          0x00000020
807 #define NFS_ACE_IDENTIFIER_GROUP                0x00000040
808 #define NFS_ACE_INHERITED_ACE                   0x00000080
809 
810 /* ACE mask flags */
811 #define NFS_ACE_READ_DATA                       0x00000001
812 #define NFS_ACE_LIST_DIRECTORY                  0x00000001
813 #define NFS_ACE_WRITE_DATA                      0x00000002
814 #define NFS_ACE_ADD_FILE                        0x00000002
815 #define NFS_ACE_APPEND_DATA                     0x00000004
816 #define NFS_ACE_ADD_SUBDIRECTORY                0x00000004
817 #define NFS_ACE_READ_NAMED_ATTRS                0x00000008
818 #define NFS_ACE_WRITE_NAMED_ATTRS               0x00000010
819 #define NFS_ACE_EXECUTE                         0x00000020
820 #define NFS_ACE_DELETE_CHILD                    0x00000040
821 #define NFS_ACE_READ_ATTRIBUTES                 0x00000080
822 #define NFS_ACE_WRITE_ATTRIBUTES                0x00000100
823 #define NFS_ACE_WRITE_RETENTION                 0x00000200
824 #define NFS_ACE_WRITE_RETENTION_HOLD            0x00000400
825 #define NFS_ACE_DELETE                          0x00010000
826 #define NFS_ACE_READ_ACL                        0x00020000
827 #define NFS_ACE_WRITE_ACL                       0x00040000
828 #define NFS_ACE_WRITE_OWNER                     0x00080000
829 #define NFS_ACE_SYNCHRONIZE                     0x00100000
830 #define NFS_ACE_GENERIC_READ                    0x00120081
831 #define NFS_ACE_GENERIC_WRITE                   0x00160106
832 #define NFS_ACE_GENERIC_EXECUTE                 0x001200A0
833 
834 /* deviceid4 */
835 #define NFS4_DEVICEID4_SIZE           16
836 
837 /* retention_get */
838 #define NFS_RET4_DURATION_INFINITE    0xffffffffffffffff
839 
840 /* na41_flag */
841 #define NFS_ACL4_AUTO_INHERIT         0x00000001
842 #define NFS_ACL4_PROTECTED            0x00000002
843 #define NFS_ACL4_DEFAULTED            0x00000004
844 
845 /* thi_hintset */
846 #define NFS_TH4_READ_SIZE             0
847 #define NFS_TH4_WRITE_SIZE            1
848 #define NFS_TH4_READ_IOSIZE           2
849 #define NFS_TH4_WRITE_IOSIZE          3
850 
851 /* fs_locations_info4 */
852 #define NFS_FSLI4BX_GFLAGS            0
853 #define NFS_FSLI4BX_TFLAGS            1
854 
855 #define NFS_FSLI4BX_CLSIMUL           2
856 #define NFS_FSLI4BX_CLHANDLE          3
857 #define NFS_FSLI4BX_CLFILEID          4
858 #define NFS_FSLI4BX_CLWRITEVER        5
859 #define NFS_FSLI4BX_CLCHANGE          6
860 #define NFS_FSLI4BX_CLREADDIR         7
861 
862 #define NFS_FSLI4BX_READRANK          8
863 #define NFS_FSLI4BX_WRITERANK         9
864 #define NFS_FSLI4BX_READORDER         10
865 #define NFS_FSLI4BX_WRITEORDER        11
866 
867 #define NFS_FSLI4GF_WRITABLE          0x01
868 #define NFS_FSLI4GF_CUR_REQ           0x02
869 #define NFS_FSLI4GF_ABSENT            0x04
870 #define NFS_FSLI4GF_GOING             0x08
871 #define NFS_FSLI4GF_SPLIT             0x10
872 
873 #define NFS_FSLI4TF_RDMA              0x01 /* Bits defined within the transport flag byte */
874 
875 #define NFS_FSLI4IF_VAR_SUB           0x00000001 /* Flag bits in fli_flags */
876 
877 /* layouttype4 */
878 #define NFS_LAYOUT4_NFSV4_1_FILES     0x1
879 #define NFS_LAYOUT4_OSD2_OBJECTS      0x2
880 #define NFS_LAYOUT4_BLOCK_VOLUME      0x3
881 
882 /* layoutiomode4 */
883 #define NFS_LAYOUTIOMODE4_READ        1
884 #define NFS_LAYOUTIOMODE4_RW          2
885 #define NFS_LAYOUTIOMODE4_ANY         3
886 
887 /* fs4_status_type */
888 #define NFS_STATUS4_FIXED             1
889 #define NFS_STATUS4_UPDATED           2
890 #define NFS_STATUS4_VERSIONED         3
891 #define NFS_STATUS4_WRITABLE          4
892 #define NFS_STATUS4_REFERRAL          5
893 
894 /* nfsv4_1_file_layouthint4 */
895 #define NFS_NFL4_UFLG_MASK                   0x0000003F
896 #define NFS_NFL4_UFLG_DENSE                  0x00000001
897 #define NFS_NFL4_UFLG_COMMIT_THRU_MDS        0x00000002
898 #define NFS_NFL4_UFLG_STRIPE_UNIT_SIZE_MASK  0xFFFFFFC0
899 
900 /* filelayout_hint_care4 */
901 #define NFS_NFLH4_CARE_DENSE                  NFS_NFL4_UFLG_DENSE
902 #define NFS_NFLH4_CARE_COMMIT_THRU_MDS        NFS_NFL4_UFLG_COMMIT_THRU_MDS
903 #define NFS_NFLH4_CARE_STRIPE_UNIT_SIZE       0x00000040
904 #define NFS_NFLH4_CARE_STRIPE_COUNT           0x00000080
905 
906 /* fs_charset_cap4 */
907 #define NFS_FSCHARSET_CAP4_CONTAINS_NON_UTF8  0x1
908 #define NFS_FSCHARSET_CAP4_ALLOWS_ONLY_UTF8   0x2
909 
910 /* ssv_subkey4 */
911 #define NFS_SSV4_SUBKEY_MIC_I2T                1
912 #define NFS_SSV4_SUBKEY_MIC_T2I                2
913 #define NFS_SSV4_SUBKEY_SEAL_I2T               3
914 #define NFS_SSV4_SUBKEY_SEAL_T2I               4
915 
916 /*
917  * Quads are defined as arrays of 2 32-bit values to ensure dense packing
918  * for the protocol and to facilitate xdr conversion.
919  */
920 struct nfs_uquad {
921 	u_int32_t       nfsuquad[2];
922 };
923 typedef struct nfs_uquad        nfsuint64;
924 
925 /*
926  * Used to convert between two u_int32_ts and a u_quad_t.
927  */
928 union nfs_quadconvert {
929 	u_int32_t               lval[2];
930 	u_quad_t        qval;
931 };
932 typedef union nfs_quadconvert   nfsquad_t;
933 
934 /*
935  * special data/attribute associated with NFBLK/NFCHR
936  */
937 struct nfs_specdata {
938 	uint32_t specdata1;     /* major device number */
939 	uint32_t specdata2;     /* minor device number */
940 };
941 typedef struct nfs_specdata nfs_specdata;
942 
943 /*
944  * an "fsid" large enough to hold an NFSv4 fsid.
945  */
946 struct nfs_fsid {
947 	uint64_t major;
948 	uint64_t minor;
949 };
950 typedef struct nfs_fsid nfs_fsid;
951 
952 /*
953  * NFSv4 stateid structure
954  */
955 struct nfs_stateid {
956 	uint32_t        seqid;
957 	uint32_t        other[3];
958 };
959 typedef struct nfs_stateid nfs_stateid;
960 
961 #endif /* __APPLE_API_PRIVATE */
962 #endif /* _NFS_NFSPROTO_H_ */
963