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