xref: /onnv-gate/usr/src/uts/common/nfs/nfs4_kprot.h (revision 11291:80bdcd03e626)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57387SRobert.Gordon@Sun.COM  * Common Development and Distribution License (the "License").
67387SRobert.Gordon@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11291SRobert.Thurlow@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _NFS4_KPROT_H
270Sstevel@tonic-gate #define	_NFS4_KPROT_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * Kernel specific version.
310Sstevel@tonic-gate  * NFS Version 4 protocol definitions.  From nfs4_prot.x rev 1.119.
320Sstevel@tonic-gate  */
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #ifdef __cplusplus
350Sstevel@tonic-gate extern "C" {
360Sstevel@tonic-gate #endif
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #include <rpc/rpc.h>
397387SRobert.Gordon@Sun.COM #ifdef _KERNEL
407387SRobert.Gordon@Sun.COM #include <rpc/rpc_rdma.h>
417387SRobert.Gordon@Sun.COM #endif
420Sstevel@tonic-gate #include <sys/stream.h>
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #define	NFS4_FHSIZE 128
450Sstevel@tonic-gate #define	NFS4_VERIFIER_SIZE 8
460Sstevel@tonic-gate 
470Sstevel@tonic-gate /*
480Sstevel@tonic-gate  * Reasonable upper bounds to catch badly behaving partners
490Sstevel@tonic-gate  */
500Sstevel@tonic-gate #define	NFS4_OPAQUE_LIMIT	1024
510Sstevel@tonic-gate #define	NFS4_COMPOUND_LIMIT	2048
520Sstevel@tonic-gate #define	NFS4_FS_LOCATIONS_LIMIT	65536
530Sstevel@tonic-gate #define	NFS4_ACL_LIMIT		65536
540Sstevel@tonic-gate #define	NFS4_SECINFO_LIMIT	65536
550Sstevel@tonic-gate #define	NFS4_FATTR4_LIMIT	1048576
560Sstevel@tonic-gate #define	NFS4_DATA_LIMIT		134217728
570Sstevel@tonic-gate 
580Sstevel@tonic-gate enum nfs_ftype4 {
590Sstevel@tonic-gate 	NF4REG = 1,
600Sstevel@tonic-gate 	NF4DIR = 2,
610Sstevel@tonic-gate 	NF4BLK = 3,
620Sstevel@tonic-gate 	NF4CHR = 4,
630Sstevel@tonic-gate 	NF4LNK = 5,
640Sstevel@tonic-gate 	NF4SOCK = 6,
650Sstevel@tonic-gate 	NF4FIFO = 7,
660Sstevel@tonic-gate 	NF4ATTRDIR = 8,
670Sstevel@tonic-gate 	NF4NAMEDATTR = 9
680Sstevel@tonic-gate };
690Sstevel@tonic-gate typedef enum nfs_ftype4 nfs_ftype4;
700Sstevel@tonic-gate 
710Sstevel@tonic-gate enum nfsstat4 {
720Sstevel@tonic-gate 	NFS4_OK = 0,
730Sstevel@tonic-gate 	NFS4ERR_PERM = 1,
740Sstevel@tonic-gate 	NFS4ERR_NOENT = 2,
750Sstevel@tonic-gate 	NFS4ERR_IO = 5,
760Sstevel@tonic-gate 	NFS4ERR_NXIO = 6,
770Sstevel@tonic-gate 	NFS4ERR_ACCESS = 13,
780Sstevel@tonic-gate 	NFS4ERR_EXIST = 17,
790Sstevel@tonic-gate 	NFS4ERR_XDEV = 18,
800Sstevel@tonic-gate 	NFS4ERR_NOTDIR = 20,
810Sstevel@tonic-gate 	NFS4ERR_ISDIR = 21,
820Sstevel@tonic-gate 	NFS4ERR_INVAL = 22,
830Sstevel@tonic-gate 	NFS4ERR_FBIG = 27,
840Sstevel@tonic-gate 	NFS4ERR_NOSPC = 28,
850Sstevel@tonic-gate 	NFS4ERR_ROFS = 30,
860Sstevel@tonic-gate 	NFS4ERR_MLINK = 31,
870Sstevel@tonic-gate 	NFS4ERR_NAMETOOLONG = 63,
880Sstevel@tonic-gate 	NFS4ERR_NOTEMPTY = 66,
890Sstevel@tonic-gate 	NFS4ERR_DQUOT = 69,
900Sstevel@tonic-gate 	NFS4ERR_STALE = 70,
910Sstevel@tonic-gate 	NFS4ERR_BADHANDLE = 10001,
920Sstevel@tonic-gate 	NFS4ERR_BAD_COOKIE = 10003,
930Sstevel@tonic-gate 	NFS4ERR_NOTSUPP = 10004,
940Sstevel@tonic-gate 	NFS4ERR_TOOSMALL = 10005,
950Sstevel@tonic-gate 	NFS4ERR_SERVERFAULT = 10006,
960Sstevel@tonic-gate 	NFS4ERR_BADTYPE = 10007,
970Sstevel@tonic-gate 	NFS4ERR_DELAY = 10008,
980Sstevel@tonic-gate 	NFS4ERR_SAME = 10009,
990Sstevel@tonic-gate 	NFS4ERR_DENIED = 10010,
1000Sstevel@tonic-gate 	NFS4ERR_EXPIRED = 10011,
1010Sstevel@tonic-gate 	NFS4ERR_LOCKED = 10012,
1020Sstevel@tonic-gate 	NFS4ERR_GRACE = 10013,
1030Sstevel@tonic-gate 	NFS4ERR_FHEXPIRED = 10014,
1040Sstevel@tonic-gate 	NFS4ERR_SHARE_DENIED = 10015,
1050Sstevel@tonic-gate 	NFS4ERR_WRONGSEC = 10016,
1060Sstevel@tonic-gate 	NFS4ERR_CLID_INUSE = 10017,
1070Sstevel@tonic-gate 	NFS4ERR_RESOURCE = 10018,
1080Sstevel@tonic-gate 	NFS4ERR_MOVED = 10019,
1090Sstevel@tonic-gate 	NFS4ERR_NOFILEHANDLE = 10020,
1100Sstevel@tonic-gate 	NFS4ERR_MINOR_VERS_MISMATCH = 10021,
1110Sstevel@tonic-gate 	NFS4ERR_STALE_CLIENTID = 10022,
1120Sstevel@tonic-gate 	NFS4ERR_STALE_STATEID = 10023,
1130Sstevel@tonic-gate 	NFS4ERR_OLD_STATEID = 10024,
1140Sstevel@tonic-gate 	NFS4ERR_BAD_STATEID = 10025,
1150Sstevel@tonic-gate 	NFS4ERR_BAD_SEQID = 10026,
1160Sstevel@tonic-gate 	NFS4ERR_NOT_SAME = 10027,
1170Sstevel@tonic-gate 	NFS4ERR_LOCK_RANGE = 10028,
1180Sstevel@tonic-gate 	NFS4ERR_SYMLINK = 10029,
1190Sstevel@tonic-gate 	NFS4ERR_RESTOREFH = 10030,
1200Sstevel@tonic-gate 	NFS4ERR_LEASE_MOVED = 10031,
1210Sstevel@tonic-gate 	NFS4ERR_ATTRNOTSUPP = 10032,
1220Sstevel@tonic-gate 	NFS4ERR_NO_GRACE = 10033,
1230Sstevel@tonic-gate 	NFS4ERR_RECLAIM_BAD = 10034,
1240Sstevel@tonic-gate 	NFS4ERR_RECLAIM_CONFLICT = 10035,
1250Sstevel@tonic-gate 	NFS4ERR_BADXDR = 10036,
1260Sstevel@tonic-gate 	NFS4ERR_LOCKS_HELD = 10037,
1270Sstevel@tonic-gate 	NFS4ERR_OPENMODE = 10038,
1280Sstevel@tonic-gate 	NFS4ERR_BADOWNER = 10039,
1290Sstevel@tonic-gate 	NFS4ERR_BADCHAR = 10040,
1300Sstevel@tonic-gate 	NFS4ERR_BADNAME = 10041,
1310Sstevel@tonic-gate 	NFS4ERR_BAD_RANGE = 10042,
1320Sstevel@tonic-gate 	NFS4ERR_LOCK_NOTSUPP = 10043,
1330Sstevel@tonic-gate 	NFS4ERR_OP_ILLEGAL = 10044,
1340Sstevel@tonic-gate 	NFS4ERR_DEADLOCK = 10045,
1350Sstevel@tonic-gate 	NFS4ERR_FILE_OPEN = 10046,
1360Sstevel@tonic-gate 	NFS4ERR_ADMIN_REVOKED = 10047,
1370Sstevel@tonic-gate 	NFS4ERR_CB_PATH_DOWN = 10048
1380Sstevel@tonic-gate };
1390Sstevel@tonic-gate typedef enum nfsstat4 nfsstat4;
1400Sstevel@tonic-gate 
1410Sstevel@tonic-gate /*
1420Sstevel@tonic-gate  * A bitmap can only be 56 bits, treat it as a uint64_t for now
1430Sstevel@tonic-gate  */
1440Sstevel@tonic-gate typedef uint64_t bitmap4;
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate typedef uint64_t offset4;
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate typedef uint32_t count4;
1490Sstevel@tonic-gate 
1500Sstevel@tonic-gate typedef uint64_t length4;
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate typedef uint64_t clientid4;
1530Sstevel@tonic-gate 
1540Sstevel@tonic-gate typedef uint32_t seqid4;
1550Sstevel@tonic-gate 
1560Sstevel@tonic-gate typedef struct {
1570Sstevel@tonic-gate 	uint_t utf8string_len;
1580Sstevel@tonic-gate 	char *utf8string_val;
1590Sstevel@tonic-gate } utf8string;
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate typedef utf8string component4;
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate typedef struct {
1640Sstevel@tonic-gate 	uint_t pathname4_len;
1650Sstevel@tonic-gate 	component4 *pathname4_val;
1660Sstevel@tonic-gate } pathname4;
1670Sstevel@tonic-gate 
1680Sstevel@tonic-gate typedef uint64_t nfs_lockid4;
1690Sstevel@tonic-gate 
1700Sstevel@tonic-gate typedef uint64_t nfs_cookie4;
1710Sstevel@tonic-gate 
1720Sstevel@tonic-gate typedef utf8string linktext4;
1730Sstevel@tonic-gate 
1740Sstevel@tonic-gate typedef struct {
1750Sstevel@tonic-gate 	uint_t sec_oid4_len;
1760Sstevel@tonic-gate 	char *sec_oid4_val;
1770Sstevel@tonic-gate } sec_oid4;
1780Sstevel@tonic-gate 
1790Sstevel@tonic-gate typedef uint32_t qop4;
1800Sstevel@tonic-gate 
1810Sstevel@tonic-gate typedef uint32_t mode4;
1820Sstevel@tonic-gate 
1830Sstevel@tonic-gate typedef uint64_t changeid4;
1840Sstevel@tonic-gate 
1850Sstevel@tonic-gate typedef uint64_t verifier4;
1860Sstevel@tonic-gate 
1870Sstevel@tonic-gate struct nfstime4 {
1880Sstevel@tonic-gate 	int64_t seconds;
1890Sstevel@tonic-gate 	uint32_t nseconds;
1900Sstevel@tonic-gate };
1910Sstevel@tonic-gate typedef struct nfstime4 nfstime4;
1920Sstevel@tonic-gate 
1930Sstevel@tonic-gate enum time_how4 {
1940Sstevel@tonic-gate 	SET_TO_SERVER_TIME4 = 0,
1950Sstevel@tonic-gate 	SET_TO_CLIENT_TIME4 = 1
1960Sstevel@tonic-gate };
1970Sstevel@tonic-gate typedef enum time_how4 time_how4;
1980Sstevel@tonic-gate 
1990Sstevel@tonic-gate struct settime4 {
2000Sstevel@tonic-gate 	time_how4 set_it;
2010Sstevel@tonic-gate 	nfstime4 time;
2020Sstevel@tonic-gate };
2030Sstevel@tonic-gate typedef struct settime4 settime4;
2040Sstevel@tonic-gate 
2050Sstevel@tonic-gate typedef struct {
2060Sstevel@tonic-gate 	uint_t nfs_fh4_len;
2070Sstevel@tonic-gate 	char *nfs_fh4_val;
2080Sstevel@tonic-gate } nfs_fh4;
2090Sstevel@tonic-gate 
2100Sstevel@tonic-gate struct fsid4 {
2110Sstevel@tonic-gate 	uint64_t major;
2120Sstevel@tonic-gate 	uint64_t minor;
2130Sstevel@tonic-gate };
2140Sstevel@tonic-gate typedef struct fsid4 fsid4;
2150Sstevel@tonic-gate 
2160Sstevel@tonic-gate struct fs_location4 {
2170Sstevel@tonic-gate 	uint_t server_len;
2180Sstevel@tonic-gate 	utf8string *server_val;
2190Sstevel@tonic-gate 	pathname4 rootpath;
2200Sstevel@tonic-gate };
2210Sstevel@tonic-gate typedef struct fs_location4 fs_location4;
2220Sstevel@tonic-gate 
2230Sstevel@tonic-gate struct fs_locations4 {
2240Sstevel@tonic-gate 	pathname4 fs_root;
2250Sstevel@tonic-gate 	uint_t locations_len;
2260Sstevel@tonic-gate 	fs_location4 *locations_val;
2270Sstevel@tonic-gate };
2280Sstevel@tonic-gate typedef struct fs_locations4 fs_locations4;
2290Sstevel@tonic-gate 
230*11291SRobert.Thurlow@Sun.COM struct nfs_fsl_info {
231*11291SRobert.Thurlow@Sun.COM 	uint_t netbuf_len;
232*11291SRobert.Thurlow@Sun.COM 	uint_t netnm_len;
233*11291SRobert.Thurlow@Sun.COM 	uint_t knconf_len;
234*11291SRobert.Thurlow@Sun.COM 	char *netname;
235*11291SRobert.Thurlow@Sun.COM 	struct netbuf *addr;
236*11291SRobert.Thurlow@Sun.COM 	struct knetconfig *knconf;
237*11291SRobert.Thurlow@Sun.COM };
238*11291SRobert.Thurlow@Sun.COM 
2390Sstevel@tonic-gate /*
2400Sstevel@tonic-gate  * ACL support
2410Sstevel@tonic-gate  */
2420Sstevel@tonic-gate 
2430Sstevel@tonic-gate #define	ACL4_SUPPORT_ALLOW_ACL 0x00000001
2440Sstevel@tonic-gate #define	ACL4_SUPPORT_DENY_ACL 0x00000002
2450Sstevel@tonic-gate #define	ACL4_SUPPORT_AUDIT_ACL 0x00000004
2460Sstevel@tonic-gate #define	ACL4_SUPPORT_ALARM_ACL 0x00000008
2470Sstevel@tonic-gate 
2480Sstevel@tonic-gate typedef uint32_t acetype4;
2490Sstevel@tonic-gate #define	ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000
2500Sstevel@tonic-gate #define	ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
2510Sstevel@tonic-gate #define	ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002
2520Sstevel@tonic-gate #define	ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003
2530Sstevel@tonic-gate 
2540Sstevel@tonic-gate typedef uint32_t aceflag4;
2550Sstevel@tonic-gate #define	ACE4_FILE_INHERIT_ACE 0x00000001
2560Sstevel@tonic-gate #define	ACE4_DIRECTORY_INHERIT_ACE 0x00000002
2570Sstevel@tonic-gate #define	ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004
2580Sstevel@tonic-gate #define	ACE4_INHERIT_ONLY_ACE 0x00000008
2590Sstevel@tonic-gate #define	ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
2600Sstevel@tonic-gate #define	ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
2610Sstevel@tonic-gate #define	ACE4_IDENTIFIER_GROUP 0x00000040
2620Sstevel@tonic-gate /*
2630Sstevel@tonic-gate  * This defines all valid flag bits, as defined by RFC 3530.  If
2640Sstevel@tonic-gate  * any additional flag bits are deemed part of the NFSv4 spec,
2650Sstevel@tonic-gate  * you must also add them to the definition below.
2660Sstevel@tonic-gate  */
2670Sstevel@tonic-gate #define	ACE4_VALID_FLAG_BITS (\
2680Sstevel@tonic-gate     ACE4_FILE_INHERIT_ACE | \
2690Sstevel@tonic-gate     ACE4_DIRECTORY_INHERIT_ACE | \
2700Sstevel@tonic-gate     ACE4_NO_PROPAGATE_INHERIT_ACE | \
2710Sstevel@tonic-gate     ACE4_INHERIT_ONLY_ACE | \
2720Sstevel@tonic-gate     ACE4_SUCCESSFUL_ACCESS_ACE_FLAG | \
2730Sstevel@tonic-gate     ACE4_FAILED_ACCESS_ACE_FLAG | \
2740Sstevel@tonic-gate     ACE4_IDENTIFIER_GROUP)
2750Sstevel@tonic-gate 
2760Sstevel@tonic-gate typedef uint32_t acemask4;
2770Sstevel@tonic-gate #define	ACE4_READ_DATA 0x00000001
2780Sstevel@tonic-gate #define	ACE4_LIST_DIRECTORY 0x00000001
2790Sstevel@tonic-gate #define	ACE4_WRITE_DATA 0x00000002
2800Sstevel@tonic-gate #define	ACE4_ADD_FILE 0x00000002
2810Sstevel@tonic-gate #define	ACE4_APPEND_DATA 0x00000004
2820Sstevel@tonic-gate #define	ACE4_ADD_SUBDIRECTORY 0x00000004
2830Sstevel@tonic-gate #define	ACE4_READ_NAMED_ATTRS 0x00000008
2840Sstevel@tonic-gate #define	ACE4_WRITE_NAMED_ATTRS 0x00000010
2850Sstevel@tonic-gate #define	ACE4_EXECUTE 0x00000020
2860Sstevel@tonic-gate #define	ACE4_DELETE_CHILD 0x00000040
2870Sstevel@tonic-gate #define	ACE4_READ_ATTRIBUTES 0x00000080
2880Sstevel@tonic-gate #define	ACE4_WRITE_ATTRIBUTES 0x00000100
2890Sstevel@tonic-gate #define	ACE4_DELETE 0x00010000
2900Sstevel@tonic-gate #define	ACE4_READ_ACL 0x00020000
2910Sstevel@tonic-gate #define	ACE4_WRITE_ACL 0x00040000
2920Sstevel@tonic-gate #define	ACE4_WRITE_OWNER 0x00080000
2930Sstevel@tonic-gate #define	ACE4_SYNCHRONIZE 0x00100000
2940Sstevel@tonic-gate #define	ACE4_GENERIC_READ 0x00120081
2950Sstevel@tonic-gate #define	ACE4_GENERIC_WRITE 0x00160106
2960Sstevel@tonic-gate #define	ACE4_GENERIC_EXECUTE 0x001200A0
2970Sstevel@tonic-gate /*
2980Sstevel@tonic-gate  * This defines all valid access mask bits, as defined by RFC 3530.  If
2990Sstevel@tonic-gate  * any additional access mask bits are deemed part of the NFSv4 spec,
3000Sstevel@tonic-gate  * you must also add them to the definition below.
3010Sstevel@tonic-gate  */
3020Sstevel@tonic-gate #define	ACE4_VALID_MASK_BITS (\
3030Sstevel@tonic-gate     ACE4_READ_DATA | \
3040Sstevel@tonic-gate     ACE4_LIST_DIRECTORY | \
3050Sstevel@tonic-gate     ACE4_WRITE_DATA | \
3060Sstevel@tonic-gate     ACE4_ADD_FILE | \
3070Sstevel@tonic-gate     ACE4_APPEND_DATA | \
3080Sstevel@tonic-gate     ACE4_ADD_SUBDIRECTORY | \
3090Sstevel@tonic-gate     ACE4_READ_NAMED_ATTRS | \
3100Sstevel@tonic-gate     ACE4_WRITE_NAMED_ATTRS | \
3110Sstevel@tonic-gate     ACE4_EXECUTE | \
3120Sstevel@tonic-gate     ACE4_DELETE_CHILD | \
3130Sstevel@tonic-gate     ACE4_READ_ATTRIBUTES | \
3140Sstevel@tonic-gate     ACE4_WRITE_ATTRIBUTES | \
3150Sstevel@tonic-gate     ACE4_DELETE | \
3160Sstevel@tonic-gate     ACE4_READ_ACL | \
3170Sstevel@tonic-gate     ACE4_WRITE_ACL | \
3180Sstevel@tonic-gate     ACE4_WRITE_OWNER | \
3190Sstevel@tonic-gate     ACE4_SYNCHRONIZE)
3200Sstevel@tonic-gate 
3210Sstevel@tonic-gate /* Used to signify an undefined value for an acemask4 */
3220Sstevel@tonic-gate #define	ACE4_MASK_UNDEFINED 0x80000000
3230Sstevel@tonic-gate 
3240Sstevel@tonic-gate #define	ACE4_WHO_OWNER		"OWNER@"
3250Sstevel@tonic-gate #define	ACE4_WHO_GROUP		"GROUP@"
3260Sstevel@tonic-gate #define	ACE4_WHO_EVERYONE	"EVERYONE@"
3270Sstevel@tonic-gate 
3280Sstevel@tonic-gate struct nfsace4 {
3290Sstevel@tonic-gate 	acetype4 type;
3300Sstevel@tonic-gate 	aceflag4 flag;
3310Sstevel@tonic-gate 	acemask4 access_mask;
3320Sstevel@tonic-gate 	utf8string who;
3330Sstevel@tonic-gate };
3340Sstevel@tonic-gate typedef struct nfsace4 nfsace4;
3350Sstevel@tonic-gate #define	MODE4_SUID 0x800
3360Sstevel@tonic-gate #define	MODE4_SGID 0x400
3370Sstevel@tonic-gate #define	MODE4_SVTX 0x200
3380Sstevel@tonic-gate #define	MODE4_RUSR 0x100
3390Sstevel@tonic-gate #define	MODE4_WUSR 0x080
3400Sstevel@tonic-gate #define	MODE4_XUSR 0x040
3410Sstevel@tonic-gate #define	MODE4_RGRP 0x020
3420Sstevel@tonic-gate #define	MODE4_WGRP 0x010
3430Sstevel@tonic-gate #define	MODE4_XGRP 0x008
3440Sstevel@tonic-gate #define	MODE4_ROTH 0x004
3450Sstevel@tonic-gate #define	MODE4_WOTH 0x002
3460Sstevel@tonic-gate #define	MODE4_XOTH 0x001
3470Sstevel@tonic-gate 
3480Sstevel@tonic-gate /*
3490Sstevel@tonic-gate  * ACL conversion helpers
3500Sstevel@tonic-gate  */
3510Sstevel@tonic-gate 
3520Sstevel@tonic-gate typedef enum {
3530Sstevel@tonic-gate 	ace4_unused,
3540Sstevel@tonic-gate 	ace4_user_obj,
3550Sstevel@tonic-gate 	ace4_user,
3560Sstevel@tonic-gate 	ace4_group, /* includes GROUP and GROUP_OBJ */
3570Sstevel@tonic-gate 	ace4_other_obj
3580Sstevel@tonic-gate } ace4_to_aent_state_t;
3590Sstevel@tonic-gate 
3600Sstevel@tonic-gate typedef struct ace4vals {
3610Sstevel@tonic-gate 	utf8string *key; /* NB: not allocated here; points to existing utf8 */
3620Sstevel@tonic-gate 	avl_node_t avl;
3630Sstevel@tonic-gate 	acemask4 mask;
3640Sstevel@tonic-gate 	acemask4 allowed;
3650Sstevel@tonic-gate 	acemask4 denied;
3660Sstevel@tonic-gate 	int aent_type;
3670Sstevel@tonic-gate } ace4vals_t;
3680Sstevel@tonic-gate 
3690Sstevel@tonic-gate typedef struct ace4_list {
3700Sstevel@tonic-gate 	ace4vals_t user_obj;
3710Sstevel@tonic-gate 	avl_tree_t user;
3720Sstevel@tonic-gate 	int numusers;
3730Sstevel@tonic-gate 	ace4vals_t group_obj;
3740Sstevel@tonic-gate 	avl_tree_t group;
3750Sstevel@tonic-gate 	int numgroups;
3760Sstevel@tonic-gate 	ace4vals_t other_obj;
3770Sstevel@tonic-gate 	acemask4 acl_mask;
3780Sstevel@tonic-gate 	int hasmask;
3790Sstevel@tonic-gate 	int dfacl_flag;
3800Sstevel@tonic-gate 	ace4_to_aent_state_t state;
3810Sstevel@tonic-gate 	int seen; /* bitmask of all aclent_t a_type values seen */
3820Sstevel@tonic-gate } ace4_list_t;
3830Sstevel@tonic-gate 
3840Sstevel@tonic-gate struct specdata4 {
3850Sstevel@tonic-gate 	uint32_t specdata1;
3860Sstevel@tonic-gate 	uint32_t specdata2;
3870Sstevel@tonic-gate };
3880Sstevel@tonic-gate typedef struct specdata4 specdata4;
3890Sstevel@tonic-gate #define	FH4_PERSISTENT 0x00000000
3900Sstevel@tonic-gate #define	FH4_NOEXPIRE_WITH_OPEN 0x00000001
3910Sstevel@tonic-gate #define	FH4_VOLATILE_ANY 0x00000002
3920Sstevel@tonic-gate #define	FH4_VOL_MIGRATION 0x00000004
3930Sstevel@tonic-gate #define	FH4_VOL_RENAME 0x00000008
3940Sstevel@tonic-gate 
3950Sstevel@tonic-gate typedef bitmap4 fattr4_supported_attrs;
3960Sstevel@tonic-gate 
3970Sstevel@tonic-gate typedef nfs_ftype4 fattr4_type;
3980Sstevel@tonic-gate 
3990Sstevel@tonic-gate typedef uint32_t fattr4_fh_expire_type;
4000Sstevel@tonic-gate 
4010Sstevel@tonic-gate typedef changeid4 fattr4_change;
4020Sstevel@tonic-gate 
4030Sstevel@tonic-gate typedef uint64_t fattr4_size;
4040Sstevel@tonic-gate 
4050Sstevel@tonic-gate typedef bool_t fattr4_link_support;
4060Sstevel@tonic-gate 
4070Sstevel@tonic-gate typedef bool_t fattr4_symlink_support;
4080Sstevel@tonic-gate 
4090Sstevel@tonic-gate typedef bool_t fattr4_named_attr;
4100Sstevel@tonic-gate 
4110Sstevel@tonic-gate typedef fsid4 fattr4_fsid;
4120Sstevel@tonic-gate 
4130Sstevel@tonic-gate typedef bool_t fattr4_unique_handles;
4140Sstevel@tonic-gate 
4150Sstevel@tonic-gate typedef uint32_t fattr4_lease_time;
4160Sstevel@tonic-gate 
4170Sstevel@tonic-gate typedef nfsstat4 fattr4_rdattr_error;
4180Sstevel@tonic-gate 
4190Sstevel@tonic-gate typedef struct {
4200Sstevel@tonic-gate 	uint_t fattr4_acl_len;
4210Sstevel@tonic-gate 	nfsace4 *fattr4_acl_val;
4220Sstevel@tonic-gate } fattr4_acl;
4230Sstevel@tonic-gate 
4240Sstevel@tonic-gate typedef uint32_t fattr4_aclsupport;
4250Sstevel@tonic-gate 
4260Sstevel@tonic-gate typedef bool_t fattr4_archive;
4270Sstevel@tonic-gate 
4280Sstevel@tonic-gate typedef bool_t fattr4_cansettime;
4290Sstevel@tonic-gate 
4300Sstevel@tonic-gate typedef bool_t fattr4_case_insensitive;
4310Sstevel@tonic-gate 
4320Sstevel@tonic-gate typedef bool_t fattr4_case_preserving;
4330Sstevel@tonic-gate 
4340Sstevel@tonic-gate typedef bool_t fattr4_chown_restricted;
4350Sstevel@tonic-gate 
4360Sstevel@tonic-gate typedef uint64_t fattr4_fileid;
4370Sstevel@tonic-gate 
4380Sstevel@tonic-gate typedef uint64_t fattr4_files_avail;
4390Sstevel@tonic-gate 
4400Sstevel@tonic-gate typedef nfs_fh4 fattr4_filehandle;
4410Sstevel@tonic-gate 
4420Sstevel@tonic-gate typedef uint64_t fattr4_files_free;
4430Sstevel@tonic-gate 
4440Sstevel@tonic-gate typedef uint64_t fattr4_files_total;
4450Sstevel@tonic-gate 
4460Sstevel@tonic-gate typedef fs_locations4 fattr4_fs_locations;
4470Sstevel@tonic-gate 
4480Sstevel@tonic-gate typedef bool_t fattr4_hidden;
4490Sstevel@tonic-gate 
4500Sstevel@tonic-gate typedef bool_t fattr4_homogeneous;
4510Sstevel@tonic-gate 
4520Sstevel@tonic-gate typedef uint64_t fattr4_maxfilesize;
4530Sstevel@tonic-gate 
4540Sstevel@tonic-gate typedef uint32_t fattr4_maxlink;
4550Sstevel@tonic-gate 
4560Sstevel@tonic-gate typedef uint32_t fattr4_maxname;
4570Sstevel@tonic-gate 
4580Sstevel@tonic-gate typedef uint64_t fattr4_maxread;
4590Sstevel@tonic-gate 
4600Sstevel@tonic-gate typedef uint64_t fattr4_maxwrite;
4610Sstevel@tonic-gate 
4620Sstevel@tonic-gate typedef utf8string fattr4_mimetype;
4630Sstevel@tonic-gate 
4640Sstevel@tonic-gate typedef mode4 fattr4_mode;
4650Sstevel@tonic-gate 
4660Sstevel@tonic-gate typedef uint64_t fattr4_mounted_on_fileid;
4670Sstevel@tonic-gate 
4680Sstevel@tonic-gate typedef bool_t fattr4_no_trunc;
4690Sstevel@tonic-gate 
4700Sstevel@tonic-gate typedef uint32_t fattr4_numlinks;
4710Sstevel@tonic-gate 
4720Sstevel@tonic-gate typedef utf8string fattr4_owner;
4730Sstevel@tonic-gate 
4740Sstevel@tonic-gate typedef utf8string fattr4_owner_group;
4750Sstevel@tonic-gate 
4760Sstevel@tonic-gate typedef uint64_t fattr4_quota_avail_hard;
4770Sstevel@tonic-gate 
4780Sstevel@tonic-gate typedef uint64_t fattr4_quota_avail_soft;
4790Sstevel@tonic-gate 
4800Sstevel@tonic-gate typedef uint64_t fattr4_quota_used;
4810Sstevel@tonic-gate 
4820Sstevel@tonic-gate typedef specdata4 fattr4_rawdev;
4830Sstevel@tonic-gate 
4840Sstevel@tonic-gate typedef uint64_t fattr4_space_avail;
4850Sstevel@tonic-gate 
4860Sstevel@tonic-gate typedef uint64_t fattr4_space_free;
4870Sstevel@tonic-gate 
4880Sstevel@tonic-gate typedef uint64_t fattr4_space_total;
4890Sstevel@tonic-gate 
4900Sstevel@tonic-gate typedef uint64_t fattr4_space_used;
4910Sstevel@tonic-gate 
4920Sstevel@tonic-gate typedef bool_t fattr4_system;
4930Sstevel@tonic-gate 
4940Sstevel@tonic-gate typedef nfstime4 fattr4_time_access;
4950Sstevel@tonic-gate 
4960Sstevel@tonic-gate typedef settime4 fattr4_time_access_set;
4970Sstevel@tonic-gate 
4980Sstevel@tonic-gate typedef nfstime4 fattr4_time_backup;
4990Sstevel@tonic-gate 
5000Sstevel@tonic-gate typedef nfstime4 fattr4_time_create;
5010Sstevel@tonic-gate 
5020Sstevel@tonic-gate typedef nfstime4 fattr4_time_delta;
5030Sstevel@tonic-gate 
5040Sstevel@tonic-gate typedef nfstime4 fattr4_time_metadata;
5050Sstevel@tonic-gate 
5060Sstevel@tonic-gate typedef nfstime4 fattr4_time_modify;
5070Sstevel@tonic-gate 
5080Sstevel@tonic-gate typedef settime4 fattr4_time_modify_set;
5090Sstevel@tonic-gate #define	FATTR4_SUPPORTED_ATTRS 0
5100Sstevel@tonic-gate #define	FATTR4_TYPE 1
5110Sstevel@tonic-gate #define	FATTR4_FH_EXPIRE_TYPE 2
5120Sstevel@tonic-gate #define	FATTR4_CHANGE 3
5130Sstevel@tonic-gate #define	FATTR4_SIZE 4
5140Sstevel@tonic-gate #define	FATTR4_LINK_SUPPORT 5
5150Sstevel@tonic-gate #define	FATTR4_SYMLINK_SUPPORT 6
5160Sstevel@tonic-gate #define	FATTR4_NAMED_ATTR 7
5170Sstevel@tonic-gate #define	FATTR4_FSID 8
5180Sstevel@tonic-gate #define	FATTR4_UNIQUE_HANDLES 9
5190Sstevel@tonic-gate #define	FATTR4_LEASE_TIME 10
5200Sstevel@tonic-gate #define	FATTR4_RDATTR_ERROR 11
5210Sstevel@tonic-gate #define	FATTR4_FILEHANDLE 19
5220Sstevel@tonic-gate #define	FATTR4_ACL 12
5230Sstevel@tonic-gate #define	FATTR4_ACLSUPPORT 13
5240Sstevel@tonic-gate #define	FATTR4_ARCHIVE 14
5250Sstevel@tonic-gate #define	FATTR4_CANSETTIME 15
5260Sstevel@tonic-gate #define	FATTR4_CASE_INSENSITIVE 16
5270Sstevel@tonic-gate #define	FATTR4_CASE_PRESERVING 17
5280Sstevel@tonic-gate #define	FATTR4_CHOWN_RESTRICTED 18
5290Sstevel@tonic-gate #define	FATTR4_FILEID 20
5300Sstevel@tonic-gate #define	FATTR4_FILES_AVAIL 21
5310Sstevel@tonic-gate #define	FATTR4_FILES_FREE 22
5320Sstevel@tonic-gate #define	FATTR4_FILES_TOTAL 23
5330Sstevel@tonic-gate #define	FATTR4_FS_LOCATIONS 24
5340Sstevel@tonic-gate #define	FATTR4_HIDDEN 25
5350Sstevel@tonic-gate #define	FATTR4_HOMOGENEOUS 26
5360Sstevel@tonic-gate #define	FATTR4_MAXFILESIZE 27
5370Sstevel@tonic-gate #define	FATTR4_MAXLINK 28
5380Sstevel@tonic-gate #define	FATTR4_MAXNAME 29
5390Sstevel@tonic-gate #define	FATTR4_MAXREAD 30
5400Sstevel@tonic-gate #define	FATTR4_MAXWRITE 31
5410Sstevel@tonic-gate #define	FATTR4_MIMETYPE 32
5420Sstevel@tonic-gate #define	FATTR4_MODE 33
5430Sstevel@tonic-gate #define	FATTR4_NO_TRUNC 34
5440Sstevel@tonic-gate #define	FATTR4_NUMLINKS 35
5450Sstevel@tonic-gate #define	FATTR4_OWNER 36
5460Sstevel@tonic-gate #define	FATTR4_OWNER_GROUP 37
5470Sstevel@tonic-gate #define	FATTR4_QUOTA_AVAIL_HARD 38
5480Sstevel@tonic-gate #define	FATTR4_QUOTA_AVAIL_SOFT 39
5490Sstevel@tonic-gate #define	FATTR4_QUOTA_USED 40
5500Sstevel@tonic-gate #define	FATTR4_RAWDEV 41
5510Sstevel@tonic-gate #define	FATTR4_SPACE_AVAIL 42
5520Sstevel@tonic-gate #define	FATTR4_SPACE_FREE 43
5530Sstevel@tonic-gate #define	FATTR4_SPACE_TOTAL 44
5540Sstevel@tonic-gate #define	FATTR4_SPACE_USED 45
5550Sstevel@tonic-gate #define	FATTR4_SYSTEM 46
5560Sstevel@tonic-gate #define	FATTR4_TIME_ACCESS 47
5570Sstevel@tonic-gate #define	FATTR4_TIME_ACCESS_SET 48
5580Sstevel@tonic-gate #define	FATTR4_TIME_BACKUP 49
5590Sstevel@tonic-gate #define	FATTR4_TIME_CREATE 50
5600Sstevel@tonic-gate #define	FATTR4_TIME_DELTA 51
5610Sstevel@tonic-gate #define	FATTR4_TIME_METADATA 52
5620Sstevel@tonic-gate #define	FATTR4_TIME_MODIFY 53
5630Sstevel@tonic-gate #define	FATTR4_TIME_MODIFY_SET 54
5640Sstevel@tonic-gate #define	FATTR4_MOUNTED_ON_FILEID 55
5650Sstevel@tonic-gate 
5660Sstevel@tonic-gate struct fattr4 {
5670Sstevel@tonic-gate 	bitmap4 attrmask;
5680Sstevel@tonic-gate 	char *attrlist4;
5690Sstevel@tonic-gate 	uint_t attrlist4_len;
5700Sstevel@tonic-gate };
5710Sstevel@tonic-gate typedef struct fattr4 fattr4;
5720Sstevel@tonic-gate 
5730Sstevel@tonic-gate struct change_info4 {
5740Sstevel@tonic-gate 	bool_t atomic;
5750Sstevel@tonic-gate 	changeid4 before;
5760Sstevel@tonic-gate 	changeid4 after;
5770Sstevel@tonic-gate };
5780Sstevel@tonic-gate typedef struct change_info4 change_info4;
5790Sstevel@tonic-gate 
5800Sstevel@tonic-gate struct clientaddr4 {
5810Sstevel@tonic-gate 	char *r_netid;
5820Sstevel@tonic-gate 	char *r_addr;
5830Sstevel@tonic-gate };
5840Sstevel@tonic-gate typedef struct clientaddr4 clientaddr4;
5850Sstevel@tonic-gate 
5860Sstevel@tonic-gate struct cb_client4 {
5870Sstevel@tonic-gate 	uint32_t cb_program;
5880Sstevel@tonic-gate 	clientaddr4 cb_location;
5890Sstevel@tonic-gate };
5900Sstevel@tonic-gate typedef struct cb_client4 cb_client4;
5910Sstevel@tonic-gate 
5920Sstevel@tonic-gate struct stateid4 {
5930Sstevel@tonic-gate 	uint32_t seqid;
5940Sstevel@tonic-gate 	char other[12];
5950Sstevel@tonic-gate };
5960Sstevel@tonic-gate typedef struct stateid4 stateid4;
5970Sstevel@tonic-gate 
5980Sstevel@tonic-gate struct nfs_client_id4 {
5990Sstevel@tonic-gate 	verifier4 verifier;
6000Sstevel@tonic-gate 	uint_t id_len;
6010Sstevel@tonic-gate 	char *id_val;
602*11291SRobert.Thurlow@Sun.COM 	struct sockaddr *cl_addr;
6030Sstevel@tonic-gate };
6040Sstevel@tonic-gate typedef struct nfs_client_id4 nfs_client_id4;
6050Sstevel@tonic-gate 
6060Sstevel@tonic-gate struct open_owner4 {
6070Sstevel@tonic-gate 	clientid4 clientid;
6080Sstevel@tonic-gate 	uint_t owner_len;
6090Sstevel@tonic-gate 	char *owner_val;
6100Sstevel@tonic-gate };
6110Sstevel@tonic-gate typedef struct open_owner4 open_owner4;
6120Sstevel@tonic-gate 
6130Sstevel@tonic-gate struct lock_owner4 {
6140Sstevel@tonic-gate 	clientid4 clientid;
6150Sstevel@tonic-gate 	uint_t owner_len;
6160Sstevel@tonic-gate 	char *owner_val;
6170Sstevel@tonic-gate };
6180Sstevel@tonic-gate typedef struct lock_owner4 lock_owner4;
6190Sstevel@tonic-gate 
6200Sstevel@tonic-gate enum nfs_lock_type4 {
6210Sstevel@tonic-gate 	READ_LT = 1,
6220Sstevel@tonic-gate 	WRITE_LT = 2,
6230Sstevel@tonic-gate 	READW_LT = 3,
6240Sstevel@tonic-gate 	WRITEW_LT = 4
6250Sstevel@tonic-gate };
6260Sstevel@tonic-gate typedef enum nfs_lock_type4 nfs_lock_type4;
6270Sstevel@tonic-gate #define	ACCESS4_READ 0x00000001
6280Sstevel@tonic-gate #define	ACCESS4_LOOKUP 0x00000002
6290Sstevel@tonic-gate #define	ACCESS4_MODIFY 0x00000004
6300Sstevel@tonic-gate #define	ACCESS4_EXTEND 0x00000008
6310Sstevel@tonic-gate #define	ACCESS4_DELETE 0x00000010
6320Sstevel@tonic-gate #define	ACCESS4_EXECUTE 0x00000020
6330Sstevel@tonic-gate 
6340Sstevel@tonic-gate struct ACCESS4args {
6350Sstevel@tonic-gate 	uint32_t access;
6360Sstevel@tonic-gate };
6370Sstevel@tonic-gate typedef struct ACCESS4args ACCESS4args;
6380Sstevel@tonic-gate 
6390Sstevel@tonic-gate struct ACCESS4res {
6400Sstevel@tonic-gate 	nfsstat4 status;
6410Sstevel@tonic-gate 	uint32_t supported;
6420Sstevel@tonic-gate 	uint32_t access;
6430Sstevel@tonic-gate };
6440Sstevel@tonic-gate typedef struct ACCESS4res ACCESS4res;
6450Sstevel@tonic-gate 
6460Sstevel@tonic-gate struct CLOSE4args {
6470Sstevel@tonic-gate 	seqid4 seqid;
6480Sstevel@tonic-gate 	stateid4 open_stateid;
6490Sstevel@tonic-gate };
6500Sstevel@tonic-gate typedef struct CLOSE4args CLOSE4args;
6510Sstevel@tonic-gate 
6520Sstevel@tonic-gate struct CLOSE4res {
6530Sstevel@tonic-gate 	nfsstat4 status;
6540Sstevel@tonic-gate 	stateid4 open_stateid;
6550Sstevel@tonic-gate };
6560Sstevel@tonic-gate typedef struct CLOSE4res CLOSE4res;
6570Sstevel@tonic-gate 
6580Sstevel@tonic-gate struct COMMIT4args {
6590Sstevel@tonic-gate 	offset4 offset;
6600Sstevel@tonic-gate 	count4 count;
6610Sstevel@tonic-gate };
6620Sstevel@tonic-gate typedef struct COMMIT4args COMMIT4args;
6630Sstevel@tonic-gate 
6640Sstevel@tonic-gate struct COMMIT4res {
6650Sstevel@tonic-gate 	nfsstat4 status;
6660Sstevel@tonic-gate 	verifier4 writeverf;
6670Sstevel@tonic-gate };
6680Sstevel@tonic-gate typedef struct COMMIT4res COMMIT4res;
6690Sstevel@tonic-gate 
6700Sstevel@tonic-gate struct CREATE4args {
6710Sstevel@tonic-gate 	nfs_ftype4 type;
6720Sstevel@tonic-gate 	union {
6730Sstevel@tonic-gate 		linktext4 linkdata;
6740Sstevel@tonic-gate 		specdata4 devdata;
6750Sstevel@tonic-gate 	} ftype4_u;
6760Sstevel@tonic-gate 	component4 objname;
6770Sstevel@tonic-gate 	fattr4 createattrs;
6780Sstevel@tonic-gate };
6790Sstevel@tonic-gate typedef struct CREATE4args CREATE4args;
6800Sstevel@tonic-gate 
6810Sstevel@tonic-gate struct CREATE4cargs {
6820Sstevel@tonic-gate 	nfs_ftype4 type;
6830Sstevel@tonic-gate 	union {
6840Sstevel@tonic-gate 		char *clinkdata;
6850Sstevel@tonic-gate 		specdata4 devdata;
6860Sstevel@tonic-gate 	} ftype4_u;
6870Sstevel@tonic-gate 	char *cname;
6880Sstevel@tonic-gate 	fattr4 createattrs;
6890Sstevel@tonic-gate };
6900Sstevel@tonic-gate typedef struct CREATE4cargs CREATE4cargs;
6910Sstevel@tonic-gate 
6920Sstevel@tonic-gate struct CREATE4res {
6930Sstevel@tonic-gate 	nfsstat4 status;
6940Sstevel@tonic-gate 	change_info4 cinfo;
6950Sstevel@tonic-gate 	bitmap4 attrset;
6960Sstevel@tonic-gate };
6970Sstevel@tonic-gate typedef struct CREATE4res CREATE4res;
6980Sstevel@tonic-gate 
6990Sstevel@tonic-gate struct DELEGPURGE4args {
7000Sstevel@tonic-gate 	clientid4 clientid;
7010Sstevel@tonic-gate };
7020Sstevel@tonic-gate typedef struct DELEGPURGE4args DELEGPURGE4args;
7030Sstevel@tonic-gate 
7040Sstevel@tonic-gate struct DELEGPURGE4res {
7050Sstevel@tonic-gate 	nfsstat4 status;
7060Sstevel@tonic-gate };
7070Sstevel@tonic-gate typedef struct DELEGPURGE4res DELEGPURGE4res;
7080Sstevel@tonic-gate 
7090Sstevel@tonic-gate struct DELEGRETURN4args {
7100Sstevel@tonic-gate 	stateid4 deleg_stateid;
7110Sstevel@tonic-gate };
7120Sstevel@tonic-gate typedef struct DELEGRETURN4args DELEGRETURN4args;
7130Sstevel@tonic-gate 
7140Sstevel@tonic-gate struct DELEGRETURN4res {
7150Sstevel@tonic-gate 	nfsstat4 status;
7160Sstevel@tonic-gate };
7170Sstevel@tonic-gate typedef struct DELEGRETURN4res DELEGRETURN4res;
7180Sstevel@tonic-gate 
7190Sstevel@tonic-gate struct mntinfo4;
7200Sstevel@tonic-gate 
7210Sstevel@tonic-gate struct GETATTR4args {
7220Sstevel@tonic-gate 	bitmap4 attr_request;
7230Sstevel@tonic-gate 	struct mntinfo4 *mi;
7240Sstevel@tonic-gate };
7250Sstevel@tonic-gate typedef struct GETATTR4args GETATTR4args;
7260Sstevel@tonic-gate 
7270Sstevel@tonic-gate struct nfs4_ga_ext_res;
7280Sstevel@tonic-gate 
7290Sstevel@tonic-gate struct nfs4_ga_res {
7300Sstevel@tonic-gate 	vattr_t				n4g_va;
7310Sstevel@tonic-gate 	unsigned			n4g_change_valid:1;
7320Sstevel@tonic-gate 	unsigned			n4g_mon_fid_valid:1;
7330Sstevel@tonic-gate 	unsigned			n4g_fsid_valid:1;
7340Sstevel@tonic-gate 	uint_t				n4g_attrerr;
7350Sstevel@tonic-gate 	uint_t				n4g_attrwhy;
7360Sstevel@tonic-gate 	bitmap4				n4g_resbmap;
7370Sstevel@tonic-gate 	fattr4_change			n4g_change;
7380Sstevel@tonic-gate 	fattr4_fsid			n4g_fsid;
7390Sstevel@tonic-gate 	fattr4_mounted_on_fileid	n4g_mon_fid;
7400Sstevel@tonic-gate 	struct nfs4_ga_ext_res		*n4g_ext_res;
7410Sstevel@tonic-gate 	vsecattr_t			n4g_vsa;
7420Sstevel@tonic-gate };
7430Sstevel@tonic-gate typedef struct nfs4_ga_res nfs4_ga_res_t;
7440Sstevel@tonic-gate 
7450Sstevel@tonic-gate struct GETATTR4res {
7460Sstevel@tonic-gate 	nfsstat4 status;
7470Sstevel@tonic-gate 	fattr4 obj_attributes;
7480Sstevel@tonic-gate 	nfsstat4	ga_status;
7490Sstevel@tonic-gate 	struct nfs4_ga_res ga_res;
7500Sstevel@tonic-gate };
7510Sstevel@tonic-gate typedef struct GETATTR4res GETATTR4res;
7520Sstevel@tonic-gate 
7530Sstevel@tonic-gate struct GETFH4res {
7540Sstevel@tonic-gate 	nfsstat4 status;
7550Sstevel@tonic-gate 	nfs_fh4 object;
7560Sstevel@tonic-gate };
7570Sstevel@tonic-gate typedef struct GETFH4res GETFH4res;
7580Sstevel@tonic-gate 
7590Sstevel@tonic-gate struct LINK4args {
7600Sstevel@tonic-gate 	component4 newname;
7610Sstevel@tonic-gate };
7620Sstevel@tonic-gate typedef struct LINK4args LINK4args;
7630Sstevel@tonic-gate 
7640Sstevel@tonic-gate struct LINK4cargs {
7650Sstevel@tonic-gate 	char *cnewname;
7660Sstevel@tonic-gate };
7670Sstevel@tonic-gate typedef struct LINK4cargs LINK4cargs;
7680Sstevel@tonic-gate 
7690Sstevel@tonic-gate struct LINK4res {
7700Sstevel@tonic-gate 	nfsstat4 status;
7710Sstevel@tonic-gate 	change_info4 cinfo;
7720Sstevel@tonic-gate };
7730Sstevel@tonic-gate typedef struct LINK4res LINK4res;
7740Sstevel@tonic-gate 
7750Sstevel@tonic-gate struct open_to_lock_owner4 {
7760Sstevel@tonic-gate 	seqid4 open_seqid;
7770Sstevel@tonic-gate 	stateid4 open_stateid;
7780Sstevel@tonic-gate 	seqid4 lock_seqid;
7790Sstevel@tonic-gate 	lock_owner4 lock_owner;
7800Sstevel@tonic-gate };
7810Sstevel@tonic-gate typedef struct open_to_lock_owner4 open_to_lock_owner4;
7820Sstevel@tonic-gate 
7830Sstevel@tonic-gate struct exist_lock_owner4 {
7840Sstevel@tonic-gate 	stateid4 lock_stateid;
7850Sstevel@tonic-gate 	seqid4 lock_seqid;
7860Sstevel@tonic-gate };
7870Sstevel@tonic-gate typedef struct exist_lock_owner4 exist_lock_owner4;
7880Sstevel@tonic-gate 
7890Sstevel@tonic-gate struct locker4 {
7900Sstevel@tonic-gate 	bool_t new_lock_owner;
7910Sstevel@tonic-gate 	union {
7920Sstevel@tonic-gate 		open_to_lock_owner4 open_owner;
7930Sstevel@tonic-gate 		exist_lock_owner4 lock_owner;
7940Sstevel@tonic-gate 	} locker4_u;
7950Sstevel@tonic-gate };
7960Sstevel@tonic-gate typedef struct locker4 locker4;
7970Sstevel@tonic-gate 
7980Sstevel@tonic-gate struct LOCK4args {
7990Sstevel@tonic-gate 	nfs_lock_type4 locktype;
8000Sstevel@tonic-gate 	bool_t reclaim;
8010Sstevel@tonic-gate 	offset4 offset;
8020Sstevel@tonic-gate 	length4 length;
8030Sstevel@tonic-gate 	locker4 locker;
8040Sstevel@tonic-gate };
8050Sstevel@tonic-gate typedef struct LOCK4args LOCK4args;
8060Sstevel@tonic-gate 
8070Sstevel@tonic-gate struct LOCK4denied {
8080Sstevel@tonic-gate 	offset4 offset;
8090Sstevel@tonic-gate 	length4 length;
8100Sstevel@tonic-gate 	nfs_lock_type4 locktype;
8110Sstevel@tonic-gate 	lock_owner4 owner;
8120Sstevel@tonic-gate };
8130Sstevel@tonic-gate typedef struct LOCK4denied LOCK4denied;
8140Sstevel@tonic-gate 
8150Sstevel@tonic-gate struct LOCK4res {
8160Sstevel@tonic-gate 	nfsstat4 status;
8170Sstevel@tonic-gate 	union {
8180Sstevel@tonic-gate 		stateid4 lock_stateid;
8190Sstevel@tonic-gate 		LOCK4denied denied;
8200Sstevel@tonic-gate 	} LOCK4res_u;
8210Sstevel@tonic-gate };
8220Sstevel@tonic-gate typedef struct LOCK4res LOCK4res;
8230Sstevel@tonic-gate 
8240Sstevel@tonic-gate struct LOCKT4args {
8250Sstevel@tonic-gate 	nfs_lock_type4 locktype;
8260Sstevel@tonic-gate 	offset4 offset;
8270Sstevel@tonic-gate 	length4 length;
8280Sstevel@tonic-gate 	lock_owner4 owner;
8290Sstevel@tonic-gate };
8300Sstevel@tonic-gate typedef struct LOCKT4args LOCKT4args;
8310Sstevel@tonic-gate 
8320Sstevel@tonic-gate struct LOCKT4res {
8330Sstevel@tonic-gate 	nfsstat4 status;
8340Sstevel@tonic-gate 	LOCK4denied denied;
8350Sstevel@tonic-gate };
8360Sstevel@tonic-gate typedef struct LOCKT4res LOCKT4res;
8370Sstevel@tonic-gate 
8380Sstevel@tonic-gate struct LOCKU4args {
8390Sstevel@tonic-gate 	nfs_lock_type4 locktype;
8400Sstevel@tonic-gate 	seqid4 seqid;
8410Sstevel@tonic-gate 	stateid4 lock_stateid;
8420Sstevel@tonic-gate 	offset4 offset;
8430Sstevel@tonic-gate 	length4 length;
8440Sstevel@tonic-gate };
8450Sstevel@tonic-gate typedef struct LOCKU4args LOCKU4args;
8460Sstevel@tonic-gate 
8470Sstevel@tonic-gate struct LOCKU4res {
8480Sstevel@tonic-gate 	nfsstat4 status;
8490Sstevel@tonic-gate 	stateid4 lock_stateid;
8500Sstevel@tonic-gate };
8510Sstevel@tonic-gate typedef struct LOCKU4res LOCKU4res;
8520Sstevel@tonic-gate 
8530Sstevel@tonic-gate struct LOOKUP4args {
8540Sstevel@tonic-gate 	component4 objname;
8550Sstevel@tonic-gate };
8560Sstevel@tonic-gate typedef struct LOOKUP4args LOOKUP4args;
8570Sstevel@tonic-gate 
8580Sstevel@tonic-gate struct LOOKUP4cargs {
8590Sstevel@tonic-gate 	char *cname;
8600Sstevel@tonic-gate };
8610Sstevel@tonic-gate typedef struct LOOKUP4cargs LOOKUP4cargs;
8620Sstevel@tonic-gate 
8630Sstevel@tonic-gate struct LOOKUP4res {
8640Sstevel@tonic-gate 	nfsstat4 status;
8650Sstevel@tonic-gate };
8660Sstevel@tonic-gate typedef struct LOOKUP4res LOOKUP4res;
8670Sstevel@tonic-gate 
8680Sstevel@tonic-gate struct LOOKUPP4res {
8690Sstevel@tonic-gate 	nfsstat4 status;
8700Sstevel@tonic-gate };
8710Sstevel@tonic-gate typedef struct LOOKUPP4res LOOKUPP4res;
8720Sstevel@tonic-gate 
8730Sstevel@tonic-gate struct NVERIFY4args {
8740Sstevel@tonic-gate 	fattr4 obj_attributes;
8750Sstevel@tonic-gate };
8760Sstevel@tonic-gate typedef struct NVERIFY4args NVERIFY4args;
8770Sstevel@tonic-gate 
8780Sstevel@tonic-gate struct NVERIFY4res {
8790Sstevel@tonic-gate 	nfsstat4 status;
8800Sstevel@tonic-gate };
8810Sstevel@tonic-gate typedef struct NVERIFY4res NVERIFY4res;
8820Sstevel@tonic-gate 
8830Sstevel@tonic-gate enum createmode4 {
8840Sstevel@tonic-gate 	UNCHECKED4 = 0,
8850Sstevel@tonic-gate 	GUARDED4 = 1,
8860Sstevel@tonic-gate 	EXCLUSIVE4 = 2
8870Sstevel@tonic-gate };
8880Sstevel@tonic-gate typedef enum createmode4 createmode4;
8890Sstevel@tonic-gate 
8900Sstevel@tonic-gate enum opentype4 {
8910Sstevel@tonic-gate 	OPEN4_NOCREATE = 0,
8920Sstevel@tonic-gate 	OPEN4_CREATE = 1
8930Sstevel@tonic-gate };
8940Sstevel@tonic-gate typedef enum opentype4 opentype4;
8950Sstevel@tonic-gate 
8960Sstevel@tonic-gate enum limit_by4 {
8970Sstevel@tonic-gate 	NFS_LIMIT_SIZE = 1,
8980Sstevel@tonic-gate 	NFS_LIMIT_BLOCKS = 2
8990Sstevel@tonic-gate };
9000Sstevel@tonic-gate typedef enum limit_by4 limit_by4;
9010Sstevel@tonic-gate 
9020Sstevel@tonic-gate struct nfs_modified_limit4 {
9030Sstevel@tonic-gate 	uint32_t num_blocks;
9040Sstevel@tonic-gate 	uint32_t bytes_per_block;
9050Sstevel@tonic-gate };
9060Sstevel@tonic-gate typedef struct nfs_modified_limit4 nfs_modified_limit4;
9070Sstevel@tonic-gate 
9080Sstevel@tonic-gate struct nfs_space_limit4 {
9090Sstevel@tonic-gate 	limit_by4 limitby;
9100Sstevel@tonic-gate 	union {
9110Sstevel@tonic-gate 		uint64_t filesize;
9120Sstevel@tonic-gate 		nfs_modified_limit4 mod_blocks;
9130Sstevel@tonic-gate 	} nfs_space_limit4_u;
9140Sstevel@tonic-gate };
9150Sstevel@tonic-gate typedef struct nfs_space_limit4 nfs_space_limit4;
9160Sstevel@tonic-gate #define	OPEN4_SHARE_ACCESS_READ 0x00000001
9170Sstevel@tonic-gate #define	OPEN4_SHARE_ACCESS_WRITE 0x00000002
9180Sstevel@tonic-gate #define	OPEN4_SHARE_ACCESS_BOTH 0x00000003
9190Sstevel@tonic-gate #define	OPEN4_SHARE_DENY_NONE 0x00000000
9200Sstevel@tonic-gate #define	OPEN4_SHARE_DENY_READ 0x00000001
9210Sstevel@tonic-gate #define	OPEN4_SHARE_DENY_WRITE 0x00000002
9220Sstevel@tonic-gate #define	OPEN4_SHARE_DENY_BOTH 0x00000003
9230Sstevel@tonic-gate 
9240Sstevel@tonic-gate enum open_delegation_type4 {
9250Sstevel@tonic-gate 	OPEN_DELEGATE_NONE = 0,
9260Sstevel@tonic-gate 	OPEN_DELEGATE_READ = 1,
9270Sstevel@tonic-gate 	OPEN_DELEGATE_WRITE = 2
9280Sstevel@tonic-gate };
9290Sstevel@tonic-gate typedef enum open_delegation_type4 open_delegation_type4;
9300Sstevel@tonic-gate 
9310Sstevel@tonic-gate enum open_claim_type4 {
9320Sstevel@tonic-gate 	CLAIM_NULL = 0,
9330Sstevel@tonic-gate 	CLAIM_PREVIOUS = 1,
9340Sstevel@tonic-gate 	CLAIM_DELEGATE_CUR = 2,
9350Sstevel@tonic-gate 	CLAIM_DELEGATE_PREV = 3
9360Sstevel@tonic-gate };
9370Sstevel@tonic-gate typedef enum open_claim_type4 open_claim_type4;
9380Sstevel@tonic-gate 
9390Sstevel@tonic-gate struct open_claim_delegate_cur4 {
9400Sstevel@tonic-gate 	stateid4 delegate_stateid;
9410Sstevel@tonic-gate 	component4 file;
9420Sstevel@tonic-gate };
9430Sstevel@tonic-gate typedef struct open_claim_delegate_cur4 open_claim_delegate_cur4;
9440Sstevel@tonic-gate 
9450Sstevel@tonic-gate struct copen_claim_delegate_cur4 {
9460Sstevel@tonic-gate 	stateid4 delegate_stateid;
9470Sstevel@tonic-gate 	char *cfile;
9480Sstevel@tonic-gate };
9490Sstevel@tonic-gate typedef struct copen_claim_delegate_cur4 copen_claim_delegate_cur4;
9500Sstevel@tonic-gate 
9510Sstevel@tonic-gate struct OPEN4args {
9520Sstevel@tonic-gate 	seqid4 seqid;
9530Sstevel@tonic-gate 	uint32_t share_access;
9540Sstevel@tonic-gate 	uint32_t share_deny;
9550Sstevel@tonic-gate 	open_owner4 owner;
9560Sstevel@tonic-gate 	opentype4 opentype;
9570Sstevel@tonic-gate 	createmode4 mode;
9580Sstevel@tonic-gate 	union {
9590Sstevel@tonic-gate 		fattr4 createattrs;
9600Sstevel@tonic-gate 		verifier4 createverf;
9610Sstevel@tonic-gate 	} createhow4_u;
9620Sstevel@tonic-gate 	open_claim_type4 claim;
9630Sstevel@tonic-gate 	union {
9640Sstevel@tonic-gate 		component4 file;
9650Sstevel@tonic-gate 		open_delegation_type4 delegate_type;
9660Sstevel@tonic-gate 		open_claim_delegate_cur4 delegate_cur_info;
9670Sstevel@tonic-gate 		component4 file_delegate_prev;
9680Sstevel@tonic-gate 	} open_claim4_u;
9690Sstevel@tonic-gate };
9700Sstevel@tonic-gate typedef struct OPEN4args OPEN4args;
9710Sstevel@tonic-gate 
9720Sstevel@tonic-gate struct OPEN4cargs {
9730Sstevel@tonic-gate 	seqid4 seqid;
9740Sstevel@tonic-gate 	uint32_t share_access;
9750Sstevel@tonic-gate 	uint32_t share_deny;
9760Sstevel@tonic-gate 	open_owner4 owner;
9770Sstevel@tonic-gate 	opentype4 opentype;
9780Sstevel@tonic-gate 	createmode4 mode;
9790Sstevel@tonic-gate 	union {
9800Sstevel@tonic-gate 		fattr4 createattrs;
9810Sstevel@tonic-gate 		verifier4 createverf;
9820Sstevel@tonic-gate 	} createhow4_u;
9830Sstevel@tonic-gate 	open_claim_type4 claim;
9840Sstevel@tonic-gate 	union {
9850Sstevel@tonic-gate 		char *cfile;
9860Sstevel@tonic-gate 		open_delegation_type4 delegate_type;
9870Sstevel@tonic-gate 		copen_claim_delegate_cur4 delegate_cur_info;
9880Sstevel@tonic-gate 		char *cfile_delegate_prev;
9890Sstevel@tonic-gate 	} open_claim4_u;
9900Sstevel@tonic-gate };
9910Sstevel@tonic-gate typedef struct OPEN4cargs OPEN4cargs;
9920Sstevel@tonic-gate 
9930Sstevel@tonic-gate struct open_read_delegation4 {
9940Sstevel@tonic-gate 	stateid4 stateid;
9950Sstevel@tonic-gate 	bool_t recall;
9960Sstevel@tonic-gate 	nfsace4 permissions;
9970Sstevel@tonic-gate };
9980Sstevel@tonic-gate typedef struct open_read_delegation4 open_read_delegation4;
9990Sstevel@tonic-gate 
10000Sstevel@tonic-gate struct open_write_delegation4 {
10010Sstevel@tonic-gate 	stateid4 stateid;
10020Sstevel@tonic-gate 	bool_t recall;
10030Sstevel@tonic-gate 	nfs_space_limit4 space_limit;
10040Sstevel@tonic-gate 	nfsace4 permissions;
10050Sstevel@tonic-gate };
10060Sstevel@tonic-gate typedef struct open_write_delegation4 open_write_delegation4;
10070Sstevel@tonic-gate 
10080Sstevel@tonic-gate struct open_delegation4 {
10090Sstevel@tonic-gate 	open_delegation_type4 delegation_type;
10100Sstevel@tonic-gate 	union {
10110Sstevel@tonic-gate 		open_read_delegation4 read;
10120Sstevel@tonic-gate 		open_write_delegation4 write;
10130Sstevel@tonic-gate 	} open_delegation4_u;
10140Sstevel@tonic-gate };
10150Sstevel@tonic-gate typedef struct open_delegation4 open_delegation4;
10160Sstevel@tonic-gate #define	OPEN4_RESULT_CONFIRM 0x00000002
10170Sstevel@tonic-gate #define	OPEN4_RESULT_LOCKTYPE_POSIX 0x00000004
10180Sstevel@tonic-gate 
10190Sstevel@tonic-gate struct OPEN4res {
10200Sstevel@tonic-gate 	nfsstat4 status;
10210Sstevel@tonic-gate 	stateid4 stateid;
10220Sstevel@tonic-gate 	change_info4 cinfo;
10230Sstevel@tonic-gate 	uint32_t rflags;
10240Sstevel@tonic-gate 	bitmap4 attrset;
10250Sstevel@tonic-gate 	open_delegation4 delegation;
10260Sstevel@tonic-gate };
10270Sstevel@tonic-gate typedef struct OPEN4res OPEN4res;
10280Sstevel@tonic-gate 
10290Sstevel@tonic-gate struct OPENATTR4args {
10300Sstevel@tonic-gate 	bool_t createdir;
10310Sstevel@tonic-gate };
10320Sstevel@tonic-gate typedef struct OPENATTR4args OPENATTR4args;
10330Sstevel@tonic-gate 
10340Sstevel@tonic-gate struct OPENATTR4res {
10350Sstevel@tonic-gate 	nfsstat4 status;
10360Sstevel@tonic-gate };
10370Sstevel@tonic-gate typedef struct OPENATTR4res OPENATTR4res;
10380Sstevel@tonic-gate 
10390Sstevel@tonic-gate struct OPEN_CONFIRM4args {
10400Sstevel@tonic-gate 	stateid4 open_stateid;
10410Sstevel@tonic-gate 	seqid4 seqid;
10420Sstevel@tonic-gate };
10430Sstevel@tonic-gate typedef struct OPEN_CONFIRM4args OPEN_CONFIRM4args;
10440Sstevel@tonic-gate 
10450Sstevel@tonic-gate struct OPEN_CONFIRM4res {
10460Sstevel@tonic-gate 	nfsstat4 status;
10470Sstevel@tonic-gate 	stateid4 open_stateid;
10480Sstevel@tonic-gate };
10490Sstevel@tonic-gate typedef struct OPEN_CONFIRM4res OPEN_CONFIRM4res;
10500Sstevel@tonic-gate 
10510Sstevel@tonic-gate struct OPEN_DOWNGRADE4args {
10520Sstevel@tonic-gate 	stateid4 open_stateid;
10530Sstevel@tonic-gate 	seqid4 seqid;
10540Sstevel@tonic-gate 	uint32_t share_access;
10550Sstevel@tonic-gate 	uint32_t share_deny;
10560Sstevel@tonic-gate };
10570Sstevel@tonic-gate typedef struct OPEN_DOWNGRADE4args OPEN_DOWNGRADE4args;
10580Sstevel@tonic-gate 
10590Sstevel@tonic-gate struct OPEN_DOWNGRADE4res {
10600Sstevel@tonic-gate 	nfsstat4 status;
10610Sstevel@tonic-gate 	stateid4 open_stateid;
10620Sstevel@tonic-gate };
10630Sstevel@tonic-gate typedef struct OPEN_DOWNGRADE4res OPEN_DOWNGRADE4res;
10640Sstevel@tonic-gate 
10650Sstevel@tonic-gate struct PUTFH4args {
10660Sstevel@tonic-gate 	nfs_fh4 object;
10670Sstevel@tonic-gate };
10680Sstevel@tonic-gate typedef struct PUTFH4args PUTFH4args;
10690Sstevel@tonic-gate 
10700Sstevel@tonic-gate /*
10710Sstevel@tonic-gate  * Client only side PUTFH arguments
10720Sstevel@tonic-gate  * This is really a nfs4_sharedfh_t * but the forward declaration
10730Sstevel@tonic-gate  * is problematic;
10740Sstevel@tonic-gate  */
10750Sstevel@tonic-gate struct PUTFH4cargs {
10760Sstevel@tonic-gate 	void *sfh;
10770Sstevel@tonic-gate };
10780Sstevel@tonic-gate typedef struct PUTFH4cargs PUTFH4cargs;
10790Sstevel@tonic-gate 
10800Sstevel@tonic-gate struct PUTFH4res {
10810Sstevel@tonic-gate 	nfsstat4 status;
10820Sstevel@tonic-gate };
10830Sstevel@tonic-gate typedef struct PUTFH4res PUTFH4res;
10840Sstevel@tonic-gate 
10850Sstevel@tonic-gate struct PUTPUBFH4res {
10860Sstevel@tonic-gate 	nfsstat4 status;
10870Sstevel@tonic-gate };
10880Sstevel@tonic-gate typedef struct PUTPUBFH4res PUTPUBFH4res;
10890Sstevel@tonic-gate 
10900Sstevel@tonic-gate struct PUTROOTFH4res {
10910Sstevel@tonic-gate 	nfsstat4 status;
10920Sstevel@tonic-gate };
10930Sstevel@tonic-gate typedef struct PUTROOTFH4res PUTROOTFH4res;
10940Sstevel@tonic-gate 
10950Sstevel@tonic-gate struct READ4args {
10960Sstevel@tonic-gate 	stateid4 stateid;
10970Sstevel@tonic-gate 	offset4 offset;
10980Sstevel@tonic-gate 	count4 count;
10990Sstevel@tonic-gate 	/* The following are used for the XDR decode path */
11000Sstevel@tonic-gate 	char *res_data_val_alt;
11010Sstevel@tonic-gate 	mblk_t *res_mblk;
11020Sstevel@tonic-gate 	struct uio *res_uiop;
11030Sstevel@tonic-gate 	uint_t res_maxsize;
11047387SRobert.Gordon@Sun.COM #ifdef _KERNEL
11057387SRobert.Gordon@Sun.COM 	struct clist *wlist;
11067387SRobert.Gordon@Sun.COM 	CONN *conn;
11077387SRobert.Gordon@Sun.COM #endif
11080Sstevel@tonic-gate };
11090Sstevel@tonic-gate typedef struct READ4args READ4args;
11100Sstevel@tonic-gate 
11110Sstevel@tonic-gate struct READ4res {
11120Sstevel@tonic-gate 	nfsstat4 status;
11130Sstevel@tonic-gate 	bool_t eof;
11140Sstevel@tonic-gate 	uint_t data_len;
11150Sstevel@tonic-gate 	char *data_val;
11160Sstevel@tonic-gate 	mblk_t *mblk;
11177387SRobert.Gordon@Sun.COM #ifdef _KERNEL
11187387SRobert.Gordon@Sun.COM 	struct clist *wlist;
11197387SRobert.Gordon@Sun.COM 	uint_t wlist_len;
11207387SRobert.Gordon@Sun.COM #endif
11210Sstevel@tonic-gate };
11220Sstevel@tonic-gate typedef struct READ4res READ4res;
11230Sstevel@tonic-gate 
11240Sstevel@tonic-gate struct rddir4_cache;
11250Sstevel@tonic-gate 
11260Sstevel@tonic-gate struct READDIR4args {
11270Sstevel@tonic-gate 	nfs_cookie4 cookie;
11280Sstevel@tonic-gate 	verifier4 cookieverf;
11290Sstevel@tonic-gate 	count4 dircount;
11300Sstevel@tonic-gate 	count4 maxcount;
11310Sstevel@tonic-gate 	bitmap4 attr_request;
11320Sstevel@tonic-gate 	vnode_t *dvp;
11330Sstevel@tonic-gate 	struct mntinfo4 *mi;
11340Sstevel@tonic-gate 	cred_t *cr;
11350Sstevel@tonic-gate 	struct rddir4_cache *rdc;
11360Sstevel@tonic-gate 	hrtime_t t;
11370Sstevel@tonic-gate };
11380Sstevel@tonic-gate typedef struct READDIR4args READDIR4args;
11390Sstevel@tonic-gate 
11400Sstevel@tonic-gate struct READDIR4res_clnt {
11410Sstevel@tonic-gate 	nfsstat4 status;
11420Sstevel@tonic-gate 	verifier4 cookieverf;
11430Sstevel@tonic-gate 	bool_t eof;
11440Sstevel@tonic-gate 	struct dirent64 *dotp, *dotdotp;
11450Sstevel@tonic-gate 	struct rddir4_cache *rdc;
11460Sstevel@tonic-gate };
11470Sstevel@tonic-gate typedef struct READDIR4res_clnt READDIR4res_clnt;
11480Sstevel@tonic-gate 
11490Sstevel@tonic-gate struct READDIR4res {
11500Sstevel@tonic-gate 	nfsstat4 status;
11510Sstevel@tonic-gate 	verifier4 cookieverf;
11520Sstevel@tonic-gate 	mblk_t *mblk;
11530Sstevel@tonic-gate 	uint_t data_len;
11540Sstevel@tonic-gate };
11550Sstevel@tonic-gate typedef struct READDIR4res READDIR4res;
11560Sstevel@tonic-gate 
11570Sstevel@tonic-gate struct READLINK4res {
11580Sstevel@tonic-gate 	nfsstat4 status;
11590Sstevel@tonic-gate 	linktext4 link;
11600Sstevel@tonic-gate };
11610Sstevel@tonic-gate typedef struct READLINK4res READLINK4res;
11620Sstevel@tonic-gate 
11630Sstevel@tonic-gate struct REMOVE4args {
11640Sstevel@tonic-gate 	component4 target;
11650Sstevel@tonic-gate };
11660Sstevel@tonic-gate typedef struct REMOVE4args REMOVE4args;
11670Sstevel@tonic-gate 
11680Sstevel@tonic-gate struct REMOVE4cargs {
11690Sstevel@tonic-gate 	char *ctarget;
11700Sstevel@tonic-gate };
11710Sstevel@tonic-gate typedef struct REMOVE4cargs REMOVE4cargs;
11720Sstevel@tonic-gate 
11730Sstevel@tonic-gate struct REMOVE4res {
11740Sstevel@tonic-gate 	nfsstat4 status;
11750Sstevel@tonic-gate 	change_info4 cinfo;
11760Sstevel@tonic-gate };
11770Sstevel@tonic-gate typedef struct REMOVE4res REMOVE4res;
11780Sstevel@tonic-gate 
11790Sstevel@tonic-gate struct RENAME4args {
11800Sstevel@tonic-gate 	component4 oldname;
11810Sstevel@tonic-gate 	component4 newname;
11820Sstevel@tonic-gate };
11830Sstevel@tonic-gate typedef struct RENAME4args RENAME4args;
11840Sstevel@tonic-gate 
11850Sstevel@tonic-gate struct RENAME4cargs {
11860Sstevel@tonic-gate 	char *coldname;
11870Sstevel@tonic-gate 	char *cnewname;
11880Sstevel@tonic-gate };
11890Sstevel@tonic-gate typedef struct RENAME4cargs RENAME4cargs;
11900Sstevel@tonic-gate 
11910Sstevel@tonic-gate struct RENAME4res {
11920Sstevel@tonic-gate 	nfsstat4 status;
11930Sstevel@tonic-gate 	change_info4 source_cinfo;
11940Sstevel@tonic-gate 	change_info4 target_cinfo;
11950Sstevel@tonic-gate };
11960Sstevel@tonic-gate typedef struct RENAME4res RENAME4res;
11970Sstevel@tonic-gate 
11980Sstevel@tonic-gate struct RENEW4args {
11990Sstevel@tonic-gate 	clientid4 clientid;
12000Sstevel@tonic-gate };
12010Sstevel@tonic-gate typedef struct RENEW4args RENEW4args;
12020Sstevel@tonic-gate 
12030Sstevel@tonic-gate struct RENEW4res {
12040Sstevel@tonic-gate 	nfsstat4 status;
12050Sstevel@tonic-gate };
12060Sstevel@tonic-gate typedef struct RENEW4res RENEW4res;
12070Sstevel@tonic-gate 
12080Sstevel@tonic-gate struct RESTOREFH4res {
12090Sstevel@tonic-gate 	nfsstat4 status;
12100Sstevel@tonic-gate };
12110Sstevel@tonic-gate typedef struct RESTOREFH4res RESTOREFH4res;
12120Sstevel@tonic-gate 
12130Sstevel@tonic-gate struct SAVEFH4res {
12140Sstevel@tonic-gate 	nfsstat4 status;
12150Sstevel@tonic-gate };
12160Sstevel@tonic-gate typedef struct SAVEFH4res SAVEFH4res;
12170Sstevel@tonic-gate 
12180Sstevel@tonic-gate struct SECINFO4args {
12190Sstevel@tonic-gate 	component4 name;
12200Sstevel@tonic-gate };
12210Sstevel@tonic-gate typedef struct SECINFO4args SECINFO4args;
12220Sstevel@tonic-gate 
12230Sstevel@tonic-gate struct SECINFO4cargs {
12240Sstevel@tonic-gate 	char *cname;
12250Sstevel@tonic-gate };
12260Sstevel@tonic-gate typedef struct SECINFO4cargs SECINFO4cargs;
12270Sstevel@tonic-gate 
12280Sstevel@tonic-gate enum rpc_gss_svc_t {
12290Sstevel@tonic-gate 	RPC_GSS_SVC_NONE = 1,
12300Sstevel@tonic-gate 	RPC_GSS_SVC_INTEGRITY = 2,
12310Sstevel@tonic-gate 	RPC_GSS_SVC_PRIVACY = 3
12320Sstevel@tonic-gate };
12330Sstevel@tonic-gate typedef enum rpc_gss_svc_t rpc_gss_svc_t;
12340Sstevel@tonic-gate 
12350Sstevel@tonic-gate struct rpcsec_gss_info {
12360Sstevel@tonic-gate 	sec_oid4 oid;
12370Sstevel@tonic-gate 	qop4 qop;
12380Sstevel@tonic-gate 	rpc_gss_svc_t service;
12390Sstevel@tonic-gate };
12400Sstevel@tonic-gate typedef struct rpcsec_gss_info rpcsec_gss_info;
12410Sstevel@tonic-gate 
12420Sstevel@tonic-gate struct secinfo4 {
12430Sstevel@tonic-gate 	uint32_t flavor;
12440Sstevel@tonic-gate 	rpcsec_gss_info flavor_info;
12450Sstevel@tonic-gate };
12460Sstevel@tonic-gate typedef struct secinfo4 secinfo4;
12470Sstevel@tonic-gate 
12480Sstevel@tonic-gate struct SECINFO4res {
12490Sstevel@tonic-gate 	nfsstat4 status;
12500Sstevel@tonic-gate 	uint_t SECINFO4resok_len;
12510Sstevel@tonic-gate 	secinfo4 *SECINFO4resok_val;
12520Sstevel@tonic-gate };
12530Sstevel@tonic-gate typedef struct SECINFO4res SECINFO4res;
12540Sstevel@tonic-gate 
12550Sstevel@tonic-gate struct SETATTR4args {
12560Sstevel@tonic-gate 	stateid4 stateid;
12570Sstevel@tonic-gate 	fattr4 obj_attributes;
12580Sstevel@tonic-gate };
12590Sstevel@tonic-gate typedef struct SETATTR4args SETATTR4args;
12600Sstevel@tonic-gate 
12610Sstevel@tonic-gate struct SETATTR4res {
12620Sstevel@tonic-gate 	nfsstat4 status;
12630Sstevel@tonic-gate 	bitmap4 attrsset;
12640Sstevel@tonic-gate };
12650Sstevel@tonic-gate typedef struct SETATTR4res SETATTR4res;
12660Sstevel@tonic-gate 
12670Sstevel@tonic-gate struct SETCLIENTID4args {
12680Sstevel@tonic-gate 	nfs_client_id4 client;
12690Sstevel@tonic-gate 	cb_client4 callback;
12700Sstevel@tonic-gate 	uint32_t callback_ident;
12710Sstevel@tonic-gate };
12720Sstevel@tonic-gate typedef struct SETCLIENTID4args SETCLIENTID4args;
12730Sstevel@tonic-gate 
12740Sstevel@tonic-gate struct SETCLIENTID4resok {
12750Sstevel@tonic-gate 	clientid4 clientid;
12760Sstevel@tonic-gate 	verifier4 setclientid_confirm;
12770Sstevel@tonic-gate };
12780Sstevel@tonic-gate typedef struct SETCLIENTID4resok SETCLIENTID4resok;
12790Sstevel@tonic-gate 
12800Sstevel@tonic-gate struct SETCLIENTID4res {
12810Sstevel@tonic-gate 	nfsstat4 status;
12820Sstevel@tonic-gate 	union {
12830Sstevel@tonic-gate 		SETCLIENTID4resok resok4;
12840Sstevel@tonic-gate 		clientaddr4 client_using;
12850Sstevel@tonic-gate 	} SETCLIENTID4res_u;
12860Sstevel@tonic-gate };
12870Sstevel@tonic-gate typedef struct SETCLIENTID4res SETCLIENTID4res;
12880Sstevel@tonic-gate 
12890Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4args {
12900Sstevel@tonic-gate 	clientid4 clientid;
12910Sstevel@tonic-gate 	verifier4 setclientid_confirm;
12920Sstevel@tonic-gate };
12930Sstevel@tonic-gate typedef struct SETCLIENTID_CONFIRM4args SETCLIENTID_CONFIRM4args;
12940Sstevel@tonic-gate 
12950Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4res {
12960Sstevel@tonic-gate 	nfsstat4 status;
12970Sstevel@tonic-gate };
12980Sstevel@tonic-gate typedef struct SETCLIENTID_CONFIRM4res SETCLIENTID_CONFIRM4res;
12990Sstevel@tonic-gate 
13000Sstevel@tonic-gate struct VERIFY4args {
13010Sstevel@tonic-gate 	fattr4 obj_attributes;
13020Sstevel@tonic-gate };
13030Sstevel@tonic-gate typedef struct VERIFY4args VERIFY4args;
13040Sstevel@tonic-gate 
13050Sstevel@tonic-gate struct VERIFY4res {
13060Sstevel@tonic-gate 	nfsstat4 status;
13070Sstevel@tonic-gate };
13080Sstevel@tonic-gate typedef struct VERIFY4res VERIFY4res;
13090Sstevel@tonic-gate 
13100Sstevel@tonic-gate enum stable_how4 {
13110Sstevel@tonic-gate 	UNSTABLE4 = 0,
13120Sstevel@tonic-gate 	DATA_SYNC4 = 1,
13130Sstevel@tonic-gate 	FILE_SYNC4 = 2
13140Sstevel@tonic-gate };
13150Sstevel@tonic-gate typedef enum stable_how4 stable_how4;
13160Sstevel@tonic-gate 
13170Sstevel@tonic-gate /*
13180Sstevel@tonic-gate  * mblk doesn't go over the wire.  If non-NULL, it points to an mblk chain
13190Sstevel@tonic-gate  * for the write data.
13200Sstevel@tonic-gate  */
13210Sstevel@tonic-gate 
13220Sstevel@tonic-gate struct WRITE4args {
13230Sstevel@tonic-gate 	stateid4 stateid;
13240Sstevel@tonic-gate 	offset4 offset;
13250Sstevel@tonic-gate 	stable_how4 stable;
13260Sstevel@tonic-gate 	uint_t data_len;
13270Sstevel@tonic-gate 	char *data_val;
13280Sstevel@tonic-gate 	mblk_t *mblk;
13297387SRobert.Gordon@Sun.COM #ifdef _KERNEL
13307387SRobert.Gordon@Sun.COM 	struct clist *rlist;
13317387SRobert.Gordon@Sun.COM 	CONN *conn;
13327387SRobert.Gordon@Sun.COM #endif
13330Sstevel@tonic-gate };
13340Sstevel@tonic-gate typedef struct WRITE4args WRITE4args;
13350Sstevel@tonic-gate 
13360Sstevel@tonic-gate struct WRITE4res {
13370Sstevel@tonic-gate 	nfsstat4 status;
13380Sstevel@tonic-gate 	count4 count;
13390Sstevel@tonic-gate 	stable_how4 committed;
13400Sstevel@tonic-gate 	verifier4 writeverf;
13410Sstevel@tonic-gate };
13420Sstevel@tonic-gate typedef struct WRITE4res WRITE4res;
13430Sstevel@tonic-gate 
13440Sstevel@tonic-gate struct RELEASE_LOCKOWNER4args {
13450Sstevel@tonic-gate 	lock_owner4 lock_owner;
13460Sstevel@tonic-gate };
13470Sstevel@tonic-gate typedef struct RELEASE_LOCKOWNER4args RELEASE_LOCKOWNER4args;
13480Sstevel@tonic-gate 
13490Sstevel@tonic-gate struct RELEASE_LOCKOWNER4res {
13500Sstevel@tonic-gate 	nfsstat4 status;
13510Sstevel@tonic-gate };
13520Sstevel@tonic-gate typedef struct RELEASE_LOCKOWNER4res RELEASE_LOCKOWNER4res;
13530Sstevel@tonic-gate 
13540Sstevel@tonic-gate struct ILLEGAL4res {
13550Sstevel@tonic-gate 	nfsstat4 status;
13560Sstevel@tonic-gate };
13570Sstevel@tonic-gate typedef struct ILLEGAL4res ILLEGAL4res;
13580Sstevel@tonic-gate 
13590Sstevel@tonic-gate enum nfs_opnum4 {
13600Sstevel@tonic-gate 	OP_ACCESS = 3,
13610Sstevel@tonic-gate 	OP_CLOSE = 4,
13620Sstevel@tonic-gate 	OP_COMMIT = 5,
13630Sstevel@tonic-gate 	OP_CREATE = 6,
13640Sstevel@tonic-gate 	OP_DELEGPURGE = 7,
13650Sstevel@tonic-gate 	OP_DELEGRETURN = 8,
13660Sstevel@tonic-gate 	OP_GETATTR = 9,
13670Sstevel@tonic-gate 	OP_GETFH = 10,
13680Sstevel@tonic-gate 	OP_LINK = 11,
13690Sstevel@tonic-gate 	OP_LOCK = 12,
13700Sstevel@tonic-gate 	OP_LOCKT = 13,
13710Sstevel@tonic-gate 	OP_LOCKU = 14,
13720Sstevel@tonic-gate 	OP_LOOKUP = 15,
13730Sstevel@tonic-gate 	OP_LOOKUPP = 16,
13740Sstevel@tonic-gate 	OP_NVERIFY = 17,
13750Sstevel@tonic-gate 	OP_OPEN = 18,
13760Sstevel@tonic-gate 	OP_OPENATTR = 19,
13770Sstevel@tonic-gate 	OP_OPEN_CONFIRM = 20,
13780Sstevel@tonic-gate 	OP_OPEN_DOWNGRADE = 21,
13790Sstevel@tonic-gate 	OP_PUTFH = 22,
13800Sstevel@tonic-gate 	OP_PUTPUBFH = 23,
13810Sstevel@tonic-gate 	OP_PUTROOTFH = 24,
13820Sstevel@tonic-gate 	OP_READ = 25,
13830Sstevel@tonic-gate 	OP_READDIR = 26,
13840Sstevel@tonic-gate 	OP_READLINK = 27,
13850Sstevel@tonic-gate 	OP_REMOVE = 28,
13860Sstevel@tonic-gate 	OP_RENAME = 29,
13870Sstevel@tonic-gate 	OP_RENEW = 30,
13880Sstevel@tonic-gate 	OP_RESTOREFH = 31,
13890Sstevel@tonic-gate 	OP_SAVEFH = 32,
13900Sstevel@tonic-gate 	OP_SECINFO = 33,
13910Sstevel@tonic-gate 	OP_SETATTR = 34,
13920Sstevel@tonic-gate 	OP_SETCLIENTID = 35,
13930Sstevel@tonic-gate 	OP_SETCLIENTID_CONFIRM = 36,
13940Sstevel@tonic-gate 	OP_VERIFY = 37,
13950Sstevel@tonic-gate 	OP_WRITE = 38,
13960Sstevel@tonic-gate 	OP_RELEASE_LOCKOWNER = 39,
13970Sstevel@tonic-gate 	OP_ILLEGAL = 10044,
13980Sstevel@tonic-gate /*
13990Sstevel@tonic-gate  * These are internal client pseudo ops that *MUST* never go over the wire
14000Sstevel@tonic-gate  */
14010Sstevel@tonic-gate #define	SUNW_PRIVATE_OP	0x10000000
14020Sstevel@tonic-gate #define	REAL_OP4(op)	((op) & ~SUNW_PRIVATE_OP)
14030Sstevel@tonic-gate 	OP_CCREATE = OP_CREATE | SUNW_PRIVATE_OP,
14040Sstevel@tonic-gate 	OP_CLINK = OP_LINK | SUNW_PRIVATE_OP,
14050Sstevel@tonic-gate 	OP_CLOOKUP = OP_LOOKUP | SUNW_PRIVATE_OP,
14060Sstevel@tonic-gate 	OP_COPEN = OP_OPEN | SUNW_PRIVATE_OP,
14070Sstevel@tonic-gate 	OP_CPUTFH = OP_PUTFH | SUNW_PRIVATE_OP,
14080Sstevel@tonic-gate 	OP_CREMOVE = OP_REMOVE | SUNW_PRIVATE_OP,
14090Sstevel@tonic-gate 	OP_CRENAME = OP_RENAME | SUNW_PRIVATE_OP,
14100Sstevel@tonic-gate 	OP_CSECINFO = OP_SECINFO | SUNW_PRIVATE_OP
14110Sstevel@tonic-gate };
14120Sstevel@tonic-gate typedef enum nfs_opnum4 nfs_opnum4;
14130Sstevel@tonic-gate 
14140Sstevel@tonic-gate struct nfs_argop4 {
14150Sstevel@tonic-gate 	nfs_opnum4 argop;
14160Sstevel@tonic-gate 	union {
14170Sstevel@tonic-gate 		ACCESS4args opaccess;
14180Sstevel@tonic-gate 		CLOSE4args opclose;
14190Sstevel@tonic-gate 		COMMIT4args opcommit;
14200Sstevel@tonic-gate 		CREATE4args opcreate;
14210Sstevel@tonic-gate 		CREATE4cargs opccreate;
14220Sstevel@tonic-gate 		DELEGPURGE4args opdelegpurge;
14230Sstevel@tonic-gate 		DELEGRETURN4args opdelegreturn;
14240Sstevel@tonic-gate 		GETATTR4args opgetattr;
14250Sstevel@tonic-gate 		LINK4args oplink;
14260Sstevel@tonic-gate 		LINK4cargs opclink;
14270Sstevel@tonic-gate 		LOCK4args oplock;
14280Sstevel@tonic-gate 		LOCKT4args oplockt;
14290Sstevel@tonic-gate 		LOCKU4args oplocku;
14300Sstevel@tonic-gate 		LOOKUP4args oplookup;
14310Sstevel@tonic-gate 		LOOKUP4cargs opclookup;
14320Sstevel@tonic-gate 		NVERIFY4args opnverify;
14330Sstevel@tonic-gate 		OPEN4args opopen;
14340Sstevel@tonic-gate 		OPEN4cargs opcopen;
14350Sstevel@tonic-gate 		OPENATTR4args opopenattr;
14360Sstevel@tonic-gate 		OPEN_CONFIRM4args opopen_confirm;
14370Sstevel@tonic-gate 		OPEN_DOWNGRADE4args opopen_downgrade;
14380Sstevel@tonic-gate 		PUTFH4args opputfh;
14390Sstevel@tonic-gate 		PUTFH4cargs opcputfh;
14400Sstevel@tonic-gate 		READ4args opread;
14410Sstevel@tonic-gate 		READDIR4args opreaddir;
14420Sstevel@tonic-gate 		REMOVE4args opremove;
14430Sstevel@tonic-gate 		REMOVE4cargs opcremove;
14440Sstevel@tonic-gate 		RENAME4args oprename;
14450Sstevel@tonic-gate 		RENAME4cargs opcrename;
14460Sstevel@tonic-gate 		RENEW4args oprenew;
14470Sstevel@tonic-gate 		SECINFO4args opsecinfo;
14480Sstevel@tonic-gate 		SECINFO4cargs opcsecinfo;
14490Sstevel@tonic-gate 		SETATTR4args opsetattr;
14500Sstevel@tonic-gate 		SETCLIENTID4args opsetclientid;
14510Sstevel@tonic-gate 		SETCLIENTID_CONFIRM4args opsetclientid_confirm;
14520Sstevel@tonic-gate 		VERIFY4args opverify;
14530Sstevel@tonic-gate 		WRITE4args opwrite;
14540Sstevel@tonic-gate 		RELEASE_LOCKOWNER4args oprelease_lockowner;
14550Sstevel@tonic-gate 	} nfs_argop4_u;
14560Sstevel@tonic-gate };
14570Sstevel@tonic-gate typedef struct nfs_argop4 nfs_argop4;
14580Sstevel@tonic-gate 
14590Sstevel@tonic-gate struct nfs_resop4 {
14600Sstevel@tonic-gate 	nfs_opnum4 resop;
14610Sstevel@tonic-gate 	union {
14620Sstevel@tonic-gate 		ACCESS4res opaccess;
14630Sstevel@tonic-gate 		CLOSE4res opclose;
14640Sstevel@tonic-gate 		COMMIT4res opcommit;
14650Sstevel@tonic-gate 		CREATE4res opcreate;
14660Sstevel@tonic-gate 		DELEGPURGE4res opdelegpurge;
14670Sstevel@tonic-gate 		DELEGRETURN4res opdelegreturn;
14680Sstevel@tonic-gate 		GETATTR4res opgetattr;
14690Sstevel@tonic-gate 		GETFH4res opgetfh;
14700Sstevel@tonic-gate 		LINK4res oplink;
14710Sstevel@tonic-gate 		LOCK4res oplock;
14720Sstevel@tonic-gate 		LOCKT4res oplockt;
14730Sstevel@tonic-gate 		LOCKU4res oplocku;
14740Sstevel@tonic-gate 		LOOKUP4res oplookup;
14750Sstevel@tonic-gate 		LOOKUPP4res oplookupp;
14760Sstevel@tonic-gate 		NVERIFY4res opnverify;
14770Sstevel@tonic-gate 		OPEN4res opopen;
14780Sstevel@tonic-gate 		OPENATTR4res opopenattr;
14790Sstevel@tonic-gate 		OPEN_CONFIRM4res opopen_confirm;
14800Sstevel@tonic-gate 		OPEN_DOWNGRADE4res opopen_downgrade;
14810Sstevel@tonic-gate 		PUTFH4res opputfh;
14820Sstevel@tonic-gate 		PUTPUBFH4res opputpubfh;
14830Sstevel@tonic-gate 		PUTROOTFH4res opputrootfh;
14840Sstevel@tonic-gate 		READ4res opread;
14850Sstevel@tonic-gate 		READDIR4res opreaddir;
14860Sstevel@tonic-gate 		READDIR4res_clnt opreaddirclnt;
14870Sstevel@tonic-gate 		READLINK4res opreadlink;
14880Sstevel@tonic-gate 		REMOVE4res opremove;
14890Sstevel@tonic-gate 		RENAME4res oprename;
14900Sstevel@tonic-gate 		RENEW4res oprenew;
14910Sstevel@tonic-gate 		RESTOREFH4res oprestorefh;
14920Sstevel@tonic-gate 		SAVEFH4res opsavefh;
14930Sstevel@tonic-gate 		SECINFO4res opsecinfo;
14940Sstevel@tonic-gate 		SETATTR4res opsetattr;
14950Sstevel@tonic-gate 		SETCLIENTID4res opsetclientid;
14960Sstevel@tonic-gate 		SETCLIENTID_CONFIRM4res opsetclientid_confirm;
14970Sstevel@tonic-gate 		VERIFY4res opverify;
14980Sstevel@tonic-gate 		WRITE4res opwrite;
14990Sstevel@tonic-gate 		RELEASE_LOCKOWNER4res oprelease_lockowner;
15000Sstevel@tonic-gate 		ILLEGAL4res opillegal;
15010Sstevel@tonic-gate 	} nfs_resop4_u;
15020Sstevel@tonic-gate };
15030Sstevel@tonic-gate typedef struct nfs_resop4 nfs_resop4;
15040Sstevel@tonic-gate 
15050Sstevel@tonic-gate /*
15060Sstevel@tonic-gate  * Fixed size tag string for easy client encoding
15070Sstevel@tonic-gate  */
15080Sstevel@tonic-gate struct _ctag {
15090Sstevel@tonic-gate 	int ct_type;
15100Sstevel@tonic-gate 	char *ct_str;
15110Sstevel@tonic-gate 	uint32_t ct_tag[3];
15120Sstevel@tonic-gate };
15130Sstevel@tonic-gate typedef struct _ctag ctag_t;
15140Sstevel@tonic-gate 
15150Sstevel@tonic-gate /*
15160Sstevel@tonic-gate  * Client-only encode-only version
15170Sstevel@tonic-gate  */
15180Sstevel@tonic-gate struct COMPOUND4args_clnt {
15190Sstevel@tonic-gate 	int ctag;
15200Sstevel@tonic-gate 	uint_t array_len;
15210Sstevel@tonic-gate 	nfs_argop4 *array;
15220Sstevel@tonic-gate };
15230Sstevel@tonic-gate typedef struct COMPOUND4args_clnt COMPOUND4args_clnt;
15240Sstevel@tonic-gate 
15250Sstevel@tonic-gate struct COMPOUND4args {
15260Sstevel@tonic-gate 	utf8string tag;
15270Sstevel@tonic-gate 	uint32_t minorversion;
15280Sstevel@tonic-gate 	uint_t array_len;
15290Sstevel@tonic-gate 	nfs_argop4 *array;
15300Sstevel@tonic-gate };
15310Sstevel@tonic-gate typedef struct COMPOUND4args COMPOUND4args;
15320Sstevel@tonic-gate 
15330Sstevel@tonic-gate struct COMPOUND4res_clnt {
15340Sstevel@tonic-gate 	nfsstat4 status;
15350Sstevel@tonic-gate 	uint_t array_len;
15360Sstevel@tonic-gate 	uint_t decode_len;
15370Sstevel@tonic-gate 	nfs_resop4 *array;
15380Sstevel@tonic-gate 	COMPOUND4args_clnt *argsp;
15390Sstevel@tonic-gate };
15400Sstevel@tonic-gate typedef struct COMPOUND4res_clnt COMPOUND4res_clnt;
15410Sstevel@tonic-gate 
15420Sstevel@tonic-gate struct COMPOUND4res {
15430Sstevel@tonic-gate 	nfsstat4 status;
15440Sstevel@tonic-gate 	utf8string tag;
15450Sstevel@tonic-gate 	uint_t array_len;
15460Sstevel@tonic-gate 	nfs_resop4 *array;
15470Sstevel@tonic-gate };
15480Sstevel@tonic-gate typedef struct COMPOUND4res COMPOUND4res;
15490Sstevel@tonic-gate 
15500Sstevel@tonic-gate struct CB_GETATTR4args {
15510Sstevel@tonic-gate 	nfs_fh4 fh;
15520Sstevel@tonic-gate 	bitmap4 attr_request;
15530Sstevel@tonic-gate };
15540Sstevel@tonic-gate typedef struct CB_GETATTR4args CB_GETATTR4args;
15550Sstevel@tonic-gate 
15560Sstevel@tonic-gate struct CB_GETATTR4res {
15570Sstevel@tonic-gate 	nfsstat4 status;
15580Sstevel@tonic-gate 	fattr4 obj_attributes;
15590Sstevel@tonic-gate };
15600Sstevel@tonic-gate typedef struct CB_GETATTR4res CB_GETATTR4res;
15610Sstevel@tonic-gate 
15620Sstevel@tonic-gate struct CB_RECALL4args {
15630Sstevel@tonic-gate 	stateid4 stateid;
15640Sstevel@tonic-gate 	bool_t truncate;
15650Sstevel@tonic-gate 	nfs_fh4 fh;
15660Sstevel@tonic-gate };
15670Sstevel@tonic-gate typedef struct CB_RECALL4args CB_RECALL4args;
15680Sstevel@tonic-gate 
15690Sstevel@tonic-gate struct CB_RECALL4res {
15700Sstevel@tonic-gate 	nfsstat4 status;
15710Sstevel@tonic-gate };
15720Sstevel@tonic-gate typedef struct CB_RECALL4res CB_RECALL4res;
15730Sstevel@tonic-gate 
15740Sstevel@tonic-gate struct CB_ILLEGAL4res {
15750Sstevel@tonic-gate 	nfsstat4 status;
15760Sstevel@tonic-gate };
15770Sstevel@tonic-gate typedef struct CB_ILLEGAL4res CB_ILLEGAL4res;
15780Sstevel@tonic-gate 
15790Sstevel@tonic-gate enum nfs_cb_opnum4 {
15800Sstevel@tonic-gate 	OP_CB_GETATTR = 3,
15810Sstevel@tonic-gate 	OP_CB_RECALL = 4,
15820Sstevel@tonic-gate 	OP_CB_ILLEGAL = 10044
15830Sstevel@tonic-gate };
15840Sstevel@tonic-gate typedef enum nfs_cb_opnum4 nfs_cb_opnum4;
15850Sstevel@tonic-gate 
15860Sstevel@tonic-gate struct nfs_cb_argop4 {
15870Sstevel@tonic-gate 	uint_t argop;
15880Sstevel@tonic-gate 	union {
15890Sstevel@tonic-gate 		CB_GETATTR4args opcbgetattr;
15900Sstevel@tonic-gate 		CB_RECALL4args opcbrecall;
15910Sstevel@tonic-gate 	} nfs_cb_argop4_u;
15920Sstevel@tonic-gate };
15930Sstevel@tonic-gate typedef struct nfs_cb_argop4 nfs_cb_argop4;
15940Sstevel@tonic-gate 
15950Sstevel@tonic-gate struct nfs_cb_resop4 {
15960Sstevel@tonic-gate 	uint_t resop;
15970Sstevel@tonic-gate 	union {
15980Sstevel@tonic-gate 		CB_GETATTR4res opcbgetattr;
15990Sstevel@tonic-gate 		CB_RECALL4res opcbrecall;
16000Sstevel@tonic-gate 		CB_ILLEGAL4res opcbillegal;
16010Sstevel@tonic-gate 	} nfs_cb_resop4_u;
16020Sstevel@tonic-gate };
16030Sstevel@tonic-gate typedef struct nfs_cb_resop4 nfs_cb_resop4;
16040Sstevel@tonic-gate 
16050Sstevel@tonic-gate struct CB_COMPOUND4args {
16060Sstevel@tonic-gate 	utf8string tag;
16070Sstevel@tonic-gate 	uint32_t minorversion;
16080Sstevel@tonic-gate 	uint32_t callback_ident;
16090Sstevel@tonic-gate 	uint_t array_len;
16100Sstevel@tonic-gate 	nfs_cb_argop4 *array;
16110Sstevel@tonic-gate };
16120Sstevel@tonic-gate typedef struct CB_COMPOUND4args CB_COMPOUND4args;
16130Sstevel@tonic-gate 
16140Sstevel@tonic-gate struct CB_COMPOUND4res {
16150Sstevel@tonic-gate 	nfsstat4 status;
16160Sstevel@tonic-gate 	utf8string tag;
16170Sstevel@tonic-gate 	uint_t array_len;
16180Sstevel@tonic-gate 	nfs_cb_resop4 *array;
16190Sstevel@tonic-gate };
16200Sstevel@tonic-gate typedef struct CB_COMPOUND4res CB_COMPOUND4res;
16210Sstevel@tonic-gate 
16220Sstevel@tonic-gate #define	NFS4_PROGRAM		100003
16230Sstevel@tonic-gate #define	NFS_V4			4
16240Sstevel@tonic-gate #define	NFSPROC4_NULL		0
16250Sstevel@tonic-gate #define	NFSPROC4_COMPOUND	1
16260Sstevel@tonic-gate 
16270Sstevel@tonic-gate #define	NFS4_CALLBACK		0x40000000
16280Sstevel@tonic-gate #define	NFS_CB			1
16290Sstevel@tonic-gate #define	CB_NULL			0
16300Sstevel@tonic-gate #define	CB_COMPOUND		1
16310Sstevel@tonic-gate 
16320Sstevel@tonic-gate extern  bool_t xdr_bitmap4(XDR *, bitmap4 *);
16330Sstevel@tonic-gate extern  bool_t xdr_utf8string(XDR *, utf8string *);
16340Sstevel@tonic-gate extern  bool_t xdr_nfs_fh4(XDR *, nfs_fh4 *);
16350Sstevel@tonic-gate extern  bool_t xdr_fattr4_fsid(XDR *, fattr4_fsid *);
16360Sstevel@tonic-gate extern  bool_t xdr_fattr4_acl(XDR *, fattr4_acl *);
16370Sstevel@tonic-gate extern  bool_t xdr_fattr4_fs_locations(XDR *, fattr4_fs_locations *);
16380Sstevel@tonic-gate extern  bool_t xdr_fattr4_rawdev(XDR *, fattr4_rawdev *);
16390Sstevel@tonic-gate extern  bool_t xdr_nfstime4(XDR *, nfstime4 *);
16400Sstevel@tonic-gate extern  bool_t xdr_settime4(XDR *, settime4 *);
16410Sstevel@tonic-gate extern  bool_t xdr_COMPOUND4args_clnt(XDR *, COMPOUND4args_clnt *);
1642806Sek110237 extern  bool_t xdr_COMPOUND4args_srv(XDR *, COMPOUND4args *);
16430Sstevel@tonic-gate extern  bool_t xdr_COMPOUND4res_clnt(XDR *, COMPOUND4res_clnt *);
1644806Sek110237 extern  bool_t xdr_COMPOUND4res_srv(XDR *, COMPOUND4res *);
16451232Srobinson extern  bool_t xdr_CB_COMPOUND4args_clnt(XDR *, CB_COMPOUND4args *);
16461232Srobinson extern  bool_t xdr_CB_COMPOUND4args_srv(XDR *, CB_COMPOUND4args *);
16470Sstevel@tonic-gate extern  bool_t xdr_CB_COMPOUND4res(XDR *, CB_COMPOUND4res *);
16480Sstevel@tonic-gate 
1649*11291SRobert.Thurlow@Sun.COM /*
1650*11291SRobert.Thurlow@Sun.COM  * xdr for referrrals upcall
1651*11291SRobert.Thurlow@Sun.COM  */
1652*11291SRobert.Thurlow@Sun.COM extern	bool_t xdr_knetconfig(XDR *, struct knetconfig *);
1653*11291SRobert.Thurlow@Sun.COM extern	bool_t xdr_nfs_fsl_info(XDR *, struct nfs_fsl_info *);
1654*11291SRobert.Thurlow@Sun.COM 
16550Sstevel@tonic-gate 
16560Sstevel@tonic-gate #ifdef __cplusplus
16570Sstevel@tonic-gate }
16580Sstevel@tonic-gate #endif
16590Sstevel@tonic-gate 
16600Sstevel@tonic-gate #endif /* _NFS4_KPROT_H */
1661