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