xref: /titanic_51/usr/src/uts/common/nfs/nfs4_kprot.h (revision c93d332c7127fa77fd1d38a46c87a7d24d7a9ef8)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50a701b1eSRobert Gordon  * Common Development and Distribution License (the "License").
60a701b1eSRobert Gordon  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*bbe876c0SMarcel Telka 
22*bbe876c0SMarcel Telka /*
23*bbe876c0SMarcel Telka  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
24*bbe876c0SMarcel Telka  */
25*bbe876c0SMarcel Telka 
267c478bd9Sstevel@tonic-gate /*
272f172c55SRobert Thurlow  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
287c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef _NFS4_KPROT_H
327c478bd9Sstevel@tonic-gate #define	_NFS4_KPROT_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * Kernel specific version.
367c478bd9Sstevel@tonic-gate  * NFS Version 4 protocol definitions.  From nfs4_prot.x rev 1.119.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef __cplusplus
407c478bd9Sstevel@tonic-gate extern "C" {
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #include <rpc/rpc.h>
440a701b1eSRobert Gordon #ifdef _KERNEL
450a701b1eSRobert Gordon #include <rpc/rpc_rdma.h>
460a701b1eSRobert Gordon #endif
477c478bd9Sstevel@tonic-gate #include <sys/stream.h>
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate #define	NFS4_FHSIZE 128
507c478bd9Sstevel@tonic-gate #define	NFS4_VERIFIER_SIZE 8
51*bbe876c0SMarcel Telka #define	NFS4_OTHER_SIZE 12
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * Reasonable upper bounds to catch badly behaving partners
557c478bd9Sstevel@tonic-gate  */
567c478bd9Sstevel@tonic-gate #define	NFS4_OPAQUE_LIMIT	1024
577c478bd9Sstevel@tonic-gate #define	NFS4_COMPOUND_LIMIT	2048
587c478bd9Sstevel@tonic-gate #define	NFS4_FS_LOCATIONS_LIMIT	65536
597c478bd9Sstevel@tonic-gate #define	NFS4_ACL_LIMIT		65536
607c478bd9Sstevel@tonic-gate #define	NFS4_SECINFO_LIMIT	65536
617c478bd9Sstevel@tonic-gate #define	NFS4_FATTR4_LIMIT	1048576
627c478bd9Sstevel@tonic-gate #define	NFS4_DATA_LIMIT		134217728
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate enum nfs_ftype4 {
657c478bd9Sstevel@tonic-gate 	NF4REG = 1,
667c478bd9Sstevel@tonic-gate 	NF4DIR = 2,
677c478bd9Sstevel@tonic-gate 	NF4BLK = 3,
687c478bd9Sstevel@tonic-gate 	NF4CHR = 4,
697c478bd9Sstevel@tonic-gate 	NF4LNK = 5,
707c478bd9Sstevel@tonic-gate 	NF4SOCK = 6,
717c478bd9Sstevel@tonic-gate 	NF4FIFO = 7,
727c478bd9Sstevel@tonic-gate 	NF4ATTRDIR = 8,
737c478bd9Sstevel@tonic-gate 	NF4NAMEDATTR = 9
747c478bd9Sstevel@tonic-gate };
757c478bd9Sstevel@tonic-gate typedef enum nfs_ftype4 nfs_ftype4;
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate enum nfsstat4 {
787c478bd9Sstevel@tonic-gate 	NFS4_OK = 0,
797c478bd9Sstevel@tonic-gate 	NFS4ERR_PERM = 1,
807c478bd9Sstevel@tonic-gate 	NFS4ERR_NOENT = 2,
817c478bd9Sstevel@tonic-gate 	NFS4ERR_IO = 5,
827c478bd9Sstevel@tonic-gate 	NFS4ERR_NXIO = 6,
837c478bd9Sstevel@tonic-gate 	NFS4ERR_ACCESS = 13,
847c478bd9Sstevel@tonic-gate 	NFS4ERR_EXIST = 17,
857c478bd9Sstevel@tonic-gate 	NFS4ERR_XDEV = 18,
867c478bd9Sstevel@tonic-gate 	NFS4ERR_NOTDIR = 20,
877c478bd9Sstevel@tonic-gate 	NFS4ERR_ISDIR = 21,
887c478bd9Sstevel@tonic-gate 	NFS4ERR_INVAL = 22,
897c478bd9Sstevel@tonic-gate 	NFS4ERR_FBIG = 27,
907c478bd9Sstevel@tonic-gate 	NFS4ERR_NOSPC = 28,
917c478bd9Sstevel@tonic-gate 	NFS4ERR_ROFS = 30,
927c478bd9Sstevel@tonic-gate 	NFS4ERR_MLINK = 31,
937c478bd9Sstevel@tonic-gate 	NFS4ERR_NAMETOOLONG = 63,
947c478bd9Sstevel@tonic-gate 	NFS4ERR_NOTEMPTY = 66,
957c478bd9Sstevel@tonic-gate 	NFS4ERR_DQUOT = 69,
967c478bd9Sstevel@tonic-gate 	NFS4ERR_STALE = 70,
977c478bd9Sstevel@tonic-gate 	NFS4ERR_BADHANDLE = 10001,
987c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_COOKIE = 10003,
997c478bd9Sstevel@tonic-gate 	NFS4ERR_NOTSUPP = 10004,
1007c478bd9Sstevel@tonic-gate 	NFS4ERR_TOOSMALL = 10005,
1017c478bd9Sstevel@tonic-gate 	NFS4ERR_SERVERFAULT = 10006,
1027c478bd9Sstevel@tonic-gate 	NFS4ERR_BADTYPE = 10007,
1037c478bd9Sstevel@tonic-gate 	NFS4ERR_DELAY = 10008,
1047c478bd9Sstevel@tonic-gate 	NFS4ERR_SAME = 10009,
1057c478bd9Sstevel@tonic-gate 	NFS4ERR_DENIED = 10010,
1067c478bd9Sstevel@tonic-gate 	NFS4ERR_EXPIRED = 10011,
1077c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCKED = 10012,
1087c478bd9Sstevel@tonic-gate 	NFS4ERR_GRACE = 10013,
1097c478bd9Sstevel@tonic-gate 	NFS4ERR_FHEXPIRED = 10014,
1107c478bd9Sstevel@tonic-gate 	NFS4ERR_SHARE_DENIED = 10015,
1117c478bd9Sstevel@tonic-gate 	NFS4ERR_WRONGSEC = 10016,
1127c478bd9Sstevel@tonic-gate 	NFS4ERR_CLID_INUSE = 10017,
1137c478bd9Sstevel@tonic-gate 	NFS4ERR_RESOURCE = 10018,
1147c478bd9Sstevel@tonic-gate 	NFS4ERR_MOVED = 10019,
1157c478bd9Sstevel@tonic-gate 	NFS4ERR_NOFILEHANDLE = 10020,
1167c478bd9Sstevel@tonic-gate 	NFS4ERR_MINOR_VERS_MISMATCH = 10021,
1177c478bd9Sstevel@tonic-gate 	NFS4ERR_STALE_CLIENTID = 10022,
1187c478bd9Sstevel@tonic-gate 	NFS4ERR_STALE_STATEID = 10023,
1197c478bd9Sstevel@tonic-gate 	NFS4ERR_OLD_STATEID = 10024,
1207c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_STATEID = 10025,
1217c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_SEQID = 10026,
1227c478bd9Sstevel@tonic-gate 	NFS4ERR_NOT_SAME = 10027,
1237c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCK_RANGE = 10028,
1247c478bd9Sstevel@tonic-gate 	NFS4ERR_SYMLINK = 10029,
1257c478bd9Sstevel@tonic-gate 	NFS4ERR_RESTOREFH = 10030,
1267c478bd9Sstevel@tonic-gate 	NFS4ERR_LEASE_MOVED = 10031,
1277c478bd9Sstevel@tonic-gate 	NFS4ERR_ATTRNOTSUPP = 10032,
1287c478bd9Sstevel@tonic-gate 	NFS4ERR_NO_GRACE = 10033,
1297c478bd9Sstevel@tonic-gate 	NFS4ERR_RECLAIM_BAD = 10034,
1307c478bd9Sstevel@tonic-gate 	NFS4ERR_RECLAIM_CONFLICT = 10035,
1317c478bd9Sstevel@tonic-gate 	NFS4ERR_BADXDR = 10036,
1327c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCKS_HELD = 10037,
1337c478bd9Sstevel@tonic-gate 	NFS4ERR_OPENMODE = 10038,
1347c478bd9Sstevel@tonic-gate 	NFS4ERR_BADOWNER = 10039,
1357c478bd9Sstevel@tonic-gate 	NFS4ERR_BADCHAR = 10040,
1367c478bd9Sstevel@tonic-gate 	NFS4ERR_BADNAME = 10041,
1377c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_RANGE = 10042,
1387c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCK_NOTSUPP = 10043,
1397c478bd9Sstevel@tonic-gate 	NFS4ERR_OP_ILLEGAL = 10044,
1407c478bd9Sstevel@tonic-gate 	NFS4ERR_DEADLOCK = 10045,
1417c478bd9Sstevel@tonic-gate 	NFS4ERR_FILE_OPEN = 10046,
1427c478bd9Sstevel@tonic-gate 	NFS4ERR_ADMIN_REVOKED = 10047,
1437c478bd9Sstevel@tonic-gate 	NFS4ERR_CB_PATH_DOWN = 10048
1447c478bd9Sstevel@tonic-gate };
1457c478bd9Sstevel@tonic-gate typedef enum nfsstat4 nfsstat4;
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
1487c478bd9Sstevel@tonic-gate  * A bitmap can only be 56 bits, treat it as a uint64_t for now
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate typedef uint64_t bitmap4;
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate typedef uint64_t offset4;
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate typedef uint32_t count4;
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate typedef uint64_t length4;
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate typedef uint64_t clientid4;
1597c478bd9Sstevel@tonic-gate 
160*bbe876c0SMarcel Telka typedef uint32_t nfs_lease4;
161*bbe876c0SMarcel Telka 
1627c478bd9Sstevel@tonic-gate typedef uint32_t seqid4;
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate typedef struct {
1657c478bd9Sstevel@tonic-gate 	uint_t utf8string_len;
1667c478bd9Sstevel@tonic-gate 	char *utf8string_val;
1677c478bd9Sstevel@tonic-gate } utf8string;
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate typedef utf8string component4;
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate typedef struct {
1727c478bd9Sstevel@tonic-gate 	uint_t pathname4_len;
1737c478bd9Sstevel@tonic-gate 	component4 *pathname4_val;
1747c478bd9Sstevel@tonic-gate } pathname4;
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate typedef uint64_t nfs_lockid4;
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate typedef uint64_t nfs_cookie4;
1797c478bd9Sstevel@tonic-gate 
180*bbe876c0SMarcel Telka typedef struct {
181*bbe876c0SMarcel Telka 	uint_t linktext4_len;
182*bbe876c0SMarcel Telka 	char *linktext4_val;
183*bbe876c0SMarcel Telka } linktext4;
184*bbe876c0SMarcel Telka 
185*bbe876c0SMarcel Telka typedef utf8string ascii_REQUIRED4;
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate typedef struct {
1887c478bd9Sstevel@tonic-gate 	uint_t sec_oid4_len;
1897c478bd9Sstevel@tonic-gate 	char *sec_oid4_val;
1907c478bd9Sstevel@tonic-gate } sec_oid4;
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate typedef uint32_t qop4;
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate typedef uint32_t mode4;
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate typedef uint64_t changeid4;
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate typedef uint64_t verifier4;
1997c478bd9Sstevel@tonic-gate 
2007c478bd9Sstevel@tonic-gate struct nfstime4 {
2017c478bd9Sstevel@tonic-gate 	int64_t seconds;
2027c478bd9Sstevel@tonic-gate 	uint32_t nseconds;
2037c478bd9Sstevel@tonic-gate };
2047c478bd9Sstevel@tonic-gate typedef struct nfstime4 nfstime4;
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate enum time_how4 {
2077c478bd9Sstevel@tonic-gate 	SET_TO_SERVER_TIME4 = 0,
2087c478bd9Sstevel@tonic-gate 	SET_TO_CLIENT_TIME4 = 1
2097c478bd9Sstevel@tonic-gate };
2107c478bd9Sstevel@tonic-gate typedef enum time_how4 time_how4;
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate struct settime4 {
2137c478bd9Sstevel@tonic-gate 	time_how4 set_it;
2147c478bd9Sstevel@tonic-gate 	nfstime4 time;
2157c478bd9Sstevel@tonic-gate };
2167c478bd9Sstevel@tonic-gate typedef struct settime4 settime4;
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate typedef struct {
2197c478bd9Sstevel@tonic-gate 	uint_t nfs_fh4_len;
2207c478bd9Sstevel@tonic-gate 	char *nfs_fh4_val;
2217c478bd9Sstevel@tonic-gate } nfs_fh4;
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate struct fsid4 {
2247c478bd9Sstevel@tonic-gate 	uint64_t major;
2257c478bd9Sstevel@tonic-gate 	uint64_t minor;
2267c478bd9Sstevel@tonic-gate };
2277c478bd9Sstevel@tonic-gate typedef struct fsid4 fsid4;
2287c478bd9Sstevel@tonic-gate 
2297c478bd9Sstevel@tonic-gate struct fs_location4 {
2307c478bd9Sstevel@tonic-gate 	uint_t server_len;
2317c478bd9Sstevel@tonic-gate 	utf8string *server_val;
2327c478bd9Sstevel@tonic-gate 	pathname4 rootpath;
2337c478bd9Sstevel@tonic-gate };
2347c478bd9Sstevel@tonic-gate typedef struct fs_location4 fs_location4;
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate struct fs_locations4 {
2377c478bd9Sstevel@tonic-gate 	pathname4 fs_root;
2387c478bd9Sstevel@tonic-gate 	uint_t locations_len;
2397c478bd9Sstevel@tonic-gate 	fs_location4 *locations_val;
2407c478bd9Sstevel@tonic-gate };
2417c478bd9Sstevel@tonic-gate typedef struct fs_locations4 fs_locations4;
2427c478bd9Sstevel@tonic-gate 
243*bbe876c0SMarcel Telka /*
244*bbe876c0SMarcel Telka  * This structure is declared in nfs4.h
245*bbe876c0SMarcel Telka  */
246*bbe876c0SMarcel Telka struct nfs_fsl_info;
2472f172c55SRobert Thurlow 
2487c478bd9Sstevel@tonic-gate /*
2497c478bd9Sstevel@tonic-gate  * ACL support
2507c478bd9Sstevel@tonic-gate  */
2517c478bd9Sstevel@tonic-gate 
2527c478bd9Sstevel@tonic-gate #define	ACL4_SUPPORT_ALLOW_ACL 0x00000001
2537c478bd9Sstevel@tonic-gate #define	ACL4_SUPPORT_DENY_ACL 0x00000002
2547c478bd9Sstevel@tonic-gate #define	ACL4_SUPPORT_AUDIT_ACL 0x00000004
2557c478bd9Sstevel@tonic-gate #define	ACL4_SUPPORT_ALARM_ACL 0x00000008
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate typedef uint32_t acetype4;
2587c478bd9Sstevel@tonic-gate #define	ACE4_ACCESS_ALLOWED_ACE_TYPE 0x00000000
2597c478bd9Sstevel@tonic-gate #define	ACE4_ACCESS_DENIED_ACE_TYPE 0x00000001
2607c478bd9Sstevel@tonic-gate #define	ACE4_SYSTEM_AUDIT_ACE_TYPE 0x00000002
2617c478bd9Sstevel@tonic-gate #define	ACE4_SYSTEM_ALARM_ACE_TYPE 0x00000003
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate typedef uint32_t aceflag4;
2647c478bd9Sstevel@tonic-gate #define	ACE4_FILE_INHERIT_ACE 0x00000001
2657c478bd9Sstevel@tonic-gate #define	ACE4_DIRECTORY_INHERIT_ACE 0x00000002
2667c478bd9Sstevel@tonic-gate #define	ACE4_NO_PROPAGATE_INHERIT_ACE 0x00000004
2677c478bd9Sstevel@tonic-gate #define	ACE4_INHERIT_ONLY_ACE 0x00000008
2687c478bd9Sstevel@tonic-gate #define	ACE4_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
2697c478bd9Sstevel@tonic-gate #define	ACE4_FAILED_ACCESS_ACE_FLAG 0x00000020
2707c478bd9Sstevel@tonic-gate #define	ACE4_IDENTIFIER_GROUP 0x00000040
2717c478bd9Sstevel@tonic-gate /*
2727c478bd9Sstevel@tonic-gate  * This defines all valid flag bits, as defined by RFC 3530.  If
2737c478bd9Sstevel@tonic-gate  * any additional flag bits are deemed part of the NFSv4 spec,
2747c478bd9Sstevel@tonic-gate  * you must also add them to the definition below.
2757c478bd9Sstevel@tonic-gate  */
2767c478bd9Sstevel@tonic-gate #define	ACE4_VALID_FLAG_BITS (\
2777c478bd9Sstevel@tonic-gate     ACE4_FILE_INHERIT_ACE | \
2787c478bd9Sstevel@tonic-gate     ACE4_DIRECTORY_INHERIT_ACE | \
2797c478bd9Sstevel@tonic-gate     ACE4_NO_PROPAGATE_INHERIT_ACE | \
2807c478bd9Sstevel@tonic-gate     ACE4_INHERIT_ONLY_ACE | \
2817c478bd9Sstevel@tonic-gate     ACE4_SUCCESSFUL_ACCESS_ACE_FLAG | \
2827c478bd9Sstevel@tonic-gate     ACE4_FAILED_ACCESS_ACE_FLAG | \
2837c478bd9Sstevel@tonic-gate     ACE4_IDENTIFIER_GROUP)
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate typedef uint32_t acemask4;
2867c478bd9Sstevel@tonic-gate #define	ACE4_READ_DATA 0x00000001
2877c478bd9Sstevel@tonic-gate #define	ACE4_LIST_DIRECTORY 0x00000001
2887c478bd9Sstevel@tonic-gate #define	ACE4_WRITE_DATA 0x00000002
2897c478bd9Sstevel@tonic-gate #define	ACE4_ADD_FILE 0x00000002
2907c478bd9Sstevel@tonic-gate #define	ACE4_APPEND_DATA 0x00000004
2917c478bd9Sstevel@tonic-gate #define	ACE4_ADD_SUBDIRECTORY 0x00000004
2927c478bd9Sstevel@tonic-gate #define	ACE4_READ_NAMED_ATTRS 0x00000008
2937c478bd9Sstevel@tonic-gate #define	ACE4_WRITE_NAMED_ATTRS 0x00000010
2947c478bd9Sstevel@tonic-gate #define	ACE4_EXECUTE 0x00000020
2957c478bd9Sstevel@tonic-gate #define	ACE4_DELETE_CHILD 0x00000040
2967c478bd9Sstevel@tonic-gate #define	ACE4_READ_ATTRIBUTES 0x00000080
2977c478bd9Sstevel@tonic-gate #define	ACE4_WRITE_ATTRIBUTES 0x00000100
2987c478bd9Sstevel@tonic-gate #define	ACE4_DELETE 0x00010000
2997c478bd9Sstevel@tonic-gate #define	ACE4_READ_ACL 0x00020000
3007c478bd9Sstevel@tonic-gate #define	ACE4_WRITE_ACL 0x00040000
3017c478bd9Sstevel@tonic-gate #define	ACE4_WRITE_OWNER 0x00080000
3027c478bd9Sstevel@tonic-gate #define	ACE4_SYNCHRONIZE 0x00100000
3037c478bd9Sstevel@tonic-gate #define	ACE4_GENERIC_READ 0x00120081
3047c478bd9Sstevel@tonic-gate #define	ACE4_GENERIC_WRITE 0x00160106
3057c478bd9Sstevel@tonic-gate #define	ACE4_GENERIC_EXECUTE 0x001200A0
3067c478bd9Sstevel@tonic-gate /*
3077c478bd9Sstevel@tonic-gate  * This defines all valid access mask bits, as defined by RFC 3530.  If
3087c478bd9Sstevel@tonic-gate  * any additional access mask bits are deemed part of the NFSv4 spec,
3097c478bd9Sstevel@tonic-gate  * you must also add them to the definition below.
3107c478bd9Sstevel@tonic-gate  */
3117c478bd9Sstevel@tonic-gate #define	ACE4_VALID_MASK_BITS (\
3127c478bd9Sstevel@tonic-gate     ACE4_READ_DATA | \
3137c478bd9Sstevel@tonic-gate     ACE4_LIST_DIRECTORY | \
3147c478bd9Sstevel@tonic-gate     ACE4_WRITE_DATA | \
3157c478bd9Sstevel@tonic-gate     ACE4_ADD_FILE | \
3167c478bd9Sstevel@tonic-gate     ACE4_APPEND_DATA | \
3177c478bd9Sstevel@tonic-gate     ACE4_ADD_SUBDIRECTORY | \
3187c478bd9Sstevel@tonic-gate     ACE4_READ_NAMED_ATTRS | \
3197c478bd9Sstevel@tonic-gate     ACE4_WRITE_NAMED_ATTRS | \
3207c478bd9Sstevel@tonic-gate     ACE4_EXECUTE | \
3217c478bd9Sstevel@tonic-gate     ACE4_DELETE_CHILD | \
3227c478bd9Sstevel@tonic-gate     ACE4_READ_ATTRIBUTES | \
3237c478bd9Sstevel@tonic-gate     ACE4_WRITE_ATTRIBUTES | \
3247c478bd9Sstevel@tonic-gate     ACE4_DELETE | \
3257c478bd9Sstevel@tonic-gate     ACE4_READ_ACL | \
3267c478bd9Sstevel@tonic-gate     ACE4_WRITE_ACL | \
3277c478bd9Sstevel@tonic-gate     ACE4_WRITE_OWNER | \
3287c478bd9Sstevel@tonic-gate     ACE4_SYNCHRONIZE)
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate /* Used to signify an undefined value for an acemask4 */
3317c478bd9Sstevel@tonic-gate #define	ACE4_MASK_UNDEFINED 0x80000000
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate #define	ACE4_WHO_OWNER		"OWNER@"
3347c478bd9Sstevel@tonic-gate #define	ACE4_WHO_GROUP		"GROUP@"
3357c478bd9Sstevel@tonic-gate #define	ACE4_WHO_EVERYONE	"EVERYONE@"
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate struct nfsace4 {
3387c478bd9Sstevel@tonic-gate 	acetype4 type;
3397c478bd9Sstevel@tonic-gate 	aceflag4 flag;
3407c478bd9Sstevel@tonic-gate 	acemask4 access_mask;
3417c478bd9Sstevel@tonic-gate 	utf8string who;
3427c478bd9Sstevel@tonic-gate };
3437c478bd9Sstevel@tonic-gate typedef struct nfsace4 nfsace4;
3447c478bd9Sstevel@tonic-gate #define	MODE4_SUID 0x800
3457c478bd9Sstevel@tonic-gate #define	MODE4_SGID 0x400
3467c478bd9Sstevel@tonic-gate #define	MODE4_SVTX 0x200
3477c478bd9Sstevel@tonic-gate #define	MODE4_RUSR 0x100
3487c478bd9Sstevel@tonic-gate #define	MODE4_WUSR 0x080
3497c478bd9Sstevel@tonic-gate #define	MODE4_XUSR 0x040
3507c478bd9Sstevel@tonic-gate #define	MODE4_RGRP 0x020
3517c478bd9Sstevel@tonic-gate #define	MODE4_WGRP 0x010
3527c478bd9Sstevel@tonic-gate #define	MODE4_XGRP 0x008
3537c478bd9Sstevel@tonic-gate #define	MODE4_ROTH 0x004
3547c478bd9Sstevel@tonic-gate #define	MODE4_WOTH 0x002
3557c478bd9Sstevel@tonic-gate #define	MODE4_XOTH 0x001
3567c478bd9Sstevel@tonic-gate 
3577c478bd9Sstevel@tonic-gate /*
3587c478bd9Sstevel@tonic-gate  * ACL conversion helpers
3597c478bd9Sstevel@tonic-gate  */
3607c478bd9Sstevel@tonic-gate 
3617c478bd9Sstevel@tonic-gate typedef enum {
3627c478bd9Sstevel@tonic-gate 	ace4_unused,
3637c478bd9Sstevel@tonic-gate 	ace4_user_obj,
3647c478bd9Sstevel@tonic-gate 	ace4_user,
3657c478bd9Sstevel@tonic-gate 	ace4_group, /* includes GROUP and GROUP_OBJ */
3667c478bd9Sstevel@tonic-gate 	ace4_other_obj
3677c478bd9Sstevel@tonic-gate } ace4_to_aent_state_t;
3687c478bd9Sstevel@tonic-gate 
3697c478bd9Sstevel@tonic-gate typedef struct ace4vals {
3707c478bd9Sstevel@tonic-gate 	utf8string *key; /* NB: not allocated here; points to existing utf8 */
3717c478bd9Sstevel@tonic-gate 	avl_node_t avl;
3727c478bd9Sstevel@tonic-gate 	acemask4 mask;
3737c478bd9Sstevel@tonic-gate 	acemask4 allowed;
3747c478bd9Sstevel@tonic-gate 	acemask4 denied;
3757c478bd9Sstevel@tonic-gate 	int aent_type;
3767c478bd9Sstevel@tonic-gate } ace4vals_t;
3777c478bd9Sstevel@tonic-gate 
3787c478bd9Sstevel@tonic-gate typedef struct ace4_list {
3797c478bd9Sstevel@tonic-gate 	ace4vals_t user_obj;
3807c478bd9Sstevel@tonic-gate 	avl_tree_t user;
3817c478bd9Sstevel@tonic-gate 	int numusers;
3827c478bd9Sstevel@tonic-gate 	ace4vals_t group_obj;
3837c478bd9Sstevel@tonic-gate 	avl_tree_t group;
3847c478bd9Sstevel@tonic-gate 	int numgroups;
3857c478bd9Sstevel@tonic-gate 	ace4vals_t other_obj;
3867c478bd9Sstevel@tonic-gate 	acemask4 acl_mask;
3877c478bd9Sstevel@tonic-gate 	int hasmask;
3887c478bd9Sstevel@tonic-gate 	int dfacl_flag;
3897c478bd9Sstevel@tonic-gate 	ace4_to_aent_state_t state;
3907c478bd9Sstevel@tonic-gate 	int seen; /* bitmask of all aclent_t a_type values seen */
3917c478bd9Sstevel@tonic-gate } ace4_list_t;
3927c478bd9Sstevel@tonic-gate 
3937c478bd9Sstevel@tonic-gate struct specdata4 {
3947c478bd9Sstevel@tonic-gate 	uint32_t specdata1;
3957c478bd9Sstevel@tonic-gate 	uint32_t specdata2;
3967c478bd9Sstevel@tonic-gate };
3977c478bd9Sstevel@tonic-gate typedef struct specdata4 specdata4;
3987c478bd9Sstevel@tonic-gate #define	FH4_PERSISTENT 0x00000000
3997c478bd9Sstevel@tonic-gate #define	FH4_NOEXPIRE_WITH_OPEN 0x00000001
4007c478bd9Sstevel@tonic-gate #define	FH4_VOLATILE_ANY 0x00000002
4017c478bd9Sstevel@tonic-gate #define	FH4_VOL_MIGRATION 0x00000004
4027c478bd9Sstevel@tonic-gate #define	FH4_VOL_RENAME 0x00000008
4037c478bd9Sstevel@tonic-gate 
4047c478bd9Sstevel@tonic-gate typedef bitmap4 fattr4_supported_attrs;
4057c478bd9Sstevel@tonic-gate 
4067c478bd9Sstevel@tonic-gate typedef nfs_ftype4 fattr4_type;
4077c478bd9Sstevel@tonic-gate 
4087c478bd9Sstevel@tonic-gate typedef uint32_t fattr4_fh_expire_type;
4097c478bd9Sstevel@tonic-gate 
4107c478bd9Sstevel@tonic-gate typedef changeid4 fattr4_change;
4117c478bd9Sstevel@tonic-gate 
4127c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_size;
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate typedef bool_t fattr4_link_support;
4157c478bd9Sstevel@tonic-gate 
4167c478bd9Sstevel@tonic-gate typedef bool_t fattr4_symlink_support;
4177c478bd9Sstevel@tonic-gate 
4187c478bd9Sstevel@tonic-gate typedef bool_t fattr4_named_attr;
4197c478bd9Sstevel@tonic-gate 
4207c478bd9Sstevel@tonic-gate typedef fsid4 fattr4_fsid;
4217c478bd9Sstevel@tonic-gate 
4227c478bd9Sstevel@tonic-gate typedef bool_t fattr4_unique_handles;
4237c478bd9Sstevel@tonic-gate 
424*bbe876c0SMarcel Telka typedef nfs_lease4 fattr4_lease_time;
4257c478bd9Sstevel@tonic-gate 
4267c478bd9Sstevel@tonic-gate typedef nfsstat4 fattr4_rdattr_error;
4277c478bd9Sstevel@tonic-gate 
4287c478bd9Sstevel@tonic-gate typedef struct {
4297c478bd9Sstevel@tonic-gate 	uint_t fattr4_acl_len;
4307c478bd9Sstevel@tonic-gate 	nfsace4 *fattr4_acl_val;
4317c478bd9Sstevel@tonic-gate } fattr4_acl;
4327c478bd9Sstevel@tonic-gate 
4337c478bd9Sstevel@tonic-gate typedef uint32_t fattr4_aclsupport;
4347c478bd9Sstevel@tonic-gate 
4357c478bd9Sstevel@tonic-gate typedef bool_t fattr4_archive;
4367c478bd9Sstevel@tonic-gate 
4377c478bd9Sstevel@tonic-gate typedef bool_t fattr4_cansettime;
4387c478bd9Sstevel@tonic-gate 
4397c478bd9Sstevel@tonic-gate typedef bool_t fattr4_case_insensitive;
4407c478bd9Sstevel@tonic-gate 
4417c478bd9Sstevel@tonic-gate typedef bool_t fattr4_case_preserving;
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate typedef bool_t fattr4_chown_restricted;
4447c478bd9Sstevel@tonic-gate 
4457c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_fileid;
4467c478bd9Sstevel@tonic-gate 
4477c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_files_avail;
4487c478bd9Sstevel@tonic-gate 
4497c478bd9Sstevel@tonic-gate typedef nfs_fh4 fattr4_filehandle;
4507c478bd9Sstevel@tonic-gate 
4517c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_files_free;
4527c478bd9Sstevel@tonic-gate 
4537c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_files_total;
4547c478bd9Sstevel@tonic-gate 
4557c478bd9Sstevel@tonic-gate typedef fs_locations4 fattr4_fs_locations;
4567c478bd9Sstevel@tonic-gate 
4577c478bd9Sstevel@tonic-gate typedef bool_t fattr4_hidden;
4587c478bd9Sstevel@tonic-gate 
4597c478bd9Sstevel@tonic-gate typedef bool_t fattr4_homogeneous;
4607c478bd9Sstevel@tonic-gate 
4617c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_maxfilesize;
4627c478bd9Sstevel@tonic-gate 
4637c478bd9Sstevel@tonic-gate typedef uint32_t fattr4_maxlink;
4647c478bd9Sstevel@tonic-gate 
4657c478bd9Sstevel@tonic-gate typedef uint32_t fattr4_maxname;
4667c478bd9Sstevel@tonic-gate 
4677c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_maxread;
4687c478bd9Sstevel@tonic-gate 
4697c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_maxwrite;
4707c478bd9Sstevel@tonic-gate 
471*bbe876c0SMarcel Telka typedef ascii_REQUIRED4 fattr4_mimetype;
4727c478bd9Sstevel@tonic-gate 
4737c478bd9Sstevel@tonic-gate typedef mode4 fattr4_mode;
4747c478bd9Sstevel@tonic-gate 
4757c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_mounted_on_fileid;
4767c478bd9Sstevel@tonic-gate 
4777c478bd9Sstevel@tonic-gate typedef bool_t fattr4_no_trunc;
4787c478bd9Sstevel@tonic-gate 
4797c478bd9Sstevel@tonic-gate typedef uint32_t fattr4_numlinks;
4807c478bd9Sstevel@tonic-gate 
4817c478bd9Sstevel@tonic-gate typedef utf8string fattr4_owner;
4827c478bd9Sstevel@tonic-gate 
4837c478bd9Sstevel@tonic-gate typedef utf8string fattr4_owner_group;
4847c478bd9Sstevel@tonic-gate 
4857c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_quota_avail_hard;
4867c478bd9Sstevel@tonic-gate 
4877c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_quota_avail_soft;
4887c478bd9Sstevel@tonic-gate 
4897c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_quota_used;
4907c478bd9Sstevel@tonic-gate 
4917c478bd9Sstevel@tonic-gate typedef specdata4 fattr4_rawdev;
4927c478bd9Sstevel@tonic-gate 
4937c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_space_avail;
4947c478bd9Sstevel@tonic-gate 
4957c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_space_free;
4967c478bd9Sstevel@tonic-gate 
4977c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_space_total;
4987c478bd9Sstevel@tonic-gate 
4997c478bd9Sstevel@tonic-gate typedef uint64_t fattr4_space_used;
5007c478bd9Sstevel@tonic-gate 
5017c478bd9Sstevel@tonic-gate typedef bool_t fattr4_system;
5027c478bd9Sstevel@tonic-gate 
5037c478bd9Sstevel@tonic-gate typedef nfstime4 fattr4_time_access;
5047c478bd9Sstevel@tonic-gate 
5057c478bd9Sstevel@tonic-gate typedef settime4 fattr4_time_access_set;
5067c478bd9Sstevel@tonic-gate 
5077c478bd9Sstevel@tonic-gate typedef nfstime4 fattr4_time_backup;
5087c478bd9Sstevel@tonic-gate 
5097c478bd9Sstevel@tonic-gate typedef nfstime4 fattr4_time_create;
5107c478bd9Sstevel@tonic-gate 
5117c478bd9Sstevel@tonic-gate typedef nfstime4 fattr4_time_delta;
5127c478bd9Sstevel@tonic-gate 
5137c478bd9Sstevel@tonic-gate typedef nfstime4 fattr4_time_metadata;
5147c478bd9Sstevel@tonic-gate 
5157c478bd9Sstevel@tonic-gate typedef nfstime4 fattr4_time_modify;
5167c478bd9Sstevel@tonic-gate 
5177c478bd9Sstevel@tonic-gate typedef settime4 fattr4_time_modify_set;
5187c478bd9Sstevel@tonic-gate #define	FATTR4_SUPPORTED_ATTRS 0
5197c478bd9Sstevel@tonic-gate #define	FATTR4_TYPE 1
5207c478bd9Sstevel@tonic-gate #define	FATTR4_FH_EXPIRE_TYPE 2
5217c478bd9Sstevel@tonic-gate #define	FATTR4_CHANGE 3
5227c478bd9Sstevel@tonic-gate #define	FATTR4_SIZE 4
5237c478bd9Sstevel@tonic-gate #define	FATTR4_LINK_SUPPORT 5
5247c478bd9Sstevel@tonic-gate #define	FATTR4_SYMLINK_SUPPORT 6
5257c478bd9Sstevel@tonic-gate #define	FATTR4_NAMED_ATTR 7
5267c478bd9Sstevel@tonic-gate #define	FATTR4_FSID 8
5277c478bd9Sstevel@tonic-gate #define	FATTR4_UNIQUE_HANDLES 9
5287c478bd9Sstevel@tonic-gate #define	FATTR4_LEASE_TIME 10
5297c478bd9Sstevel@tonic-gate #define	FATTR4_RDATTR_ERROR 11
5307c478bd9Sstevel@tonic-gate #define	FATTR4_FILEHANDLE 19
5317c478bd9Sstevel@tonic-gate #define	FATTR4_ACL 12
5327c478bd9Sstevel@tonic-gate #define	FATTR4_ACLSUPPORT 13
5337c478bd9Sstevel@tonic-gate #define	FATTR4_ARCHIVE 14
5347c478bd9Sstevel@tonic-gate #define	FATTR4_CANSETTIME 15
5357c478bd9Sstevel@tonic-gate #define	FATTR4_CASE_INSENSITIVE 16
5367c478bd9Sstevel@tonic-gate #define	FATTR4_CASE_PRESERVING 17
5377c478bd9Sstevel@tonic-gate #define	FATTR4_CHOWN_RESTRICTED 18
5387c478bd9Sstevel@tonic-gate #define	FATTR4_FILEID 20
5397c478bd9Sstevel@tonic-gate #define	FATTR4_FILES_AVAIL 21
5407c478bd9Sstevel@tonic-gate #define	FATTR4_FILES_FREE 22
5417c478bd9Sstevel@tonic-gate #define	FATTR4_FILES_TOTAL 23
5427c478bd9Sstevel@tonic-gate #define	FATTR4_FS_LOCATIONS 24
5437c478bd9Sstevel@tonic-gate #define	FATTR4_HIDDEN 25
5447c478bd9Sstevel@tonic-gate #define	FATTR4_HOMOGENEOUS 26
5457c478bd9Sstevel@tonic-gate #define	FATTR4_MAXFILESIZE 27
5467c478bd9Sstevel@tonic-gate #define	FATTR4_MAXLINK 28
5477c478bd9Sstevel@tonic-gate #define	FATTR4_MAXNAME 29
5487c478bd9Sstevel@tonic-gate #define	FATTR4_MAXREAD 30
5497c478bd9Sstevel@tonic-gate #define	FATTR4_MAXWRITE 31
5507c478bd9Sstevel@tonic-gate #define	FATTR4_MIMETYPE 32
5517c478bd9Sstevel@tonic-gate #define	FATTR4_MODE 33
5527c478bd9Sstevel@tonic-gate #define	FATTR4_NO_TRUNC 34
5537c478bd9Sstevel@tonic-gate #define	FATTR4_NUMLINKS 35
5547c478bd9Sstevel@tonic-gate #define	FATTR4_OWNER 36
5557c478bd9Sstevel@tonic-gate #define	FATTR4_OWNER_GROUP 37
5567c478bd9Sstevel@tonic-gate #define	FATTR4_QUOTA_AVAIL_HARD 38
5577c478bd9Sstevel@tonic-gate #define	FATTR4_QUOTA_AVAIL_SOFT 39
5587c478bd9Sstevel@tonic-gate #define	FATTR4_QUOTA_USED 40
5597c478bd9Sstevel@tonic-gate #define	FATTR4_RAWDEV 41
5607c478bd9Sstevel@tonic-gate #define	FATTR4_SPACE_AVAIL 42
5617c478bd9Sstevel@tonic-gate #define	FATTR4_SPACE_FREE 43
5627c478bd9Sstevel@tonic-gate #define	FATTR4_SPACE_TOTAL 44
5637c478bd9Sstevel@tonic-gate #define	FATTR4_SPACE_USED 45
5647c478bd9Sstevel@tonic-gate #define	FATTR4_SYSTEM 46
5657c478bd9Sstevel@tonic-gate #define	FATTR4_TIME_ACCESS 47
5667c478bd9Sstevel@tonic-gate #define	FATTR4_TIME_ACCESS_SET 48
5677c478bd9Sstevel@tonic-gate #define	FATTR4_TIME_BACKUP 49
5687c478bd9Sstevel@tonic-gate #define	FATTR4_TIME_CREATE 50
5697c478bd9Sstevel@tonic-gate #define	FATTR4_TIME_DELTA 51
5707c478bd9Sstevel@tonic-gate #define	FATTR4_TIME_METADATA 52
5717c478bd9Sstevel@tonic-gate #define	FATTR4_TIME_MODIFY 53
5727c478bd9Sstevel@tonic-gate #define	FATTR4_TIME_MODIFY_SET 54
5737c478bd9Sstevel@tonic-gate #define	FATTR4_MOUNTED_ON_FILEID 55
5747c478bd9Sstevel@tonic-gate 
5757c478bd9Sstevel@tonic-gate struct fattr4 {
5767c478bd9Sstevel@tonic-gate 	bitmap4 attrmask;
5777c478bd9Sstevel@tonic-gate 	char *attrlist4;
5787c478bd9Sstevel@tonic-gate 	uint_t attrlist4_len;
5797c478bd9Sstevel@tonic-gate };
5807c478bd9Sstevel@tonic-gate typedef struct fattr4 fattr4;
5817c478bd9Sstevel@tonic-gate 
5827c478bd9Sstevel@tonic-gate struct change_info4 {
5837c478bd9Sstevel@tonic-gate 	bool_t atomic;
5847c478bd9Sstevel@tonic-gate 	changeid4 before;
5857c478bd9Sstevel@tonic-gate 	changeid4 after;
5867c478bd9Sstevel@tonic-gate };
5877c478bd9Sstevel@tonic-gate typedef struct change_info4 change_info4;
5887c478bd9Sstevel@tonic-gate 
5897c478bd9Sstevel@tonic-gate struct clientaddr4 {
5907c478bd9Sstevel@tonic-gate 	char *r_netid;
5917c478bd9Sstevel@tonic-gate 	char *r_addr;
5927c478bd9Sstevel@tonic-gate };
5937c478bd9Sstevel@tonic-gate typedef struct clientaddr4 clientaddr4;
5947c478bd9Sstevel@tonic-gate 
5957c478bd9Sstevel@tonic-gate struct cb_client4 {
596*bbe876c0SMarcel Telka 	uint_t cb_program;
5977c478bd9Sstevel@tonic-gate 	clientaddr4 cb_location;
5987c478bd9Sstevel@tonic-gate };
5997c478bd9Sstevel@tonic-gate typedef struct cb_client4 cb_client4;
6007c478bd9Sstevel@tonic-gate 
6017c478bd9Sstevel@tonic-gate struct stateid4 {
6027c478bd9Sstevel@tonic-gate 	uint32_t seqid;
603*bbe876c0SMarcel Telka 	char other[NFS4_OTHER_SIZE];
6047c478bd9Sstevel@tonic-gate };
6057c478bd9Sstevel@tonic-gate typedef struct stateid4 stateid4;
6067c478bd9Sstevel@tonic-gate 
6077c478bd9Sstevel@tonic-gate struct nfs_client_id4 {
6087c478bd9Sstevel@tonic-gate 	verifier4 verifier;
6097c478bd9Sstevel@tonic-gate 	uint_t id_len;
6107c478bd9Sstevel@tonic-gate 	char *id_val;
6112f172c55SRobert Thurlow 	struct sockaddr *cl_addr;
6127c478bd9Sstevel@tonic-gate };
6137c478bd9Sstevel@tonic-gate typedef struct nfs_client_id4 nfs_client_id4;
6147c478bd9Sstevel@tonic-gate 
6157c478bd9Sstevel@tonic-gate struct open_owner4 {
6167c478bd9Sstevel@tonic-gate 	clientid4 clientid;
6177c478bd9Sstevel@tonic-gate 	uint_t owner_len;
6187c478bd9Sstevel@tonic-gate 	char *owner_val;
6197c478bd9Sstevel@tonic-gate };
6207c478bd9Sstevel@tonic-gate typedef struct open_owner4 open_owner4;
6217c478bd9Sstevel@tonic-gate 
6227c478bd9Sstevel@tonic-gate struct lock_owner4 {
6237c478bd9Sstevel@tonic-gate 	clientid4 clientid;
6247c478bd9Sstevel@tonic-gate 	uint_t owner_len;
6257c478bd9Sstevel@tonic-gate 	char *owner_val;
6267c478bd9Sstevel@tonic-gate };
6277c478bd9Sstevel@tonic-gate typedef struct lock_owner4 lock_owner4;
6287c478bd9Sstevel@tonic-gate 
6297c478bd9Sstevel@tonic-gate enum nfs_lock_type4 {
6307c478bd9Sstevel@tonic-gate 	READ_LT = 1,
6317c478bd9Sstevel@tonic-gate 	WRITE_LT = 2,
6327c478bd9Sstevel@tonic-gate 	READW_LT = 3,
6337c478bd9Sstevel@tonic-gate 	WRITEW_LT = 4
6347c478bd9Sstevel@tonic-gate };
6357c478bd9Sstevel@tonic-gate typedef enum nfs_lock_type4 nfs_lock_type4;
6367c478bd9Sstevel@tonic-gate #define	ACCESS4_READ 0x00000001
6377c478bd9Sstevel@tonic-gate #define	ACCESS4_LOOKUP 0x00000002
6387c478bd9Sstevel@tonic-gate #define	ACCESS4_MODIFY 0x00000004
6397c478bd9Sstevel@tonic-gate #define	ACCESS4_EXTEND 0x00000008
6407c478bd9Sstevel@tonic-gate #define	ACCESS4_DELETE 0x00000010
6417c478bd9Sstevel@tonic-gate #define	ACCESS4_EXECUTE 0x00000020
6427c478bd9Sstevel@tonic-gate 
6437c478bd9Sstevel@tonic-gate struct ACCESS4args {
6447c478bd9Sstevel@tonic-gate 	uint32_t access;
6457c478bd9Sstevel@tonic-gate };
6467c478bd9Sstevel@tonic-gate typedef struct ACCESS4args ACCESS4args;
6477c478bd9Sstevel@tonic-gate 
6487c478bd9Sstevel@tonic-gate struct ACCESS4res {
6497c478bd9Sstevel@tonic-gate 	nfsstat4 status;
6507c478bd9Sstevel@tonic-gate 	uint32_t supported;
6517c478bd9Sstevel@tonic-gate 	uint32_t access;
6527c478bd9Sstevel@tonic-gate };
6537c478bd9Sstevel@tonic-gate typedef struct ACCESS4res ACCESS4res;
6547c478bd9Sstevel@tonic-gate 
6557c478bd9Sstevel@tonic-gate struct CLOSE4args {
6567c478bd9Sstevel@tonic-gate 	seqid4 seqid;
6577c478bd9Sstevel@tonic-gate 	stateid4 open_stateid;
6587c478bd9Sstevel@tonic-gate };
6597c478bd9Sstevel@tonic-gate typedef struct CLOSE4args CLOSE4args;
6607c478bd9Sstevel@tonic-gate 
6617c478bd9Sstevel@tonic-gate struct CLOSE4res {
6627c478bd9Sstevel@tonic-gate 	nfsstat4 status;
6637c478bd9Sstevel@tonic-gate 	stateid4 open_stateid;
6647c478bd9Sstevel@tonic-gate };
6657c478bd9Sstevel@tonic-gate typedef struct CLOSE4res CLOSE4res;
6667c478bd9Sstevel@tonic-gate 
6677c478bd9Sstevel@tonic-gate struct COMMIT4args {
6687c478bd9Sstevel@tonic-gate 	offset4 offset;
6697c478bd9Sstevel@tonic-gate 	count4 count;
6707c478bd9Sstevel@tonic-gate };
6717c478bd9Sstevel@tonic-gate typedef struct COMMIT4args COMMIT4args;
6727c478bd9Sstevel@tonic-gate 
6737c478bd9Sstevel@tonic-gate struct COMMIT4res {
6747c478bd9Sstevel@tonic-gate 	nfsstat4 status;
6757c478bd9Sstevel@tonic-gate 	verifier4 writeverf;
6767c478bd9Sstevel@tonic-gate };
6777c478bd9Sstevel@tonic-gate typedef struct COMMIT4res COMMIT4res;
6787c478bd9Sstevel@tonic-gate 
6797c478bd9Sstevel@tonic-gate struct CREATE4args {
6807c478bd9Sstevel@tonic-gate 	nfs_ftype4 type;
6817c478bd9Sstevel@tonic-gate 	union {
6827c478bd9Sstevel@tonic-gate 		linktext4 linkdata;
6837c478bd9Sstevel@tonic-gate 		specdata4 devdata;
6847c478bd9Sstevel@tonic-gate 	} ftype4_u;
6857c478bd9Sstevel@tonic-gate 	component4 objname;
6867c478bd9Sstevel@tonic-gate 	fattr4 createattrs;
6877c478bd9Sstevel@tonic-gate };
6887c478bd9Sstevel@tonic-gate typedef struct CREATE4args CREATE4args;
6897c478bd9Sstevel@tonic-gate 
6907c478bd9Sstevel@tonic-gate struct CREATE4cargs {
6917c478bd9Sstevel@tonic-gate 	nfs_ftype4 type;
6927c478bd9Sstevel@tonic-gate 	union {
6937c478bd9Sstevel@tonic-gate 		char *clinkdata;
6947c478bd9Sstevel@tonic-gate 		specdata4 devdata;
6957c478bd9Sstevel@tonic-gate 	} ftype4_u;
6967c478bd9Sstevel@tonic-gate 	char *cname;
6977c478bd9Sstevel@tonic-gate 	fattr4 createattrs;
6987c478bd9Sstevel@tonic-gate };
6997c478bd9Sstevel@tonic-gate typedef struct CREATE4cargs CREATE4cargs;
7007c478bd9Sstevel@tonic-gate 
7017c478bd9Sstevel@tonic-gate struct CREATE4res {
7027c478bd9Sstevel@tonic-gate 	nfsstat4 status;
7037c478bd9Sstevel@tonic-gate 	change_info4 cinfo;
7047c478bd9Sstevel@tonic-gate 	bitmap4 attrset;
7057c478bd9Sstevel@tonic-gate };
7067c478bd9Sstevel@tonic-gate typedef struct CREATE4res CREATE4res;
7077c478bd9Sstevel@tonic-gate 
7087c478bd9Sstevel@tonic-gate struct DELEGPURGE4args {
7097c478bd9Sstevel@tonic-gate 	clientid4 clientid;
7107c478bd9Sstevel@tonic-gate };
7117c478bd9Sstevel@tonic-gate typedef struct DELEGPURGE4args DELEGPURGE4args;
7127c478bd9Sstevel@tonic-gate 
7137c478bd9Sstevel@tonic-gate struct DELEGPURGE4res {
7147c478bd9Sstevel@tonic-gate 	nfsstat4 status;
7157c478bd9Sstevel@tonic-gate };
7167c478bd9Sstevel@tonic-gate typedef struct DELEGPURGE4res DELEGPURGE4res;
7177c478bd9Sstevel@tonic-gate 
7187c478bd9Sstevel@tonic-gate struct DELEGRETURN4args {
7197c478bd9Sstevel@tonic-gate 	stateid4 deleg_stateid;
7207c478bd9Sstevel@tonic-gate };
7217c478bd9Sstevel@tonic-gate typedef struct DELEGRETURN4args DELEGRETURN4args;
7227c478bd9Sstevel@tonic-gate 
7237c478bd9Sstevel@tonic-gate struct DELEGRETURN4res {
7247c478bd9Sstevel@tonic-gate 	nfsstat4 status;
7257c478bd9Sstevel@tonic-gate };
7267c478bd9Sstevel@tonic-gate typedef struct DELEGRETURN4res DELEGRETURN4res;
7277c478bd9Sstevel@tonic-gate 
7287c478bd9Sstevel@tonic-gate struct mntinfo4;
7297c478bd9Sstevel@tonic-gate 
7307c478bd9Sstevel@tonic-gate struct GETATTR4args {
7317c478bd9Sstevel@tonic-gate 	bitmap4 attr_request;
7327c478bd9Sstevel@tonic-gate 	struct mntinfo4 *mi;
7337c478bd9Sstevel@tonic-gate };
7347c478bd9Sstevel@tonic-gate typedef struct GETATTR4args GETATTR4args;
7357c478bd9Sstevel@tonic-gate 
7367c478bd9Sstevel@tonic-gate struct nfs4_ga_ext_res;
7377c478bd9Sstevel@tonic-gate 
7387c478bd9Sstevel@tonic-gate struct nfs4_ga_res {
7397c478bd9Sstevel@tonic-gate 	vattr_t				n4g_va;
7407c478bd9Sstevel@tonic-gate 	unsigned			n4g_change_valid:1;
7417c478bd9Sstevel@tonic-gate 	unsigned			n4g_mon_fid_valid:1;
7427c478bd9Sstevel@tonic-gate 	unsigned			n4g_fsid_valid:1;
7437c478bd9Sstevel@tonic-gate 	uint_t				n4g_attrerr;
7447c478bd9Sstevel@tonic-gate 	uint_t				n4g_attrwhy;
7457c478bd9Sstevel@tonic-gate 	bitmap4				n4g_resbmap;
7467c478bd9Sstevel@tonic-gate 	fattr4_change			n4g_change;
7477c478bd9Sstevel@tonic-gate 	fattr4_fsid			n4g_fsid;
7487c478bd9Sstevel@tonic-gate 	fattr4_mounted_on_fileid	n4g_mon_fid;
7497c478bd9Sstevel@tonic-gate 	struct nfs4_ga_ext_res		*n4g_ext_res;
7507c478bd9Sstevel@tonic-gate 	vsecattr_t			n4g_vsa;
7517c478bd9Sstevel@tonic-gate };
7527c478bd9Sstevel@tonic-gate typedef struct nfs4_ga_res nfs4_ga_res_t;
7537c478bd9Sstevel@tonic-gate 
7547c478bd9Sstevel@tonic-gate struct GETATTR4res {
7557c478bd9Sstevel@tonic-gate 	nfsstat4 status;
7567c478bd9Sstevel@tonic-gate 	fattr4 obj_attributes;
7577c478bd9Sstevel@tonic-gate 	nfsstat4	ga_status;
7587c478bd9Sstevel@tonic-gate 	struct nfs4_ga_res ga_res;
7597c478bd9Sstevel@tonic-gate };
7607c478bd9Sstevel@tonic-gate typedef struct GETATTR4res GETATTR4res;
7617c478bd9Sstevel@tonic-gate 
7627c478bd9Sstevel@tonic-gate struct GETFH4res {
7637c478bd9Sstevel@tonic-gate 	nfsstat4 status;
7647c478bd9Sstevel@tonic-gate 	nfs_fh4 object;
7657c478bd9Sstevel@tonic-gate };
7667c478bd9Sstevel@tonic-gate typedef struct GETFH4res GETFH4res;
7677c478bd9Sstevel@tonic-gate 
7687c478bd9Sstevel@tonic-gate struct LINK4args {
7697c478bd9Sstevel@tonic-gate 	component4 newname;
7707c478bd9Sstevel@tonic-gate };
7717c478bd9Sstevel@tonic-gate typedef struct LINK4args LINK4args;
7727c478bd9Sstevel@tonic-gate 
7737c478bd9Sstevel@tonic-gate struct LINK4cargs {
7747c478bd9Sstevel@tonic-gate 	char *cnewname;
7757c478bd9Sstevel@tonic-gate };
7767c478bd9Sstevel@tonic-gate typedef struct LINK4cargs LINK4cargs;
7777c478bd9Sstevel@tonic-gate 
7787c478bd9Sstevel@tonic-gate struct LINK4res {
7797c478bd9Sstevel@tonic-gate 	nfsstat4 status;
7807c478bd9Sstevel@tonic-gate 	change_info4 cinfo;
7817c478bd9Sstevel@tonic-gate };
7827c478bd9Sstevel@tonic-gate typedef struct LINK4res LINK4res;
7837c478bd9Sstevel@tonic-gate 
7847c478bd9Sstevel@tonic-gate struct open_to_lock_owner4 {
7857c478bd9Sstevel@tonic-gate 	seqid4 open_seqid;
7867c478bd9Sstevel@tonic-gate 	stateid4 open_stateid;
7877c478bd9Sstevel@tonic-gate 	seqid4 lock_seqid;
7887c478bd9Sstevel@tonic-gate 	lock_owner4 lock_owner;
7897c478bd9Sstevel@tonic-gate };
7907c478bd9Sstevel@tonic-gate typedef struct open_to_lock_owner4 open_to_lock_owner4;
7917c478bd9Sstevel@tonic-gate 
7927c478bd9Sstevel@tonic-gate struct exist_lock_owner4 {
7937c478bd9Sstevel@tonic-gate 	stateid4 lock_stateid;
7947c478bd9Sstevel@tonic-gate 	seqid4 lock_seqid;
7957c478bd9Sstevel@tonic-gate };
7967c478bd9Sstevel@tonic-gate typedef struct exist_lock_owner4 exist_lock_owner4;
7977c478bd9Sstevel@tonic-gate 
7987c478bd9Sstevel@tonic-gate struct locker4 {
7997c478bd9Sstevel@tonic-gate 	bool_t new_lock_owner;
8007c478bd9Sstevel@tonic-gate 	union {
8017c478bd9Sstevel@tonic-gate 		open_to_lock_owner4 open_owner;
8027c478bd9Sstevel@tonic-gate 		exist_lock_owner4 lock_owner;
8037c478bd9Sstevel@tonic-gate 	} locker4_u;
8047c478bd9Sstevel@tonic-gate };
8057c478bd9Sstevel@tonic-gate typedef struct locker4 locker4;
8067c478bd9Sstevel@tonic-gate 
8077c478bd9Sstevel@tonic-gate struct LOCK4args {
8087c478bd9Sstevel@tonic-gate 	nfs_lock_type4 locktype;
8097c478bd9Sstevel@tonic-gate 	bool_t reclaim;
8107c478bd9Sstevel@tonic-gate 	offset4 offset;
8117c478bd9Sstevel@tonic-gate 	length4 length;
8127c478bd9Sstevel@tonic-gate 	locker4 locker;
8137c478bd9Sstevel@tonic-gate };
8147c478bd9Sstevel@tonic-gate typedef struct LOCK4args LOCK4args;
8157c478bd9Sstevel@tonic-gate 
8167c478bd9Sstevel@tonic-gate struct LOCK4denied {
8177c478bd9Sstevel@tonic-gate 	offset4 offset;
8187c478bd9Sstevel@tonic-gate 	length4 length;
8197c478bd9Sstevel@tonic-gate 	nfs_lock_type4 locktype;
8207c478bd9Sstevel@tonic-gate 	lock_owner4 owner;
8217c478bd9Sstevel@tonic-gate };
8227c478bd9Sstevel@tonic-gate typedef struct LOCK4denied LOCK4denied;
8237c478bd9Sstevel@tonic-gate 
8247c478bd9Sstevel@tonic-gate struct LOCK4res {
8257c478bd9Sstevel@tonic-gate 	nfsstat4 status;
8267c478bd9Sstevel@tonic-gate 	union {
8277c478bd9Sstevel@tonic-gate 		stateid4 lock_stateid;
8287c478bd9Sstevel@tonic-gate 		LOCK4denied denied;
8297c478bd9Sstevel@tonic-gate 	} LOCK4res_u;
8307c478bd9Sstevel@tonic-gate };
8317c478bd9Sstevel@tonic-gate typedef struct LOCK4res LOCK4res;
8327c478bd9Sstevel@tonic-gate 
8337c478bd9Sstevel@tonic-gate struct LOCKT4args {
8347c478bd9Sstevel@tonic-gate 	nfs_lock_type4 locktype;
8357c478bd9Sstevel@tonic-gate 	offset4 offset;
8367c478bd9Sstevel@tonic-gate 	length4 length;
8377c478bd9Sstevel@tonic-gate 	lock_owner4 owner;
8387c478bd9Sstevel@tonic-gate };
8397c478bd9Sstevel@tonic-gate typedef struct LOCKT4args LOCKT4args;
8407c478bd9Sstevel@tonic-gate 
8417c478bd9Sstevel@tonic-gate struct LOCKT4res {
8427c478bd9Sstevel@tonic-gate 	nfsstat4 status;
8437c478bd9Sstevel@tonic-gate 	LOCK4denied denied;
8447c478bd9Sstevel@tonic-gate };
8457c478bd9Sstevel@tonic-gate typedef struct LOCKT4res LOCKT4res;
8467c478bd9Sstevel@tonic-gate 
8477c478bd9Sstevel@tonic-gate struct LOCKU4args {
8487c478bd9Sstevel@tonic-gate 	nfs_lock_type4 locktype;
8497c478bd9Sstevel@tonic-gate 	seqid4 seqid;
8507c478bd9Sstevel@tonic-gate 	stateid4 lock_stateid;
8517c478bd9Sstevel@tonic-gate 	offset4 offset;
8527c478bd9Sstevel@tonic-gate 	length4 length;
8537c478bd9Sstevel@tonic-gate };
8547c478bd9Sstevel@tonic-gate typedef struct LOCKU4args LOCKU4args;
8557c478bd9Sstevel@tonic-gate 
8567c478bd9Sstevel@tonic-gate struct LOCKU4res {
8577c478bd9Sstevel@tonic-gate 	nfsstat4 status;
8587c478bd9Sstevel@tonic-gate 	stateid4 lock_stateid;
8597c478bd9Sstevel@tonic-gate };
8607c478bd9Sstevel@tonic-gate typedef struct LOCKU4res LOCKU4res;
8617c478bd9Sstevel@tonic-gate 
8627c478bd9Sstevel@tonic-gate struct LOOKUP4args {
8637c478bd9Sstevel@tonic-gate 	component4 objname;
8647c478bd9Sstevel@tonic-gate };
8657c478bd9Sstevel@tonic-gate typedef struct LOOKUP4args LOOKUP4args;
8667c478bd9Sstevel@tonic-gate 
8677c478bd9Sstevel@tonic-gate struct LOOKUP4cargs {
8687c478bd9Sstevel@tonic-gate 	char *cname;
8697c478bd9Sstevel@tonic-gate };
8707c478bd9Sstevel@tonic-gate typedef struct LOOKUP4cargs LOOKUP4cargs;
8717c478bd9Sstevel@tonic-gate 
8727c478bd9Sstevel@tonic-gate struct LOOKUP4res {
8737c478bd9Sstevel@tonic-gate 	nfsstat4 status;
8747c478bd9Sstevel@tonic-gate };
8757c478bd9Sstevel@tonic-gate typedef struct LOOKUP4res LOOKUP4res;
8767c478bd9Sstevel@tonic-gate 
8777c478bd9Sstevel@tonic-gate struct LOOKUPP4res {
8787c478bd9Sstevel@tonic-gate 	nfsstat4 status;
8797c478bd9Sstevel@tonic-gate };
8807c478bd9Sstevel@tonic-gate typedef struct LOOKUPP4res LOOKUPP4res;
8817c478bd9Sstevel@tonic-gate 
8827c478bd9Sstevel@tonic-gate struct NVERIFY4args {
8837c478bd9Sstevel@tonic-gate 	fattr4 obj_attributes;
8847c478bd9Sstevel@tonic-gate };
8857c478bd9Sstevel@tonic-gate typedef struct NVERIFY4args NVERIFY4args;
8867c478bd9Sstevel@tonic-gate 
8877c478bd9Sstevel@tonic-gate struct NVERIFY4res {
8887c478bd9Sstevel@tonic-gate 	nfsstat4 status;
8897c478bd9Sstevel@tonic-gate };
8907c478bd9Sstevel@tonic-gate typedef struct NVERIFY4res NVERIFY4res;
8917c478bd9Sstevel@tonic-gate 
8927c478bd9Sstevel@tonic-gate enum createmode4 {
8937c478bd9Sstevel@tonic-gate 	UNCHECKED4 = 0,
8947c478bd9Sstevel@tonic-gate 	GUARDED4 = 1,
8957c478bd9Sstevel@tonic-gate 	EXCLUSIVE4 = 2
8967c478bd9Sstevel@tonic-gate };
8977c478bd9Sstevel@tonic-gate typedef enum createmode4 createmode4;
8987c478bd9Sstevel@tonic-gate 
8997c478bd9Sstevel@tonic-gate enum opentype4 {
9007c478bd9Sstevel@tonic-gate 	OPEN4_NOCREATE = 0,
9017c478bd9Sstevel@tonic-gate 	OPEN4_CREATE = 1
9027c478bd9Sstevel@tonic-gate };
9037c478bd9Sstevel@tonic-gate typedef enum opentype4 opentype4;
9047c478bd9Sstevel@tonic-gate 
9057c478bd9Sstevel@tonic-gate enum limit_by4 {
9067c478bd9Sstevel@tonic-gate 	NFS_LIMIT_SIZE = 1,
9077c478bd9Sstevel@tonic-gate 	NFS_LIMIT_BLOCKS = 2
9087c478bd9Sstevel@tonic-gate };
9097c478bd9Sstevel@tonic-gate typedef enum limit_by4 limit_by4;
9107c478bd9Sstevel@tonic-gate 
9117c478bd9Sstevel@tonic-gate struct nfs_modified_limit4 {
9127c478bd9Sstevel@tonic-gate 	uint32_t num_blocks;
9137c478bd9Sstevel@tonic-gate 	uint32_t bytes_per_block;
9147c478bd9Sstevel@tonic-gate };
9157c478bd9Sstevel@tonic-gate typedef struct nfs_modified_limit4 nfs_modified_limit4;
9167c478bd9Sstevel@tonic-gate 
9177c478bd9Sstevel@tonic-gate struct nfs_space_limit4 {
9187c478bd9Sstevel@tonic-gate 	limit_by4 limitby;
9197c478bd9Sstevel@tonic-gate 	union {
9207c478bd9Sstevel@tonic-gate 		uint64_t filesize;
9217c478bd9Sstevel@tonic-gate 		nfs_modified_limit4 mod_blocks;
9227c478bd9Sstevel@tonic-gate 	} nfs_space_limit4_u;
9237c478bd9Sstevel@tonic-gate };
9247c478bd9Sstevel@tonic-gate typedef struct nfs_space_limit4 nfs_space_limit4;
9257c478bd9Sstevel@tonic-gate #define	OPEN4_SHARE_ACCESS_READ 0x00000001
9267c478bd9Sstevel@tonic-gate #define	OPEN4_SHARE_ACCESS_WRITE 0x00000002
9277c478bd9Sstevel@tonic-gate #define	OPEN4_SHARE_ACCESS_BOTH 0x00000003
9287c478bd9Sstevel@tonic-gate #define	OPEN4_SHARE_DENY_NONE 0x00000000
9297c478bd9Sstevel@tonic-gate #define	OPEN4_SHARE_DENY_READ 0x00000001
9307c478bd9Sstevel@tonic-gate #define	OPEN4_SHARE_DENY_WRITE 0x00000002
9317c478bd9Sstevel@tonic-gate #define	OPEN4_SHARE_DENY_BOTH 0x00000003
9327c478bd9Sstevel@tonic-gate 
9337c478bd9Sstevel@tonic-gate enum open_delegation_type4 {
9347c478bd9Sstevel@tonic-gate 	OPEN_DELEGATE_NONE = 0,
9357c478bd9Sstevel@tonic-gate 	OPEN_DELEGATE_READ = 1,
9367c478bd9Sstevel@tonic-gate 	OPEN_DELEGATE_WRITE = 2
9377c478bd9Sstevel@tonic-gate };
9387c478bd9Sstevel@tonic-gate typedef enum open_delegation_type4 open_delegation_type4;
9397c478bd9Sstevel@tonic-gate 
9407c478bd9Sstevel@tonic-gate enum open_claim_type4 {
9417c478bd9Sstevel@tonic-gate 	CLAIM_NULL = 0,
9427c478bd9Sstevel@tonic-gate 	CLAIM_PREVIOUS = 1,
9437c478bd9Sstevel@tonic-gate 	CLAIM_DELEGATE_CUR = 2,
9447c478bd9Sstevel@tonic-gate 	CLAIM_DELEGATE_PREV = 3
9457c478bd9Sstevel@tonic-gate };
9467c478bd9Sstevel@tonic-gate typedef enum open_claim_type4 open_claim_type4;
9477c478bd9Sstevel@tonic-gate 
9487c478bd9Sstevel@tonic-gate struct open_claim_delegate_cur4 {
9497c478bd9Sstevel@tonic-gate 	stateid4 delegate_stateid;
9507c478bd9Sstevel@tonic-gate 	component4 file;
9517c478bd9Sstevel@tonic-gate };
9527c478bd9Sstevel@tonic-gate typedef struct open_claim_delegate_cur4 open_claim_delegate_cur4;
9537c478bd9Sstevel@tonic-gate 
9547c478bd9Sstevel@tonic-gate struct copen_claim_delegate_cur4 {
9557c478bd9Sstevel@tonic-gate 	stateid4 delegate_stateid;
9567c478bd9Sstevel@tonic-gate 	char *cfile;
9577c478bd9Sstevel@tonic-gate };
9587c478bd9Sstevel@tonic-gate typedef struct copen_claim_delegate_cur4 copen_claim_delegate_cur4;
9597c478bd9Sstevel@tonic-gate 
9607c478bd9Sstevel@tonic-gate struct OPEN4args {
9617c478bd9Sstevel@tonic-gate 	seqid4 seqid;
9627c478bd9Sstevel@tonic-gate 	uint32_t share_access;
9637c478bd9Sstevel@tonic-gate 	uint32_t share_deny;
9647c478bd9Sstevel@tonic-gate 	open_owner4 owner;
9657c478bd9Sstevel@tonic-gate 	opentype4 opentype;
9667c478bd9Sstevel@tonic-gate 	createmode4 mode;
9677c478bd9Sstevel@tonic-gate 	union {
9687c478bd9Sstevel@tonic-gate 		fattr4 createattrs;
9697c478bd9Sstevel@tonic-gate 		verifier4 createverf;
9707c478bd9Sstevel@tonic-gate 	} createhow4_u;
9717c478bd9Sstevel@tonic-gate 	open_claim_type4 claim;
9727c478bd9Sstevel@tonic-gate 	union {
9737c478bd9Sstevel@tonic-gate 		component4 file;
9747c478bd9Sstevel@tonic-gate 		open_delegation_type4 delegate_type;
9757c478bd9Sstevel@tonic-gate 		open_claim_delegate_cur4 delegate_cur_info;
9767c478bd9Sstevel@tonic-gate 		component4 file_delegate_prev;
9777c478bd9Sstevel@tonic-gate 	} open_claim4_u;
9787c478bd9Sstevel@tonic-gate };
9797c478bd9Sstevel@tonic-gate typedef struct OPEN4args OPEN4args;
9807c478bd9Sstevel@tonic-gate 
9817c478bd9Sstevel@tonic-gate struct OPEN4cargs {
9827c478bd9Sstevel@tonic-gate 	seqid4 seqid;
9837c478bd9Sstevel@tonic-gate 	uint32_t share_access;
9847c478bd9Sstevel@tonic-gate 	uint32_t share_deny;
9857c478bd9Sstevel@tonic-gate 	open_owner4 owner;
9867c478bd9Sstevel@tonic-gate 	opentype4 opentype;
9877c478bd9Sstevel@tonic-gate 	createmode4 mode;
9887c478bd9Sstevel@tonic-gate 	union {
9897c478bd9Sstevel@tonic-gate 		fattr4 createattrs;
9907c478bd9Sstevel@tonic-gate 		verifier4 createverf;
9917c478bd9Sstevel@tonic-gate 	} createhow4_u;
9927c478bd9Sstevel@tonic-gate 	open_claim_type4 claim;
9937c478bd9Sstevel@tonic-gate 	union {
9947c478bd9Sstevel@tonic-gate 		char *cfile;
9957c478bd9Sstevel@tonic-gate 		open_delegation_type4 delegate_type;
9967c478bd9Sstevel@tonic-gate 		copen_claim_delegate_cur4 delegate_cur_info;
9977c478bd9Sstevel@tonic-gate 		char *cfile_delegate_prev;
9987c478bd9Sstevel@tonic-gate 	} open_claim4_u;
9997c478bd9Sstevel@tonic-gate };
10007c478bd9Sstevel@tonic-gate typedef struct OPEN4cargs OPEN4cargs;
10017c478bd9Sstevel@tonic-gate 
10027c478bd9Sstevel@tonic-gate struct open_read_delegation4 {
10037c478bd9Sstevel@tonic-gate 	stateid4 stateid;
10047c478bd9Sstevel@tonic-gate 	bool_t recall;
10057c478bd9Sstevel@tonic-gate 	nfsace4 permissions;
10067c478bd9Sstevel@tonic-gate };
10077c478bd9Sstevel@tonic-gate typedef struct open_read_delegation4 open_read_delegation4;
10087c478bd9Sstevel@tonic-gate 
10097c478bd9Sstevel@tonic-gate struct open_write_delegation4 {
10107c478bd9Sstevel@tonic-gate 	stateid4 stateid;
10117c478bd9Sstevel@tonic-gate 	bool_t recall;
10127c478bd9Sstevel@tonic-gate 	nfs_space_limit4 space_limit;
10137c478bd9Sstevel@tonic-gate 	nfsace4 permissions;
10147c478bd9Sstevel@tonic-gate };
10157c478bd9Sstevel@tonic-gate typedef struct open_write_delegation4 open_write_delegation4;
10167c478bd9Sstevel@tonic-gate 
10177c478bd9Sstevel@tonic-gate struct open_delegation4 {
10187c478bd9Sstevel@tonic-gate 	open_delegation_type4 delegation_type;
10197c478bd9Sstevel@tonic-gate 	union {
10207c478bd9Sstevel@tonic-gate 		open_read_delegation4 read;
10217c478bd9Sstevel@tonic-gate 		open_write_delegation4 write;
10227c478bd9Sstevel@tonic-gate 	} open_delegation4_u;
10237c478bd9Sstevel@tonic-gate };
10247c478bd9Sstevel@tonic-gate typedef struct open_delegation4 open_delegation4;
10257c478bd9Sstevel@tonic-gate #define	OPEN4_RESULT_CONFIRM 0x00000002
10267c478bd9Sstevel@tonic-gate #define	OPEN4_RESULT_LOCKTYPE_POSIX 0x00000004
10277c478bd9Sstevel@tonic-gate 
10287c478bd9Sstevel@tonic-gate struct OPEN4res {
10297c478bd9Sstevel@tonic-gate 	nfsstat4 status;
10307c478bd9Sstevel@tonic-gate 	stateid4 stateid;
10317c478bd9Sstevel@tonic-gate 	change_info4 cinfo;
10327c478bd9Sstevel@tonic-gate 	uint32_t rflags;
10337c478bd9Sstevel@tonic-gate 	bitmap4 attrset;
10347c478bd9Sstevel@tonic-gate 	open_delegation4 delegation;
10357c478bd9Sstevel@tonic-gate };
10367c478bd9Sstevel@tonic-gate typedef struct OPEN4res OPEN4res;
10377c478bd9Sstevel@tonic-gate 
10387c478bd9Sstevel@tonic-gate struct OPENATTR4args {
10397c478bd9Sstevel@tonic-gate 	bool_t createdir;
10407c478bd9Sstevel@tonic-gate };
10417c478bd9Sstevel@tonic-gate typedef struct OPENATTR4args OPENATTR4args;
10427c478bd9Sstevel@tonic-gate 
10437c478bd9Sstevel@tonic-gate struct OPENATTR4res {
10447c478bd9Sstevel@tonic-gate 	nfsstat4 status;
10457c478bd9Sstevel@tonic-gate };
10467c478bd9Sstevel@tonic-gate typedef struct OPENATTR4res OPENATTR4res;
10477c478bd9Sstevel@tonic-gate 
10487c478bd9Sstevel@tonic-gate struct OPEN_CONFIRM4args {
10497c478bd9Sstevel@tonic-gate 	stateid4 open_stateid;
10507c478bd9Sstevel@tonic-gate 	seqid4 seqid;
10517c478bd9Sstevel@tonic-gate };
10527c478bd9Sstevel@tonic-gate typedef struct OPEN_CONFIRM4args OPEN_CONFIRM4args;
10537c478bd9Sstevel@tonic-gate 
10547c478bd9Sstevel@tonic-gate struct OPEN_CONFIRM4res {
10557c478bd9Sstevel@tonic-gate 	nfsstat4 status;
10567c478bd9Sstevel@tonic-gate 	stateid4 open_stateid;
10577c478bd9Sstevel@tonic-gate };
10587c478bd9Sstevel@tonic-gate typedef struct OPEN_CONFIRM4res OPEN_CONFIRM4res;
10597c478bd9Sstevel@tonic-gate 
10607c478bd9Sstevel@tonic-gate struct OPEN_DOWNGRADE4args {
10617c478bd9Sstevel@tonic-gate 	stateid4 open_stateid;
10627c478bd9Sstevel@tonic-gate 	seqid4 seqid;
10637c478bd9Sstevel@tonic-gate 	uint32_t share_access;
10647c478bd9Sstevel@tonic-gate 	uint32_t share_deny;
10657c478bd9Sstevel@tonic-gate };
10667c478bd9Sstevel@tonic-gate typedef struct OPEN_DOWNGRADE4args OPEN_DOWNGRADE4args;
10677c478bd9Sstevel@tonic-gate 
10687c478bd9Sstevel@tonic-gate struct OPEN_DOWNGRADE4res {
10697c478bd9Sstevel@tonic-gate 	nfsstat4 status;
10707c478bd9Sstevel@tonic-gate 	stateid4 open_stateid;
10717c478bd9Sstevel@tonic-gate };
10727c478bd9Sstevel@tonic-gate typedef struct OPEN_DOWNGRADE4res OPEN_DOWNGRADE4res;
10737c478bd9Sstevel@tonic-gate 
10747c478bd9Sstevel@tonic-gate struct PUTFH4args {
10757c478bd9Sstevel@tonic-gate 	nfs_fh4 object;
10767c478bd9Sstevel@tonic-gate };
10777c478bd9Sstevel@tonic-gate typedef struct PUTFH4args PUTFH4args;
10787c478bd9Sstevel@tonic-gate 
10797c478bd9Sstevel@tonic-gate /*
10807c478bd9Sstevel@tonic-gate  * Client only side PUTFH arguments
10817c478bd9Sstevel@tonic-gate  * This is really a nfs4_sharedfh_t * but the forward declaration
10827c478bd9Sstevel@tonic-gate  * is problematic;
10837c478bd9Sstevel@tonic-gate  */
10847c478bd9Sstevel@tonic-gate struct PUTFH4cargs {
10857c478bd9Sstevel@tonic-gate 	void *sfh;
10867c478bd9Sstevel@tonic-gate };
10877c478bd9Sstevel@tonic-gate typedef struct PUTFH4cargs PUTFH4cargs;
10887c478bd9Sstevel@tonic-gate 
10897c478bd9Sstevel@tonic-gate struct PUTFH4res {
10907c478bd9Sstevel@tonic-gate 	nfsstat4 status;
10917c478bd9Sstevel@tonic-gate };
10927c478bd9Sstevel@tonic-gate typedef struct PUTFH4res PUTFH4res;
10937c478bd9Sstevel@tonic-gate 
10947c478bd9Sstevel@tonic-gate struct PUTPUBFH4res {
10957c478bd9Sstevel@tonic-gate 	nfsstat4 status;
10967c478bd9Sstevel@tonic-gate };
10977c478bd9Sstevel@tonic-gate typedef struct PUTPUBFH4res PUTPUBFH4res;
10987c478bd9Sstevel@tonic-gate 
10997c478bd9Sstevel@tonic-gate struct PUTROOTFH4res {
11007c478bd9Sstevel@tonic-gate 	nfsstat4 status;
11017c478bd9Sstevel@tonic-gate };
11027c478bd9Sstevel@tonic-gate typedef struct PUTROOTFH4res PUTROOTFH4res;
11037c478bd9Sstevel@tonic-gate 
11047c478bd9Sstevel@tonic-gate struct READ4args {
11057c478bd9Sstevel@tonic-gate 	stateid4 stateid;
11067c478bd9Sstevel@tonic-gate 	offset4 offset;
11077c478bd9Sstevel@tonic-gate 	count4 count;
11087c478bd9Sstevel@tonic-gate 	/* The following are used for the XDR decode path */
11097c478bd9Sstevel@tonic-gate 	char *res_data_val_alt;
11107c478bd9Sstevel@tonic-gate 	mblk_t *res_mblk;
11117c478bd9Sstevel@tonic-gate 	struct uio *res_uiop;
11127c478bd9Sstevel@tonic-gate 	uint_t res_maxsize;
11130a701b1eSRobert Gordon #ifdef _KERNEL
11140a701b1eSRobert Gordon 	struct clist *wlist;
11150a701b1eSRobert Gordon 	CONN *conn;
11160a701b1eSRobert Gordon #endif
11177c478bd9Sstevel@tonic-gate };
11187c478bd9Sstevel@tonic-gate typedef struct READ4args READ4args;
11197c478bd9Sstevel@tonic-gate 
11207c478bd9Sstevel@tonic-gate struct READ4res {
11217c478bd9Sstevel@tonic-gate 	nfsstat4 status;
11227c478bd9Sstevel@tonic-gate 	bool_t eof;
11237c478bd9Sstevel@tonic-gate 	uint_t data_len;
11247c478bd9Sstevel@tonic-gate 	char *data_val;
11257c478bd9Sstevel@tonic-gate 	mblk_t *mblk;
11260a701b1eSRobert Gordon #ifdef _KERNEL
11270a701b1eSRobert Gordon 	struct clist *wlist;
11280a701b1eSRobert Gordon 	uint_t wlist_len;
11290a701b1eSRobert Gordon #endif
11307c478bd9Sstevel@tonic-gate };
11317c478bd9Sstevel@tonic-gate typedef struct READ4res READ4res;
11327c478bd9Sstevel@tonic-gate 
11337c478bd9Sstevel@tonic-gate struct rddir4_cache;
11347c478bd9Sstevel@tonic-gate 
11357c478bd9Sstevel@tonic-gate struct READDIR4args {
11367c478bd9Sstevel@tonic-gate 	nfs_cookie4 cookie;
11377c478bd9Sstevel@tonic-gate 	verifier4 cookieverf;
11387c478bd9Sstevel@tonic-gate 	count4 dircount;
11397c478bd9Sstevel@tonic-gate 	count4 maxcount;
11407c478bd9Sstevel@tonic-gate 	bitmap4 attr_request;
11417c478bd9Sstevel@tonic-gate 	vnode_t *dvp;
11427c478bd9Sstevel@tonic-gate 	struct mntinfo4 *mi;
11437c478bd9Sstevel@tonic-gate 	cred_t *cr;
11447c478bd9Sstevel@tonic-gate 	struct rddir4_cache *rdc;
11457c478bd9Sstevel@tonic-gate 	hrtime_t t;
11467c478bd9Sstevel@tonic-gate };
11477c478bd9Sstevel@tonic-gate typedef struct READDIR4args READDIR4args;
11487c478bd9Sstevel@tonic-gate 
11497c478bd9Sstevel@tonic-gate struct READDIR4res_clnt {
11507c478bd9Sstevel@tonic-gate 	nfsstat4 status;
11517c478bd9Sstevel@tonic-gate 	verifier4 cookieverf;
11527c478bd9Sstevel@tonic-gate 	bool_t eof;
11537c478bd9Sstevel@tonic-gate 	struct dirent64 *dotp, *dotdotp;
11547c478bd9Sstevel@tonic-gate 	struct rddir4_cache *rdc;
11557c478bd9Sstevel@tonic-gate };
11567c478bd9Sstevel@tonic-gate typedef struct READDIR4res_clnt READDIR4res_clnt;
11577c478bd9Sstevel@tonic-gate 
11587c478bd9Sstevel@tonic-gate struct READDIR4res {
11597c478bd9Sstevel@tonic-gate 	nfsstat4 status;
11607c478bd9Sstevel@tonic-gate 	verifier4 cookieverf;
11617c478bd9Sstevel@tonic-gate 	mblk_t *mblk;
11627c478bd9Sstevel@tonic-gate 	uint_t data_len;
11637c478bd9Sstevel@tonic-gate };
11647c478bd9Sstevel@tonic-gate typedef struct READDIR4res READDIR4res;
11657c478bd9Sstevel@tonic-gate 
11667c478bd9Sstevel@tonic-gate struct READLINK4res {
11677c478bd9Sstevel@tonic-gate 	nfsstat4 status;
11687c478bd9Sstevel@tonic-gate 	linktext4 link;
11697c478bd9Sstevel@tonic-gate };
11707c478bd9Sstevel@tonic-gate typedef struct READLINK4res READLINK4res;
11717c478bd9Sstevel@tonic-gate 
11727c478bd9Sstevel@tonic-gate struct REMOVE4args {
11737c478bd9Sstevel@tonic-gate 	component4 target;
11747c478bd9Sstevel@tonic-gate };
11757c478bd9Sstevel@tonic-gate typedef struct REMOVE4args REMOVE4args;
11767c478bd9Sstevel@tonic-gate 
11777c478bd9Sstevel@tonic-gate struct REMOVE4cargs {
11787c478bd9Sstevel@tonic-gate 	char *ctarget;
11797c478bd9Sstevel@tonic-gate };
11807c478bd9Sstevel@tonic-gate typedef struct REMOVE4cargs REMOVE4cargs;
11817c478bd9Sstevel@tonic-gate 
11827c478bd9Sstevel@tonic-gate struct REMOVE4res {
11837c478bd9Sstevel@tonic-gate 	nfsstat4 status;
11847c478bd9Sstevel@tonic-gate 	change_info4 cinfo;
11857c478bd9Sstevel@tonic-gate };
11867c478bd9Sstevel@tonic-gate typedef struct REMOVE4res REMOVE4res;
11877c478bd9Sstevel@tonic-gate 
11887c478bd9Sstevel@tonic-gate struct RENAME4args {
11897c478bd9Sstevel@tonic-gate 	component4 oldname;
11907c478bd9Sstevel@tonic-gate 	component4 newname;
11917c478bd9Sstevel@tonic-gate };
11927c478bd9Sstevel@tonic-gate typedef struct RENAME4args RENAME4args;
11937c478bd9Sstevel@tonic-gate 
11947c478bd9Sstevel@tonic-gate struct RENAME4cargs {
11957c478bd9Sstevel@tonic-gate 	char *coldname;
11967c478bd9Sstevel@tonic-gate 	char *cnewname;
11977c478bd9Sstevel@tonic-gate };
11987c478bd9Sstevel@tonic-gate typedef struct RENAME4cargs RENAME4cargs;
11997c478bd9Sstevel@tonic-gate 
12007c478bd9Sstevel@tonic-gate struct RENAME4res {
12017c478bd9Sstevel@tonic-gate 	nfsstat4 status;
12027c478bd9Sstevel@tonic-gate 	change_info4 source_cinfo;
12037c478bd9Sstevel@tonic-gate 	change_info4 target_cinfo;
12047c478bd9Sstevel@tonic-gate };
12057c478bd9Sstevel@tonic-gate typedef struct RENAME4res RENAME4res;
12067c478bd9Sstevel@tonic-gate 
12077c478bd9Sstevel@tonic-gate struct RENEW4args {
12087c478bd9Sstevel@tonic-gate 	clientid4 clientid;
12097c478bd9Sstevel@tonic-gate };
12107c478bd9Sstevel@tonic-gate typedef struct RENEW4args RENEW4args;
12117c478bd9Sstevel@tonic-gate 
12127c478bd9Sstevel@tonic-gate struct RENEW4res {
12137c478bd9Sstevel@tonic-gate 	nfsstat4 status;
12147c478bd9Sstevel@tonic-gate };
12157c478bd9Sstevel@tonic-gate typedef struct RENEW4res RENEW4res;
12167c478bd9Sstevel@tonic-gate 
12177c478bd9Sstevel@tonic-gate struct RESTOREFH4res {
12187c478bd9Sstevel@tonic-gate 	nfsstat4 status;
12197c478bd9Sstevel@tonic-gate };
12207c478bd9Sstevel@tonic-gate typedef struct RESTOREFH4res RESTOREFH4res;
12217c478bd9Sstevel@tonic-gate 
12227c478bd9Sstevel@tonic-gate struct SAVEFH4res {
12237c478bd9Sstevel@tonic-gate 	nfsstat4 status;
12247c478bd9Sstevel@tonic-gate };
12257c478bd9Sstevel@tonic-gate typedef struct SAVEFH4res SAVEFH4res;
12267c478bd9Sstevel@tonic-gate 
12277c478bd9Sstevel@tonic-gate struct SECINFO4args {
12287c478bd9Sstevel@tonic-gate 	component4 name;
12297c478bd9Sstevel@tonic-gate };
12307c478bd9Sstevel@tonic-gate typedef struct SECINFO4args SECINFO4args;
12317c478bd9Sstevel@tonic-gate 
12327c478bd9Sstevel@tonic-gate struct SECINFO4cargs {
12337c478bd9Sstevel@tonic-gate 	char *cname;
12347c478bd9Sstevel@tonic-gate };
12357c478bd9Sstevel@tonic-gate typedef struct SECINFO4cargs SECINFO4cargs;
12367c478bd9Sstevel@tonic-gate 
12377c478bd9Sstevel@tonic-gate enum rpc_gss_svc_t {
12387c478bd9Sstevel@tonic-gate 	RPC_GSS_SVC_NONE = 1,
12397c478bd9Sstevel@tonic-gate 	RPC_GSS_SVC_INTEGRITY = 2,
12407c478bd9Sstevel@tonic-gate 	RPC_GSS_SVC_PRIVACY = 3
12417c478bd9Sstevel@tonic-gate };
12427c478bd9Sstevel@tonic-gate typedef enum rpc_gss_svc_t rpc_gss_svc_t;
12437c478bd9Sstevel@tonic-gate 
12447c478bd9Sstevel@tonic-gate struct rpcsec_gss_info {
12457c478bd9Sstevel@tonic-gate 	sec_oid4 oid;
12467c478bd9Sstevel@tonic-gate 	qop4 qop;
12477c478bd9Sstevel@tonic-gate 	rpc_gss_svc_t service;
12487c478bd9Sstevel@tonic-gate };
12497c478bd9Sstevel@tonic-gate typedef struct rpcsec_gss_info rpcsec_gss_info;
12507c478bd9Sstevel@tonic-gate 
12517c478bd9Sstevel@tonic-gate struct secinfo4 {
12527c478bd9Sstevel@tonic-gate 	uint32_t flavor;
12537c478bd9Sstevel@tonic-gate 	rpcsec_gss_info flavor_info;
12547c478bd9Sstevel@tonic-gate };
12557c478bd9Sstevel@tonic-gate typedef struct secinfo4 secinfo4;
12567c478bd9Sstevel@tonic-gate 
12577c478bd9Sstevel@tonic-gate struct SECINFO4res {
12587c478bd9Sstevel@tonic-gate 	nfsstat4 status;
12597c478bd9Sstevel@tonic-gate 	uint_t SECINFO4resok_len;
12607c478bd9Sstevel@tonic-gate 	secinfo4 *SECINFO4resok_val;
12617c478bd9Sstevel@tonic-gate };
12627c478bd9Sstevel@tonic-gate typedef struct SECINFO4res SECINFO4res;
12637c478bd9Sstevel@tonic-gate 
12647c478bd9Sstevel@tonic-gate struct SETATTR4args {
12657c478bd9Sstevel@tonic-gate 	stateid4 stateid;
12667c478bd9Sstevel@tonic-gate 	fattr4 obj_attributes;
12677c478bd9Sstevel@tonic-gate };
12687c478bd9Sstevel@tonic-gate typedef struct SETATTR4args SETATTR4args;
12697c478bd9Sstevel@tonic-gate 
12707c478bd9Sstevel@tonic-gate struct SETATTR4res {
12717c478bd9Sstevel@tonic-gate 	nfsstat4 status;
12727c478bd9Sstevel@tonic-gate 	bitmap4 attrsset;
12737c478bd9Sstevel@tonic-gate };
12747c478bd9Sstevel@tonic-gate typedef struct SETATTR4res SETATTR4res;
12757c478bd9Sstevel@tonic-gate 
12767c478bd9Sstevel@tonic-gate struct SETCLIENTID4args {
12777c478bd9Sstevel@tonic-gate 	nfs_client_id4 client;
12787c478bd9Sstevel@tonic-gate 	cb_client4 callback;
12797c478bd9Sstevel@tonic-gate 	uint32_t callback_ident;
12807c478bd9Sstevel@tonic-gate };
12817c478bd9Sstevel@tonic-gate typedef struct SETCLIENTID4args SETCLIENTID4args;
12827c478bd9Sstevel@tonic-gate 
12837c478bd9Sstevel@tonic-gate struct SETCLIENTID4resok {
12847c478bd9Sstevel@tonic-gate 	clientid4 clientid;
12857c478bd9Sstevel@tonic-gate 	verifier4 setclientid_confirm;
12867c478bd9Sstevel@tonic-gate };
12877c478bd9Sstevel@tonic-gate typedef struct SETCLIENTID4resok SETCLIENTID4resok;
12887c478bd9Sstevel@tonic-gate 
12897c478bd9Sstevel@tonic-gate struct SETCLIENTID4res {
12907c478bd9Sstevel@tonic-gate 	nfsstat4 status;
12917c478bd9Sstevel@tonic-gate 	union {
12927c478bd9Sstevel@tonic-gate 		SETCLIENTID4resok resok4;
12937c478bd9Sstevel@tonic-gate 		clientaddr4 client_using;
12947c478bd9Sstevel@tonic-gate 	} SETCLIENTID4res_u;
12957c478bd9Sstevel@tonic-gate };
12967c478bd9Sstevel@tonic-gate typedef struct SETCLIENTID4res SETCLIENTID4res;
12977c478bd9Sstevel@tonic-gate 
12987c478bd9Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4args {
12997c478bd9Sstevel@tonic-gate 	clientid4 clientid;
13007c478bd9Sstevel@tonic-gate 	verifier4 setclientid_confirm;
13017c478bd9Sstevel@tonic-gate };
13027c478bd9Sstevel@tonic-gate typedef struct SETCLIENTID_CONFIRM4args SETCLIENTID_CONFIRM4args;
13037c478bd9Sstevel@tonic-gate 
13047c478bd9Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4res {
13057c478bd9Sstevel@tonic-gate 	nfsstat4 status;
13067c478bd9Sstevel@tonic-gate };
13077c478bd9Sstevel@tonic-gate typedef struct SETCLIENTID_CONFIRM4res SETCLIENTID_CONFIRM4res;
13087c478bd9Sstevel@tonic-gate 
13097c478bd9Sstevel@tonic-gate struct VERIFY4args {
13107c478bd9Sstevel@tonic-gate 	fattr4 obj_attributes;
13117c478bd9Sstevel@tonic-gate };
13127c478bd9Sstevel@tonic-gate typedef struct VERIFY4args VERIFY4args;
13137c478bd9Sstevel@tonic-gate 
13147c478bd9Sstevel@tonic-gate struct VERIFY4res {
13157c478bd9Sstevel@tonic-gate 	nfsstat4 status;
13167c478bd9Sstevel@tonic-gate };
13177c478bd9Sstevel@tonic-gate typedef struct VERIFY4res VERIFY4res;
13187c478bd9Sstevel@tonic-gate 
13197c478bd9Sstevel@tonic-gate enum stable_how4 {
13207c478bd9Sstevel@tonic-gate 	UNSTABLE4 = 0,
13217c478bd9Sstevel@tonic-gate 	DATA_SYNC4 = 1,
13227c478bd9Sstevel@tonic-gate 	FILE_SYNC4 = 2
13237c478bd9Sstevel@tonic-gate };
13247c478bd9Sstevel@tonic-gate typedef enum stable_how4 stable_how4;
13257c478bd9Sstevel@tonic-gate 
13267c478bd9Sstevel@tonic-gate /*
13277c478bd9Sstevel@tonic-gate  * mblk doesn't go over the wire.  If non-NULL, it points to an mblk chain
13287c478bd9Sstevel@tonic-gate  * for the write data.
13297c478bd9Sstevel@tonic-gate  */
13307c478bd9Sstevel@tonic-gate 
13317c478bd9Sstevel@tonic-gate struct WRITE4args {
13327c478bd9Sstevel@tonic-gate 	stateid4 stateid;
13337c478bd9Sstevel@tonic-gate 	offset4 offset;
13347c478bd9Sstevel@tonic-gate 	stable_how4 stable;
13357c478bd9Sstevel@tonic-gate 	uint_t data_len;
13367c478bd9Sstevel@tonic-gate 	char *data_val;
13377c478bd9Sstevel@tonic-gate 	mblk_t *mblk;
13380a701b1eSRobert Gordon #ifdef _KERNEL
13390a701b1eSRobert Gordon 	struct clist *rlist;
13400a701b1eSRobert Gordon 	CONN *conn;
13410a701b1eSRobert Gordon #endif
13427c478bd9Sstevel@tonic-gate };
13437c478bd9Sstevel@tonic-gate typedef struct WRITE4args WRITE4args;
13447c478bd9Sstevel@tonic-gate 
13457c478bd9Sstevel@tonic-gate struct WRITE4res {
13467c478bd9Sstevel@tonic-gate 	nfsstat4 status;
13477c478bd9Sstevel@tonic-gate 	count4 count;
13487c478bd9Sstevel@tonic-gate 	stable_how4 committed;
13497c478bd9Sstevel@tonic-gate 	verifier4 writeverf;
13507c478bd9Sstevel@tonic-gate };
13517c478bd9Sstevel@tonic-gate typedef struct WRITE4res WRITE4res;
13527c478bd9Sstevel@tonic-gate 
13537c478bd9Sstevel@tonic-gate struct RELEASE_LOCKOWNER4args {
13547c478bd9Sstevel@tonic-gate 	lock_owner4 lock_owner;
13557c478bd9Sstevel@tonic-gate };
13567c478bd9Sstevel@tonic-gate typedef struct RELEASE_LOCKOWNER4args RELEASE_LOCKOWNER4args;
13577c478bd9Sstevel@tonic-gate 
13587c478bd9Sstevel@tonic-gate struct RELEASE_LOCKOWNER4res {
13597c478bd9Sstevel@tonic-gate 	nfsstat4 status;
13607c478bd9Sstevel@tonic-gate };
13617c478bd9Sstevel@tonic-gate typedef struct RELEASE_LOCKOWNER4res RELEASE_LOCKOWNER4res;
13627c478bd9Sstevel@tonic-gate 
13637c478bd9Sstevel@tonic-gate struct ILLEGAL4res {
13647c478bd9Sstevel@tonic-gate 	nfsstat4 status;
13657c478bd9Sstevel@tonic-gate };
13667c478bd9Sstevel@tonic-gate typedef struct ILLEGAL4res ILLEGAL4res;
13677c478bd9Sstevel@tonic-gate 
13687c478bd9Sstevel@tonic-gate enum nfs_opnum4 {
13697c478bd9Sstevel@tonic-gate 	OP_ACCESS = 3,
13707c478bd9Sstevel@tonic-gate 	OP_CLOSE = 4,
13717c478bd9Sstevel@tonic-gate 	OP_COMMIT = 5,
13727c478bd9Sstevel@tonic-gate 	OP_CREATE = 6,
13737c478bd9Sstevel@tonic-gate 	OP_DELEGPURGE = 7,
13747c478bd9Sstevel@tonic-gate 	OP_DELEGRETURN = 8,
13757c478bd9Sstevel@tonic-gate 	OP_GETATTR = 9,
13767c478bd9Sstevel@tonic-gate 	OP_GETFH = 10,
13777c478bd9Sstevel@tonic-gate 	OP_LINK = 11,
13787c478bd9Sstevel@tonic-gate 	OP_LOCK = 12,
13797c478bd9Sstevel@tonic-gate 	OP_LOCKT = 13,
13807c478bd9Sstevel@tonic-gate 	OP_LOCKU = 14,
13817c478bd9Sstevel@tonic-gate 	OP_LOOKUP = 15,
13827c478bd9Sstevel@tonic-gate 	OP_LOOKUPP = 16,
13837c478bd9Sstevel@tonic-gate 	OP_NVERIFY = 17,
13847c478bd9Sstevel@tonic-gate 	OP_OPEN = 18,
13857c478bd9Sstevel@tonic-gate 	OP_OPENATTR = 19,
13867c478bd9Sstevel@tonic-gate 	OP_OPEN_CONFIRM = 20,
13877c478bd9Sstevel@tonic-gate 	OP_OPEN_DOWNGRADE = 21,
13887c478bd9Sstevel@tonic-gate 	OP_PUTFH = 22,
13897c478bd9Sstevel@tonic-gate 	OP_PUTPUBFH = 23,
13907c478bd9Sstevel@tonic-gate 	OP_PUTROOTFH = 24,
13917c478bd9Sstevel@tonic-gate 	OP_READ = 25,
13927c478bd9Sstevel@tonic-gate 	OP_READDIR = 26,
13937c478bd9Sstevel@tonic-gate 	OP_READLINK = 27,
13947c478bd9Sstevel@tonic-gate 	OP_REMOVE = 28,
13957c478bd9Sstevel@tonic-gate 	OP_RENAME = 29,
13967c478bd9Sstevel@tonic-gate 	OP_RENEW = 30,
13977c478bd9Sstevel@tonic-gate 	OP_RESTOREFH = 31,
13987c478bd9Sstevel@tonic-gate 	OP_SAVEFH = 32,
13997c478bd9Sstevel@tonic-gate 	OP_SECINFO = 33,
14007c478bd9Sstevel@tonic-gate 	OP_SETATTR = 34,
14017c478bd9Sstevel@tonic-gate 	OP_SETCLIENTID = 35,
14027c478bd9Sstevel@tonic-gate 	OP_SETCLIENTID_CONFIRM = 36,
14037c478bd9Sstevel@tonic-gate 	OP_VERIFY = 37,
14047c478bd9Sstevel@tonic-gate 	OP_WRITE = 38,
14057c478bd9Sstevel@tonic-gate 	OP_RELEASE_LOCKOWNER = 39,
14067c478bd9Sstevel@tonic-gate 	OP_ILLEGAL = 10044,
14077c478bd9Sstevel@tonic-gate /*
14087c478bd9Sstevel@tonic-gate  * These are internal client pseudo ops that *MUST* never go over the wire
14097c478bd9Sstevel@tonic-gate  */
14107c478bd9Sstevel@tonic-gate #define	SUNW_PRIVATE_OP	0x10000000
14117c478bd9Sstevel@tonic-gate #define	REAL_OP4(op)	((op) & ~SUNW_PRIVATE_OP)
14127c478bd9Sstevel@tonic-gate 	OP_CCREATE = OP_CREATE | SUNW_PRIVATE_OP,
14137c478bd9Sstevel@tonic-gate 	OP_CLINK = OP_LINK | SUNW_PRIVATE_OP,
14147c478bd9Sstevel@tonic-gate 	OP_CLOOKUP = OP_LOOKUP | SUNW_PRIVATE_OP,
14157c478bd9Sstevel@tonic-gate 	OP_COPEN = OP_OPEN | SUNW_PRIVATE_OP,
14167c478bd9Sstevel@tonic-gate 	OP_CPUTFH = OP_PUTFH | SUNW_PRIVATE_OP,
14177c478bd9Sstevel@tonic-gate 	OP_CREMOVE = OP_REMOVE | SUNW_PRIVATE_OP,
14187c478bd9Sstevel@tonic-gate 	OP_CRENAME = OP_RENAME | SUNW_PRIVATE_OP,
14197c478bd9Sstevel@tonic-gate 	OP_CSECINFO = OP_SECINFO | SUNW_PRIVATE_OP
14207c478bd9Sstevel@tonic-gate };
14217c478bd9Sstevel@tonic-gate typedef enum nfs_opnum4 nfs_opnum4;
14227c478bd9Sstevel@tonic-gate 
14237c478bd9Sstevel@tonic-gate struct nfs_argop4 {
14247c478bd9Sstevel@tonic-gate 	nfs_opnum4 argop;
14257c478bd9Sstevel@tonic-gate 	union {
14267c478bd9Sstevel@tonic-gate 		ACCESS4args opaccess;
14277c478bd9Sstevel@tonic-gate 		CLOSE4args opclose;
14287c478bd9Sstevel@tonic-gate 		COMMIT4args opcommit;
14297c478bd9Sstevel@tonic-gate 		CREATE4args opcreate;
14307c478bd9Sstevel@tonic-gate 		CREATE4cargs opccreate;
14317c478bd9Sstevel@tonic-gate 		DELEGPURGE4args opdelegpurge;
14327c478bd9Sstevel@tonic-gate 		DELEGRETURN4args opdelegreturn;
14337c478bd9Sstevel@tonic-gate 		GETATTR4args opgetattr;
14347c478bd9Sstevel@tonic-gate 		LINK4args oplink;
14357c478bd9Sstevel@tonic-gate 		LINK4cargs opclink;
14367c478bd9Sstevel@tonic-gate 		LOCK4args oplock;
14377c478bd9Sstevel@tonic-gate 		LOCKT4args oplockt;
14387c478bd9Sstevel@tonic-gate 		LOCKU4args oplocku;
14397c478bd9Sstevel@tonic-gate 		LOOKUP4args oplookup;
14407c478bd9Sstevel@tonic-gate 		LOOKUP4cargs opclookup;
14417c478bd9Sstevel@tonic-gate 		NVERIFY4args opnverify;
14427c478bd9Sstevel@tonic-gate 		OPEN4args opopen;
14437c478bd9Sstevel@tonic-gate 		OPEN4cargs opcopen;
14447c478bd9Sstevel@tonic-gate 		OPENATTR4args opopenattr;
14457c478bd9Sstevel@tonic-gate 		OPEN_CONFIRM4args opopen_confirm;
14467c478bd9Sstevel@tonic-gate 		OPEN_DOWNGRADE4args opopen_downgrade;
14477c478bd9Sstevel@tonic-gate 		PUTFH4args opputfh;
14487c478bd9Sstevel@tonic-gate 		PUTFH4cargs opcputfh;
14497c478bd9Sstevel@tonic-gate 		READ4args opread;
14507c478bd9Sstevel@tonic-gate 		READDIR4args opreaddir;
14517c478bd9Sstevel@tonic-gate 		REMOVE4args opremove;
14527c478bd9Sstevel@tonic-gate 		REMOVE4cargs opcremove;
14537c478bd9Sstevel@tonic-gate 		RENAME4args oprename;
14547c478bd9Sstevel@tonic-gate 		RENAME4cargs opcrename;
14557c478bd9Sstevel@tonic-gate 		RENEW4args oprenew;
14567c478bd9Sstevel@tonic-gate 		SECINFO4args opsecinfo;
14577c478bd9Sstevel@tonic-gate 		SECINFO4cargs opcsecinfo;
14587c478bd9Sstevel@tonic-gate 		SETATTR4args opsetattr;
14597c478bd9Sstevel@tonic-gate 		SETCLIENTID4args opsetclientid;
14607c478bd9Sstevel@tonic-gate 		SETCLIENTID_CONFIRM4args opsetclientid_confirm;
14617c478bd9Sstevel@tonic-gate 		VERIFY4args opverify;
14627c478bd9Sstevel@tonic-gate 		WRITE4args opwrite;
14637c478bd9Sstevel@tonic-gate 		RELEASE_LOCKOWNER4args oprelease_lockowner;
14647c478bd9Sstevel@tonic-gate 	} nfs_argop4_u;
14657c478bd9Sstevel@tonic-gate };
14667c478bd9Sstevel@tonic-gate typedef struct nfs_argop4 nfs_argop4;
14677c478bd9Sstevel@tonic-gate 
14687c478bd9Sstevel@tonic-gate struct nfs_resop4 {
14697c478bd9Sstevel@tonic-gate 	nfs_opnum4 resop;
14707c478bd9Sstevel@tonic-gate 	union {
14717c478bd9Sstevel@tonic-gate 		ACCESS4res opaccess;
14727c478bd9Sstevel@tonic-gate 		CLOSE4res opclose;
14737c478bd9Sstevel@tonic-gate 		COMMIT4res opcommit;
14747c478bd9Sstevel@tonic-gate 		CREATE4res opcreate;
14757c478bd9Sstevel@tonic-gate 		DELEGPURGE4res opdelegpurge;
14767c478bd9Sstevel@tonic-gate 		DELEGRETURN4res opdelegreturn;
14777c478bd9Sstevel@tonic-gate 		GETATTR4res opgetattr;
14787c478bd9Sstevel@tonic-gate 		GETFH4res opgetfh;
14797c478bd9Sstevel@tonic-gate 		LINK4res oplink;
14807c478bd9Sstevel@tonic-gate 		LOCK4res oplock;
14817c478bd9Sstevel@tonic-gate 		LOCKT4res oplockt;
14827c478bd9Sstevel@tonic-gate 		LOCKU4res oplocku;
14837c478bd9Sstevel@tonic-gate 		LOOKUP4res oplookup;
14847c478bd9Sstevel@tonic-gate 		LOOKUPP4res oplookupp;
14857c478bd9Sstevel@tonic-gate 		NVERIFY4res opnverify;
14867c478bd9Sstevel@tonic-gate 		OPEN4res opopen;
14877c478bd9Sstevel@tonic-gate 		OPENATTR4res opopenattr;
14887c478bd9Sstevel@tonic-gate 		OPEN_CONFIRM4res opopen_confirm;
14897c478bd9Sstevel@tonic-gate 		OPEN_DOWNGRADE4res opopen_downgrade;
14907c478bd9Sstevel@tonic-gate 		PUTFH4res opputfh;
14917c478bd9Sstevel@tonic-gate 		PUTPUBFH4res opputpubfh;
14927c478bd9Sstevel@tonic-gate 		PUTROOTFH4res opputrootfh;
14937c478bd9Sstevel@tonic-gate 		READ4res opread;
14947c478bd9Sstevel@tonic-gate 		READDIR4res opreaddir;
14957c478bd9Sstevel@tonic-gate 		READDIR4res_clnt opreaddirclnt;
14967c478bd9Sstevel@tonic-gate 		READLINK4res opreadlink;
14977c478bd9Sstevel@tonic-gate 		REMOVE4res opremove;
14987c478bd9Sstevel@tonic-gate 		RENAME4res oprename;
14997c478bd9Sstevel@tonic-gate 		RENEW4res oprenew;
15007c478bd9Sstevel@tonic-gate 		RESTOREFH4res oprestorefh;
15017c478bd9Sstevel@tonic-gate 		SAVEFH4res opsavefh;
15027c478bd9Sstevel@tonic-gate 		SECINFO4res opsecinfo;
15037c478bd9Sstevel@tonic-gate 		SETATTR4res opsetattr;
15047c478bd9Sstevel@tonic-gate 		SETCLIENTID4res opsetclientid;
15057c478bd9Sstevel@tonic-gate 		SETCLIENTID_CONFIRM4res opsetclientid_confirm;
15067c478bd9Sstevel@tonic-gate 		VERIFY4res opverify;
15077c478bd9Sstevel@tonic-gate 		WRITE4res opwrite;
15087c478bd9Sstevel@tonic-gate 		RELEASE_LOCKOWNER4res oprelease_lockowner;
15097c478bd9Sstevel@tonic-gate 		ILLEGAL4res opillegal;
15107c478bd9Sstevel@tonic-gate 	} nfs_resop4_u;
15117c478bd9Sstevel@tonic-gate };
15127c478bd9Sstevel@tonic-gate typedef struct nfs_resop4 nfs_resop4;
15137c478bd9Sstevel@tonic-gate 
15147c478bd9Sstevel@tonic-gate /*
15157c478bd9Sstevel@tonic-gate  * Fixed size tag string for easy client encoding
15167c478bd9Sstevel@tonic-gate  */
15177c478bd9Sstevel@tonic-gate struct _ctag {
15187c478bd9Sstevel@tonic-gate 	int ct_type;
15197c478bd9Sstevel@tonic-gate 	char *ct_str;
15207c478bd9Sstevel@tonic-gate 	uint32_t ct_tag[3];
15217c478bd9Sstevel@tonic-gate };
15227c478bd9Sstevel@tonic-gate typedef struct _ctag ctag_t;
15237c478bd9Sstevel@tonic-gate 
15247c478bd9Sstevel@tonic-gate /*
15257c478bd9Sstevel@tonic-gate  * Client-only encode-only version
15267c478bd9Sstevel@tonic-gate  */
15277c478bd9Sstevel@tonic-gate struct COMPOUND4args_clnt {
15287c478bd9Sstevel@tonic-gate 	int ctag;
15297c478bd9Sstevel@tonic-gate 	uint_t array_len;
15307c478bd9Sstevel@tonic-gate 	nfs_argop4 *array;
15317c478bd9Sstevel@tonic-gate };
15327c478bd9Sstevel@tonic-gate typedef struct COMPOUND4args_clnt COMPOUND4args_clnt;
15337c478bd9Sstevel@tonic-gate 
15347c478bd9Sstevel@tonic-gate struct COMPOUND4args {
15357c478bd9Sstevel@tonic-gate 	utf8string tag;
15367c478bd9Sstevel@tonic-gate 	uint32_t minorversion;
15377c478bd9Sstevel@tonic-gate 	uint_t array_len;
15387c478bd9Sstevel@tonic-gate 	nfs_argop4 *array;
15397c478bd9Sstevel@tonic-gate };
15407c478bd9Sstevel@tonic-gate typedef struct COMPOUND4args COMPOUND4args;
15417c478bd9Sstevel@tonic-gate 
15427c478bd9Sstevel@tonic-gate struct COMPOUND4res_clnt {
15437c478bd9Sstevel@tonic-gate 	nfsstat4 status;
15447c478bd9Sstevel@tonic-gate 	uint_t array_len;
15457c478bd9Sstevel@tonic-gate 	uint_t decode_len;
15467c478bd9Sstevel@tonic-gate 	nfs_resop4 *array;
15477c478bd9Sstevel@tonic-gate 	COMPOUND4args_clnt *argsp;
15487c478bd9Sstevel@tonic-gate };
15497c478bd9Sstevel@tonic-gate typedef struct COMPOUND4res_clnt COMPOUND4res_clnt;
15507c478bd9Sstevel@tonic-gate 
15517c478bd9Sstevel@tonic-gate struct COMPOUND4res {
15527c478bd9Sstevel@tonic-gate 	nfsstat4 status;
15537c478bd9Sstevel@tonic-gate 	utf8string tag;
15547c478bd9Sstevel@tonic-gate 	uint_t array_len;
15557c478bd9Sstevel@tonic-gate 	nfs_resop4 *array;
15567c478bd9Sstevel@tonic-gate };
15577c478bd9Sstevel@tonic-gate typedef struct COMPOUND4res COMPOUND4res;
15587c478bd9Sstevel@tonic-gate 
15597c478bd9Sstevel@tonic-gate struct CB_GETATTR4args {
15607c478bd9Sstevel@tonic-gate 	nfs_fh4 fh;
15617c478bd9Sstevel@tonic-gate 	bitmap4 attr_request;
15627c478bd9Sstevel@tonic-gate };
15637c478bd9Sstevel@tonic-gate typedef struct CB_GETATTR4args CB_GETATTR4args;
15647c478bd9Sstevel@tonic-gate 
15657c478bd9Sstevel@tonic-gate struct CB_GETATTR4res {
15667c478bd9Sstevel@tonic-gate 	nfsstat4 status;
15677c478bd9Sstevel@tonic-gate 	fattr4 obj_attributes;
15687c478bd9Sstevel@tonic-gate };
15697c478bd9Sstevel@tonic-gate typedef struct CB_GETATTR4res CB_GETATTR4res;
15707c478bd9Sstevel@tonic-gate 
15717c478bd9Sstevel@tonic-gate struct CB_RECALL4args {
15727c478bd9Sstevel@tonic-gate 	stateid4 stateid;
15737c478bd9Sstevel@tonic-gate 	bool_t truncate;
15747c478bd9Sstevel@tonic-gate 	nfs_fh4 fh;
15757c478bd9Sstevel@tonic-gate };
15767c478bd9Sstevel@tonic-gate typedef struct CB_RECALL4args CB_RECALL4args;
15777c478bd9Sstevel@tonic-gate 
15787c478bd9Sstevel@tonic-gate struct CB_RECALL4res {
15797c478bd9Sstevel@tonic-gate 	nfsstat4 status;
15807c478bd9Sstevel@tonic-gate };
15817c478bd9Sstevel@tonic-gate typedef struct CB_RECALL4res CB_RECALL4res;
15827c478bd9Sstevel@tonic-gate 
15837c478bd9Sstevel@tonic-gate struct CB_ILLEGAL4res {
15847c478bd9Sstevel@tonic-gate 	nfsstat4 status;
15857c478bd9Sstevel@tonic-gate };
15867c478bd9Sstevel@tonic-gate typedef struct CB_ILLEGAL4res CB_ILLEGAL4res;
15877c478bd9Sstevel@tonic-gate 
15887c478bd9Sstevel@tonic-gate enum nfs_cb_opnum4 {
15897c478bd9Sstevel@tonic-gate 	OP_CB_GETATTR = 3,
15907c478bd9Sstevel@tonic-gate 	OP_CB_RECALL = 4,
15917c478bd9Sstevel@tonic-gate 	OP_CB_ILLEGAL = 10044
15927c478bd9Sstevel@tonic-gate };
15937c478bd9Sstevel@tonic-gate typedef enum nfs_cb_opnum4 nfs_cb_opnum4;
15947c478bd9Sstevel@tonic-gate 
15957c478bd9Sstevel@tonic-gate struct nfs_cb_argop4 {
15967c478bd9Sstevel@tonic-gate 	uint_t argop;
15977c478bd9Sstevel@tonic-gate 	union {
15987c478bd9Sstevel@tonic-gate 		CB_GETATTR4args opcbgetattr;
15997c478bd9Sstevel@tonic-gate 		CB_RECALL4args opcbrecall;
16007c478bd9Sstevel@tonic-gate 	} nfs_cb_argop4_u;
16017c478bd9Sstevel@tonic-gate };
16027c478bd9Sstevel@tonic-gate typedef struct nfs_cb_argop4 nfs_cb_argop4;
16037c478bd9Sstevel@tonic-gate 
16047c478bd9Sstevel@tonic-gate struct nfs_cb_resop4 {
16057c478bd9Sstevel@tonic-gate 	uint_t resop;
16067c478bd9Sstevel@tonic-gate 	union {
16077c478bd9Sstevel@tonic-gate 		CB_GETATTR4res opcbgetattr;
16087c478bd9Sstevel@tonic-gate 		CB_RECALL4res opcbrecall;
16097c478bd9Sstevel@tonic-gate 		CB_ILLEGAL4res opcbillegal;
16107c478bd9Sstevel@tonic-gate 	} nfs_cb_resop4_u;
16117c478bd9Sstevel@tonic-gate };
16127c478bd9Sstevel@tonic-gate typedef struct nfs_cb_resop4 nfs_cb_resop4;
16137c478bd9Sstevel@tonic-gate 
16147c478bd9Sstevel@tonic-gate struct CB_COMPOUND4args {
16157c478bd9Sstevel@tonic-gate 	utf8string tag;
16167c478bd9Sstevel@tonic-gate 	uint32_t minorversion;
16177c478bd9Sstevel@tonic-gate 	uint32_t callback_ident;
16187c478bd9Sstevel@tonic-gate 	uint_t array_len;
16197c478bd9Sstevel@tonic-gate 	nfs_cb_argop4 *array;
16207c478bd9Sstevel@tonic-gate };
16217c478bd9Sstevel@tonic-gate typedef struct CB_COMPOUND4args CB_COMPOUND4args;
16227c478bd9Sstevel@tonic-gate 
16237c478bd9Sstevel@tonic-gate struct CB_COMPOUND4res {
16247c478bd9Sstevel@tonic-gate 	nfsstat4 status;
16257c478bd9Sstevel@tonic-gate 	utf8string tag;
16267c478bd9Sstevel@tonic-gate 	uint_t array_len;
16277c478bd9Sstevel@tonic-gate 	nfs_cb_resop4 *array;
16287c478bd9Sstevel@tonic-gate };
16297c478bd9Sstevel@tonic-gate typedef struct CB_COMPOUND4res CB_COMPOUND4res;
16307c478bd9Sstevel@tonic-gate 
16317c478bd9Sstevel@tonic-gate #define	NFS4_PROGRAM		100003
16327c478bd9Sstevel@tonic-gate #define	NFS_V4			4
16337c478bd9Sstevel@tonic-gate #define	NFSPROC4_NULL		0
16347c478bd9Sstevel@tonic-gate #define	NFSPROC4_COMPOUND	1
16357c478bd9Sstevel@tonic-gate 
16367c478bd9Sstevel@tonic-gate #define	NFS4_CALLBACK		0x40000000
16377c478bd9Sstevel@tonic-gate #define	NFS_CB			1
16387c478bd9Sstevel@tonic-gate #define	CB_NULL			0
16397c478bd9Sstevel@tonic-gate #define	CB_COMPOUND		1
16407c478bd9Sstevel@tonic-gate 
16417c478bd9Sstevel@tonic-gate extern  bool_t xdr_bitmap4(XDR *, bitmap4 *);
16427c478bd9Sstevel@tonic-gate extern  bool_t xdr_utf8string(XDR *, utf8string *);
16437c478bd9Sstevel@tonic-gate extern  bool_t xdr_nfs_fh4(XDR *, nfs_fh4 *);
16447c478bd9Sstevel@tonic-gate extern  bool_t xdr_fattr4_fsid(XDR *, fattr4_fsid *);
16457c478bd9Sstevel@tonic-gate extern  bool_t xdr_fattr4_acl(XDR *, fattr4_acl *);
16467c478bd9Sstevel@tonic-gate extern  bool_t xdr_fattr4_fs_locations(XDR *, fattr4_fs_locations *);
16477c478bd9Sstevel@tonic-gate extern  bool_t xdr_fattr4_rawdev(XDR *, fattr4_rawdev *);
16487c478bd9Sstevel@tonic-gate extern  bool_t xdr_nfstime4(XDR *, nfstime4 *);
16497c478bd9Sstevel@tonic-gate extern  bool_t xdr_settime4(XDR *, settime4 *);
16507c478bd9Sstevel@tonic-gate extern  bool_t xdr_COMPOUND4args_clnt(XDR *, COMPOUND4args_clnt *);
16517c46fb7fSek110237 extern  bool_t xdr_COMPOUND4args_srv(XDR *, COMPOUND4args *);
16527c478bd9Sstevel@tonic-gate extern  bool_t xdr_COMPOUND4res_clnt(XDR *, COMPOUND4res_clnt *);
16537c46fb7fSek110237 extern  bool_t xdr_COMPOUND4res_srv(XDR *, COMPOUND4res *);
1654eac3aab7Srobinson extern  bool_t xdr_CB_COMPOUND4args_clnt(XDR *, CB_COMPOUND4args *);
1655eac3aab7Srobinson extern  bool_t xdr_CB_COMPOUND4args_srv(XDR *, CB_COMPOUND4args *);
16567c478bd9Sstevel@tonic-gate extern  bool_t xdr_CB_COMPOUND4res(XDR *, CB_COMPOUND4res *);
16577c478bd9Sstevel@tonic-gate 
16582f172c55SRobert Thurlow /*
16592f172c55SRobert Thurlow  * xdr for referrrals upcall
16602f172c55SRobert Thurlow  */
16612f172c55SRobert Thurlow extern	bool_t xdr_knetconfig(XDR *, struct knetconfig *);
16622f172c55SRobert Thurlow extern	bool_t xdr_nfs_fsl_info(XDR *, struct nfs_fsl_info *);
16632f172c55SRobert Thurlow 
16647c478bd9Sstevel@tonic-gate 
16657c478bd9Sstevel@tonic-gate #ifdef __cplusplus
16667c478bd9Sstevel@tonic-gate }
16677c478bd9Sstevel@tonic-gate #endif
16687c478bd9Sstevel@tonic-gate 
16697c478bd9Sstevel@tonic-gate #endif /* _NFS4_KPROT_H */
1670