xref: /titanic_53/usr/src/head/rpcsvc/nfs4_prot.x (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 (C) The Internet Society (1998-2003).
24*7c478bd9Sstevel@tonic-gate  *  All Rights Reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*
28*7c478bd9Sstevel@tonic-gate  *	nfs4_prot.x
29*7c478bd9Sstevel@tonic-gate  */
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate %#pragma ident	"@(#)nfs4_prot.x	1.122"
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate /*
34*7c478bd9Sstevel@tonic-gate  * Basic typedefs for RFC 1832 data type definitions
35*7c478bd9Sstevel@tonic-gate  */
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate /*
38*7c478bd9Sstevel@tonic-gate  * typedef int		int32_t;
39*7c478bd9Sstevel@tonic-gate  * typedef unsigned int	uint32_t;
40*7c478bd9Sstevel@tonic-gate  * typedef hyper		int64_t;
41*7c478bd9Sstevel@tonic-gate  * typedef unsigned hyper	uint64_t;
42*7c478bd9Sstevel@tonic-gate  */
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate /*
45*7c478bd9Sstevel@tonic-gate  * Sizes
46*7c478bd9Sstevel@tonic-gate  */
47*7c478bd9Sstevel@tonic-gate const NFS4_FHSIZE		= 128;
48*7c478bd9Sstevel@tonic-gate const NFS4_VERIFIER_SIZE	= 8;
49*7c478bd9Sstevel@tonic-gate const NFS4_OPAQUE_LIMIT		= 1024;
50*7c478bd9Sstevel@tonic-gate 
51*7c478bd9Sstevel@tonic-gate /*
52*7c478bd9Sstevel@tonic-gate  * File types
53*7c478bd9Sstevel@tonic-gate  */
54*7c478bd9Sstevel@tonic-gate enum nfs_ftype4 {
55*7c478bd9Sstevel@tonic-gate 	NF4REG		= 1,	/* Regular File */
56*7c478bd9Sstevel@tonic-gate 	NF4DIR		= 2,	/* Directory */
57*7c478bd9Sstevel@tonic-gate 	NF4BLK		= 3,	/* Special File - block device */
58*7c478bd9Sstevel@tonic-gate 	NF4CHR		= 4,	/* Special File - character device */
59*7c478bd9Sstevel@tonic-gate 	NF4LNK		= 5,	/* Symbolic Link */
60*7c478bd9Sstevel@tonic-gate 	NF4SOCK		= 6,	/* Special File - socket */
61*7c478bd9Sstevel@tonic-gate 	NF4FIFO		= 7,	/* Special File - fifo */
62*7c478bd9Sstevel@tonic-gate 	NF4ATTRDIR	= 8,	/* Attribute Directory */
63*7c478bd9Sstevel@tonic-gate 	NF4NAMEDATTR	= 9	/* Named Attribute */
64*7c478bd9Sstevel@tonic-gate };
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate /*
67*7c478bd9Sstevel@tonic-gate  * Error status
68*7c478bd9Sstevel@tonic-gate  */
69*7c478bd9Sstevel@tonic-gate enum nfsstat4 {
70*7c478bd9Sstevel@tonic-gate 	NFS4_OK			= 0,    /* everything is okay      */
71*7c478bd9Sstevel@tonic-gate 	NFS4ERR_PERM		= 1,    /* caller not privileged   */
72*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NOENT		= 2,    /* no such file/directory  */
73*7c478bd9Sstevel@tonic-gate 	NFS4ERR_IO		= 5,    /* hard I/O error          */
74*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NXIO		= 6,    /* no such device          */
75*7c478bd9Sstevel@tonic-gate 	NFS4ERR_ACCESS		= 13,   /* access denied           */
76*7c478bd9Sstevel@tonic-gate 	NFS4ERR_EXIST		= 17,   /* file already exists     */
77*7c478bd9Sstevel@tonic-gate 	NFS4ERR_XDEV		= 18,   /* different filesystems   */
78*7c478bd9Sstevel@tonic-gate 	/* Unused/reserved        19 */
79*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NOTDIR		= 20,   /* should be a directory   */
80*7c478bd9Sstevel@tonic-gate 	NFS4ERR_ISDIR		= 21,   /* should not be directory */
81*7c478bd9Sstevel@tonic-gate 	NFS4ERR_INVAL		= 22,   /* invalid argument        */
82*7c478bd9Sstevel@tonic-gate 	NFS4ERR_FBIG		= 27,   /* file exceeds server max */
83*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NOSPC		= 28,   /* no space on filesystem  */
84*7c478bd9Sstevel@tonic-gate 	NFS4ERR_ROFS		= 30,   /* read-only filesystem    */
85*7c478bd9Sstevel@tonic-gate 	NFS4ERR_MLINK		= 31,   /* too many hard links     */
86*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NAMETOOLONG	= 63,   /* name exceeds server max */
87*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NOTEMPTY	= 66,   /* directory not empty     */
88*7c478bd9Sstevel@tonic-gate 	NFS4ERR_DQUOT		= 69,   /* hard quota limit reached*/
89*7c478bd9Sstevel@tonic-gate 	NFS4ERR_STALE		= 70,   /* file no longer exists   */
90*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BADHANDLE	= 10001,/* Illegal filehandle      */
91*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_COOKIE	= 10003,/* READDIR cookie is stale */
92*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NOTSUPP		= 10004,/* operation not supported */
93*7c478bd9Sstevel@tonic-gate 	NFS4ERR_TOOSMALL	= 10005,/* response limit exceeded */
94*7c478bd9Sstevel@tonic-gate 	NFS4ERR_SERVERFAULT	= 10006,/* undefined server error  */
95*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BADTYPE		= 10007,/* type invalid for CREATE */
96*7c478bd9Sstevel@tonic-gate 	NFS4ERR_DELAY		= 10008,/* file "busy" - retry     */
97*7c478bd9Sstevel@tonic-gate 	NFS4ERR_SAME		= 10009,/* nverify says attrs same */
98*7c478bd9Sstevel@tonic-gate 	NFS4ERR_DENIED		= 10010,/* lock unavailable	   */
99*7c478bd9Sstevel@tonic-gate 	NFS4ERR_EXPIRED		= 10011,/* lock lease expired	   */
100*7c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCKED		= 10012,/* I/O failed due to lock  */
101*7c478bd9Sstevel@tonic-gate 	NFS4ERR_GRACE		= 10013,/* in grace period	   */
102*7c478bd9Sstevel@tonic-gate 	NFS4ERR_FHEXPIRED	= 10014,/* filehandle expired	   */
103*7c478bd9Sstevel@tonic-gate 	NFS4ERR_SHARE_DENIED	= 10015,/* share reserve denied	   */
104*7c478bd9Sstevel@tonic-gate 	NFS4ERR_WRONGSEC	= 10016,/* wrong security flavor   */
105*7c478bd9Sstevel@tonic-gate 	NFS4ERR_CLID_INUSE	= 10017,/* clientid in use	   */
106*7c478bd9Sstevel@tonic-gate 	NFS4ERR_RESOURCE	= 10018,/* resource exhaustion	   */
107*7c478bd9Sstevel@tonic-gate 	NFS4ERR_MOVED		= 10019,/* filesystem relocated	   */
108*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NOFILEHANDLE	= 10020,/* current FH is not set   */
109*7c478bd9Sstevel@tonic-gate 	NFS4ERR_MINOR_VERS_MISMATCH = 10021,/* minor vers not supp */
110*7c478bd9Sstevel@tonic-gate 	NFS4ERR_STALE_CLIENTID	= 10022,/* server has rebooted     */
111*7c478bd9Sstevel@tonic-gate 	NFS4ERR_STALE_STATEID	= 10023,/* server has rebooted     */
112*7c478bd9Sstevel@tonic-gate 	NFS4ERR_OLD_STATEID	= 10024,/* state is out of sync    */
113*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_STATEID	= 10025,/* incorrect stateid       */
114*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_SEQID	= 10026,/* request is out of seq.  */
115*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NOT_SAME	= 10027,/* verify - attrs not same */
116*7c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCK_RANGE	= 10028,/* lock range not supported*/
117*7c478bd9Sstevel@tonic-gate 	NFS4ERR_SYMLINK		= 10029,/* should be file/directory*/
118*7c478bd9Sstevel@tonic-gate 	NFS4ERR_RESTOREFH	= 10030,/* no saved filehandle     */
119*7c478bd9Sstevel@tonic-gate 	NFS4ERR_LEASE_MOVED	= 10031,/* some filesystem moved   */
120*7c478bd9Sstevel@tonic-gate 	NFS4ERR_ATTRNOTSUPP	= 10032,/* recommended attr not sup*/
121*7c478bd9Sstevel@tonic-gate 	NFS4ERR_NO_GRACE	= 10033,/* reclaim outside of grace*/
122*7c478bd9Sstevel@tonic-gate 	NFS4ERR_RECLAIM_BAD	= 10034,/* reclaim error at server */
123*7c478bd9Sstevel@tonic-gate 	NFS4ERR_RECLAIM_CONFLICT = 10035,/* conflict on reclaim    */
124*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BADXDR		= 10036,/* XDR decode failed       */
125*7c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCKS_HELD	= 10037,/* file locks held at CLOSE*/
126*7c478bd9Sstevel@tonic-gate 	NFS4ERR_OPENMODE	= 10038,/* conflict in OPEN and I/O*/
127*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BADOWNER	= 10039,/* owner translation bad   */
128*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BADCHAR		= 10040,/* utf-8 char not supported*/
129*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BADNAME		= 10041,/* name not supported      */
130*7c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_RANGE	= 10042,/* lock range not supported*/
131*7c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCK_NOTSUPP	= 10043,/* no atomic up/downgrade  */
132*7c478bd9Sstevel@tonic-gate 	NFS4ERR_OP_ILLEGAL	= 10044,/* undefined operation     */
133*7c478bd9Sstevel@tonic-gate 	NFS4ERR_DEADLOCK	= 10045,/* file locking deadlock   */
134*7c478bd9Sstevel@tonic-gate 	NFS4ERR_FILE_OPEN	= 10046,/* open file blocks op.    */
135*7c478bd9Sstevel@tonic-gate 	NFS4ERR_ADMIN_REVOKED	= 10047,/* lockowner state revoked */
136*7c478bd9Sstevel@tonic-gate 	NFS4ERR_CB_PATH_DOWN    = 10048 /* callback path down      */
137*7c478bd9Sstevel@tonic-gate };
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate /*
140*7c478bd9Sstevel@tonic-gate  * Basic data types
141*7c478bd9Sstevel@tonic-gate  */
142*7c478bd9Sstevel@tonic-gate typedef uint32_t	bitmap4<>;
143*7c478bd9Sstevel@tonic-gate typedef uint64_t	offset4;
144*7c478bd9Sstevel@tonic-gate typedef uint32_t	count4;
145*7c478bd9Sstevel@tonic-gate typedef	uint64_t	length4;
146*7c478bd9Sstevel@tonic-gate typedef uint64_t	clientid4;
147*7c478bd9Sstevel@tonic-gate typedef uint32_t	seqid4;
148*7c478bd9Sstevel@tonic-gate typedef opaque		utf8string<>;
149*7c478bd9Sstevel@tonic-gate typedef utf8string	utf8str_cis;
150*7c478bd9Sstevel@tonic-gate typedef utf8string	utf8str_cs;
151*7c478bd9Sstevel@tonic-gate typedef utf8string	utf8str_mixed;
152*7c478bd9Sstevel@tonic-gate typedef utf8str_cs	component4;
153*7c478bd9Sstevel@tonic-gate typedef	component4	pathname4<>;
154*7c478bd9Sstevel@tonic-gate typedef uint64_t	nfs_lockid4;
155*7c478bd9Sstevel@tonic-gate typedef	uint64_t	nfs_cookie4;
156*7c478bd9Sstevel@tonic-gate typedef	utf8str_cs	linktext4;
157*7c478bd9Sstevel@tonic-gate typedef opaque		sec_oid4<>;
158*7c478bd9Sstevel@tonic-gate typedef uint32_t	qop4;
159*7c478bd9Sstevel@tonic-gate typedef	uint32_t	mode4;
160*7c478bd9Sstevel@tonic-gate typedef	uint64_t	changeid4;
161*7c478bd9Sstevel@tonic-gate typedef opaque		verifier4[NFS4_VERIFIER_SIZE];
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate /*
164*7c478bd9Sstevel@tonic-gate  * Timeval
165*7c478bd9Sstevel@tonic-gate  */
166*7c478bd9Sstevel@tonic-gate struct nfstime4 {
167*7c478bd9Sstevel@tonic-gate 	int64_t		seconds;
168*7c478bd9Sstevel@tonic-gate 	uint32_t	nseconds;
169*7c478bd9Sstevel@tonic-gate };
170*7c478bd9Sstevel@tonic-gate 
171*7c478bd9Sstevel@tonic-gate enum time_how4 {
172*7c478bd9Sstevel@tonic-gate 	SET_TO_SERVER_TIME4 = 0,
173*7c478bd9Sstevel@tonic-gate 	SET_TO_CLIENT_TIME4 = 1
174*7c478bd9Sstevel@tonic-gate };
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate union settime4 switch (time_how4 set_it) {
177*7c478bd9Sstevel@tonic-gate  case SET_TO_CLIENT_TIME4:
178*7c478bd9Sstevel@tonic-gate 	 nfstime4	time;
179*7c478bd9Sstevel@tonic-gate  default:
180*7c478bd9Sstevel@tonic-gate 	 void;
181*7c478bd9Sstevel@tonic-gate };
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate /*
184*7c478bd9Sstevel@tonic-gate  * File access handle
185*7c478bd9Sstevel@tonic-gate  */
186*7c478bd9Sstevel@tonic-gate typedef	opaque	nfs_fh4<NFS4_FHSIZE>;
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate /*
190*7c478bd9Sstevel@tonic-gate  * File attribute definitions
191*7c478bd9Sstevel@tonic-gate  */
192*7c478bd9Sstevel@tonic-gate 
193*7c478bd9Sstevel@tonic-gate /*
194*7c478bd9Sstevel@tonic-gate  * FSID structure for major/minor
195*7c478bd9Sstevel@tonic-gate  */
196*7c478bd9Sstevel@tonic-gate struct fsid4 {
197*7c478bd9Sstevel@tonic-gate 	uint64_t	major;
198*7c478bd9Sstevel@tonic-gate 	uint64_t	minor;
199*7c478bd9Sstevel@tonic-gate };
200*7c478bd9Sstevel@tonic-gate 
201*7c478bd9Sstevel@tonic-gate /*
202*7c478bd9Sstevel@tonic-gate  * Filesystem locations attribute for relocation/migration
203*7c478bd9Sstevel@tonic-gate  */
204*7c478bd9Sstevel@tonic-gate struct fs_location4 {
205*7c478bd9Sstevel@tonic-gate 	utf8str_cis	server<>;
206*7c478bd9Sstevel@tonic-gate 	pathname4	rootpath;
207*7c478bd9Sstevel@tonic-gate };
208*7c478bd9Sstevel@tonic-gate 
209*7c478bd9Sstevel@tonic-gate struct fs_locations4 {
210*7c478bd9Sstevel@tonic-gate 	pathname4	fs_root;
211*7c478bd9Sstevel@tonic-gate 	fs_location4	locations<>;
212*7c478bd9Sstevel@tonic-gate };
213*7c478bd9Sstevel@tonic-gate 
214*7c478bd9Sstevel@tonic-gate /*
215*7c478bd9Sstevel@tonic-gate  * Various Access Control Entry definitions
216*7c478bd9Sstevel@tonic-gate  */
217*7c478bd9Sstevel@tonic-gate 
218*7c478bd9Sstevel@tonic-gate /*
219*7c478bd9Sstevel@tonic-gate  * Mask that indicates which Access Control Entries are supported.
220*7c478bd9Sstevel@tonic-gate  * Values for the fattr4_aclsupport attribute.
221*7c478bd9Sstevel@tonic-gate  */
222*7c478bd9Sstevel@tonic-gate const ACL4_SUPPORT_ALLOW_ACL	= 0x00000001;
223*7c478bd9Sstevel@tonic-gate const ACL4_SUPPORT_DENY_ACL	= 0x00000002;
224*7c478bd9Sstevel@tonic-gate const ACL4_SUPPORT_AUDIT_ACL	= 0x00000004;
225*7c478bd9Sstevel@tonic-gate const ACL4_SUPPORT_ALARM_ACL	= 0x00000008;
226*7c478bd9Sstevel@tonic-gate 
227*7c478bd9Sstevel@tonic-gate 
228*7c478bd9Sstevel@tonic-gate typedef	uint32_t	acetype4;
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate /*
231*7c478bd9Sstevel@tonic-gate  * acetype4 values, others can be added as needed.
232*7c478bd9Sstevel@tonic-gate  */
233*7c478bd9Sstevel@tonic-gate const ACE4_ACCESS_ALLOWED_ACE_TYPE	= 0x00000000;
234*7c478bd9Sstevel@tonic-gate const ACE4_ACCESS_DENIED_ACE_TYPE	= 0x00000001;
235*7c478bd9Sstevel@tonic-gate const ACE4_SYSTEM_AUDIT_ACE_TYPE	= 0x00000002;
236*7c478bd9Sstevel@tonic-gate const ACE4_SYSTEM_ALARM_ACE_TYPE	= 0x00000003;
237*7c478bd9Sstevel@tonic-gate 
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate /*
240*7c478bd9Sstevel@tonic-gate  * ACE flag
241*7c478bd9Sstevel@tonic-gate  */
242*7c478bd9Sstevel@tonic-gate typedef uint32_t aceflag4;
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate /*
245*7c478bd9Sstevel@tonic-gate  * ACE flag values
246*7c478bd9Sstevel@tonic-gate  */
247*7c478bd9Sstevel@tonic-gate const ACE4_FILE_INHERIT_ACE		= 0x00000001;
248*7c478bd9Sstevel@tonic-gate const ACE4_DIRECTORY_INHERIT_ACE	= 0x00000002;
249*7c478bd9Sstevel@tonic-gate const ACE4_NO_PROPAGATE_INHERIT_ACE	= 0x00000004;
250*7c478bd9Sstevel@tonic-gate const ACE4_INHERIT_ONLY_ACE		= 0x00000008;
251*7c478bd9Sstevel@tonic-gate const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG	= 0x00000010;
252*7c478bd9Sstevel@tonic-gate const ACE4_FAILED_ACCESS_ACE_FLAG	= 0x00000020;
253*7c478bd9Sstevel@tonic-gate const ACE4_IDENTIFIER_GROUP		= 0x00000040;
254*7c478bd9Sstevel@tonic-gate 
255*7c478bd9Sstevel@tonic-gate 
256*7c478bd9Sstevel@tonic-gate /*
257*7c478bd9Sstevel@tonic-gate  * ACE mask
258*7c478bd9Sstevel@tonic-gate  */
259*7c478bd9Sstevel@tonic-gate typedef uint32_t	acemask4;
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate /*
262*7c478bd9Sstevel@tonic-gate  * ACE mask values
263*7c478bd9Sstevel@tonic-gate  */
264*7c478bd9Sstevel@tonic-gate const ACE4_READ_DATA		= 0x00000001;
265*7c478bd9Sstevel@tonic-gate const ACE4_LIST_DIRECTORY	= 0x00000001;
266*7c478bd9Sstevel@tonic-gate const ACE4_WRITE_DATA		= 0x00000002;
267*7c478bd9Sstevel@tonic-gate const ACE4_ADD_FILE		= 0x00000002;
268*7c478bd9Sstevel@tonic-gate const ACE4_APPEND_DATA		= 0x00000004;
269*7c478bd9Sstevel@tonic-gate const ACE4_ADD_SUBDIRECTORY	= 0x00000004;
270*7c478bd9Sstevel@tonic-gate const ACE4_READ_NAMED_ATTRS	= 0x00000008;
271*7c478bd9Sstevel@tonic-gate const ACE4_WRITE_NAMED_ATTRS	= 0x00000010;
272*7c478bd9Sstevel@tonic-gate const ACE4_EXECUTE		= 0x00000020;
273*7c478bd9Sstevel@tonic-gate const ACE4_DELETE_CHILD		= 0x00000040;
274*7c478bd9Sstevel@tonic-gate const ACE4_READ_ATTRIBUTES	= 0x00000080;
275*7c478bd9Sstevel@tonic-gate const ACE4_WRITE_ATTRIBUTES	= 0x00000100;
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate const ACE4_DELETE		= 0x00010000;
278*7c478bd9Sstevel@tonic-gate const ACE4_READ_ACL		= 0x00020000;
279*7c478bd9Sstevel@tonic-gate const ACE4_WRITE_ACL		= 0x00040000;
280*7c478bd9Sstevel@tonic-gate const ACE4_WRITE_OWNER		= 0x00080000;
281*7c478bd9Sstevel@tonic-gate const ACE4_SYNCHRONIZE		= 0x00100000;
282*7c478bd9Sstevel@tonic-gate 
283*7c478bd9Sstevel@tonic-gate /*
284*7c478bd9Sstevel@tonic-gate  * ACE4_GENERIC_READ -- defined as combination of
285*7c478bd9Sstevel@tonic-gate  *	ACE4_READ_ACL |
286*7c478bd9Sstevel@tonic-gate  *	ACE4_READ_DATA |
287*7c478bd9Sstevel@tonic-gate  *	ACE4_READ_ATTRIBUTES |
288*7c478bd9Sstevel@tonic-gate  *	ACE4_SYNCHRONIZE
289*7c478bd9Sstevel@tonic-gate  */
290*7c478bd9Sstevel@tonic-gate 
291*7c478bd9Sstevel@tonic-gate const ACE4_GENERIC_READ	= 0x00120081;
292*7c478bd9Sstevel@tonic-gate 
293*7c478bd9Sstevel@tonic-gate /*
294*7c478bd9Sstevel@tonic-gate  * ACE4_GENERIC_WRITE -- defined as combination of
295*7c478bd9Sstevel@tonic-gate  *	ACE4_READ_ACL |
296*7c478bd9Sstevel@tonic-gate  *	ACE4_WRITE_DATA |
297*7c478bd9Sstevel@tonic-gate  *	ACE4_WRITE_ATTRIBUTES |
298*7c478bd9Sstevel@tonic-gate  *	ACE4_WRITE_ACL |
299*7c478bd9Sstevel@tonic-gate  *	ACE4_APPEND_DATA |
300*7c478bd9Sstevel@tonic-gate  *	ACE4_SYNCHRONIZE
301*7c478bd9Sstevel@tonic-gate  */
302*7c478bd9Sstevel@tonic-gate const ACE4_GENERIC_WRITE = 0x00160106;
303*7c478bd9Sstevel@tonic-gate 
304*7c478bd9Sstevel@tonic-gate 
305*7c478bd9Sstevel@tonic-gate /*
306*7c478bd9Sstevel@tonic-gate  * ACE4_GENERIC_EXECUTE -- defined as combination of
307*7c478bd9Sstevel@tonic-gate  *	ACE4_READ_ACL
308*7c478bd9Sstevel@tonic-gate  *	ACE4_READ_ATTRIBUTES
309*7c478bd9Sstevel@tonic-gate  *	ACE4_EXECUTE
310*7c478bd9Sstevel@tonic-gate  *	ACE4_SYNCHRONIZE
311*7c478bd9Sstevel@tonic-gate  */
312*7c478bd9Sstevel@tonic-gate const ACE4_GENERIC_EXECUTE = 0x001200A0;
313*7c478bd9Sstevel@tonic-gate 
314*7c478bd9Sstevel@tonic-gate 
315*7c478bd9Sstevel@tonic-gate /*
316*7c478bd9Sstevel@tonic-gate  * Access Control Entry definition
317*7c478bd9Sstevel@tonic-gate  */
318*7c478bd9Sstevel@tonic-gate struct nfsace4 {
319*7c478bd9Sstevel@tonic-gate 	acetype4	type;
320*7c478bd9Sstevel@tonic-gate 	aceflag4	flag;
321*7c478bd9Sstevel@tonic-gate 	acemask4	access_mask;
322*7c478bd9Sstevel@tonic-gate 	utf8str_mixed	who;
323*7c478bd9Sstevel@tonic-gate };
324*7c478bd9Sstevel@tonic-gate 
325*7c478bd9Sstevel@tonic-gate /*
326*7c478bd9Sstevel@tonic-gate  * Field definitions for the fattr4_mode attribute
327*7c478bd9Sstevel@tonic-gate  */
328*7c478bd9Sstevel@tonic-gate const MODE4_SUID = 0x800;  /* set user id on execution */
329*7c478bd9Sstevel@tonic-gate const MODE4_SGID = 0x400;  /* set group id on execution */
330*7c478bd9Sstevel@tonic-gate const MODE4_SVTX = 0x200;  /* save text even after use */
331*7c478bd9Sstevel@tonic-gate const MODE4_RUSR = 0x100;  /* read permission: owner */
332*7c478bd9Sstevel@tonic-gate const MODE4_WUSR = 0x080;  /* write permission: owner */
333*7c478bd9Sstevel@tonic-gate const MODE4_XUSR = 0x040;  /* execute permission: owner */
334*7c478bd9Sstevel@tonic-gate const MODE4_RGRP = 0x020;  /* read permission: group */
335*7c478bd9Sstevel@tonic-gate const MODE4_WGRP = 0x010;  /* write permission: group */
336*7c478bd9Sstevel@tonic-gate const MODE4_XGRP = 0x008;  /* execute permission: group */
337*7c478bd9Sstevel@tonic-gate const MODE4_ROTH = 0x004;  /* read permission: other */
338*7c478bd9Sstevel@tonic-gate const MODE4_WOTH = 0x002;  /* write permission: other */
339*7c478bd9Sstevel@tonic-gate const MODE4_XOTH = 0x001;  /* execute permission: other */
340*7c478bd9Sstevel@tonic-gate 
341*7c478bd9Sstevel@tonic-gate /*
342*7c478bd9Sstevel@tonic-gate  * Special data/attribute associated with
343*7c478bd9Sstevel@tonic-gate  * file types NF4BLK and NF4CHR.
344*7c478bd9Sstevel@tonic-gate  */
345*7c478bd9Sstevel@tonic-gate struct specdata4 {
346*7c478bd9Sstevel@tonic-gate 	uint32_t	specdata1;	/* major device number */
347*7c478bd9Sstevel@tonic-gate 	uint32_t	specdata2;	/* minor device number */
348*7c478bd9Sstevel@tonic-gate };
349*7c478bd9Sstevel@tonic-gate 
350*7c478bd9Sstevel@tonic-gate /*
351*7c478bd9Sstevel@tonic-gate  * Values for fattr4_fh_expire_type
352*7c478bd9Sstevel@tonic-gate  */
353*7c478bd9Sstevel@tonic-gate const	FH4_PERSISTENT		= 0x00000000;
354*7c478bd9Sstevel@tonic-gate const	FH4_NOEXPIRE_WITH_OPEN	= 0x00000001;
355*7c478bd9Sstevel@tonic-gate const	FH4_VOLATILE_ANY	= 0x00000002;
356*7c478bd9Sstevel@tonic-gate const	FH4_VOL_MIGRATION	= 0x00000004;
357*7c478bd9Sstevel@tonic-gate const	FH4_VOL_RENAME		= 0x00000008;
358*7c478bd9Sstevel@tonic-gate 
359*7c478bd9Sstevel@tonic-gate 
360*7c478bd9Sstevel@tonic-gate typedef bitmap4		fattr4_supported_attrs;
361*7c478bd9Sstevel@tonic-gate typedef nfs_ftype4	fattr4_type;
362*7c478bd9Sstevel@tonic-gate typedef	uint32_t	fattr4_fh_expire_type;
363*7c478bd9Sstevel@tonic-gate typedef	changeid4	fattr4_change;
364*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_size;
365*7c478bd9Sstevel@tonic-gate typedef	bool		fattr4_link_support;
366*7c478bd9Sstevel@tonic-gate typedef	bool		fattr4_symlink_support;
367*7c478bd9Sstevel@tonic-gate typedef bool		fattr4_named_attr;
368*7c478bd9Sstevel@tonic-gate typedef fsid4		fattr4_fsid;
369*7c478bd9Sstevel@tonic-gate typedef	bool		fattr4_unique_handles;
370*7c478bd9Sstevel@tonic-gate typedef uint32_t	fattr4_lease_time;
371*7c478bd9Sstevel@tonic-gate typedef	nfsstat4	fattr4_rdattr_error;
372*7c478bd9Sstevel@tonic-gate 
373*7c478bd9Sstevel@tonic-gate typedef nfsace4		fattr4_acl<>;
374*7c478bd9Sstevel@tonic-gate typedef uint32_t	fattr4_aclsupport;
375*7c478bd9Sstevel@tonic-gate typedef	bool		fattr4_archive;
376*7c478bd9Sstevel@tonic-gate typedef	bool		fattr4_cansettime;
377*7c478bd9Sstevel@tonic-gate typedef	bool		fattr4_case_insensitive;
378*7c478bd9Sstevel@tonic-gate typedef	bool		fattr4_case_preserving;
379*7c478bd9Sstevel@tonic-gate typedef	bool		fattr4_chown_restricted;
380*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_fileid;
381*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_files_avail;
382*7c478bd9Sstevel@tonic-gate typedef nfs_fh4		fattr4_filehandle;
383*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_files_free;
384*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_files_total;
385*7c478bd9Sstevel@tonic-gate typedef fs_locations4	fattr4_fs_locations;
386*7c478bd9Sstevel@tonic-gate typedef bool		fattr4_hidden;
387*7c478bd9Sstevel@tonic-gate typedef bool		fattr4_homogeneous;
388*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_maxfilesize;
389*7c478bd9Sstevel@tonic-gate typedef uint32_t	fattr4_maxlink;
390*7c478bd9Sstevel@tonic-gate typedef uint32_t	fattr4_maxname;
391*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_maxread;
392*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_maxwrite;
393*7c478bd9Sstevel@tonic-gate typedef	utf8str_cs	fattr4_mimetype;
394*7c478bd9Sstevel@tonic-gate typedef mode4		fattr4_mode;
395*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_mounted_on_fileid;
396*7c478bd9Sstevel@tonic-gate typedef	bool		fattr4_no_trunc;
397*7c478bd9Sstevel@tonic-gate typedef	uint32_t	fattr4_numlinks;
398*7c478bd9Sstevel@tonic-gate typedef	utf8str_mixed	fattr4_owner;
399*7c478bd9Sstevel@tonic-gate typedef	utf8str_mixed	fattr4_owner_group;
400*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_quota_avail_hard;
401*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_quota_avail_soft;
402*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_quota_used;
403*7c478bd9Sstevel@tonic-gate typedef specdata4	fattr4_rawdev;
404*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_space_avail;
405*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_space_free;
406*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_space_total;
407*7c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_space_used;
408*7c478bd9Sstevel@tonic-gate typedef bool		fattr4_system;
409*7c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_access;
410*7c478bd9Sstevel@tonic-gate typedef settime4	fattr4_time_access_set;
411*7c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_backup;
412*7c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_create;
413*7c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_delta;
414*7c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_metadata;
415*7c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_modify;
416*7c478bd9Sstevel@tonic-gate typedef settime4	fattr4_time_modify_set;
417*7c478bd9Sstevel@tonic-gate 
418*7c478bd9Sstevel@tonic-gate 
419*7c478bd9Sstevel@tonic-gate /*
420*7c478bd9Sstevel@tonic-gate  * Mandatory Attributes
421*7c478bd9Sstevel@tonic-gate  */
422*7c478bd9Sstevel@tonic-gate const FATTR4_SUPPORTED_ATTRS	= 0;
423*7c478bd9Sstevel@tonic-gate const FATTR4_TYPE		= 1;
424*7c478bd9Sstevel@tonic-gate const FATTR4_FH_EXPIRE_TYPE	= 2;
425*7c478bd9Sstevel@tonic-gate const FATTR4_CHANGE		= 3;
426*7c478bd9Sstevel@tonic-gate const FATTR4_SIZE		= 4;
427*7c478bd9Sstevel@tonic-gate const FATTR4_LINK_SUPPORT	= 5;
428*7c478bd9Sstevel@tonic-gate const FATTR4_SYMLINK_SUPPORT	= 6;
429*7c478bd9Sstevel@tonic-gate const FATTR4_NAMED_ATTR		= 7;
430*7c478bd9Sstevel@tonic-gate const FATTR4_FSID		= 8;
431*7c478bd9Sstevel@tonic-gate const FATTR4_UNIQUE_HANDLES	= 9;
432*7c478bd9Sstevel@tonic-gate const FATTR4_LEASE_TIME		= 10;
433*7c478bd9Sstevel@tonic-gate const FATTR4_RDATTR_ERROR	= 11;
434*7c478bd9Sstevel@tonic-gate const FATTR4_FILEHANDLE		= 19;
435*7c478bd9Sstevel@tonic-gate 
436*7c478bd9Sstevel@tonic-gate /*
437*7c478bd9Sstevel@tonic-gate  * Recommended Attributes
438*7c478bd9Sstevel@tonic-gate  */
439*7c478bd9Sstevel@tonic-gate const FATTR4_ACL		= 12;
440*7c478bd9Sstevel@tonic-gate const FATTR4_ACLSUPPORT		= 13;
441*7c478bd9Sstevel@tonic-gate const FATTR4_ARCHIVE		= 14;
442*7c478bd9Sstevel@tonic-gate const FATTR4_CANSETTIME		= 15;
443*7c478bd9Sstevel@tonic-gate const FATTR4_CASE_INSENSITIVE	= 16;
444*7c478bd9Sstevel@tonic-gate const FATTR4_CASE_PRESERVING	= 17;
445*7c478bd9Sstevel@tonic-gate const FATTR4_CHOWN_RESTRICTED	= 18;
446*7c478bd9Sstevel@tonic-gate const FATTR4_FILEID		= 20;
447*7c478bd9Sstevel@tonic-gate const FATTR4_FILES_AVAIL	= 21;
448*7c478bd9Sstevel@tonic-gate const FATTR4_FILES_FREE		= 22;
449*7c478bd9Sstevel@tonic-gate const FATTR4_FILES_TOTAL	= 23;
450*7c478bd9Sstevel@tonic-gate const FATTR4_FS_LOCATIONS	= 24;
451*7c478bd9Sstevel@tonic-gate const FATTR4_HIDDEN		= 25;
452*7c478bd9Sstevel@tonic-gate const FATTR4_HOMOGENEOUS	= 26;
453*7c478bd9Sstevel@tonic-gate const FATTR4_MAXFILESIZE	= 27;
454*7c478bd9Sstevel@tonic-gate const FATTR4_MAXLINK		= 28;
455*7c478bd9Sstevel@tonic-gate const FATTR4_MAXNAME		= 29;
456*7c478bd9Sstevel@tonic-gate const FATTR4_MAXREAD		= 30;
457*7c478bd9Sstevel@tonic-gate const FATTR4_MAXWRITE		= 31;
458*7c478bd9Sstevel@tonic-gate const FATTR4_MIMETYPE		= 32;
459*7c478bd9Sstevel@tonic-gate const FATTR4_MODE		= 33;
460*7c478bd9Sstevel@tonic-gate const FATTR4_NO_TRUNC		= 34;
461*7c478bd9Sstevel@tonic-gate const FATTR4_NUMLINKS		= 35;
462*7c478bd9Sstevel@tonic-gate const FATTR4_OWNER		= 36;
463*7c478bd9Sstevel@tonic-gate const FATTR4_OWNER_GROUP	= 37;
464*7c478bd9Sstevel@tonic-gate const FATTR4_QUOTA_AVAIL_HARD	= 38;
465*7c478bd9Sstevel@tonic-gate const FATTR4_QUOTA_AVAIL_SOFT	= 39;
466*7c478bd9Sstevel@tonic-gate const FATTR4_QUOTA_USED		= 40;
467*7c478bd9Sstevel@tonic-gate const FATTR4_RAWDEV		= 41;
468*7c478bd9Sstevel@tonic-gate const FATTR4_SPACE_AVAIL	= 42;
469*7c478bd9Sstevel@tonic-gate const FATTR4_SPACE_FREE		= 43;
470*7c478bd9Sstevel@tonic-gate const FATTR4_SPACE_TOTAL	= 44;
471*7c478bd9Sstevel@tonic-gate const FATTR4_SPACE_USED		= 45;
472*7c478bd9Sstevel@tonic-gate const FATTR4_SYSTEM		= 46;
473*7c478bd9Sstevel@tonic-gate const FATTR4_TIME_ACCESS	= 47;
474*7c478bd9Sstevel@tonic-gate const FATTR4_TIME_ACCESS_SET	= 48;
475*7c478bd9Sstevel@tonic-gate const FATTR4_TIME_BACKUP	= 49;
476*7c478bd9Sstevel@tonic-gate const FATTR4_TIME_CREATE	= 50;
477*7c478bd9Sstevel@tonic-gate const FATTR4_TIME_DELTA		= 51;
478*7c478bd9Sstevel@tonic-gate const FATTR4_TIME_METADATA	= 52;
479*7c478bd9Sstevel@tonic-gate const FATTR4_TIME_MODIFY	= 53;
480*7c478bd9Sstevel@tonic-gate const FATTR4_TIME_MODIFY_SET	= 54;
481*7c478bd9Sstevel@tonic-gate const FATTR4_MOUNTED_ON_FILEID	= 55;
482*7c478bd9Sstevel@tonic-gate 
483*7c478bd9Sstevel@tonic-gate typedef	opaque	attrlist4<>;
484*7c478bd9Sstevel@tonic-gate 
485*7c478bd9Sstevel@tonic-gate /*
486*7c478bd9Sstevel@tonic-gate  * File attribute container
487*7c478bd9Sstevel@tonic-gate  */
488*7c478bd9Sstevel@tonic-gate struct fattr4 {
489*7c478bd9Sstevel@tonic-gate 	bitmap4		attrmask;
490*7c478bd9Sstevel@tonic-gate 	attrlist4	attr_vals;
491*7c478bd9Sstevel@tonic-gate };
492*7c478bd9Sstevel@tonic-gate 
493*7c478bd9Sstevel@tonic-gate /*
494*7c478bd9Sstevel@tonic-gate  * Change info for the client
495*7c478bd9Sstevel@tonic-gate  */
496*7c478bd9Sstevel@tonic-gate struct change_info4 {
497*7c478bd9Sstevel@tonic-gate 	bool		atomic;
498*7c478bd9Sstevel@tonic-gate 	changeid4	before;
499*7c478bd9Sstevel@tonic-gate 	changeid4	after;
500*7c478bd9Sstevel@tonic-gate };
501*7c478bd9Sstevel@tonic-gate 
502*7c478bd9Sstevel@tonic-gate struct clientaddr4 {
503*7c478bd9Sstevel@tonic-gate 	/* see struct rpcb in RFC 1833 */
504*7c478bd9Sstevel@tonic-gate 	string r_netid<>;		/* network id */
505*7c478bd9Sstevel@tonic-gate 	string r_addr<>;		/* universal address */
506*7c478bd9Sstevel@tonic-gate };
507*7c478bd9Sstevel@tonic-gate 
508*7c478bd9Sstevel@tonic-gate /*
509*7c478bd9Sstevel@tonic-gate  * Callback program info as provided by the client
510*7c478bd9Sstevel@tonic-gate  */
511*7c478bd9Sstevel@tonic-gate struct cb_client4 {
512*7c478bd9Sstevel@tonic-gate 	uint32_t	cb_program;
513*7c478bd9Sstevel@tonic-gate 	clientaddr4	cb_location;
514*7c478bd9Sstevel@tonic-gate };
515*7c478bd9Sstevel@tonic-gate 
516*7c478bd9Sstevel@tonic-gate /*
517*7c478bd9Sstevel@tonic-gate  * Stateid
518*7c478bd9Sstevel@tonic-gate  */
519*7c478bd9Sstevel@tonic-gate struct stateid4 {
520*7c478bd9Sstevel@tonic-gate 	uint32_t	seqid;
521*7c478bd9Sstevel@tonic-gate 	opaque		other[12];
522*7c478bd9Sstevel@tonic-gate };
523*7c478bd9Sstevel@tonic-gate 
524*7c478bd9Sstevel@tonic-gate /*
525*7c478bd9Sstevel@tonic-gate  * Client ID
526*7c478bd9Sstevel@tonic-gate  */
527*7c478bd9Sstevel@tonic-gate struct nfs_client_id4 {
528*7c478bd9Sstevel@tonic-gate 	verifier4	verifier;
529*7c478bd9Sstevel@tonic-gate 	opaque		id<NFS4_OPAQUE_LIMIT>;
530*7c478bd9Sstevel@tonic-gate };
531*7c478bd9Sstevel@tonic-gate 
532*7c478bd9Sstevel@tonic-gate struct open_owner4 {
533*7c478bd9Sstevel@tonic-gate 	clientid4	clientid;
534*7c478bd9Sstevel@tonic-gate 	opaque		owner<NFS4_OPAQUE_LIMIT>;
535*7c478bd9Sstevel@tonic-gate };
536*7c478bd9Sstevel@tonic-gate 
537*7c478bd9Sstevel@tonic-gate struct lock_owner4 {
538*7c478bd9Sstevel@tonic-gate 	clientid4	clientid;
539*7c478bd9Sstevel@tonic-gate 	opaque		owner<NFS4_OPAQUE_LIMIT>;
540*7c478bd9Sstevel@tonic-gate };
541*7c478bd9Sstevel@tonic-gate 
542*7c478bd9Sstevel@tonic-gate enum nfs_lock_type4 {
543*7c478bd9Sstevel@tonic-gate 	READ_LT		= 1,
544*7c478bd9Sstevel@tonic-gate 	WRITE_LT	= 2,
545*7c478bd9Sstevel@tonic-gate 	READW_LT	= 3,	/* blocking read */
546*7c478bd9Sstevel@tonic-gate 	WRITEW_LT	= 4	/* blocking write */
547*7c478bd9Sstevel@tonic-gate };
548*7c478bd9Sstevel@tonic-gate 
549*7c478bd9Sstevel@tonic-gate /*
550*7c478bd9Sstevel@tonic-gate  * ACCESS: Check access permission
551*7c478bd9Sstevel@tonic-gate  */
552*7c478bd9Sstevel@tonic-gate const ACCESS4_READ	= 0x00000001;
553*7c478bd9Sstevel@tonic-gate const ACCESS4_LOOKUP	= 0x00000002;
554*7c478bd9Sstevel@tonic-gate const ACCESS4_MODIFY	= 0x00000004;
555*7c478bd9Sstevel@tonic-gate const ACCESS4_EXTEND	= 0x00000008;
556*7c478bd9Sstevel@tonic-gate const ACCESS4_DELETE	= 0x00000010;
557*7c478bd9Sstevel@tonic-gate const ACCESS4_EXECUTE	= 0x00000020;
558*7c478bd9Sstevel@tonic-gate 
559*7c478bd9Sstevel@tonic-gate struct ACCESS4args {
560*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
561*7c478bd9Sstevel@tonic-gate 	uint32_t	access;
562*7c478bd9Sstevel@tonic-gate };
563*7c478bd9Sstevel@tonic-gate 
564*7c478bd9Sstevel@tonic-gate struct ACCESS4resok {
565*7c478bd9Sstevel@tonic-gate 	uint32_t	supported;
566*7c478bd9Sstevel@tonic-gate 	uint32_t	access;
567*7c478bd9Sstevel@tonic-gate };
568*7c478bd9Sstevel@tonic-gate 
569*7c478bd9Sstevel@tonic-gate union ACCESS4res switch (nfsstat4 status) {
570*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
571*7c478bd9Sstevel@tonic-gate 	 ACCESS4resok	resok4;
572*7c478bd9Sstevel@tonic-gate  default:
573*7c478bd9Sstevel@tonic-gate 	 void;
574*7c478bd9Sstevel@tonic-gate };
575*7c478bd9Sstevel@tonic-gate 
576*7c478bd9Sstevel@tonic-gate /*
577*7c478bd9Sstevel@tonic-gate  * CLOSE: Close a file and release share reservations
578*7c478bd9Sstevel@tonic-gate  */
579*7c478bd9Sstevel@tonic-gate struct CLOSE4args {
580*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
581*7c478bd9Sstevel@tonic-gate 	seqid4		seqid;
582*7c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
583*7c478bd9Sstevel@tonic-gate };
584*7c478bd9Sstevel@tonic-gate 
585*7c478bd9Sstevel@tonic-gate union CLOSE4res switch (nfsstat4 status) {
586*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
587*7c478bd9Sstevel@tonic-gate 	 stateid4	open_stateid;
588*7c478bd9Sstevel@tonic-gate  default:
589*7c478bd9Sstevel@tonic-gate 	 void;
590*7c478bd9Sstevel@tonic-gate };
591*7c478bd9Sstevel@tonic-gate 
592*7c478bd9Sstevel@tonic-gate /*
593*7c478bd9Sstevel@tonic-gate  * COMMIT: Commit cached data on server to stable storage
594*7c478bd9Sstevel@tonic-gate  */
595*7c478bd9Sstevel@tonic-gate struct COMMIT4args {
596*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
597*7c478bd9Sstevel@tonic-gate 	offset4		offset;
598*7c478bd9Sstevel@tonic-gate 	count4		count;
599*7c478bd9Sstevel@tonic-gate };
600*7c478bd9Sstevel@tonic-gate 
601*7c478bd9Sstevel@tonic-gate struct COMMIT4resok {
602*7c478bd9Sstevel@tonic-gate 	verifier4	writeverf;
603*7c478bd9Sstevel@tonic-gate };
604*7c478bd9Sstevel@tonic-gate 
605*7c478bd9Sstevel@tonic-gate 
606*7c478bd9Sstevel@tonic-gate union COMMIT4res switch (nfsstat4 status) {
607*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
608*7c478bd9Sstevel@tonic-gate 	 COMMIT4resok	resok4;
609*7c478bd9Sstevel@tonic-gate  default:
610*7c478bd9Sstevel@tonic-gate 	 void;
611*7c478bd9Sstevel@tonic-gate };
612*7c478bd9Sstevel@tonic-gate 
613*7c478bd9Sstevel@tonic-gate /*
614*7c478bd9Sstevel@tonic-gate  * CREATE: Create a non-regular file
615*7c478bd9Sstevel@tonic-gate  */
616*7c478bd9Sstevel@tonic-gate union createtype4 switch (nfs_ftype4 type) {
617*7c478bd9Sstevel@tonic-gate  case NF4LNK:
618*7c478bd9Sstevel@tonic-gate 	 linktext4	linkdata;
619*7c478bd9Sstevel@tonic-gate  case NF4BLK:
620*7c478bd9Sstevel@tonic-gate  case NF4CHR:
621*7c478bd9Sstevel@tonic-gate 	 specdata4	devdata;
622*7c478bd9Sstevel@tonic-gate  case NF4SOCK:
623*7c478bd9Sstevel@tonic-gate  case NF4FIFO:
624*7c478bd9Sstevel@tonic-gate  case NF4DIR:
625*7c478bd9Sstevel@tonic-gate 	 void;
626*7c478bd9Sstevel@tonic-gate  default:
627*7c478bd9Sstevel@tonic-gate 	 void;		/* server should return NFS4ERR_BADTYPE */
628*7c478bd9Sstevel@tonic-gate };
629*7c478bd9Sstevel@tonic-gate 
630*7c478bd9Sstevel@tonic-gate struct CREATE4args {
631*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory for creation */
632*7c478bd9Sstevel@tonic-gate 	createtype4	objtype;
633*7c478bd9Sstevel@tonic-gate 	component4	objname;
634*7c478bd9Sstevel@tonic-gate 	fattr4		createattrs;
635*7c478bd9Sstevel@tonic-gate };
636*7c478bd9Sstevel@tonic-gate 
637*7c478bd9Sstevel@tonic-gate struct CREATE4resok {
638*7c478bd9Sstevel@tonic-gate 	change_info4	cinfo;
639*7c478bd9Sstevel@tonic-gate 	bitmap4		attrset;	/* attributes set */
640*7c478bd9Sstevel@tonic-gate };
641*7c478bd9Sstevel@tonic-gate 
642*7c478bd9Sstevel@tonic-gate union CREATE4res switch (nfsstat4 status) {
643*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
644*7c478bd9Sstevel@tonic-gate 	 CREATE4resok resok4;
645*7c478bd9Sstevel@tonic-gate  default:
646*7c478bd9Sstevel@tonic-gate 	 void;
647*7c478bd9Sstevel@tonic-gate };
648*7c478bd9Sstevel@tonic-gate 
649*7c478bd9Sstevel@tonic-gate /*
650*7c478bd9Sstevel@tonic-gate  * DELEGPURGE: Purge Delegations Awaiting Recovery
651*7c478bd9Sstevel@tonic-gate  */
652*7c478bd9Sstevel@tonic-gate struct DELEGPURGE4args {
653*7c478bd9Sstevel@tonic-gate 	clientid4	clientid;
654*7c478bd9Sstevel@tonic-gate };
655*7c478bd9Sstevel@tonic-gate 
656*7c478bd9Sstevel@tonic-gate struct DELEGPURGE4res {
657*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
658*7c478bd9Sstevel@tonic-gate };
659*7c478bd9Sstevel@tonic-gate 
660*7c478bd9Sstevel@tonic-gate /*
661*7c478bd9Sstevel@tonic-gate  * DELEGRETURN: Return a delegation
662*7c478bd9Sstevel@tonic-gate  */
663*7c478bd9Sstevel@tonic-gate struct DELEGRETURN4args {
664*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: delegated file */
665*7c478bd9Sstevel@tonic-gate 	stateid4	deleg_stateid;
666*7c478bd9Sstevel@tonic-gate };
667*7c478bd9Sstevel@tonic-gate 
668*7c478bd9Sstevel@tonic-gate struct DELEGRETURN4res {
669*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
670*7c478bd9Sstevel@tonic-gate };
671*7c478bd9Sstevel@tonic-gate 
672*7c478bd9Sstevel@tonic-gate /*
673*7c478bd9Sstevel@tonic-gate  * GETATTR: Get file attributes
674*7c478bd9Sstevel@tonic-gate  */
675*7c478bd9Sstevel@tonic-gate struct GETATTR4args {
676*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory or file */
677*7c478bd9Sstevel@tonic-gate 	bitmap4		attr_request;
678*7c478bd9Sstevel@tonic-gate };
679*7c478bd9Sstevel@tonic-gate 
680*7c478bd9Sstevel@tonic-gate struct GETATTR4resok {
681*7c478bd9Sstevel@tonic-gate 	fattr4		obj_attributes;
682*7c478bd9Sstevel@tonic-gate };
683*7c478bd9Sstevel@tonic-gate 
684*7c478bd9Sstevel@tonic-gate union GETATTR4res switch (nfsstat4 status) {
685*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
686*7c478bd9Sstevel@tonic-gate 	 GETATTR4resok	resok4;
687*7c478bd9Sstevel@tonic-gate  default:
688*7c478bd9Sstevel@tonic-gate 	 void;
689*7c478bd9Sstevel@tonic-gate };
690*7c478bd9Sstevel@tonic-gate 
691*7c478bd9Sstevel@tonic-gate /*
692*7c478bd9Sstevel@tonic-gate  * GETFH: Get current filehandle
693*7c478bd9Sstevel@tonic-gate  */
694*7c478bd9Sstevel@tonic-gate struct GETFH4resok {
695*7c478bd9Sstevel@tonic-gate 	nfs_fh4		object;
696*7c478bd9Sstevel@tonic-gate };
697*7c478bd9Sstevel@tonic-gate 
698*7c478bd9Sstevel@tonic-gate union GETFH4res switch (nfsstat4 status) {
699*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
700*7c478bd9Sstevel@tonic-gate 	GETFH4resok	resok4;
701*7c478bd9Sstevel@tonic-gate  default:
702*7c478bd9Sstevel@tonic-gate 	void;
703*7c478bd9Sstevel@tonic-gate };
704*7c478bd9Sstevel@tonic-gate 
705*7c478bd9Sstevel@tonic-gate /*
706*7c478bd9Sstevel@tonic-gate  * LINK: Create link to an object
707*7c478bd9Sstevel@tonic-gate  */
708*7c478bd9Sstevel@tonic-gate struct LINK4args {
709*7c478bd9Sstevel@tonic-gate 	/* SAVED_FH: source object */
710*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: target directory */
711*7c478bd9Sstevel@tonic-gate 	component4	newname;
712*7c478bd9Sstevel@tonic-gate };
713*7c478bd9Sstevel@tonic-gate 
714*7c478bd9Sstevel@tonic-gate struct LINK4resok {
715*7c478bd9Sstevel@tonic-gate 	change_info4	cinfo;
716*7c478bd9Sstevel@tonic-gate };
717*7c478bd9Sstevel@tonic-gate 
718*7c478bd9Sstevel@tonic-gate union LINK4res switch (nfsstat4 status) {
719*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
720*7c478bd9Sstevel@tonic-gate 	 LINK4resok resok4;
721*7c478bd9Sstevel@tonic-gate  default:
722*7c478bd9Sstevel@tonic-gate 	 void;
723*7c478bd9Sstevel@tonic-gate };
724*7c478bd9Sstevel@tonic-gate 
725*7c478bd9Sstevel@tonic-gate /*
726*7c478bd9Sstevel@tonic-gate  * For LOCK, transition from open_owner to new lock_owner
727*7c478bd9Sstevel@tonic-gate  */
728*7c478bd9Sstevel@tonic-gate struct open_to_lock_owner4 {
729*7c478bd9Sstevel@tonic-gate 	seqid4		open_seqid;
730*7c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
731*7c478bd9Sstevel@tonic-gate 	seqid4		lock_seqid;
732*7c478bd9Sstevel@tonic-gate 	lock_owner4	lock_owner;
733*7c478bd9Sstevel@tonic-gate };
734*7c478bd9Sstevel@tonic-gate 
735*7c478bd9Sstevel@tonic-gate /*
736*7c478bd9Sstevel@tonic-gate  * For LOCK, existing lock_owner continues to request file locks
737*7c478bd9Sstevel@tonic-gate  */
738*7c478bd9Sstevel@tonic-gate struct exist_lock_owner4 {
739*7c478bd9Sstevel@tonic-gate 	stateid4	lock_stateid;
740*7c478bd9Sstevel@tonic-gate 	seqid4		lock_seqid;
741*7c478bd9Sstevel@tonic-gate };
742*7c478bd9Sstevel@tonic-gate 
743*7c478bd9Sstevel@tonic-gate union locker4 switch (bool new_lock_owner) {
744*7c478bd9Sstevel@tonic-gate  case TRUE:
745*7c478bd9Sstevel@tonic-gate 	open_to_lock_owner4	open_owner;
746*7c478bd9Sstevel@tonic-gate  case FALSE:
747*7c478bd9Sstevel@tonic-gate 	exist_lock_owner4	lock_owner;
748*7c478bd9Sstevel@tonic-gate };
749*7c478bd9Sstevel@tonic-gate 
750*7c478bd9Sstevel@tonic-gate /*
751*7c478bd9Sstevel@tonic-gate  * LOCK/LOCKT/LOCKU: Record lock management
752*7c478bd9Sstevel@tonic-gate  */
753*7c478bd9Sstevel@tonic-gate struct LOCK4args {
754*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
755*7c478bd9Sstevel@tonic-gate 	nfs_lock_type4	locktype;
756*7c478bd9Sstevel@tonic-gate 	bool		reclaim;
757*7c478bd9Sstevel@tonic-gate 	offset4		offset;
758*7c478bd9Sstevel@tonic-gate 	length4		length;
759*7c478bd9Sstevel@tonic-gate 	locker4		locker;
760*7c478bd9Sstevel@tonic-gate };
761*7c478bd9Sstevel@tonic-gate 
762*7c478bd9Sstevel@tonic-gate struct LOCK4denied {
763*7c478bd9Sstevel@tonic-gate 	offset4		offset;
764*7c478bd9Sstevel@tonic-gate 	length4		length;
765*7c478bd9Sstevel@tonic-gate 	nfs_lock_type4	locktype;
766*7c478bd9Sstevel@tonic-gate 	lock_owner4	owner;
767*7c478bd9Sstevel@tonic-gate };
768*7c478bd9Sstevel@tonic-gate 
769*7c478bd9Sstevel@tonic-gate struct LOCK4resok {
770*7c478bd9Sstevel@tonic-gate 	stateid4	lock_stateid;
771*7c478bd9Sstevel@tonic-gate };
772*7c478bd9Sstevel@tonic-gate 
773*7c478bd9Sstevel@tonic-gate union LOCK4res switch (nfsstat4 status) {
774*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
775*7c478bd9Sstevel@tonic-gate 	 LOCK4resok	resok4;
776*7c478bd9Sstevel@tonic-gate  case NFS4ERR_DENIED:
777*7c478bd9Sstevel@tonic-gate 	 LOCK4denied	denied;
778*7c478bd9Sstevel@tonic-gate  default:
779*7c478bd9Sstevel@tonic-gate 	 void;
780*7c478bd9Sstevel@tonic-gate };
781*7c478bd9Sstevel@tonic-gate 
782*7c478bd9Sstevel@tonic-gate struct LOCKT4args {
783*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
784*7c478bd9Sstevel@tonic-gate 	nfs_lock_type4	locktype;
785*7c478bd9Sstevel@tonic-gate 	offset4		offset;
786*7c478bd9Sstevel@tonic-gate 	length4		length;
787*7c478bd9Sstevel@tonic-gate 	lock_owner4	owner;
788*7c478bd9Sstevel@tonic-gate };
789*7c478bd9Sstevel@tonic-gate 
790*7c478bd9Sstevel@tonic-gate union LOCKT4res switch (nfsstat4 status) {
791*7c478bd9Sstevel@tonic-gate  case NFS4ERR_DENIED:
792*7c478bd9Sstevel@tonic-gate 	 LOCK4denied	denied;
793*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
794*7c478bd9Sstevel@tonic-gate 	 void;
795*7c478bd9Sstevel@tonic-gate  default:
796*7c478bd9Sstevel@tonic-gate 	 void;
797*7c478bd9Sstevel@tonic-gate };
798*7c478bd9Sstevel@tonic-gate 
799*7c478bd9Sstevel@tonic-gate struct LOCKU4args {
800*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
801*7c478bd9Sstevel@tonic-gate 	nfs_lock_type4	locktype;
802*7c478bd9Sstevel@tonic-gate 	seqid4		seqid;
803*7c478bd9Sstevel@tonic-gate 	stateid4	lock_stateid;
804*7c478bd9Sstevel@tonic-gate 	offset4		offset;
805*7c478bd9Sstevel@tonic-gate 	length4		length;
806*7c478bd9Sstevel@tonic-gate };
807*7c478bd9Sstevel@tonic-gate 
808*7c478bd9Sstevel@tonic-gate union LOCKU4res switch (nfsstat4 status) {
809*7c478bd9Sstevel@tonic-gate  case	NFS4_OK:
810*7c478bd9Sstevel@tonic-gate 	 stateid4	lock_stateid;
811*7c478bd9Sstevel@tonic-gate  default:
812*7c478bd9Sstevel@tonic-gate 	 void;
813*7c478bd9Sstevel@tonic-gate };
814*7c478bd9Sstevel@tonic-gate 
815*7c478bd9Sstevel@tonic-gate /*
816*7c478bd9Sstevel@tonic-gate  * LOOKUP: Lookup filename
817*7c478bd9Sstevel@tonic-gate  */
818*7c478bd9Sstevel@tonic-gate struct LOOKUP4args {
819*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
820*7c478bd9Sstevel@tonic-gate 	component4	objname;
821*7c478bd9Sstevel@tonic-gate };
822*7c478bd9Sstevel@tonic-gate 
823*7c478bd9Sstevel@tonic-gate struct LOOKUP4res {
824*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
825*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
826*7c478bd9Sstevel@tonic-gate };
827*7c478bd9Sstevel@tonic-gate 
828*7c478bd9Sstevel@tonic-gate /*
829*7c478bd9Sstevel@tonic-gate  * LOOKUPP: Lookup parent directory
830*7c478bd9Sstevel@tonic-gate  */
831*7c478bd9Sstevel@tonic-gate struct LOOKUPP4res {
832*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
833*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
834*7c478bd9Sstevel@tonic-gate };
835*7c478bd9Sstevel@tonic-gate 
836*7c478bd9Sstevel@tonic-gate /*
837*7c478bd9Sstevel@tonic-gate  * NVERIFY: Verify attributes different
838*7c478bd9Sstevel@tonic-gate  */
839*7c478bd9Sstevel@tonic-gate struct NVERIFY4args {
840*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
841*7c478bd9Sstevel@tonic-gate 	fattr4		obj_attributes;
842*7c478bd9Sstevel@tonic-gate };
843*7c478bd9Sstevel@tonic-gate 
844*7c478bd9Sstevel@tonic-gate struct NVERIFY4res {
845*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
846*7c478bd9Sstevel@tonic-gate };
847*7c478bd9Sstevel@tonic-gate 
848*7c478bd9Sstevel@tonic-gate /*
849*7c478bd9Sstevel@tonic-gate  * Various definitions for OPEN
850*7c478bd9Sstevel@tonic-gate  */
851*7c478bd9Sstevel@tonic-gate enum createmode4 {
852*7c478bd9Sstevel@tonic-gate 	UNCHECKED4	= 0,
853*7c478bd9Sstevel@tonic-gate 	GUARDED4	= 1,
854*7c478bd9Sstevel@tonic-gate 	EXCLUSIVE4	= 2
855*7c478bd9Sstevel@tonic-gate };
856*7c478bd9Sstevel@tonic-gate 
857*7c478bd9Sstevel@tonic-gate union createhow4 switch (createmode4 mode) {
858*7c478bd9Sstevel@tonic-gate  case UNCHECKED4:
859*7c478bd9Sstevel@tonic-gate  case GUARDED4:
860*7c478bd9Sstevel@tonic-gate 	 fattr4		createattrs;
861*7c478bd9Sstevel@tonic-gate  case EXCLUSIVE4:
862*7c478bd9Sstevel@tonic-gate 	 verifier4	createverf;
863*7c478bd9Sstevel@tonic-gate };
864*7c478bd9Sstevel@tonic-gate 
865*7c478bd9Sstevel@tonic-gate enum opentype4 {
866*7c478bd9Sstevel@tonic-gate 	OPEN4_NOCREATE	= 0,
867*7c478bd9Sstevel@tonic-gate 	OPEN4_CREATE	= 1
868*7c478bd9Sstevel@tonic-gate };
869*7c478bd9Sstevel@tonic-gate 
870*7c478bd9Sstevel@tonic-gate union openflag4 switch (opentype4 opentype) {
871*7c478bd9Sstevel@tonic-gate  case OPEN4_CREATE:
872*7c478bd9Sstevel@tonic-gate 	 createhow4	how;
873*7c478bd9Sstevel@tonic-gate  default:
874*7c478bd9Sstevel@tonic-gate 	 void;
875*7c478bd9Sstevel@tonic-gate };
876*7c478bd9Sstevel@tonic-gate 
877*7c478bd9Sstevel@tonic-gate /* Next definitions used for OPEN delegation */
878*7c478bd9Sstevel@tonic-gate enum limit_by4 {
879*7c478bd9Sstevel@tonic-gate 	NFS_LIMIT_SIZE		= 1,
880*7c478bd9Sstevel@tonic-gate 	NFS_LIMIT_BLOCKS	= 2
881*7c478bd9Sstevel@tonic-gate 	/* others as needed */
882*7c478bd9Sstevel@tonic-gate };
883*7c478bd9Sstevel@tonic-gate 
884*7c478bd9Sstevel@tonic-gate struct nfs_modified_limit4 {
885*7c478bd9Sstevel@tonic-gate 	uint32_t	num_blocks;
886*7c478bd9Sstevel@tonic-gate 	uint32_t	bytes_per_block;
887*7c478bd9Sstevel@tonic-gate };
888*7c478bd9Sstevel@tonic-gate 
889*7c478bd9Sstevel@tonic-gate union nfs_space_limit4 switch (limit_by4 limitby) {
890*7c478bd9Sstevel@tonic-gate  /* limit specified as file size */
891*7c478bd9Sstevel@tonic-gate  case NFS_LIMIT_SIZE:
892*7c478bd9Sstevel@tonic-gate 	 uint64_t		filesize;
893*7c478bd9Sstevel@tonic-gate  /* limit specified by number of blocks */
894*7c478bd9Sstevel@tonic-gate  case NFS_LIMIT_BLOCKS:
895*7c478bd9Sstevel@tonic-gate 	 nfs_modified_limit4	mod_blocks;
896*7c478bd9Sstevel@tonic-gate } ;
897*7c478bd9Sstevel@tonic-gate 
898*7c478bd9Sstevel@tonic-gate /*
899*7c478bd9Sstevel@tonic-gate  * Share Access and Deny constants for open argument
900*7c478bd9Sstevel@tonic-gate  */
901*7c478bd9Sstevel@tonic-gate const OPEN4_SHARE_ACCESS_READ	= 0x00000001;
902*7c478bd9Sstevel@tonic-gate const OPEN4_SHARE_ACCESS_WRITE	= 0x00000002;
903*7c478bd9Sstevel@tonic-gate const OPEN4_SHARE_ACCESS_BOTH	= 0x00000003;
904*7c478bd9Sstevel@tonic-gate 
905*7c478bd9Sstevel@tonic-gate const OPEN4_SHARE_DENY_NONE	= 0x00000000;
906*7c478bd9Sstevel@tonic-gate const OPEN4_SHARE_DENY_READ	= 0x00000001;
907*7c478bd9Sstevel@tonic-gate const OPEN4_SHARE_DENY_WRITE	= 0x00000002;
908*7c478bd9Sstevel@tonic-gate const OPEN4_SHARE_DENY_BOTH	= 0x00000003;
909*7c478bd9Sstevel@tonic-gate 
910*7c478bd9Sstevel@tonic-gate enum open_delegation_type4 {
911*7c478bd9Sstevel@tonic-gate 	OPEN_DELEGATE_NONE	= 0,
912*7c478bd9Sstevel@tonic-gate 	OPEN_DELEGATE_READ	= 1,
913*7c478bd9Sstevel@tonic-gate 	OPEN_DELEGATE_WRITE	= 2
914*7c478bd9Sstevel@tonic-gate };
915*7c478bd9Sstevel@tonic-gate 
916*7c478bd9Sstevel@tonic-gate enum open_claim_type4 {
917*7c478bd9Sstevel@tonic-gate 	CLAIM_NULL		= 0,
918*7c478bd9Sstevel@tonic-gate 	CLAIM_PREVIOUS		= 1,
919*7c478bd9Sstevel@tonic-gate 	CLAIM_DELEGATE_CUR	= 2,
920*7c478bd9Sstevel@tonic-gate 	CLAIM_DELEGATE_PREV	= 3
921*7c478bd9Sstevel@tonic-gate };
922*7c478bd9Sstevel@tonic-gate 
923*7c478bd9Sstevel@tonic-gate struct open_claim_delegate_cur4 {
924*7c478bd9Sstevel@tonic-gate 	stateid4	delegate_stateid;
925*7c478bd9Sstevel@tonic-gate 	component4	file;
926*7c478bd9Sstevel@tonic-gate };
927*7c478bd9Sstevel@tonic-gate 
928*7c478bd9Sstevel@tonic-gate union open_claim4 switch (open_claim_type4 claim) {
929*7c478bd9Sstevel@tonic-gate  /*
930*7c478bd9Sstevel@tonic-gate   * No special rights to file. Ordinary OPEN of the specified file.
931*7c478bd9Sstevel@tonic-gate   */
932*7c478bd9Sstevel@tonic-gate  case CLAIM_NULL:
933*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
934*7c478bd9Sstevel@tonic-gate 	component4	file;
935*7c478bd9Sstevel@tonic-gate 
936*7c478bd9Sstevel@tonic-gate  /*
937*7c478bd9Sstevel@tonic-gate   * Right to the file established by an open previous to server
938*7c478bd9Sstevel@tonic-gate   * reboot.  File identified by filehandle obtained at that time
939*7c478bd9Sstevel@tonic-gate   * rather than by name.
940*7c478bd9Sstevel@tonic-gate   */
941*7c478bd9Sstevel@tonic-gate  case CLAIM_PREVIOUS:
942*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file being reclaimed */
943*7c478bd9Sstevel@tonic-gate 	open_delegation_type4	delegate_type;
944*7c478bd9Sstevel@tonic-gate 
945*7c478bd9Sstevel@tonic-gate  /*
946*7c478bd9Sstevel@tonic-gate   * Right to file based on a delegation granted by the server.
947*7c478bd9Sstevel@tonic-gate   * File is specified by name.
948*7c478bd9Sstevel@tonic-gate   */
949*7c478bd9Sstevel@tonic-gate  case CLAIM_DELEGATE_CUR:
950*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
951*7c478bd9Sstevel@tonic-gate 	open_claim_delegate_cur4	delegate_cur_info;
952*7c478bd9Sstevel@tonic-gate 
953*7c478bd9Sstevel@tonic-gate  /* Right to file based on a delegation granted to a previous boot
954*7c478bd9Sstevel@tonic-gate   * instance of the client.  File is specified by name.
955*7c478bd9Sstevel@tonic-gate   */
956*7c478bd9Sstevel@tonic-gate  case CLAIM_DELEGATE_PREV:
957*7c478bd9Sstevel@tonic-gate 	 /* CURRENT_FH: directory */
958*7c478bd9Sstevel@tonic-gate 	component4	file_delegate_prev;
959*7c478bd9Sstevel@tonic-gate };
960*7c478bd9Sstevel@tonic-gate 
961*7c478bd9Sstevel@tonic-gate /*
962*7c478bd9Sstevel@tonic-gate  * OPEN: Open a file, potentially receiving an open delegation
963*7c478bd9Sstevel@tonic-gate  */
964*7c478bd9Sstevel@tonic-gate struct OPEN4args {
965*7c478bd9Sstevel@tonic-gate 	seqid4		seqid;
966*7c478bd9Sstevel@tonic-gate 	uint32_t	share_access;
967*7c478bd9Sstevel@tonic-gate 	uint32_t	share_deny;
968*7c478bd9Sstevel@tonic-gate 	open_owner4	owner;
969*7c478bd9Sstevel@tonic-gate 	openflag4	openhow;
970*7c478bd9Sstevel@tonic-gate 	open_claim4	claim;
971*7c478bd9Sstevel@tonic-gate };
972*7c478bd9Sstevel@tonic-gate 
973*7c478bd9Sstevel@tonic-gate struct open_read_delegation4 {
974*7c478bd9Sstevel@tonic-gate 	stateid4	stateid;	/* Stateid for delegation*/
975*7c478bd9Sstevel@tonic-gate 	bool		recall;		/* Pre-recalled flag for
976*7c478bd9Sstevel@tonic-gate 					   delegations obtained
977*7c478bd9Sstevel@tonic-gate 					   by reclaim
978*7c478bd9Sstevel@tonic-gate 					   (CLAIM_PREVIOUS) */
979*7c478bd9Sstevel@tonic-gate 	nfsace4		permissions;	/* Defines users who don't
980*7c478bd9Sstevel@tonic-gate 					   need an ACCESS call to
981*7c478bd9Sstevel@tonic-gate 					   open for read */
982*7c478bd9Sstevel@tonic-gate };
983*7c478bd9Sstevel@tonic-gate 
984*7c478bd9Sstevel@tonic-gate struct open_write_delegation4 {
985*7c478bd9Sstevel@tonic-gate 	stateid4	stateid;	/* Stateid for delegation */
986*7c478bd9Sstevel@tonic-gate 	bool		recall;		/* Pre-recalled flag for
987*7c478bd9Sstevel@tonic-gate 					   delegations obtained
988*7c478bd9Sstevel@tonic-gate 					   by reclaim
989*7c478bd9Sstevel@tonic-gate 					   (CLAIM_PREVIOUS) */
990*7c478bd9Sstevel@tonic-gate 	nfs_space_limit4 space_limit;	/* Defines condition that
991*7c478bd9Sstevel@tonic-gate 					   the client must check to
992*7c478bd9Sstevel@tonic-gate 					   determine whether the
993*7c478bd9Sstevel@tonic-gate 					   file needs to be flushed
994*7c478bd9Sstevel@tonic-gate 					   to the server on close.
995*7c478bd9Sstevel@tonic-gate 					   */
996*7c478bd9Sstevel@tonic-gate 	nfsace4		permissions;	/* Defines users who don't
997*7c478bd9Sstevel@tonic-gate 					   need an ACCESS call as
998*7c478bd9Sstevel@tonic-gate 					   part of a delegated
999*7c478bd9Sstevel@tonic-gate 					   open. */
1000*7c478bd9Sstevel@tonic-gate };
1001*7c478bd9Sstevel@tonic-gate 
1002*7c478bd9Sstevel@tonic-gate union open_delegation4
1003*7c478bd9Sstevel@tonic-gate switch (open_delegation_type4 delegation_type) {
1004*7c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_NONE:
1005*7c478bd9Sstevel@tonic-gate 		void;
1006*7c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_READ:
1007*7c478bd9Sstevel@tonic-gate 		open_read_delegation4 read;
1008*7c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_WRITE:
1009*7c478bd9Sstevel@tonic-gate 		open_write_delegation4 write;
1010*7c478bd9Sstevel@tonic-gate };
1011*7c478bd9Sstevel@tonic-gate 
1012*7c478bd9Sstevel@tonic-gate /*
1013*7c478bd9Sstevel@tonic-gate  * Result flags
1014*7c478bd9Sstevel@tonic-gate  */
1015*7c478bd9Sstevel@tonic-gate /* Client must confirm open */
1016*7c478bd9Sstevel@tonic-gate const OPEN4_RESULT_CONFIRM	= 0x00000002;
1017*7c478bd9Sstevel@tonic-gate /* Type of file locking behavior at the server */
1018*7c478bd9Sstevel@tonic-gate const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004;
1019*7c478bd9Sstevel@tonic-gate 
1020*7c478bd9Sstevel@tonic-gate struct OPEN4resok {
1021*7c478bd9Sstevel@tonic-gate 	stateid4	stateid;	/* Stateid for open */
1022*7c478bd9Sstevel@tonic-gate 	change_info4	cinfo;		/* Directory Change Info */
1023*7c478bd9Sstevel@tonic-gate 	uint32_t	rflags;		/* Result flags */
1024*7c478bd9Sstevel@tonic-gate 	bitmap4		attrset;	/* attribute set for create*/
1025*7c478bd9Sstevel@tonic-gate 	open_delegation4 delegation;	/* Info on any open
1026*7c478bd9Sstevel@tonic-gate 					   delegation */
1027*7c478bd9Sstevel@tonic-gate };
1028*7c478bd9Sstevel@tonic-gate 
1029*7c478bd9Sstevel@tonic-gate union OPEN4res switch (nfsstat4 status) {
1030*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1031*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: opened file */
1032*7c478bd9Sstevel@tonic-gate 	OPEN4resok	resok4;
1033*7c478bd9Sstevel@tonic-gate  default:
1034*7c478bd9Sstevel@tonic-gate 	void;
1035*7c478bd9Sstevel@tonic-gate };
1036*7c478bd9Sstevel@tonic-gate 
1037*7c478bd9Sstevel@tonic-gate /*
1038*7c478bd9Sstevel@tonic-gate  * OPENATTR: open named attributes directory
1039*7c478bd9Sstevel@tonic-gate  */
1040*7c478bd9Sstevel@tonic-gate struct OPENATTR4args {
1041*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
1042*7c478bd9Sstevel@tonic-gate 	bool	createdir;
1043*7c478bd9Sstevel@tonic-gate };
1044*7c478bd9Sstevel@tonic-gate 
1045*7c478bd9Sstevel@tonic-gate struct OPENATTR4res {
1046*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: named attr directory */
1047*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1048*7c478bd9Sstevel@tonic-gate };
1049*7c478bd9Sstevel@tonic-gate 
1050*7c478bd9Sstevel@tonic-gate /*
1051*7c478bd9Sstevel@tonic-gate  * OPEN_CONFIRM: confirm the open
1052*7c478bd9Sstevel@tonic-gate  */
1053*7c478bd9Sstevel@tonic-gate struct OPEN_CONFIRM4args {
1054*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: opened file */
1055*7c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
1056*7c478bd9Sstevel@tonic-gate 	seqid4		seqid;
1057*7c478bd9Sstevel@tonic-gate };
1058*7c478bd9Sstevel@tonic-gate 
1059*7c478bd9Sstevel@tonic-gate struct OPEN_CONFIRM4resok {
1060*7c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
1061*7c478bd9Sstevel@tonic-gate };
1062*7c478bd9Sstevel@tonic-gate 
1063*7c478bd9Sstevel@tonic-gate union OPEN_CONFIRM4res switch (nfsstat4 status) {
1064*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1065*7c478bd9Sstevel@tonic-gate 	 OPEN_CONFIRM4resok	resok4;
1066*7c478bd9Sstevel@tonic-gate  default:
1067*7c478bd9Sstevel@tonic-gate 	 void;
1068*7c478bd9Sstevel@tonic-gate };
1069*7c478bd9Sstevel@tonic-gate 
1070*7c478bd9Sstevel@tonic-gate /*
1071*7c478bd9Sstevel@tonic-gate  * OPEN_DOWNGRADE: downgrade the access/deny for a file
1072*7c478bd9Sstevel@tonic-gate  */
1073*7c478bd9Sstevel@tonic-gate struct OPEN_DOWNGRADE4args {
1074*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: opened file */
1075*7c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
1076*7c478bd9Sstevel@tonic-gate 	seqid4		seqid;
1077*7c478bd9Sstevel@tonic-gate 	uint32_t	share_access;
1078*7c478bd9Sstevel@tonic-gate 	uint32_t	share_deny;
1079*7c478bd9Sstevel@tonic-gate };
1080*7c478bd9Sstevel@tonic-gate 
1081*7c478bd9Sstevel@tonic-gate struct OPEN_DOWNGRADE4resok {
1082*7c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
1083*7c478bd9Sstevel@tonic-gate };
1084*7c478bd9Sstevel@tonic-gate 
1085*7c478bd9Sstevel@tonic-gate union OPEN_DOWNGRADE4res switch(nfsstat4 status) {
1086*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1087*7c478bd9Sstevel@tonic-gate 	OPEN_DOWNGRADE4resok	resok4;
1088*7c478bd9Sstevel@tonic-gate  default:
1089*7c478bd9Sstevel@tonic-gate 	 void;
1090*7c478bd9Sstevel@tonic-gate };
1091*7c478bd9Sstevel@tonic-gate 
1092*7c478bd9Sstevel@tonic-gate /*
1093*7c478bd9Sstevel@tonic-gate  * PUTFH: Set current filehandle
1094*7c478bd9Sstevel@tonic-gate  */
1095*7c478bd9Sstevel@tonic-gate struct PUTFH4args {
1096*7c478bd9Sstevel@tonic-gate 	nfs_fh4		object;
1097*7c478bd9Sstevel@tonic-gate };
1098*7c478bd9Sstevel@tonic-gate 
1099*7c478bd9Sstevel@tonic-gate struct PUTFH4res {
1100*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: */
1101*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1102*7c478bd9Sstevel@tonic-gate };
1103*7c478bd9Sstevel@tonic-gate 
1104*7c478bd9Sstevel@tonic-gate /*
1105*7c478bd9Sstevel@tonic-gate  * PUTPUBFH: Set public filehandle
1106*7c478bd9Sstevel@tonic-gate  */
1107*7c478bd9Sstevel@tonic-gate struct PUTPUBFH4res {
1108*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: public fh */
1109*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1110*7c478bd9Sstevel@tonic-gate };
1111*7c478bd9Sstevel@tonic-gate 
1112*7c478bd9Sstevel@tonic-gate /*
1113*7c478bd9Sstevel@tonic-gate  * PUTROOTFH: Set root filehandle
1114*7c478bd9Sstevel@tonic-gate  */
1115*7c478bd9Sstevel@tonic-gate struct PUTROOTFH4res {
1116*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: root fh */
1117*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1118*7c478bd9Sstevel@tonic-gate };
1119*7c478bd9Sstevel@tonic-gate 
1120*7c478bd9Sstevel@tonic-gate /*
1121*7c478bd9Sstevel@tonic-gate  * READ: Read from file
1122*7c478bd9Sstevel@tonic-gate  */
1123*7c478bd9Sstevel@tonic-gate struct READ4args {
1124*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
1125*7c478bd9Sstevel@tonic-gate 	stateid4	stateid;
1126*7c478bd9Sstevel@tonic-gate 	offset4		offset;
1127*7c478bd9Sstevel@tonic-gate 	count4		count;
1128*7c478bd9Sstevel@tonic-gate };
1129*7c478bd9Sstevel@tonic-gate 
1130*7c478bd9Sstevel@tonic-gate struct READ4resok {
1131*7c478bd9Sstevel@tonic-gate 	bool		eof;
1132*7c478bd9Sstevel@tonic-gate 	opaque		data<>;
1133*7c478bd9Sstevel@tonic-gate };
1134*7c478bd9Sstevel@tonic-gate 
1135*7c478bd9Sstevel@tonic-gate union READ4res switch (nfsstat4 status) {
1136*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1137*7c478bd9Sstevel@tonic-gate 	 READ4resok	resok4;
1138*7c478bd9Sstevel@tonic-gate  default:
1139*7c478bd9Sstevel@tonic-gate 	 void;
1140*7c478bd9Sstevel@tonic-gate };
1141*7c478bd9Sstevel@tonic-gate 
1142*7c478bd9Sstevel@tonic-gate /*
1143*7c478bd9Sstevel@tonic-gate  * READDIR: Read directory
1144*7c478bd9Sstevel@tonic-gate  */
1145*7c478bd9Sstevel@tonic-gate struct READDIR4args {
1146*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
1147*7c478bd9Sstevel@tonic-gate 	nfs_cookie4	cookie;
1148*7c478bd9Sstevel@tonic-gate 	verifier4	cookieverf;
1149*7c478bd9Sstevel@tonic-gate 	count4		dircount;
1150*7c478bd9Sstevel@tonic-gate 	count4		maxcount;
1151*7c478bd9Sstevel@tonic-gate 	bitmap4		attr_request;
1152*7c478bd9Sstevel@tonic-gate };
1153*7c478bd9Sstevel@tonic-gate 
1154*7c478bd9Sstevel@tonic-gate struct entry4 {
1155*7c478bd9Sstevel@tonic-gate 	nfs_cookie4	cookie;
1156*7c478bd9Sstevel@tonic-gate 	component4	name;
1157*7c478bd9Sstevel@tonic-gate 	fattr4		attrs;
1158*7c478bd9Sstevel@tonic-gate 	entry4		*nextentry;
1159*7c478bd9Sstevel@tonic-gate };
1160*7c478bd9Sstevel@tonic-gate 
1161*7c478bd9Sstevel@tonic-gate struct dirlist4 {
1162*7c478bd9Sstevel@tonic-gate 	entry4		*entries;
1163*7c478bd9Sstevel@tonic-gate 	bool		eof;
1164*7c478bd9Sstevel@tonic-gate };
1165*7c478bd9Sstevel@tonic-gate 
1166*7c478bd9Sstevel@tonic-gate struct READDIR4resok {
1167*7c478bd9Sstevel@tonic-gate 	verifier4	cookieverf;
1168*7c478bd9Sstevel@tonic-gate 	dirlist4	reply;
1169*7c478bd9Sstevel@tonic-gate };
1170*7c478bd9Sstevel@tonic-gate 
1171*7c478bd9Sstevel@tonic-gate 
1172*7c478bd9Sstevel@tonic-gate union READDIR4res switch (nfsstat4 status) {
1173*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1174*7c478bd9Sstevel@tonic-gate 	 READDIR4resok	resok4;
1175*7c478bd9Sstevel@tonic-gate  default:
1176*7c478bd9Sstevel@tonic-gate 	 void;
1177*7c478bd9Sstevel@tonic-gate };
1178*7c478bd9Sstevel@tonic-gate 
1179*7c478bd9Sstevel@tonic-gate 
1180*7c478bd9Sstevel@tonic-gate /*
1181*7c478bd9Sstevel@tonic-gate  * READLINK: Read symbolic link
1182*7c478bd9Sstevel@tonic-gate  */
1183*7c478bd9Sstevel@tonic-gate struct READLINK4resok {
1184*7c478bd9Sstevel@tonic-gate 	linktext4	link;
1185*7c478bd9Sstevel@tonic-gate };
1186*7c478bd9Sstevel@tonic-gate 
1187*7c478bd9Sstevel@tonic-gate union READLINK4res switch (nfsstat4 status) {
1188*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1189*7c478bd9Sstevel@tonic-gate 	 READLINK4resok	resok4;
1190*7c478bd9Sstevel@tonic-gate  default:
1191*7c478bd9Sstevel@tonic-gate 	 void;
1192*7c478bd9Sstevel@tonic-gate };
1193*7c478bd9Sstevel@tonic-gate 
1194*7c478bd9Sstevel@tonic-gate /*
1195*7c478bd9Sstevel@tonic-gate  * REMOVE: Remove filesystem object
1196*7c478bd9Sstevel@tonic-gate  */
1197*7c478bd9Sstevel@tonic-gate struct REMOVE4args {
1198*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
1199*7c478bd9Sstevel@tonic-gate 	component4	target;
1200*7c478bd9Sstevel@tonic-gate };
1201*7c478bd9Sstevel@tonic-gate 
1202*7c478bd9Sstevel@tonic-gate struct REMOVE4resok {
1203*7c478bd9Sstevel@tonic-gate 	change_info4	cinfo;
1204*7c478bd9Sstevel@tonic-gate };
1205*7c478bd9Sstevel@tonic-gate 
1206*7c478bd9Sstevel@tonic-gate union REMOVE4res switch (nfsstat4 status) {
1207*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1208*7c478bd9Sstevel@tonic-gate 	 REMOVE4resok	resok4;
1209*7c478bd9Sstevel@tonic-gate  default:
1210*7c478bd9Sstevel@tonic-gate 	 void;
1211*7c478bd9Sstevel@tonic-gate };
1212*7c478bd9Sstevel@tonic-gate 
1213*7c478bd9Sstevel@tonic-gate /*
1214*7c478bd9Sstevel@tonic-gate  * RENAME: Rename directory entry
1215*7c478bd9Sstevel@tonic-gate  */
1216*7c478bd9Sstevel@tonic-gate struct RENAME4args {
1217*7c478bd9Sstevel@tonic-gate 	/* SAVED_FH: source directory */
1218*7c478bd9Sstevel@tonic-gate 	component4	oldname;
1219*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: target directory */
1220*7c478bd9Sstevel@tonic-gate 	component4	newname;
1221*7c478bd9Sstevel@tonic-gate };
1222*7c478bd9Sstevel@tonic-gate 
1223*7c478bd9Sstevel@tonic-gate struct RENAME4resok {
1224*7c478bd9Sstevel@tonic-gate 	change_info4	source_cinfo;
1225*7c478bd9Sstevel@tonic-gate 	change_info4	target_cinfo;
1226*7c478bd9Sstevel@tonic-gate };
1227*7c478bd9Sstevel@tonic-gate 
1228*7c478bd9Sstevel@tonic-gate union RENAME4res switch (nfsstat4 status) {
1229*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1230*7c478bd9Sstevel@tonic-gate 	RENAME4resok	resok4;
1231*7c478bd9Sstevel@tonic-gate  default:
1232*7c478bd9Sstevel@tonic-gate 	void;
1233*7c478bd9Sstevel@tonic-gate };
1234*7c478bd9Sstevel@tonic-gate 
1235*7c478bd9Sstevel@tonic-gate /*
1236*7c478bd9Sstevel@tonic-gate  * RENEW: Renew a Lease
1237*7c478bd9Sstevel@tonic-gate  */
1238*7c478bd9Sstevel@tonic-gate struct RENEW4args {
1239*7c478bd9Sstevel@tonic-gate 	clientid4	clientid;
1240*7c478bd9Sstevel@tonic-gate };
1241*7c478bd9Sstevel@tonic-gate 
1242*7c478bd9Sstevel@tonic-gate struct RENEW4res {
1243*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1244*7c478bd9Sstevel@tonic-gate };
1245*7c478bd9Sstevel@tonic-gate 
1246*7c478bd9Sstevel@tonic-gate /*
1247*7c478bd9Sstevel@tonic-gate  * RESTOREFH: Restore saved filehandle
1248*7c478bd9Sstevel@tonic-gate  */
1249*7c478bd9Sstevel@tonic-gate 
1250*7c478bd9Sstevel@tonic-gate struct RESTOREFH4res {
1251*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: value of saved fh */
1252*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1253*7c478bd9Sstevel@tonic-gate };
1254*7c478bd9Sstevel@tonic-gate 
1255*7c478bd9Sstevel@tonic-gate /*
1256*7c478bd9Sstevel@tonic-gate  * SAVEFH: Save current filehandle
1257*7c478bd9Sstevel@tonic-gate  */
1258*7c478bd9Sstevel@tonic-gate struct SAVEFH4res {
1259*7c478bd9Sstevel@tonic-gate 	/* SAVED_FH: value of current fh */
1260*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1261*7c478bd9Sstevel@tonic-gate };
1262*7c478bd9Sstevel@tonic-gate 
1263*7c478bd9Sstevel@tonic-gate /*
1264*7c478bd9Sstevel@tonic-gate  * SECINFO: Obtain Available Security Mechanisms
1265*7c478bd9Sstevel@tonic-gate  */
1266*7c478bd9Sstevel@tonic-gate struct SECINFO4args {
1267*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
1268*7c478bd9Sstevel@tonic-gate 	component4	name;
1269*7c478bd9Sstevel@tonic-gate };
1270*7c478bd9Sstevel@tonic-gate 
1271*7c478bd9Sstevel@tonic-gate /*
1272*7c478bd9Sstevel@tonic-gate  * From RFC 2203
1273*7c478bd9Sstevel@tonic-gate  */
1274*7c478bd9Sstevel@tonic-gate enum rpc_gss_svc_t {
1275*7c478bd9Sstevel@tonic-gate 	RPC_GSS_SVC_NONE	= 1,
1276*7c478bd9Sstevel@tonic-gate 	RPC_GSS_SVC_INTEGRITY	= 2,
1277*7c478bd9Sstevel@tonic-gate 	RPC_GSS_SVC_PRIVACY	= 3
1278*7c478bd9Sstevel@tonic-gate };
1279*7c478bd9Sstevel@tonic-gate 
1280*7c478bd9Sstevel@tonic-gate struct rpcsec_gss_info {
1281*7c478bd9Sstevel@tonic-gate 	sec_oid4	oid;
1282*7c478bd9Sstevel@tonic-gate 	qop4		qop;
1283*7c478bd9Sstevel@tonic-gate 	rpc_gss_svc_t	service;
1284*7c478bd9Sstevel@tonic-gate };
1285*7c478bd9Sstevel@tonic-gate 
1286*7c478bd9Sstevel@tonic-gate /* RPCSEC_GSS has a value of '6' - See RFC 2203 */
1287*7c478bd9Sstevel@tonic-gate union secinfo4 switch (uint32_t flavor) {
1288*7c478bd9Sstevel@tonic-gate  case RPCSEC_GSS:
1289*7c478bd9Sstevel@tonic-gate 	 rpcsec_gss_info	flavor_info;
1290*7c478bd9Sstevel@tonic-gate  default:
1291*7c478bd9Sstevel@tonic-gate 	 void;
1292*7c478bd9Sstevel@tonic-gate };
1293*7c478bd9Sstevel@tonic-gate 
1294*7c478bd9Sstevel@tonic-gate typedef secinfo4 SECINFO4resok<>;
1295*7c478bd9Sstevel@tonic-gate 
1296*7c478bd9Sstevel@tonic-gate union SECINFO4res switch (nfsstat4 status) {
1297*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1298*7c478bd9Sstevel@tonic-gate 	 SECINFO4resok resok4;
1299*7c478bd9Sstevel@tonic-gate  default:
1300*7c478bd9Sstevel@tonic-gate 	 void;
1301*7c478bd9Sstevel@tonic-gate };
1302*7c478bd9Sstevel@tonic-gate 
1303*7c478bd9Sstevel@tonic-gate /*
1304*7c478bd9Sstevel@tonic-gate  * SETATTR: Set attributes
1305*7c478bd9Sstevel@tonic-gate  */
1306*7c478bd9Sstevel@tonic-gate struct SETATTR4args {
1307*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: target object */
1308*7c478bd9Sstevel@tonic-gate 	stateid4	stateid;
1309*7c478bd9Sstevel@tonic-gate 	fattr4		obj_attributes;
1310*7c478bd9Sstevel@tonic-gate };
1311*7c478bd9Sstevel@tonic-gate 
1312*7c478bd9Sstevel@tonic-gate struct SETATTR4res {
1313*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1314*7c478bd9Sstevel@tonic-gate 	bitmap4		attrsset;
1315*7c478bd9Sstevel@tonic-gate };
1316*7c478bd9Sstevel@tonic-gate 
1317*7c478bd9Sstevel@tonic-gate /*
1318*7c478bd9Sstevel@tonic-gate  * SETCLIENTID
1319*7c478bd9Sstevel@tonic-gate  */
1320*7c478bd9Sstevel@tonic-gate struct SETCLIENTID4args {
1321*7c478bd9Sstevel@tonic-gate 	nfs_client_id4	client;
1322*7c478bd9Sstevel@tonic-gate 	cb_client4	callback;
1323*7c478bd9Sstevel@tonic-gate 	uint32_t	callback_ident;
1324*7c478bd9Sstevel@tonic-gate };
1325*7c478bd9Sstevel@tonic-gate 
1326*7c478bd9Sstevel@tonic-gate struct SETCLIENTID4resok {
1327*7c478bd9Sstevel@tonic-gate 	clientid4	clientid;
1328*7c478bd9Sstevel@tonic-gate 	verifier4	setclientid_confirm;
1329*7c478bd9Sstevel@tonic-gate };
1330*7c478bd9Sstevel@tonic-gate 
1331*7c478bd9Sstevel@tonic-gate union SETCLIENTID4res switch (nfsstat4 status) {
1332*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1333*7c478bd9Sstevel@tonic-gate 	 SETCLIENTID4resok	resok4;
1334*7c478bd9Sstevel@tonic-gate  case NFS4ERR_CLID_INUSE:
1335*7c478bd9Sstevel@tonic-gate 	 clientaddr4	client_using;
1336*7c478bd9Sstevel@tonic-gate  default:
1337*7c478bd9Sstevel@tonic-gate 	 void;
1338*7c478bd9Sstevel@tonic-gate };
1339*7c478bd9Sstevel@tonic-gate 
1340*7c478bd9Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4args {
1341*7c478bd9Sstevel@tonic-gate 	clientid4	clientid;
1342*7c478bd9Sstevel@tonic-gate 	verifier4	setclientid_confirm;
1343*7c478bd9Sstevel@tonic-gate };
1344*7c478bd9Sstevel@tonic-gate 
1345*7c478bd9Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4res {
1346*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1347*7c478bd9Sstevel@tonic-gate };
1348*7c478bd9Sstevel@tonic-gate 
1349*7c478bd9Sstevel@tonic-gate /*
1350*7c478bd9Sstevel@tonic-gate  * VERIFY: Verify attributes same
1351*7c478bd9Sstevel@tonic-gate  */
1352*7c478bd9Sstevel@tonic-gate struct VERIFY4args {
1353*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
1354*7c478bd9Sstevel@tonic-gate 	fattr4		obj_attributes;
1355*7c478bd9Sstevel@tonic-gate };
1356*7c478bd9Sstevel@tonic-gate 
1357*7c478bd9Sstevel@tonic-gate struct VERIFY4res {
1358*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1359*7c478bd9Sstevel@tonic-gate };
1360*7c478bd9Sstevel@tonic-gate 
1361*7c478bd9Sstevel@tonic-gate /*
1362*7c478bd9Sstevel@tonic-gate  * WRITE: Write to file
1363*7c478bd9Sstevel@tonic-gate  */
1364*7c478bd9Sstevel@tonic-gate enum stable_how4 {
1365*7c478bd9Sstevel@tonic-gate 	UNSTABLE4	= 0,
1366*7c478bd9Sstevel@tonic-gate 	DATA_SYNC4	= 1,
1367*7c478bd9Sstevel@tonic-gate 	FILE_SYNC4	= 2
1368*7c478bd9Sstevel@tonic-gate };
1369*7c478bd9Sstevel@tonic-gate 
1370*7c478bd9Sstevel@tonic-gate struct WRITE4args {
1371*7c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
1372*7c478bd9Sstevel@tonic-gate 	stateid4	stateid;
1373*7c478bd9Sstevel@tonic-gate 	offset4		offset;
1374*7c478bd9Sstevel@tonic-gate 	stable_how4	stable;
1375*7c478bd9Sstevel@tonic-gate 	opaque		data<>;
1376*7c478bd9Sstevel@tonic-gate };
1377*7c478bd9Sstevel@tonic-gate 
1378*7c478bd9Sstevel@tonic-gate struct WRITE4resok {
1379*7c478bd9Sstevel@tonic-gate 	count4		count;
1380*7c478bd9Sstevel@tonic-gate 	stable_how4	committed;
1381*7c478bd9Sstevel@tonic-gate 	verifier4	writeverf;
1382*7c478bd9Sstevel@tonic-gate };
1383*7c478bd9Sstevel@tonic-gate 
1384*7c478bd9Sstevel@tonic-gate union WRITE4res switch (nfsstat4 status) {
1385*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1386*7c478bd9Sstevel@tonic-gate 	 WRITE4resok	resok4;
1387*7c478bd9Sstevel@tonic-gate  default:
1388*7c478bd9Sstevel@tonic-gate 	 void;
1389*7c478bd9Sstevel@tonic-gate };
1390*7c478bd9Sstevel@tonic-gate 
1391*7c478bd9Sstevel@tonic-gate /*
1392*7c478bd9Sstevel@tonic-gate  * RELEASE_LOCKOWNER: Notify server to release lockowner
1393*7c478bd9Sstevel@tonic-gate  */
1394*7c478bd9Sstevel@tonic-gate struct RELEASE_LOCKOWNER4args {
1395*7c478bd9Sstevel@tonic-gate 	lock_owner4	lock_owner;
1396*7c478bd9Sstevel@tonic-gate };
1397*7c478bd9Sstevel@tonic-gate 
1398*7c478bd9Sstevel@tonic-gate struct RELEASE_LOCKOWNER4res {
1399*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1400*7c478bd9Sstevel@tonic-gate };
1401*7c478bd9Sstevel@tonic-gate 
1402*7c478bd9Sstevel@tonic-gate /*
1403*7c478bd9Sstevel@tonic-gate  * ILLEGAL: Response for illegal operation numbers
1404*7c478bd9Sstevel@tonic-gate  */
1405*7c478bd9Sstevel@tonic-gate struct ILLEGAL4res {
1406*7c478bd9Sstevel@tonic-gate 	nfsstat4        status;
1407*7c478bd9Sstevel@tonic-gate };
1408*7c478bd9Sstevel@tonic-gate 
1409*7c478bd9Sstevel@tonic-gate /*
1410*7c478bd9Sstevel@tonic-gate  * Operation arrays
1411*7c478bd9Sstevel@tonic-gate  */
1412*7c478bd9Sstevel@tonic-gate 
1413*7c478bd9Sstevel@tonic-gate enum nfs_opnum4 {
1414*7c478bd9Sstevel@tonic-gate 	OP_ACCESS		= 3,
1415*7c478bd9Sstevel@tonic-gate 	OP_CLOSE		= 4,
1416*7c478bd9Sstevel@tonic-gate 	OP_COMMIT		= 5,
1417*7c478bd9Sstevel@tonic-gate 	OP_CREATE		= 6,
1418*7c478bd9Sstevel@tonic-gate 	OP_DELEGPURGE		= 7,
1419*7c478bd9Sstevel@tonic-gate 	OP_DELEGRETURN		= 8,
1420*7c478bd9Sstevel@tonic-gate 	OP_GETATTR		= 9,
1421*7c478bd9Sstevel@tonic-gate 	OP_GETFH		= 10,
1422*7c478bd9Sstevel@tonic-gate 	OP_LINK			= 11,
1423*7c478bd9Sstevel@tonic-gate 	OP_LOCK			= 12,
1424*7c478bd9Sstevel@tonic-gate 	OP_LOCKT		= 13,
1425*7c478bd9Sstevel@tonic-gate 	OP_LOCKU		= 14,
1426*7c478bd9Sstevel@tonic-gate 	OP_LOOKUP		= 15,
1427*7c478bd9Sstevel@tonic-gate 	OP_LOOKUPP		= 16,
1428*7c478bd9Sstevel@tonic-gate 	OP_NVERIFY		= 17,
1429*7c478bd9Sstevel@tonic-gate 	OP_OPEN			= 18,
1430*7c478bd9Sstevel@tonic-gate 	OP_OPENATTR		= 19,
1431*7c478bd9Sstevel@tonic-gate 	OP_OPEN_CONFIRM		= 20,
1432*7c478bd9Sstevel@tonic-gate 	OP_OPEN_DOWNGRADE	= 21,
1433*7c478bd9Sstevel@tonic-gate 	OP_PUTFH		= 22,
1434*7c478bd9Sstevel@tonic-gate 	OP_PUTPUBFH		= 23,
1435*7c478bd9Sstevel@tonic-gate 	OP_PUTROOTFH		= 24,
1436*7c478bd9Sstevel@tonic-gate 	OP_READ			= 25,
1437*7c478bd9Sstevel@tonic-gate 	OP_READDIR		= 26,
1438*7c478bd9Sstevel@tonic-gate 	OP_READLINK		= 27,
1439*7c478bd9Sstevel@tonic-gate 	OP_REMOVE		= 28,
1440*7c478bd9Sstevel@tonic-gate 	OP_RENAME		= 29,
1441*7c478bd9Sstevel@tonic-gate 	OP_RENEW		= 30,
1442*7c478bd9Sstevel@tonic-gate 	OP_RESTOREFH		= 31,
1443*7c478bd9Sstevel@tonic-gate 	OP_SAVEFH		= 32,
1444*7c478bd9Sstevel@tonic-gate 	OP_SECINFO		= 33,
1445*7c478bd9Sstevel@tonic-gate 	OP_SETATTR		= 34,
1446*7c478bd9Sstevel@tonic-gate 	OP_SETCLIENTID		= 35,
1447*7c478bd9Sstevel@tonic-gate 	OP_SETCLIENTID_CONFIRM	= 36,
1448*7c478bd9Sstevel@tonic-gate 	OP_VERIFY		= 37,
1449*7c478bd9Sstevel@tonic-gate 	OP_WRITE		= 38,
1450*7c478bd9Sstevel@tonic-gate 	OP_RELEASE_LOCKOWNER	= 39,
1451*7c478bd9Sstevel@tonic-gate 	OP_ILLEGAL		= 10044
1452*7c478bd9Sstevel@tonic-gate };
1453*7c478bd9Sstevel@tonic-gate 
1454*7c478bd9Sstevel@tonic-gate union nfs_argop4 switch (nfs_opnum4 argop) {
1455*7c478bd9Sstevel@tonic-gate  case OP_ACCESS:	ACCESS4args opaccess;
1456*7c478bd9Sstevel@tonic-gate  case OP_CLOSE:		CLOSE4args opclose;
1457*7c478bd9Sstevel@tonic-gate  case OP_COMMIT:	COMMIT4args opcommit;
1458*7c478bd9Sstevel@tonic-gate  case OP_CREATE:	CREATE4args opcreate;
1459*7c478bd9Sstevel@tonic-gate  case OP_DELEGPURGE:	DELEGPURGE4args opdelegpurge;
1460*7c478bd9Sstevel@tonic-gate  case OP_DELEGRETURN:	DELEGRETURN4args opdelegreturn;
1461*7c478bd9Sstevel@tonic-gate  case OP_GETATTR:	GETATTR4args opgetattr;
1462*7c478bd9Sstevel@tonic-gate  case OP_GETFH:		void;
1463*7c478bd9Sstevel@tonic-gate  case OP_LINK:		LINK4args oplink;
1464*7c478bd9Sstevel@tonic-gate  case OP_LOCK:		LOCK4args oplock;
1465*7c478bd9Sstevel@tonic-gate  case OP_LOCKT:		LOCKT4args oplockt;
1466*7c478bd9Sstevel@tonic-gate  case OP_LOCKU:		LOCKU4args oplocku;
1467*7c478bd9Sstevel@tonic-gate  case OP_LOOKUP:	LOOKUP4args oplookup;
1468*7c478bd9Sstevel@tonic-gate  case OP_LOOKUPP:	void;
1469*7c478bd9Sstevel@tonic-gate  case OP_NVERIFY:	NVERIFY4args opnverify;
1470*7c478bd9Sstevel@tonic-gate  case OP_OPEN:		OPEN4args opopen;
1471*7c478bd9Sstevel@tonic-gate  case OP_OPENATTR:	OPENATTR4args opopenattr;
1472*7c478bd9Sstevel@tonic-gate  case OP_OPEN_CONFIRM:	OPEN_CONFIRM4args opopen_confirm;
1473*7c478bd9Sstevel@tonic-gate  case OP_OPEN_DOWNGRADE:	OPEN_DOWNGRADE4args opopen_downgrade;
1474*7c478bd9Sstevel@tonic-gate  case OP_PUTFH:		PUTFH4args opputfh;
1475*7c478bd9Sstevel@tonic-gate  case OP_PUTPUBFH:	void;
1476*7c478bd9Sstevel@tonic-gate  case OP_PUTROOTFH:	void;
1477*7c478bd9Sstevel@tonic-gate  case OP_READ:		READ4args opread;
1478*7c478bd9Sstevel@tonic-gate  case OP_READDIR:	READDIR4args opreaddir;
1479*7c478bd9Sstevel@tonic-gate  case OP_READLINK:	void;
1480*7c478bd9Sstevel@tonic-gate  case OP_REMOVE:	REMOVE4args opremove;
1481*7c478bd9Sstevel@tonic-gate  case OP_RENAME:	RENAME4args oprename;
1482*7c478bd9Sstevel@tonic-gate  case OP_RENEW:		RENEW4args oprenew;
1483*7c478bd9Sstevel@tonic-gate  case OP_RESTOREFH:	void;
1484*7c478bd9Sstevel@tonic-gate  case OP_SAVEFH:	void;
1485*7c478bd9Sstevel@tonic-gate  case OP_SECINFO:	SECINFO4args opsecinfo;
1486*7c478bd9Sstevel@tonic-gate  case OP_SETATTR:	SETATTR4args opsetattr;
1487*7c478bd9Sstevel@tonic-gate  case OP_SETCLIENTID:	SETCLIENTID4args opsetclientid;
1488*7c478bd9Sstevel@tonic-gate  case OP_SETCLIENTID_CONFIRM:	SETCLIENTID_CONFIRM4args
1489*7c478bd9Sstevel@tonic-gate 					opsetclientid_confirm;
1490*7c478bd9Sstevel@tonic-gate  case OP_VERIFY:	VERIFY4args opverify;
1491*7c478bd9Sstevel@tonic-gate  case OP_WRITE:		WRITE4args opwrite;
1492*7c478bd9Sstevel@tonic-gate  case OP_RELEASE_LOCKOWNER:	RELEASE_LOCKOWNER4args
1493*7c478bd9Sstevel@tonic-gate 				    oprelease_lockowner;
1494*7c478bd9Sstevel@tonic-gate  case OP_ILLEGAL:	void;
1495*7c478bd9Sstevel@tonic-gate };
1496*7c478bd9Sstevel@tonic-gate 
1497*7c478bd9Sstevel@tonic-gate union nfs_resop4 switch (nfs_opnum4 resop){
1498*7c478bd9Sstevel@tonic-gate  case OP_ACCESS:	ACCESS4res opaccess;
1499*7c478bd9Sstevel@tonic-gate  case OP_CLOSE:		CLOSE4res opclose;
1500*7c478bd9Sstevel@tonic-gate  case OP_COMMIT:	COMMIT4res opcommit;
1501*7c478bd9Sstevel@tonic-gate  case OP_CREATE:	CREATE4res opcreate;
1502*7c478bd9Sstevel@tonic-gate  case OP_DELEGPURGE:	DELEGPURGE4res opdelegpurge;
1503*7c478bd9Sstevel@tonic-gate  case OP_DELEGRETURN:	DELEGRETURN4res opdelegreturn;
1504*7c478bd9Sstevel@tonic-gate  case OP_GETATTR:	GETATTR4res opgetattr;
1505*7c478bd9Sstevel@tonic-gate  case OP_GETFH:		GETFH4res opgetfh;
1506*7c478bd9Sstevel@tonic-gate  case OP_LINK:		LINK4res oplink;
1507*7c478bd9Sstevel@tonic-gate  case OP_LOCK:		LOCK4res oplock;
1508*7c478bd9Sstevel@tonic-gate  case OP_LOCKT:		LOCKT4res oplockt;
1509*7c478bd9Sstevel@tonic-gate  case OP_LOCKU:		LOCKU4res oplocku;
1510*7c478bd9Sstevel@tonic-gate  case OP_LOOKUP:	LOOKUP4res oplookup;
1511*7c478bd9Sstevel@tonic-gate  case OP_LOOKUPP:	LOOKUPP4res oplookupp;
1512*7c478bd9Sstevel@tonic-gate  case OP_NVERIFY:	NVERIFY4res opnverify;
1513*7c478bd9Sstevel@tonic-gate  case OP_OPEN:		OPEN4res opopen;
1514*7c478bd9Sstevel@tonic-gate  case OP_OPENATTR:	OPENATTR4res opopenattr;
1515*7c478bd9Sstevel@tonic-gate  case OP_OPEN_CONFIRM:	OPEN_CONFIRM4res opopen_confirm;
1516*7c478bd9Sstevel@tonic-gate  case OP_OPEN_DOWNGRADE:	OPEN_DOWNGRADE4res opopen_downgrade;
1517*7c478bd9Sstevel@tonic-gate  case OP_PUTFH:		PUTFH4res opputfh;
1518*7c478bd9Sstevel@tonic-gate  case OP_PUTPUBFH:	PUTPUBFH4res opputpubfh;
1519*7c478bd9Sstevel@tonic-gate  case OP_PUTROOTFH:	PUTROOTFH4res opputrootfh;
1520*7c478bd9Sstevel@tonic-gate  case OP_READ:		READ4res opread;
1521*7c478bd9Sstevel@tonic-gate  case OP_READDIR:	READDIR4res opreaddir;
1522*7c478bd9Sstevel@tonic-gate  case OP_READLINK:	READLINK4res opreadlink;
1523*7c478bd9Sstevel@tonic-gate  case OP_REMOVE:	REMOVE4res opremove;
1524*7c478bd9Sstevel@tonic-gate  case OP_RENAME:	RENAME4res oprename;
1525*7c478bd9Sstevel@tonic-gate  case OP_RENEW:		RENEW4res oprenew;
1526*7c478bd9Sstevel@tonic-gate  case OP_RESTOREFH:	RESTOREFH4res oprestorefh;
1527*7c478bd9Sstevel@tonic-gate  case OP_SAVEFH:	SAVEFH4res opsavefh;
1528*7c478bd9Sstevel@tonic-gate  case OP_SECINFO:	SECINFO4res opsecinfo;
1529*7c478bd9Sstevel@tonic-gate  case OP_SETATTR:	SETATTR4res opsetattr;
1530*7c478bd9Sstevel@tonic-gate  case OP_SETCLIENTID:	SETCLIENTID4res opsetclientid;
1531*7c478bd9Sstevel@tonic-gate  case OP_SETCLIENTID_CONFIRM:	SETCLIENTID_CONFIRM4res
1532*7c478bd9Sstevel@tonic-gate 					opsetclientid_confirm;
1533*7c478bd9Sstevel@tonic-gate  case OP_VERIFY:	VERIFY4res opverify;
1534*7c478bd9Sstevel@tonic-gate  case OP_WRITE:		WRITE4res opwrite;
1535*7c478bd9Sstevel@tonic-gate  case OP_RELEASE_LOCKOWNER:	RELEASE_LOCKOWNER4res
1536*7c478bd9Sstevel@tonic-gate 				    oprelease_lockowner;
1537*7c478bd9Sstevel@tonic-gate  case OP_ILLEGAL:	ILLEGAL4res opillegal;
1538*7c478bd9Sstevel@tonic-gate };
1539*7c478bd9Sstevel@tonic-gate 
1540*7c478bd9Sstevel@tonic-gate struct COMPOUND4args {
1541*7c478bd9Sstevel@tonic-gate 	utf8str_cs	tag;
1542*7c478bd9Sstevel@tonic-gate 	uint32_t	minorversion;
1543*7c478bd9Sstevel@tonic-gate 	nfs_argop4	argarray<>;
1544*7c478bd9Sstevel@tonic-gate };
1545*7c478bd9Sstevel@tonic-gate 
1546*7c478bd9Sstevel@tonic-gate struct COMPOUND4res {
1547*7c478bd9Sstevel@tonic-gate 	nfsstat4 status;
1548*7c478bd9Sstevel@tonic-gate 	utf8str_cs	tag;
1549*7c478bd9Sstevel@tonic-gate 	nfs_resop4	resarray<>;
1550*7c478bd9Sstevel@tonic-gate };
1551*7c478bd9Sstevel@tonic-gate 
1552*7c478bd9Sstevel@tonic-gate /*
1553*7c478bd9Sstevel@tonic-gate  * Remote file service routines
1554*7c478bd9Sstevel@tonic-gate  */
1555*7c478bd9Sstevel@tonic-gate program NFS4_PROGRAM {
1556*7c478bd9Sstevel@tonic-gate 	version NFS_V4 {
1557*7c478bd9Sstevel@tonic-gate 		void
1558*7c478bd9Sstevel@tonic-gate 			NFSPROC4_NULL(void) = 0;
1559*7c478bd9Sstevel@tonic-gate 
1560*7c478bd9Sstevel@tonic-gate 		COMPOUND4res
1561*7c478bd9Sstevel@tonic-gate 			NFSPROC4_COMPOUND(COMPOUND4args) = 1;
1562*7c478bd9Sstevel@tonic-gate 
1563*7c478bd9Sstevel@tonic-gate 	} = 4;
1564*7c478bd9Sstevel@tonic-gate } = 100003;
1565*7c478bd9Sstevel@tonic-gate 
1566*7c478bd9Sstevel@tonic-gate 
1567*7c478bd9Sstevel@tonic-gate 
1568*7c478bd9Sstevel@tonic-gate /*
1569*7c478bd9Sstevel@tonic-gate  * NFS4 Callback Procedure Definitions and Program
1570*7c478bd9Sstevel@tonic-gate  */
1571*7c478bd9Sstevel@tonic-gate 
1572*7c478bd9Sstevel@tonic-gate /*
1573*7c478bd9Sstevel@tonic-gate  * CB_GETATTR: Get Current Attributes
1574*7c478bd9Sstevel@tonic-gate  */
1575*7c478bd9Sstevel@tonic-gate struct CB_GETATTR4args {
1576*7c478bd9Sstevel@tonic-gate 	nfs_fh4	fh;
1577*7c478bd9Sstevel@tonic-gate 	bitmap4	attr_request;
1578*7c478bd9Sstevel@tonic-gate };
1579*7c478bd9Sstevel@tonic-gate 
1580*7c478bd9Sstevel@tonic-gate struct CB_GETATTR4resok {
1581*7c478bd9Sstevel@tonic-gate 	fattr4	obj_attributes;
1582*7c478bd9Sstevel@tonic-gate };
1583*7c478bd9Sstevel@tonic-gate 
1584*7c478bd9Sstevel@tonic-gate union CB_GETATTR4res switch (nfsstat4 status) {
1585*7c478bd9Sstevel@tonic-gate  case NFS4_OK:
1586*7c478bd9Sstevel@tonic-gate 	 CB_GETATTR4resok	resok4;
1587*7c478bd9Sstevel@tonic-gate  default:
1588*7c478bd9Sstevel@tonic-gate 	 void;
1589*7c478bd9Sstevel@tonic-gate };
1590*7c478bd9Sstevel@tonic-gate 
1591*7c478bd9Sstevel@tonic-gate /*
1592*7c478bd9Sstevel@tonic-gate  * CB_RECALL: Recall an Open Delegation
1593*7c478bd9Sstevel@tonic-gate  */
1594*7c478bd9Sstevel@tonic-gate struct CB_RECALL4args {
1595*7c478bd9Sstevel@tonic-gate 	stateid4	stateid;
1596*7c478bd9Sstevel@tonic-gate 	bool		truncate;
1597*7c478bd9Sstevel@tonic-gate 	nfs_fh4		fh;
1598*7c478bd9Sstevel@tonic-gate };
1599*7c478bd9Sstevel@tonic-gate 
1600*7c478bd9Sstevel@tonic-gate struct CB_RECALL4res {
1601*7c478bd9Sstevel@tonic-gate 	nfsstat4	status;
1602*7c478bd9Sstevel@tonic-gate };
1603*7c478bd9Sstevel@tonic-gate 
1604*7c478bd9Sstevel@tonic-gate /*
1605*7c478bd9Sstevel@tonic-gate  * CB_ILLEGAL: Response for illegal operation numbers
1606*7c478bd9Sstevel@tonic-gate  */
1607*7c478bd9Sstevel@tonic-gate struct CB_ILLEGAL4res {
1608*7c478bd9Sstevel@tonic-gate 	nfsstat4        status;
1609*7c478bd9Sstevel@tonic-gate };
1610*7c478bd9Sstevel@tonic-gate 
1611*7c478bd9Sstevel@tonic-gate /*
1612*7c478bd9Sstevel@tonic-gate  * Various definitions for CB_COMPOUND
1613*7c478bd9Sstevel@tonic-gate  */
1614*7c478bd9Sstevel@tonic-gate enum nfs_cb_opnum4 {
1615*7c478bd9Sstevel@tonic-gate 	OP_CB_GETATTR		= 3,
1616*7c478bd9Sstevel@tonic-gate 	OP_CB_RECALL		= 4,
1617*7c478bd9Sstevel@tonic-gate 	OP_CB_ILLEGAL		= 10044
1618*7c478bd9Sstevel@tonic-gate };
1619*7c478bd9Sstevel@tonic-gate 
1620*7c478bd9Sstevel@tonic-gate union nfs_cb_argop4 switch (unsigned argop) {
1621*7c478bd9Sstevel@tonic-gate  case OP_CB_GETATTR:	CB_GETATTR4args opcbgetattr;
1622*7c478bd9Sstevel@tonic-gate  case OP_CB_RECALL:	CB_RECALL4args	opcbrecall;
1623*7c478bd9Sstevel@tonic-gate  case OP_CB_ILLEGAL:	void;
1624*7c478bd9Sstevel@tonic-gate };
1625*7c478bd9Sstevel@tonic-gate 
1626*7c478bd9Sstevel@tonic-gate union nfs_cb_resop4 switch (unsigned resop){
1627*7c478bd9Sstevel@tonic-gate  case OP_CB_GETATTR:	CB_GETATTR4res	opcbgetattr;
1628*7c478bd9Sstevel@tonic-gate  case OP_CB_RECALL:	CB_RECALL4res	opcbrecall;
1629*7c478bd9Sstevel@tonic-gate  case OP_CB_ILLEGAL:	CB_ILLEGAL4res	opcbillegal;
1630*7c478bd9Sstevel@tonic-gate };
1631*7c478bd9Sstevel@tonic-gate 
1632*7c478bd9Sstevel@tonic-gate struct CB_COMPOUND4args {
1633*7c478bd9Sstevel@tonic-gate 	utf8str_cs	tag;
1634*7c478bd9Sstevel@tonic-gate 	uint32_t	minorversion;
1635*7c478bd9Sstevel@tonic-gate 	uint32_t	callback_ident;
1636*7c478bd9Sstevel@tonic-gate 	nfs_cb_argop4	argarray<>;
1637*7c478bd9Sstevel@tonic-gate };
1638*7c478bd9Sstevel@tonic-gate 
1639*7c478bd9Sstevel@tonic-gate struct CB_COMPOUND4res {
1640*7c478bd9Sstevel@tonic-gate 	nfsstat4 status;
1641*7c478bd9Sstevel@tonic-gate 	utf8str_cs	tag;
1642*7c478bd9Sstevel@tonic-gate 	nfs_cb_resop4	resarray<>;
1643*7c478bd9Sstevel@tonic-gate };
1644*7c478bd9Sstevel@tonic-gate 
1645*7c478bd9Sstevel@tonic-gate 
1646*7c478bd9Sstevel@tonic-gate /*
1647*7c478bd9Sstevel@tonic-gate  * Program number is in the transient range since the client
1648*7c478bd9Sstevel@tonic-gate  * will assign the exact transient program number and provide
1649*7c478bd9Sstevel@tonic-gate  * that to the server via the SETCLIENTID operation.
1650*7c478bd9Sstevel@tonic-gate  */
1651*7c478bd9Sstevel@tonic-gate program NFS4_CALLBACK {
1652*7c478bd9Sstevel@tonic-gate 	version NFS_CB {
1653*7c478bd9Sstevel@tonic-gate 		void
1654*7c478bd9Sstevel@tonic-gate 			CB_NULL(void) = 0;
1655*7c478bd9Sstevel@tonic-gate 		CB_COMPOUND4res
1656*7c478bd9Sstevel@tonic-gate 			CB_COMPOUND(CB_COMPOUND4args) = 1;
1657*7c478bd9Sstevel@tonic-gate 	} = 1;
1658*7c478bd9Sstevel@tonic-gate } = 0x40000000;
1659