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