Home | History | Annotate | Download | only in rpcsvc
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 /*
     22  * Copyright (c) 2008 IETF Trust and the persons identified
     23  * as the document authors. All rights reserved.
     24  *
     25  * The document authors are identified in [RFC3530] and
     26  * [draft-ietf-nfsv4-minorversion1-xx.txt].
     27  *
     28  * Redistribution and use in source and binary forms, with
     29  * or without modification, are permitted provided that the
     30  * following conditions are met:
     31  *
     32  * o Redistributions of source code must retain the above
     33  *   copyright notice, this list of conditions and the
     34  *   following disclaimer.
     35  *
     36  * o Redistributions in binary form must reproduce the above
     37  *   copyright notice, this list of conditions and the
     38  *   following disclaimer in the documentation and/or other
     39  *   materials provided with the distribution.
     40  *
     41  * o Neither the name of Internet Society, IETF or IETF
     42  *   Trust, nor the names of specific contributors, may be
     43  *   used to endorse or promote products derived from this
     44  *   software without specific prior written permission.
     45  *
     46  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
     47  *   AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
     48  *   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     49  *   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     50  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
     51  *   EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     52  *   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     53  *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     54  *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     55  *   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     56  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     57  *   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     58  *   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     59  *   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     60  *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     61  */
     62 /*
     63  * This code was derived from [RFC3530]. Please
     64  * reproduce this note if possible.
     65  *
     66  * This file was machine generated for
     67  *  draft-ietf-nfsv4-minorversion1-29
     68  * Last updated Mon Dec 15 11:26:38 PST 2008
     69  */
     70 /*
     71  *      nfs4_prot.x
     72  */
     73 
     74 %#ifndef _AUTH_SYS_DEFINE_FOR_NFSv41
     75 %#define _AUTH_SYS_DEFINE_FOR_NFSv41
     76 %#include <rpc/auth_sys.h>
     77 %typedef struct authsys_parms authsys_parms;
     78 %#endif _AUTH_SYS_DEFINE_FOR_NFSv41
     79 
     80 /*
     81  * Basic typedefs for RFC 1832 data type definitions
     82  */
     83 
     84 /*
     85  * typedef int                  int32_t;
     86  * typedef unsigned int         uint32_t;
     87  * typedef hyper                int64_t;
     88  * typedef unsigned hyper       uint64_t;
     89  */
     90 
     91 /*
     92  * Sizes
     93  */
     94 const NFS4_FHSIZE               = 128;
     95 const NFS4_VERIFIER_SIZE        = 8;
     96 const NFS4_OPAQUE_LIMIT         = 1024;
     97 const NFS4_SESSIONID_SIZE       = 16;
     98 
     99 const NFS4_INT64_MAX            = 0x7fffffffffffffff;
    100 const NFS4_UINT64_MAX           = 0xffffffffffffffff;
    101 const NFS4_INT32_MAX            = 0x7fffffff;
    102 const NFS4_UINT32_MAX           = 0xffffffff;
    103 
    104 const NFS4_MAXFILELEN           = 0xffffffffffffffff;
    105 const NFS4_MAXFILEOFF           = 0xfffffffffffffffe;
    106 
    107 
    108 /*
    109  * File types
    110  */
    111 enum nfs_ftype4 {
    112         NF4REG  = 1,    /* Regular File */
    113         NF4DIR  = 2,    /* Directory */
    114         NF4BLK  = 3,    /* Special File - block device */
    115         NF4CHR  = 4,    /* Special File - character device */
    116         NF4LNK  = 5,    /* Symbolic Link */
    117         NF4SOCK = 6,    /* Special File - socket */
    118         NF4FIFO = 7,    /* Special File - fifo */
    119         NF4ATTRDIR
    120                 = 8,    /* Attribute Directory */
    121         NF4NAMEDATTR
    122                 = 9     /* Named Attribute */
    123 };
    124 
    125 /*
    126  * Error status
    127  */
    128 enum nfsstat4 {
    129  NFS4_OK                = 0,    /* everything is okay      */
    130  NFS4ERR_PERM           = 1,    /* caller not privileged   */
    131  NFS4ERR_NOENT          = 2,    /* no such file/directory  */
    132  NFS4ERR_IO             = 5,    /* hard I/O error          */
    133  NFS4ERR_NXIO           = 6,    /* no such device          */
    134  NFS4ERR_ACCESS         = 13,   /* access denied           */
    135  NFS4ERR_EXIST          = 17,   /* file already exists     */
    136  NFS4ERR_XDEV           = 18,   /* different filesystems   */
    137 
    138  /*
    139   * Please do not allocate value 19; it was used in NFSv3
    140   * and we do not want a value in NFSv3 to have a different
    141   * meaning in NFSv4.x.
    142   */
    143 
    144  NFS4ERR_NOTDIR         = 20,   /* should be a directory   */
    145  NFS4ERR_ISDIR          = 21,   /* should not be directory */
    146  NFS4ERR_INVAL          = 22,   /* invalid argument        */
    147  NFS4ERR_FBIG           = 27,   /* file exceeds server max */
    148  NFS4ERR_NOSPC          = 28,   /* no space on filesystem  */
    149  NFS4ERR_ROFS           = 30,   /* read-only filesystem    */
    150  NFS4ERR_MLINK          = 31,   /* too many hard links     */
    151  NFS4ERR_NAMETOOLONG    = 63,   /* name exceeds server max */
    152  NFS4ERR_NOTEMPTY       = 66,   /* directory not empty     */
    153  NFS4ERR_DQUOT          = 69,   /* hard quota limit reached*/
    154  NFS4ERR_STALE          = 70,   /* file no longer exists   */
    155  NFS4ERR_BADHANDLE      = 10001,/* Illegal filehandle      */
    156  NFS4ERR_BAD_COOKIE     = 10003,/* READDIR cookie is stale */
    157  NFS4ERR_NOTSUPP        = 10004,/* operation not supported */
    158  NFS4ERR_TOOSMALL       = 10005,/* response limit exceeded */
    159  NFS4ERR_SERVERFAULT    = 10006,/* undefined server error  */
    160  NFS4ERR_BADTYPE        = 10007,/* type invalid for CREATE */
    161  NFS4ERR_DELAY          = 10008,/* file "busy" - retry     */
    162  NFS4ERR_SAME           = 10009,/* nverify says attrs same */
    163  NFS4ERR_DENIED         = 10010,/* lock unavailable        */
    164  NFS4ERR_EXPIRED        = 10011,/* lock lease expired      */
    165  NFS4ERR_LOCKED         = 10012,/* I/O failed due to lock  */
    166  NFS4ERR_GRACE          = 10013,/* in grace period         */
    167  NFS4ERR_FHEXPIRED      = 10014,/* filehandle expired      */
    168  NFS4ERR_SHARE_DENIED   = 10015,/* share reserve denied    */
    169  NFS4ERR_WRONGSEC       = 10016,/* wrong security flavor   */
    170  NFS4ERR_CLID_INUSE     = 10017,/* clientid in use         */
    171 
    172  /* NFS4ERR_RESOURCE is not a valid error in NFSv4.1 */
    173  NFS4ERR_RESOURCE       = 10018,/* resource exhaustion     */
    174 
    175  NFS4ERR_MOVED          = 10019,/* filesystem relocated    */
    176  NFS4ERR_NOFILEHANDLE   = 10020,/* current FH is not set   */
    177  NFS4ERR_MINOR_VERS_MISMATCH= 10021,/* minor vers not supp */
    178  NFS4ERR_STALE_CLIENTID = 10022,/* server has rebooted     */
    179  NFS4ERR_STALE_STATEID  = 10023,/* server has rebooted     */
    180  NFS4ERR_OLD_STATEID    = 10024,/* state is out of sync    */
    181  NFS4ERR_BAD_STATEID    = 10025,/* incorrect stateid       */
    182  NFS4ERR_BAD_SEQID      = 10026,/* request is out of seq.  */
    183  NFS4ERR_NOT_SAME       = 10027,/* verify - attrs not same */
    184  NFS4ERR_LOCK_RANGE     = 10028,/* overlapping lock range  */
    185  NFS4ERR_SYMLINK        = 10029,/* should be file/directory*/
    186  NFS4ERR_RESTOREFH      = 10030,/* no saved filehandle     */
    187  NFS4ERR_LEASE_MOVED    = 10031,/* some filesystem moved   */
    188  NFS4ERR_ATTRNOTSUPP    = 10032,/* recommended attr not sup*/
    189  NFS4ERR_NO_GRACE       = 10033,/* reclaim outside of grace*/
    190  NFS4ERR_RECLAIM_BAD    = 10034,/* reclaim error at server */
    191  NFS4ERR_RECLAIM_CONFLICT= 10035,/* conflict on reclaim    */
    192  NFS4ERR_BADXDR         = 10036,/* XDR decode failed       */
    193  NFS4ERR_LOCKS_HELD     = 10037,/* file locks held at CLOSE*/
    194  NFS4ERR_OPENMODE       = 10038,/* conflict in OPEN and I/O*/
    195  NFS4ERR_BADOWNER       = 10039,/* owner translation bad   */
    196  NFS4ERR_BADCHAR        = 10040,/* utf-8 char not supported*/
    197  NFS4ERR_BADNAME        = 10041,/* name not supported      */
    198  NFS4ERR_BAD_RANGE      = 10042,/* lock range not supported*/
    199  NFS4ERR_LOCK_NOTSUPP   = 10043,/* no atomic up/downgrade  */
    200  NFS4ERR_OP_ILLEGAL     = 10044,/* undefined operation     */
    201  NFS4ERR_DEADLOCK       = 10045,/* file locking deadlock   */
    202  NFS4ERR_FILE_OPEN      = 10046,/* open file blocks op.    */
    203  NFS4ERR_ADMIN_REVOKED  = 10047,/* lockowner state revoked */
    204  NFS4ERR_CB_PATH_DOWN   = 10048,/* callback path down      */
    205 
    206  /* NFSv4.1 errors start here. */
    207 
    208  NFS4ERR_BADIOMODE      = 10049,
    209  NFS4ERR_BADLAYOUT      = 10050,
    210  NFS4ERR_BAD_SESSION_DIGEST = 10051,
    211  NFS4ERR_BADSESSION     = 10052,
    212  NFS4ERR_BADSLOT        = 10053,
    213  NFS4ERR_COMPLETE_ALREADY = 10054,
    214  NFS4ERR_CONN_NOT_BOUND_TO_SESSION = 10055,
    215  NFS4ERR_DELEG_ALREADY_WANTED = 10056,
    216  NFS4ERR_BACK_CHAN_BUSY = 10057,/*backchan reqs outstanding*/
    217  NFS4ERR_LAYOUTTRYLATER = 10058,
    218  NFS4ERR_LAYOUTUNAVAILABLE = 10059,
    219  NFS4ERR_NOMATCHING_LAYOUT = 10060,
    220  NFS4ERR_RECALLCONFLICT = 10061,
    221  NFS4ERR_UNKNOWN_LAYOUTTYPE = 10062,
    222  NFS4ERR_SEQ_MISORDERED = 10063,/* unexpected seq.ID in req*/
    223  NFS4ERR_SEQUENCE_POS   = 10064,/* [CB_]SEQ. op not 1st op */
    224  NFS4ERR_REQ_TOO_BIG    = 10065,/* request too big         */
    225  NFS4ERR_REP_TOO_BIG    = 10066,/* reply too big           */
    226  NFS4ERR_REP_TOO_BIG_TO_CACHE =10067,/* rep. not all cached*/
    227  NFS4ERR_RETRY_UNCACHED_REP =10068,/* retry & rep. uncached*/
    228  NFS4ERR_UNSAFE_COMPOUND =10069,/* retry/recovery too hard */
    229  NFS4ERR_TOO_MANY_OPS   = 10070,/*too many ops in [CB_]COMP*/
    230  NFS4ERR_OP_NOT_IN_SESSION =10071,/* op needs [CB_]SEQ. op */
    231  NFS4ERR_HASH_ALG_UNSUPP = 10072, /* hash alg. not supp.   */
    232                                 /* Error 10073 is unused.  */
    233  NFS4ERR_CLIENTID_BUSY  = 10074,/* clientid has state      */
    234  NFS4ERR_PNFS_IO_HOLE   = 10075,/* IO to _SPARSE file hole */
    235  NFS4ERR_SEQ_FALSE_RETRY= 10076,/* Retry != original req.  */
    236  NFS4ERR_BAD_HIGH_SLOT  = 10077,/* req has bad highest_slot*/
    237  NFS4ERR_DEADSESSION    = 10078,/*new req sent to dead sess*/
    238  NFS4ERR_ENCR_ALG_UNSUPP= 10079,/* encr alg. not supp.     */
    239  NFS4ERR_PNFS_NO_LAYOUT = 10080,/* I/O without a layout    */
    240  NFS4ERR_NOT_ONLY_OP    = 10081,/* addl ops not allowed    */
    241  NFS4ERR_WRONG_CRED     = 10082,/* op done by wrong cred   */
    242  NFS4ERR_WRONG_TYPE     = 10083,/* op on wrong type object */
    243  NFS4ERR_DIRDELEG_UNAVAIL=10084,/* delegation not avail.   */
    244  NFS4ERR_REJECT_DELEG   = 10085,/* cb rejected delegation  */
    245  NFS4ERR_RETURNCONFLICT = 10086,/* layout get before return*/
    246  NFS4ERR_DELEG_REVOKED  = 10087 /* deleg./layout revoked   */
    247 };
    248 
    249 /*
    250  * Basic data types
    251  */
    252 typedef opaque  attrlist4<>;
    253 typedef uint32_t        bitmap4<>;
    254 typedef uint64_t        changeid4;
    255 typedef uint64_t        clientid4;
    256 typedef uint32_t        count4;
    257 typedef uint64_t        length4;
    258 typedef uint32_t        mode4;
    259 typedef uint64_t        nfs_cookie4;
    260 typedef opaque  nfs_fh4<NFS4_FHSIZE>;
    261 typedef uint64_t        offset4;
    262 typedef uint32_t        qop4;
    263 typedef opaque  sec_oid4<>;
    264 typedef uint32_t        sequenceid4;
    265 typedef uint32_t        seqid4;
    266 typedef opaque  sessionid4[NFS4_SESSIONID_SIZE];
    267 typedef uint32_t        slotid4;
    268 typedef opaque  utf8string<>;
    269 typedef utf8string      utf8str_cis;
    270 typedef utf8string      utf8str_cs;
    271 typedef utf8string      utf8str_mixed;
    272 typedef utf8str_cs      component4;
    273 typedef utf8str_cs      linktext4;
    274 typedef component4      pathname4<>;
    275 typedef opaque  verifier4[NFS4_VERIFIER_SIZE];
    276 
    277 /*
    278  * Timeval
    279  */
    280 struct nfstime4 {
    281         int64_t         seconds;
    282         uint32_t        nseconds;
    283 };
    284 
    285 enum time_how4 {
    286         SET_TO_SERVER_TIME4 = 0,
    287         SET_TO_CLIENT_TIME4 = 1
    288 };
    289 
    290 union settime4 switch (time_how4 set_it) {
    291  case SET_TO_CLIENT_TIME4:
    292          nfstime4       time;
    293  default:
    294          void;
    295 };
    296 
    297 
    298 typedef uint32_t nfs_lease4;
    299 
    300 /*
    301  * File attribute definitions
    302  */
    303 
    304 /*
    305  * FSID structure for major/minor
    306  */
    307 struct fsid4 {
    308         uint64_t        major;
    309         uint64_t        minor;
    310 };
    311 
    312 /*
    313  * Filesystem locations attribute
    314  * for relocation/migration and
    315  * related attributes.
    316  */
    317 struct change_policy4 {
    318         uint64_t        cp_major;
    319         uint64_t        cp_minor;
    320 };
    321 
    322 struct fs_location4 {
    323         utf8str_cis     server<>;
    324         pathname4       rootpath;
    325 };
    326 
    327 struct fs_locations4 {
    328         pathname4       fs_root;
    329         fs_location4    locations<>;
    330 };
    331 
    332 /*
    333  * Various Access Control Entry definitions
    334  */
    335 
    336 /*
    337  * Mask that indicates which
    338  * Access Control Entries are supported.
    339  * Values for the fattr4_aclsupport attribute.
    340  */
    341 const ACL4_SUPPORT_ALLOW_ACL    = 0x00000001;
    342 const ACL4_SUPPORT_DENY_ACL     = 0x00000002;
    343 const ACL4_SUPPORT_AUDIT_ACL    = 0x00000004;
    344 const ACL4_SUPPORT_ALARM_ACL    = 0x00000008;
    345 
    346 
    347 typedef uint32_t        acetype4;
    348 
    349 
    350 /*
    351  * acetype4 values, others can be added as needed.
    352  */
    353 const ACE4_ACCESS_ALLOWED_ACE_TYPE      = 0x00000000;
    354 const ACE4_ACCESS_DENIED_ACE_TYPE       = 0x00000001;
    355 const ACE4_SYSTEM_AUDIT_ACE_TYPE        = 0x00000002;
    356 const ACE4_SYSTEM_ALARM_ACE_TYPE        = 0x00000003;
    357 
    358 
    359 
    360 /*
    361  * ACE flag
    362  */
    363 typedef uint32_t aceflag4;
    364 
    365 
    366 /*
    367  * ACE flag values
    368  */
    369 const ACE4_FILE_INHERIT_ACE             = 0x00000001;
    370 const ACE4_DIRECTORY_INHERIT_ACE        = 0x00000002;
    371 const ACE4_NO_PROPAGATE_INHERIT_ACE     = 0x00000004;
    372 const ACE4_INHERIT_ONLY_ACE             = 0x00000008;
    373 const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG   = 0x00000010;
    374 const ACE4_FAILED_ACCESS_ACE_FLAG       = 0x00000020;
    375 const ACE4_IDENTIFIER_GROUP             = 0x00000040;
    376 const ACE4_INHERITED_ACE                = 0x00000080;
    377 
    378 
    379 
    380 /*
    381  * ACE mask
    382  */
    383 typedef uint32_t        acemask4;
    384 
    385 
    386 /*
    387  * ACE mask values
    388  */
    389 const ACE4_READ_DATA            = 0x00000001;
    390 const ACE4_LIST_DIRECTORY       = 0x00000001;
    391 const ACE4_WRITE_DATA           = 0x00000002;
    392 const ACE4_ADD_FILE             = 0x00000002;
    393 const ACE4_APPEND_DATA          = 0x00000004;
    394 const ACE4_ADD_SUBDIRECTORY     = 0x00000004;
    395 const ACE4_READ_NAMED_ATTRS     = 0x00000008;
    396 const ACE4_WRITE_NAMED_ATTRS    = 0x00000010;
    397 const ACE4_EXECUTE              = 0x00000020;
    398 const ACE4_DELETE_CHILD         = 0x00000040;
    399 const ACE4_READ_ATTRIBUTES      = 0x00000080;
    400 const ACE4_WRITE_ATTRIBUTES     = 0x00000100;
    401 const ACE4_WRITE_RETENTION      = 0x00000200;
    402 const ACE4_WRITE_RETENTION_HOLD = 0x00000400;
    403 
    404 const ACE4_DELETE               = 0x00010000;
    405 const ACE4_READ_ACL             = 0x00020000;
    406 const ACE4_WRITE_ACL            = 0x00040000;
    407 const ACE4_WRITE_OWNER          = 0x00080000;
    408 const ACE4_SYNCHRONIZE          = 0x00100000;
    409 
    410 
    411 /*
    412  * ACE4_GENERIC_READ -- defined as combination of
    413  *      ACE4_READ_ACL |
    414  *      ACE4_READ_DATA |
    415  *      ACE4_READ_ATTRIBUTES |
    416  *      ACE4_SYNCHRONIZE
    417  */
    418 
    419 const ACE4_GENERIC_READ = 0x00120081;
    420 
    421 /*
    422  * ACE4_GENERIC_WRITE -- defined as combination of
    423  *      ACE4_READ_ACL |
    424  *      ACE4_WRITE_DATA |
    425  *      ACE4_WRITE_ATTRIBUTES |
    426  *      ACE4_WRITE_ACL |
    427  *      ACE4_APPEND_DATA |
    428  *      ACE4_SYNCHRONIZE
    429  */
    430 const ACE4_GENERIC_WRITE = 0x00160106;
    431 
    432 
    433 /*
    434  * ACE4_GENERIC_EXECUTE -- defined as combination of
    435  *      ACE4_READ_ACL
    436  *      ACE4_READ_ATTRIBUTES
    437  *      ACE4_EXECUTE
    438  *      ACE4_SYNCHRONIZE
    439  */
    440 const ACE4_GENERIC_EXECUTE = 0x001200A0;
    441 
    442 
    443 /*
    444  * Access Control Entry definition
    445  */
    446 struct nfsace4 {
    447         acetype4        type;
    448         aceflag4        flag;
    449         acemask4        access_mask;
    450         utf8str_mixed   who;
    451 };
    452 
    453 
    454 /*
    455  * ACL flag
    456  */
    457 
    458 typedef uint32_t aclflag4;
    459 
    460 /*
    461  * ACL flag values
    462  */
    463 const ACL4_AUTO_INHERIT         = 0x00000001;
    464 const ACL4_PROTECTED            = 0x00000002;
    465 const ACL4_DEFAULTED            = 0x00000004;
    466 
    467 
    468 /*
    469  * Version 4.1 Access Control List definition
    470  */
    471 struct nfsacl41 {
    472         aclflag4        na41_flag;
    473         nfsace4         na41_aces<>;
    474 };
    475 
    476 
    477 /*
    478  * Field definitions for the fattr4_mode
    479  * and fattr4_mode_set_masked attributes.
    480  */
    481 const MODE4_SUID = 0x800;  /* set user id on execution */
    482 const MODE4_SGID = 0x400;  /* set group id on execution */
    483 const MODE4_SVTX = 0x200;  /* save text even after use */
    484 const MODE4_RUSR = 0x100;  /* read permission: owner */
    485 const MODE4_WUSR = 0x080;  /* write permission: owner */
    486 const MODE4_XUSR = 0x040;  /* execute permission: owner */
    487 const MODE4_RGRP = 0x020;  /* read permission: group */
    488 const MODE4_WGRP = 0x010;  /* write permission: group */
    489 const MODE4_XGRP = 0x008;  /* execute permission: group */
    490 const MODE4_ROTH = 0x004;  /* read permission: other */
    491 const MODE4_WOTH = 0x002;  /* write permission: other */
    492 const MODE4_XOTH = 0x001;  /* execute permission: other */
    493 
    494 
    495 /*
    496  * Masked mode for the mode_set_masked attribute.
    497  */
    498 struct mode_masked4 {
    499  mode4  mm_value_to_set; /* Values of bits
    500                             to set or reset
    501                             in mode. */
    502 
    503  mode4  mm_mask_bits;    /* Mask of bits to
    504                             set or reset
    505                             in mode. */
    506 };
    507 
    508 /*
    509  * Special data/attribute associated with
    510  * file types NF4BLK and NF4CHR.
    511  */
    512 struct specdata4 {
    513  uint32_t specdata1; /* major device number */
    514  uint32_t specdata2; /* minor device number */
    515 };
    516 
    517 /*
    518  * Values for fattr4_fh_expire_type
    519  */
    520 const   FH4_PERSISTENT          = 0x00000000;
    521 const   FH4_NOEXPIRE_WITH_OPEN  = 0x00000001;
    522 const   FH4_VOLATILE_ANY        = 0x00000002;
    523 const   FH4_VOL_MIGRATION       = 0x00000004;
    524 const   FH4_VOL_RENAME          = 0x00000008;
    525 
    526 
    527 struct netaddr4 {
    528         /* see struct rpcb in RFC 1833 */
    529         string na_r_netid<>;    /* network id */
    530         string na_r_addr<>;     /* universal address */
    531 };
    532 
    533 /*
    534  * data structures new to NFSv4.1
    535  */
    536 
    537 struct nfs_impl_id4 {
    538         utf8str_cis   nii_domain;
    539         utf8str_cs    nii_name;
    540         nfstime4      nii_date;
    541 };
    542 
    543 
    544 /*
    545  * Stateid
    546  */
    547 struct stateid4 {
    548         uint32_t        seqid;
    549         opaque          other[12];
    550 };
    551 
    552 enum layouttype4 {
    553         LAYOUT4_NFSV4_1_FILES   = 0x1,
    554         LAYOUT4_OSD2_OBJECTS    = 0x2,
    555         LAYOUT4_BLOCK_VOLUME    = 0x3
    556 };
    557 
    558 struct layout_content4 {
    559         layouttype4 loc_type;
    560         opaque      loc_body<>;
    561 };
    562 
    563 
    564 %/*
    565 %/* LAYOUT4_OSD2_OBJECTS loc_body description
    566 % * is in a separate .x file
    567 % */
    568 %
    569 %/*
    570 %/* LAYOUT4_BLOCK_VOLUME loc_body description
    571 % * is in a separate .x file
    572 % */
    573 
    574 struct layouthint4 {
    575         layouttype4             loh_type;
    576         opaque                  loh_body<>;
    577 };
    578 
    579 enum layoutiomode4 {
    580         LAYOUTIOMODE4_READ      = 1,
    581         LAYOUTIOMODE4_RW        = 2,
    582         LAYOUTIOMODE4_ANY       = 3
    583 };
    584 
    585 struct layout4 {
    586         offset4                 lo_offset;
    587         length4                 lo_length;
    588         layoutiomode4           lo_iomode;
    589         layout_content4         lo_content;
    590 };
    591 
    592 const NFS4_DEVICEID4_SIZE = 16;
    593 
    594 typedef opaque  deviceid4[NFS4_DEVICEID4_SIZE];
    595 
    596 struct device_addr4 {
    597         layouttype4             da_layout_type;
    598         opaque                  da_addr_body<>;
    599 };
    600 
    601 
    602 struct layoutupdate4 {
    603         layouttype4             lou_type;
    604         opaque                  lou_body<>;
    605 };
    606 
    607 %
    608 /* Constants used for LAYOUTRETURN and CB_LAYOUTRECALL */
    609 const LAYOUT4_RET_REC_FILE      = 1;
    610 const LAYOUT4_RET_REC_FSID      = 2;
    611 const LAYOUT4_RET_REC_ALL       = 3;
    612 %
    613 enum layoutreturn_type4 {
    614         LAYOUTRETURN4_FILE = LAYOUT4_RET_REC_FILE,
    615         LAYOUTRETURN4_FSID = LAYOUT4_RET_REC_FSID,
    616         LAYOUTRETURN4_ALL  = LAYOUT4_RET_REC_ALL
    617 };
    618 
    619 struct layoutreturn_file4 {
    620         offset4         lrf_offset;
    621         length4         lrf_length;
    622         stateid4        lrf_stateid;
    623 %       /* layouttype4 specific data */
    624         opaque          lrf_body<>;
    625 };
    626 
    627 union layoutreturn4 switch(layoutreturn_type4 lr_returntype) {
    628         case LAYOUTRETURN4_FILE:
    629                 layoutreturn_file4      lr_layout;
    630         default:
    631                 void;
    632 };
    633 %
    634 
    635 enum fs4_status_type {
    636         STATUS4_FIXED = 1,
    637         STATUS4_UPDATED = 2,
    638         STATUS4_VERSIONED = 3,
    639         STATUS4_WRITABLE = 4,
    640         STATUS4_REFERRAL = 5
    641 };
    642 
    643 struct fs4_status {
    644         bool            fss_absent;
    645         fs4_status_type fss_type;
    646         utf8str_cs      fss_source;
    647         utf8str_cs      fss_current;
    648         int32_t         fss_age;
    649         nfstime4        fss_version;
    650 };
    651 
    652 
    653 const TH4_READ_SIZE     = 0;
    654 const TH4_WRITE_SIZE    = 1;
    655 const TH4_READ_IOSIZE   = 2;
    656 const TH4_WRITE_IOSIZE  = 3;
    657 
    658 typedef length4 threshold4_read_size;
    659 typedef length4 threshold4_write_size;
    660 typedef length4 threshold4_read_iosize;
    661 typedef length4 threshold4_write_iosize;
    662 
    663 struct threshold_item4 {
    664         layouttype4     thi_layout_type;
    665         bitmap4         thi_hintset;
    666         opaque          thi_hintlist<>;
    667 };
    668 
    669 struct mdsthreshold4 {
    670         threshold_item4 mth_hints<>;
    671 };
    672 
    673 const RET4_DURATION_INFINITE    = 0xffffffffffffffff;
    674 struct retention_get4 {
    675         uint64_t        rg_duration;
    676         nfstime4        rg_begin_time<1>;
    677 };
    678 
    679 struct retention_set4 {
    680         bool            rs_enable;
    681         uint64_t        rs_duration<1>;
    682 };
    683 
    684 const FSCHARSET_CAP4_CONTAINS_NON_UTF8  = 0x1;
    685 const FSCHARSET_CAP4_ALLOWS_ONLY_UTF8   = 0x2;
    686 
    687 typedef uint32_t        fs_charset_cap4;
    688 
    689 
    690 /*
    691  * NFSv4.1 attributes
    692  */
    693 typedef bitmap4         fattr4_supported_attrs;
    694 typedef bitmap4         fattr4_suppattr_exclcreat;
    695 typedef nfs_ftype4      fattr4_type;
    696 typedef uint32_t        fattr4_fh_expire_type;
    697 typedef changeid4       fattr4_change;
    698 typedef uint64_t        fattr4_size;
    699 typedef bool            fattr4_link_support;
    700 typedef bool            fattr4_symlink_support;
    701 typedef bool            fattr4_named_attr;
    702 typedef fsid4           fattr4_fsid;
    703 typedef bool            fattr4_unique_handles;
    704 typedef nfs_lease4      fattr4_lease_time;
    705 typedef nfsstat4        fattr4_rdattr_error;
    706 typedef nfsace4         fattr4_acl<>;
    707 typedef uint32_t        fattr4_aclsupport;
    708 typedef bool            fattr4_archive;
    709 typedef bool            fattr4_cansettime;
    710 typedef bool            fattr4_case_insensitive;
    711 typedef bool            fattr4_case_preserving;
    712 typedef bool            fattr4_chown_restricted;
    713 typedef uint64_t        fattr4_fileid;
    714 typedef uint64_t        fattr4_files_avail;
    715 typedef nfs_fh4         fattr4_filehandle;
    716 typedef uint64_t        fattr4_files_free;
    717 typedef uint64_t        fattr4_files_total;
    718 typedef fs_locations4   fattr4_fs_locations;
    719 typedef bool            fattr4_hidden;
    720 typedef bool            fattr4_homogeneous;
    721 typedef uint64_t        fattr4_maxfilesize;
    722 typedef uint32_t        fattr4_maxlink;
    723 typedef uint32_t        fattr4_maxname;
    724 typedef uint64_t        fattr4_maxread;
    725 typedef uint64_t        fattr4_maxwrite;
    726 typedef utf8str_cs      fattr4_mimetype;
    727 typedef mode4           fattr4_mode;
    728 typedef mode_masked4    fattr4_mode_set_masked;
    729 typedef uint64_t        fattr4_mounted_on_fileid;
    730 typedef bool            fattr4_no_trunc;
    731 typedef uint32_t        fattr4_numlinks;
    732 typedef utf8str_mixed   fattr4_owner;
    733 typedef utf8str_mixed   fattr4_owner_group;
    734 typedef uint64_t        fattr4_quota_avail_hard;
    735 typedef uint64_t        fattr4_quota_avail_soft;
    736 typedef uint64_t        fattr4_quota_used;
    737 typedef specdata4       fattr4_rawdev;
    738 typedef uint64_t        fattr4_space_avail;
    739 typedef uint64_t        fattr4_space_free;
    740 typedef uint64_t        fattr4_space_total;
    741 typedef uint64_t        fattr4_space_used;
    742 typedef bool            fattr4_system;
    743 typedef nfstime4        fattr4_time_access;
    744 typedef settime4        fattr4_time_access_set;
    745 typedef nfstime4        fattr4_time_backup;
    746 typedef nfstime4        fattr4_time_create;
    747 typedef nfstime4        fattr4_time_delta;
    748 typedef nfstime4        fattr4_time_metadata;
    749 typedef nfstime4        fattr4_time_modify;
    750 typedef settime4        fattr4_time_modify_set;
    751 /*
    752  * attributes new to NFSv4.1
    753  */
    754 typedef nfstime4        fattr4_dir_notif_delay;
    755 typedef nfstime4        fattr4_dirent_notif_delay;
    756 typedef bool            fattr4_absent;
    757 typedef layouttype4     fattr4_fs_layout_types<>;
    758 typedef fs4_status      fattr4_fs_status;
    759 typedef fs_charset_cap4 fattr4_fs_charset_cap4;
    760 typedef uint32_t        fattr4_layout_alignment;
    761 typedef uint32_t        fattr4_layout_blksize;
    762 typedef layouthint4     fattr4_layout_hint;
    763 typedef layouttype4     fattr4_layout_types<>;
    764 typedef mdsthreshold4   fattr4_mdsthreshold;
    765 typedef retention_get4  fattr4_retention_get;
    766 typedef retention_set4  fattr4_retention_set;
    767 typedef retention_get4  fattr4_retentevt_get;
    768 typedef retention_set4  fattr4_retentevt_set;
    769 typedef uint64_t        fattr4_retention_hold;
    770 typedef nfsacl41        fattr4_dacl;
    771 typedef nfsacl41        fattr4_sacl;
    772 
    773 
    774 /*
    775  * Mandatory Attributes
    776  */
    777 const FATTR4_SUPPORTED_ATTRS    = 0;
    778 const FATTR4_TYPE               = 1;
    779 const FATTR4_FH_EXPIRE_TYPE     = 2;
    780 const FATTR4_CHANGE             = 3;
    781 const FATTR4_SIZE               = 4;
    782 const FATTR4_LINK_SUPPORT       = 5;
    783 const FATTR4_SYMLINK_SUPPORT    = 6;
    784 const FATTR4_NAMED_ATTR         = 7;
    785 const FATTR4_FSID               = 8;
    786 const FATTR4_UNIQUE_HANDLES     = 9;
    787 const FATTR4_LEASE_TIME         = 10;
    788 const FATTR4_RDATTR_ERROR       = 11;
    789 const FATTR4_FILEHANDLE         = 19;
    790 const FATTR4_SUPPATTR_EXCLCREAT = 75;
    791 
    792 /*
    793  * Recommended Attributes
    794  */
    795 const FATTR4_ACL                = 12;
    796 const FATTR4_ACLSUPPORT         = 13;
    797 const FATTR4_ARCHIVE            = 14;
    798 const FATTR4_CANSETTIME         = 15;
    799 const FATTR4_CASE_INSENSITIVE   = 16;
    800 const FATTR4_CASE_PRESERVING    = 17;
    801 const FATTR4_CHOWN_RESTRICTED   = 18;
    802 const FATTR4_FILEID             = 20;
    803 const FATTR4_FILES_AVAIL        = 21;
    804 const FATTR4_FILES_FREE         = 22;
    805 const FATTR4_FILES_TOTAL        = 23;
    806 const FATTR4_FS_LOCATIONS       = 24;
    807 const FATTR4_HIDDEN             = 25;
    808 const FATTR4_HOMOGENEOUS        = 26;
    809 const FATTR4_MAXFILESIZE        = 27;
    810 const FATTR4_MAXLINK            = 28;
    811 const FATTR4_MAXNAME            = 29;
    812 const FATTR4_MAXREAD            = 30;
    813 const FATTR4_MAXWRITE           = 31;
    814 const FATTR4_MIMETYPE           = 32;
    815 const FATTR4_MODE               = 33;
    816 const FATTR4_NO_TRUNC           = 34;
    817 const FATTR4_NUMLINKS           = 35;
    818 const FATTR4_OWNER              = 36;
    819 const FATTR4_OWNER_GROUP        = 37;
    820 const FATTR4_QUOTA_AVAIL_HARD   = 38;
    821 const FATTR4_QUOTA_AVAIL_SOFT   = 39;
    822 const FATTR4_QUOTA_USED         = 40;
    823 const FATTR4_RAWDEV             = 41;
    824 const FATTR4_SPACE_AVAIL        = 42;
    825 const FATTR4_SPACE_FREE         = 43;
    826 const FATTR4_SPACE_TOTAL        = 44;
    827 const FATTR4_SPACE_USED         = 45;
    828 const FATTR4_SYSTEM             = 46;
    829 const FATTR4_TIME_ACCESS        = 47;
    830 const FATTR4_TIME_ACCESS_SET    = 48;
    831 const FATTR4_TIME_BACKUP        = 49;
    832 const FATTR4_TIME_CREATE        = 50;
    833 const FATTR4_TIME_DELTA         = 51;
    834 const FATTR4_TIME_METADATA      = 52;
    835 const FATTR4_TIME_MODIFY        = 53;
    836 const FATTR4_TIME_MODIFY_SET    = 54;
    837 const FATTR4_MOUNTED_ON_FILEID  = 55;
    838 const FATTR4_DIR_NOTIF_DELAY    = 56;
    839 const FATTR4_DIRENT_NOTIF_DELAY = 57;
    840 const FATTR4_DACL               = 58;
    841 const FATTR4_SACL               = 59;
    842 const FATTR4_CHANGE_POLICY      = 60;
    843 const FATTR4_FS_STATUS          = 61;
    844 const FATTR4_FS_LAYOUT_TYPE     = 62;
    845 const FATTR4_LAYOUT_HINT        = 63;
    846 const FATTR4_LAYOUT_TYPE        = 64;
    847 const FATTR4_LAYOUT_BLKSIZE     = 65;
    848 const FATTR4_LAYOUT_ALIGNMENT   = 66;
    849 const FATTR4_FS_LOCATIONS_INFO  = 67;
    850 const FATTR4_MDSTHRESHOLD       = 68;
    851 const FATTR4_RETENTION_GET      = 69;
    852 const FATTR4_RETENTION_SET      = 70;
    853 const FATTR4_RETENTEVT_GET      = 71;
    854 const FATTR4_RETENTEVT_SET      = 72;
    855 const FATTR4_RETENTION_HOLD     = 73;
    856 const FATTR4_MODE_SET_MASKED    = 74;
    857 const FATTR4_FS_CHARSET_CAP     = 76;
    858 
    859 /*
    860  * File attribute container
    861  */
    862 struct fattr4 {
    863         bitmap4         attrmask;
    864         attrlist4       attr_vals;
    865 };
    866 
    867 /*
    868  * Change info for the client
    869  */
    870 struct change_info4 {
    871         bool            atomic;
    872         changeid4       before;
    873         changeid4       after;
    874 };
    875 
    876 typedef netaddr4 clientaddr4;
    877 
    878 /*
    879  * Callback program info as provided by the client
    880  */
    881 struct cb_client4 {
    882         uint32_t        cb_program;
    883         netaddr4        cb_location;
    884 };
    885 
    886 /*
    887  * NFSv4.0 Long Hand Client ID
    888  */
    889 struct nfs_client_id4 {
    890         verifier4       verifier;
    891         opaque          id<NFS4_OPAQUE_LIMIT>;
    892 };
    893 
    894 /*
    895  * NFSv4.1 Client Owner (aka long hand client ID)
    896  */
    897 struct client_owner4 {
    898         verifier4       co_verifier;
    899         opaque          co_ownerid<NFS4_OPAQUE_LIMIT>;
    900 };
    901 
    902 
    903 /*
    904  * NFSv4.1 server Owner
    905  */
    906 struct server_owner4 {
    907  uint64_t       so_minor_id;
    908  opaque         so_major_id<NFS4_OPAQUE_LIMIT>;
    909 };
    910 
    911 
    912 struct state_owner4 {
    913         clientid4       clientid;
    914         opaque          owner<NFS4_OPAQUE_LIMIT>;
    915 };
    916 
    917 typedef state_owner4 open_owner4;
    918 typedef state_owner4 lock_owner4;
    919 
    920 
    921 enum nfs_lock_type4 {
    922         READ_LT         = 1,
    923         WRITE_LT        = 2,
    924         READW_LT        = 3,    /* blocking read */
    925         WRITEW_LT       = 4     /* blocking write */
    926 };
    927 
    928 
    929 %
    930 %/* Input for computing subkeys */
    931 enum ssv_subkey4 {
    932         SSV4_SUBKEY_MIC_I2T     = 1,
    933         SSV4_SUBKEY_MIC_T2I     = 2,
    934         SSV4_SUBKEY_SEAL_I2T    = 3,
    935         SSV4_SUBKEY_SEAL_T2I    = 4
    936 };
    937 %
    938 
    939 %
    940 %/* Input for computing smt_hmac */
    941 struct ssv_mic_plain_tkn4 {
    942   uint32_t        smpt_ssv_seq;
    943   opaque          smpt_orig_plain<>;
    944 };
    945 %
    946 
    947 %
    948 %/* SSV GSS PerMsgToken token */
    949 struct ssv_mic_tkn4 {
    950   uint32_t        smt_ssv_seq;
    951   opaque          smt_hmac<>;
    952 };
    953 %
    954 
    955 %
    956 %/* Input for computing ssct_encr_data and ssct_hmac */
    957 struct ssv_seal_plain_tkn4 {
    958   opaque          sspt_confounder<>;
    959   uint32_t        sspt_ssv_seq;
    960   opaque          sspt_orig_plain<>;
    961   opaque          sspt_pad<>;
    962 };
    963 %
    964 
    965 %
    966 %/* SSV GSS SealedMessage token */
    967 struct ssv_seal_cipher_tkn4 {
    968   uint32_t      ssct_ssv_seq;
    969   opaque        ssct_iv<>;
    970   opaque        ssct_encr_data<>;
    971   opaque        ssct_hmac<>;
    972 };
    973 %
    974 
    975 /*
    976  * Defines an individual server replica
    977  */
    978 struct  fs_locations_server4 {
    979         int32_t         fls_currency;
    980         opaque          fls_info<>;
    981         utf8str_cis     fls_server;
    982 };
    983 
    984 /*
    985  * Byte indices of items within
    986  * fls_info: flag fields, class numbers,
    987  * bytes indicating ranks and orders.
    988  */
    989 const FSLI4BX_GFLAGS            = 0;
    990 const FSLI4BX_TFLAGS            = 1;
    991 
    992 const FSLI4BX_CLSIMUL           = 2;
    993 const FSLI4BX_CLHANDLE          = 3;
    994 const FSLI4BX_CLFILEID          = 4;
    995 const FSLI4BX_CLWRITEVER        = 5;
    996 const FSLI4BX_CLCHANGE          = 6;
    997 const FSLI4BX_CLREADDIR         = 7;
    998 
    999 const FSLI4BX_READRANK          = 8;
   1000 const FSLI4BX_WRITERANK         = 9;
   1001 const FSLI4BX_READORDER         = 10;
   1002 const FSLI4BX_WRITEORDER        = 11;
   1003 
   1004 /*
   1005  * Bits defined within the general flag byte.
   1006  */
   1007 const FSLI4GF_WRITABLE          = 0x01;
   1008 const FSLI4GF_CUR_REQ           = 0x02;
   1009 const FSLI4GF_ABSENT            = 0x04;
   1010 const FSLI4GF_GOING             = 0x08;
   1011 const FSLI4GF_SPLIT             = 0x10;
   1012 
   1013 /*
   1014  * Bits defined within the transport flag byte.
   1015  */
   1016 const FSLI4TF_RDMA              = 0x01;
   1017 
   1018 /*
   1019  * Defines a set of replicas sharing
   1020  * a common value of the root path
   1021  * with in the corresponding
   1022  * single-server namespaces.
   1023  */
   1024 struct  fs_locations_item4 {
   1025         fs_locations_server4    fli_entries<>;
   1026         pathname4               fli_rootpath;
   1027 };
   1028 
   1029 /*
   1030  * Defines the overall structure of
   1031  * the fs_locations_info attribute.
   1032  */
   1033 struct  fs_locations_info4 {
   1034         uint32_t                fli_flags;
   1035         int32_t                 fli_valid_for;
   1036         pathname4               fli_fs_root;
   1037         fs_locations_item4      fli_items<>;
   1038 };
   1039 
   1040 /*
   1041  * Flag bits in fli_flags.
   1042  */
   1043 const FSLI4IF_VAR_SUB           = 0x00000001;
   1044 
   1045 typedef fs_locations_info4 fattr4_fs_locations_info;
   1046 
   1047 const NFL4_UFLG_MASK            = 0x0000003F;
   1048 const NFL4_UFLG_DENSE           = 0x00000001;
   1049 const NFL4_UFLG_COMMIT_THRU_MDS = 0x00000002;
   1050 const NFL4_UFLG_STRIPE_UNIT_SIZE_MASK
   1051                                 = 0xFFFFFFC0;
   1052 
   1053 typedef uint32_t nfl_util4;
   1054 
   1055 %
   1056 
   1057 enum filelayout_hint_care4 {
   1058         NFLH4_CARE_DENSE        = NFL4_UFLG_DENSE,
   1059 
   1060         NFLH4_CARE_COMMIT_THRU_MDS
   1061                                 = NFL4_UFLG_COMMIT_THRU_MDS,
   1062 
   1063         NFLH4_CARE_STRIPE_UNIT_SIZE
   1064                                 = 0x00000040,
   1065 
   1066         NFLH4_CARE_STRIPE_COUNT = 0x00000080
   1067 };
   1068 %
   1069 %/* Encoded in the loh_body field of type layouthint4: */
   1070 %
   1071 struct nfsv4_1_file_layouthint4 {
   1072         uint32_t        nflh_care;
   1073         nfl_util4       nflh_util;
   1074         count4          nflh_stripe_count;
   1075 };
   1076 
   1077 %
   1078 
   1079 %
   1080 typedef netaddr4 multipath_list4<>;
   1081 %
   1082 %/* Encoded in the da_addr_body field of type device_addr4: */
   1083 struct nfsv4_1_file_layout_ds_addr4 {
   1084         uint32_t        nflda_stripe_indices<>;
   1085         multipath_list4 nflda_multipath_ds_list<>;
   1086 };
   1087 
   1088 %
   1089 
   1090 %
   1091 %/* Encoded in the loc_body field of type layout_content4: */
   1092 struct nfsv4_1_file_layout4 {
   1093          deviceid4      nfl_deviceid;
   1094          nfl_util4      nfl_util;
   1095          uint32_t       nfl_first_stripe_index;
   1096          offset4        nfl_pattern_offset;
   1097          nfs_fh4        nfl_fh_list<>;
   1098 };
   1099 
   1100 %
   1101 
   1102 %/*
   1103 % * Encoded in the lou_body field of type layoutupdate4:
   1104 % *      Nothing. lou_body is a zero length array of octets.
   1105 % */
   1106 %
   1107 
   1108 
   1109 
   1110 const ACCESS4_READ      = 0x00000001;
   1111 const ACCESS4_LOOKUP    = 0x00000002;
   1112 const ACCESS4_MODIFY    = 0x00000004;
   1113 const ACCESS4_EXTEND    = 0x00000008;
   1114 const ACCESS4_DELETE    = 0x00000010;
   1115 const ACCESS4_EXECUTE   = 0x00000020;
   1116 
   1117 struct ACCESS4args {
   1118         /* CURRENT_FH: object */
   1119         uint32_t        access;
   1120 };
   1121 
   1122 struct ACCESS4resok {
   1123         uint32_t        supported;
   1124         uint32_t        access;
   1125 };
   1126 
   1127 union ACCESS4res switch (nfsstat4 status) {
   1128  case NFS4_OK:
   1129          ACCESS4resok   resok4;
   1130  default:
   1131          void;
   1132 };
   1133 
   1134 struct CLOSE4args {
   1135         /* CURRENT_FH: object */
   1136         seqid4          seqid;
   1137         stateid4        open_stateid;
   1138 };
   1139 
   1140 union CLOSE4res switch (nfsstat4 status) {
   1141  case NFS4_OK:
   1142          stateid4       open_stateid;
   1143  default:
   1144          void;
   1145 };
   1146 
   1147 struct COMMIT4args {
   1148         /* CURRENT_FH: file */
   1149         offset4         offset;
   1150         count4          count;
   1151 };
   1152 
   1153 struct COMMIT4resok {
   1154         verifier4       writeverf;
   1155 };
   1156 
   1157 union COMMIT4res switch (nfsstat4 status) {
   1158  case NFS4_OK:
   1159          COMMIT4resok   resok4;
   1160  default:
   1161          void;
   1162 };
   1163 
   1164 union createtype4 switch (nfs_ftype4 type) {
   1165  case NF4LNK:
   1166          linktext4 linkdata;
   1167  case NF4BLK:
   1168  case NF4CHR:
   1169          specdata4 devdata;
   1170  case NF4SOCK:
   1171  case NF4FIFO:
   1172  case NF4DIR:
   1173          void;
   1174  default:
   1175          void;  /* server should return NFS4ERR_BADTYPE */
   1176 };
   1177 
   1178 struct CREATE4args {
   1179         /* CURRENT_FH: directory for creation */
   1180         createtype4     objtype;
   1181         component4      objname;
   1182         fattr4          createattrs;
   1183 };
   1184 
   1185 struct CREATE4resok {
   1186         change_info4    cinfo;
   1187         bitmap4         attrset;        /* attributes set */
   1188 };
   1189 
   1190 union CREATE4res switch (nfsstat4 status) {
   1191  case NFS4_OK:
   1192          /* new CURRENTFH: created object */
   1193          CREATE4resok resok4;
   1194  default:
   1195          void;
   1196 };
   1197 
   1198 struct DELEGPURGE4args {
   1199         clientid4       clientid;
   1200 };
   1201 
   1202 struct DELEGPURGE4res {
   1203         nfsstat4        status;
   1204 };
   1205 
   1206 struct DELEGRETURN4args {
   1207         /* CURRENT_FH: delegated object */
   1208         stateid4        deleg_stateid;
   1209 };
   1210 
   1211 struct DELEGRETURN4res {
   1212         nfsstat4        status;
   1213 };
   1214 
   1215 struct GETATTR4args {
   1216         /* CURRENT_FH: object */
   1217         bitmap4         attr_request;
   1218 };
   1219 
   1220 struct GETATTR4resok {
   1221         fattr4          obj_attributes;
   1222 };
   1223 
   1224 union GETATTR4res switch (nfsstat4 status) {
   1225  case NFS4_OK:
   1226          GETATTR4resok  resok4;
   1227  default:
   1228          void;
   1229 };
   1230 
   1231 struct GETFH4resok {
   1232         nfs_fh4         object;
   1233 };
   1234 
   1235 union GETFH4res switch (nfsstat4 status) {
   1236  case NFS4_OK:
   1237         GETFH4resok     resok4;
   1238  default:
   1239         void;
   1240 };
   1241 
   1242 struct LINK4args {
   1243         /* SAVED_FH: source object */
   1244         /* CURRENT_FH: target directory */
   1245         component4      newname;
   1246 };
   1247 
   1248 struct LINK4resok {
   1249         change_info4    cinfo;
   1250 };
   1251 
   1252 union LINK4res switch (nfsstat4 status) {
   1253  case NFS4_OK:
   1254          LINK4resok resok4;
   1255  default:
   1256          void;
   1257 };
   1258 
   1259 /*
   1260  * For LOCK, transition from open_stateid and lock_owner
   1261  * to a lock stateid.
   1262  */
   1263 struct open_to_lock_owner4 {
   1264         seqid4          open_seqid;
   1265         stateid4        open_stateid;
   1266         seqid4          lock_seqid;
   1267         lock_owner4     lock_owner;
   1268 };
   1269 
   1270 /*
   1271  * For LOCK, existing lock stateid  continues to request new
   1272  * file lock for the same lock_owner and open_stateid.
   1273  */
   1274 struct exist_lock_owner4 {
   1275         stateid4        lock_stateid;
   1276         seqid4          lock_seqid;
   1277 };
   1278 
   1279 union locker4 switch (bool new_lock_owner) {
   1280  case TRUE:
   1281         open_to_lock_owner4     open_owner;
   1282  case FALSE:
   1283         exist_lock_owner4       lock_owner;
   1284 };
   1285 
   1286 /*
   1287  * LOCK/LOCKT/LOCKU: Record lock management
   1288  */
   1289 struct LOCK4args {
   1290         /* CURRENT_FH: file */
   1291         nfs_lock_type4  locktype;
   1292         bool            reclaim;
   1293         offset4         offset;
   1294         length4         length;
   1295         locker4         locker;
   1296 };
   1297 
   1298 struct LOCK4denied {
   1299         offset4         offset;
   1300         length4         length;
   1301         nfs_lock_type4  locktype;
   1302         lock_owner4     owner;
   1303 };
   1304 
   1305 struct LOCK4resok {
   1306         stateid4        lock_stateid;
   1307 };
   1308 
   1309 union LOCK4res switch (nfsstat4 status) {
   1310  case NFS4_OK:
   1311          LOCK4resok     resok4;
   1312  case NFS4ERR_DENIED:
   1313          LOCK4denied    denied;
   1314  default:
   1315          void;
   1316 };
   1317 
   1318 struct LOCKT4args {
   1319         /* CURRENT_FH: file */
   1320         nfs_lock_type4  locktype;
   1321         offset4         offset;
   1322         length4         length;
   1323         lock_owner4     owner;
   1324 };
   1325 
   1326 union LOCKT4res switch (nfsstat4 status) {
   1327  case NFS4ERR_DENIED:
   1328          LOCK4denied    denied;
   1329  case NFS4_OK:
   1330          void;
   1331  default:
   1332          void;
   1333 };
   1334 
   1335 struct LOCKU4args {
   1336         /* CURRENT_FH: file */
   1337         nfs_lock_type4  locktype;
   1338         seqid4          seqid;
   1339         stateid4        lock_stateid;
   1340         offset4         offset;
   1341         length4         length;
   1342 };
   1343 
   1344 union LOCKU4res switch (nfsstat4 status) {
   1345  case   NFS4_OK:
   1346          stateid4       lock_stateid;
   1347  default:
   1348          void;
   1349 };
   1350 
   1351 struct LOOKUP4args {
   1352         /* CURRENT_FH: directory */
   1353         component4      objname;
   1354 };
   1355 
   1356 struct LOOKUP4res {
   1357         /* New CURRENT_FH: object */
   1358         nfsstat4        status;
   1359 };
   1360 
   1361 struct LOOKUPP4res {
   1362         /* new CURRENT_FH: parent directory */
   1363         nfsstat4        status;
   1364 };
   1365 
   1366 struct NVERIFY4args {
   1367         /* CURRENT_FH: object */
   1368         fattr4          obj_attributes;
   1369 };
   1370 
   1371 struct NVERIFY4res {
   1372         nfsstat4        status;
   1373 };
   1374 
   1375 /*
   1376  * Various definitions for OPEN
   1377  */
   1378 enum createmode4 {
   1379         UNCHECKED4      = 0,
   1380         GUARDED4        = 1,
   1381         /* Deprecated in NFSv4.1. */
   1382         EXCLUSIVE4      = 2,
   1383         /*
   1384          * New to NFSv4.1. If session is persistent,
   1385          * GUARDED4 MUST be used. Otherwise, use
   1386          * EXCLUSIVE4_1 instead of EXCLUSIVE4.
   1387          */
   1388         EXCLUSIVE4_1    = 3
   1389 };
   1390 
   1391 struct creatverfattr {
   1392          verifier4      cva_verf;
   1393          fattr4         cva_attrs;
   1394 };
   1395 
   1396 union createhow4 switch (createmode4 mode) {
   1397  case UNCHECKED4:
   1398  case GUARDED4:
   1399          fattr4         createattrs;
   1400  case EXCLUSIVE4:
   1401          verifier4      createverf;
   1402  case EXCLUSIVE4_1:
   1403          creatverfattr  ch_createboth;
   1404 };
   1405 
   1406 enum opentype4 {
   1407         OPEN4_NOCREATE  = 0,
   1408         OPEN4_CREATE    = 1
   1409 };
   1410 
   1411 union openflag4 switch (opentype4 opentype) {
   1412  case OPEN4_CREATE:
   1413          createhow4     how;
   1414  default:
   1415          void;
   1416 };
   1417 
   1418 /* Next definitions used for OPEN delegation */
   1419 enum limit_by4 {
   1420         NFS_LIMIT_SIZE          = 1,
   1421         NFS_LIMIT_BLOCKS        = 2
   1422         /* others as needed */
   1423 };
   1424 
   1425 struct nfs_modified_limit4 {
   1426         uint32_t        num_blocks;
   1427         uint32_t        bytes_per_block;
   1428 };
   1429 
   1430 union nfs_space_limit4 switch (limit_by4 limitby) {
   1431  /* limit specified as file size */
   1432  case NFS_LIMIT_SIZE:
   1433          uint64_t               filesize;
   1434  /* limit specified by number of blocks */
   1435  case NFS_LIMIT_BLOCKS:
   1436          nfs_modified_limit4    mod_blocks;
   1437 } ;
   1438 
   1439 /*
   1440  * Share Access and Deny constants for open argument
   1441  */
   1442 const OPEN4_SHARE_ACCESS_READ   = 0x00000001;
   1443 const OPEN4_SHARE_ACCESS_WRITE  = 0x00000002;
   1444 const OPEN4_SHARE_ACCESS_BOTH   = 0x00000003;
   1445 
   1446 const OPEN4_SHARE_DENY_NONE     = 0x00000000;
   1447 const OPEN4_SHARE_DENY_READ     = 0x00000001;
   1448 const OPEN4_SHARE_DENY_WRITE    = 0x00000002;
   1449 const OPEN4_SHARE_DENY_BOTH     = 0x00000003;
   1450 
   1451 
   1452 /* new flags for share_access field of OPEN4args */
   1453 const OPEN4_SHARE_ACCESS_WANT_DELEG_MASK        = 0xFF00;
   1454 const OPEN4_SHARE_ACCESS_WANT_NO_PREFERENCE     = 0x0000;
   1455 const OPEN4_SHARE_ACCESS_WANT_READ_DELEG        = 0x0100;
   1456 const OPEN4_SHARE_ACCESS_WANT_WRITE_DELEG       = 0x0200;
   1457 const OPEN4_SHARE_ACCESS_WANT_ANY_DELEG         = 0x0300;
   1458 const OPEN4_SHARE_ACCESS_WANT_NO_DELEG          = 0x0400;
   1459 const OPEN4_SHARE_ACCESS_WANT_CANCEL            = 0x0500;
   1460 
   1461 const
   1462  OPEN4_SHARE_ACCESS_WANT_SIGNAL_DELEG_WHEN_RESRC_AVAIL
   1463  = 0x10000;
   1464 
   1465 const
   1466  OPEN4_SHARE_ACCESS_WANT_PUSH_DELEG_WHEN_UNCONTENDED
   1467  = 0x20000;
   1468 
   1469 enum open_delegation_type4 {
   1470         OPEN_DELEGATE_NONE      = 0,
   1471         OPEN_DELEGATE_READ      = 1,
   1472         OPEN_DELEGATE_WRITE     = 2,
   1473         OPEN_DELEGATE_NONE_EXT  = 3 /* new to v4.1 */
   1474 };
   1475 
   1476 enum open_claim_type4 {
   1477         /*
   1478          * Not a reclaim.
   1479          */
   1480         CLAIM_NULL              = 0,
   1481 
   1482         CLAIM_PREVIOUS          = 1,
   1483         CLAIM_DELEGATE_CUR      = 2,
   1484         CLAIM_DELEGATE_PREV     = 3,
   1485 
   1486         /*
   1487          * Not a reclaim.
   1488          *
   1489          * Like CLAIM_NULL, but object identified
   1490          * by the current filehandle.
   1491          */
   1492         CLAIM_FH                = 4, /* new to v4.1 */
   1493 
   1494         /*
   1495          * Like CLAIM_DELEGATE_CUR, but object identified
   1496          * by current filehandle.
   1497          */
   1498         CLAIM_DELEG_CUR_FH      = 5, /* new to v4.1 */
   1499 
   1500         /*
   1501          * Like CLAIM_DELEGATE_PREV, but object identified
   1502          * by current filehandle.
   1503          */
   1504         CLAIM_DELEG_PREV_FH     = 6 /* new to v4.1 */
   1505 };
   1506 
   1507 struct open_claim_delegate_cur4 {
   1508         stateid4        delegate_stateid;
   1509         component4      file;
   1510 };
   1511 
   1512 union open_claim4 switch (open_claim_type4 claim) {
   1513  /*
   1514   * No special rights to file.
   1515   * Ordinary OPEN of the specified file.
   1516   */
   1517  case CLAIM_NULL:
   1518         /* CURRENT_FH: directory */
   1519         component4      file;
   1520  /*
   1521   * Right to the file established by an
   1522   * open previous to server reboot. File
   1523   * identified by filehandle obtained at
   1524   * that time rather than by name.
   1525   */
   1526  case CLAIM_PREVIOUS:
   1527         /* CURRENT_FH: file being reclaimed */
   1528         open_delegation_type4   delegate_type;
   1529 
   1530  /*
   1531   * Right to file based on a delegation
   1532   * granted by the server. File is
   1533   * specified by name.
   1534   */
   1535  case CLAIM_DELEGATE_CUR:
   1536         /* CURRENT_FH: directory */
   1537         open_claim_delegate_cur4        delegate_cur_info;
   1538 
   1539  /*
   1540   * Right to file based on a delegation
   1541   * granted to a previous boot instance
   1542   * of the client.  File is specified by name.
   1543   */
   1544  case CLAIM_DELEGATE_PREV:
   1545          /* CURRENT_FH: directory */
   1546         component4      file_delegate_prev;
   1547 
   1548  /*
   1549   * Like CLAIM_NULL. No special rights
   1550   * to file. Ordinary OPEN of the
   1551   * specified file by current filehandle.
   1552   */
   1553  case CLAIM_FH: /* new to v4.1 */
   1554         /* CURRENT_FH: regular file to open */
   1555         void;
   1556 
   1557  /*
   1558   * Like CLAIM_DELEGATE_PREV. Right to file based on a
   1559   * delegation granted to a previous boot
   1560   * instance of the client.  File is identified by
   1561   * by filehandle.
   1562   */
   1563  case CLAIM_DELEG_PREV_FH: /* new to v4.1 */
   1564         /* CURRENT_FH: file being opened */
   1565         void;
   1566 
   1567  /*
   1568   * Like CLAIM_DELEGATE_CUR. Right to file based on
   1569   * a delegation granted by the server.
   1570   * File is identified by filehandle.
   1571   */
   1572  case CLAIM_DELEG_CUR_FH: /* new to v4.1 */
   1573          /* CURRENT_FH: file being opened */
   1574          stateid4       oc_delegate_stateid;
   1575 
   1576 };
   1577 
   1578 /*
   1579  * OPEN: Open a file, potentially receiving an open delegation
   1580  */
   1581 struct OPEN4args {
   1582         seqid4          seqid;
   1583         uint32_t        share_access;
   1584         uint32_t        share_deny;
   1585         open_owner4     owner;
   1586         openflag4       openhow;
   1587         open_claim4     claim;
   1588 };
   1589 
   1590 struct open_read_delegation4 {
   1591  stateid4 stateid;    /* Stateid for delegation*/
   1592  bool     recall;     /* Pre-recalled flag for
   1593                          delegations obtained
   1594                          by reclaim (CLAIM_PREVIOUS) */
   1595 
   1596  nfsace4 permissions; /* Defines users who don't
   1597                          need an ACCESS call to
   1598                          open for read */
   1599 };
   1600 
   1601 struct open_write_delegation4 {
   1602  stateid4 stateid;      /* Stateid for delegation */
   1603  bool     recall;       /* Pre-recalled flag for
   1604                            delegations obtained
   1605                            by reclaim
   1606                            (CLAIM_PREVIOUS) */
   1607 
   1608  nfs_space_limit4
   1609            space_limit; /* Defines condition that
   1610                            the client must check to
   1611                            determine whether the
   1612                            file needs to be flushed
   1613                            to the server on close.  */
   1614 
   1615  nfsace4   permissions; /* Defines users who don't
   1616                            need an ACCESS call as
   1617                            part of a delegated
   1618                            open. */
   1619 };
   1620 
   1621 
   1622 enum why_no_delegation4 { /* new to v4.1 */
   1623         WND4_NOT_WANTED         = 0,
   1624         WND4_CONTENTION         = 1,
   1625         WND4_RESOURCE           = 2,
   1626         WND4_NOT_SUPP_FTYPE     = 3,
   1627         WND4_WRITE_DELEG_NOT_SUPP_FTYPE = 4,
   1628         WND4_NOT_SUPP_UPGRADE   = 5,
   1629         WND4_NOT_SUPP_DOWNGRADE = 6,
   1630         WND4_CANCELED           = 7,
   1631         WND4_IS_DIR             = 8
   1632 };
   1633 
   1634 union open_none_delegation4 /* new to v4.1 */
   1635 switch (why_no_delegation4 ond_why) {
   1636         case WND4_CONTENTION:
   1637                 bool ond_server_will_push_deleg;
   1638         case WND4_RESOURCE:
   1639                 bool ond_server_will_signal_avail;
   1640         default:
   1641                 void;
   1642 };
   1643 
   1644 union open_delegation4
   1645 switch (open_delegation_type4 delegation_type) {
   1646         case OPEN_DELEGATE_NONE:
   1647                 void;
   1648         case OPEN_DELEGATE_READ:
   1649                 open_read_delegation4 read;
   1650         case OPEN_DELEGATE_WRITE:
   1651                 open_write_delegation4 write;
   1652         case OPEN_DELEGATE_NONE_EXT: /* new to v4.1 */
   1653                 open_none_delegation4 od_whynone;
   1654 };
   1655 
   1656 /*
   1657  * Result flags
   1658  */
   1659 
   1660 /* Client must confirm open */
   1661 const OPEN4_RESULT_CONFIRM      = 0x00000002;
   1662 /* Type of file locking behavior at the server */
   1663 const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004;
   1664 /* Server will preserve file if removed while open */
   1665 const OPEN4_RESULT_PRESERVE_UNLINKED = 0x00000008;
   1666 
   1667 /*
   1668  * Server may use CB_NOTIFY_LOCK on locks
   1669  * derived from this open
   1670  */
   1671 const OPEN4_RESULT_MAY_NOTIFY_LOCK = 0x00000020;
   1672 
   1673 struct OPEN4resok {
   1674  stateid4       stateid;      /* Stateid for open */
   1675  change_info4   cinfo;        /* Directory Change Info */
   1676  uint32_t       rflags;       /* Result flags */
   1677  bitmap4        attrset;      /* attribute set for create*/
   1678  open_delegation4 delegation; /* Info on any open
   1679                                  delegation */
   1680 };
   1681 
   1682 union OPEN4res switch (nfsstat4 status) {
   1683  case NFS4_OK:
   1684         /* New CURRENT_FH: opened file */
   1685         OPEN4resok      resok4;
   1686  default:
   1687         void;
   1688 };
   1689 
   1690 struct OPENATTR4args {
   1691         /* CURRENT_FH: object */
   1692         bool    createdir;
   1693 };
   1694 
   1695 struct OPENATTR4res {
   1696         /*
   1697          * If status is NFS4_OK,
   1698          *   new CURRENT_FH: named attribute
   1699          *                   directory
   1700          */
   1701         nfsstat4        status;
   1702 };
   1703 
   1704 /* obsolete in NFSv4.1 */
   1705 struct OPEN_CONFIRM4args {
   1706         /* CURRENT_FH: opened file */
   1707         stateid4        open_stateid;
   1708         seqid4          seqid;
   1709 };
   1710 
   1711 struct OPEN_CONFIRM4resok {
   1712         stateid4        open_stateid;
   1713 };
   1714 
   1715 union OPEN_CONFIRM4res switch (nfsstat4 status) {
   1716  case NFS4_OK:
   1717          OPEN_CONFIRM4resok     resok4;
   1718  default:
   1719          void;
   1720 };
   1721 
   1722 struct OPEN_DOWNGRADE4args {
   1723         /* CURRENT_FH: opened file */
   1724         stateid4        open_stateid;
   1725         seqid4          seqid;
   1726         uint32_t        share_access;
   1727         uint32_t        share_deny;
   1728 };
   1729 
   1730 struct OPEN_DOWNGRADE4resok {
   1731         stateid4        open_stateid;
   1732 };
   1733 
   1734 union OPEN_DOWNGRADE4res switch(nfsstat4 status) {
   1735  case NFS4_OK:
   1736         OPEN_DOWNGRADE4resok    resok4;
   1737  default:
   1738          void;
   1739 };
   1740 
   1741 struct PUTFH4args {
   1742         nfs_fh4         object;
   1743 };
   1744 
   1745 struct PUTFH4res {
   1746         /*
   1747          * If status is NFS4_OK,
   1748          *    new CURRENT_FH: argument to PUTFH
   1749          */
   1750         nfsstat4        status;
   1751 };
   1752 
   1753 struct PUTPUBFH4res {
   1754         /*
   1755          * If status is NFS4_OK,
   1756          *   new CURRENT_FH: public fh
   1757          */
   1758         nfsstat4        status;
   1759 };
   1760 
   1761 struct PUTROOTFH4res {
   1762         /*
   1763          * If status is NFS4_OK,
   1764          *   new CURRENT_FH: root fh
   1765          */
   1766         nfsstat4        status;
   1767 };
   1768 
   1769 struct READ4args {
   1770         /* CURRENT_FH: file */
   1771         stateid4        stateid;
   1772         offset4         offset;
   1773         count4          count;
   1774 };
   1775 
   1776 struct READ4resok {
   1777         bool            eof;
   1778         opaque          data<>;
   1779 };
   1780 
   1781 union READ4res switch (nfsstat4 status) {
   1782  case NFS4_OK:
   1783          READ4resok     resok4;
   1784  default:
   1785          void;
   1786 };
   1787 
   1788 struct READDIR4args {
   1789         /* CURRENT_FH: directory */
   1790         nfs_cookie4     cookie;
   1791         verifier4       cookieverf;
   1792         count4          dircount;
   1793         count4          maxcount;
   1794         bitmap4         attr_request;
   1795 };
   1796 
   1797 struct entry4 {
   1798         nfs_cookie4     cookie;
   1799         component4      name;
   1800         fattr4          attrs;
   1801         entry4          *nextentry;
   1802 };
   1803 
   1804 struct dirlist4 {
   1805         entry4          *entries;
   1806         bool            eof;
   1807 };
   1808 
   1809 struct READDIR4resok {
   1810         verifier4       cookieverf;
   1811         dirlist4        reply;
   1812 };
   1813 
   1814 
   1815 union READDIR4res switch (nfsstat4 status) {
   1816  case NFS4_OK:
   1817          READDIR4resok  resok4;
   1818  default:
   1819          void;
   1820 };
   1821 
   1822 
   1823 struct READLINK4resok {
   1824         linktext4       link;
   1825 };
   1826 
   1827 union READLINK4res switch (nfsstat4 status) {
   1828  case NFS4_OK:
   1829          READLINK4resok resok4;
   1830  default:
   1831          void;
   1832 };
   1833 
   1834 struct REMOVE4args {
   1835         /* CURRENT_FH: directory */
   1836         component4      target;
   1837 };
   1838 
   1839 struct REMOVE4resok {
   1840         change_info4    cinfo;
   1841 };
   1842 
   1843 union REMOVE4res switch (nfsstat4 status) {
   1844  case NFS4_OK:
   1845          REMOVE4resok   resok4;
   1846  default:
   1847          void;
   1848 };
   1849 
   1850 struct RENAME4args {
   1851         /* SAVED_FH: source directory */
   1852         component4      oldname;
   1853         /* CURRENT_FH: target directory */
   1854         component4      newname;
   1855 };
   1856 
   1857 struct RENAME4resok {
   1858         change_info4    source_cinfo;
   1859         change_info4    target_cinfo;
   1860 };
   1861 
   1862 union RENAME4res switch (nfsstat4 status) {
   1863  case NFS4_OK:
   1864         RENAME4resok    resok4;
   1865  default:
   1866         void;
   1867 };
   1868 
   1869 /* Obsolete in NFSv4.1 */
   1870 struct RENEW4args {
   1871         clientid4       clientid;
   1872 };
   1873 
   1874 struct RENEW4res {
   1875         nfsstat4        status;
   1876 };
   1877 
   1878 struct RESTOREFH4res {
   1879         /*
   1880          * If status is NFS4_OK,
   1881          *     new CURRENT_FH: value of saved fh
   1882          */
   1883         nfsstat4        status;
   1884 };
   1885 
   1886 struct SAVEFH4res {
   1887         /*
   1888          * If status is NFS4_OK,
   1889          *    new SAVED_FH: value of current fh
   1890          */
   1891         nfsstat4        status;
   1892 };
   1893 
   1894 struct SECINFO4args {
   1895         /* CURRENT_FH: directory */
   1896         component4      name;
   1897 };
   1898 
   1899 /*
   1900  * From RFC 2203
   1901  */
   1902 enum rpc_gss_svc_t {
   1903         RPC_GSS_SVC_NONE        = 1,
   1904         RPC_GSS_SVC_INTEGRITY   = 2,
   1905         RPC_GSS_SVC_PRIVACY     = 3
   1906 };
   1907 
   1908 struct rpcsec_gss_info {
   1909         sec_oid4        oid;
   1910         qop4            qop;
   1911         rpc_gss_svc_t   service;
   1912 };
   1913 
   1914 /* RPCSEC_GSS has a value of '6' - See RFC 2203 */
   1915 union secinfo4 switch (uint32_t flavor) {
   1916  case RPCSEC_GSS:
   1917          rpcsec_gss_info        flavor_info;
   1918  default:
   1919          void;
   1920 };
   1921 
   1922 typedef secinfo4 SECINFO4resok<>;
   1923 
   1924 union SECINFO4res switch (nfsstat4 status) {
   1925  case NFS4_OK:
   1926         /* CURRENTFH: consumed */
   1927          SECINFO4resok resok4;
   1928  default:
   1929          void;
   1930 };
   1931 
   1932 struct SETATTR4args {
   1933         /* CURRENT_FH: target object */
   1934         stateid4        stateid;
   1935         fattr4          obj_attributes;
   1936 };
   1937 
   1938 struct SETATTR4res {
   1939         nfsstat4        status;
   1940         bitmap4         attrsset;
   1941 };
   1942 
   1943 /* Obsolete in NFSv4.1 */
   1944 struct SETCLIENTID4args {
   1945         nfs_client_id4  client;
   1946         cb_client4      callback;
   1947         uint32_t        callback_ident;
   1948 };
   1949 
   1950 struct SETCLIENTID4resok {
   1951         clientid4       clientid;
   1952         verifier4       setclientid_confirm;
   1953 };
   1954 
   1955 union SETCLIENTID4res switch (nfsstat4 status) {
   1956  case NFS4_OK:
   1957          SETCLIENTID4resok      resok4;
   1958  case NFS4ERR_CLID_INUSE:
   1959          clientaddr4    client_using;
   1960  default:
   1961          void;
   1962 };
   1963 
   1964 /* Obsolete in NFSv4.1 */
   1965 struct SETCLIENTID_CONFIRM4args {
   1966         clientid4       clientid;
   1967         verifier4       setclientid_confirm;
   1968 };
   1969 
   1970 struct SETCLIENTID_CONFIRM4res {
   1971         nfsstat4        status;
   1972 };
   1973 
   1974 struct VERIFY4args {
   1975         /* CURRENT_FH: object */
   1976         fattr4          obj_attributes;
   1977 };
   1978 
   1979 struct VERIFY4res {
   1980         nfsstat4        status;
   1981 };
   1982 
   1983 enum stable_how4 {
   1984         UNSTABLE4       = 0,
   1985         DATA_SYNC4      = 1,
   1986         FILE_SYNC4      = 2
   1987 };
   1988 
   1989 struct WRITE4args {
   1990         /* CURRENT_FH: file */
   1991         stateid4        stateid;
   1992         offset4         offset;
   1993         stable_how4     stable;
   1994         opaque          data<>;
   1995 };
   1996 
   1997 struct WRITE4resok {
   1998         count4          count;
   1999         stable_how4     committed;
   2000         verifier4       writeverf;
   2001 };
   2002 
   2003 union WRITE4res switch (nfsstat4 status) {
   2004  case NFS4_OK:
   2005          WRITE4resok    resok4;
   2006  default:
   2007          void;
   2008 };
   2009 
   2010 /* Obsolete in NFSv4.1 */
   2011 struct RELEASE_LOCKOWNER4args {
   2012         lock_owner4     lock_owner;
   2013 };
   2014 
   2015 struct RELEASE_LOCKOWNER4res {
   2016         nfsstat4        status;
   2017 };
   2018 
   2019 struct ILLEGAL4res {
   2020         nfsstat4        status;
   2021 };
   2022 
   2023 typedef opaque gsshandle4_t<>;
   2024 
   2025 struct gss_cb_handles4 {
   2026         rpc_gss_svc_t           gcbp_service; /* RFC 2203 */
   2027         gsshandle4_t            gcbp_handle_from_server;
   2028         gsshandle4_t            gcbp_handle_from_client;
   2029 };
   2030 
   2031 union callback_sec_parms4 switch (uint32_t cb_secflavor) {
   2032 case AUTH_NONE:
   2033         void;
   2034 case AUTH_SYS:
   2035         authsys_parms   cbsp_sys_cred; /* RFC 1831 */
   2036 case RPCSEC_GSS:
   2037         gss_cb_handles4 cbsp_gss_handles;
   2038 };
   2039 
   2040 struct BACKCHANNEL_CTL4args {
   2041         uint32_t                bca_cb_program;
   2042         callback_sec_parms4     bca_sec_parms<>;
   2043 };
   2044 
   2045 struct BACKCHANNEL_CTL4res {
   2046         nfsstat4                bcr_status;
   2047 };
   2048 
   2049 enum channel_dir_from_client4 {
   2050  CDFC4_FORE             = 0x1,
   2051  CDFC4_BACK             = 0x2,
   2052  CDFC4_FORE_OR_BOTH     = 0x3,
   2053  CDFC4_BACK_OR_BOTH     = 0x7
   2054 };
   2055 
   2056 struct BIND_CONN_TO_SESSION4args {
   2057  sessionid4     bctsa_sessid;
   2058 
   2059  channel_dir_from_client4
   2060                 bctsa_dir;
   2061 
   2062  bool           bctsa_use_conn_in_rdma_mode;
   2063 };
   2064 
   2065 enum channel_dir_from_server4 {
   2066  CDFS4_FORE     = 0x1,
   2067  CDFS4_BACK     = 0x2,
   2068  CDFS4_BOTH     = 0x3
   2069 };
   2070 
   2071 struct BIND_CONN_TO_SESSION4resok {
   2072  sessionid4     bctsr_sessid;
   2073 
   2074  channel_dir_from_server4
   2075                 bctsr_dir;
   2076 
   2077  bool           bctsr_use_conn_in_rdma_mode;
   2078 };
   2079 
   2080 union BIND_CONN_TO_SESSION4res
   2081  switch (nfsstat4 bctsr_status) {
   2082 
   2083  case NFS4_OK:
   2084   BIND_CONN_TO_SESSION4resok
   2085                 bctsr_resok4;
   2086 
   2087  default:       void;
   2088 };
   2089 
   2090 const EXCHGID4_FLAG_SUPP_MOVED_REFER    = 0x00000001;
   2091 const EXCHGID4_FLAG_SUPP_MOVED_MIGR     = 0x00000002;
   2092 
   2093 const EXCHGID4_FLAG_BIND_PRINC_STATEID  = 0x00000100;
   2094 
   2095 const EXCHGID4_FLAG_USE_NON_PNFS        = 0x00010000;
   2096 const EXCHGID4_FLAG_USE_PNFS_MDS        = 0x00020000;
   2097 const EXCHGID4_FLAG_USE_PNFS_DS         = 0x00040000;
   2098 
   2099 const EXCHGID4_FLAG_MASK_PNFS           = 0x00070000;
   2100 
   2101 const EXCHGID4_FLAG_UPD_CONFIRMED_REC_A = 0x40000000;
   2102 const EXCHGID4_FLAG_CONFIRMED_R         = 0x80000000;
   2103 
   2104 struct state_protect_ops4 {
   2105         bitmap4 spo_must_enforce;
   2106         bitmap4 spo_must_allow;
   2107 };
   2108 
   2109 struct ssv_sp_parms4 {
   2110         state_protect_ops4      ssp_ops;
   2111         sec_oid4                ssp_hash_algs<>;
   2112         sec_oid4                ssp_encr_algs<>;
   2113         uint32_t                ssp_window;
   2114         uint32_t                ssp_num_gss_handles;
   2115 };
   2116 
   2117 enum state_protect_how4 {
   2118         SP4_NONE = 0,
   2119         SP4_MACH_CRED = 1,
   2120         SP4_SSV = 2
   2121 };
   2122 
   2123 union state_protect4_a switch(state_protect_how4 spa_how) {
   2124         case SP4_NONE:
   2125                 void;
   2126         case SP4_MACH_CRED:
   2127                 state_protect_ops4      spa_mach_ops;
   2128         case SP4_SSV:
   2129                 ssv_sp_parms4           spa_ssv_parms;
   2130 };
   2131 
   2132 struct EXCHANGE_ID4args {
   2133         client_owner4           eia_clientowner;
   2134         uint32_t                eia_flags;
   2135         state_protect4_a        eia_state_protect;
   2136         nfs_impl_id4            eia_client_impl_id<1>;
   2137 };
   2138 
   2139 struct ssv_prot_info4 {
   2140  state_protect_ops4     spi_ops;
   2141  uint32_t               spi_hash_alg;
   2142  uint32_t               spi_encr_alg;
   2143  uint32_t               spi_ssv_len;
   2144  uint32_t               spi_window;
   2145  gsshandle4_t           spi_handles<>;
   2146 };
   2147 
   2148 union state_protect4_r switch(state_protect_how4 spr_how) {
   2149  case SP4_NONE:
   2150          void;
   2151  case SP4_MACH_CRED:
   2152          state_protect_ops4     spr_mach_ops;
   2153  case SP4_SSV:
   2154          ssv_prot_info4         spr_ssv_info;
   2155 };
   2156 
   2157 struct EXCHANGE_ID4resok {
   2158  clientid4        eir_clientid;
   2159  sequenceid4      eir_sequenceid;
   2160  uint32_t         eir_flags;
   2161  state_protect4_r eir_state_protect;
   2162  server_owner4    eir_server_owner;
   2163  opaque           eir_server_scope<NFS4_OPAQUE_LIMIT>;
   2164  nfs_impl_id4     eir_server_impl_id<1>;
   2165 };
   2166 
   2167 union EXCHANGE_ID4res switch (nfsstat4 eir_status) {
   2168 case NFS4_OK:
   2169  EXCHANGE_ID4resok      eir_resok4;
   2170 
   2171 default:
   2172  void;
   2173 };
   2174 
   2175 struct channel_attrs4 {
   2176         count4                  ca_headerpadsize;
   2177         count4                  ca_maxrequestsize;
   2178         count4                  ca_maxresponsesize;
   2179         count4                  ca_maxresponsesize_cached;
   2180         count4                  ca_maxoperations;
   2181         count4                  ca_maxrequests;
   2182         uint32_t                ca_rdma_ird<1>;
   2183 };
   2184 
   2185 const CREATE_SESSION4_FLAG_PERSIST              = 0x00000001;
   2186 const CREATE_SESSION4_FLAG_CONN_BACK_CHAN       = 0x00000002;
   2187 const CREATE_SESSION4_FLAG_CONN_RDMA            = 0x00000004;
   2188 
   2189 struct CREATE_SESSION4args {
   2190         clientid4               csa_clientid;
   2191         sequenceid4             csa_sequence;
   2192 
   2193         uint32_t                csa_flags;
   2194 
   2195         channel_attrs4          csa_fore_chan_attrs;
   2196         channel_attrs4          csa_back_chan_attrs;
   2197 
   2198         uint32_t                csa_cb_program;
   2199         callback_sec_parms4     csa_sec_parms<>;
   2200 };
   2201 
   2202 struct CREATE_SESSION4resok {
   2203         sessionid4              csr_sessionid;
   2204         sequenceid4             csr_sequence;
   2205 
   2206         uint32_t                csr_flags;
   2207 
   2208         channel_attrs4          csr_fore_chan_attrs;
   2209         channel_attrs4          csr_back_chan_attrs;
   2210 };
   2211 
   2212 union CREATE_SESSION4res switch (nfsstat4 csr_status) {
   2213 case NFS4_OK:
   2214         CREATE_SESSION4resok    csr_resok4;
   2215 default:
   2216         void;
   2217 };
   2218 
   2219 struct DESTROY_SESSION4args {
   2220         sessionid4      dsa_sessionid;
   2221 };
   2222 
   2223 struct DESTROY_SESSION4res {
   2224         nfsstat4        dsr_status;
   2225 };
   2226 
   2227 struct FREE_STATEID4args {
   2228         stateid4        fsa_stateid;
   2229 };
   2230 
   2231 struct FREE_STATEID4res {
   2232         nfsstat4        fsr_status;
   2233 };
   2234 
   2235 
   2236 typedef nfstime4 attr_notice4;
   2237 
   2238 struct GET_DIR_DELEGATION4args {
   2239         /* CURRENT_FH: delegated directory */
   2240         bool            gdda_signal_deleg_avail;
   2241         bitmap4         gdda_notification_types;
   2242         attr_notice4    gdda_child_attr_delay;
   2243         attr_notice4    gdda_dir_attr_delay;
   2244         bitmap4         gdda_child_attributes;
   2245         bitmap4         gdda_dir_attributes;
   2246 };
   2247 struct GET_DIR_DELEGATION4resok {
   2248         verifier4       gddr_cookieverf;
   2249         /* Stateid for get_dir_delegation */
   2250         stateid4        gddr_stateid;
   2251         /* Which notifications can the server support */
   2252         bitmap4         gddr_notification;
   2253         bitmap4         gddr_child_attributes;
   2254         bitmap4         gddr_dir_attributes;
   2255 };
   2256 
   2257 enum gddrnf4_status {
   2258         GDD4_OK         = 0,
   2259         GDD4_UNAVAIL    = 1
   2260 };
   2261 
   2262 union GET_DIR_DELEGATION4res_non_fatal
   2263  switch (gddrnf4_status gddrnf_status) {
   2264  case GDD4_OK:
   2265   GET_DIR_DELEGATION4resok      gddrnf_resok4;
   2266  case GDD4_UNAVAIL:
   2267   bool                          gddrnf_will_signal_deleg_avail;
   2268 };
   2269 
   2270 union GET_DIR_DELEGATION4res
   2271  switch (nfsstat4 gddr_status) {
   2272  case NFS4_OK:
   2273   GET_DIR_DELEGATION4res_non_fatal      gddr_res_non_fatal4;
   2274  default:
   2275   void;
   2276 };
   2277 
   2278 struct GETDEVICEINFO4args {
   2279         deviceid4       gdia_device_id;
   2280         layouttype4     gdia_layout_type;
   2281         count4          gdia_maxcount;
   2282         bitmap4         gdia_notify_types;
   2283 };
   2284 
   2285 struct GETDEVICEINFO4resok {
   2286         device_addr4    gdir_device_addr;
   2287         bitmap4         gdir_notification;
   2288 };
   2289 
   2290 union GETDEVICEINFO4res switch (nfsstat4 gdir_status) {
   2291 case NFS4_OK:
   2292         GETDEVICEINFO4resok     gdir_resok4;
   2293 case NFS4ERR_TOOSMALL:
   2294         count4                  gdir_mincount;
   2295 default:
   2296         void;
   2297 };
   2298 
   2299 struct GETDEVICELIST4args {
   2300         /* CURRENT_FH: object belonging to the file system */
   2301         layouttype4     gdla_layout_type;
   2302 
   2303         /* number of deviceIDs to return */
   2304         count4          gdla_maxdevices;
   2305 
   2306         nfs_cookie4     gdla_cookie;
   2307         verifier4       gdla_cookieverf;
   2308 };
   2309 
   2310 struct GETDEVICELIST4resok {
   2311         nfs_cookie4             gdlr_cookie;
   2312         verifier4               gdlr_cookieverf;
   2313         deviceid4               gdlr_deviceid_list<>;
   2314         bool                    gdlr_eof;
   2315 };
   2316 
   2317 union GETDEVICELIST4res switch (nfsstat4 gdlr_status) {
   2318 case NFS4_OK:
   2319         GETDEVICELIST4resok     gdlr_resok4;
   2320 default:
   2321         void;
   2322 };
   2323 
   2324 union newtime4 switch (bool nt_timechanged) {
   2325 case TRUE:
   2326         nfstime4           nt_time;
   2327 case FALSE:
   2328         void;
   2329 };
   2330 
   2331 union newoffset4 switch (bool no_newoffset) {
   2332 case TRUE:
   2333         offset4           no_offset;
   2334 case FALSE:
   2335         void;
   2336 };
   2337 
   2338 struct LAYOUTCOMMIT4args {
   2339         /* CURRENT_FH: file */
   2340         offset4                 loca_offset;
   2341         length4                 loca_length;
   2342         bool                    loca_reclaim;
   2343         stateid4                loca_stateid;
   2344         newoffset4              loca_last_write_offset;
   2345         newtime4                loca_time_modify;
   2346         layoutupdate4           loca_layoutupdate;
   2347 };
   2348 union newsize4 switch (bool ns_sizechanged) {
   2349 case TRUE:
   2350         length4         ns_size;
   2351 case FALSE:
   2352         void;
   2353 };
   2354 
   2355 struct LAYOUTCOMMIT4resok {
   2356         newsize4                locr_newsize;
   2357 };
   2358 
   2359 union LAYOUTCOMMIT4res switch (nfsstat4 locr_status) {
   2360 case NFS4_OK:
   2361         LAYOUTCOMMIT4resok      locr_resok4;
   2362 default:
   2363         void;
   2364 };
   2365 
   2366 struct LAYOUTGET4args {
   2367         /* CURRENT_FH: file */
   2368         bool                    loga_signal_layout_avail;
   2369         layouttype4             loga_layout_type;
   2370         layoutiomode4           loga_iomode;
   2371         offset4                 loga_offset;
   2372         length4                 loga_length;
   2373         length4                 loga_minlength;
   2374         stateid4                loga_stateid;
   2375         count4                  loga_maxcount;
   2376 };
   2377 struct LAYOUTGET4resok {
   2378         bool               logr_return_on_close;
   2379         stateid4           logr_stateid;
   2380         layout4            logr_layout<>;
   2381 };
   2382 
   2383 union LAYOUTGET4res switch (nfsstat4 logr_status) {
   2384 case NFS4_OK:
   2385         LAYOUTGET4resok     logr_resok4;
   2386 case NFS4ERR_LAYOUTTRYLATER:
   2387         bool                logr_will_signal_layout_avail;
   2388 default:
   2389         void;
   2390 };
   2391 
   2392 
   2393 struct LAYOUTRETURN4args {
   2394         /* CURRENT_FH: file */
   2395         bool                    lora_reclaim;
   2396         layouttype4             lora_layout_type;
   2397         layoutiomode4           lora_iomode;
   2398         layoutreturn4           lora_layoutreturn;
   2399 };
   2400 
   2401 
   2402 union layoutreturn_stateid switch (bool lrs_present) {
   2403 case TRUE:
   2404         stateid4                lrs_stateid;
   2405 case FALSE:
   2406         void;
   2407 };
   2408 
   2409 union LAYOUTRETURN4res switch (nfsstat4 lorr_status) {
   2410 case NFS4_OK:
   2411         layoutreturn_stateid    lorr_stateid;
   2412 default:
   2413         void;
   2414 };
   2415 
   2416 enum secinfo_style4 {
   2417         SECINFO_STYLE4_CURRENT_FH       = 0,
   2418         SECINFO_STYLE4_PARENT           = 1
   2419 };
   2420 
   2421 /* CURRENT_FH: object or child directory */
   2422 typedef secinfo_style4 SECINFO_NO_NAME4args;
   2423 
   2424 /* CURRENTFH: consumed if status is NFS4_OK */
   2425 typedef SECINFO4res SECINFO_NO_NAME4res;
   2426 
   2427 struct SEQUENCE4args {
   2428         sessionid4     sa_sessionid;
   2429         sequenceid4    sa_sequenceid;
   2430         slotid4        sa_slotid;
   2431         slotid4        sa_highest_slotid;
   2432         bool           sa_cachethis;
   2433 };
   2434 
   2435 const SEQ4_STATUS_CB_PATH_DOWN                  = 0x00000001;
   2436 const SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING      = 0x00000002;
   2437 const SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED       = 0x00000004;
   2438 const SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED     = 0x00000008;
   2439 const SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED    = 0x00000010;
   2440 const SEQ4_STATUS_ADMIN_STATE_REVOKED           = 0x00000020;
   2441 const SEQ4_STATUS_RECALLABLE_STATE_REVOKED      = 0x00000040;
   2442 const SEQ4_STATUS_LEASE_MOVED                   = 0x00000080;
   2443 const SEQ4_STATUS_RESTART_RECLAIM_NEEDED        = 0x00000100;
   2444 const SEQ4_STATUS_CB_PATH_DOWN_SESSION          = 0x00000200;
   2445 const SEQ4_STATUS_BACKCHANNEL_FAULT             = 0x00000400;
   2446 const SEQ4_STATUS_DEVID_CHANGED                 = 0x00000800;
   2447 const SEQ4_STATUS_DEVID_DELETED                 = 0x00001000;
   2448 
   2449 struct SEQUENCE4resok {
   2450         sessionid4      sr_sessionid;
   2451         sequenceid4     sr_sequenceid;
   2452         slotid4         sr_slotid;
   2453         slotid4         sr_highest_slotid;
   2454         slotid4         sr_target_highest_slotid;
   2455         uint32_t        sr_status_flags;
   2456 };
   2457 
   2458 union SEQUENCE4res switch (nfsstat4 sr_status) {
   2459 case NFS4_OK:
   2460         SEQUENCE4resok  sr_resok4;
   2461 default:
   2462         void;
   2463 };
   2464 
   2465 struct ssa_digest_input4 {
   2466         SEQUENCE4args sdi_seqargs;
   2467 };
   2468 
   2469 struct SET_SSV4args {
   2470         opaque          ssa_ssv<>;
   2471         opaque          ssa_digest<>;
   2472 };
   2473 
   2474 struct ssr_digest_input4 {
   2475         SEQUENCE4res sdi_seqres;
   2476 };
   2477 
   2478 struct SET_SSV4resok {
   2479         opaque          ssr_digest<>;
   2480 };
   2481 
   2482 union SET_SSV4res switch (nfsstat4 ssr_status) {
   2483 case NFS4_OK:
   2484         SET_SSV4resok   ssr_resok4;
   2485 default:
   2486         void;
   2487 };
   2488 
   2489 struct TEST_STATEID4args {
   2490         stateid4        ts_stateids<>;
   2491 };
   2492 
   2493 struct TEST_STATEID4resok {
   2494         nfsstat4        tsr_status_codes<>;
   2495 };
   2496 
   2497 union TEST_STATEID4res switch (nfsstat4 tsr_status) {
   2498     case NFS4_OK:
   2499         TEST_STATEID4resok tsr_resok4;
   2500     default:
   2501         void;
   2502 };
   2503 
   2504 union deleg_claim4 switch (open_claim_type4 dc_claim) {
   2505 /*
   2506  * No special rights to object. Ordinary delegation
   2507  * request of the specified object. Object identified
   2508  * by filehandle.
   2509  */
   2510 case CLAIM_FH: /* new to v4.1 */
   2511         /* CURRENT_FH: object being delegated */
   2512         void;
   2513 
   2514 /*
   2515  * Right to file based on a delegation granted
   2516  * to a previous boot instance of the client.
   2517  * File is specified by filehandle.
   2518  */
   2519 case CLAIM_DELEG_PREV_FH: /* new to v4.1 */
   2520         /* CURRENT_FH: object being delegated */
   2521         void;
   2522 
   2523 /*
   2524  * Right to the file established by an open previous
   2525  * to server reboot.  File identified by filehandle.
   2526  * Used during server reclaim grace period.
   2527  */
   2528 case CLAIM_PREVIOUS:
   2529         /* CURRENT_FH: object being reclaimed */
   2530         open_delegation_type4   dc_delegate_type;
   2531 };
   2532 
   2533 struct WANT_DELEGATION4args {
   2534         uint32_t        wda_want;
   2535         deleg_claim4    wda_claim;
   2536 };
   2537 
   2538 union WANT_DELEGATION4res switch (nfsstat4 wdr_status) {
   2539 case NFS4_OK:
   2540         open_delegation4 wdr_resok4;
   2541 default:
   2542         void;
   2543 };
   2544 
   2545 struct DESTROY_CLIENTID4args {
   2546         clientid4       dca_clientid;
   2547 };
   2548 
   2549 struct DESTROY_CLIENTID4res {
   2550         nfsstat4        dcr_status;
   2551 };
   2552 
   2553 struct RECLAIM_COMPLETE4args {
   2554         /*
   2555          * If rca_one_fs TRUE,
   2556          *
   2557          *    CURRENT_FH: object in
   2558          *    filesystem reclaim is
   2559          *    complete for.
   2560          */
   2561         bool            rca_one_fs;
   2562 };
   2563 
   2564 struct RECLAIM_COMPLETE4res {
   2565         nfsstat4        rcr_status;
   2566 };
   2567 
   2568 /*
   2569  * Operation arrays
   2570  */
   2571 
   2572 enum nfs_opnum4 {
   2573  OP_ACCESS              = 3,
   2574  OP_CLOSE               = 4,
   2575  OP_COMMIT              = 5,
   2576  OP_CREATE              = 6,
   2577  OP_DELEGPURGE          = 7,
   2578  OP_DELEGRETURN         = 8,
   2579  OP_GETATTR             = 9,
   2580  OP_GETFH               = 10,
   2581  OP_LINK                = 11,
   2582  OP_LOCK                = 12,
   2583  OP_LOCKT               = 13,
   2584  OP_LOCKU               = 14,
   2585  OP_LOOKUP              = 15,
   2586  OP_LOOKUPP             = 16,
   2587  OP_NVERIFY             = 17,
   2588  OP_OPEN                = 18,
   2589  OP_OPENATTR            = 19,
   2590  OP_OPEN_CONFIRM        = 20, /* Mandatory not-to-implement */
   2591  OP_OPEN_DOWNGRADE      = 21,
   2592  OP_PUTFH               = 22,
   2593  OP_PUTPUBFH            = 23,
   2594  OP_PUTROOTFH           = 24,
   2595  OP_READ                = 25,
   2596  OP_READDIR             = 26,
   2597  OP_READLINK            = 27,
   2598  OP_REMOVE              = 28,
   2599  OP_RENAME              = 29,
   2600  OP_RENEW               = 30, /* Mandatory not-to-implement */
   2601  OP_RESTOREFH           = 31,
   2602  OP_SAVEFH              = 32,
   2603  OP_SECINFO             = 33,
   2604  OP_SETATTR             = 34,
   2605  OP_SETCLIENTID         = 35, /* Mandatory not-to-implement */
   2606  OP_SETCLIENTID_CONFIRM = 36, /* Mandatory not-to-implement */
   2607  OP_VERIFY              = 37,
   2608  OP_WRITE               = 38,
   2609  OP_RELEASE_LOCKOWNER   = 39, /* Mandatory not-to-implement */
   2610 %
   2611 %/* new operations for NFSv4.1 */
   2612 %
   2613  OP_BACKCHANNEL_CTL     = 40,
   2614  OP_BIND_CONN_TO_SESSION = 41,
   2615  OP_EXCHANGE_ID         = 42,
   2616  OP_CREATE_SESSION      = 43,
   2617  OP_DESTROY_SESSION     = 44,
   2618  OP_FREE_STATEID        = 45,
   2619  OP_GET_DIR_DELEGATION  = 46,
   2620  OP_GETDEVICEINFO       = 47,
   2621  OP_GETDEVICELIST       = 48,
   2622  OP_LAYOUTCOMMIT        = 49,
   2623  OP_LAYOUTGET           = 50,
   2624  OP_LAYOUTRETURN        = 51,
   2625  OP_SECINFO_NO_NAME     = 52,
   2626  OP_SEQUENCE            = 53,
   2627  OP_SET_SSV             = 54,
   2628  OP_TEST_STATEID        = 55,
   2629  OP_WANT_DELEGATION     = 56,
   2630  OP_DESTROY_CLIENTID    = 57,
   2631  OP_RECLAIM_COMPLETE    = 58,
   2632  OP_ILLEGAL             = 10044
   2633 };
   2634 
   2635 union nfs_argop4 switch (nfs_opnum4 argop) {
   2636  case OP_ACCESS:        ACCESS4args opaccess;
   2637  case OP_CLOSE:         CLOSE4args opclose;
   2638  case OP_COMMIT:        COMMIT4args opcommit;
   2639  case OP_CREATE:        CREATE4args opcreate;
   2640  case OP_DELEGPURGE:    DELEGPURGE4args opdelegpurge;
   2641  case OP_DELEGRETURN:   DELEGRETURN4args opdelegreturn;
   2642  case OP_GETATTR:       GETATTR4args opgetattr;
   2643  case OP_GETFH:         void;
   2644  case OP_LINK:          LINK4args oplink;
   2645  case OP_LOCK:          LOCK4args oplock;
   2646  case OP_LOCKT:         LOCKT4args oplockt;
   2647  case OP_LOCKU:         LOCKU4args oplocku;
   2648  case OP_LOOKUP:        LOOKUP4args oplookup;
   2649  case OP_LOOKUPP:       void;
   2650  case OP_NVERIFY:       NVERIFY4args opnverify;
   2651  case OP_OPEN:          OPEN4args opopen;
   2652  case OP_OPENATTR:      OPENATTR4args opopenattr;
   2653 
   2654  /* Not for NFSv4.1 */
   2655  case OP_OPEN_CONFIRM:  OPEN_CONFIRM4args opopen_confirm;
   2656 
   2657  case OP_OPEN_DOWNGRADE:
   2658                         OPEN_DOWNGRADE4args opopen_downgrade;
   2659 
   2660  case OP_PUTFH:         PUTFH4args opputfh;
   2661  case OP_PUTPUBFH:      void;
   2662  case OP_PUTROOTFH:     void;
   2663  case OP_READ:          READ4args opread;
   2664  case OP_READDIR:       READDIR4args opreaddir;
   2665  case OP_READLINK:      void;
   2666  case OP_REMOVE:        REMOVE4args opremove;
   2667  case OP_RENAME:        RENAME4args oprename;
   2668 
   2669  /* Not for NFSv4.1 */
   2670  case OP_RENEW:         RENEW4args oprenew;
   2671 
   2672  case OP_RESTOREFH:     void;
   2673  case OP_SAVEFH:        void;
   2674  case OP_SECINFO:       SECINFO4args opsecinfo;
   2675  case OP_SETATTR:       SETATTR4args opsetattr;
   2676 
   2677  /* Not for NFSv4.1 */
   2678  case OP_SETCLIENTID: SETCLIENTID4args opsetclientid;
   2679 
   2680  /* Not for NFSv4.1 */
   2681  case OP_SETCLIENTID_CONFIRM: SETCLIENTID_CONFIRM4args
   2682                                 opsetclientid_confirm;
   2683  case OP_VERIFY:        VERIFY4args opverify;
   2684  case OP_WRITE:         WRITE4args opwrite;
   2685 
   2686  /* Not for NFSv4.1 */
   2687  case OP_RELEASE_LOCKOWNER:
   2688                         RELEASE_LOCKOWNER4args
   2689                         oprelease_lockowner;
   2690 
   2691  /* Operations new to NFSv4.1 */
   2692  case OP_BACKCHANNEL_CTL:
   2693                         BACKCHANNEL_CTL4args opbackchannel_ctl;
   2694 
   2695  case OP_BIND_CONN_TO_SESSION:
   2696                         BIND_CONN_TO_SESSION4args
   2697                         opbind_conn_to_session;
   2698 
   2699  case OP_EXCHANGE_ID:   EXCHANGE_ID4args opexchange_id;
   2700 
   2701  case OP_CREATE_SESSION:
   2702                         CREATE_SESSION4args opcreate_session;
   2703 
   2704  case OP_DESTROY_SESSION:
   2705                         DESTROY_SESSION4args opdestroy_session;
   2706 
   2707  case OP_FREE_STATEID:  FREE_STATEID4args opfree_stateid;
   2708 
   2709  case OP_GET_DIR_DELEGATION:
   2710                         GET_DIR_DELEGATION4args
   2711                                 opget_dir_delegation;
   2712 
   2713  case OP_GETDEVICEINFO: GETDEVICEINFO4args opgetdeviceinfo;
   2714  case OP_GETDEVICELIST: GETDEVICELIST4args opgetdevicelist;
   2715  case OP_LAYOUTCOMMIT:  LAYOUTCOMMIT4args oplayoutcommit;
   2716  case OP_LAYOUTGET:     LAYOUTGET4args oplayoutget;
   2717  case OP_LAYOUTRETURN:  LAYOUTRETURN4args oplayoutreturn;
   2718 
   2719  case OP_SECINFO_NO_NAME:
   2720                         SECINFO_NO_NAME4args opsecinfo_no_name;
   2721 
   2722  case OP_SEQUENCE:      SEQUENCE4args opsequence;
   2723  case OP_SET_SSV:       SET_SSV4args opset_ssv;
   2724  case OP_TEST_STATEID:  TEST_STATEID4args optest_stateid;
   2725 
   2726  case OP_WANT_DELEGATION:
   2727                         WANT_DELEGATION4args opwant_delegation;
   2728 
   2729  case OP_DESTROY_CLIENTID:
   2730                         DESTROY_CLIENTID4args
   2731                                 opdestroy_clientid;
   2732 
   2733  case OP_RECLAIM_COMPLETE:
   2734                         RECLAIM_COMPLETE4args
   2735                                 opreclaim_complete;
   2736 
   2737  /* Operations not new to NFSv4.1 */
   2738  case OP_ILLEGAL:       void;
   2739 };
   2740 
   2741 union nfs_resop4 switch (nfs_opnum4 resop) {
   2742  case OP_ACCESS:        ACCESS4res opaccess;
   2743  case OP_CLOSE:         CLOSE4res opclose;
   2744  case OP_COMMIT:        COMMIT4res opcommit;
   2745  case OP_CREATE:        CREATE4res opcreate;
   2746  case OP_DELEGPURGE:    DELEGPURGE4res opdelegpurge;
   2747  case OP_DELEGRETURN:   DELEGRETURN4res opdelegreturn;
   2748  case OP_GETATTR:       GETATTR4res opgetattr;
   2749  case OP_GETFH:         GETFH4res opgetfh;
   2750  case OP_LINK:          LINK4res oplink;
   2751  case OP_LOCK:          LOCK4res oplock;
   2752  case OP_LOCKT:         LOCKT4res oplockt;
   2753  case OP_LOCKU:         LOCKU4res oplocku;
   2754  case OP_LOOKUP:        LOOKUP4res oplookup;
   2755  case OP_LOOKUPP:       LOOKUPP4res oplookupp;
   2756  case OP_NVERIFY:       NVERIFY4res opnverify;
   2757  case OP_OPEN:          OPEN4res opopen;
   2758  case OP_OPENATTR:      OPENATTR4res opopenattr;
   2759  /* Not for NFSv4.1 */
   2760  case OP_OPEN_CONFIRM:  OPEN_CONFIRM4res opopen_confirm;
   2761 
   2762  case OP_OPEN_DOWNGRADE:
   2763                         OPEN_DOWNGRADE4res
   2764                                 opopen_downgrade;
   2765 
   2766  case OP_PUTFH:         PUTFH4res opputfh;
   2767  case OP_PUTPUBFH:      PUTPUBFH4res opputpubfh;
   2768  case OP_PUTROOTFH:     PUTROOTFH4res opputrootfh;
   2769  case OP_READ:          READ4res opread;
   2770  case OP_READDIR:       READDIR4res opreaddir;
   2771  case OP_READLINK:      READLINK4res opreadlink;
   2772  case OP_REMOVE:        REMOVE4res opremove;
   2773  case OP_RENAME:        RENAME4res oprename;
   2774  /* Not for NFSv4.1 */
   2775  case OP_RENEW:         RENEW4res oprenew;
   2776  case OP_RESTOREFH:     RESTOREFH4res oprestorefh;
   2777  case OP_SAVEFH:        SAVEFH4res opsavefh;
   2778  case OP_SECINFO:       SECINFO4res opsecinfo;
   2779  case OP_SETATTR:       SETATTR4res opsetattr;
   2780  /* Not for NFSv4.1 */
   2781  case OP_SETCLIENTID: SETCLIENTID4res opsetclientid;
   2782 
   2783  /* Not for NFSv4.1 */
   2784  case OP_SETCLIENTID_CONFIRM:
   2785                         SETCLIENTID_CONFIRM4res
   2786                                 opsetclientid_confirm;
   2787  case OP_VERIFY:        VERIFY4res opverify;
   2788  case OP_WRITE:         WRITE4res opwrite;
   2789 
   2790  /* Not for NFSv4.1 */
   2791  case OP_RELEASE_LOCKOWNER:
   2792                         RELEASE_LOCKOWNER4res
   2793                                 oprelease_lockowner;
   2794 
   2795  /* Operations new to NFSv4.1 */
   2796  case OP_BACKCHANNEL_CTL:
   2797                         BACKCHANNEL_CTL4res
   2798                                 opbackchannel_ctl;
   2799 
   2800  case OP_BIND_CONN_TO_SESSION:
   2801                         BIND_CONN_TO_SESSION4res
   2802                                  opbind_conn_to_session;
   2803 
   2804  case OP_EXCHANGE_ID:   EXCHANGE_ID4res opexchange_id;
   2805 
   2806  case OP_CREATE_SESSION:
   2807                         CREATE_SESSION4res
   2808                                 opcreate_session;
   2809 
   2810  case OP_DESTROY_SESSION:
   2811                         DESTROY_SESSION4res
   2812                                 opdestroy_session;
   2813 
   2814  case OP_FREE_STATEID:  FREE_STATEID4res
   2815                                 opfree_stateid;
   2816 
   2817  case OP_GET_DIR_DELEGATION:
   2818                         GET_DIR_DELEGATION4res
   2819                                 opget_dir_delegation;
   2820 
   2821  case OP_GETDEVICEINFO: GETDEVICEINFO4res
   2822                                 opgetdeviceinfo;
   2823 
   2824  case OP_GETDEVICELIST: GETDEVICELIST4res
   2825                                 opgetdevicelist;
   2826 
   2827  case OP_LAYOUTCOMMIT:  LAYOUTCOMMIT4res oplayoutcommit;
   2828  case OP_LAYOUTGET:     LAYOUTGET4res oplayoutget;
   2829  case OP_LAYOUTRETURN:  LAYOUTRETURN4res oplayoutreturn;
   2830 
   2831  case OP_SECINFO_NO_NAME:
   2832                         SECINFO_NO_NAME4res
   2833                                 opsecinfo_no_name;
   2834 
   2835  case OP_SEQUENCE:      SEQUENCE4res opsequence;
   2836  case OP_SET_SSV:       SET_SSV4res opset_ssv;
   2837  case OP_TEST_STATEID:  TEST_STATEID4res optest_stateid;
   2838 
   2839  case OP_WANT_DELEGATION:
   2840                         WANT_DELEGATION4res
   2841                                 opwant_delegation;
   2842 
   2843  case OP_DESTROY_CLIENTID:
   2844                         DESTROY_CLIENTID4res
   2845                                 opdestroy_clientid;
   2846 
   2847  case OP_RECLAIM_COMPLETE:
   2848                         RECLAIM_COMPLETE4res
   2849                                 opreclaim_complete;
   2850 
   2851  /* Operations not new to NFSv4.1 */
   2852  case OP_ILLEGAL:       ILLEGAL4res opillegal;
   2853 };
   2854 
   2855 struct COMPOUND4args {
   2856         utf8str_cs      tag;
   2857         uint32_t        minorversion;
   2858         nfs_argop4      argarray<>;
   2859 };
   2860 
   2861 struct COMPOUND4res {
   2862         nfsstat4        status;
   2863         utf8str_cs      tag;
   2864         nfs_resop4      resarray<>;
   2865 };
   2866 
   2867 
   2868 /*
   2869  * Remote file service routines
   2870  */
   2871 program NFS4_PROGRAM {
   2872         version NFS_V4 {
   2873                 void
   2874                         NFSPROC4_NULL(void) = 0;
   2875 
   2876                 COMPOUND4res
   2877                         NFSPROC4_COMPOUND(COMPOUND4args) = 1;
   2878 
   2879         } = 4;
   2880 } = 100003;
   2881 
   2882 /*
   2883  * NFS4 Callback Procedure Definitions and Program
   2884  */
   2885 struct CB_GETATTR4args {
   2886         nfs_fh4 fh;
   2887         bitmap4 attr_request;
   2888 };
   2889 
   2890 struct CB_GETATTR4resok {
   2891         fattr4  obj_attributes;
   2892 };
   2893 
   2894 union CB_GETATTR4res switch (nfsstat4 status) {
   2895  case NFS4_OK:
   2896          CB_GETATTR4resok       resok4;
   2897  default:
   2898          void;
   2899 };
   2900 
   2901 struct CB_RECALL4args {
   2902         stateid4        stateid;
   2903         bool            truncate;
   2904         nfs_fh4         fh;
   2905 };
   2906 
   2907 struct CB_RECALL4res {
   2908         nfsstat4        status;
   2909 };
   2910 
   2911 /*
   2912  * CB_ILLEGAL: Response for illegal operation numbers
   2913  */
   2914 struct CB_ILLEGAL4res {
   2915         nfsstat4        status;
   2916 };
   2917 
   2918 /*
   2919  * NFSv4.1 callback arguments and results
   2920  */
   2921 
   2922 enum layoutrecall_type4 {
   2923         LAYOUTRECALL4_FILE = LAYOUT4_RET_REC_FILE,
   2924         LAYOUTRECALL4_FSID = LAYOUT4_RET_REC_FSID,
   2925         LAYOUTRECALL4_ALL  = LAYOUT4_RET_REC_ALL
   2926 };
   2927 
   2928 struct layoutrecall_file4 {
   2929         nfs_fh4         lor_fh;
   2930         offset4         lor_offset;
   2931         length4         lor_length;
   2932         stateid4        lor_stateid;
   2933 };
   2934 
   2935 union layoutrecall4 switch(layoutrecall_type4 lor_recalltype) {
   2936 case LAYOUTRECALL4_FILE:
   2937         layoutrecall_file4 lor_layout;
   2938 case LAYOUTRECALL4_FSID:
   2939         fsid4              lor_fsid;
   2940 case LAYOUTRECALL4_ALL:
   2941         void;
   2942 };
   2943 
   2944 struct CB_LAYOUTRECALL4args {
   2945         layouttype4             clora_type;
   2946         layoutiomode4           clora_iomode;
   2947         bool                    clora_changed;
   2948         layoutrecall4           clora_recall;
   2949 };
   2950 struct CB_LAYOUTRECALL4res {
   2951         nfsstat4        clorr_status;
   2952 };
   2953 
   2954 /*
   2955  * Directory notification types.
   2956  */
   2957 enum notify_type4 {
   2958         NOTIFY4_CHANGE_CHILD_ATTRS = 0,
   2959         NOTIFY4_CHANGE_DIR_ATTRS = 1,
   2960         NOTIFY4_REMOVE_ENTRY = 2,
   2961         NOTIFY4_ADD_ENTRY = 3,
   2962         NOTIFY4_RENAME_ENTRY = 4,
   2963         NOTIFY4_CHANGE_COOKIE_VERIFIER = 5
   2964 };
   2965 
   2966 /* Changed entry information.  */
   2967 struct notify_entry4 {
   2968         component4      ne_file;
   2969         fattr4          ne_attrs;
   2970 };
   2971 
   2972 /* Previous entry information */
   2973 struct prev_entry4 {
   2974         notify_entry4   pe_prev_entry;
   2975         /* what READDIR returned for this entry */
   2976         nfs_cookie4     pe_prev_entry_cookie;
   2977 };
   2978 
   2979 struct notify_remove4 {
   2980         notify_entry4   nrm_old_entry;
   2981         nfs_cookie4     nrm_old_entry_cookie;
   2982 };
   2983 
   2984 struct notify_add4 {
   2985         /*
   2986          * Information on object
   2987          * possibly renamed over.
   2988          */
   2989         notify_remove4      nad_old_entry<1>;
   2990         notify_entry4       nad_new_entry;
   2991         /* what READDIR would have returned for this entry */
   2992         nfs_cookie4         nad_new_entry_cookie<1>;
   2993         prev_entry4         nad_prev_entry<1>;
   2994         bool                nad_last_entry;
   2995 };
   2996 
   2997 struct notify_attr4 {
   2998         notify_entry4   na_changed_entry;
   2999 };
   3000 
   3001 struct notify_rename4 {
   3002         notify_remove4  nrn_old_entry;
   3003         notify_add4     nrn_new_entry;
   3004 };
   3005 
   3006 struct notify_verifier4 {
   3007         verifier4       nv_old_cookieverf;
   3008         verifier4       nv_new_cookieverf;
   3009 };
   3010 
   3011 /*
   3012  * Objects of type notify_<>4 and
   3013  * notify_device_<>4 are encoded in this.
   3014  */
   3015 typedef opaque notifylist4<>;
   3016 
   3017 struct notify4 {
   3018         /* composed from notify_type4 or notify_deviceid_type4 */
   3019         bitmap4         notify_mask;
   3020         notifylist4     notify_vals;
   3021 };
   3022 
   3023 struct CB_NOTIFY4args {
   3024         stateid4    cna_stateid;
   3025         nfs_fh4     cna_fh;
   3026         notify4     cna_changes<>;
   3027 };
   3028 
   3029 struct CB_NOTIFY4res {
   3030         nfsstat4    cnr_status;
   3031 };
   3032 
   3033 struct CB_PUSH_DELEG4args {
   3034         nfs_fh4          cpda_fh;
   3035         open_delegation4 cpda_delegation;
   3036 
   3037 };
   3038 
   3039 struct CB_PUSH_DELEG4res {
   3040         nfsstat4 cpdr_status;
   3041 };
   3042 
   3043 const RCA4_TYPE_MASK_RDATA_DLG          = 0;
   3044 const RCA4_TYPE_MASK_WDATA_DLG          = 1;
   3045 const RCA4_TYPE_MASK_DIR_DLG            = 2;
   3046 const RCA4_TYPE_MASK_FILE_LAYOUT        = 3;
   3047 const RCA4_TYPE_MASK_BLK_LAYOUT         = 4;
   3048 const RCA4_TYPE_MASK_OBJ_LAYOUT_MIN     = 8;
   3049 const RCA4_TYPE_MASK_OBJ_LAYOUT_MAX     = 9;
   3050 const RCA4_TYPE_MASK_OTHER_LAYOUT_MIN   = 12;
   3051 const RCA4_TYPE_MASK_OTHER_LAYOUT_MAX   = 15;
   3052 
   3053 struct  CB_RECALL_ANY4args      {
   3054         uint32_t        craa_objects_to_keep;
   3055         bitmap4         craa_type_mask;
   3056 };
   3057 
   3058 struct CB_RECALL_ANY4res {
   3059         nfsstat4        crar_status;
   3060 };
   3061 
   3062 typedef CB_RECALL_ANY4args CB_RECALLABLE_OBJ_AVAIL4args;
   3063 
   3064 struct CB_RECALLABLE_OBJ_AVAIL4res {
   3065         nfsstat4        croa_status;
   3066 };
   3067 
   3068 struct CB_RECALL_SLOT4args {
   3069         slotid4       rsa_target_highest_slotid;
   3070 };
   3071 
   3072 struct CB_RECALL_SLOT4res {
   3073         nfsstat4   rsr_status;
   3074 };
   3075 
   3076 struct referring_call4 {
   3077         sequenceid4     rc_sequenceid;
   3078         slotid4         rc_slotid;
   3079 };
   3080 
   3081 struct referring_call_list4 {
   3082         sessionid4      rcl_sessionid;
   3083         referring_call4 rcl_referring_calls<>;
   3084 };
   3085 
   3086 struct CB_SEQUENCE4args {
   3087         sessionid4           csa_sessionid;
   3088         sequenceid4          csa_sequenceid;
   3089         slotid4              csa_slotid;
   3090         slotid4              csa_highest_slotid;
   3091         bool                 csa_cachethis;
   3092         referring_call_list4 csa_referring_call_lists<>;
   3093 };
   3094 
   3095 struct CB_SEQUENCE4resok {
   3096         sessionid4         csr_sessionid;
   3097         sequenceid4        csr_sequenceid;
   3098         slotid4            csr_slotid;
   3099         slotid4            csr_highest_slotid;
   3100         slotid4            csr_target_highest_slotid;
   3101 };
   3102 
   3103 union CB_SEQUENCE4res switch (nfsstat4 csr_status) {
   3104 case NFS4_OK:
   3105         CB_SEQUENCE4resok   csr_resok4;
   3106 default:
   3107         void;
   3108 };
   3109 
   3110 struct CB_WANTS_CANCELLED4args {
   3111         bool cwca_contended_wants_cancelled;
   3112         bool cwca_resourced_wants_cancelled;
   3113 };
   3114 
   3115 struct CB_WANTS_CANCELLED4res {
   3116         nfsstat4        cwcr_status;
   3117 };
   3118 
   3119 struct CB_NOTIFY_LOCK4args {
   3120     nfs_fh4     cnla_fh;
   3121     lock_owner4 cnla_lock_owner;
   3122 };
   3123 
   3124 struct CB_NOTIFY_LOCK4res {
   3125         nfsstat4        cnlr_status;
   3126 };
   3127 
   3128 /*
   3129  * Device notification types.
   3130  */
   3131 enum notify_deviceid_type4 {
   3132         NOTIFY_DEVICEID4_CHANGE = 1,
   3133         NOTIFY_DEVICEID4_DELETE = 2
   3134 };
   3135 
   3136 /* For NOTIFY4_DEVICEID4_DELETE */
   3137 struct notify_deviceid_delete4 {
   3138         layouttype4     ndd_layouttype;
   3139         deviceid4       ndd_deviceid;
   3140 };
   3141 
   3142 /* For NOTIFY4_DEVICEID4_CHANGE */
   3143 struct notify_deviceid_change4 {
   3144         layouttype4     ndc_layouttype;
   3145         deviceid4       ndc_deviceid;
   3146         bool            ndc_immediate;
   3147 };
   3148 
   3149 struct CB_NOTIFY_DEVICEID4args {
   3150         notify4 cnda_changes<>;
   3151 };
   3152 
   3153 struct CB_NOTIFY_DEVICEID4res {
   3154         nfsstat4        cndr_status;
   3155 };
   3156 
   3157 /*
   3158  * Various definitions for CB_COMPOUND
   3159  */
   3160 %
   3161 enum nfs_cb_opnum4 {
   3162         OP_CB_GETATTR           = 3,
   3163         OP_CB_RECALL            = 4,
   3164 %/* Callback operations new to NFSv4.1 */
   3165         OP_CB_LAYOUTRECALL      = 5,
   3166         OP_CB_NOTIFY            = 6,
   3167         OP_CB_PUSH_DELEG        = 7,
   3168         OP_CB_RECALL_ANY        = 8,
   3169         OP_CB_RECALLABLE_OBJ_AVAIL = 9,
   3170         OP_CB_RECALL_SLOT       = 10,
   3171         OP_CB_SEQUENCE          = 11,
   3172         OP_CB_WANTS_CANCELLED   = 12,
   3173         OP_CB_NOTIFY_LOCK       = 13,
   3174         OP_CB_NOTIFY_DEVICEID   = 14,
   3175 
   3176         OP_CB_ILLEGAL           = 10044
   3177 };
   3178 
   3179 union nfs_cb_argop4 switch (unsigned argop) {
   3180  case OP_CB_GETATTR:
   3181       CB_GETATTR4args           opcbgetattr;
   3182  case OP_CB_RECALL:
   3183       CB_RECALL4args            opcbrecall;
   3184  case OP_CB_LAYOUTRECALL:
   3185       CB_LAYOUTRECALL4args      opcblayoutrecall;
   3186  case OP_CB_NOTIFY:
   3187       CB_NOTIFY4args            opcbnotify;
   3188  case OP_CB_PUSH_DELEG:
   3189       CB_PUSH_DELEG4args        opcbpush_deleg;
   3190  case OP_CB_RECALL_ANY:
   3191       CB_RECALL_ANY4args        opcbrecall_any;
   3192  case OP_CB_RECALLABLE_OBJ_AVAIL:
   3193       CB_RECALLABLE_OBJ_AVAIL4args opcbrecallable_obj_avail;
   3194  case OP_CB_RECALL_SLOT:
   3195       CB_RECALL_SLOT4args       opcbrecall_slot;
   3196  case OP_CB_SEQUENCE:
   3197       CB_SEQUENCE4args          opcbsequence;
   3198  case OP_CB_WANTS_CANCELLED:
   3199       CB_WANTS_CANCELLED4args   opcbwants_cancelled;
   3200  case OP_CB_NOTIFY_LOCK:
   3201       CB_NOTIFY_LOCK4args       opcbnotify_lock;
   3202  case OP_CB_NOTIFY_DEVICEID:
   3203       CB_NOTIFY_DEVICEID4args   opcbnotify_deviceid;
   3204  case OP_CB_ILLEGAL:            void;
   3205 };
   3206 
   3207 union nfs_cb_resop4 switch (unsigned resop) {
   3208  case OP_CB_GETATTR:    CB_GETATTR4res  opcbgetattr;
   3209  case OP_CB_RECALL:     CB_RECALL4res   opcbrecall;
   3210 
   3211  /* new NFSv4.1 operations */
   3212  case OP_CB_LAYOUTRECALL:
   3213                         CB_LAYOUTRECALL4res
   3214                                         opcblayoutrecall;
   3215 
   3216  case OP_CB_NOTIFY:     CB_NOTIFY4res   opcbnotify;
   3217 
   3218  case OP_CB_PUSH_DELEG: CB_PUSH_DELEG4res
   3219                                         opcbpush_deleg;
   3220 
   3221  case OP_CB_RECALL_ANY: CB_RECALL_ANY4res
   3222                                         opcbrecall_any;
   3223 
   3224  case OP_CB_RECALLABLE_OBJ_AVAIL:
   3225                         CB_RECALLABLE_OBJ_AVAIL4res
   3226                                 opcbrecallable_obj_avail;
   3227 
   3228  case OP_CB_RECALL_SLOT:
   3229                         CB_RECALL_SLOT4res
   3230                                         opcbrecall_slot;
   3231 
   3232  case OP_CB_SEQUENCE:   CB_SEQUENCE4res opcbsequence;
   3233 
   3234  case OP_CB_WANTS_CANCELLED:
   3235                         CB_WANTS_CANCELLED4res
   3236                                 opcbwants_cancelled;
   3237 
   3238  case OP_CB_NOTIFY_LOCK:
   3239                         CB_NOTIFY_LOCK4res
   3240                                         opcbnotify_lock;
   3241 
   3242  case OP_CB_NOTIFY_DEVICEID:
   3243                         CB_NOTIFY_DEVICEID4res
   3244                                         opcbnotify_deviceid;
   3245 
   3246  /* Not new operation */
   3247  case OP_CB_ILLEGAL:    CB_ILLEGAL4res  opcbillegal;
   3248 };
   3249 
   3250 
   3251 struct CB_COMPOUND4args {
   3252         utf8str_cs      tag;
   3253         uint32_t        minorversion;
   3254         uint32_t        callback_ident;
   3255         nfs_cb_argop4   argarray<>;
   3256 };
   3257 
   3258 struct CB_COMPOUND4res {
   3259         nfsstat4 status;
   3260         utf8str_cs      tag;
   3261         nfs_cb_resop4   resarray<>;
   3262 };
   3263 
   3264 
   3265 
   3266 /*
   3267  * Program number is in the transient range since the client
   3268  * will assign the exact transient program number and provide
   3269  * that to the server via the SETCLIENTID operation.
   3270  */
   3271 program NFS4_CALLBACK {
   3272         version NFS_CB {
   3273                 void
   3274                         CB_NULL(void) = 0;
   3275                 CB_COMPOUND4res
   3276                         CB_COMPOUND(CB_COMPOUND4args) = 1;
   3277         } = 1;
   3278 } = 0x40000000;
   3279