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