Home | History | Annotate | Download | only in nfs
      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 2008 Sun Microsystems, Inc.  All rights reserved.
     23  * Use is subject to license terms.
     24  */
     25 
     26 #ifndef _NFS4_KPROT_H
     27 #define	_NFS4_KPROT_H
     28 
     29 /*
     30  * Kernel specific version.
     31  * NFS Version 4 protocol definitions.  From nfs4_prot.x rev 1.119.
     32  */
     33 
     34 #ifdef __cplusplus
     35 extern "C" {
     36 #endif
     37 
     38 #include <rpc/rpc.h>
     39 #ifdef _KERNEL
     40 #include <rpc/rpc_rdma.h>
     41 #endif
     42 #include <sys/stream.h>
     43 
     44 #define	NFS4_FHSIZE 128
     45 #define	NFS4_VERIFIER_SIZE 8
     46 
     47 /*
     48  * Reasonable upper bounds to catch badly behaving partners
     49  */
     50 #define	NFS4_OPAQUE_LIMIT	1024
     51 #define	NFS4_COMPOUND_LIMIT	2048
     52 #define	NFS4_FS_LOCATIONS_LIMIT	65536
     53 #define	NFS4_ACL_LIMIT		65536
     54 #define	NFS4_SECINFO_LIMIT	65536
     55 #define	NFS4_FATTR4_LIMIT	1048576
     56 #define	NFS4_DATA_LIMIT		134217728
     57 
     58 enum nfs_ftype4 {
     59 	NF4REG = 1,
     60 	NF4DIR = 2,
     61 	NF4BLK = 3,
     62 	NF4CHR = 4,
     63 	NF4LNK = 5,
     64 	NF4SOCK = 6,
     65 	NF4FIFO = 7,
     66 	NF4ATTRDIR = 8,
     67 	NF4NAMEDATTR = 9
     68 };
     69 typedef enum nfs_ftype4 nfs_ftype4;
     70 
     71 enum nfsstat4 {
     72 	NFS4_OK = 0,
     73 	NFS4ERR_PERM = 1,
     74 	NFS4ERR_NOENT = 2,
     75 	NFS4ERR_IO = 5,
     76 	NFS4ERR_NXIO = 6,
     77 	NFS4ERR_ACCESS = 13,
     78 	NFS4ERR_EXIST = 17,
     79 	NFS4ERR_XDEV = 18,
     80 	NFS4ERR_NOTDIR = 20,
     81 	NFS4ERR_ISDIR = 21,
     82 	NFS4ERR_INVAL = 22,
     83 	NFS4ERR_FBIG = 27,
     84 	NFS4ERR_NOSPC = 28,
     85 	NFS4ERR_ROFS = 30,
     86 	NFS4ERR_MLINK = 31,
     87 	NFS4ERR_NAMETOOLONG = 63,
     88 	NFS4ERR_NOTEMPTY = 66,
     89 	NFS4ERR_DQUOT = 69,
     90 	NFS4ERR_STALE = 70,
     91 	NFS4ERR_BADHANDLE = 10001,
     92 	NFS4ERR_BAD_COOKIE = 10003,
     93 	NFS4ERR_NOTSUPP = 10004,
     94 	NFS4ERR_TOOSMALL = 10005,
     95 	NFS4ERR_SERVERFAULT = 10006,
     96 	NFS4ERR_BADTYPE = 10007,
     97 	NFS4ERR_DELAY = 10008,
     98 	NFS4ERR_SAME = 10009,
     99 	NFS4ERR_DENIED = 10010,
    100 	NFS4ERR_EXPIRED = 10011,
    101 	NFS4ERR_LOCKED = 10012,
    102 	NFS4ERR_GRACE = 10013,
    103 	NFS4ERR_FHEXPIRED = 10014,
    104 	NFS4ERR_SHARE_DENIED = 10015,
    105 	NFS4ERR_WRONGSEC = 10016,
    106 	NFS4ERR_CLID_INUSE = 10017,
    107 	NFS4ERR_RESOURCE = 10018,
    108 	NFS4ERR_MOVED = 10019,
    109 	NFS4ERR_NOFILEHANDLE = 10020,
    110 	NFS4ERR_MINOR_VERS_MISMATCH = 10021,
    111 	NFS4ERR_STALE_CLIENTID = 10022,
    112 	NFS4ERR_STALE_STATEID = 10023,
    113 	NFS4ERR_OLD_STATEID = 10024,
    114 	NFS4ERR_BAD_STATEID = 10025,
    115 	NFS4ERR_BAD_SEQID = 10026,
    116 	NFS4ERR_NOT_SAME = 10027,
    117 	NFS4ERR_LOCK_RANGE = 10028,
    118 	NFS4ERR_SYMLINK = 10029,
    119 	NFS4ERR_RESTOREFH = 10030,
    120 	NFS4ERR_LEASE_MOVED = 10031,
    121 	NFS4ERR_ATTRNOTSUPP = 10032,
    122 	NFS4ERR_NO_GRACE = 10033,
    123 	NFS4ERR_RECLAIM_BAD = 10034,
    124 	NFS4ERR_RECLAIM_CONFLICT = 10035,
    125 	NFS4ERR_BADXDR = 10036,
    126 	NFS4ERR_LOCKS_HELD = 10037,
    127 	NFS4ERR_OPENMODE = 10038,
    128 	NFS4ERR_BADOWNER = 10039,
    129 	NFS4ERR_BADCHAR = 10040,
    130 	NFS4ERR_BADNAME = 10041,
    131 	NFS4ERR_BAD_RANGE = 10042,
    132 	NFS4ERR_LOCK_NOTSUPP = 10043,
    133 	NFS4ERR_OP_ILLEGAL = 10044,
    134 	NFS4ERR_DEADLOCK = 10045,
    135 	NFS4ERR_FILE_OPEN = 10046,
    136 	NFS4ERR_ADMIN_REVOKED = 10047,
    137 	NFS4ERR_CB_PATH_DOWN = 10048
    138 };
    139 typedef enum nfsstat4 nfsstat4;
    140 
    141 /*
    142  * A bitmap can only be 56 bits, treat it as a uint64_t for now
    143  */
    144 typedef uint64_t bitmap4;
    145 
    146 typedef uint64_t offset4;
    147 
    148 typedef uint32_t count4;
    149 
    150 typedef uint64_t length4;
    151 
    152 typedef uint64_t clientid4;
    153 
    154 typedef uint32_t seqid4;
    155 
    156 typedef struct {
    157 	uint_t utf8string_len;
    158 	char *utf8string_val;
    159 } utf8string;
    160 
    161 typedef utf8string component4;
    162 
    163 typedef struct {
    164 	uint_t pathname4_len;
    165 	component4 *pathname4_val;
    166 } pathname4;
    167 
    168 typedef uint64_t nfs_lockid4;
    169 
    170 typedef uint64_t nfs_cookie4;
    171 
    172 typedef utf8string linktext4;
    173 
    174 typedef struct {
    175 	uint_t sec_oid4_len;
    176 	char *sec_oid4_val;
    177 } sec_oid4;
    178 
    179 typedef uint32_t qop4;
    180 
    181 typedef uint32_t mode4;
    182 
    183 typedef uint64_t changeid4;
    184 
    185 typedef uint64_t verifier4;
    186 
    187 struct nfstime4 {
    188 	int64_t seconds;
    189 	uint32_t nseconds;
    190 };
    191 typedef struct nfstime4 nfstime4;
    192 
    193 enum time_how4 {
    194 	SET_TO_SERVER_TIME4 = 0,
    195 	SET_TO_CLIENT_TIME4 = 1
    196 };
    197 typedef enum time_how4 time_how4;
    198 
    199 struct settime4 {
    200 	time_how4 set_it;
    201 	nfstime4 time;
    202 };
    203 typedef struct settime4 settime4;
    204 
    205 typedef struct {
    206 	uint_t nfs_fh4_len;
    207 	char *nfs_fh4_val;
    208 } nfs_fh4;
    209 
    210 struct fsid4 {
    211 	uint64_t major;
    212 	uint64_t minor;
    213 };
    214 typedef struct fsid4 fsid4;
    215 
    216 struct fs_location4 {
    217 	uint_t server_len;
    218 	utf8string *server_val;
    219 	pathname4 rootpath;
    220 };
    221 typedef struct fs_location4 fs_location4;
    222 
    223 struct fs_locations4 {
    224 	pathname4 fs_root;
    225 	uint_t locations_len;
    226 	fs_location4 *locations_val;
    227 };
    228 typedef struct fs_locations4 fs_locations4;
    229 
    230 /*
    231  * ACL support
    232  */
    233 
    234 #define	ACL4_SUPPORT_ALLOW_ACL 0x00000001
    235 #define	ACL4_SUPPORT_DENY_ACL 0x00000002
    236 #define	ACL4_SUPPORT_AUDIT_ACL 0x00000004
    237 #define	ACL4_SUPPORT_ALARM_ACL 0x00000008
    238 
    239 typedef uint32_t acetype4;
    240 #define	ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000
    241 #define	ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
    242 #define	ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002
    243 #define	ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003
    244 
    245 typedef uint32_t aceflag4;
    246 #define	ACE4_FILE_INHERIT_ACE 0x00000001
    247 #define	ACE4_DIRECTORY_INHERIT_ACE 0x00000002
    248 #define	ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004
    249 #define	ACE4_INHERIT_ONLY_ACE 0x00000008
    250 #define	ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
    251 #define	ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
    252 #define	ACE4_IDENTIFIER_GROUP 0x00000040
    253 /*
    254  * This defines all valid flag bits, as defined by RFC 3530.  If
    255  * any additional flag bits are deemed part of the NFSv4 spec,
    256  * you must also add them to the definition below.
    257  */
    258 #define	ACE4_VALID_FLAG_BITS (\
    259     ACE4_FILE_INHERIT_ACE | \
    260     ACE4_DIRECTORY_INHERIT_ACE | \
    261     ACE4_NO_PROPAGATE_INHERIT_ACE | \
    262     ACE4_INHERIT_ONLY_ACE | \
    263     ACE4_SUCCESSFUL_ACCESS_ACE_FLAG | \
    264     ACE4_FAILED_ACCESS_ACE_FLAG | \
    265     ACE4_IDENTIFIER_GROUP)
    266 
    267 typedef uint32_t acemask4;
    268 #define	ACE4_READ_DATA 0x00000001
    269 #define	ACE4_LIST_DIRECTORY 0x00000001
    270 #define	ACE4_WRITE_DATA 0x00000002
    271 #define	ACE4_ADD_FILE 0x00000002
    272 #define	ACE4_APPEND_DATA 0x00000004
    273 #define	ACE4_ADD_SUBDIRECTORY 0x00000004
    274 #define	ACE4_READ_NAMED_ATTRS 0x00000008
    275 #define	ACE4_WRITE_NAMED_ATTRS 0x00000010
    276 #define	ACE4_EXECUTE 0x00000020
    277 #define	ACE4_DELETE_CHILD 0x00000040
    278 #define	ACE4_READ_ATTRIBUTES 0x00000080
    279 #define	ACE4_WRITE_ATTRIBUTES 0x00000100
    280 #define	ACE4_DELETE 0x00010000
    281 #define	ACE4_READ_ACL 0x00020000
    282 #define	ACE4_WRITE_ACL 0x00040000
    283 #define	ACE4_WRITE_OWNER 0x00080000
    284 #define	ACE4_SYNCHRONIZE 0x00100000
    285 #define	ACE4_GENERIC_READ 0x00120081
    286 #define	ACE4_GENERIC_WRITE 0x00160106
    287 #define	ACE4_GENERIC_EXECUTE 0x001200A0
    288 /*
    289  * This defines all valid access mask bits, as defined by RFC 3530.  If
    290  * any additional access mask bits are deemed part of the NFSv4 spec,
    291  * you must also add them to the definition below.
    292  */
    293 #define	ACE4_VALID_MASK_BITS (\
    294     ACE4_READ_DATA | \
    295     ACE4_LIST_DIRECTORY | \
    296     ACE4_WRITE_DATA | \
    297     ACE4_ADD_FILE | \
    298     ACE4_APPEND_DATA | \
    299     ACE4_ADD_SUBDIRECTORY | \
    300     ACE4_READ_NAMED_ATTRS | \
    301     ACE4_WRITE_NAMED_ATTRS | \
    302     ACE4_EXECUTE | \
    303     ACE4_DELETE_CHILD | \
    304     ACE4_READ_ATTRIBUTES | \
    305     ACE4_WRITE_ATTRIBUTES | \
    306     ACE4_DELETE | \
    307     ACE4_READ_ACL | \
    308     ACE4_WRITE_ACL | \
    309     ACE4_WRITE_OWNER | \
    310     ACE4_SYNCHRONIZE)
    311 
    312 /* Used to signify an undefined value for an acemask4 */
    313 #define	ACE4_MASK_UNDEFINED 0x80000000
    314 
    315 #define	ACE4_WHO_OWNER		"OWNER@"
    316 #define	ACE4_WHO_GROUP		"GROUP@"
    317 #define	ACE4_WHO_EVERYONE	"EVERYONE@"
    318 
    319 struct nfsace4 {
    320 	acetype4 type;
    321 	aceflag4 flag;
    322 	acemask4 access_mask;
    323 	utf8string who;
    324 };
    325 typedef struct nfsace4 nfsace4;
    326 #define	MODE4_SUID 0x800
    327 #define	MODE4_SGID 0x400
    328 #define	MODE4_SVTX 0x200
    329 #define	MODE4_RUSR 0x100
    330 #define	MODE4_WUSR 0x080
    331 #define	MODE4_XUSR 0x040
    332 #define	MODE4_RGRP 0x020
    333 #define	MODE4_WGRP 0x010
    334 #define	MODE4_XGRP 0x008
    335 #define	MODE4_ROTH 0x004
    336 #define	MODE4_WOTH 0x002
    337 #define	MODE4_XOTH 0x001
    338 
    339 /*
    340  * ACL conversion helpers
    341  */
    342 
    343 typedef enum {
    344 	ace4_unused,
    345 	ace4_user_obj,
    346 	ace4_user,
    347 	ace4_group, /* includes GROUP and GROUP_OBJ */
    348 	ace4_other_obj
    349 } ace4_to_aent_state_t;
    350 
    351 typedef struct ace4vals {
    352 	utf8string *key; /* NB: not allocated here; points to existing utf8 */
    353 	avl_node_t avl;
    354 	acemask4 mask;
    355 	acemask4 allowed;
    356 	acemask4 denied;
    357 	int aent_type;
    358 } ace4vals_t;
    359 
    360 typedef struct ace4_list {
    361 	ace4vals_t user_obj;
    362 	avl_tree_t user;
    363 	int numusers;
    364 	ace4vals_t group_obj;
    365 	avl_tree_t group;
    366 	int numgroups;
    367 	ace4vals_t other_obj;
    368 	acemask4 acl_mask;
    369 	int hasmask;
    370 	int dfacl_flag;
    371 	ace4_to_aent_state_t state;
    372 	int seen; /* bitmask of all aclent_t a_type values seen */
    373 } ace4_list_t;
    374 
    375 struct specdata4 {
    376 	uint32_t specdata1;
    377 	uint32_t specdata2;
    378 };
    379 typedef struct specdata4 specdata4;
    380 #define	FH4_PERSISTENT 0x00000000
    381 #define	FH4_NOEXPIRE_WITH_OPEN 0x00000001
    382 #define	FH4_VOLATILE_ANY 0x00000002
    383 #define	FH4_VOL_MIGRATION 0x00000004
    384 #define	FH4_VOL_RENAME 0x00000008
    385 
    386 typedef bitmap4 fattr4_supported_attrs;
    387 
    388 typedef nfs_ftype4 fattr4_type;
    389 
    390 typedef uint32_t fattr4_fh_expire_type;
    391 
    392 typedef changeid4 fattr4_change;
    393 
    394 typedef uint64_t fattr4_size;
    395 
    396 typedef bool_t fattr4_link_support;
    397 
    398 typedef bool_t fattr4_symlink_support;
    399 
    400 typedef bool_t fattr4_named_attr;
    401 
    402 typedef fsid4 fattr4_fsid;
    403 
    404 typedef bool_t fattr4_unique_handles;
    405 
    406 typedef uint32_t fattr4_lease_time;
    407 
    408 typedef nfsstat4 fattr4_rdattr_error;
    409 
    410 typedef struct {
    411 	uint_t fattr4_acl_len;
    412 	nfsace4 *fattr4_acl_val;
    413 } fattr4_acl;
    414 
    415 typedef uint32_t fattr4_aclsupport;
    416 
    417 typedef bool_t fattr4_archive;
    418 
    419 typedef bool_t fattr4_cansettime;
    420 
    421 typedef bool_t fattr4_case_insensitive;
    422 
    423 typedef bool_t fattr4_case_preserving;
    424 
    425 typedef bool_t fattr4_chown_restricted;
    426 
    427 typedef uint64_t fattr4_fileid;
    428 
    429 typedef uint64_t fattr4_files_avail;
    430 
    431 typedef nfs_fh4 fattr4_filehandle;
    432 
    433 typedef uint64_t fattr4_files_free;
    434 
    435 typedef uint64_t fattr4_files_total;
    436 
    437 typedef fs_locations4 fattr4_fs_locations;
    438 
    439 typedef bool_t fattr4_hidden;
    440 
    441 typedef bool_t fattr4_homogeneous;
    442 
    443 typedef uint64_t fattr4_maxfilesize;
    444 
    445 typedef uint32_t fattr4_maxlink;
    446 
    447 typedef uint32_t fattr4_maxname;
    448 
    449 typedef uint64_t fattr4_maxread;
    450 
    451 typedef uint64_t fattr4_maxwrite;
    452 
    453 typedef utf8string fattr4_mimetype;
    454 
    455 typedef mode4 fattr4_mode;
    456 
    457 typedef uint64_t fattr4_mounted_on_fileid;
    458 
    459 typedef bool_t fattr4_no_trunc;
    460 
    461 typedef uint32_t fattr4_numlinks;
    462 
    463 typedef utf8string fattr4_owner;
    464 
    465 typedef utf8string fattr4_owner_group;
    466 
    467 typedef uint64_t fattr4_quota_avail_hard;
    468 
    469 typedef uint64_t fattr4_quota_avail_soft;
    470 
    471 typedef uint64_t fattr4_quota_used;
    472 
    473 typedef specdata4 fattr4_rawdev;
    474 
    475 typedef uint64_t fattr4_space_avail;
    476 
    477 typedef uint64_t fattr4_space_free;
    478 
    479 typedef uint64_t fattr4_space_total;
    480 
    481 typedef uint64_t fattr4_space_used;
    482 
    483 typedef bool_t fattr4_system;
    484 
    485 typedef nfstime4 fattr4_time_access;
    486 
    487 typedef settime4 fattr4_time_access_set;
    488 
    489 typedef nfstime4 fattr4_time_backup;
    490 
    491 typedef nfstime4 fattr4_time_create;
    492 
    493 typedef nfstime4 fattr4_time_delta;
    494 
    495 typedef nfstime4 fattr4_time_metadata;
    496 
    497 typedef nfstime4 fattr4_time_modify;
    498 
    499 typedef settime4 fattr4_time_modify_set;
    500 #define	FATTR4_SUPPORTED_ATTRS 0
    501 #define	FATTR4_TYPE 1
    502 #define	FATTR4_FH_EXPIRE_TYPE 2
    503 #define	FATTR4_CHANGE 3
    504 #define	FATTR4_SIZE 4
    505 #define	FATTR4_LINK_SUPPORT 5
    506 #define	FATTR4_SYMLINK_SUPPORT 6
    507 #define	FATTR4_NAMED_ATTR 7
    508 #define	FATTR4_FSID 8
    509 #define	FATTR4_UNIQUE_HANDLES 9
    510 #define	FATTR4_LEASE_TIME 10
    511 #define	FATTR4_RDATTR_ERROR 11
    512 #define	FATTR4_FILEHANDLE 19
    513 #define	FATTR4_ACL 12
    514 #define	FATTR4_ACLSUPPORT 13
    515 #define	FATTR4_ARCHIVE 14
    516 #define	FATTR4_CANSETTIME 15
    517 #define	FATTR4_CASE_INSENSITIVE 16
    518 #define	FATTR4_CASE_PRESERVING 17
    519 #define	FATTR4_CHOWN_RESTRICTED 18
    520 #define	FATTR4_FILEID 20
    521 #define	FATTR4_FILES_AVAIL 21
    522 #define	FATTR4_FILES_FREE 22
    523 #define	FATTR4_FILES_TOTAL 23
    524 #define	FATTR4_FS_LOCATIONS 24
    525 #define	FATTR4_HIDDEN 25
    526 #define	FATTR4_HOMOGENEOUS 26
    527 #define	FATTR4_MAXFILESIZE 27
    528 #define	FATTR4_MAXLINK 28
    529 #define	FATTR4_MAXNAME 29
    530 #define	FATTR4_MAXREAD 30
    531 #define	FATTR4_MAXWRITE 31
    532 #define	FATTR4_MIMETYPE 32
    533 #define	FATTR4_MODE 33
    534 #define	FATTR4_NO_TRUNC 34
    535 #define	FATTR4_NUMLINKS 35
    536 #define	FATTR4_OWNER 36
    537 #define	FATTR4_OWNER_GROUP 37
    538 #define	FATTR4_QUOTA_AVAIL_HARD 38
    539 #define	FATTR4_QUOTA_AVAIL_SOFT 39
    540 #define	FATTR4_QUOTA_USED 40
    541 #define	FATTR4_RAWDEV 41
    542 #define	FATTR4_SPACE_AVAIL 42
    543 #define	FATTR4_SPACE_FREE 43
    544 #define	FATTR4_SPACE_TOTAL 44
    545 #define	FATTR4_SPACE_USED 45
    546 #define	FATTR4_SYSTEM 46
    547 #define	FATTR4_TIME_ACCESS 47
    548 #define	FATTR4_TIME_ACCESS_SET 48
    549 #define	FATTR4_TIME_BACKUP 49
    550 #define	FATTR4_TIME_CREATE 50
    551 #define	FATTR4_TIME_DELTA 51
    552 #define	FATTR4_TIME_METADATA 52
    553 #define	FATTR4_TIME_MODIFY 53
    554 #define	FATTR4_TIME_MODIFY_SET 54
    555 #define	FATTR4_MOUNTED_ON_FILEID 55
    556 
    557 struct fattr4 {
    558 	bitmap4 attrmask;
    559 	char *attrlist4;
    560 	uint_t attrlist4_len;
    561 };
    562 typedef struct fattr4 fattr4;
    563 
    564 struct change_info4 {
    565 	bool_t atomic;
    566 	changeid4 before;
    567 	changeid4 after;
    568 };
    569 typedef struct change_info4 change_info4;
    570 
    571 struct clientaddr4 {
    572 	char *r_netid;
    573 	char *r_addr;
    574 };
    575 typedef struct clientaddr4 clientaddr4;
    576 
    577 struct cb_client4 {
    578 	uint32_t cb_program;
    579 	clientaddr4 cb_location;
    580 };
    581 typedef struct cb_client4 cb_client4;
    582 
    583 struct stateid4 {
    584 	uint32_t seqid;
    585 	char other[12];
    586 };
    587 typedef struct stateid4 stateid4;
    588 
    589 struct nfs_client_id4 {
    590 	verifier4 verifier;
    591 	uint_t id_len;
    592 	char *id_val;
    593 };
    594 typedef struct nfs_client_id4 nfs_client_id4;
    595 
    596 struct open_owner4 {
    597 	clientid4 clientid;
    598 	uint_t owner_len;
    599 	char *owner_val;
    600 };
    601 typedef struct open_owner4 open_owner4;
    602 
    603 struct lock_owner4 {
    604 	clientid4 clientid;
    605 	uint_t owner_len;
    606 	char *owner_val;
    607 };
    608 typedef struct lock_owner4 lock_owner4;
    609 
    610 enum nfs_lock_type4 {
    611 	READ_LT = 1,
    612 	WRITE_LT = 2,
    613 	READW_LT = 3,
    614 	WRITEW_LT = 4
    615 };
    616 typedef enum nfs_lock_type4 nfs_lock_type4;
    617 #define	ACCESS4_READ 0x00000001
    618 #define	ACCESS4_LOOKUP 0x00000002
    619 #define	ACCESS4_MODIFY 0x00000004
    620 #define	ACCESS4_EXTEND 0x00000008
    621 #define	ACCESS4_DELETE 0x00000010
    622 #define	ACCESS4_EXECUTE 0x00000020
    623 
    624 struct ACCESS4args {
    625 	uint32_t access;
    626 };
    627 typedef struct ACCESS4args ACCESS4args;
    628 
    629 struct ACCESS4res {
    630 	nfsstat4 status;
    631 	uint32_t supported;
    632 	uint32_t access;
    633 };
    634 typedef struct ACCESS4res ACCESS4res;
    635 
    636 struct CLOSE4args {
    637 	seqid4 seqid;
    638 	stateid4 open_stateid;
    639 };
    640 typedef struct CLOSE4args CLOSE4args;
    641 
    642 struct CLOSE4res {
    643 	nfsstat4 status;
    644 	stateid4 open_stateid;
    645 };
    646 typedef struct CLOSE4res CLOSE4res;
    647 
    648 struct COMMIT4args {
    649 	offset4 offset;
    650 	count4 count;
    651 };
    652 typedef struct COMMIT4args COMMIT4args;
    653 
    654 struct COMMIT4res {
    655 	nfsstat4 status;
    656 	verifier4 writeverf;
    657 };
    658 typedef struct COMMIT4res COMMIT4res;
    659 
    660 struct CREATE4args {
    661 	nfs_ftype4 type;
    662 	union {
    663 		linktext4 linkdata;
    664 		specdata4 devdata;
    665 	} ftype4_u;
    666 	component4 objname;
    667 	fattr4 createattrs;
    668 };
    669 typedef struct CREATE4args CREATE4args;
    670 
    671 struct CREATE4cargs {
    672 	nfs_ftype4 type;
    673 	union {
    674 		char *clinkdata;
    675 		specdata4 devdata;
    676 	} ftype4_u;
    677 	char *cname;
    678 	fattr4 createattrs;
    679 };
    680 typedef struct CREATE4cargs CREATE4cargs;
    681 
    682 struct CREATE4res {
    683 	nfsstat4 status;
    684 	change_info4 cinfo;
    685 	bitmap4 attrset;
    686 };
    687 typedef struct CREATE4res CREATE4res;
    688 
    689 struct DELEGPURGE4args {
    690 	clientid4 clientid;
    691 };
    692 typedef struct DELEGPURGE4args DELEGPURGE4args;
    693 
    694 struct DELEGPURGE4res {
    695 	nfsstat4 status;
    696 };
    697 typedef struct DELEGPURGE4res DELEGPURGE4res;
    698 
    699 struct DELEGRETURN4args {
    700 	stateid4 deleg_stateid;
    701 };
    702 typedef struct DELEGRETURN4args DELEGRETURN4args;
    703 
    704 struct DELEGRETURN4res {
    705 	nfsstat4 status;
    706 };
    707 typedef struct DELEGRETURN4res DELEGRETURN4res;
    708 
    709 struct mntinfo4;
    710 
    711 struct GETATTR4args {
    712 	bitmap4 attr_request;
    713 	struct mntinfo4 *mi;
    714 };
    715 typedef struct GETATTR4args GETATTR4args;
    716 
    717 struct nfs4_ga_ext_res;
    718 
    719 struct nfs4_ga_res {
    720 	vattr_t				n4g_va;
    721 	unsigned			n4g_change_valid:1;
    722 	unsigned			n4g_mon_fid_valid:1;
    723 	unsigned			n4g_fsid_valid:1;
    724 	uint_t				n4g_attrerr;
    725 	uint_t				n4g_attrwhy;
    726 	bitmap4				n4g_resbmap;
    727 	fattr4_change			n4g_change;
    728 	fattr4_fsid			n4g_fsid;
    729 	fattr4_mounted_on_fileid	n4g_mon_fid;
    730 	struct nfs4_ga_ext_res		*n4g_ext_res;
    731 	vsecattr_t			n4g_vsa;
    732 };
    733 typedef struct nfs4_ga_res nfs4_ga_res_t;
    734 
    735 struct GETATTR4res {
    736 	nfsstat4 status;
    737 	fattr4 obj_attributes;
    738 	nfsstat4	ga_status;
    739 	struct nfs4_ga_res ga_res;
    740 };
    741 typedef struct GETATTR4res GETATTR4res;
    742 
    743 struct GETFH4res {
    744 	nfsstat4 status;
    745 	nfs_fh4 object;
    746 };
    747 typedef struct GETFH4res GETFH4res;
    748 
    749 struct LINK4args {
    750 	component4 newname;
    751 };
    752 typedef struct LINK4args LINK4args;
    753 
    754 struct LINK4cargs {
    755 	char *cnewname;
    756 };
    757 typedef struct LINK4cargs LINK4cargs;
    758 
    759 struct LINK4res {
    760 	nfsstat4 status;
    761 	change_info4 cinfo;
    762 };
    763 typedef struct LINK4res LINK4res;
    764 
    765 struct open_to_lock_owner4 {
    766 	seqid4 open_seqid;
    767 	stateid4 open_stateid;
    768 	seqid4 lock_seqid;
    769 	lock_owner4 lock_owner;
    770 };
    771 typedef struct open_to_lock_owner4 open_to_lock_owner4;
    772 
    773 struct exist_lock_owner4 {
    774 	stateid4 lock_stateid;
    775 	seqid4 lock_seqid;
    776 };
    777 typedef struct exist_lock_owner4 exist_lock_owner4;
    778 
    779 struct locker4 {
    780 	bool_t new_lock_owner;
    781 	union {
    782 		open_to_lock_owner4 open_owner;
    783 		exist_lock_owner4 lock_owner;
    784 	} locker4_u;
    785 };
    786 typedef struct locker4 locker4;
    787 
    788 struct LOCK4args {
    789 	nfs_lock_type4 locktype;
    790 	bool_t reclaim;
    791 	offset4 offset;
    792 	length4 length;
    793 	locker4 locker;
    794 };
    795 typedef struct LOCK4args LOCK4args;
    796 
    797 struct LOCK4denied {
    798 	offset4 offset;
    799 	length4 length;
    800 	nfs_lock_type4 locktype;
    801 	lock_owner4 owner;
    802 };
    803 typedef struct LOCK4denied LOCK4denied;
    804 
    805 struct LOCK4res {
    806 	nfsstat4 status;
    807 	union {
    808 		stateid4 lock_stateid;
    809 		LOCK4denied denied;
    810 	} LOCK4res_u;
    811 };
    812 typedef struct LOCK4res LOCK4res;
    813 
    814 struct LOCKT4args {
    815 	nfs_lock_type4 locktype;
    816 	offset4 offset;
    817 	length4 length;
    818 	lock_owner4 owner;
    819 };
    820 typedef struct LOCKT4args LOCKT4args;
    821 
    822 struct LOCKT4res {
    823 	nfsstat4 status;
    824 	LOCK4denied denied;
    825 };
    826 typedef struct LOCKT4res LOCKT4res;
    827 
    828 struct LOCKU4args {
    829 	nfs_lock_type4 locktype;
    830 	seqid4 seqid;
    831 	stateid4 lock_stateid;
    832 	offset4 offset;
    833 	length4 length;
    834 };
    835 typedef struct LOCKU4args LOCKU4args;
    836 
    837 struct LOCKU4res {
    838 	nfsstat4 status;
    839 	stateid4 lock_stateid;
    840 };
    841 typedef struct LOCKU4res LOCKU4res;
    842 
    843 struct LOOKUP4args {
    844 	component4 objname;
    845 };
    846 typedef struct LOOKUP4args LOOKUP4args;
    847 
    848 struct LOOKUP4cargs {
    849 	char *cname;
    850 };
    851 typedef struct LOOKUP4cargs LOOKUP4cargs;
    852 
    853 struct LOOKUP4res {
    854 	nfsstat4 status;
    855 };
    856 typedef struct LOOKUP4res LOOKUP4res;
    857 
    858 struct LOOKUPP4res {
    859 	nfsstat4 status;
    860 };
    861 typedef struct LOOKUPP4res LOOKUPP4res;
    862 
    863 struct NVERIFY4args {
    864 	fattr4 obj_attributes;
    865 };
    866 typedef struct NVERIFY4args NVERIFY4args;
    867 
    868 struct NVERIFY4res {
    869 	nfsstat4 status;
    870 };
    871 typedef struct NVERIFY4res NVERIFY4res;
    872 
    873 enum createmode4 {
    874 	UNCHECKED4 = 0,
    875 	GUARDED4 = 1,
    876 	EXCLUSIVE4 = 2
    877 };
    878 typedef enum createmode4 createmode4;
    879 
    880 enum opentype4 {
    881 	OPEN4_NOCREATE = 0,
    882 	OPEN4_CREATE = 1
    883 };
    884 typedef enum opentype4 opentype4;
    885 
    886 enum limit_by4 {
    887 	NFS_LIMIT_SIZE = 1,
    888 	NFS_LIMIT_BLOCKS = 2
    889 };
    890 typedef enum limit_by4 limit_by4;
    891 
    892 struct nfs_modified_limit4 {
    893 	uint32_t num_blocks;
    894 	uint32_t bytes_per_block;
    895 };
    896 typedef struct nfs_modified_limit4 nfs_modified_limit4;
    897 
    898 struct nfs_space_limit4 {
    899 	limit_by4 limitby;
    900 	union {
    901 		uint64_t filesize;
    902 		nfs_modified_limit4 mod_blocks;
    903 	} nfs_space_limit4_u;
    904 };
    905 typedef struct nfs_space_limit4 nfs_space_limit4;
    906 #define	OPEN4_SHARE_ACCESS_READ 0x00000001
    907 #define	OPEN4_SHARE_ACCESS_WRITE 0x00000002
    908 #define	OPEN4_SHARE_ACCESS_BOTH 0x00000003
    909 #define	OPEN4_SHARE_DENY_NONE 0x00000000
    910 #define	OPEN4_SHARE_DENY_READ 0x00000001
    911 #define	OPEN4_SHARE_DENY_WRITE 0x00000002
    912 #define	OPEN4_SHARE_DENY_BOTH 0x00000003
    913 
    914 enum open_delegation_type4 {
    915 	OPEN_DELEGATE_NONE = 0,
    916 	OPEN_DELEGATE_READ = 1,
    917 	OPEN_DELEGATE_WRITE = 2
    918 };
    919 typedef enum open_delegation_type4 open_delegation_type4;
    920 
    921 enum open_claim_type4 {
    922 	CLAIM_NULL = 0,
    923 	CLAIM_PREVIOUS = 1,
    924 	CLAIM_DELEGATE_CUR = 2,
    925 	CLAIM_DELEGATE_PREV = 3
    926 };
    927 typedef enum open_claim_type4 open_claim_type4;
    928 
    929 struct open_claim_delegate_cur4 {
    930 	stateid4 delegate_stateid;
    931 	component4 file;
    932 };
    933 typedef struct open_claim_delegate_cur4 open_claim_delegate_cur4;
    934 
    935 struct copen_claim_delegate_cur4 {
    936 	stateid4 delegate_stateid;
    937 	char *cfile;
    938 };
    939 typedef struct copen_claim_delegate_cur4 copen_claim_delegate_cur4;
    940 
    941 struct OPEN4args {
    942 	seqid4 seqid;
    943 	uint32_t share_access;
    944 	uint32_t share_deny;
    945 	open_owner4 owner;
    946 	opentype4 opentype;
    947 	createmode4 mode;
    948 	union {
    949 		fattr4 createattrs;
    950 		verifier4 createverf;
    951 	} createhow4_u;
    952 	open_claim_type4 claim;
    953 	union {
    954 		component4 file;
    955 		open_delegation_type4 delegate_type;
    956 		open_claim_delegate_cur4 delegate_cur_info;
    957 		component4 file_delegate_prev;
    958 	} open_claim4_u;
    959 };
    960 typedef struct OPEN4args OPEN4args;
    961 
    962 struct OPEN4cargs {
    963 	seqid4 seqid;
    964 	uint32_t share_access;
    965 	uint32_t share_deny;
    966 	open_owner4 owner;
    967 	opentype4 opentype;
    968 	createmode4 mode;
    969 	union {
    970 		fattr4 createattrs;
    971 		verifier4 createverf;
    972 	} createhow4_u;
    973 	open_claim_type4 claim;
    974 	union {
    975 		char *cfile;
    976 		open_delegation_type4 delegate_type;
    977 		copen_claim_delegate_cur4 delegate_cur_info;
    978 		char *cfile_delegate_prev;
    979 	} open_claim4_u;
    980 };
    981 typedef struct OPEN4cargs OPEN4cargs;
    982 
    983 struct open_read_delegation4 {
    984 	stateid4 stateid;
    985 	bool_t recall;
    986 	nfsace4 permissions;
    987 };
    988 typedef struct open_read_delegation4 open_read_delegation4;
    989 
    990 struct open_write_delegation4 {
    991 	stateid4 stateid;
    992 	bool_t recall;
    993 	nfs_space_limit4 space_limit;
    994 	nfsace4 permissions;
    995 };
    996 typedef struct open_write_delegation4 open_write_delegation4;
    997 
    998 struct open_delegation4 {
    999 	open_delegation_type4 delegation_type;
   1000 	union {
   1001 		open_read_delegation4 read;
   1002 		open_write_delegation4 write;
   1003 	} open_delegation4_u;
   1004 };
   1005 typedef struct open_delegation4 open_delegation4;
   1006 #define	OPEN4_RESULT_CONFIRM 0x00000002
   1007 #define	OPEN4_RESULT_LOCKTYPE_POSIX 0x00000004
   1008 
   1009 struct OPEN4res {
   1010 	nfsstat4 status;
   1011 	stateid4 stateid;
   1012 	change_info4 cinfo;
   1013 	uint32_t rflags;
   1014 	bitmap4 attrset;
   1015 	open_delegation4 delegation;
   1016 };
   1017 typedef struct OPEN4res OPEN4res;
   1018 
   1019 struct OPENATTR4args {
   1020 	bool_t createdir;
   1021 };
   1022 typedef struct OPENATTR4args OPENATTR4args;
   1023 
   1024 struct OPENATTR4res {
   1025 	nfsstat4 status;
   1026 };
   1027 typedef struct OPENATTR4res OPENATTR4res;
   1028 
   1029 struct OPEN_CONFIRM4args {
   1030 	stateid4 open_stateid;
   1031 	seqid4 seqid;
   1032 };
   1033 typedef struct OPEN_CONFIRM4args OPEN_CONFIRM4args;
   1034 
   1035 struct OPEN_CONFIRM4res {
   1036 	nfsstat4 status;
   1037 	stateid4 open_stateid;
   1038 };
   1039 typedef struct OPEN_CONFIRM4res OPEN_CONFIRM4res;
   1040 
   1041 struct OPEN_DOWNGRADE4args {
   1042 	stateid4 open_stateid;
   1043 	seqid4 seqid;
   1044 	uint32_t share_access;
   1045 	uint32_t share_deny;
   1046 };
   1047 typedef struct OPEN_DOWNGRADE4args OPEN_DOWNGRADE4args;
   1048 
   1049 struct OPEN_DOWNGRADE4res {
   1050 	nfsstat4 status;
   1051 	stateid4 open_stateid;
   1052 };
   1053 typedef struct OPEN_DOWNGRADE4res OPEN_DOWNGRADE4res;
   1054 
   1055 struct PUTFH4args {
   1056 	nfs_fh4 object;
   1057 };
   1058 typedef struct PUTFH4args PUTFH4args;
   1059 
   1060 /*
   1061  * Client only side PUTFH arguments
   1062  * This is really a nfs4_sharedfh_t * but the forward declaration
   1063  * is problematic;
   1064  */
   1065 struct PUTFH4cargs {
   1066 	void *sfh;
   1067 };
   1068 typedef struct PUTFH4cargs PUTFH4cargs;
   1069 
   1070 struct PUTFH4res {
   1071 	nfsstat4 status;
   1072 };
   1073 typedef struct PUTFH4res PUTFH4res;
   1074 
   1075 struct PUTPUBFH4res {
   1076 	nfsstat4 status;
   1077 };
   1078 typedef struct PUTPUBFH4res PUTPUBFH4res;
   1079 
   1080 struct PUTROOTFH4res {
   1081 	nfsstat4 status;
   1082 };
   1083 typedef struct PUTROOTFH4res PUTROOTFH4res;
   1084 
   1085 struct READ4args {
   1086 	stateid4 stateid;
   1087 	offset4 offset;
   1088 	count4 count;
   1089 	/* The following are used for the XDR decode path */
   1090 	char *res_data_val_alt;
   1091 	mblk_t *res_mblk;
   1092 	struct uio *res_uiop;
   1093 	uint_t res_maxsize;
   1094 #ifdef _KERNEL
   1095 	struct clist *wlist;
   1096 	CONN *conn;
   1097 #endif
   1098 };
   1099 typedef struct READ4args READ4args;
   1100 
   1101 struct READ4res {
   1102 	nfsstat4 status;
   1103 	bool_t eof;
   1104 	uint_t data_len;
   1105 	char *data_val;
   1106 	mblk_t *mblk;
   1107 #ifdef _KERNEL
   1108 	struct clist *wlist;
   1109 	uint_t wlist_len;
   1110 #endif
   1111 };
   1112 typedef struct READ4res READ4res;
   1113 
   1114 struct rddir4_cache;
   1115 
   1116 struct READDIR4args {
   1117 	nfs_cookie4 cookie;
   1118 	verifier4 cookieverf;
   1119 	count4 dircount;
   1120 	count4 maxcount;
   1121 	bitmap4 attr_request;
   1122 	vnode_t *dvp;
   1123 	struct mntinfo4 *mi;
   1124 	cred_t *cr;
   1125 	struct rddir4_cache *rdc;
   1126 	hrtime_t t;
   1127 };
   1128 typedef struct READDIR4args READDIR4args;
   1129 
   1130 struct READDIR4res_clnt {
   1131 	nfsstat4 status;
   1132 	verifier4 cookieverf;
   1133 	bool_t eof;
   1134 	struct dirent64 *dotp, *dotdotp;
   1135 	struct rddir4_cache *rdc;
   1136 };
   1137 typedef struct READDIR4res_clnt READDIR4res_clnt;
   1138 
   1139 struct READDIR4res {
   1140 	nfsstat4 status;
   1141 	verifier4 cookieverf;
   1142 	mblk_t *mblk;
   1143 	uint_t data_len;
   1144 };
   1145 typedef struct READDIR4res READDIR4res;
   1146 
   1147 struct READLINK4res {
   1148 	nfsstat4 status;
   1149 	linktext4 link;
   1150 };
   1151 typedef struct READLINK4res READLINK4res;
   1152 
   1153 struct REMOVE4args {
   1154 	component4 target;
   1155 };
   1156 typedef struct REMOVE4args REMOVE4args;
   1157 
   1158 struct REMOVE4cargs {
   1159 	char *ctarget;
   1160 };
   1161 typedef struct REMOVE4cargs REMOVE4cargs;
   1162 
   1163 struct REMOVE4res {
   1164 	nfsstat4 status;
   1165 	change_info4 cinfo;
   1166 };
   1167 typedef struct REMOVE4res REMOVE4res;
   1168 
   1169 struct RENAME4args {
   1170 	component4 oldname;
   1171 	component4 newname;
   1172 };
   1173 typedef struct RENAME4args RENAME4args;
   1174 
   1175 struct RENAME4cargs {
   1176 	char *coldname;
   1177 	char *cnewname;
   1178 };
   1179 typedef struct RENAME4cargs RENAME4cargs;
   1180 
   1181 struct RENAME4res {
   1182 	nfsstat4 status;
   1183 	change_info4 source_cinfo;
   1184 	change_info4 target_cinfo;
   1185 };
   1186 typedef struct RENAME4res RENAME4res;
   1187 
   1188 struct RENEW4args {
   1189 	clientid4 clientid;
   1190 };
   1191 typedef struct RENEW4args RENEW4args;
   1192 
   1193 struct RENEW4res {
   1194 	nfsstat4 status;
   1195 };
   1196 typedef struct RENEW4res RENEW4res;
   1197 
   1198 struct RESTOREFH4res {
   1199 	nfsstat4 status;
   1200 };
   1201 typedef struct RESTOREFH4res RESTOREFH4res;
   1202 
   1203 struct SAVEFH4res {
   1204 	nfsstat4 status;
   1205 };
   1206 typedef struct SAVEFH4res SAVEFH4res;
   1207 
   1208 struct SECINFO4args {
   1209 	component4 name;
   1210 };
   1211 typedef struct SECINFO4args SECINFO4args;
   1212 
   1213 struct SECINFO4cargs {
   1214 	char *cname;
   1215 };
   1216 typedef struct SECINFO4cargs SECINFO4cargs;
   1217 
   1218 enum rpc_gss_svc_t {
   1219 	RPC_GSS_SVC_NONE = 1,
   1220 	RPC_GSS_SVC_INTEGRITY = 2,
   1221 	RPC_GSS_SVC_PRIVACY = 3
   1222 };
   1223 typedef enum rpc_gss_svc_t rpc_gss_svc_t;
   1224 
   1225 struct rpcsec_gss_info {
   1226 	sec_oid4 oid;
   1227 	qop4 qop;
   1228 	rpc_gss_svc_t service;
   1229 };
   1230 typedef struct rpcsec_gss_info rpcsec_gss_info;
   1231 
   1232 struct secinfo4 {
   1233 	uint32_t flavor;
   1234 	rpcsec_gss_info flavor_info;
   1235 };
   1236 typedef struct secinfo4 secinfo4;
   1237 
   1238 struct SECINFO4res {
   1239 	nfsstat4 status;
   1240 	uint_t SECINFO4resok_len;
   1241 	secinfo4 *SECINFO4resok_val;
   1242 };
   1243 typedef struct SECINFO4res SECINFO4res;
   1244 
   1245 struct SETATTR4args {
   1246 	stateid4 stateid;
   1247 	fattr4 obj_attributes;
   1248 };
   1249 typedef struct SETATTR4args SETATTR4args;
   1250 
   1251 struct SETATTR4res {
   1252 	nfsstat4 status;
   1253 	bitmap4 attrsset;
   1254 };
   1255 typedef struct SETATTR4res SETATTR4res;
   1256 
   1257 struct SETCLIENTID4args {
   1258 	nfs_client_id4 client;
   1259 	cb_client4 callback;
   1260 	uint32_t callback_ident;
   1261 };
   1262 typedef struct SETCLIENTID4args SETCLIENTID4args;
   1263 
   1264 struct SETCLIENTID4resok {
   1265 	clientid4 clientid;
   1266 	verifier4 setclientid_confirm;
   1267 };
   1268 typedef struct SETCLIENTID4resok SETCLIENTID4resok;
   1269 
   1270 struct SETCLIENTID4res {
   1271 	nfsstat4 status;
   1272 	union {
   1273 		SETCLIENTID4resok resok4;
   1274 		clientaddr4 client_using;
   1275 	} SETCLIENTID4res_u;
   1276 };
   1277 typedef struct SETCLIENTID4res SETCLIENTID4res;
   1278 
   1279 struct SETCLIENTID_CONFIRM4args {
   1280 	clientid4 clientid;
   1281 	verifier4 setclientid_confirm;
   1282 };
   1283 typedef struct SETCLIENTID_CONFIRM4args SETCLIENTID_CONFIRM4args;
   1284 
   1285 struct SETCLIENTID_CONFIRM4res {
   1286 	nfsstat4 status;
   1287 };
   1288 typedef struct SETCLIENTID_CONFIRM4res SETCLIENTID_CONFIRM4res;
   1289 
   1290 struct VERIFY4args {
   1291 	fattr4 obj_attributes;
   1292 };
   1293 typedef struct VERIFY4args VERIFY4args;
   1294 
   1295 struct VERIFY4res {
   1296 	nfsstat4 status;
   1297 };
   1298 typedef struct VERIFY4res VERIFY4res;
   1299 
   1300 enum stable_how4 {
   1301 	UNSTABLE4 = 0,
   1302 	DATA_SYNC4 = 1,
   1303 	FILE_SYNC4 = 2
   1304 };
   1305 typedef enum stable_how4 stable_how4;
   1306 
   1307 /*
   1308  * mblk doesn't go over the wire.  If non-NULL, it points to an mblk chain
   1309  * for the write data.
   1310  */
   1311 
   1312 struct WRITE4args {
   1313 	stateid4 stateid;
   1314 	offset4 offset;
   1315 	stable_how4 stable;
   1316 	uint_t data_len;
   1317 	char *data_val;
   1318 	mblk_t *mblk;
   1319 #ifdef _KERNEL
   1320 	struct clist *rlist;
   1321 	CONN *conn;
   1322 #endif
   1323 };
   1324 typedef struct WRITE4args WRITE4args;
   1325 
   1326 struct WRITE4res {
   1327 	nfsstat4 status;
   1328 	count4 count;
   1329 	stable_how4 committed;
   1330 	verifier4 writeverf;
   1331 };
   1332 typedef struct WRITE4res WRITE4res;
   1333 
   1334 struct RELEASE_LOCKOWNER4args {
   1335 	lock_owner4 lock_owner;
   1336 };
   1337 typedef struct RELEASE_LOCKOWNER4args RELEASE_LOCKOWNER4args;
   1338 
   1339 struct RELEASE_LOCKOWNER4res {
   1340 	nfsstat4 status;
   1341 };
   1342 typedef struct RELEASE_LOCKOWNER4res RELEASE_LOCKOWNER4res;
   1343 
   1344 struct ILLEGAL4res {
   1345 	nfsstat4 status;
   1346 };
   1347 typedef struct ILLEGAL4res ILLEGAL4res;
   1348 
   1349 enum nfs_opnum4 {
   1350 	OP_ACCESS = 3,
   1351 	OP_CLOSE = 4,
   1352 	OP_COMMIT = 5,
   1353 	OP_CREATE = 6,
   1354 	OP_DELEGPURGE = 7,
   1355 	OP_DELEGRETURN = 8,
   1356 	OP_GETATTR = 9,
   1357 	OP_GETFH = 10,
   1358 	OP_LINK = 11,
   1359 	OP_LOCK = 12,
   1360 	OP_LOCKT = 13,
   1361 	OP_LOCKU = 14,
   1362 	OP_LOOKUP = 15,
   1363 	OP_LOOKUPP = 16,
   1364 	OP_NVERIFY = 17,
   1365 	OP_OPEN = 18,
   1366 	OP_OPENATTR = 19,
   1367 	OP_OPEN_CONFIRM = 20,
   1368 	OP_OPEN_DOWNGRADE = 21,
   1369 	OP_PUTFH = 22,
   1370 	OP_PUTPUBFH = 23,
   1371 	OP_PUTROOTFH = 24,
   1372 	OP_READ = 25,
   1373 	OP_READDIR = 26,
   1374 	OP_READLINK = 27,
   1375 	OP_REMOVE = 28,
   1376 	OP_RENAME = 29,
   1377 	OP_RENEW = 30,
   1378 	OP_RESTOREFH = 31,
   1379 	OP_SAVEFH = 32,
   1380 	OP_SECINFO = 33,
   1381 	OP_SETATTR = 34,
   1382 	OP_SETCLIENTID = 35,
   1383 	OP_SETCLIENTID_CONFIRM = 36,
   1384 	OP_VERIFY = 37,
   1385 	OP_WRITE = 38,
   1386 	OP_RELEASE_LOCKOWNER = 39,
   1387 	OP_ILLEGAL = 10044,
   1388 /*
   1389  * These are internal client pseudo ops that *MUST* never go over the wire
   1390  */
   1391 #define	SUNW_PRIVATE_OP	0x10000000
   1392 #define	REAL_OP4(op)	((op) & ~SUNW_PRIVATE_OP)
   1393 	OP_CCREATE = OP_CREATE | SUNW_PRIVATE_OP,
   1394 	OP_CLINK = OP_LINK | SUNW_PRIVATE_OP,
   1395 	OP_CLOOKUP = OP_LOOKUP | SUNW_PRIVATE_OP,
   1396 	OP_COPEN = OP_OPEN | SUNW_PRIVATE_OP,
   1397 	OP_CPUTFH = OP_PUTFH | SUNW_PRIVATE_OP,
   1398 	OP_CREMOVE = OP_REMOVE | SUNW_PRIVATE_OP,
   1399 	OP_CRENAME = OP_RENAME | SUNW_PRIVATE_OP,
   1400 	OP_CSECINFO = OP_SECINFO | SUNW_PRIVATE_OP
   1401 };
   1402 typedef enum nfs_opnum4 nfs_opnum4;
   1403 
   1404 struct nfs_argop4 {
   1405 	nfs_opnum4 argop;
   1406 	union {
   1407 		ACCESS4args opaccess;
   1408 		CLOSE4args opclose;
   1409 		COMMIT4args opcommit;
   1410 		CREATE4args opcreate;
   1411 		CREATE4cargs opccreate;
   1412 		DELEGPURGE4args opdelegpurge;
   1413 		DELEGRETURN4args opdelegreturn;
   1414 		GETATTR4args opgetattr;
   1415 		LINK4args oplink;
   1416 		LINK4cargs opclink;
   1417 		LOCK4args oplock;
   1418 		LOCKT4args oplockt;
   1419 		LOCKU4args oplocku;
   1420 		LOOKUP4args oplookup;
   1421 		LOOKUP4cargs opclookup;
   1422 		NVERIFY4args opnverify;
   1423 		OPEN4args opopen;
   1424 		OPEN4cargs opcopen;
   1425 		OPENATTR4args opopenattr;
   1426 		OPEN_CONFIRM4args opopen_confirm;
   1427 		OPEN_DOWNGRADE4args opopen_downgrade;
   1428 		PUTFH4args opputfh;
   1429 		PUTFH4cargs opcputfh;
   1430 		READ4args opread;
   1431 		READDIR4args opreaddir;
   1432 		REMOVE4args opremove;
   1433 		REMOVE4cargs opcremove;
   1434 		RENAME4args oprename;
   1435 		RENAME4cargs opcrename;
   1436 		RENEW4args oprenew;
   1437 		SECINFO4args opsecinfo;
   1438 		SECINFO4cargs opcsecinfo;
   1439 		SETATTR4args opsetattr;
   1440 		SETCLIENTID4args opsetclientid;
   1441 		SETCLIENTID_CONFIRM4args opsetclientid_confirm;
   1442 		VERIFY4args opverify;
   1443 		WRITE4args opwrite;
   1444 		RELEASE_LOCKOWNER4args oprelease_lockowner;
   1445 	} nfs_argop4_u;
   1446 };
   1447 typedef struct nfs_argop4 nfs_argop4;
   1448 
   1449 struct nfs_resop4 {
   1450 	nfs_opnum4 resop;
   1451 	union {
   1452 		ACCESS4res opaccess;
   1453 		CLOSE4res opclose;
   1454 		COMMIT4res opcommit;
   1455 		CREATE4res opcreate;
   1456 		DELEGPURGE4res opdelegpurge;
   1457 		DELEGRETURN4res opdelegreturn;
   1458 		GETATTR4res opgetattr;
   1459 		GETFH4res opgetfh;
   1460 		LINK4res oplink;
   1461 		LOCK4res oplock;
   1462 		LOCKT4res oplockt;
   1463 		LOCKU4res oplocku;
   1464 		LOOKUP4res oplookup;
   1465 		LOOKUPP4res oplookupp;
   1466 		NVERIFY4res opnverify;
   1467 		OPEN4res opopen;
   1468 		OPENATTR4res opopenattr;
   1469 		OPEN_CONFIRM4res opopen_confirm;
   1470 		OPEN_DOWNGRADE4res opopen_downgrade;
   1471 		PUTFH4res opputfh;
   1472 		PUTPUBFH4res opputpubfh;
   1473 		PUTROOTFH4res opputrootfh;
   1474 		READ4res opread;
   1475 		READDIR4res opreaddir;
   1476 		READDIR4res_clnt opreaddirclnt;
   1477 		READLINK4res opreadlink;
   1478 		REMOVE4res opremove;
   1479 		RENAME4res oprename;
   1480 		RENEW4res oprenew;
   1481 		RESTOREFH4res oprestorefh;
   1482 		SAVEFH4res opsavefh;
   1483 		SECINFO4res opsecinfo;
   1484 		SETATTR4res opsetattr;
   1485 		SETCLIENTID4res opsetclientid;
   1486 		SETCLIENTID_CONFIRM4res opsetclientid_confirm;
   1487 		VERIFY4res opverify;
   1488 		WRITE4res opwrite;
   1489 		RELEASE_LOCKOWNER4res oprelease_lockowner;
   1490 		ILLEGAL4res opillegal;
   1491 	} nfs_resop4_u;
   1492 };
   1493 typedef struct nfs_resop4 nfs_resop4;
   1494 
   1495 /*
   1496  * Fixed size tag string for easy client encoding
   1497  */
   1498 struct _ctag {
   1499 	int ct_type;
   1500 	char *ct_str;
   1501 	uint32_t ct_tag[3];
   1502 };
   1503 typedef struct _ctag ctag_t;
   1504 
   1505 /*
   1506  * Client-only encode-only version
   1507  */
   1508 struct COMPOUND4args_clnt {
   1509 	int ctag;
   1510 	uint_t array_len;
   1511 	nfs_argop4 *array;
   1512 };
   1513 typedef struct COMPOUND4args_clnt COMPOUND4args_clnt;
   1514 
   1515 struct COMPOUND4args {
   1516 	utf8string tag;
   1517 	uint32_t minorversion;
   1518 	uint_t array_len;
   1519 	nfs_argop4 *array;
   1520 };
   1521 typedef struct COMPOUND4args COMPOUND4args;
   1522 
   1523 struct COMPOUND4res_clnt {
   1524 	nfsstat4 status;
   1525 	uint_t array_len;
   1526 	uint_t decode_len;
   1527 	nfs_resop4 *array;
   1528 	COMPOUND4args_clnt *argsp;
   1529 };
   1530 typedef struct COMPOUND4res_clnt COMPOUND4res_clnt;
   1531 
   1532 struct COMPOUND4res {
   1533 	nfsstat4 status;
   1534 	utf8string tag;
   1535 	uint_t array_len;
   1536 	nfs_resop4 *array;
   1537 };
   1538 typedef struct COMPOUND4res COMPOUND4res;
   1539 
   1540 struct CB_GETATTR4args {
   1541 	nfs_fh4 fh;
   1542 	bitmap4 attr_request;
   1543 };
   1544 typedef struct CB_GETATTR4args CB_GETATTR4args;
   1545 
   1546 struct CB_GETATTR4res {
   1547 	nfsstat4 status;
   1548 	fattr4 obj_attributes;
   1549 };
   1550 typedef struct CB_GETATTR4res CB_GETATTR4res;
   1551 
   1552 struct CB_RECALL4args {
   1553 	stateid4 stateid;
   1554 	bool_t truncate;
   1555 	nfs_fh4 fh;
   1556 };
   1557 typedef struct CB_RECALL4args CB_RECALL4args;
   1558 
   1559 struct CB_RECALL4res {
   1560 	nfsstat4 status;
   1561 };
   1562 typedef struct CB_RECALL4res CB_RECALL4res;
   1563 
   1564 struct CB_ILLEGAL4res {
   1565 	nfsstat4 status;
   1566 };
   1567 typedef struct CB_ILLEGAL4res CB_ILLEGAL4res;
   1568 
   1569 enum nfs_cb_opnum4 {
   1570 	OP_CB_GETATTR = 3,
   1571 	OP_CB_RECALL = 4,
   1572 	OP_CB_ILLEGAL = 10044
   1573 };
   1574 typedef enum nfs_cb_opnum4 nfs_cb_opnum4;
   1575 
   1576 struct nfs_cb_argop4 {
   1577 	uint_t argop;
   1578 	union {
   1579 		CB_GETATTR4args opcbgetattr;
   1580 		CB_RECALL4args opcbrecall;
   1581 	} nfs_cb_argop4_u;
   1582 };
   1583 typedef struct nfs_cb_argop4 nfs_cb_argop4;
   1584 
   1585 struct nfs_cb_resop4 {
   1586 	uint_t resop;
   1587 	union {
   1588 		CB_GETATTR4res opcbgetattr;
   1589 		CB_RECALL4res opcbrecall;
   1590 		CB_ILLEGAL4res opcbillegal;
   1591 	} nfs_cb_resop4_u;
   1592 };
   1593 typedef struct nfs_cb_resop4 nfs_cb_resop4;
   1594 
   1595 struct CB_COMPOUND4args {
   1596 	utf8string tag;
   1597 	uint32_t minorversion;
   1598 	uint32_t callback_ident;
   1599 	uint_t array_len;
   1600 	nfs_cb_argop4 *array;
   1601 };
   1602 typedef struct CB_COMPOUND4args CB_COMPOUND4args;
   1603 
   1604 struct CB_COMPOUND4res {
   1605 	nfsstat4 status;
   1606 	utf8string tag;
   1607 	uint_t array_len;
   1608 	nfs_cb_resop4 *array;
   1609 };
   1610 typedef struct CB_COMPOUND4res CB_COMPOUND4res;
   1611 
   1612 #define	NFS4_PROGRAM		100003
   1613 #define	NFS_V4			4
   1614 #define	NFSPROC4_NULL		0
   1615 #define	NFSPROC4_COMPOUND	1
   1616 
   1617 #define	NFS4_CALLBACK		0x40000000
   1618 #define	NFS_CB			1
   1619 #define	CB_NULL			0
   1620 #define	CB_COMPOUND		1
   1621 
   1622 extern  bool_t xdr_bitmap4(XDR *, bitmap4 *);
   1623 extern  bool_t xdr_utf8string(XDR *, utf8string *);
   1624 extern  bool_t xdr_nfs_fh4(XDR *, nfs_fh4 *);
   1625 extern  bool_t xdr_fattr4_fsid(XDR *, fattr4_fsid *);
   1626 extern  bool_t xdr_fattr4_acl(XDR *, fattr4_acl *);
   1627 extern  bool_t xdr_fattr4_fs_locations(XDR *, fattr4_fs_locations *);
   1628 extern  bool_t xdr_fattr4_rawdev(XDR *, fattr4_rawdev *);
   1629 extern  bool_t xdr_nfstime4(XDR *, nfstime4 *);
   1630 extern  bool_t xdr_settime4(XDR *, settime4 *);
   1631 extern  bool_t xdr_COMPOUND4args_clnt(XDR *, COMPOUND4args_clnt *);
   1632 extern  bool_t xdr_COMPOUND4args_srv(XDR *, COMPOUND4args *);
   1633 extern  bool_t xdr_COMPOUND4res_clnt(XDR *, COMPOUND4res_clnt *);
   1634 extern  bool_t xdr_COMPOUND4res_srv(XDR *, COMPOUND4res *);
   1635 extern  bool_t xdr_CB_COMPOUND4args_clnt(XDR *, CB_COMPOUND4args *);
   1636 extern  bool_t xdr_CB_COMPOUND4args_srv(XDR *, CB_COMPOUND4args *);
   1637 extern  bool_t xdr_CB_COMPOUND4res(XDR *, CB_COMPOUND4res *);
   1638 
   1639 
   1640 #ifdef __cplusplus
   1641 }
   1642 #endif
   1643 
   1644 #endif /* _NFS4_KPROT_H */
   1645