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