2 * This file was machine generated for [RFC7530].
4 * Last updated Tue Mar 10 11:51:21 PDT 2015.
8 * Copyright (c) 2015 IETF Trust and the persons identified
9 * as authors of the code. All rights reserved.
11 * Redistribution and use in source and binary forms, with
12 * or without modification, are permitted provided that the
13 * following conditions are met:
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the
17 * following disclaimer.
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the
21 * following disclaimer in the documentation and/or other
22 * materials provided with the distribution.
24 * - Neither the name of Internet Society, IETF or IETF
25 * Trust, nor the names of specific contributors, may be
26 * used to endorse or promote products derived from this
27 * software without specific prior written permission.
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
30 * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
31 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
33 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
34 * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
35 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
36 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
37 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
38 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
41 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
42 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
43 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47 * This code was derived from RFC 7531.
56 * Basic typedefs for RFC 1832 data type definitions
59 * typedef int int32_t;
60 * typedef unsigned int uint32_t;
61 * typedef hyper int64_t;
62 * typedef unsigned hyper uint64_t;
68 const NFS4_FHSIZE = 128;
69 const NFS4_VERIFIER_SIZE = 8;
70 const NFS4_OTHER_SIZE = 12;
71 const NFS4_OPAQUE_LIMIT = 1024;
73 const NFS4_INT64_MAX = 0x7fffffffffffffff;
74 const NFS4_UINT64_MAX = 0xffffffffffffffff;
75 const NFS4_INT32_MAX = 0x7fffffff;
76 const NFS4_UINT32_MAX = 0xffffffff;
83 NF4REG = 1, /* Regular File */
84 NF4DIR = 2, /* Directory */
85 NF4BLK = 3, /* Special File - block device */
86 NF4CHR = 4, /* Special File - character device */
87 NF4LNK = 5, /* Symbolic Link */
88 NF4SOCK = 6, /* Special File - socket */
89 NF4FIFO = 7, /* Special File - fifo */
91 = 8, /* Attribute Directory */
93 = 9 /* Named Attribute */
100 NFS4_OK = 0, /* everything is okay */
101 NFS4ERR_PERM = 1, /* caller not privileged */
102 NFS4ERR_NOENT = 2, /* no such file/directory */
103 NFS4ERR_IO = 5, /* hard I/O error */
104 NFS4ERR_NXIO = 6, /* no such device */
105 NFS4ERR_ACCESS = 13, /* access denied */
106 NFS4ERR_EXIST = 17, /* file already exists */
107 NFS4ERR_XDEV = 18, /* different file systems */
108 /* Unused/reserved 19 */
109 NFS4ERR_NOTDIR = 20, /* should be a directory */
110 NFS4ERR_ISDIR = 21, /* should not be directory */
111 NFS4ERR_INVAL = 22, /* invalid argument */
112 NFS4ERR_FBIG = 27, /* file exceeds server max */
113 NFS4ERR_NOSPC = 28, /* no space on file system */
114 NFS4ERR_ROFS = 30, /* read-only file system */
115 NFS4ERR_MLINK = 31, /* too many hard links */
116 NFS4ERR_NAMETOOLONG = 63, /* name exceeds server max */
117 NFS4ERR_NOTEMPTY = 66, /* directory not empty */
118 NFS4ERR_DQUOT = 69, /* hard quota limit reached */
119 NFS4ERR_STALE = 70, /* file no longer exists */
120 NFS4ERR_BADHANDLE = 10001,/* Illegal filehandle */
121 NFS4ERR_BAD_COOKIE = 10003,/* READDIR cookie is stale */
122 NFS4ERR_NOTSUPP = 10004,/* operation not supported */
123 NFS4ERR_TOOSMALL = 10005,/* response limit exceeded */
124 NFS4ERR_SERVERFAULT = 10006,/* undefined server error */
125 NFS4ERR_BADTYPE = 10007,/* type invalid for CREATE */
126 NFS4ERR_DELAY = 10008,/* file "busy" - retry */
127 NFS4ERR_SAME = 10009,/* nverify says attrs same */
128 NFS4ERR_DENIED = 10010,/* lock unavailable */
129 NFS4ERR_EXPIRED = 10011,/* lock lease expired */
130 NFS4ERR_LOCKED = 10012,/* I/O failed due to lock */
131 NFS4ERR_GRACE = 10013,/* in grace period */
132 NFS4ERR_FHEXPIRED = 10014,/* filehandle expired */
133 NFS4ERR_SHARE_DENIED = 10015,/* share reserve denied */
134 NFS4ERR_WRONGSEC = 10016,/* wrong security flavor */
135 NFS4ERR_CLID_INUSE = 10017,/* clientid in use */
136 NFS4ERR_RESOURCE = 10018,/* resource exhaustion */
137 NFS4ERR_MOVED = 10019,/* file system relocated */
138 NFS4ERR_NOFILEHANDLE = 10020,/* current FH is not set */
139 NFS4ERR_MINOR_VERS_MISMATCH = 10021,/* minor vers not supp */
140 NFS4ERR_STALE_CLIENTID = 10022,/* server has rebooted */
141 NFS4ERR_STALE_STATEID = 10023,/* server has rebooted */
142 NFS4ERR_OLD_STATEID = 10024,/* state is out of sync */
143 NFS4ERR_BAD_STATEID = 10025,/* incorrect stateid */
144 NFS4ERR_BAD_SEQID = 10026,/* request is out of seq. */
145 NFS4ERR_NOT_SAME = 10027,/* verify - attrs not same */
146 NFS4ERR_LOCK_RANGE = 10028,/* lock range not supported */
147 NFS4ERR_SYMLINK = 10029,/* should be file/directory */
148 NFS4ERR_RESTOREFH = 10030,/* no saved filehandle */
149 NFS4ERR_LEASE_MOVED = 10031,/* some file system moved */
150 NFS4ERR_ATTRNOTSUPP = 10032,/* recommended attr not sup */
151 NFS4ERR_NO_GRACE = 10033,/* reclaim outside of grace */
152 NFS4ERR_RECLAIM_BAD = 10034,/* reclaim error at server */
153 NFS4ERR_RECLAIM_CONFLICT = 10035,/* conflict on reclaim */
154 NFS4ERR_BADXDR = 10036,/* XDR decode failed */
155 NFS4ERR_LOCKS_HELD = 10037,/* file locks held at CLOSE */
156 NFS4ERR_OPENMODE = 10038,/* conflict in OPEN and I/O */
157 NFS4ERR_BADOWNER = 10039,/* owner translation bad */
158 NFS4ERR_BADCHAR = 10040,/* UTF-8 char not supported */
159 NFS4ERR_BADNAME = 10041,/* name not supported */
160 NFS4ERR_BAD_RANGE = 10042,/* lock range not supported */
161 NFS4ERR_LOCK_NOTSUPP = 10043,/* no atomic up/downgrade */
162 NFS4ERR_OP_ILLEGAL = 10044,/* undefined operation */
163 NFS4ERR_DEADLOCK = 10045,/* file locking deadlock */
164 NFS4ERR_FILE_OPEN = 10046,/* open file blocks op. */
165 NFS4ERR_ADMIN_REVOKED = 10047,/* lock-owner state revoked */
166 NFS4ERR_CB_PATH_DOWN = 10048 /* callback path down */
172 typedef opaque attrlist4<>;
173 typedef uint32_t bitmap4<>;
174 typedef uint64_t changeid4;
175 typedef uint64_t clientid4;
176 typedef uint32_t count4;
177 typedef uint64_t length4;
178 typedef uint32_t mode4;
179 typedef uint64_t nfs_cookie4;
180 typedef opaque nfs_fh4<NFS4_FHSIZE>;
181 typedef uint32_t nfs_lease4;
182 typedef uint64_t offset4;
183 typedef uint32_t qop4;
184 typedef opaque sec_oid4<>;
185 typedef uint32_t seqid4;
186 typedef opaque utf8string<>;
187 typedef utf8string utf8str_cis;
188 typedef utf8string utf8str_cs;
189 typedef utf8string utf8str_mixed;
190 typedef utf8str_cs component4;
191 typedef opaque linktext4<>;
192 typedef utf8string ascii_REQUIRED4;
193 typedef component4 pathname4<>;
194 typedef uint64_t nfs_lockid4;
195 typedef opaque verifier4[NFS4_VERIFIER_SIZE];
207 SET_TO_SERVER_TIME4 = 0,
208 SET_TO_CLIENT_TIME4 = 1
211 union settime4 switch (time_how4 set_it) {
212 case SET_TO_CLIENT_TIME4:
220 * File attribute definitions
224 * FSID structure for major/minor
233 * File system locations attribute for relocation/migration
235 struct fs_location4 {
236 utf8str_cis server<>;
240 struct fs_locations4 {
242 fs_location4 locations<>;
247 * Various Access Control Entry definitions
251 * Mask that indicates which Access Control Entries
252 * are supported. Values for the fattr4_aclsupport attribute.
254 const ACL4_SUPPORT_ALLOW_ACL = 0x00000001;
255 const ACL4_SUPPORT_DENY_ACL = 0x00000002;
256 const ACL4_SUPPORT_AUDIT_ACL = 0x00000004;
257 const ACL4_SUPPORT_ALARM_ACL = 0x00000008;
260 typedef uint32_t acetype4;
264 * acetype4 values; others can be added as needed.
266 const ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000;
267 const ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001;
268 const ACE4_SYSTEM_AUDIT_ACE_TYPE = 0x00000002;
269 const ACE4_SYSTEM_ALARM_ACE_TYPE = 0x00000003;
276 typedef uint32_t aceflag4;
282 const ACE4_FILE_INHERIT_ACE = 0x00000001;
283 const ACE4_DIRECTORY_INHERIT_ACE = 0x00000002;
284 const ACE4_NO_PROPAGATE_INHERIT_ACE = 0x00000004;
285 const ACE4_INHERIT_ONLY_ACE = 0x00000008;
286 const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG = 0x00000010;
287 const ACE4_FAILED_ACCESS_ACE_FLAG = 0x00000020;
288 const ACE4_IDENTIFIER_GROUP = 0x00000040;
295 typedef uint32_t acemask4;
301 const ACE4_READ_DATA = 0x00000001;
302 const ACE4_LIST_DIRECTORY = 0x00000001;
303 const ACE4_WRITE_DATA = 0x00000002;
304 const ACE4_ADD_FILE = 0x00000002;
305 const ACE4_APPEND_DATA = 0x00000004;
306 const ACE4_ADD_SUBDIRECTORY = 0x00000004;
307 const ACE4_READ_NAMED_ATTRS = 0x00000008;
308 const ACE4_WRITE_NAMED_ATTRS = 0x00000010;
309 const ACE4_EXECUTE = 0x00000020;
310 const ACE4_DELETE_CHILD = 0x00000040;
311 const ACE4_READ_ATTRIBUTES = 0x00000080;
312 const ACE4_WRITE_ATTRIBUTES = 0x00000100;
314 const ACE4_DELETE = 0x00010000;
315 const ACE4_READ_ACL = 0x00020000;
316 const ACE4_WRITE_ACL = 0x00040000;
317 const ACE4_WRITE_OWNER = 0x00080000;
318 const ACE4_SYNCHRONIZE = 0x00100000;
322 * ACE4_GENERIC_READ - defined as a combination of
325 * ACE4_READ_ATTRIBUTES |
329 const ACE4_GENERIC_READ = 0x00120081;
332 * ACE4_GENERIC_WRITE - defined as a combination of
335 * ACE4_WRITE_ATTRIBUTES |
340 const ACE4_GENERIC_WRITE = 0x00160106;
344 * ACE4_GENERIC_EXECUTE - defined as a combination of
346 * ACE4_READ_ATTRIBUTES
350 const ACE4_GENERIC_EXECUTE = 0x001200A0;
354 * Access Control Entry definition
359 acemask4 access_mask;
365 * Field definitions for the fattr4_mode attribute
367 const MODE4_SUID = 0x800; /* set user id on execution */
368 const MODE4_SGID = 0x400; /* set group id on execution */
369 const MODE4_SVTX = 0x200; /* save text even after use */
370 const MODE4_RUSR = 0x100; /* read permission: owner */
371 const MODE4_WUSR = 0x080; /* write permission: owner */
372 const MODE4_XUSR = 0x040; /* execute permission: owner */
373 const MODE4_RGRP = 0x020; /* read permission: group */
374 const MODE4_WGRP = 0x010; /* write permission: group */
375 const MODE4_XGRP = 0x008; /* execute permission: group */
376 const MODE4_ROTH = 0x004; /* read permission: other */
377 const MODE4_WOTH = 0x002; /* write permission: other */
378 const MODE4_XOTH = 0x001; /* execute permission: other */
382 * Special data/attribute associated with
383 * file types NF4BLK and NF4CHR.
386 uint32_t specdata1; /* major device number */
387 uint32_t specdata2; /* minor device number */
392 * Values for fattr4_fh_expire_type
394 const FH4_PERSISTENT = 0x00000000;
395 const FH4_NOEXPIRE_WITH_OPEN = 0x00000001;
396 const FH4_VOLATILE_ANY = 0x00000002;
397 const FH4_VOL_MIGRATION = 0x00000004;
398 const FH4_VOL_RENAME = 0x00000008;
401 typedef bitmap4 fattr4_supported_attrs;
402 typedef nfs_ftype4 fattr4_type;
403 typedef uint32_t fattr4_fh_expire_type;
404 typedef changeid4 fattr4_change;
405 typedef uint64_t fattr4_size;
406 typedef bool fattr4_link_support;
407 typedef bool fattr4_symlink_support;
408 typedef bool fattr4_named_attr;
409 typedef fsid4 fattr4_fsid;
410 typedef bool fattr4_unique_handles;
411 typedef nfs_lease4 fattr4_lease_time;
412 typedef nfsstat4 fattr4_rdattr_error;
414 typedef nfsace4 fattr4_acl<>;
415 typedef uint32_t fattr4_aclsupport;
416 typedef bool fattr4_archive;
417 typedef bool fattr4_cansettime;
418 typedef bool fattr4_case_insensitive;
419 typedef bool fattr4_case_preserving;
420 typedef bool fattr4_chown_restricted;
421 typedef uint64_t fattr4_fileid;
422 typedef uint64_t fattr4_files_avail;
423 typedef nfs_fh4 fattr4_filehandle;
424 typedef uint64_t fattr4_files_free;
425 typedef uint64_t fattr4_files_total;
426 typedef fs_locations4 fattr4_fs_locations;
427 typedef bool fattr4_hidden;
428 typedef bool fattr4_homogeneous;
429 typedef uint64_t fattr4_maxfilesize;
430 typedef uint32_t fattr4_maxlink;
431 typedef uint32_t fattr4_maxname;
432 typedef uint64_t fattr4_maxread;
433 typedef uint64_t fattr4_maxwrite;
434 typedef ascii_REQUIRED4 fattr4_mimetype;
435 typedef mode4 fattr4_mode;
436 typedef uint64_t fattr4_mounted_on_fileid;
437 typedef bool fattr4_no_trunc;
438 typedef uint32_t fattr4_numlinks;
439 typedef utf8str_mixed fattr4_owner;
440 typedef utf8str_mixed fattr4_owner_group;
441 typedef uint64_t fattr4_quota_avail_hard;
442 typedef uint64_t fattr4_quota_avail_soft;
443 typedef uint64_t fattr4_quota_used;
444 typedef specdata4 fattr4_rawdev;
445 typedef uint64_t fattr4_space_avail;
446 typedef uint64_t fattr4_space_free;
447 typedef uint64_t fattr4_space_total;
448 typedef uint64_t fattr4_space_used;
449 typedef bool fattr4_system;
450 typedef nfstime4 fattr4_time_access;
451 typedef settime4 fattr4_time_access_set;
452 typedef nfstime4 fattr4_time_backup;
453 typedef nfstime4 fattr4_time_create;
454 typedef nfstime4 fattr4_time_delta;
455 typedef nfstime4 fattr4_time_metadata;
456 typedef nfstime4 fattr4_time_modify;
457 typedef settime4 fattr4_time_modify_set;
461 * Mandatory attributes
463 const FATTR4_SUPPORTED_ATTRS = 0;
464 const FATTR4_TYPE = 1;
465 const FATTR4_FH_EXPIRE_TYPE = 2;
466 const FATTR4_CHANGE = 3;
467 const FATTR4_SIZE = 4;
468 const FATTR4_LINK_SUPPORT = 5;
469 const FATTR4_SYMLINK_SUPPORT = 6;
470 const FATTR4_NAMED_ATTR = 7;
471 const FATTR4_FSID = 8;
472 const FATTR4_UNIQUE_HANDLES = 9;
473 const FATTR4_LEASE_TIME = 10;
474 const FATTR4_RDATTR_ERROR = 11;
475 const FATTR4_FILEHANDLE = 19;
478 * Recommended attributes
480 const FATTR4_ACL = 12;
481 const FATTR4_ACLSUPPORT = 13;
482 const FATTR4_ARCHIVE = 14;
483 const FATTR4_CANSETTIME = 15;
484 const FATTR4_CASE_INSENSITIVE = 16;
485 const FATTR4_CASE_PRESERVING = 17;
486 const FATTR4_CHOWN_RESTRICTED = 18;
487 const FATTR4_FILEID = 20;
488 const FATTR4_FILES_AVAIL = 21;
489 const FATTR4_FILES_FREE = 22;
490 const FATTR4_FILES_TOTAL = 23;
491 const FATTR4_FS_LOCATIONS = 24;
492 const FATTR4_HIDDEN = 25;
493 const FATTR4_HOMOGENEOUS = 26;
494 const FATTR4_MAXFILESIZE = 27;
495 const FATTR4_MAXLINK = 28;
496 const FATTR4_MAXNAME = 29;
497 const FATTR4_MAXREAD = 30;
498 const FATTR4_MAXWRITE = 31;
499 const FATTR4_MIMETYPE = 32;
500 const FATTR4_MODE = 33;
501 const FATTR4_NO_TRUNC = 34;
502 const FATTR4_NUMLINKS = 35;
503 const FATTR4_OWNER = 36;
504 const FATTR4_OWNER_GROUP = 37;
505 const FATTR4_QUOTA_AVAIL_HARD = 38;
506 const FATTR4_QUOTA_AVAIL_SOFT = 39;
507 const FATTR4_QUOTA_USED = 40;
508 const FATTR4_RAWDEV = 41;
509 const FATTR4_SPACE_AVAIL = 42;
510 const FATTR4_SPACE_FREE = 43;
511 const FATTR4_SPACE_TOTAL = 44;
512 const FATTR4_SPACE_USED = 45;
513 const FATTR4_SYSTEM = 46;
514 const FATTR4_TIME_ACCESS = 47;
515 const FATTR4_TIME_ACCESS_SET = 48;
516 const FATTR4_TIME_BACKUP = 49;
517 const FATTR4_TIME_CREATE = 50;
518 const FATTR4_TIME_DELTA = 51;
519 const FATTR4_TIME_METADATA = 52;
520 const FATTR4_TIME_MODIFY = 53;
521 const FATTR4_TIME_MODIFY_SET = 54;
522 const FATTR4_MOUNTED_ON_FILEID = 55;
525 * File attribute container
534 * Change info for the client
536 struct change_info4 {
544 /* see struct rpcb in RFC 1833 */
545 string r_netid<>; /* network id */
546 string r_addr<>; /* universal address */
551 * Callback program info as provided by the client
554 unsigned int cb_program;
555 clientaddr4 cb_location;
564 opaque other[NFS4_OTHER_SIZE];
570 struct nfs_client_id4 {
572 opaque id<NFS4_OPAQUE_LIMIT>;
578 opaque owner<NFS4_OPAQUE_LIMIT>;
584 opaque owner<NFS4_OPAQUE_LIMIT>;
588 enum nfs_lock_type4 {
591 READW_LT = 3, /* blocking read */
592 WRITEW_LT = 4 /* blocking write */
596 const ACCESS4_READ = 0x00000001;
597 const ACCESS4_LOOKUP = 0x00000002;
598 const ACCESS4_MODIFY = 0x00000004;
599 const ACCESS4_EXTEND = 0x00000008;
600 const ACCESS4_DELETE = 0x00000010;
601 const ACCESS4_EXECUTE = 0x00000020;
604 /* CURRENT_FH: object */
608 struct ACCESS4resok {
613 union ACCESS4res switch (nfsstat4 status) {
621 /* CURRENT_FH: object */
623 stateid4 open_stateid;
626 union CLOSE4res switch (nfsstat4 status) {
628 stateid4 open_stateid;
634 /* CURRENT_FH: file */
639 struct COMMIT4resok {
643 union COMMIT4res switch (nfsstat4 status) {
650 union createtype4 switch (nfs_ftype4 type) {
661 void; /* server should return NFS4ERR_BADTYPE */
665 /* CURRENT_FH: directory for creation */
671 struct CREATE4resok {
673 bitmap4 attrset; /* attributes set */
676 union CREATE4res switch (nfsstat4 status) {
683 struct DELEGPURGE4args {
687 struct DELEGPURGE4res {
691 struct DELEGRETURN4args {
692 /* CURRENT_FH: delegated file */
693 stateid4 deleg_stateid;
696 struct DELEGRETURN4res {
700 struct GETATTR4args {
701 /* CURRENT_FH: directory or file */
702 bitmap4 attr_request;
705 struct GETATTR4resok {
706 fattr4 obj_attributes;
709 union GETATTR4res switch (nfsstat4 status) {
711 GETATTR4resok resok4;
720 union GETFH4res switch (nfsstat4 status) {
728 /* SAVED_FH: source object */
729 /* CURRENT_FH: target directory */
737 union LINK4res switch (nfsstat4 status) {
745 * For LOCK, transition from open_owner to new lock_owner
747 struct open_to_lock_owner4 {
749 stateid4 open_stateid;
751 lock_owner4 lock_owner;
755 * For LOCK, existing lock_owner continues to request file locks
757 struct exist_lock_owner4 {
758 stateid4 lock_stateid;
762 union locker4 switch (bool new_lock_owner) {
764 open_to_lock_owner4 open_owner;
766 exist_lock_owner4 lock_owner;
770 * LOCK/LOCKT/LOCKU: Record lock management
773 /* CURRENT_FH: file */
774 nfs_lock_type4 locktype;
784 nfs_lock_type4 locktype;
789 stateid4 lock_stateid;
792 union LOCK4res switch (nfsstat4 status) {
802 /* CURRENT_FH: file */
803 nfs_lock_type4 locktype;
809 union LOCKT4res switch (nfsstat4 status) {
819 /* CURRENT_FH: file */
820 nfs_lock_type4 locktype;
822 stateid4 lock_stateid;
827 union LOCKU4res switch (nfsstat4 status) {
829 stateid4 lock_stateid;
835 /* CURRENT_FH: directory */
840 /* CURRENT_FH: object */
845 /* CURRENT_FH: directory */
849 struct NVERIFY4args {
850 /* CURRENT_FH: object */
851 fattr4 obj_attributes;
858 const OPEN4_SHARE_ACCESS_READ = 0x00000001;
859 const OPEN4_SHARE_ACCESS_WRITE = 0x00000002;
860 const OPEN4_SHARE_ACCESS_BOTH = 0x00000003;
862 const OPEN4_SHARE_DENY_NONE = 0x00000000;
863 const OPEN4_SHARE_DENY_READ = 0x00000001;
864 const OPEN4_SHARE_DENY_WRITE = 0x00000002;
865 const OPEN4_SHARE_DENY_BOTH = 0x00000003;
867 * Various definitions for OPEN
875 union createhow4 switch (createmode4 mode) {
880 verifier4 createverf;
888 union openflag4 switch (opentype4 opentype) {
895 /* Next definitions used for OPEN delegation */
899 /* others as needed */
902 struct nfs_modified_limit4 {
904 uint32_t bytes_per_block;
907 union nfs_space_limit4 switch (limit_by4 limitby) {
908 /* limit specified as file size */
911 /* limit specified by number of blocks */
912 case NFS_LIMIT_BLOCKS:
913 nfs_modified_limit4 mod_blocks;
916 enum open_delegation_type4 {
917 OPEN_DELEGATE_NONE = 0,
918 OPEN_DELEGATE_READ = 1,
919 OPEN_DELEGATE_WRITE = 2
922 enum open_claim_type4 {
925 CLAIM_DELEGATE_CUR = 2,
926 CLAIM_DELEGATE_PREV = 3
929 struct open_claim_delegate_cur4 {
930 stateid4 delegate_stateid;
934 union open_claim4 switch (open_claim_type4 claim) {
936 * No special rights to file.
937 * Ordinary OPEN of the specified file.
940 /* CURRENT_FH: directory */
943 * Right to the file established by an
944 * open previous to server reboot. File
945 * identified by filehandle obtained at
946 * that time rather than by name.
949 /* CURRENT_FH: file being reclaimed */
950 open_delegation_type4 delegate_type;
953 * Right to file based on a delegation
954 * granted by the server. File is
957 case CLAIM_DELEGATE_CUR:
958 /* CURRENT_FH: directory */
959 open_claim_delegate_cur4 delegate_cur_info;
962 * Right to file based on a delegation
963 * granted to a previous boot instance
964 * of the client. File is specified by name.
966 case CLAIM_DELEGATE_PREV:
967 /* CURRENT_FH: directory */
968 component4 file_delegate_prev;
972 * OPEN: Open a file, potentially receiving an open delegation
976 uint32_t share_access;
983 struct open_read_delegation4 {
984 stateid4 stateid; /* Stateid for delegation */
985 bool recall; /* Pre-recalled flag for
987 by reclaim (CLAIM_PREVIOUS). */
989 nfsace4 permissions; /* Defines users who don't
990 need an ACCESS call to
994 struct open_write_delegation4 {
995 stateid4 stateid; /* Stateid for delegation */
996 bool recall; /* Pre-recalled flag for
1002 space_limit; /* Defines condition that
1003 the client must check to
1004 determine whether the
1005 file needs to be flushed
1006 to the server on close. */
1008 nfsace4 permissions; /* Defines users who don't
1009 need an ACCESS call as
1014 union open_delegation4
1015 switch (open_delegation_type4 delegation_type) {
1016 case OPEN_DELEGATE_NONE:
1018 case OPEN_DELEGATE_READ:
1019 open_read_delegation4 read;
1020 case OPEN_DELEGATE_WRITE:
1021 open_write_delegation4 write;
1028 /* Client must confirm open */
1029 const OPEN4_RESULT_CONFIRM = 0x00000002;
1030 /* Type of file locking behavior at the server */
1031 const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004;
1034 stateid4 stateid; /* Stateid for open */
1035 change_info4 cinfo; /* Directory change info */
1036 uint32_t rflags; /* Result flags */
1037 bitmap4 attrset; /* attribute set for create */
1038 open_delegation4 delegation; /* Info on any open
1042 union OPEN4res switch (nfsstat4 status) {
1044 /* CURRENT_FH: opened file */
1050 struct OPENATTR4args {
1051 /* CURRENT_FH: object */
1055 struct OPENATTR4res {
1056 /* CURRENT_FH: named attr directory */
1060 struct OPEN_CONFIRM4args {
1061 /* CURRENT_FH: opened file */
1062 stateid4 open_stateid;
1066 struct OPEN_CONFIRM4resok {
1067 stateid4 open_stateid;
1070 union OPEN_CONFIRM4res switch (nfsstat4 status) {
1072 OPEN_CONFIRM4resok resok4;
1077 struct OPEN_DOWNGRADE4args {
1078 /* CURRENT_FH: opened file */
1079 stateid4 open_stateid;
1081 uint32_t share_access;
1082 uint32_t share_deny;
1085 struct OPEN_DOWNGRADE4resok {
1086 stateid4 open_stateid;
1089 union OPEN_DOWNGRADE4res switch (nfsstat4 status) {
1091 OPEN_DOWNGRADE4resok resok4;
1105 struct PUTPUBFH4res {
1106 /* CURRENT_FH: public fh */
1110 struct PUTROOTFH4res {
1111 /* CURRENT_FH: root fh */
1116 /* CURRENT_FH: file */
1127 union READ4res switch (nfsstat4 status) {
1134 struct READDIR4args {
1135 /* CURRENT_FH: directory */
1137 verifier4 cookieverf;
1140 bitmap4 attr_request;
1155 struct READDIR4resok {
1156 verifier4 cookieverf;
1161 union READDIR4res switch (nfsstat4 status) {
1163 READDIR4resok resok4;
1169 struct READLINK4resok {
1173 union READLINK4res switch (nfsstat4 status) {
1175 READLINK4resok resok4;
1180 struct REMOVE4args {
1181 /* CURRENT_FH: directory */
1185 struct REMOVE4resok {
1189 union REMOVE4res switch (nfsstat4 status) {
1191 REMOVE4resok resok4;
1196 struct RENAME4args {
1197 /* SAVED_FH: source directory */
1199 /* CURRENT_FH: target directory */
1203 struct RENAME4resok {
1204 change_info4 source_cinfo;
1205 change_info4 target_cinfo;
1208 union RENAME4res switch (nfsstat4 status) {
1210 RENAME4resok resok4;
1223 struct RESTOREFH4res {
1224 /* CURRENT_FH: value of saved fh */
1229 /* SAVED_FH: value of current fh */
1233 struct SECINFO4args {
1234 /* CURRENT_FH: directory */
1241 enum rpc_gss_svc_t {
1242 RPC_GSS_SVC_NONE = 1,
1243 RPC_GSS_SVC_INTEGRITY = 2,
1244 RPC_GSS_SVC_PRIVACY = 3
1247 struct rpcsec_gss_info {
1250 rpc_gss_svc_t service;
1253 /* RPCSEC_GSS has a value of '6'. See RFC 2203 */
1254 union secinfo4 switch (uint32_t flavor) {
1256 rpcsec_gss_info flavor_info;
1261 typedef secinfo4 SECINFO4resok<>;
1263 union SECINFO4res switch (nfsstat4 status) {
1265 SECINFO4resok resok4;
1270 struct SETATTR4args {
1271 /* CURRENT_FH: target object */
1273 fattr4 obj_attributes;
1276 struct SETATTR4res {
1281 struct SETCLIENTID4args {
1282 nfs_client_id4 client;
1283 cb_client4 callback;
1284 uint32_t callback_ident;
1287 struct SETCLIENTID4resok {
1289 verifier4 setclientid_confirm;
1292 union SETCLIENTID4res switch (nfsstat4 status) {
1294 SETCLIENTID4resok resok4;
1295 case NFS4ERR_CLID_INUSE:
1296 clientaddr4 client_using;
1301 struct SETCLIENTID_CONFIRM4args {
1303 verifier4 setclientid_confirm;
1306 struct SETCLIENTID_CONFIRM4res {
1310 struct VERIFY4args {
1311 /* CURRENT_FH: object */
1312 fattr4 obj_attributes;
1326 /* CURRENT_FH: file */
1333 struct WRITE4resok {
1335 stable_how4 committed;
1336 verifier4 writeverf;
1339 union WRITE4res switch (nfsstat4 status) {
1346 struct RELEASE_LOCKOWNER4args {
1347 lock_owner4 lock_owner;
1350 struct RELEASE_LOCKOWNER4res {
1354 struct ILLEGAL4res {
1380 OP_OPEN_CONFIRM = 20,
1381 OP_OPEN_DOWNGRADE = 21,
1395 OP_SETCLIENTID = 35,
1396 OP_SETCLIENTID_CONFIRM = 36,
1399 OP_RELEASE_LOCKOWNER = 39,
1403 union nfs_argop4 switch (nfs_opnum4 argop) {
1404 case OP_ACCESS: ACCESS4args opaccess;
1405 case OP_CLOSE: CLOSE4args opclose;
1406 case OP_COMMIT: COMMIT4args opcommit;
1407 case OP_CREATE: CREATE4args opcreate;
1408 case OP_DELEGPURGE: DELEGPURGE4args opdelegpurge;
1409 case OP_DELEGRETURN: DELEGRETURN4args opdelegreturn;
1410 case OP_GETATTR: GETATTR4args opgetattr;
1411 case OP_GETFH: void;
1412 case OP_LINK: LINK4args oplink;
1413 case OP_LOCK: LOCK4args oplock;
1414 case OP_LOCKT: LOCKT4args oplockt;
1415 case OP_LOCKU: LOCKU4args oplocku;
1416 case OP_LOOKUP: LOOKUP4args oplookup;
1417 case OP_LOOKUPP: void;
1418 case OP_NVERIFY: NVERIFY4args opnverify;
1419 case OP_OPEN: OPEN4args opopen;
1420 case OP_OPENATTR: OPENATTR4args opopenattr;
1421 case OP_OPEN_CONFIRM: OPEN_CONFIRM4args opopen_confirm;
1422 case OP_OPEN_DOWNGRADE:
1423 OPEN_DOWNGRADE4args opopen_downgrade;
1424 case OP_PUTFH: PUTFH4args opputfh;
1425 case OP_PUTPUBFH: void;
1426 case OP_PUTROOTFH: void;
1427 case OP_READ: READ4args opread;
1428 case OP_READDIR: READDIR4args opreaddir;
1429 case OP_READLINK: void;
1430 case OP_REMOVE: REMOVE4args opremove;
1431 case OP_RENAME: RENAME4args oprename;
1432 case OP_RENEW: RENEW4args oprenew;
1433 case OP_RESTOREFH: void;
1434 case OP_SAVEFH: void;
1435 case OP_SECINFO: SECINFO4args opsecinfo;
1436 case OP_SETATTR: SETATTR4args opsetattr;
1437 case OP_SETCLIENTID: SETCLIENTID4args opsetclientid;
1438 case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4args
1439 opsetclientid_confirm;
1440 case OP_VERIFY: VERIFY4args opverify;
1441 case OP_WRITE: WRITE4args opwrite;
1442 case OP_RELEASE_LOCKOWNER:
1443 RELEASE_LOCKOWNER4args
1444 oprelease_lockowner;
1445 case OP_ILLEGAL: void;
1448 union nfs_resop4 switch (nfs_opnum4 resop) {
1449 case OP_ACCESS: ACCESS4res opaccess;
1450 case OP_CLOSE: CLOSE4res opclose;
1451 case OP_COMMIT: COMMIT4res opcommit;
1452 case OP_CREATE: CREATE4res opcreate;
1453 case OP_DELEGPURGE: DELEGPURGE4res opdelegpurge;
1454 case OP_DELEGRETURN: DELEGRETURN4res opdelegreturn;
1455 case OP_GETATTR: GETATTR4res opgetattr;
1456 case OP_GETFH: GETFH4res opgetfh;
1457 case OP_LINK: LINK4res oplink;
1458 case OP_LOCK: LOCK4res oplock;
1459 case OP_LOCKT: LOCKT4res oplockt;
1460 case OP_LOCKU: LOCKU4res oplocku;
1461 case OP_LOOKUP: LOOKUP4res oplookup;
1462 case OP_LOOKUPP: LOOKUPP4res oplookupp;
1463 case OP_NVERIFY: NVERIFY4res opnverify;
1464 case OP_OPEN: OPEN4res opopen;
1465 case OP_OPENATTR: OPENATTR4res opopenattr;
1466 case OP_OPEN_CONFIRM: OPEN_CONFIRM4res opopen_confirm;
1467 case OP_OPEN_DOWNGRADE:
1470 case OP_PUTFH: PUTFH4res opputfh;
1471 case OP_PUTPUBFH: PUTPUBFH4res opputpubfh;
1472 case OP_PUTROOTFH: PUTROOTFH4res opputrootfh;
1473 case OP_READ: READ4res opread;
1474 case OP_READDIR: READDIR4res opreaddir;
1475 case OP_READLINK: READLINK4res opreadlink;
1476 case OP_REMOVE: REMOVE4res opremove;
1477 case OP_RENAME: RENAME4res oprename;
1478 case OP_RENEW: RENEW4res oprenew;
1479 case OP_RESTOREFH: RESTOREFH4res oprestorefh;
1480 case OP_SAVEFH: SAVEFH4res opsavefh;
1481 case OP_SECINFO: SECINFO4res opsecinfo;
1482 case OP_SETATTR: SETATTR4res opsetattr;
1483 case OP_SETCLIENTID: SETCLIENTID4res opsetclientid;
1484 case OP_SETCLIENTID_CONFIRM:
1485 SETCLIENTID_CONFIRM4res
1486 opsetclientid_confirm;
1487 case OP_VERIFY: VERIFY4res opverify;
1488 case OP_WRITE: WRITE4res opwrite;
1489 case OP_RELEASE_LOCKOWNER:
1490 RELEASE_LOCKOWNER4res
1491 oprelease_lockowner;
1492 case OP_ILLEGAL: ILLEGAL4res opillegal;
1495 struct COMPOUND4args {
1497 uint32_t minorversion;
1498 nfs_argop4 argarray<>;
1501 struct COMPOUND4res {
1504 nfs_resop4 resarray<>;
1509 * Remote file service routines
1511 program NFS4_PROGRAM {
1514 NFSPROC4_NULL(void) = 0;
1517 NFSPROC4_COMPOUND(COMPOUND4args) = 1;
1523 * NFS4 callback procedure definitions and program
1525 struct CB_GETATTR4args {
1527 bitmap4 attr_request;
1530 struct CB_GETATTR4resok {
1531 fattr4 obj_attributes;
1534 union CB_GETATTR4res switch (nfsstat4 status) {
1536 CB_GETATTR4resok resok4;
1541 struct CB_RECALL4args {
1547 struct CB_RECALL4res {
1552 * CB_ILLEGAL: Response for illegal operation numbers
1554 struct CB_ILLEGAL4res {
1559 * Various definitions for CB_COMPOUND
1561 enum nfs_cb_opnum4 {
1564 OP_CB_ILLEGAL = 10044
1567 union nfs_cb_argop4 switch (unsigned argop) {
1568 case OP_CB_GETATTR: CB_GETATTR4args opcbgetattr;
1569 case OP_CB_RECALL: CB_RECALL4args opcbrecall;
1570 case OP_CB_ILLEGAL: void;
1573 union nfs_cb_resop4 switch (unsigned resop) {
1574 case OP_CB_GETATTR: CB_GETATTR4res opcbgetattr;
1575 case OP_CB_RECALL: CB_RECALL4res opcbrecall;
1576 case OP_CB_ILLEGAL: CB_ILLEGAL4res opcbillegal;
1580 struct CB_COMPOUND4args {
1582 uint32_t minorversion;
1583 uint32_t callback_ident;
1584 nfs_cb_argop4 argarray<>;
1587 struct CB_COMPOUND4res {
1590 nfs_cb_resop4 resarray<>;
1596 * Program number is in the transient range, since the client
1597 * will assign the exact transient program number and provide
1598 * that to the server via the SETCLIENTID operation.
1600 program NFS4_CALLBACK {
1605 CB_COMPOUND(CB_COMPOUND4args) = 1;