1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Rick Macklem at The University of Guelph. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * $FreeBSD$ 35 */ 36 37 #ifndef _NFS_NFSPROTO_H_ 38 #define _NFS_NFSPROTO_H_ 39 40 /* 41 * nfs definitions as per the Version 2, 3 and 4 specs 42 */ 43 44 /* 45 * Constants as defined in the NFS Version 2, 3 and 4 specs. 46 * "NFS: Network File System Protocol Specification" RFC1094 47 * and in the "NFS: Network File System Version 3 Protocol 48 * Specification" 49 */ 50 51 #define NFS_PORT 2049 52 #define NFS_PROG 100003 53 #define NFS_CALLBCKPROG 0x40000000 /* V4 only */ 54 #define NFS_VER2 2 55 #define NFS_VER3 3 56 #define NFS_VER4 4 57 #define NFS_V2MAXDATA 8192 58 #define NFS_MAXDGRAMDATA 16384 59 #define NFS_MAXPATHLEN 1024 60 #define NFS_MAXNAMLEN 255 61 /* 62 * Calculating the maximum XDR overhead for an NFS RPC isn't easy. 63 * NFS_MAXPKTHDR is antiquated and assumes AUTH_SYS over UDP. 64 * NFS_MAXXDR should be sufficient for all NFS versions over TCP. 65 * It includes: 66 * - Maximum RPC message header. It can include 2 400byte authenticators plus 67 * a machine name of unlimited length, although it is usually relatively 68 * small. 69 * - XDR overheads for the NFSv4 compound. This can include Owner and 70 * Owner_group strings, which are usually fairly small, but are allowed 71 * to be up to 1024 bytes each. 72 * 4096 is overkill, but should always be sufficient. 73 */ 74 #define NFS_MAXPKTHDR 404 75 #define NFS_MAXXDR 4096 76 #define NFS_MAXPACKET (NFS_SRVMAXIO + NFS_MAXXDR) 77 #define NFS_MINPACKET 20 78 #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ 79 #define NFSV4_MINORVERSION 0 /* V4 Minor version */ 80 #define NFSV41_MINORVERSION 1 /* V4 Minor version */ 81 #define NFSV42_MINORVERSION 2 /* V4 Minor version */ 82 #define NFSV4_CBVERS 1 /* V4 CB Version */ 83 #define NFSV41_CBVERS 4 /* V4.1 CB Version */ 84 #define NFSV4_SMALLSTR 50 /* Strings small enough for stack */ 85 86 /* 87 * This value isn't a fixed value in the RFCs. 88 * It is the maximum data size supported by NFSv3 or NFSv4 over TCP for 89 * the server. It should be set to the I/O size preferred by ZFS or 90 * MAXBSIZE, whichever is greater. 91 * ZFS currently prefers 128K. 92 * It used to be called NFS_MAXDATA, but has been renamed to clarify that 93 * it refers to server side only and doesn't conflict with the NFS_MAXDATA 94 * defined in rpcsvc/nfs_prot.h for userland. 95 */ 96 #define NFS_SRVMAXIO (128 * 1024) 97 98 /* Stat numbers for rpc returns (version 2, 3 and 4) */ 99 /* 100 * These numbers are hard-wired in the RFCs, so they can't be changed. 101 * The code currently assumes that the ones < 10000 are the same as 102 * sys/errno.h and that sys/errno.h will never go as high as 10000. 103 * If the value in sys/errno.h of any entry listed below is changed, 104 * the NFS code must be modified to do the mapping between them. 105 * (You can ignore NFSERR_WFLUSH, since it is never actually used.) 106 */ 107 #define NFSERR_OK 0 108 #define NFSERR_PERM 1 109 #define NFSERR_NOENT 2 110 #define NFSERR_IO 5 111 #define NFSERR_NXIO 6 112 #define NFSERR_ACCES 13 113 #define NFSERR_EXIST 17 114 #define NFSERR_XDEV 18 /* Version 3, 4 only */ 115 #define NFSERR_NODEV 19 116 #define NFSERR_NOTDIR 20 117 #define NFSERR_ISDIR 21 118 #define NFSERR_INVAL 22 /* Version 3, 4 only */ 119 #define NFSERR_FBIG 27 120 #define NFSERR_NOSPC 28 121 #define NFSERR_ROFS 30 122 #define NFSERR_MLINK 31 /* Version 3, 4 only */ 123 #define NFSERR_NAMETOL 63 124 #define NFSERR_NOTEMPTY 66 125 #define NFSERR_DQUOT 69 126 #define NFSERR_STALE 70 127 #define NFSERR_REMOTE 71 /* Version 3 only */ 128 #define NFSERR_WFLUSH 99 /* Version 2 only */ 129 #define NFSERR_BADHANDLE 10001 /* These are Version 3, 4 only */ 130 #define NFSERR_NOT_SYNC 10002 /* Version 3 Only */ 131 #define NFSERR_BAD_COOKIE 10003 132 #define NFSERR_NOTSUPP 10004 133 #define NFSERR_TOOSMALL 10005 134 #define NFSERR_SERVERFAULT 10006 135 #define NFSERR_BADTYPE 10007 136 #define NFSERR_DELAY 10008 /* Called NFSERR_JUKEBOX for V3 */ 137 #define NFSERR_SAME 10009 /* These are Version 4 only */ 138 #define NFSERR_DENIED 10010 139 #define NFSERR_EXPIRED 10011 140 #define NFSERR_LOCKED 10012 141 #define NFSERR_GRACE 10013 142 #define NFSERR_FHEXPIRED 10014 143 #define NFSERR_SHAREDENIED 10015 144 #define NFSERR_WRONGSEC 10016 145 #define NFSERR_CLIDINUSE 10017 146 #define NFSERR_RESOURCE 10018 147 #define NFSERR_MOVED 10019 148 #define NFSERR_NOFILEHANDLE 10020 149 #define NFSERR_MINORVERMISMATCH 10021 150 #define NFSERR_STALECLIENTID 10022 151 #define NFSERR_STALESTATEID 10023 152 #define NFSERR_OLDSTATEID 10024 153 #define NFSERR_BADSTATEID 10025 154 #define NFSERR_BADSEQID 10026 155 #define NFSERR_NOTSAME 10027 156 #define NFSERR_LOCKRANGE 10028 157 #define NFSERR_SYMLINK 10029 158 #define NFSERR_RESTOREFH 10030 159 #define NFSERR_LEASEMOVED 10031 160 #define NFSERR_ATTRNOTSUPP 10032 161 #define NFSERR_NOGRACE 10033 162 #define NFSERR_RECLAIMBAD 10034 163 #define NFSERR_RECLAIMCONFLICT 10035 164 #define NFSERR_BADXDR 10036 165 #define NFSERR_LOCKSHELD 10037 166 #define NFSERR_OPENMODE 10038 167 #define NFSERR_BADOWNER 10039 168 #define NFSERR_BADCHAR 10040 169 #define NFSERR_BADNAME 10041 170 #define NFSERR_BADRANGE 10042 171 #define NFSERR_LOCKNOTSUPP 10043 172 #define NFSERR_OPILLEGAL 10044 173 #define NFSERR_DEADLOCK 10045 174 #define NFSERR_FILEOPEN 10046 175 #define NFSERR_ADMINREVOKED 10047 176 #define NFSERR_CBPATHDOWN 10048 177 178 /* NFSv4.1 specific errors. */ 179 #define NFSERR_BADIOMODE 10049 180 #define NFSERR_BADLAYOUT 10050 181 #define NFSERR_BADSESSIONDIGEST 10051 182 #define NFSERR_BADSESSION 10052 183 #define NFSERR_BADSLOT 10053 184 #define NFSERR_COMPLETEALREADY 10054 185 #define NFSERR_NOTBNDTOSESS 10055 186 #define NFSERR_DELEGALREADYWANT 10056 187 #define NFSERR_BACKCHANBUSY 10057 188 #define NFSERR_LAYOUTTRYLATER 10058 189 #define NFSERR_LAYOUTUNAVAIL 10059 190 #define NFSERR_NOMATCHLAYOUT 10060 191 #define NFSERR_RECALLCONFLICT 10061 192 #define NFSERR_UNKNLAYOUTTYPE 10062 193 #define NFSERR_SEQMISORDERED 10063 194 #define NFSERR_SEQUENCEPOS 10064 195 #define NFSERR_REQTOOBIG 10065 196 #define NFSERR_REPTOOBIG 10066 197 #define NFSERR_REPTOOBIGTOCACHE 10067 198 #define NFSERR_RETRYUNCACHEDREP 10068 199 #define NFSERR_UNSAFECOMPOUND 10069 200 #define NFSERR_TOOMANYOPS 10070 201 #define NFSERR_OPNOTINSESS 10071 202 #define NFSERR_HASHALGUNSUPP 10072 203 #define NFSERR_CLIENTIDBUSY 10074 204 #define NFSERR_PNFSIOHOLE 10075 205 #define NFSERR_SEQFALSERETRY 10076 206 #define NFSERR_BADHIGHSLOT 10077 207 #define NFSERR_DEADSESSION 10078 208 #define NFSERR_ENCRALGUNSUPP 10079 209 #define NFSERR_PNFSNOLAYOUT 10080 210 #define NFSERR_NOTONLYOP 10081 211 #define NFSERR_WRONGCRED 10082 212 #define NFSERR_WRONGTYPE 10083 213 #define NFSERR_DIRDELEGUNAVAIL 10084 214 #define NFSERR_REJECTDELEG 10085 215 #define NFSERR_RETURNCONFLICT 10086 216 #define NFSERR_DELEGREVOKED 10087 217 218 /* NFSv4.2 specific errors. */ 219 #define NFSERR_PARTNERNOTSUPP 10088 220 #define NFSERR_PARTNERNOAUTH 10089 221 #define NFSERR_UNIONNOTSUPP 10090 222 #define NFSERR_OFFLOADDENIED 10091 223 #define NFSERR_WRONGLFS 10092 224 #define NFSERR_BADLABEL 10093 225 #define NFSERR_OFFLOADNOREQS 10094 226 227 /* NFSv4.2 Extended Attribute errors. */ 228 #define NFSERR_NOXATTR 10095 229 #define NFSERR_XATTR2BIG 10096 230 231 /* Maximum value of all the NFS error values. */ 232 #define NFSERR_MAXERRVAL NFSERR_XATTR2BIG 233 234 #define NFSERR_STALEWRITEVERF 30001 /* Fake return for nfs_commit() */ 235 #define NFSERR_DONTREPLY 30003 /* Don't process request */ 236 #define NFSERR_RETVOID 30004 /* Return void, not error */ 237 #define NFSERR_REPLYFROMCACHE 30005 /* Reply from recent request cache */ 238 #define NFSERR_STALEDONTRECOVER 30006 /* Don't initiate recovery */ 239 240 #define NFSERR_RPCERR 0x40000000 /* Mark an RPC layer error */ 241 #define NFSERR_AUTHERR 0x80000000 /* Mark an authentication error */ 242 243 #define NFSERR_RPCMISMATCH (NFSERR_RPCERR | RPC_MISMATCH) 244 #define NFSERR_PROGUNAVAIL (NFSERR_RPCERR | RPC_PROGUNAVAIL) 245 #define NFSERR_PROGMISMATCH (NFSERR_RPCERR | RPC_PROGMISMATCH) 246 #define NFSERR_PROGNOTV4 (NFSERR_RPCERR | 0xffff) 247 #define NFSERR_PROCUNAVAIL (NFSERR_RPCERR | RPC_PROCUNAVAIL) 248 #define NFSERR_GARBAGE (NFSERR_RPCERR | RPC_GARBAGE) 249 250 /* Sizes in bytes of various nfs rpc components */ 251 #define NFSX_UNSIGNED 4 252 #define NFSX_HYPER (2 * NFSX_UNSIGNED) 253 254 /* specific to NFS Version 2 */ 255 #define NFSX_V2FH 32 256 #define NFSX_V2FATTR 68 257 #define NFSX_V2SATTR 32 258 #define NFSX_V2COOKIE 4 259 #define NFSX_V2STATFS 20 260 261 /* specific to NFS Version 3 */ 262 #define NFSX_V3FHMAX 64 /* max. allowed by protocol */ 263 #define NFSX_V3FATTR 84 264 #define NFSX_V3SATTR 60 /* max. all fields filled in */ 265 #define NFSX_V3SRVSATTR (sizeof (struct nfsv3_sattr)) 266 #define NFSX_V3POSTOPATTR (NFSX_V3FATTR + NFSX_UNSIGNED) 267 #define NFSX_V3WCCDATA (NFSX_V3POSTOPATTR + 8 * NFSX_UNSIGNED) 268 #define NFSX_V3STATFS 52 269 #define NFSX_V3FSINFO 48 270 #define NFSX_V3PATHCONF 24 271 272 /* specific to NFS Version 4 */ 273 #define NFSX_V4FHMAX 128 274 #define NFSX_V4FSID (2 * NFSX_HYPER) 275 #define NFSX_V4SPECDATA (2 * NFSX_UNSIGNED) 276 #define NFSX_V4TIME (NFSX_HYPER + NFSX_UNSIGNED) 277 #define NFSX_V4SETTIME (NFSX_UNSIGNED + NFSX_V4TIME) 278 #define NFSX_V4SESSIONID 16 279 #define NFSX_V4DEVICEID 16 280 #define NFSX_V4PNFSFH (sizeof(fhandle_t) + 1) 281 #define NFSX_V4FILELAYOUT (4 * NFSX_UNSIGNED + NFSX_V4DEVICEID + \ 282 NFSX_HYPER + NFSM_RNDUP(NFSX_V4PNFSFH)) 283 #define NFSX_V4FLEXLAYOUT(m) (NFSX_HYPER + 3 * NFSX_UNSIGNED + \ 284 ((m) * (NFSX_V4DEVICEID + NFSX_STATEID + NFSM_RNDUP(NFSX_V4PNFSFH) + \ 285 8 * NFSX_UNSIGNED))) 286 287 /* sizes common to multiple NFS versions */ 288 #define NFSX_FHMAX (NFSX_V4FHMAX) 289 #define NFSX_MYFH (sizeof (fhandle_t)) /* size this server uses */ 290 #define NFSX_VERF 8 291 #define NFSX_STATEIDOTHER 12 292 #define NFSX_STATEID (NFSX_UNSIGNED + NFSX_STATEIDOTHER) 293 #define NFSX_GSSH 12 294 295 /* variants for multiple versions */ 296 #define NFSX_STATFS(v3) ((v3) ? NFSX_V3STATFS : NFSX_V2STATFS) 297 298 /* 299 * Beware. NFSPROC_NULL and friends are defined in 300 * <rpcsvc/nfs_prot.h> as well and the numbers are different. 301 */ 302 #ifndef NFSPROC_NULL 303 /* nfs rpc procedure numbers (before version mapping) */ 304 #define NFSPROC_NULL 0 305 #define NFSPROC_GETATTR 1 306 #define NFSPROC_SETATTR 2 307 #define NFSPROC_LOOKUP 3 308 #define NFSPROC_ACCESS 4 309 #define NFSPROC_READLINK 5 310 #define NFSPROC_READ 6 311 #define NFSPROC_WRITE 7 312 #define NFSPROC_CREATE 8 313 #define NFSPROC_MKDIR 9 314 #define NFSPROC_SYMLINK 10 315 #define NFSPROC_MKNOD 11 316 #define NFSPROC_REMOVE 12 317 #define NFSPROC_RMDIR 13 318 #define NFSPROC_RENAME 14 319 #define NFSPROC_LINK 15 320 #define NFSPROC_READDIR 16 321 #define NFSPROC_READDIRPLUS 17 322 #define NFSPROC_FSSTAT 18 323 #define NFSPROC_FSINFO 19 324 #define NFSPROC_PATHCONF 20 325 #define NFSPROC_COMMIT 21 326 #endif /* NFSPROC_NULL */ 327 328 /* 329 * The lower numbers -> 21 are used by NFSv2 and v3. These define higher 330 * numbers used by NFSv4. 331 * NFS_V3NPROCS is one greater than the last V3 op and NFS_NPROCS is 332 * one greater than the last number. 333 */ 334 #ifndef NFS_V3NPROCS 335 #define NFS_V3NPROCS 22 336 337 #define NFSPROC_LOOKUPP 22 338 #define NFSPROC_SETCLIENTID 23 339 #define NFSPROC_SETCLIENTIDCFRM 24 340 #define NFSPROC_LOCK 25 341 #define NFSPROC_LOCKU 26 342 #define NFSPROC_OPEN 27 343 #define NFSPROC_CLOSE 28 344 #define NFSPROC_OPENCONFIRM 29 345 #define NFSPROC_LOCKT 30 346 #define NFSPROC_OPENDOWNGRADE 31 347 #define NFSPROC_RENEW 32 348 #define NFSPROC_PUTROOTFH 33 349 #define NFSPROC_RELEASELCKOWN 34 350 #define NFSPROC_DELEGRETURN 35 351 #define NFSPROC_RETDELEGREMOVE 36 352 #define NFSPROC_RETDELEGRENAME1 37 353 #define NFSPROC_RETDELEGRENAME2 38 354 #define NFSPROC_GETACL 39 355 #define NFSPROC_SETACL 40 356 357 /* 358 * Must be defined as one higher than the last Proc# above. 359 */ 360 #define NFSV4_NPROCS 41 361 362 /* Additional procedures for NFSv4.1. */ 363 #define NFSPROC_EXCHANGEID 41 364 #define NFSPROC_CREATESESSION 42 365 #define NFSPROC_DESTROYSESSION 43 366 #define NFSPROC_DESTROYCLIENT 44 367 #define NFSPROC_FREESTATEID 45 368 #define NFSPROC_LAYOUTGET 46 369 #define NFSPROC_GETDEVICEINFO 47 370 #define NFSPROC_LAYOUTCOMMIT 48 371 #define NFSPROC_LAYOUTRETURN 49 372 #define NFSPROC_RECLAIMCOMPL 50 373 #define NFSPROC_WRITEDS 51 374 #define NFSPROC_READDS 52 375 #define NFSPROC_COMMITDS 53 376 #define NFSPROC_OPENLAYGET 54 377 #define NFSPROC_CREATELAYGET 55 378 379 /* 380 * Must be defined as one higher than the last NFSv4.1 Proc# above. 381 */ 382 #define NFSV41_NPROCS 56 383 384 /* Additional procedures for NFSv4.2. */ 385 #define NFSPROC_IOADVISE 56 386 #define NFSPROC_ALLOCATE 57 387 #define NFSPROC_COPY 58 388 #define NFSPROC_SEEK 59 389 #define NFSPROC_SEEKDS 60 390 391 /* and the ones for the optional Extended attribute support (RFC-8276). */ 392 #define NFSPROC_GETEXTATTR 61 393 #define NFSPROC_SETEXTATTR 62 394 #define NFSPROC_RMEXTATTR 63 395 #define NFSPROC_LISTEXTATTR 64 396 397 /* 398 * Must be defined as one higher than the last NFSv4.2 Proc# above. 399 */ 400 #define NFSV42_NPROCS 65 401 402 #endif /* NFS_V3NPROCS */ 403 404 /* 405 * Define NFS_NPROCS as NFSV4_NPROCS for the experimental kernel code. 406 */ 407 #ifndef NFS_NPROCS 408 #define NFS_NPROCS NFSV4_NPROCS 409 #endif 410 411 /* 412 * NFSPROC_NOOP is a fake op# that can't be the same as any V2/3/4 Procedure 413 * or Operation#. Since the NFS V4 Op #s go higher, use NFSV42_NOPS, which 414 * is one greater than the highest Op#. 415 */ 416 #define NFSPROC_NOOP NFSV42_NOPS 417 418 /* Actual Version 2 procedure numbers */ 419 #define NFSV2PROC_NULL 0 420 #define NFSV2PROC_GETATTR 1 421 #define NFSV2PROC_SETATTR 2 422 #define NFSV2PROC_NOOP 3 423 #define NFSV2PROC_ROOT NFSV2PROC_NOOP /* Obsolete */ 424 #define NFSV2PROC_LOOKUP 4 425 #define NFSV2PROC_READLINK 5 426 #define NFSV2PROC_READ 6 427 #define NFSV2PROC_WRITECACHE NFSV2PROC_NOOP /* Obsolete */ 428 #define NFSV2PROC_WRITE 8 429 #define NFSV2PROC_CREATE 9 430 #define NFSV2PROC_REMOVE 10 431 #define NFSV2PROC_RENAME 11 432 #define NFSV2PROC_LINK 12 433 #define NFSV2PROC_SYMLINK 13 434 #define NFSV2PROC_MKDIR 14 435 #define NFSV2PROC_RMDIR 15 436 #define NFSV2PROC_READDIR 16 437 #define NFSV2PROC_STATFS 17 438 439 /* 440 * V4 Procedure numbers 441 */ 442 #define NFSV4PROC_COMPOUND 1 443 #define NFSV4PROC_CBNULL 0 444 #define NFSV4PROC_CBCOMPOUND 1 445 446 /* 447 * Constants used by the Version 3 and 4 protocols for various RPCs 448 */ 449 #define NFSV3SATTRTIME_DONTCHANGE 0 450 #define NFSV3SATTRTIME_TOSERVER 1 451 #define NFSV3SATTRTIME_TOCLIENT 2 452 453 #define NFSV4SATTRTIME_TOSERVER 0 454 #define NFSV4SATTRTIME_TOCLIENT 1 455 456 #define NFSV4LOCKT_READ 1 457 #define NFSV4LOCKT_WRITE 2 458 #define NFSV4LOCKT_READW 3 459 #define NFSV4LOCKT_WRITEW 4 460 #define NFSV4LOCKT_RELEASE 5 461 462 #define NFSV4OPEN_NOCREATE 0 463 #define NFSV4OPEN_CREATE 1 464 #define NFSV4OPEN_CLAIMNULL 0 465 #define NFSV4OPEN_CLAIMPREVIOUS 1 466 #define NFSV4OPEN_CLAIMDELEGATECUR 2 467 #define NFSV4OPEN_CLAIMDELEGATEPREV 3 468 #define NFSV4OPEN_CLAIMFH 4 469 #define NFSV4OPEN_CLAIMDELEGATECURFH 5 470 #define NFSV4OPEN_CLAIMDELEGATEPREVFH 6 471 #define NFSV4OPEN_DELEGATENONE 0 472 #define NFSV4OPEN_DELEGATEREAD 1 473 #define NFSV4OPEN_DELEGATEWRITE 2 474 #define NFSV4OPEN_DELEGATENONEEXT 3 475 #define NFSV4OPEN_LIMITSIZE 1 476 #define NFSV4OPEN_LIMITBLOCKS 2 477 478 /* 479 * Nfs V4 ACE stuff 480 */ 481 #define NFSV4ACE_ALLOWEDTYPE 0x00000000 482 #define NFSV4ACE_DENIEDTYPE 0x00000001 483 #define NFSV4ACE_AUDITTYPE 0x00000002 484 #define NFSV4ACE_ALARMTYPE 0x00000003 485 486 #define NFSV4ACE_SUPALLOWED 0x00000001 487 #define NFSV4ACE_SUPDENIED 0x00000002 488 #define NFSV4ACE_SUPAUDIT 0x00000004 489 #define NFSV4ACE_SUPALARM 0x00000008 490 491 #define NFSV4ACE_SUPTYPES (NFSV4ACE_SUPALLOWED | NFSV4ACE_SUPDENIED) 492 493 #define NFSV4ACE_FILEINHERIT 0x00000001 494 #define NFSV4ACE_DIRECTORYINHERIT 0x00000002 495 #define NFSV4ACE_NOPROPAGATEINHERIT 0x00000004 496 #define NFSV4ACE_INHERITONLY 0x00000008 497 #define NFSV4ACE_SUCCESSFULACCESS 0x00000010 498 #define NFSV4ACE_FAILEDACCESS 0x00000020 499 #define NFSV4ACE_IDENTIFIERGROUP 0x00000040 500 501 #define NFSV4ACE_READDATA 0x00000001 502 #define NFSV4ACE_LISTDIRECTORY 0x00000001 503 #define NFSV4ACE_WRITEDATA 0x00000002 504 #define NFSV4ACE_ADDFILE 0x00000002 505 #define NFSV4ACE_APPENDDATA 0x00000004 506 #define NFSV4ACE_ADDSUBDIRECTORY 0x00000004 507 #define NFSV4ACE_READNAMEDATTR 0x00000008 508 #define NFSV4ACE_WRITENAMEDATTR 0x00000010 509 #define NFSV4ACE_EXECUTE 0x00000020 510 #define NFSV4ACE_SEARCH 0x00000020 511 #define NFSV4ACE_DELETECHILD 0x00000040 512 #define NFSV4ACE_READATTRIBUTES 0x00000080 513 #define NFSV4ACE_WRITEATTRIBUTES 0x00000100 514 #define NFSV4ACE_DELETE 0x00010000 515 #define NFSV4ACE_READACL 0x00020000 516 #define NFSV4ACE_WRITEACL 0x00040000 517 #define NFSV4ACE_WRITEOWNER 0x00080000 518 #define NFSV4ACE_SYNCHRONIZE 0x00100000 519 520 /* 521 * Here are the mappings between mode bits and acl mask bits for 522 * directories and other files. 523 * (Named attributes have not been included, since named attributes are 524 * not yet supported.) 525 * The mailing list seems to indicate that NFSV4ACE_EXECUTE refers to 526 * searching a directory, although I can't find a statement of that in 527 * the RFC. 528 */ 529 #define NFSV4ACE_ALLFILESMASK (NFSV4ACE_READATTRIBUTES | NFSV4ACE_READACL) 530 #define NFSV4ACE_OWNERMASK (NFSV4ACE_WRITEATTRIBUTES | NFSV4ACE_WRITEACL) 531 #define NFSV4ACE_DIRREADMASK NFSV4ACE_LISTDIRECTORY 532 #define NFSV4ACE_DIREXECUTEMASK NFSV4ACE_EXECUTE 533 #define NFSV4ACE_DIRWRITEMASK (NFSV4ACE_ADDFILE | \ 534 NFSV4ACE_ADDSUBDIRECTORY | NFSV4ACE_DELETECHILD) 535 #define NFSV4ACE_READMASK NFSV4ACE_READDATA 536 #define NFSV4ACE_WRITEMASK (NFSV4ACE_WRITEDATA | NFSV4ACE_APPENDDATA) 537 #define NFSV4ACE_EXECUTEMASK NFSV4ACE_EXECUTE 538 #define NFSV4ACE_ALLFILEBITS (NFSV4ACE_READMASK | NFSV4ACE_WRITEMASK | \ 539 NFSV4ACE_EXECUTEMASK | NFSV4ACE_SYNCHRONIZE) 540 #define NFSV4ACE_ALLDIRBITS (NFSV4ACE_DIRREADMASK | \ 541 NFSV4ACE_DIRWRITEMASK | NFSV4ACE_DIREXECUTEMASK) 542 #define NFSV4ACE_AUDITMASK 0x0 543 544 /* 545 * These GENERIC masks are not used and are no longer believed to be useful. 546 */ 547 #define NFSV4ACE_GENERICREAD 0x00120081 548 #define NFSV4ACE_GENERICWRITE 0x00160106 549 #define NFSV4ACE_GENERICEXECUTE 0x001200a0 550 551 #define NFSSTATEID_PUTALLZERO 0 552 #define NFSSTATEID_PUTALLONE 1 553 #define NFSSTATEID_PUTSTATEID 2 554 #define NFSSTATEID_PUTSEQIDZERO 3 555 556 /* 557 * Bits for share access and deny. 558 */ 559 #define NFSV4OPEN_ACCESSREAD 0x00000001 560 #define NFSV4OPEN_ACCESSWRITE 0x00000002 561 #define NFSV4OPEN_ACCESSBOTH 0x00000003 562 #define NFSV4OPEN_WANTDELEGMASK 0x0000ff00 563 #define NFSV4OPEN_WANTREADDELEG 0x00000100 564 #define NFSV4OPEN_WANTWRITEDELEG 0x00000200 565 #define NFSV4OPEN_WANTANYDELEG 0x00000300 566 #define NFSV4OPEN_WANTNODELEG 0x00000400 567 #define NFSV4OPEN_WANTCANCEL 0x00000500 568 #define NFSV4OPEN_WANTSIGNALDELEG 0x00010000 569 #define NFSV4OPEN_WANTPUSHDELEG 0x00020000 570 571 #define NFSV4OPEN_DENYNONE 0x00000000 572 #define NFSV4OPEN_DENYREAD 0x00000001 573 #define NFSV4OPEN_DENYWRITE 0x00000002 574 #define NFSV4OPEN_DENYBOTH 0x00000003 575 576 /* 577 * Delegate_none_ext reply values. 578 */ 579 #define NFSV4OPEN_NOTWANTED 0 580 #define NFSV4OPEN_CONTENTION 1 581 #define NFSV4OPEN_RESOURCE 2 582 #define NFSV4OPEN_NOTSUPPFTYPE 3 583 #define NFSV4OPEN_NOTSUPPWRITEFTYPE 4 584 #define NFSV4OPEN_NOTSUPPUPGRADE 5 585 #define NFSV4OPEN_NOTSUPPDOWNGRADE 6 586 #define NFSV4OPEN_CANCELLED 7 587 #define NFSV4OPEN_ISDIR 8 588 589 /* 590 * Open result flags 591 * (The first four are in the spec. The rest are used internally.) 592 */ 593 #define NFSV4OPEN_RESULTCONFIRM 0x00000002 594 #define NFSV4OPEN_LOCKTYPEPOSIX 0x00000004 595 #define NFSV4OPEN_PRESERVEUNLINKED 0x00000008 596 #define NFSV4OPEN_MAYNOTIFYLOCK 0x00000020 597 #define NFSV4OPEN_RFLAGS \ 598 (NFSV4OPEN_RESULTCONFIRM | NFSV4OPEN_LOCKTYPEPOSIX | \ 599 NFSV4OPEN_PRESERVEUNLINKED | NFSV4OPEN_MAYNOTIFYLOCK) 600 #define NFSV4OPEN_RECALL 0x00010000 601 #define NFSV4OPEN_READDELEGATE 0x00020000 602 #define NFSV4OPEN_WRITEDELEGATE 0x00040000 603 #define NFSV4OPEN_WDRESOURCE 0x00080000 604 #define NFSV4OPEN_WDCONTENTION 0x00100000 605 #define NFSV4OPEN_WDNOTWANTED 0x00200000 606 #define NFSV4OPEN_WDSUPPFTYPE 0x00400000 607 608 /* 609 * NFS V4 File Handle types 610 */ 611 #define NFSV4FHTYPE_PERSISTENT 0x0 612 #define NFSV4FHTYPE_NOEXPIREWITHOPEN 0x1 613 #define NFSV4FHTYPE_VOLATILEANY 0x2 614 #define NFSV4FHTYPE_VOLATILEMIGRATE 0x4 615 #define NFSV4FHTYPE_VOLATILERENAME 0x8 616 617 /* 618 * Maximum size of V4 opaque strings. 619 */ 620 #define NFSV4_OPAQUELIMIT 1024 621 622 /* 623 * These are the same for V3 and V4. 624 */ 625 #define NFSACCESS_READ 0x01 626 #define NFSACCESS_LOOKUP 0x02 627 #define NFSACCESS_MODIFY 0x04 628 #define NFSACCESS_EXTEND 0x08 629 #define NFSACCESS_DELETE 0x10 630 #define NFSACCESS_EXECUTE 0x20 631 632 /* Additional Extended Attribute access bits RFC-8276. */ 633 #define NFSACCESS_XAREAD 0x40 634 #define NFSACCESS_XAWRITE 0x80 635 #define NFSACCESS_XALIST 0x100 636 637 #define NFSWRITE_UNSTABLE 0 638 #define NFSWRITE_DATASYNC 1 639 #define NFSWRITE_FILESYNC 2 640 641 #define NFSCREATE_UNCHECKED 0 642 #define NFSCREATE_GUARDED 1 643 #define NFSCREATE_EXCLUSIVE 2 644 #define NFSCREATE_EXCLUSIVE41 3 645 646 #define NFSV3FSINFO_LINK 0x01 647 #define NFSV3FSINFO_SYMLINK 0x02 648 #define NFSV3FSINFO_HOMOGENEOUS 0x08 649 #define NFSV3FSINFO_CANSETTIME 0x10 650 651 /* Flags for Exchange ID */ 652 #define NFSV4EXCH_SUPPMOVEDREFER 0x00000001 653 #define NFSV4EXCH_SUPPMOVEDMIGR 0x00000002 654 #define NFSV4EXCH_BINDPRINCSTATEID 0x00000100 655 #define NFSV4EXCH_USENONPNFS 0x00010000 656 #define NFSV4EXCH_USEPNFSMDS 0x00020000 657 #define NFSV4EXCH_USEPNFSDS 0x00040000 658 #define NFSV4EXCH_MASKPNFS 0x00070000 659 #define NFSV4EXCH_UPDCONFIRMEDRECA 0x40000000 660 #define NFSV4EXCH_CONFIRMEDR 0x80000000 661 662 /* State Protects */ 663 #define NFSV4EXCH_SP4NONE 0 664 #define NFSV4EXCH_SP4MACHCRED 1 665 #define NFSV4EXCH_SP4SSV 2 666 667 /* Flags for Create Session */ 668 #define NFSV4CRSESS_PERSIST 0x00000001 669 #define NFSV4CRSESS_CONNBACKCHAN 0x00000002 670 #define NFSV4CRSESS_CONNRDMA 0x00000004 671 672 /* Flags for Sequence */ 673 #define NFSV4SEQ_CBPATHDOWN 0x00000001 674 #define NFSV4SEQ_CBGSSCONTEXPIRING 0x00000002 675 #define NFSV4SEQ_CBGSSCONTEXPIRED 0x00000004 676 #define NFSV4SEQ_EXPIREDALLSTATEREVOKED 0x00000008 677 #define NFSV4SEQ_EXPIREDSOMESTATEREVOKED 0x00000010 678 #define NFSV4SEQ_ADMINSTATEREVOKED 0x00000020 679 #define NFSV4SEQ_RECALLABLESTATEREVOKED 0x00000040 680 #define NFSV4SEQ_LEASEMOVED 0x00000080 681 #define NFSV4SEQ_RESTARTRECLAIMNEEDED 0x00000100 682 #define NFSV4SEQ_CBPATHDOWNSESSION 0x00000200 683 #define NFSV4SEQ_BACKCHANNELFAULT 0x00000400 684 #define NFSV4SEQ_DEVIDCHANGED 0x00000800 685 #define NFSV4SEQ_DEVIDDELETED 0x00001000 686 687 /* Flags for Layout. */ 688 #define NFSLAYOUTRETURN_FILE 1 689 #define NFSLAYOUTRETURN_FSID 2 690 #define NFSLAYOUTRETURN_ALL 3 691 692 #define NFSLAYOUT_NFSV4_1_FILES 0x1 693 #define NFSLAYOUT_OSD2_OBJECTS 0x2 694 #define NFSLAYOUT_BLOCK_VOLUME 0x3 695 #define NFSLAYOUT_FLEXFILE 0x4 696 697 #define NFSLAYOUTIOMODE_READ 1 698 #define NFSLAYOUTIOMODE_RW 2 699 #define NFSLAYOUTIOMODE_ANY 3 700 701 /* Flags for Get Device Info. */ 702 #define NFSDEVICEIDNOTIFY_CHANGEBIT 0x1 703 #define NFSDEVICEIDNOTIFY_DELETEBIT 0x2 704 705 /* Flags for File Layout. */ 706 #define NFSFLAYUTIL_DENSE 0x1 707 #define NFSFLAYUTIL_COMMIT_THRU_MDS 0x2 708 #define NFSFLAYUTIL_IOADVISE_THRU_MDS 0x4 709 #define NFSFLAYUTIL_STRIPE_MASK 0xffffffc0 710 711 /* Flags for Flex File Layout. */ 712 #define NFSFLEXFLAG_NO_LAYOUTCOMMIT 0x00000001 713 #define NFSFLEXFLAG_NOIO_MDS 0x00000002 714 #define NFSFLEXFLAG_NO_READIO 0x00000004 715 #define NFSFLEXFLAG_WRITE_ONEMIRROR 0x00000008 716 717 /* Enum values for Bind Connection to Session. */ 718 #define NFSCDFC4_FORE 0x1 719 #define NFSCDFC4_BACK 0x2 720 #define NFSCDFC4_FORE_OR_BOTH 0x3 721 #define NFSCDFC4_BACK_OR_BOTH 0x7 722 #define NFSCDFS4_FORE 0x1 723 #define NFSCDFS4_BACK 0x2 724 #define NFSCDFS4_BOTH 0x3 725 726 #if defined(_KERNEL) || defined(KERNEL) 727 /* Conversion macros */ 728 #define vtonfsv2_mode(t,m) \ 729 txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \ 730 MAKEIMODE((t), (m))) 731 #define vtonfsv34_mode(m) txdr_unsigned((m) & 07777) 732 #define nfstov_mode(a) (fxdr_unsigned(u_int16_t, (a))&07777) 733 #define vtonfsv2_type(a) (((u_int32_t)(a)) >= 9 ? txdr_unsigned(NFNON) : \ 734 txdr_unsigned(newnfsv2_type[((u_int32_t)(a))])) 735 #define vtonfsv34_type(a) (((u_int32_t)(a)) >= 9 ? txdr_unsigned(NFNON) : \ 736 txdr_unsigned(nfsv34_type[((u_int32_t)(a))])) 737 #define nfsv2tov_type(a) newnv2tov_type[fxdr_unsigned(u_int32_t,(a))&0x7] 738 #define nfsv34tov_type(a) nv34tov_type[fxdr_unsigned(u_int32_t,(a))&0x7] 739 #define vtonfs_dtype(a) (((u_int32_t)(a)) >= 9 ? IFTODT(VTTOIF(VNON)) : \ 740 IFTODT(VTTOIF(a))) 741 742 /* File types */ 743 typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5, 744 NFSOCK=6, NFFIFO=7, NFATTRDIR=8, NFNAMEDATTR=9 } nfstype; 745 746 /* Structs for common parts of the rpc's */ 747 748 struct nfsv2_time { 749 u_int32_t nfsv2_sec; 750 u_int32_t nfsv2_usec; 751 }; 752 typedef struct nfsv2_time nfstime2; 753 754 struct nfsv3_time { 755 u_int32_t nfsv3_sec; 756 u_int32_t nfsv3_nsec; 757 }; 758 typedef struct nfsv3_time nfstime3; 759 760 struct nfsv4_time { 761 u_int32_t nfsv4_highsec; 762 u_int32_t nfsv4_sec; 763 u_int32_t nfsv4_nsec; 764 }; 765 typedef struct nfsv4_time nfstime4; 766 767 /* 768 * Quads are defined as arrays of 2 longs to ensure dense packing for the 769 * protocol and to facilitate xdr conversion. 770 */ 771 struct nfs_uquad { 772 u_int32_t nfsuquad[2]; 773 }; 774 typedef struct nfs_uquad nfsuint64; 775 776 /* 777 * Used to convert between two u_longs and a u_quad_t. 778 */ 779 union nfs_quadconvert { 780 u_int32_t lval[2]; 781 u_quad_t qval; 782 }; 783 typedef union nfs_quadconvert nfsquad_t; 784 785 /* 786 * NFS Version 3 special file number. 787 */ 788 struct nfsv3_spec { 789 u_int32_t specdata1; 790 u_int32_t specdata2; 791 }; 792 typedef struct nfsv3_spec nfsv3spec; 793 794 /* 795 * File attributes and setable attributes. These structures cover both 796 * NFS version 2 and the version 3 protocol. Note that the union is only 797 * used so that one pointer can refer to both variants. These structures 798 * go out on the wire and must be densely packed, so no quad data types 799 * are used. (all fields are longs or u_longs or structures of same) 800 * NB: You can't do sizeof(struct nfs_fattr), you must use the 801 * NFSX_FATTR(v3) macro. 802 */ 803 struct nfs_fattr { 804 u_int32_t fa_type; 805 u_int32_t fa_mode; 806 u_int32_t fa_nlink; 807 u_int32_t fa_uid; 808 u_int32_t fa_gid; 809 union { 810 struct { 811 u_int32_t nfsv2fa_size; 812 u_int32_t nfsv2fa_blocksize; 813 u_int32_t nfsv2fa_rdev; 814 u_int32_t nfsv2fa_blocks; 815 u_int32_t nfsv2fa_fsid; 816 u_int32_t nfsv2fa_fileid; 817 nfstime2 nfsv2fa_atime; 818 nfstime2 nfsv2fa_mtime; 819 nfstime2 nfsv2fa_ctime; 820 } fa_nfsv2; 821 struct { 822 nfsuint64 nfsv3fa_size; 823 nfsuint64 nfsv3fa_used; 824 nfsv3spec nfsv3fa_rdev; 825 nfsuint64 nfsv3fa_fsid; 826 nfsuint64 nfsv3fa_fileid; 827 nfstime3 nfsv3fa_atime; 828 nfstime3 nfsv3fa_mtime; 829 nfstime3 nfsv3fa_ctime; 830 } fa_nfsv3; 831 } fa_un; 832 }; 833 834 /* and some ugly defines for accessing union components */ 835 #define fa2_size fa_un.fa_nfsv2.nfsv2fa_size 836 #define fa2_blocksize fa_un.fa_nfsv2.nfsv2fa_blocksize 837 #define fa2_rdev fa_un.fa_nfsv2.nfsv2fa_rdev 838 #define fa2_blocks fa_un.fa_nfsv2.nfsv2fa_blocks 839 #define fa2_fsid fa_un.fa_nfsv2.nfsv2fa_fsid 840 #define fa2_fileid fa_un.fa_nfsv2.nfsv2fa_fileid 841 #define fa2_atime fa_un.fa_nfsv2.nfsv2fa_atime 842 #define fa2_mtime fa_un.fa_nfsv2.nfsv2fa_mtime 843 #define fa2_ctime fa_un.fa_nfsv2.nfsv2fa_ctime 844 #define fa3_size fa_un.fa_nfsv3.nfsv3fa_size 845 #define fa3_used fa_un.fa_nfsv3.nfsv3fa_used 846 #define fa3_rdev fa_un.fa_nfsv3.nfsv3fa_rdev 847 #define fa3_fsid fa_un.fa_nfsv3.nfsv3fa_fsid 848 #define fa3_fileid fa_un.fa_nfsv3.nfsv3fa_fileid 849 #define fa3_atime fa_un.fa_nfsv3.nfsv3fa_atime 850 #define fa3_mtime fa_un.fa_nfsv3.nfsv3fa_mtime 851 #define fa3_ctime fa_un.fa_nfsv3.nfsv3fa_ctime 852 853 #define NFS_LINK_MAX UINT32_MAX 854 855 struct nfsv2_sattr { 856 u_int32_t sa_mode; 857 u_int32_t sa_uid; 858 u_int32_t sa_gid; 859 u_int32_t sa_size; 860 nfstime2 sa_atime; 861 nfstime2 sa_mtime; 862 }; 863 864 /* 865 * NFS Version 3 sattr structure for the new node creation case. 866 */ 867 struct nfsv3_sattr { 868 u_int32_t sa_modetrue; 869 u_int32_t sa_mode; 870 u_int32_t sa_uidfalse; 871 u_int32_t sa_gidfalse; 872 u_int32_t sa_sizefalse; 873 u_int32_t sa_atimetype; 874 nfstime3 sa_atime; 875 u_int32_t sa_mtimetype; 876 nfstime3 sa_mtime; 877 }; 878 879 /* 880 * IO Advise hint bits for NFSv4.2. 881 * Since these go on the wire as a bitmap, the NFSATTRBIT macros are 882 * used to manipulate these bits. 883 */ 884 #define NFSV4IOHINT_NORMAL 0 885 #define NFSV4IOHINT_SEQUENTIAL 1 886 #define NFSV4IOHINT_SEQUENTIALBACK 2 887 #define NFSV4IOHINT_RANDOM 3 888 #define NFSV4IOHINT_WILLNEED 4 889 #define NFSV4IOHINT_WILLNEEDOPTUN 5 890 #define NFSV4IOHINT_DONTNEED 6 891 #define NFSV4IOHINT_NOREUSE 7 892 #define NFSV4IOHINT_READ 8 893 #define NFSV4IOHINT_WRITE 9 894 #define NFSV4IOHINT_INITPROXIMITY 10 895 896 #endif /* _KERNEL */ 897 898 /* 899 * The attribute bits used for V4. 900 * NFSATTRBIT_xxx defines the attribute# (and its bit position) 901 * NFSATTRBM_xxx is a 32bit mask with the correct bit set within the 902 * appropriate 32bit word. 903 * NFSATTRBIT_MAX is one greater than the largest NFSATTRBIT_xxx 904 */ 905 #define NFSATTRBIT_SUPPORTEDATTRS 0 906 #define NFSATTRBIT_TYPE 1 907 #define NFSATTRBIT_FHEXPIRETYPE 2 908 #define NFSATTRBIT_CHANGE 3 909 #define NFSATTRBIT_SIZE 4 910 #define NFSATTRBIT_LINKSUPPORT 5 911 #define NFSATTRBIT_SYMLINKSUPPORT 6 912 #define NFSATTRBIT_NAMEDATTR 7 913 #define NFSATTRBIT_FSID 8 914 #define NFSATTRBIT_UNIQUEHANDLES 9 915 #define NFSATTRBIT_LEASETIME 10 916 #define NFSATTRBIT_RDATTRERROR 11 917 #define NFSATTRBIT_ACL 12 918 #define NFSATTRBIT_ACLSUPPORT 13 919 #define NFSATTRBIT_ARCHIVE 14 920 #define NFSATTRBIT_CANSETTIME 15 921 #define NFSATTRBIT_CASEINSENSITIVE 16 922 #define NFSATTRBIT_CASEPRESERVING 17 923 #define NFSATTRBIT_CHOWNRESTRICTED 18 924 #define NFSATTRBIT_FILEHANDLE 19 925 #define NFSATTRBIT_FILEID 20 926 #define NFSATTRBIT_FILESAVAIL 21 927 #define NFSATTRBIT_FILESFREE 22 928 #define NFSATTRBIT_FILESTOTAL 23 929 #define NFSATTRBIT_FSLOCATIONS 24 930 #define NFSATTRBIT_HIDDEN 25 931 #define NFSATTRBIT_HOMOGENEOUS 26 932 #define NFSATTRBIT_MAXFILESIZE 27 933 #define NFSATTRBIT_MAXLINK 28 934 #define NFSATTRBIT_MAXNAME 29 935 #define NFSATTRBIT_MAXREAD 30 936 #define NFSATTRBIT_MAXWRITE 31 937 #define NFSATTRBIT_MIMETYPE 32 938 #define NFSATTRBIT_MODE 33 939 #define NFSATTRBIT_NOTRUNC 34 940 #define NFSATTRBIT_NUMLINKS 35 941 #define NFSATTRBIT_OWNER 36 942 #define NFSATTRBIT_OWNERGROUP 37 943 #define NFSATTRBIT_QUOTAHARD 38 944 #define NFSATTRBIT_QUOTASOFT 39 945 #define NFSATTRBIT_QUOTAUSED 40 946 #define NFSATTRBIT_RAWDEV 41 947 #define NFSATTRBIT_SPACEAVAIL 42 948 #define NFSATTRBIT_SPACEFREE 43 949 #define NFSATTRBIT_SPACETOTAL 44 950 #define NFSATTRBIT_SPACEUSED 45 951 #define NFSATTRBIT_SYSTEM 46 952 #define NFSATTRBIT_TIMEACCESS 47 953 #define NFSATTRBIT_TIMEACCESSSET 48 954 #define NFSATTRBIT_TIMEBACKUP 49 955 #define NFSATTRBIT_TIMECREATE 50 956 #define NFSATTRBIT_TIMEDELTA 51 957 #define NFSATTRBIT_TIMEMETADATA 52 958 #define NFSATTRBIT_TIMEMODIFY 53 959 #define NFSATTRBIT_TIMEMODIFYSET 54 960 #define NFSATTRBIT_MOUNTEDONFILEID 55 961 #define NFSATTRBIT_DIRNOTIFDELAY 56 962 #define NFSATTRBIT_DIRENTNOTIFDELAY 57 963 #define NFSATTRBIT_DACL 58 964 #define NFSATTRBIT_SACL 59 965 #define NFSATTRBIT_CHANGEPOLICY 60 966 #define NFSATTRBIT_FSSTATUS 61 967 #define NFSATTRBIT_FSLAYOUTTYPE 62 968 #define NFSATTRBIT_LAYOUTHINT 63 969 #define NFSATTRBIT_LAYOUTTYPE 64 970 #define NFSATTRBIT_LAYOUTBLKSIZE 65 971 #define NFSATTRBIT_LAYOUTALIGNMENT 66 972 #define NFSATTRBIT_FSLOCATIONSINFO 67 973 #define NFSATTRBIT_MDSTHRESHOLD 68 974 #define NFSATTRBIT_RETENTIONGET 69 975 #define NFSATTRBIT_RETENTIONSET 70 976 #define NFSATTRBIT_RETENTEVTGET 71 977 #define NFSATTRBIT_RETENTEVTSET 72 978 #define NFSATTRBIT_RETENTIONHOLD 73 979 #define NFSATTRBIT_MODESETMASKED 74 980 #define NFSATTRBIT_SUPPATTREXCLCREAT 75 981 #define NFSATTRBIT_FSCHARSETCAP 76 982 #define NFSATTRBIT_CLONEBLKSIZE 77 983 #define NFSATTRBIT_SPACEFREED 78 984 #define NFSATTRBIT_CHANGEATTRTYPE 79 985 #define NFSATTRBIT_SECLABEL 80 986 /* Not sure what attribute bit #81 is? */ 987 #define NFSATTRBIT_XATTRSUPPORT 82 988 989 #define NFSATTRBM_SUPPORTEDATTRS 0x00000001 990 #define NFSATTRBM_TYPE 0x00000002 991 #define NFSATTRBM_FHEXPIRETYPE 0x00000004 992 #define NFSATTRBM_CHANGE 0x00000008 993 #define NFSATTRBM_SIZE 0x00000010 994 #define NFSATTRBM_LINKSUPPORT 0x00000020 995 #define NFSATTRBM_SYMLINKSUPPORT 0x00000040 996 #define NFSATTRBM_NAMEDATTR 0x00000080 997 #define NFSATTRBM_FSID 0x00000100 998 #define NFSATTRBM_UNIQUEHANDLES 0x00000200 999 #define NFSATTRBM_LEASETIME 0x00000400 1000 #define NFSATTRBM_RDATTRERROR 0x00000800 1001 #define NFSATTRBM_ACL 0x00001000 1002 #define NFSATTRBM_ACLSUPPORT 0x00002000 1003 #define NFSATTRBM_ARCHIVE 0x00004000 1004 #define NFSATTRBM_CANSETTIME 0x00008000 1005 #define NFSATTRBM_CASEINSENSITIVE 0x00010000 1006 #define NFSATTRBM_CASEPRESERVING 0x00020000 1007 #define NFSATTRBM_CHOWNRESTRICTED 0x00040000 1008 #define NFSATTRBM_FILEHANDLE 0x00080000 1009 #define NFSATTRBM_FILEID 0x00100000 1010 #define NFSATTRBM_FILESAVAIL 0x00200000 1011 #define NFSATTRBM_FILESFREE 0x00400000 1012 #define NFSATTRBM_FILESTOTAL 0x00800000 1013 #define NFSATTRBM_FSLOCATIONS 0x01000000 1014 #define NFSATTRBM_HIDDEN 0x02000000 1015 #define NFSATTRBM_HOMOGENEOUS 0x04000000 1016 #define NFSATTRBM_MAXFILESIZE 0x08000000 1017 #define NFSATTRBM_MAXLINK 0x10000000 1018 #define NFSATTRBM_MAXNAME 0x20000000 1019 #define NFSATTRBM_MAXREAD 0x40000000 1020 #define NFSATTRBM_MAXWRITE 0x80000000 1021 #define NFSATTRBM_MIMETYPE 0x00000001 1022 #define NFSATTRBM_MODE 0x00000002 1023 #define NFSATTRBM_NOTRUNC 0x00000004 1024 #define NFSATTRBM_NUMLINKS 0x00000008 1025 #define NFSATTRBM_OWNER 0x00000010 1026 #define NFSATTRBM_OWNERGROUP 0x00000020 1027 #define NFSATTRBM_QUOTAHARD 0x00000040 1028 #define NFSATTRBM_QUOTASOFT 0x00000080 1029 #define NFSATTRBM_QUOTAUSED 0x00000100 1030 #define NFSATTRBM_RAWDEV 0x00000200 1031 #define NFSATTRBM_SPACEAVAIL 0x00000400 1032 #define NFSATTRBM_SPACEFREE 0x00000800 1033 #define NFSATTRBM_SPACETOTAL 0x00001000 1034 #define NFSATTRBM_SPACEUSED 0x00002000 1035 #define NFSATTRBM_SYSTEM 0x00004000 1036 #define NFSATTRBM_TIMEACCESS 0x00008000 1037 #define NFSATTRBM_TIMEACCESSSET 0x00010000 1038 #define NFSATTRBM_TIMEBACKUP 0x00020000 1039 #define NFSATTRBM_TIMECREATE 0x00040000 1040 #define NFSATTRBM_TIMEDELTA 0x00080000 1041 #define NFSATTRBM_TIMEMETADATA 0x00100000 1042 #define NFSATTRBM_TIMEMODIFY 0x00200000 1043 #define NFSATTRBM_TIMEMODIFYSET 0x00400000 1044 #define NFSATTRBM_MOUNTEDONFILEID 0x00800000 1045 #define NFSATTRBM_DIRNOTIFDELAY 0x01000000 1046 #define NFSATTRBM_DIRENTNOTIFDELAY 0x02000000 1047 #define NFSATTRBM_DACL 0x04000000 1048 #define NFSATTRBM_SACL 0x08000000 1049 #define NFSATTRBM_CHANGEPOLICY 0x10000000 1050 #define NFSATTRBM_FSSTATUS 0x20000000 1051 #define NFSATTRBM_FSLAYOUTTYPE 0x40000000 1052 #define NFSATTRBM_LAYOUTHINT 0x80000000 1053 #define NFSATTRBM_LAYOUTTYPE 0x00000001 1054 #define NFSATTRBM_LAYOUTBLKSIZE 0x00000002 1055 #define NFSATTRBM_LAYOUTALIGNMENT 0x00000004 1056 #define NFSATTRBM_FSLOCATIONSINFO 0x00000008 1057 #define NFSATTRBM_MDSTHRESHOLD 0x00000010 1058 #define NFSATTRBM_RETENTIONGET 0x00000020 1059 #define NFSATTRBM_RETENTIONSET 0x00000040 1060 #define NFSATTRBM_RETENTEVTGET 0x00000080 1061 #define NFSATTRBM_RETENTEVTSET 0x00000100 1062 #define NFSATTRBM_RETENTIONHOLD 0x00000200 1063 #define NFSATTRBM_MODESETMASKED 0x00000400 1064 #define NFSATTRBM_SUPPATTREXCLCREAT 0x00000800 1065 #define NFSATTRBM_FSCHARSETCAP 0x00001000 1066 #define NFSATTRBM_CLONEBLKSIZE 0x00002000 1067 #define NFSATTRBM_SPACEFREED 0x00004000 1068 #define NFSATTRBM_CHANGEATTRTYPE 0x00008000 1069 #define NFSATTRBM_SECLABEL 0x00010000 1070 /* Not sure what attribute bit#81/0x00020000 is? */ 1071 #define NFSATTRBM_XATTRSUPPORT 0x00040000 1072 1073 #define NFSATTRBIT_MAX 83 1074 1075 /* 1076 * Sets of attributes that are supported, by words in the bitmap. 1077 */ 1078 /* 1079 * NFSATTRBIT_SUPPORTED - SUPP0 - bits 0<->31 1080 * SUPP1 - bits 32<->63 1081 * SUPP2 - bits 64<->95 1082 */ 1083 #define NFSATTRBIT_SUPP0 \ 1084 (NFSATTRBM_SUPPORTEDATTRS | \ 1085 NFSATTRBM_TYPE | \ 1086 NFSATTRBM_FHEXPIRETYPE | \ 1087 NFSATTRBM_CHANGE | \ 1088 NFSATTRBM_SIZE | \ 1089 NFSATTRBM_LINKSUPPORT | \ 1090 NFSATTRBM_SYMLINKSUPPORT | \ 1091 NFSATTRBM_NAMEDATTR | \ 1092 NFSATTRBM_FSID | \ 1093 NFSATTRBM_UNIQUEHANDLES | \ 1094 NFSATTRBM_LEASETIME | \ 1095 NFSATTRBM_RDATTRERROR | \ 1096 NFSATTRBM_ACL | \ 1097 NFSATTRBM_ACLSUPPORT | \ 1098 NFSATTRBM_CANSETTIME | \ 1099 NFSATTRBM_CASEINSENSITIVE | \ 1100 NFSATTRBM_CASEPRESERVING | \ 1101 NFSATTRBM_CHOWNRESTRICTED | \ 1102 NFSATTRBM_FILEHANDLE | \ 1103 NFSATTRBM_FILEID | \ 1104 NFSATTRBM_FILESAVAIL | \ 1105 NFSATTRBM_FILESFREE | \ 1106 NFSATTRBM_FILESTOTAL | \ 1107 NFSATTRBM_FSLOCATIONS | \ 1108 NFSATTRBM_HOMOGENEOUS | \ 1109 NFSATTRBM_MAXFILESIZE | \ 1110 NFSATTRBM_MAXLINK | \ 1111 NFSATTRBM_MAXNAME | \ 1112 NFSATTRBM_MAXREAD | \ 1113 NFSATTRBM_MAXWRITE) 1114 1115 /* 1116 * NFSATTRBIT_S1 - subset of SUPP1 - OR of the following bits: 1117 */ 1118 #define NFSATTRBIT_S1 \ 1119 (NFSATTRBM_MODE | \ 1120 NFSATTRBM_NOTRUNC | \ 1121 NFSATTRBM_NUMLINKS | \ 1122 NFSATTRBM_OWNER | \ 1123 NFSATTRBM_OWNERGROUP | \ 1124 NFSATTRBM_RAWDEV | \ 1125 NFSATTRBM_SPACEAVAIL | \ 1126 NFSATTRBM_SPACEFREE | \ 1127 NFSATTRBM_SPACETOTAL | \ 1128 NFSATTRBM_SPACEUSED | \ 1129 NFSATTRBM_TIMEACCESS | \ 1130 NFSATTRBM_TIMEDELTA | \ 1131 NFSATTRBM_TIMEMETADATA | \ 1132 NFSATTRBM_TIMEMODIFY | \ 1133 NFSATTRBM_MOUNTEDONFILEID | \ 1134 NFSATTRBM_QUOTAHARD | \ 1135 NFSATTRBM_QUOTASOFT | \ 1136 NFSATTRBM_QUOTAUSED | \ 1137 NFSATTRBM_FSLAYOUTTYPE) 1138 1139 1140 #ifdef QUOTA 1141 /* 1142 * If QUOTA OR in NFSATTRBIT_QUOTAHARD, NFSATTRBIT_QUOTASOFT and 1143 * NFSATTRBIT_QUOTAUSED. 1144 */ 1145 #define NFSATTRBIT_SUPP1 (NFSATTRBIT_S1 | \ 1146 NFSATTRBM_QUOTAHARD | \ 1147 NFSATTRBM_QUOTASOFT | \ 1148 NFSATTRBM_QUOTAUSED) 1149 #else 1150 #define NFSATTRBIT_SUPP1 NFSATTRBIT_S1 1151 #endif 1152 1153 #define NFSATTRBIT_SUPP2 \ 1154 (NFSATTRBM_LAYOUTTYPE | \ 1155 NFSATTRBM_LAYOUTBLKSIZE | \ 1156 NFSATTRBM_LAYOUTALIGNMENT | \ 1157 NFSATTRBM_SUPPATTREXCLCREAT | \ 1158 NFSATTRBM_XATTRSUPPORT) 1159 1160 /* 1161 * These are the set only attributes. 1162 */ 1163 #define NFSATTRBIT_SUPPSETONLY1 (NFSATTRBM_TIMEACCESSSET | \ 1164 NFSATTRBM_TIMEMODIFYSET) 1165 #define NFSATTRBIT_SUPPSETONLY2 (NFSATTRBM_MODESETMASKED) 1166 1167 /* 1168 * NFSATTRBIT_SETABLE - SETABLE0 - bits 0<->31 1169 * SETABLE1 - bits 32<->63 1170 * SETABLE2 - bits 64<->95 1171 */ 1172 #define NFSATTRBIT_SETABLE0 \ 1173 (NFSATTRBM_SIZE | \ 1174 NFSATTRBM_ACL) 1175 #define NFSATTRBIT_SETABLE1 \ 1176 (NFSATTRBM_MODE | \ 1177 NFSATTRBM_OWNER | \ 1178 NFSATTRBM_OWNERGROUP | \ 1179 NFSATTRBM_TIMEACCESSSET | \ 1180 NFSATTRBM_TIMEMODIFYSET) 1181 #define NFSATTRBIT_SETABLE2 \ 1182 (NFSATTRBM_MODESETMASKED) 1183 1184 /* 1185 * NFSATTRBIT_NFSV41 - Attributes only supported by NFSv4.1. 1186 */ 1187 #define NFSATTRBIT_NFSV41_1 \ 1188 (NFSATTRBM_FSLAYOUTTYPE) 1189 #define NFSATTRBIT_NFSV41_2 \ 1190 (NFSATTRBM_LAYOUTTYPE | \ 1191 NFSATTRBM_LAYOUTBLKSIZE | \ 1192 NFSATTRBM_LAYOUTALIGNMENT | \ 1193 NFSATTRBM_MODESETMASKED | \ 1194 NFSATTRBM_SUPPATTREXCLCREAT) 1195 1196 /* 1197 * NFSATTRBIT_NFSV42 - Attributes only supported by NFSv4.2. 1198 */ 1199 #define NFSATTRBIT_NFSV42_2 NFSATTRBM_XATTRSUPPORT 1200 1201 /* 1202 * Set of attributes that the getattr vnode op needs. 1203 * OR of the following bits. 1204 * NFSATTRBIT_GETATTR0 - bits 0<->31 1205 */ 1206 #define NFSATTRBIT_GETATTR0 \ 1207 (NFSATTRBM_SUPPORTEDATTRS | \ 1208 NFSATTRBM_TYPE | \ 1209 NFSATTRBM_CHANGE | \ 1210 NFSATTRBM_SIZE | \ 1211 NFSATTRBM_FSID | \ 1212 NFSATTRBM_FILEID | \ 1213 NFSATTRBM_MAXREAD) 1214 1215 /* 1216 * NFSATTRBIT_GETATTR1 - bits 32<->63 1217 */ 1218 #define NFSATTRBIT_GETATTR1 \ 1219 (NFSATTRBM_MODE | \ 1220 NFSATTRBM_NUMLINKS | \ 1221 NFSATTRBM_OWNER | \ 1222 NFSATTRBM_OWNERGROUP | \ 1223 NFSATTRBM_RAWDEV | \ 1224 NFSATTRBM_SPACEUSED | \ 1225 NFSATTRBM_TIMEACCESS | \ 1226 NFSATTRBM_TIMEMETADATA | \ 1227 NFSATTRBM_TIMEMODIFY) 1228 1229 /* 1230 * NFSATTRBIT_GETATTR2 - bits 64<->95 1231 */ 1232 #define NFSATTRBIT_GETATTR2 0 1233 1234 /* 1235 * Subset of the above that the Write RPC gets. 1236 * OR of the following bits. 1237 * NFSATTRBIT_WRITEGETATTR0 - bits 0<->31 1238 */ 1239 #define NFSATTRBIT_WRITEGETATTR0 \ 1240 (NFSATTRBM_SUPPORTEDATTRS | \ 1241 NFSATTRBM_TYPE | \ 1242 NFSATTRBM_CHANGE | \ 1243 NFSATTRBM_SIZE | \ 1244 NFSATTRBM_FSID | \ 1245 NFSATTRBM_FILEID | \ 1246 NFSATTRBM_MAXREAD) 1247 1248 /* 1249 * NFSATTRBIT_WRITEGETATTR1 - bits 32<->63 1250 */ 1251 #define NFSATTRBIT_WRITEGETATTR1 \ 1252 (NFSATTRBM_MODE | \ 1253 NFSATTRBM_NUMLINKS | \ 1254 NFSATTRBM_RAWDEV | \ 1255 NFSATTRBM_SPACEUSED | \ 1256 NFSATTRBM_TIMEACCESS | \ 1257 NFSATTRBM_TIMEMETADATA | \ 1258 NFSATTRBM_TIMEMODIFY) 1259 1260 /* 1261 * NFSATTRBIT_WRITEGETATTR2 - bits 64<->95 1262 */ 1263 #define NFSATTRBIT_WRITEGETATTR2 0 1264 1265 /* 1266 * Set of attributes that the wccattr operation op needs. 1267 * OR of the following bits. 1268 * NFSATTRBIT_WCCATTR0 - bits 0<->31 1269 */ 1270 #define NFSATTRBIT_WCCATTR0 0 1271 1272 /* 1273 * NFSATTRBIT_WCCATTR1 - bits 32<->63 1274 */ 1275 #define NFSATTRBIT_WCCATTR1 \ 1276 (NFSATTRBM_TIMEMODIFY) 1277 1278 /* 1279 * NFSATTRBIT_WCCATTR2 - bits 64<->95 1280 */ 1281 #define NFSATTRBIT_WCCATTR2 0 1282 1283 /* 1284 * NFSATTRBIT_CBGETATTR0 - bits 0<->31 1285 */ 1286 #define NFSATTRBIT_CBGETATTR0 (NFSATTRBM_CHANGE | NFSATTRBM_SIZE) 1287 1288 /* 1289 * NFSATTRBIT_CBGETATTR1 - bits 32<->63 1290 */ 1291 #define NFSATTRBIT_CBGETATTR1 0x0 1292 1293 /* 1294 * NFSATTRBIT_CBGETATTR2 - bits 64<->95 1295 */ 1296 #define NFSATTRBIT_CBGETATTR2 0x0 1297 1298 /* 1299 * Sets of attributes that require a VFS_STATFS() call to get the 1300 * values of. 1301 * NFSATTRBIT_STATFS0 - bits 0<->31 1302 */ 1303 #define NFSATTRBIT_STATFS0 \ 1304 (NFSATTRBM_LINKSUPPORT | \ 1305 NFSATTRBM_SYMLINKSUPPORT | \ 1306 NFSATTRBM_CANSETTIME | \ 1307 NFSATTRBM_FILESAVAIL | \ 1308 NFSATTRBM_FILESFREE | \ 1309 NFSATTRBM_FILESTOTAL | \ 1310 NFSATTRBM_HOMOGENEOUS | \ 1311 NFSATTRBM_MAXFILESIZE | \ 1312 NFSATTRBM_MAXNAME | \ 1313 NFSATTRBM_MAXREAD | \ 1314 NFSATTRBM_MAXWRITE) 1315 1316 /* 1317 * NFSATTRBIT_STATFS1 - bits 32<->63 1318 */ 1319 #define NFSATTRBIT_STATFS1 \ 1320 (NFSATTRBM_QUOTAHARD | \ 1321 NFSATTRBM_QUOTASOFT | \ 1322 NFSATTRBM_QUOTAUSED | \ 1323 NFSATTRBM_SPACEAVAIL | \ 1324 NFSATTRBM_SPACEFREE | \ 1325 NFSATTRBM_SPACETOTAL | \ 1326 NFSATTRBM_SPACEUSED | \ 1327 NFSATTRBM_TIMEDELTA) 1328 1329 /* 1330 * NFSATTRBIT_STATFS2 - bits 64<->95 1331 */ 1332 #define NFSATTRBIT_STATFS2 0 1333 1334 /* 1335 * These are the bits that are needed by the nfs_statfs() call. 1336 * (The regular getattr bits are or'd in so the vnode gets the correct 1337 * type, etc.) 1338 * NFSGETATTRBIT_STATFS0 - bits 0<->31 1339 */ 1340 #define NFSGETATTRBIT_STATFS0 (NFSATTRBIT_GETATTR0 | \ 1341 NFSATTRBM_LINKSUPPORT | \ 1342 NFSATTRBM_SYMLINKSUPPORT | \ 1343 NFSATTRBM_CANSETTIME | \ 1344 NFSATTRBM_FILESFREE | \ 1345 NFSATTRBM_FILESTOTAL | \ 1346 NFSATTRBM_HOMOGENEOUS | \ 1347 NFSATTRBM_MAXFILESIZE | \ 1348 NFSATTRBM_MAXNAME | \ 1349 NFSATTRBM_MAXREAD | \ 1350 NFSATTRBM_MAXWRITE) 1351 1352 /* 1353 * NFSGETATTRBIT_STATFS1 - bits 32<->63 1354 */ 1355 #define NFSGETATTRBIT_STATFS1 (NFSATTRBIT_GETATTR1 | \ 1356 NFSATTRBM_SPACEAVAIL | \ 1357 NFSATTRBM_SPACEFREE | \ 1358 NFSATTRBM_SPACETOTAL | \ 1359 NFSATTRBM_TIMEDELTA) 1360 1361 /* 1362 * NFSGETATTRBIT_STATFS2 - bits 64<->95 1363 */ 1364 #define NFSGETATTRBIT_STATFS2 0 1365 1366 /* 1367 * Set of attributes for the equivalent of an nfsv3 pathconf rpc. 1368 * NFSGETATTRBIT_PATHCONF0 - bits 0<->31 1369 */ 1370 #define NFSGETATTRBIT_PATHCONF0 (NFSATTRBIT_GETATTR0 | \ 1371 NFSATTRBM_CASEINSENSITIVE | \ 1372 NFSATTRBM_CASEPRESERVING | \ 1373 NFSATTRBM_CHOWNRESTRICTED | \ 1374 NFSATTRBM_MAXLINK | \ 1375 NFSATTRBM_MAXNAME) 1376 1377 /* 1378 * NFSGETATTRBIT_PATHCONF1 - bits 32<->63 1379 */ 1380 #define NFSGETATTRBIT_PATHCONF1 (NFSATTRBIT_GETATTR1 | \ 1381 NFSATTRBM_NOTRUNC) 1382 1383 /* 1384 * NFSGETATTRBIT_PATHCONF2 - bits 64<->95 1385 */ 1386 #define NFSGETATTRBIT_PATHCONF2 0 1387 1388 /* 1389 * Sets of attributes required by readdir and readdirplus. 1390 * NFSATTRBIT_READDIRPLUS0 (NFSATTRBIT_GETATTR0 | NFSATTRBIT_FILEHANDLE | 1391 * NFSATTRBIT_RDATTRERROR) 1392 */ 1393 #define NFSATTRBIT_READDIRPLUS0 (NFSATTRBIT_GETATTR0 | NFSATTRBM_FILEHANDLE | \ 1394 NFSATTRBM_RDATTRERROR) 1395 #define NFSATTRBIT_READDIRPLUS1 NFSATTRBIT_GETATTR1 1396 #define NFSATTRBIT_READDIRPLUS2 0 1397 1398 /* 1399 * Set of attributes supported by Referral vnodes. 1400 */ 1401 #define NFSATTRBIT_REFERRAL0 (NFSATTRBM_TYPE | NFSATTRBM_FSID | \ 1402 NFSATTRBM_RDATTRERROR | NFSATTRBM_FSLOCATIONS) 1403 #define NFSATTRBIT_REFERRAL1 NFSATTRBM_MOUNTEDONFILEID 1404 #define NFSATTRBIT_REFERRAL2 0 1405 1406 /* 1407 * Structure for data handled by the statfs rpc. Since some fields are 1408 * u_int64_t, this cannot be used for copying data on/off the wire, due 1409 * to alignment concerns. 1410 */ 1411 struct nfsstatfs { 1412 union { 1413 struct { 1414 u_int32_t nfsv2sf_tsize; 1415 u_int32_t nfsv2sf_bsize; 1416 u_int32_t nfsv2sf_blocks; 1417 u_int32_t nfsv2sf_bfree; 1418 u_int32_t nfsv2sf_bavail; 1419 } sf_nfsv2; 1420 struct { 1421 u_int64_t nfsv3sf_tbytes; 1422 u_int64_t nfsv3sf_fbytes; 1423 u_int64_t nfsv3sf_abytes; 1424 u_int64_t nfsv3sf_tfiles; 1425 u_int64_t nfsv3sf_ffiles; 1426 u_int64_t nfsv3sf_afiles; 1427 u_int32_t nfsv3sf_invarsec; 1428 } sf_nfsv3; 1429 } sf_un; 1430 }; 1431 1432 #define sf_tsize sf_un.sf_nfsv2.nfsv2sf_tsize 1433 #define sf_bsize sf_un.sf_nfsv2.nfsv2sf_bsize 1434 #define sf_blocks sf_un.sf_nfsv2.nfsv2sf_blocks 1435 #define sf_bfree sf_un.sf_nfsv2.nfsv2sf_bfree 1436 #define sf_bavail sf_un.sf_nfsv2.nfsv2sf_bavail 1437 #define sf_tbytes sf_un.sf_nfsv3.nfsv3sf_tbytes 1438 #define sf_fbytes sf_un.sf_nfsv3.nfsv3sf_fbytes 1439 #define sf_abytes sf_un.sf_nfsv3.nfsv3sf_abytes 1440 #define sf_tfiles sf_un.sf_nfsv3.nfsv3sf_tfiles 1441 #define sf_ffiles sf_un.sf_nfsv3.nfsv3sf_ffiles 1442 #define sf_afiles sf_un.sf_nfsv3.nfsv3sf_afiles 1443 #define sf_invarsec sf_un.sf_nfsv3.nfsv3sf_invarsec 1444 1445 /* 1446 * Now defined using u_int64_t for the 64 bit field(s). 1447 * (Cannot be used to move data on/off the wire, due to alignment concerns.) 1448 */ 1449 struct nfsfsinfo { 1450 u_int32_t fs_rtmax; 1451 u_int32_t fs_rtpref; 1452 u_int32_t fs_rtmult; 1453 u_int32_t fs_wtmax; 1454 u_int32_t fs_wtpref; 1455 u_int32_t fs_wtmult; 1456 u_int32_t fs_dtpref; 1457 u_int64_t fs_maxfilesize; 1458 struct timespec fs_timedelta; 1459 u_int32_t fs_properties; 1460 }; 1461 1462 /* 1463 * Bits for fs_properties 1464 */ 1465 #define NFSV3_FSFLINK 0x1 1466 #define NFSV3_FSFSYMLINK 0x2 1467 #define NFSV3_FSFHOMOGENEOUS 0x4 1468 #define NFSV3_FSFCANSETTIME 0x8 1469 1470 /* 1471 * Yikes, overload fs_rtmult as fs_maxname for V4. 1472 */ 1473 #define fs_maxname fs_rtmult 1474 1475 struct nfsv3_pathconf { 1476 u_int32_t pc_linkmax; 1477 u_int32_t pc_namemax; 1478 u_int32_t pc_notrunc; 1479 u_int32_t pc_chownrestricted; 1480 u_int32_t pc_caseinsensitive; 1481 u_int32_t pc_casepreserving; 1482 }; 1483 1484 /* 1485 * NFS V4 data structures. 1486 */ 1487 struct nfsv4stateid { 1488 u_int32_t seqid; 1489 u_int32_t other[NFSX_STATEIDOTHER / NFSX_UNSIGNED]; 1490 }; 1491 typedef struct nfsv4stateid nfsv4stateid_t; 1492 1493 /* Notify bits and notify bitmap size. */ 1494 #define NFSV4NOTIFY_CHANGE 1 1495 #define NFSV4NOTIFY_DELETE 2 1496 #define NFSV4_NOTIFYBITMAP 1 /* # of 32bit values needed for bits */ 1497 1498 /* Layoutreturn kinds. */ 1499 #define NFSV4LAYOUTRET_FILE 1 1500 #define NFSV4LAYOUTRET_FSID 2 1501 #define NFSV4LAYOUTRET_ALL 3 1502 1503 /* Seek Contents. */ 1504 #define NFSV4CONTENT_DATA 0 1505 #define NFSV4CONTENT_HOLE 1 1506 1507 /* Options for Set Extended attribute (RFC-8276). */ 1508 #define NFSV4SXATTR_EITHER 0 1509 #define NFSV4SXATTR_CREATE 1 1510 #define NFSV4SXATTR_REPLACE 2 1511 1512 #endif /* _NFS_NFSPROTO_H_ */ 1513