FreeBSD/Linux Kernel Cross Reference
sys/fs/nfs/nfsproto.h
1 /*-
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
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 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 4. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD: releng/8.4/sys/fs/nfs/nfsproto.h 223968 2011-07-12 21:01:09Z rmacklem $
33 */
34
35 #ifndef _NFS_NFSPROTO_H_
36 #define _NFS_NFSPROTO_H_
37
38 /*
39 * nfs definitions as per the Version 2, 3 and 4 specs
40 */
41
42 /*
43 * Constants as defined in the NFS Version 2, 3 and 4 specs.
44 * "NFS: Network File System Protocol Specification" RFC1094
45 * and in the "NFS: Network File System Version 3 Protocol
46 * Specification"
47 */
48
49 #define NFS_PORT 2049
50 #define NFS_PROG 100003
51 #define NFS_CALLBCKPROG 0x40000000 /* V4 only */
52 #define NFS_VER2 2
53 #define NFS_VER3 3
54 #define NFS_VER4 4
55 #define NFS_V2MAXDATA 8192
56 #define NFS_MAXDGRAMDATA 16384
57 #define NFS_MAXDATA NFS_MAXBSIZE
58 #define NFS_MAXPATHLEN 1024
59 #define NFS_MAXNAMLEN 255
60 #define NFS_MAXPKTHDR 404
61 #define NFS_MAXPACKET (NFS_MAXDATA + 2048)
62 #define NFS_MINPACKET 20
63 #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */
64 #define NFSV4_MINORVERSION 0 /* V4 Minor version */
65 #define NFSV4_CBVERS 1 /* V4 CB Version */
66 #define NFSV4_SMALLSTR 50 /* Strings small enough for stack */
67
68 /* Stat numbers for rpc returns (version 2, 3 and 4) */
69 /*
70 * These numbers are hard-wired in the RFCs, so they can't be changed.
71 * The code currently assumes that the ones < 10000 are the same as
72 * sys/errno.h and that sys/errno.h will never go as high as 10000.
73 * If the value in sys/errno.h of any entry listed below is changed,
74 * the NFS code must be modified to do the mapping between them.
75 * (You can ignore NFSERR_WFLUSH, since it is never actually used.)
76 */
77 #define NFSERR_OK 0
78 #define NFSERR_PERM 1
79 #define NFSERR_NOENT 2
80 #define NFSERR_IO 5
81 #define NFSERR_NXIO 6
82 #define NFSERR_ACCES 13
83 #define NFSERR_EXIST 17
84 #define NFSERR_XDEV 18 /* Version 3, 4 only */
85 #define NFSERR_NODEV 19
86 #define NFSERR_NOTDIR 20
87 #define NFSERR_ISDIR 21
88 #define NFSERR_INVAL 22 /* Version 3, 4 only */
89 #define NFSERR_FBIG 27
90 #define NFSERR_NOSPC 28
91 #define NFSERR_ROFS 30
92 #define NFSERR_MLINK 31 /* Version 3, 4 only */
93 #define NFSERR_NAMETOL 63
94 #define NFSERR_NOTEMPTY 66
95 #define NFSERR_DQUOT 69
96 #define NFSERR_STALE 70
97 #define NFSERR_REMOTE 71 /* Version 3 only */
98 #define NFSERR_WFLUSH 99 /* Version 2 only */
99 #define NFSERR_BADHANDLE 10001 /* These are Version 3, 4 only */
100 #define NFSERR_NOT_SYNC 10002 /* Version 3 Only */
101 #define NFSERR_BAD_COOKIE 10003
102 #define NFSERR_NOTSUPP 10004
103 #define NFSERR_TOOSMALL 10005
104 #define NFSERR_SERVERFAULT 10006
105 #define NFSERR_BADTYPE 10007
106 #define NFSERR_DELAY 10008 /* Called NFSERR_JUKEBOX for V3 */
107 #define NFSERR_SAME 10009 /* These are Version 4 only */
108 #define NFSERR_DENIED 10010
109 #define NFSERR_EXPIRED 10011
110 #define NFSERR_LOCKED 10012
111 #define NFSERR_GRACE 10013
112 #define NFSERR_FHEXPIRED 10014
113 #define NFSERR_SHAREDENIED 10015
114 #define NFSERR_WRONGSEC 10016
115 #define NFSERR_CLIDINUSE 10017
116 #define NFSERR_RESOURCE 10018
117 #define NFSERR_MOVED 10019
118 #define NFSERR_NOFILEHANDLE 10020
119 #define NFSERR_MINORVERMISMATCH 10021
120 #define NFSERR_STALECLIENTID 10022
121 #define NFSERR_STALESTATEID 10023
122 #define NFSERR_OLDSTATEID 10024
123 #define NFSERR_BADSTATEID 10025
124 #define NFSERR_BADSEQID 10026
125 #define NFSERR_NOTSAME 10027
126 #define NFSERR_LOCKRANGE 10028
127 #define NFSERR_SYMLINK 10029
128 #define NFSERR_RESTOREFH 10030
129 #define NFSERR_LEASEMOVED 10031
130 #define NFSERR_ATTRNOTSUPP 10032
131 #define NFSERR_NOGRACE 10033
132 #define NFSERR_RECLAIMBAD 10034
133 #define NFSERR_RECLAIMCONFLICT 10035
134 #define NFSERR_BADXDR 10036
135 #define NFSERR_LOCKSHELD 10037
136 #define NFSERR_OPENMODE 10038
137 #define NFSERR_BADOWNER 10039
138 #define NFSERR_BADCHAR 10040
139 #define NFSERR_BADNAME 10041
140 #define NFSERR_BADRANGE 10042
141 #define NFSERR_LOCKNOTSUPP 10043
142 #define NFSERR_OPILLEGAL 10044
143 #define NFSERR_DEADLOCK 10045
144 #define NFSERR_FILEOPEN 10046
145 #define NFSERR_ADMINREVOKED 10047
146 #define NFSERR_CBPATHDOWN 10048
147
148 #define NFSERR_STALEWRITEVERF 30001 /* Fake return for nfs_commit() */
149 #define NFSERR_DONTREPLY 30003 /* Don't process request */
150 #define NFSERR_RETVOID 30004 /* Return void, not error */
151 #define NFSERR_REPLYFROMCACHE 30005 /* Reply from recent request cache */
152 #define NFSERR_STALEDONTRECOVER 30006 /* Don't initiate recovery */
153
154 #define NFSERR_RPCERR 0x40000000 /* Mark an RPC layer error */
155 #define NFSERR_AUTHERR 0x80000000 /* Mark an authentication error */
156
157 #define NFSERR_RPCMISMATCH (NFSERR_RPCERR | RPC_MISMATCH)
158 #define NFSERR_PROGUNAVAIL (NFSERR_RPCERR | RPC_PROGUNAVAIL)
159 #define NFSERR_PROGMISMATCH (NFSERR_RPCERR | RPC_PROGMISMATCH)
160 #define NFSERR_PROGNOTV4 (NFSERR_RPCERR | 0xffff)
161 #define NFSERR_PROCUNAVAIL (NFSERR_RPCERR | RPC_PROCUNAVAIL)
162 #define NFSERR_GARBAGE (NFSERR_RPCERR | RPC_GARBAGE)
163
164 /* Sizes in bytes of various nfs rpc components */
165 #define NFSX_UNSIGNED 4
166 #define NFSX_HYPER (2 * NFSX_UNSIGNED)
167
168 /* specific to NFS Version 2 */
169 #define NFSX_V2FH 32
170 #define NFSX_V2FATTR 68
171 #define NFSX_V2SATTR 32
172 #define NFSX_V2COOKIE 4
173 #define NFSX_V2STATFS 20
174
175 /* specific to NFS Version 3 */
176 #define NFSX_V3FHMAX 64 /* max. allowed by protocol */
177 #define NFSX_V3FATTR 84
178 #define NFSX_V3SATTR 60 /* max. all fields filled in */
179 #define NFSX_V3SRVSATTR (sizeof (struct nfsv3_sattr))
180 #define NFSX_V3POSTOPATTR (NFSX_V3FATTR + NFSX_UNSIGNED)
181 #define NFSX_V3WCCDATA (NFSX_V3POSTOPATTR + 8 * NFSX_UNSIGNED)
182 #define NFSX_V3STATFS 52
183 #define NFSX_V3FSINFO 48
184 #define NFSX_V3PATHCONF 24
185
186 /* specific to NFS Version 4 */
187 #define NFSX_V4FHMAX 128
188 #define NFSX_V4FSID (2 * NFSX_HYPER)
189 #define NFSX_V4SPECDATA (2 * NFSX_UNSIGNED)
190 #define NFSX_V4TIME (NFSX_HYPER + NFSX_UNSIGNED)
191 #define NFSX_V4SETTIME (NFSX_UNSIGNED + NFSX_V4TIME)
192
193 /* sizes common to multiple NFS versions */
194 #define NFSX_FHMAX (NFSX_V4FHMAX)
195 #define NFSX_MYFH (sizeof (fhandle_t)) /* size this server uses */
196 #define NFSX_VERF 8
197 #define NFSX_STATEIDOTHER 12
198 #define NFSX_STATEID (NFSX_UNSIGNED + NFSX_STATEIDOTHER)
199 #define NFSX_GSSH 12
200
201 /* variants for multiple versions */
202 #define NFSX_STATFS(v3) ((v3) ? NFSX_V3STATFS : NFSX_V2STATFS)
203
204 /* nfs rpc procedure numbers (before version mapping) */
205 #define NFSPROC_NULL 0
206 #define NFSPROC_GETATTR 1
207 #define NFSPROC_SETATTR 2
208 #define NFSPROC_LOOKUP 3
209 #define NFSPROC_ACCESS 4
210 #define NFSPROC_READLINK 5
211 #define NFSPROC_READ 6
212 #define NFSPROC_WRITE 7
213 #define NFSPROC_CREATE 8
214 #define NFSPROC_MKDIR 9
215 #define NFSPROC_SYMLINK 10
216 #define NFSPROC_MKNOD 11
217 #define NFSPROC_REMOVE 12
218 #define NFSPROC_RMDIR 13
219 #define NFSPROC_RENAME 14
220 #define NFSPROC_LINK 15
221 #define NFSPROC_READDIR 16
222 #define NFSPROC_READDIRPLUS 17
223 #define NFSPROC_FSSTAT 18
224 #define NFSPROC_FSINFO 19
225 #define NFSPROC_PATHCONF 20
226 #define NFSPROC_COMMIT 21
227
228 /*
229 * NFSPROC_NOOP is a fake op# that can't be the same as any V2/3/4 Procedure
230 * or Operation#. Since the NFS V4 Op #s go higher, use NFSV4OP_NOPS, which
231 * is one greater than the highest Op#.
232 */
233 #define NFSPROC_NOOP NFSV4OP_NOPS
234
235 /* Actual Version 2 procedure numbers */
236 #define NFSV2PROC_NULL 0
237 #define NFSV2PROC_GETATTR 1
238 #define NFSV2PROC_SETATTR 2
239 #define NFSV2PROC_NOOP 3
240 #define NFSV2PROC_ROOT NFSV2PROC_NOOP /* Obsolete */
241 #define NFSV2PROC_LOOKUP 4
242 #define NFSV2PROC_READLINK 5
243 #define NFSV2PROC_READ 6
244 #define NFSV2PROC_WRITECACHE NFSV2PROC_NOOP /* Obsolete */
245 #define NFSV2PROC_WRITE 8
246 #define NFSV2PROC_CREATE 9
247 #define NFSV2PROC_REMOVE 10
248 #define NFSV2PROC_RENAME 11
249 #define NFSV2PROC_LINK 12
250 #define NFSV2PROC_SYMLINK 13
251 #define NFSV2PROC_MKDIR 14
252 #define NFSV2PROC_RMDIR 15
253 #define NFSV2PROC_READDIR 16
254 #define NFSV2PROC_STATFS 17
255
256 /*
257 * V4 Procedure numbers
258 */
259 #define NFSV4PROC_COMPOUND 1
260 #define NFSV4PROC_CBNULL 0
261 #define NFSV4PROC_CBCOMPOUND 1
262
263 /*
264 * Constants used by the Version 3 and 4 protocols for various RPCs
265 */
266 #define NFSV3SATTRTIME_DONTCHANGE 0
267 #define NFSV3SATTRTIME_TOSERVER 1
268 #define NFSV3SATTRTIME_TOCLIENT 2
269
270 #define NFSV4SATTRTIME_TOSERVER 0
271 #define NFSV4SATTRTIME_TOCLIENT 1
272
273 #define NFSV4LOCKT_READ 1
274 #define NFSV4LOCKT_WRITE 2
275 #define NFSV4LOCKT_READW 3
276 #define NFSV4LOCKT_WRITEW 4
277 #define NFSV4LOCKT_RELEASE 5
278
279 #define NFSV4OPEN_NOCREATE 0
280 #define NFSV4OPEN_CREATE 1
281 #define NFSV4OPEN_CLAIMNULL 0
282 #define NFSV4OPEN_CLAIMPREVIOUS 1
283 #define NFSV4OPEN_CLAIMDELEGATECUR 2
284 #define NFSV4OPEN_CLAIMDELEGATEPREV 3
285 #define NFSV4OPEN_DELEGATENONE 0
286 #define NFSV4OPEN_DELEGATEREAD 1
287 #define NFSV4OPEN_DELEGATEWRITE 2
288 #define NFSV4OPEN_LIMITSIZE 1
289 #define NFSV4OPEN_LIMITBLOCKS 2
290
291 /*
292 * Nfs V4 ACE stuff
293 */
294 #define NFSV4ACE_ALLOWEDTYPE 0x00000000
295 #define NFSV4ACE_DENIEDTYPE 0x00000001
296 #define NFSV4ACE_AUDITTYPE 0x00000002
297 #define NFSV4ACE_ALARMTYPE 0x00000003
298
299 #define NFSV4ACE_SUPALLOWED 0x00000001
300 #define NFSV4ACE_SUPDENIED 0x00000002
301 #define NFSV4ACE_SUPAUDIT 0x00000004
302 #define NFSV4ACE_SUPALARM 0x00000008
303
304 #define NFSV4ACE_SUPTYPES (NFSV4ACE_SUPALLOWED | NFSV4ACE_SUPDENIED)
305
306 #define NFSV4ACE_FILEINHERIT 0x00000001
307 #define NFSV4ACE_DIRECTORYINHERIT 0x00000002
308 #define NFSV4ACE_NOPROPAGATEINHERIT 0x00000004
309 #define NFSV4ACE_INHERITONLY 0x00000008
310 #define NFSV4ACE_SUCCESSFULACCESS 0x00000010
311 #define NFSV4ACE_FAILEDACCESS 0x00000020
312 #define NFSV4ACE_IDENTIFIERGROUP 0x00000040
313
314 #define NFSV4ACE_READDATA 0x00000001
315 #define NFSV4ACE_LISTDIRECTORY 0x00000001
316 #define NFSV4ACE_WRITEDATA 0x00000002
317 #define NFSV4ACE_ADDFILE 0x00000002
318 #define NFSV4ACE_APPENDDATA 0x00000004
319 #define NFSV4ACE_ADDSUBDIRECTORY 0x00000004
320 #define NFSV4ACE_READNAMEDATTR 0x00000008
321 #define NFSV4ACE_WRITENAMEDATTR 0x00000010
322 #define NFSV4ACE_EXECUTE 0x00000020
323 #define NFSV4ACE_SEARCH 0x00000020
324 #define NFSV4ACE_DELETECHILD 0x00000040
325 #define NFSV4ACE_READATTRIBUTES 0x00000080
326 #define NFSV4ACE_WRITEATTRIBUTES 0x00000100
327 #define NFSV4ACE_DELETE 0x00010000
328 #define NFSV4ACE_READACL 0x00020000
329 #define NFSV4ACE_WRITEACL 0x00040000
330 #define NFSV4ACE_WRITEOWNER 0x00080000
331 #define NFSV4ACE_SYNCHRONIZE 0x00100000
332
333 /*
334 * Here are the mappings between mode bits and acl mask bits for
335 * directories and other files.
336 * (Named attributes have not been included, since named attributes are
337 * not yet supported.)
338 * The mailing list seems to indicate that NFSV4ACE_EXECUTE refers to
339 * searching a directory, although I can't find a statement of that in
340 * the RFC.
341 */
342 #define NFSV4ACE_ALLFILESMASK (NFSV4ACE_READATTRIBUTES | NFSV4ACE_READACL)
343 #define NFSV4ACE_OWNERMASK (NFSV4ACE_WRITEATTRIBUTES | NFSV4ACE_WRITEACL)
344 #define NFSV4ACE_DIRREADMASK NFSV4ACE_LISTDIRECTORY
345 #define NFSV4ACE_DIREXECUTEMASK NFSV4ACE_EXECUTE
346 #define NFSV4ACE_DIRWRITEMASK (NFSV4ACE_ADDFILE | \
347 NFSV4ACE_ADDSUBDIRECTORY | NFSV4ACE_DELETECHILD)
348 #define NFSV4ACE_READMASK NFSV4ACE_READDATA
349 #define NFSV4ACE_WRITEMASK (NFSV4ACE_WRITEDATA | NFSV4ACE_APPENDDATA)
350 #define NFSV4ACE_EXECUTEMASK NFSV4ACE_EXECUTE
351 #define NFSV4ACE_ALLFILEBITS (NFSV4ACE_READMASK | NFSV4ACE_WRITEMASK | \
352 NFSV4ACE_EXECUTEMASK | NFSV4ACE_SYNCHRONIZE)
353 #define NFSV4ACE_ALLDIRBITS (NFSV4ACE_DIRREADMASK | \
354 NFSV4ACE_DIRWRITEMASK | NFSV4ACE_DIREXECUTEMASK)
355 #define NFSV4ACE_AUDITMASK 0x0
356
357 /*
358 * These GENERIC masks are not used and are no longer believed to be useful.
359 */
360 #define NFSV4ACE_GENERICREAD 0x00120081
361 #define NFSV4ACE_GENERICWRITE 0x00160106
362 #define NFSV4ACE_GENERICEXECUTE 0x001200a0
363
364 #define NFSSTATEID_PUTALLZERO 0
365 #define NFSSTATEID_PUTALLONE 1
366 #define NFSSTATEID_PUTSTATEID 2
367
368 /*
369 * Bits for share access and deny.
370 */
371 #define NFSV4OPEN_ACCESSREAD 0x00000001
372 #define NFSV4OPEN_ACCESSWRITE 0x00000002
373 #define NFSV4OPEN_ACCESSBOTH 0x00000003
374
375 #define NFSV4OPEN_DENYNONE 0x00000000
376 #define NFSV4OPEN_DENYREAD 0x00000001
377 #define NFSV4OPEN_DENYWRITE 0x00000002
378 #define NFSV4OPEN_DENYBOTH 0x00000003
379
380 /*
381 * Open result flags
382 * (The first two are in the spec. The rest are used internally.)
383 */
384 #define NFSV4OPEN_RESULTCONFIRM 0x00000002
385 #define NFSV4OPEN_LOCKTYPEPOSIX 0x00000004
386 #define NFSV4OPEN_RFLAGS \
387 (NFSV4OPEN_RESULTCONFIRM | NFSV4OPEN_LOCKTYPEPOSIX)
388 #define NFSV4OPEN_RECALL 0x00010000
389 #define NFSV4OPEN_READDELEGATE 0x00020000
390 #define NFSV4OPEN_WRITEDELEGATE 0x00040000
391
392 /*
393 * NFS V4 File Handle types
394 */
395 #define NFSV4FHTYPE_PERSISTENT 0x0
396 #define NFSV4FHTYPE_NOEXPIREWITHOPEN 0x1
397 #define NFSV4FHTYPE_VOLATILEANY 0x2
398 #define NFSV4FHTYPE_VOLATILEMIGRATE 0x4
399 #define NFSV4FHTYPE_VOLATILERENAME 0x8
400
401 /*
402 * Maximum size of V4 opaque strings.
403 */
404 #define NFSV4_OPAQUELIMIT 1024
405
406 /*
407 * These are the same for V3 and V4.
408 */
409 #define NFSACCESS_READ 0x01
410 #define NFSACCESS_LOOKUP 0x02
411 #define NFSACCESS_MODIFY 0x04
412 #define NFSACCESS_EXTEND 0x08
413 #define NFSACCESS_DELETE 0x10
414 #define NFSACCESS_EXECUTE 0x20
415
416 #define NFSWRITE_UNSTABLE 0
417 #define NFSWRITE_DATASYNC 1
418 #define NFSWRITE_FILESYNC 2
419
420 #define NFSCREATE_UNCHECKED 0
421 #define NFSCREATE_GUARDED 1
422 #define NFSCREATE_EXCLUSIVE 2
423
424 #define NFSV3FSINFO_LINK 0x01
425 #define NFSV3FSINFO_SYMLINK 0x02
426 #define NFSV3FSINFO_HOMOGENEOUS 0x08
427 #define NFSV3FSINFO_CANSETTIME 0x10
428
429 /* Conversion macros */
430 #define vtonfsv2_mode(t,m) \
431 txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \
432 MAKEIMODE((t), (m)))
433 #define vtonfsv34_mode(m) txdr_unsigned((m) & 07777)
434 #define nfstov_mode(a) (fxdr_unsigned(u_int16_t, (a))&07777)
435 #define vtonfsv2_type(a) (((u_int32_t)(a)) >= 9 ? txdr_unsigned(NFNON) : \
436 txdr_unsigned(newnfsv2_type[((u_int32_t)(a))]))
437 #define vtonfsv34_type(a) (((u_int32_t)(a)) >= 9 ? txdr_unsigned(NFNON) : \
438 txdr_unsigned(nfsv34_type[((u_int32_t)(a))]))
439 #define nfsv2tov_type(a) newnv2tov_type[fxdr_unsigned(u_int32_t,(a))&0x7]
440 #define nfsv34tov_type(a) nv34tov_type[fxdr_unsigned(u_int32_t,(a))&0x7]
441 #define vtonfs_dtype(a) (((u_int32_t)(a)) >= 9 ? IFTODT(VTTOIF(VNON)) : \
442 IFTODT(VTTOIF(a)))
443
444 /* File types */
445 typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5,
446 NFSOCK=6, NFFIFO=7, NFATTRDIR=8, NFNAMEDATTR=9 } nfstype;
447
448 /* Structs for common parts of the rpc's */
449
450 struct nfsv2_time {
451 u_int32_t nfsv2_sec;
452 u_int32_t nfsv2_usec;
453 };
454 typedef struct nfsv2_time nfstime2;
455
456 struct nfsv3_time {
457 u_int32_t nfsv3_sec;
458 u_int32_t nfsv3_nsec;
459 };
460 typedef struct nfsv3_time nfstime3;
461
462 struct nfsv4_time {
463 u_int32_t nfsv4_highsec;
464 u_int32_t nfsv4_sec;
465 u_int32_t nfsv4_nsec;
466 };
467 typedef struct nfsv4_time nfstime4;
468
469 /*
470 * Quads are defined as arrays of 2 longs to ensure dense packing for the
471 * protocol and to facilitate xdr conversion.
472 */
473 struct nfs_uquad {
474 u_int32_t nfsuquad[2];
475 };
476 typedef struct nfs_uquad nfsuint64;
477
478 /*
479 * Used to convert between two u_longs and a u_quad_t.
480 */
481 union nfs_quadconvert {
482 u_int32_t lval[2];
483 u_quad_t qval;
484 };
485 typedef union nfs_quadconvert nfsquad_t;
486
487 /*
488 * NFS Version 3 special file number.
489 */
490 struct nfsv3_spec {
491 u_int32_t specdata1;
492 u_int32_t specdata2;
493 };
494 typedef struct nfsv3_spec nfsv3spec;
495
496 /*
497 * File attributes and setable attributes. These structures cover both
498 * NFS version 2 and the version 3 protocol. Note that the union is only
499 * used so that one pointer can refer to both variants. These structures
500 * go out on the wire and must be densely packed, so no quad data types
501 * are used. (all fields are longs or u_longs or structures of same)
502 * NB: You can't do sizeof(struct nfs_fattr), you must use the
503 * NFSX_FATTR(v3) macro.
504 */
505 struct nfs_fattr {
506 u_int32_t fa_type;
507 u_int32_t fa_mode;
508 u_int32_t fa_nlink;
509 u_int32_t fa_uid;
510 u_int32_t fa_gid;
511 union {
512 struct {
513 u_int32_t nfsv2fa_size;
514 u_int32_t nfsv2fa_blocksize;
515 u_int32_t nfsv2fa_rdev;
516 u_int32_t nfsv2fa_blocks;
517 u_int32_t nfsv2fa_fsid;
518 u_int32_t nfsv2fa_fileid;
519 nfstime2 nfsv2fa_atime;
520 nfstime2 nfsv2fa_mtime;
521 nfstime2 nfsv2fa_ctime;
522 } fa_nfsv2;
523 struct {
524 nfsuint64 nfsv3fa_size;
525 nfsuint64 nfsv3fa_used;
526 nfsv3spec nfsv3fa_rdev;
527 nfsuint64 nfsv3fa_fsid;
528 nfsuint64 nfsv3fa_fileid;
529 nfstime3 nfsv3fa_atime;
530 nfstime3 nfsv3fa_mtime;
531 nfstime3 nfsv3fa_ctime;
532 } fa_nfsv3;
533 } fa_un;
534 };
535
536 /* and some ugly defines for accessing union components */
537 #define fa2_size fa_un.fa_nfsv2.nfsv2fa_size
538 #define fa2_blocksize fa_un.fa_nfsv2.nfsv2fa_blocksize
539 #define fa2_rdev fa_un.fa_nfsv2.nfsv2fa_rdev
540 #define fa2_blocks fa_un.fa_nfsv2.nfsv2fa_blocks
541 #define fa2_fsid fa_un.fa_nfsv2.nfsv2fa_fsid
542 #define fa2_fileid fa_un.fa_nfsv2.nfsv2fa_fileid
543 #define fa2_atime fa_un.fa_nfsv2.nfsv2fa_atime
544 #define fa2_mtime fa_un.fa_nfsv2.nfsv2fa_mtime
545 #define fa2_ctime fa_un.fa_nfsv2.nfsv2fa_ctime
546 #define fa3_size fa_un.fa_nfsv3.nfsv3fa_size
547 #define fa3_used fa_un.fa_nfsv3.nfsv3fa_used
548 #define fa3_rdev fa_un.fa_nfsv3.nfsv3fa_rdev
549 #define fa3_fsid fa_un.fa_nfsv3.nfsv3fa_fsid
550 #define fa3_fileid fa_un.fa_nfsv3.nfsv3fa_fileid
551 #define fa3_atime fa_un.fa_nfsv3.nfsv3fa_atime
552 #define fa3_mtime fa_un.fa_nfsv3.nfsv3fa_mtime
553 #define fa3_ctime fa_un.fa_nfsv3.nfsv3fa_ctime
554
555 struct nfsv2_sattr {
556 u_int32_t sa_mode;
557 u_int32_t sa_uid;
558 u_int32_t sa_gid;
559 u_int32_t sa_size;
560 nfstime2 sa_atime;
561 nfstime2 sa_mtime;
562 };
563
564 /*
565 * NFS Version 3 sattr structure for the new node creation case.
566 */
567 struct nfsv3_sattr {
568 u_int32_t sa_modetrue;
569 u_int32_t sa_mode;
570 u_int32_t sa_uidfalse;
571 u_int32_t sa_gidfalse;
572 u_int32_t sa_sizefalse;
573 u_int32_t sa_atimetype;
574 nfstime3 sa_atime;
575 u_int32_t sa_mtimetype;
576 nfstime3 sa_mtime;
577 };
578
579 /*
580 * The attribute bits used for V4.
581 * NFSATTRBIT_xxx defines the attribute# (and its bit position)
582 * NFSATTRBM_xxx is a 32bit mask with the correct bit set within the
583 * appropriate 32bit word.
584 * NFSATTRBIT_MAX is one greater than the largest NFSATTRBIT_xxx
585 */
586 #define NFSATTRBIT_SUPPORTEDATTRS 0
587 #define NFSATTRBIT_TYPE 1
588 #define NFSATTRBIT_FHEXPIRETYPE 2
589 #define NFSATTRBIT_CHANGE 3
590 #define NFSATTRBIT_SIZE 4
591 #define NFSATTRBIT_LINKSUPPORT 5
592 #define NFSATTRBIT_SYMLINKSUPPORT 6
593 #define NFSATTRBIT_NAMEDATTR 7
594 #define NFSATTRBIT_FSID 8
595 #define NFSATTRBIT_UNIQUEHANDLES 9
596 #define NFSATTRBIT_LEASETIME 10
597 #define NFSATTRBIT_RDATTRERROR 11
598 #define NFSATTRBIT_ACL 12
599 #define NFSATTRBIT_ACLSUPPORT 13
600 #define NFSATTRBIT_ARCHIVE 14
601 #define NFSATTRBIT_CANSETTIME 15
602 #define NFSATTRBIT_CASEINSENSITIVE 16
603 #define NFSATTRBIT_CASEPRESERVING 17
604 #define NFSATTRBIT_CHOWNRESTRICTED 18
605 #define NFSATTRBIT_FILEHANDLE 19
606 #define NFSATTRBIT_FILEID 20
607 #define NFSATTRBIT_FILESAVAIL 21
608 #define NFSATTRBIT_FILESFREE 22
609 #define NFSATTRBIT_FILESTOTAL 23
610 #define NFSATTRBIT_FSLOCATIONS 24
611 #define NFSATTRBIT_HIDDEN 25
612 #define NFSATTRBIT_HOMOGENEOUS 26
613 #define NFSATTRBIT_MAXFILESIZE 27
614 #define NFSATTRBIT_MAXLINK 28
615 #define NFSATTRBIT_MAXNAME 29
616 #define NFSATTRBIT_MAXREAD 30
617 #define NFSATTRBIT_MAXWRITE 31
618 #define NFSATTRBIT_MIMETYPE 32
619 #define NFSATTRBIT_MODE 33
620 #define NFSATTRBIT_NOTRUNC 34
621 #define NFSATTRBIT_NUMLINKS 35
622 #define NFSATTRBIT_OWNER 36
623 #define NFSATTRBIT_OWNERGROUP 37
624 #define NFSATTRBIT_QUOTAHARD 38
625 #define NFSATTRBIT_QUOTASOFT 39
626 #define NFSATTRBIT_QUOTAUSED 40
627 #define NFSATTRBIT_RAWDEV 41
628 #define NFSATTRBIT_SPACEAVAIL 42
629 #define NFSATTRBIT_SPACEFREE 43
630 #define NFSATTRBIT_SPACETOTAL 44
631 #define NFSATTRBIT_SPACEUSED 45
632 #define NFSATTRBIT_SYSTEM 46
633 #define NFSATTRBIT_TIMEACCESS 47
634 #define NFSATTRBIT_TIMEACCESSSET 48
635 #define NFSATTRBIT_TIMEBACKUP 49
636 #define NFSATTRBIT_TIMECREATE 50
637 #define NFSATTRBIT_TIMEDELTA 51
638 #define NFSATTRBIT_TIMEMETADATA 52
639 #define NFSATTRBIT_TIMEMODIFY 53
640 #define NFSATTRBIT_TIMEMODIFYSET 54
641 #define NFSATTRBIT_MOUNTEDONFILEID 55
642
643 #define NFSATTRBM_SUPPORTEDATTRS 0x00000001
644 #define NFSATTRBM_TYPE 0x00000002
645 #define NFSATTRBM_FHEXPIRETYPE 0x00000004
646 #define NFSATTRBM_CHANGE 0x00000008
647 #define NFSATTRBM_SIZE 0x00000010
648 #define NFSATTRBM_LINKSUPPORT 0x00000020
649 #define NFSATTRBM_SYMLINKSUPPORT 0x00000040
650 #define NFSATTRBM_NAMEDATTR 0x00000080
651 #define NFSATTRBM_FSID 0x00000100
652 #define NFSATTRBM_UNIQUEHANDLES 0x00000200
653 #define NFSATTRBM_LEASETIME 0x00000400
654 #define NFSATTRBM_RDATTRERROR 0x00000800
655 #define NFSATTRBM_ACL 0x00001000
656 #define NFSATTRBM_ACLSUPPORT 0x00002000
657 #define NFSATTRBM_ARCHIVE 0x00004000
658 #define NFSATTRBM_CANSETTIME 0x00008000
659 #define NFSATTRBM_CASEINSENSITIVE 0x00010000
660 #define NFSATTRBM_CASEPRESERVING 0x00020000
661 #define NFSATTRBM_CHOWNRESTRICTED 0x00040000
662 #define NFSATTRBM_FILEHANDLE 0x00080000
663 #define NFSATTRBM_FILEID 0x00100000
664 #define NFSATTRBM_FILESAVAIL 0x00200000
665 #define NFSATTRBM_FILESFREE 0x00400000
666 #define NFSATTRBM_FILESTOTAL 0x00800000
667 #define NFSATTRBM_FSLOCATIONS 0x01000000
668 #define NFSATTRBM_HIDDEN 0x02000000
669 #define NFSATTRBM_HOMOGENEOUS 0x04000000
670 #define NFSATTRBM_MAXFILESIZE 0x08000000
671 #define NFSATTRBM_MAXLINK 0x10000000
672 #define NFSATTRBM_MAXNAME 0x20000000
673 #define NFSATTRBM_MAXREAD 0x40000000
674 #define NFSATTRBM_MAXWRITE 0x80000000
675 #define NFSATTRBM_MIMETYPE 0x00000001
676 #define NFSATTRBM_MODE 0x00000002
677 #define NFSATTRBM_NOTRUNC 0x00000004
678 #define NFSATTRBM_NUMLINKS 0x00000008
679 #define NFSATTRBM_OWNER 0x00000010
680 #define NFSATTRBM_OWNERGROUP 0x00000020
681 #define NFSATTRBM_QUOTAHARD 0x00000040
682 #define NFSATTRBM_QUOTASOFT 0x00000080
683 #define NFSATTRBM_QUOTAUSED 0x00000100
684 #define NFSATTRBM_RAWDEV 0x00000200
685 #define NFSATTRBM_SPACEAVAIL 0x00000400
686 #define NFSATTRBM_SPACEFREE 0x00000800
687 #define NFSATTRBM_SPACETOTAL 0x00001000
688 #define NFSATTRBM_SPACEUSED 0x00002000
689 #define NFSATTRBM_SYSTEM 0x00004000
690 #define NFSATTRBM_TIMEACCESS 0x00008000
691 #define NFSATTRBM_TIMEACCESSSET 0x00010000
692 #define NFSATTRBM_TIMEBACKUP 0x00020000
693 #define NFSATTRBM_TIMECREATE 0x00040000
694 #define NFSATTRBM_TIMEDELTA 0x00080000
695 #define NFSATTRBM_TIMEMETADATA 0x00100000
696 #define NFSATTRBM_TIMEMODIFY 0x00200000
697 #define NFSATTRBM_TIMEMODIFYSET 0x00400000
698 #define NFSATTRBM_MOUNTEDONFILEID 0x00800000
699
700 #define NFSATTRBIT_MAX 56
701
702 /*
703 * Sets of attributes that are supported, by words in the bitmap.
704 */
705 /*
706 * NFSATTRBIT_SUPPORTED - SUPP0 - bits 0<->31
707 * SUPP1 - bits 32<->63
708 */
709 #define NFSATTRBIT_SUPP0 \
710 (NFSATTRBM_SUPPORTEDATTRS | \
711 NFSATTRBM_TYPE | \
712 NFSATTRBM_FHEXPIRETYPE | \
713 NFSATTRBM_CHANGE | \
714 NFSATTRBM_SIZE | \
715 NFSATTRBM_LINKSUPPORT | \
716 NFSATTRBM_SYMLINKSUPPORT | \
717 NFSATTRBM_NAMEDATTR | \
718 NFSATTRBM_FSID | \
719 NFSATTRBM_UNIQUEHANDLES | \
720 NFSATTRBM_LEASETIME | \
721 NFSATTRBM_RDATTRERROR | \
722 NFSATTRBM_ACL | \
723 NFSATTRBM_ACLSUPPORT | \
724 NFSATTRBM_CANSETTIME | \
725 NFSATTRBM_CASEINSENSITIVE | \
726 NFSATTRBM_CASEPRESERVING | \
727 NFSATTRBM_CHOWNRESTRICTED | \
728 NFSATTRBM_FILEHANDLE | \
729 NFSATTRBM_FILEID | \
730 NFSATTRBM_FILESAVAIL | \
731 NFSATTRBM_FILESFREE | \
732 NFSATTRBM_FILESTOTAL | \
733 NFSATTRBM_FSLOCATIONS | \
734 NFSATTRBM_HOMOGENEOUS | \
735 NFSATTRBM_MAXFILESIZE | \
736 NFSATTRBM_MAXLINK | \
737 NFSATTRBM_MAXNAME | \
738 NFSATTRBM_MAXREAD | \
739 NFSATTRBM_MAXWRITE)
740
741 /*
742 * NFSATTRBIT_S1 - subset of SUPP1 - OR of the following bits:
743 */
744 #define NFSATTRBIT_S1 \
745 (NFSATTRBM_MODE | \
746 NFSATTRBM_NOTRUNC | \
747 NFSATTRBM_NUMLINKS | \
748 NFSATTRBM_OWNER | \
749 NFSATTRBM_OWNERGROUP | \
750 NFSATTRBM_RAWDEV | \
751 NFSATTRBM_SPACEAVAIL | \
752 NFSATTRBM_SPACEFREE | \
753 NFSATTRBM_SPACETOTAL | \
754 NFSATTRBM_SPACEUSED | \
755 NFSATTRBM_TIMEACCESS | \
756 NFSATTRBM_TIMEDELTA | \
757 NFSATTRBM_TIMEMETADATA | \
758 NFSATTRBM_TIMEMODIFY | \
759 NFSATTRBM_MOUNTEDONFILEID)
760
761 #ifdef QUOTA
762 /*
763 * If QUOTA OR in NFSATTRBIT_QUOTAHARD, NFSATTRBIT_QUOTASOFT and
764 * NFSATTRBIT_QUOTAUSED.
765 */
766 #define NFSATTRBIT_SUPP1 (NFSATTRBIT_S1 | \
767 NFSATTRBM_QUOTAHARD | \
768 NFSATTRBM_QUOTASOFT | \
769 NFSATTRBM_QUOTAUSED)
770 #else
771 #define NFSATTRBIT_SUPP1 NFSATTRBIT_S1
772 #endif
773
774 /*
775 * NFSATTRBIT_SUPPSETONLY is the OR of NFSATTRBIT_TIMEACCESSSET and
776 * NFSATTRBIT_TIMEMODIFYSET.
777 */
778 #define NFSATTRBIT_SUPPSETONLY (NFSATTRBM_TIMEACCESSSET | \
779 NFSATTRBM_TIMEMODIFYSET)
780
781 /*
782 * NFSATTRBIT_SETABLE - SETABLE0 - bits 0<->31
783 * SETABLE1 - bits 32<->63
784 */
785 #define NFSATTRBIT_SETABLE0 \
786 (NFSATTRBM_SIZE | \
787 NFSATTRBM_ACL)
788 #define NFSATTRBIT_SETABLE1 \
789 (NFSATTRBM_MODE | \
790 NFSATTRBM_OWNER | \
791 NFSATTRBM_OWNERGROUP | \
792 NFSATTRBM_TIMEACCESSSET | \
793 NFSATTRBM_TIMEMODIFYSET)
794
795 /*
796 * Set of attributes that the getattr vnode op needs.
797 * OR of the following bits.
798 * NFSATTRBIT_GETATTR0 - bits 0<->31
799 */
800 #define NFSATTRBIT_GETATTR0 \
801 (NFSATTRBM_SUPPORTEDATTRS | \
802 NFSATTRBM_TYPE | \
803 NFSATTRBM_CHANGE | \
804 NFSATTRBM_SIZE | \
805 NFSATTRBM_FSID | \
806 NFSATTRBM_FILEID | \
807 NFSATTRBM_MAXREAD)
808
809 /*
810 * NFSATTRBIT_GETATTR1 - bits 32<->63
811 */
812 #define NFSATTRBIT_GETATTR1 \
813 (NFSATTRBM_MODE | \
814 NFSATTRBM_NUMLINKS | \
815 NFSATTRBM_OWNER | \
816 NFSATTRBM_OWNERGROUP | \
817 NFSATTRBM_RAWDEV | \
818 NFSATTRBM_SPACEUSED | \
819 NFSATTRBM_TIMEACCESS | \
820 NFSATTRBM_TIMEMETADATA | \
821 NFSATTRBM_TIMEMODIFY)
822
823 /*
824 * Subset of the above that the Write RPC gets.
825 * OR of the following bits.
826 * NFSATTRBIT_WRITEGETATTR0 - bits 0<->31
827 */
828 #define NFSATTRBIT_WRITEGETATTR0 \
829 (NFSATTRBM_SUPPORTEDATTRS | \
830 NFSATTRBM_TYPE | \
831 NFSATTRBM_CHANGE | \
832 NFSATTRBM_SIZE | \
833 NFSATTRBM_FSID | \
834 NFSATTRBM_FILEID | \
835 NFSATTRBM_MAXREAD)
836
837 /*
838 * NFSATTRBIT_WRITEGETATTR1 - bits 32<->63
839 */
840 #define NFSATTRBIT_WRITEGETATTR1 \
841 (NFSATTRBM_MODE | \
842 NFSATTRBM_NUMLINKS | \
843 NFSATTRBM_RAWDEV | \
844 NFSATTRBM_SPACEUSED | \
845 NFSATTRBM_TIMEACCESS | \
846 NFSATTRBM_TIMEMETADATA | \
847 NFSATTRBM_TIMEMODIFY)
848
849 /*
850 * Set of attributes that the wccattr operation op needs.
851 * OR of the following bits.
852 * NFSATTRBIT_WCCATTR0 - bits 0<->31
853 */
854 #define NFSATTRBIT_WCCATTR0 0
855
856 /*
857 * NFSATTRBIT_WCCATTR1 - bits 32<->63
858 */
859 #define NFSATTRBIT_WCCATTR1 \
860 (NFSATTRBM_TIMEMODIFY)
861
862 /*
863 * NFSATTRBIT_CBGETATTR0 - bits 0<->31
864 */
865 #define NFSATTRBIT_CBGETATTR0 (NFSATTRBM_CHANGE | NFSATTRBM_SIZE)
866
867 /*
868 * NFSATTRBIT_CBGETATTR1 - bits 32<->63
869 */
870 #define NFSATTRBIT_CBGETATTR1 0x0
871
872 /*
873 * Sets of attributes that require a VFS_STATFS() call to get the
874 * values of.
875 * NFSATTRBIT_STATFS0 - bits 0<->31
876 */
877 #define NFSATTRBIT_STATFS0 \
878 (NFSATTRBM_LINKSUPPORT | \
879 NFSATTRBM_SYMLINKSUPPORT | \
880 NFSATTRBM_CANSETTIME | \
881 NFSATTRBM_FILESAVAIL | \
882 NFSATTRBM_FILESFREE | \
883 NFSATTRBM_FILESTOTAL | \
884 NFSATTRBM_HOMOGENEOUS | \
885 NFSATTRBM_MAXFILESIZE | \
886 NFSATTRBM_MAXNAME | \
887 NFSATTRBM_MAXREAD | \
888 NFSATTRBM_MAXWRITE)
889
890 /*
891 * NFSATTRBIT_STATFS1 - bits 32<->63
892 */
893 #define NFSATTRBIT_STATFS1 \
894 (NFSATTRBM_QUOTAHARD | \
895 NFSATTRBM_QUOTASOFT | \
896 NFSATTRBM_QUOTAUSED | \
897 NFSATTRBM_SPACEAVAIL | \
898 NFSATTRBM_SPACEFREE | \
899 NFSATTRBM_SPACETOTAL | \
900 NFSATTRBM_SPACEUSED | \
901 NFSATTRBM_TIMEDELTA)
902
903 /*
904 * These are the bits that are needed by the nfs_statfs() call.
905 * (The regular getattr bits are or'd in so the vnode gets the correct
906 * type, etc.)
907 * NFSGETATTRBIT_STATFS0 - bits 0<->31
908 */
909 #define NFSGETATTRBIT_STATFS0 (NFSATTRBIT_GETATTR0 | \
910 NFSATTRBM_LINKSUPPORT | \
911 NFSATTRBM_SYMLINKSUPPORT | \
912 NFSATTRBM_CANSETTIME | \
913 NFSATTRBM_FILESFREE | \
914 NFSATTRBM_FILESTOTAL | \
915 NFSATTRBM_HOMOGENEOUS | \
916 NFSATTRBM_MAXFILESIZE | \
917 NFSATTRBM_MAXNAME | \
918 NFSATTRBM_MAXREAD | \
919 NFSATTRBM_MAXWRITE)
920
921 /*
922 * NFSGETATTRBIT_STATFS1 - bits 32<->63
923 */
924 #define NFSGETATTRBIT_STATFS1 (NFSATTRBIT_GETATTR1 | \
925 NFSATTRBM_SPACEAVAIL | \
926 NFSATTRBM_SPACEFREE | \
927 NFSATTRBM_SPACETOTAL | \
928 NFSATTRBM_TIMEDELTA)
929
930 /*
931 * Set of attributes for the equivalent of an nfsv3 pathconf rpc.
932 * NFSGETATTRBIT_PATHCONF0 - bits 0<->31
933 */
934 #define NFSGETATTRBIT_PATHCONF0 (NFSATTRBIT_GETATTR0 | \
935 NFSATTRBM_CASEINSENSITIVE | \
936 NFSATTRBM_CASEPRESERVING | \
937 NFSATTRBM_CHOWNRESTRICTED | \
938 NFSATTRBM_MAXLINK | \
939 NFSATTRBM_MAXNAME)
940
941 /*
942 * NFSGETATTRBIT_PATHCONF1 - bits 32<->63
943 */
944 #define NFSGETATTRBIT_PATHCONF1 (NFSATTRBIT_GETATTR1 | \
945 NFSATTRBM_NOTRUNC)
946
947 /*
948 * Sets of attributes required by readdir and readdirplus.
949 * NFSATTRBIT_READDIRPLUS0 (NFSATTRBIT_GETATTR0 | NFSATTRBIT_FILEHANDLE |
950 * NFSATTRBIT_RDATTRERROR)
951 */
952 #define NFSATTRBIT_READDIRPLUS0 (NFSATTRBIT_GETATTR0 | NFSATTRBM_FILEHANDLE | \
953 NFSATTRBM_RDATTRERROR)
954 #define NFSATTRBIT_READDIRPLUS1 NFSATTRBIT_GETATTR1
955
956 /*
957 * Set of attributes supported by Referral vnodes.
958 */
959 #define NFSATTRBIT_REFERRAL0 (NFSATTRBM_TYPE | NFSATTRBM_FSID | \
960 NFSATTRBM_RDATTRERROR | NFSATTRBM_FSLOCATIONS)
961 #define NFSATTRBIT_REFERRAL1 NFSATTRBM_MOUNTEDONFILEID
962
963 /*
964 * Structure for data handled by the statfs rpc. Since some fields are
965 * u_int64_t, this cannot be used for copying data on/off the wire, due
966 * to alignment concerns.
967 */
968 struct nfsstatfs {
969 union {
970 struct {
971 u_int32_t nfsv2sf_tsize;
972 u_int32_t nfsv2sf_bsize;
973 u_int32_t nfsv2sf_blocks;
974 u_int32_t nfsv2sf_bfree;
975 u_int32_t nfsv2sf_bavail;
976 } sf_nfsv2;
977 struct {
978 u_int64_t nfsv3sf_tbytes;
979 u_int64_t nfsv3sf_fbytes;
980 u_int64_t nfsv3sf_abytes;
981 u_int64_t nfsv3sf_tfiles;
982 u_int64_t nfsv3sf_ffiles;
983 u_int64_t nfsv3sf_afiles;
984 u_int32_t nfsv3sf_invarsec;
985 } sf_nfsv3;
986 } sf_un;
987 };
988
989 #define sf_tsize sf_un.sf_nfsv2.nfsv2sf_tsize
990 #define sf_bsize sf_un.sf_nfsv2.nfsv2sf_bsize
991 #define sf_blocks sf_un.sf_nfsv2.nfsv2sf_blocks
992 #define sf_bfree sf_un.sf_nfsv2.nfsv2sf_bfree
993 #define sf_bavail sf_un.sf_nfsv2.nfsv2sf_bavail
994 #define sf_tbytes sf_un.sf_nfsv3.nfsv3sf_tbytes
995 #define sf_fbytes sf_un.sf_nfsv3.nfsv3sf_fbytes
996 #define sf_abytes sf_un.sf_nfsv3.nfsv3sf_abytes
997 #define sf_tfiles sf_un.sf_nfsv3.nfsv3sf_tfiles
998 #define sf_ffiles sf_un.sf_nfsv3.nfsv3sf_ffiles
999 #define sf_afiles sf_un.sf_nfsv3.nfsv3sf_afiles
1000 #define sf_invarsec sf_un.sf_nfsv3.nfsv3sf_invarsec
1001
1002 /*
1003 * Now defined using u_int64_t for the 64 bit field(s).
1004 * (Cannot be used to move data on/off the wire, due to alignment concerns.)
1005 */
1006 struct nfsfsinfo {
1007 u_int32_t fs_rtmax;
1008 u_int32_t fs_rtpref;
1009 u_int32_t fs_rtmult;
1010 u_int32_t fs_wtmax;
1011 u_int32_t fs_wtpref;
1012 u_int32_t fs_wtmult;
1013 u_int32_t fs_dtpref;
1014 u_int64_t fs_maxfilesize;
1015 struct timespec fs_timedelta;
1016 u_int32_t fs_properties;
1017 };
1018
1019 /*
1020 * Bits for fs_properties
1021 */
1022 #define NFSV3_FSFLINK 0x1
1023 #define NFSV3_FSFSYMLINK 0x2
1024 #define NFSV3_FSFHOMOGENEOUS 0x4
1025 #define NFSV3_FSFCANSETTIME 0x8
1026
1027 /*
1028 * Yikes, overload fs_rtmult as fs_maxname for V4.
1029 */
1030 #define fs_maxname fs_rtmult
1031
1032 struct nfsv3_pathconf {
1033 u_int32_t pc_linkmax;
1034 u_int32_t pc_namemax;
1035 u_int32_t pc_notrunc;
1036 u_int32_t pc_chownrestricted;
1037 u_int32_t pc_caseinsensitive;
1038 u_int32_t pc_casepreserving;
1039 };
1040
1041 /*
1042 * NFS V4 data structures.
1043 */
1044 struct nfsv4stateid {
1045 u_int32_t seqid;
1046 u_int32_t other[NFSX_STATEIDOTHER / NFSX_UNSIGNED];
1047 };
1048 typedef struct nfsv4stateid nfsv4stateid_t;
1049
1050 #endif /* _NFS_NFSPROTO_H_ */
Cache object: 3a1afbee2ea19539c7f32dc89d698d24
|