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