xref: /titanic_53/usr/src/head/rpcsvc/nfs_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 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate %#pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
30*7c478bd9Sstevel@tonic-gate %
31*7c478bd9Sstevel@tonic-gate %/*
32*7c478bd9Sstevel@tonic-gate % * Definitions for uint64, int64, uint32, and int32
33*7c478bd9Sstevel@tonic-gate % */
34*7c478bd9Sstevel@tonic-gate %#include <rpc/rpc_sztypes.h>
35*7c478bd9Sstevel@tonic-gate %
36*7c478bd9Sstevel@tonic-gate #endif
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate const NFS_PORT          = 2049;
39*7c478bd9Sstevel@tonic-gate const NFS_MAXDATA       = 8192;
40*7c478bd9Sstevel@tonic-gate const NFS_MAXPATHLEN    = 1024;
41*7c478bd9Sstevel@tonic-gate const NFS_MAXNAMLEN	= 255;
42*7c478bd9Sstevel@tonic-gate const NFS_FHSIZE	= 32;
43*7c478bd9Sstevel@tonic-gate const NFS_COOKIESIZE	= 4;
44*7c478bd9Sstevel@tonic-gate const NFS_FIFO_DEV	= -1;	/* size kludge for named pipes */
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate /*
47*7c478bd9Sstevel@tonic-gate  * File types
48*7c478bd9Sstevel@tonic-gate  */
49*7c478bd9Sstevel@tonic-gate const NFSMODE_FMT  = 0170000;	/* type of file */
50*7c478bd9Sstevel@tonic-gate const NFSMODE_DIR  = 0040000;	/* directory */
51*7c478bd9Sstevel@tonic-gate const NFSMODE_CHR  = 0020000;	/* character special */
52*7c478bd9Sstevel@tonic-gate const NFSMODE_BLK  = 0060000;	/* block special */
53*7c478bd9Sstevel@tonic-gate const NFSMODE_REG  = 0100000;	/* regular */
54*7c478bd9Sstevel@tonic-gate const NFSMODE_LNK  = 0120000;	/* symbolic link */
55*7c478bd9Sstevel@tonic-gate const NFSMODE_SOCK = 0140000;	/* socket */
56*7c478bd9Sstevel@tonic-gate const NFSMODE_FIFO = 0010000;	/* fifo */
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate /*
59*7c478bd9Sstevel@tonic-gate  * Error status
60*7c478bd9Sstevel@tonic-gate  */
61*7c478bd9Sstevel@tonic-gate enum nfsstat {
62*7c478bd9Sstevel@tonic-gate 	NFS_OK= 0,		/* no error */
63*7c478bd9Sstevel@tonic-gate 	NFSERR_PERM=1,		/* Not owner */
64*7c478bd9Sstevel@tonic-gate 	NFSERR_NOENT=2,		/* No such file or directory */
65*7c478bd9Sstevel@tonic-gate 	NFSERR_IO=5,		/* I/O error */
66*7c478bd9Sstevel@tonic-gate 	NFSERR_NXIO=6,		/* No such device or address */
67*7c478bd9Sstevel@tonic-gate 	NFSERR_ACCES=13,	/* Permission denied */
68*7c478bd9Sstevel@tonic-gate 	NFSERR_EXIST=17,	/* File exists */
69*7c478bd9Sstevel@tonic-gate 	NFSERR_XDEV=18,		/* Cross-device link */
70*7c478bd9Sstevel@tonic-gate 	NFSERR_NODEV=19,	/* No such device */
71*7c478bd9Sstevel@tonic-gate 	NFSERR_NOTDIR=20,	/* Not a directory*/
72*7c478bd9Sstevel@tonic-gate 	NFSERR_ISDIR=21,	/* Is a directory */
73*7c478bd9Sstevel@tonic-gate 	NFSERR_INVAL=22,	/* Invalid argument */
74*7c478bd9Sstevel@tonic-gate 	NFSERR_FBIG=27,		/* File too large */
75*7c478bd9Sstevel@tonic-gate 	NFSERR_NOSPC=28,	/* No space left on device */
76*7c478bd9Sstevel@tonic-gate 	NFSERR_ROFS=30,		/* Read-only file system */
77*7c478bd9Sstevel@tonic-gate 	NFSERR_OPNOTSUPP=45,	/* Operation not supported */
78*7c478bd9Sstevel@tonic-gate 	NFSERR_NAMETOOLONG=63,	/* File name too long */
79*7c478bd9Sstevel@tonic-gate 	NFSERR_NOTEMPTY=66,	/* Directory not empty */
80*7c478bd9Sstevel@tonic-gate 	NFSERR_DQUOT=69,	/* Disc quota exceeded */
81*7c478bd9Sstevel@tonic-gate 	NFSERR_STALE=70,	/* Stale NFS file handle */
82*7c478bd9Sstevel@tonic-gate 	NFSERR_REMOTE=71,	/* Object is remote */
83*7c478bd9Sstevel@tonic-gate 	NFSERR_WFLUSH=72	/* write cache flushed */
84*7c478bd9Sstevel@tonic-gate };
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate /*
87*7c478bd9Sstevel@tonic-gate  * File types
88*7c478bd9Sstevel@tonic-gate  */
89*7c478bd9Sstevel@tonic-gate enum ftype {
90*7c478bd9Sstevel@tonic-gate 	NFNON = 0,	/* non-file */
91*7c478bd9Sstevel@tonic-gate 	NFREG = 1,	/* regular file */
92*7c478bd9Sstevel@tonic-gate 	NFDIR = 2,	/* directory */
93*7c478bd9Sstevel@tonic-gate 	NFBLK = 3,	/* block special */
94*7c478bd9Sstevel@tonic-gate 	NFCHR = 4,	/* character special */
95*7c478bd9Sstevel@tonic-gate 	NFLNK = 5,	/* symbolic link */
96*7c478bd9Sstevel@tonic-gate 	NFSOCK = 6,	/* unix domain sockets */
97*7c478bd9Sstevel@tonic-gate 	NFBAD = 7,	/* unused */
98*7c478bd9Sstevel@tonic-gate 	NFFIFO = 8 	/* named pipe */
99*7c478bd9Sstevel@tonic-gate };
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate /*
102*7c478bd9Sstevel@tonic-gate  * File access handle
103*7c478bd9Sstevel@tonic-gate  */
104*7c478bd9Sstevel@tonic-gate struct nfs_fh {
105*7c478bd9Sstevel@tonic-gate 	opaque data[NFS_FHSIZE];
106*7c478bd9Sstevel@tonic-gate };
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate /*
109*7c478bd9Sstevel@tonic-gate  * Timeval
110*7c478bd9Sstevel@tonic-gate  */
111*7c478bd9Sstevel@tonic-gate struct nfstime {
112*7c478bd9Sstevel@tonic-gate 	unsigned seconds;
113*7c478bd9Sstevel@tonic-gate 	unsigned useconds;
114*7c478bd9Sstevel@tonic-gate };
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate /*
118*7c478bd9Sstevel@tonic-gate  * File attributes
119*7c478bd9Sstevel@tonic-gate  */
120*7c478bd9Sstevel@tonic-gate struct fattr {
121*7c478bd9Sstevel@tonic-gate 	ftype type;		/* file type */
122*7c478bd9Sstevel@tonic-gate 	unsigned mode;		/* protection mode bits */
123*7c478bd9Sstevel@tonic-gate 	unsigned nlink;		/* # hard links */
124*7c478bd9Sstevel@tonic-gate 	unsigned uid;		/* owner user id */
125*7c478bd9Sstevel@tonic-gate 	unsigned gid;		/* owner group id */
126*7c478bd9Sstevel@tonic-gate 	unsigned size;		/* file size in bytes */
127*7c478bd9Sstevel@tonic-gate 	unsigned blocksize;	/* prefered block size */
128*7c478bd9Sstevel@tonic-gate 	unsigned rdev;		/* special device # */
129*7c478bd9Sstevel@tonic-gate 	unsigned blocks;	/* Kb of disk used by file */
130*7c478bd9Sstevel@tonic-gate 	unsigned fsid;		/* device # */
131*7c478bd9Sstevel@tonic-gate 	unsigned fileid;	/* inode # */
132*7c478bd9Sstevel@tonic-gate 	nfstime	atime;		/* time of last access */
133*7c478bd9Sstevel@tonic-gate 	nfstime	mtime;		/* time of last modification */
134*7c478bd9Sstevel@tonic-gate 	nfstime	ctime;		/* time of last change */
135*7c478bd9Sstevel@tonic-gate };
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate /*
138*7c478bd9Sstevel@tonic-gate  * File attributes which can be set
139*7c478bd9Sstevel@tonic-gate  */
140*7c478bd9Sstevel@tonic-gate struct sattr {
141*7c478bd9Sstevel@tonic-gate 	unsigned mode;	/* protection mode bits */
142*7c478bd9Sstevel@tonic-gate 	unsigned uid;	/* owner user id */
143*7c478bd9Sstevel@tonic-gate 	unsigned gid;	/* owner group id */
144*7c478bd9Sstevel@tonic-gate 	unsigned size;	/* file size in bytes */
145*7c478bd9Sstevel@tonic-gate 	nfstime	atime;	/* time of last access */
146*7c478bd9Sstevel@tonic-gate 	nfstime	mtime;	/* time of last modification */
147*7c478bd9Sstevel@tonic-gate };
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate typedef string filename<NFS_MAXNAMLEN>;
151*7c478bd9Sstevel@tonic-gate typedef string nfspath<NFS_MAXPATHLEN>;
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate /*
154*7c478bd9Sstevel@tonic-gate  * Reply status with file attributes
155*7c478bd9Sstevel@tonic-gate  */
156*7c478bd9Sstevel@tonic-gate union attrstat switch (nfsstat status) {
157*7c478bd9Sstevel@tonic-gate case NFS_OK:
158*7c478bd9Sstevel@tonic-gate 	fattr attributes;
159*7c478bd9Sstevel@tonic-gate default:
160*7c478bd9Sstevel@tonic-gate 	void;
161*7c478bd9Sstevel@tonic-gate };
162*7c478bd9Sstevel@tonic-gate 
163*7c478bd9Sstevel@tonic-gate struct sattrargs {
164*7c478bd9Sstevel@tonic-gate 	nfs_fh file;
165*7c478bd9Sstevel@tonic-gate 	sattr attributes;
166*7c478bd9Sstevel@tonic-gate };
167*7c478bd9Sstevel@tonic-gate 
168*7c478bd9Sstevel@tonic-gate /*
169*7c478bd9Sstevel@tonic-gate  * Arguments for directory operations
170*7c478bd9Sstevel@tonic-gate  */
171*7c478bd9Sstevel@tonic-gate struct diropargs {
172*7c478bd9Sstevel@tonic-gate 	nfs_fh	dir;	/* directory file handle */
173*7c478bd9Sstevel@tonic-gate 	filename name;		/* name (up to NFS_MAXNAMLEN bytes) */
174*7c478bd9Sstevel@tonic-gate };
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate struct diropokres {
177*7c478bd9Sstevel@tonic-gate 	nfs_fh file;
178*7c478bd9Sstevel@tonic-gate 	fattr attributes;
179*7c478bd9Sstevel@tonic-gate };
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate /*
182*7c478bd9Sstevel@tonic-gate  * Results from directory operation
183*7c478bd9Sstevel@tonic-gate  */
184*7c478bd9Sstevel@tonic-gate union diropres switch (nfsstat status) {
185*7c478bd9Sstevel@tonic-gate case NFS_OK:
186*7c478bd9Sstevel@tonic-gate 	diropokres diropres;
187*7c478bd9Sstevel@tonic-gate default:
188*7c478bd9Sstevel@tonic-gate 	void;
189*7c478bd9Sstevel@tonic-gate };
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate union readlinkres switch (nfsstat status) {
192*7c478bd9Sstevel@tonic-gate case NFS_OK:
193*7c478bd9Sstevel@tonic-gate 	nfspath data;
194*7c478bd9Sstevel@tonic-gate default:
195*7c478bd9Sstevel@tonic-gate 	void;
196*7c478bd9Sstevel@tonic-gate };
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate /*
199*7c478bd9Sstevel@tonic-gate  * Arguments to remote read
200*7c478bd9Sstevel@tonic-gate  */
201*7c478bd9Sstevel@tonic-gate struct readargs {
202*7c478bd9Sstevel@tonic-gate 	nfs_fh file;		/* handle for file */
203*7c478bd9Sstevel@tonic-gate 	unsigned offset;	/* byte offset in file */
204*7c478bd9Sstevel@tonic-gate 	unsigned count;		/* immediate read count */
205*7c478bd9Sstevel@tonic-gate 	unsigned totalcount;	/* total read count (from this offset)*/
206*7c478bd9Sstevel@tonic-gate };
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate /*
209*7c478bd9Sstevel@tonic-gate  * Status OK portion of remote read reply
210*7c478bd9Sstevel@tonic-gate  */
211*7c478bd9Sstevel@tonic-gate struct readokres {
212*7c478bd9Sstevel@tonic-gate 	fattr	attributes;	/* attributes, need for pagin*/
213*7c478bd9Sstevel@tonic-gate 	opaque data<NFS_MAXDATA>;
214*7c478bd9Sstevel@tonic-gate };
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate union readres switch (nfsstat status) {
217*7c478bd9Sstevel@tonic-gate case NFS_OK:
218*7c478bd9Sstevel@tonic-gate 	readokres reply;
219*7c478bd9Sstevel@tonic-gate default:
220*7c478bd9Sstevel@tonic-gate 	void;
221*7c478bd9Sstevel@tonic-gate };
222*7c478bd9Sstevel@tonic-gate 
223*7c478bd9Sstevel@tonic-gate /*
224*7c478bd9Sstevel@tonic-gate  * Arguments to remote write
225*7c478bd9Sstevel@tonic-gate  */
226*7c478bd9Sstevel@tonic-gate struct writeargs {
227*7c478bd9Sstevel@tonic-gate 	nfs_fh	file;		/* handle for file */
228*7c478bd9Sstevel@tonic-gate 	unsigned beginoffset;	/* beginning byte offset in file */
229*7c478bd9Sstevel@tonic-gate 	unsigned offset;	/* current byte offset in file */
230*7c478bd9Sstevel@tonic-gate 	unsigned totalcount;	/* total write count (to this offset)*/
231*7c478bd9Sstevel@tonic-gate 	opaque data<NFS_MAXDATA>;
232*7c478bd9Sstevel@tonic-gate };
233*7c478bd9Sstevel@tonic-gate 
234*7c478bd9Sstevel@tonic-gate struct createargs {
235*7c478bd9Sstevel@tonic-gate 	diropargs where;
236*7c478bd9Sstevel@tonic-gate 	sattr attributes;
237*7c478bd9Sstevel@tonic-gate };
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate struct renameargs {
240*7c478bd9Sstevel@tonic-gate 	diropargs from;
241*7c478bd9Sstevel@tonic-gate 	diropargs to;
242*7c478bd9Sstevel@tonic-gate };
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate struct linkargs {
245*7c478bd9Sstevel@tonic-gate 	nfs_fh from;
246*7c478bd9Sstevel@tonic-gate 	diropargs to;
247*7c478bd9Sstevel@tonic-gate };
248*7c478bd9Sstevel@tonic-gate 
249*7c478bd9Sstevel@tonic-gate struct symlinkargs {
250*7c478bd9Sstevel@tonic-gate 	diropargs from;
251*7c478bd9Sstevel@tonic-gate 	nfspath to;
252*7c478bd9Sstevel@tonic-gate 	sattr attributes;
253*7c478bd9Sstevel@tonic-gate };
254*7c478bd9Sstevel@tonic-gate 
255*7c478bd9Sstevel@tonic-gate 
256*7c478bd9Sstevel@tonic-gate typedef opaque nfscookie[NFS_COOKIESIZE];
257*7c478bd9Sstevel@tonic-gate 
258*7c478bd9Sstevel@tonic-gate /*
259*7c478bd9Sstevel@tonic-gate  * Arguments to readdir
260*7c478bd9Sstevel@tonic-gate  */
261*7c478bd9Sstevel@tonic-gate struct readdirargs {
262*7c478bd9Sstevel@tonic-gate 	nfs_fh dir;		/* directory handle */
263*7c478bd9Sstevel@tonic-gate 	nfscookie cookie;
264*7c478bd9Sstevel@tonic-gate 	unsigned count;		/* number of directory bytes to read */
265*7c478bd9Sstevel@tonic-gate };
266*7c478bd9Sstevel@tonic-gate 
267*7c478bd9Sstevel@tonic-gate struct entry {
268*7c478bd9Sstevel@tonic-gate 	unsigned fileid;
269*7c478bd9Sstevel@tonic-gate 	filename name;
270*7c478bd9Sstevel@tonic-gate 	nfscookie cookie;
271*7c478bd9Sstevel@tonic-gate 	entry *nextentry;
272*7c478bd9Sstevel@tonic-gate };
273*7c478bd9Sstevel@tonic-gate 
274*7c478bd9Sstevel@tonic-gate struct dirlist {
275*7c478bd9Sstevel@tonic-gate 	entry *entries;
276*7c478bd9Sstevel@tonic-gate 	bool eof;
277*7c478bd9Sstevel@tonic-gate };
278*7c478bd9Sstevel@tonic-gate 
279*7c478bd9Sstevel@tonic-gate union readdirres switch (nfsstat status) {
280*7c478bd9Sstevel@tonic-gate case NFS_OK:
281*7c478bd9Sstevel@tonic-gate 	dirlist reply;
282*7c478bd9Sstevel@tonic-gate default:
283*7c478bd9Sstevel@tonic-gate 	void;
284*7c478bd9Sstevel@tonic-gate };
285*7c478bd9Sstevel@tonic-gate 
286*7c478bd9Sstevel@tonic-gate struct statfsokres {
287*7c478bd9Sstevel@tonic-gate 	unsigned tsize;	/* preferred transfer size in bytes */
288*7c478bd9Sstevel@tonic-gate 	unsigned bsize;	/* fundamental file system block size */
289*7c478bd9Sstevel@tonic-gate 	unsigned blocks;	/* total blocks in file system */
290*7c478bd9Sstevel@tonic-gate 	unsigned bfree;	/* free blocks in fs */
291*7c478bd9Sstevel@tonic-gate 	unsigned bavail;	/* free blocks avail to non-superuser */
292*7c478bd9Sstevel@tonic-gate };
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate union statfsres switch (nfsstat status) {
295*7c478bd9Sstevel@tonic-gate case NFS_OK:
296*7c478bd9Sstevel@tonic-gate 	statfsokres reply;
297*7c478bd9Sstevel@tonic-gate default:
298*7c478bd9Sstevel@tonic-gate 	void;
299*7c478bd9Sstevel@tonic-gate };
300*7c478bd9Sstevel@tonic-gate 
301*7c478bd9Sstevel@tonic-gate /*
302*7c478bd9Sstevel@tonic-gate  * Remote file service routines
303*7c478bd9Sstevel@tonic-gate  */
304*7c478bd9Sstevel@tonic-gate program NFS_PROGRAM {
305*7c478bd9Sstevel@tonic-gate 	version NFS_VERSION {
306*7c478bd9Sstevel@tonic-gate 		void
307*7c478bd9Sstevel@tonic-gate 		NFSPROC_NULL(void) = 0;
308*7c478bd9Sstevel@tonic-gate 
309*7c478bd9Sstevel@tonic-gate 		attrstat
310*7c478bd9Sstevel@tonic-gate 		NFSPROC_GETATTR(nfs_fh) =	1;
311*7c478bd9Sstevel@tonic-gate 
312*7c478bd9Sstevel@tonic-gate 		attrstat
313*7c478bd9Sstevel@tonic-gate 		NFSPROC_SETATTR(sattrargs) = 2;
314*7c478bd9Sstevel@tonic-gate 
315*7c478bd9Sstevel@tonic-gate 		void
316*7c478bd9Sstevel@tonic-gate 		NFSPROC_ROOT(void) = 3;
317*7c478bd9Sstevel@tonic-gate 
318*7c478bd9Sstevel@tonic-gate 		diropres
319*7c478bd9Sstevel@tonic-gate 		NFSPROC_LOOKUP(diropargs) = 4;
320*7c478bd9Sstevel@tonic-gate 
321*7c478bd9Sstevel@tonic-gate 		readlinkres
322*7c478bd9Sstevel@tonic-gate 		NFSPROC_READLINK(nfs_fh) = 5;
323*7c478bd9Sstevel@tonic-gate 
324*7c478bd9Sstevel@tonic-gate 		readres
325*7c478bd9Sstevel@tonic-gate 		NFSPROC_READ(readargs) = 6;
326*7c478bd9Sstevel@tonic-gate 
327*7c478bd9Sstevel@tonic-gate 		void
328*7c478bd9Sstevel@tonic-gate 		NFSPROC_WRITECACHE(void) = 7;
329*7c478bd9Sstevel@tonic-gate 
330*7c478bd9Sstevel@tonic-gate 		attrstat
331*7c478bd9Sstevel@tonic-gate 		NFSPROC_WRITE(writeargs) = 8;
332*7c478bd9Sstevel@tonic-gate 
333*7c478bd9Sstevel@tonic-gate 		diropres
334*7c478bd9Sstevel@tonic-gate 		NFSPROC_CREATE(createargs) = 9;
335*7c478bd9Sstevel@tonic-gate 
336*7c478bd9Sstevel@tonic-gate 		nfsstat
337*7c478bd9Sstevel@tonic-gate 		NFSPROC_REMOVE(diropargs) = 10;
338*7c478bd9Sstevel@tonic-gate 
339*7c478bd9Sstevel@tonic-gate 		nfsstat
340*7c478bd9Sstevel@tonic-gate 		NFSPROC_RENAME(renameargs) = 11;
341*7c478bd9Sstevel@tonic-gate 
342*7c478bd9Sstevel@tonic-gate 		nfsstat
343*7c478bd9Sstevel@tonic-gate 		NFSPROC_LINK(linkargs) = 12;
344*7c478bd9Sstevel@tonic-gate 
345*7c478bd9Sstevel@tonic-gate 		nfsstat
346*7c478bd9Sstevel@tonic-gate 		NFSPROC_SYMLINK(symlinkargs) = 13;
347*7c478bd9Sstevel@tonic-gate 
348*7c478bd9Sstevel@tonic-gate 		diropres
349*7c478bd9Sstevel@tonic-gate 		NFSPROC_MKDIR(createargs) = 14;
350*7c478bd9Sstevel@tonic-gate 
351*7c478bd9Sstevel@tonic-gate 		nfsstat
352*7c478bd9Sstevel@tonic-gate 		NFSPROC_RMDIR(diropargs) = 15;
353*7c478bd9Sstevel@tonic-gate 
354*7c478bd9Sstevel@tonic-gate 		readdirres
355*7c478bd9Sstevel@tonic-gate 		NFSPROC_READDIR(readdirargs) = 16;
356*7c478bd9Sstevel@tonic-gate 
357*7c478bd9Sstevel@tonic-gate 		statfsres
358*7c478bd9Sstevel@tonic-gate 		NFSPROC_STATFS(nfs_fh) = 17;
359*7c478bd9Sstevel@tonic-gate 	} = 2;
360*7c478bd9Sstevel@tonic-gate } = 100003;
361*7c478bd9Sstevel@tonic-gate 
362*7c478bd9Sstevel@tonic-gate /*
363*7c478bd9Sstevel@tonic-gate  * Version 3 declarations and definitions.
364*7c478bd9Sstevel@tonic-gate  */
365*7c478bd9Sstevel@tonic-gate 
366*7c478bd9Sstevel@tonic-gate /*
367*7c478bd9Sstevel@tonic-gate  * Sizes
368*7c478bd9Sstevel@tonic-gate  */
369*7c478bd9Sstevel@tonic-gate const NFS3_FHSIZE         = 64;
370*7c478bd9Sstevel@tonic-gate const NFS3_COOKIEVERFSIZE = 8;
371*7c478bd9Sstevel@tonic-gate const NFS3_CREATEVERFSIZE = 8;
372*7c478bd9Sstevel@tonic-gate const NFS3_WRITEVERFSIZE  = 8;
373*7c478bd9Sstevel@tonic-gate 
374*7c478bd9Sstevel@tonic-gate /*
375*7c478bd9Sstevel@tonic-gate  * Basic data types
376*7c478bd9Sstevel@tonic-gate  */
377*7c478bd9Sstevel@tonic-gate typedef string		filename3<>;
378*7c478bd9Sstevel@tonic-gate typedef string		nfspath3<>;
379*7c478bd9Sstevel@tonic-gate typedef uint64		fileid3;
380*7c478bd9Sstevel@tonic-gate typedef uint64		cookie3;
381*7c478bd9Sstevel@tonic-gate typedef opaque		cookieverf3[NFS3_COOKIEVERFSIZE];
382*7c478bd9Sstevel@tonic-gate typedef opaque		createverf3[NFS3_CREATEVERFSIZE];
383*7c478bd9Sstevel@tonic-gate typedef opaque		writeverf3[NFS3_WRITEVERFSIZE];
384*7c478bd9Sstevel@tonic-gate typedef uint32		uid3;
385*7c478bd9Sstevel@tonic-gate typedef uint32		gid3;
386*7c478bd9Sstevel@tonic-gate typedef uint64		size3;
387*7c478bd9Sstevel@tonic-gate typedef uint64		offset3;
388*7c478bd9Sstevel@tonic-gate typedef uint32		mode3;
389*7c478bd9Sstevel@tonic-gate typedef uint32		count3;
390*7c478bd9Sstevel@tonic-gate 
391*7c478bd9Sstevel@tonic-gate /*
392*7c478bd9Sstevel@tonic-gate  * Error status
393*7c478bd9Sstevel@tonic-gate  */
394*7c478bd9Sstevel@tonic-gate enum nfsstat3 {
395*7c478bd9Sstevel@tonic-gate 	NFS3_OK = 0,
396*7c478bd9Sstevel@tonic-gate 	NFS3ERR_PERM = 1,
397*7c478bd9Sstevel@tonic-gate 	NFS3ERR_NOENT = 2,
398*7c478bd9Sstevel@tonic-gate 	NFS3ERR_IO = 5,
399*7c478bd9Sstevel@tonic-gate 	NFS3ERR_NXIO = 6,
400*7c478bd9Sstevel@tonic-gate 	NFS3ERR_ACCES = 13,
401*7c478bd9Sstevel@tonic-gate 	NFS3ERR_EXIST = 17,
402*7c478bd9Sstevel@tonic-gate 	NFS3ERR_XDEV = 18,
403*7c478bd9Sstevel@tonic-gate 	NFS3ERR_NODEV = 19,
404*7c478bd9Sstevel@tonic-gate 	NFS3ERR_NOTDIR = 20,
405*7c478bd9Sstevel@tonic-gate 	NFS3ERR_ISDIR = 21,
406*7c478bd9Sstevel@tonic-gate 	NFS3ERR_INVAL = 22,
407*7c478bd9Sstevel@tonic-gate 	NFS3ERR_FBIG = 27,
408*7c478bd9Sstevel@tonic-gate 	NFS3ERR_NOSPC = 28,
409*7c478bd9Sstevel@tonic-gate 	NFS3ERR_ROFS = 30,
410*7c478bd9Sstevel@tonic-gate 	NFS3ERR_MLINK = 31,
411*7c478bd9Sstevel@tonic-gate 	NFS3ERR_NAMETOOLONG = 63,
412*7c478bd9Sstevel@tonic-gate 	NFS3ERR_NOTEMPTY = 66,
413*7c478bd9Sstevel@tonic-gate 	NFS3ERR_DQUOT = 69,
414*7c478bd9Sstevel@tonic-gate 	NFS3ERR_STALE = 70,
415*7c478bd9Sstevel@tonic-gate 	NFS3ERR_REMOTE = 71,
416*7c478bd9Sstevel@tonic-gate 	NFS3ERR_BADHANDLE = 10001,
417*7c478bd9Sstevel@tonic-gate 	NFS3ERR_NOT_SYNC = 10002,
418*7c478bd9Sstevel@tonic-gate 	NFS3ERR_BAD_COOKIE = 10003,
419*7c478bd9Sstevel@tonic-gate 	NFS3ERR_NOTSUPP = 10004,
420*7c478bd9Sstevel@tonic-gate 	NFS3ERR_TOOSMALL = 10005,
421*7c478bd9Sstevel@tonic-gate 	NFS3ERR_SERVERFAULT = 10006,
422*7c478bd9Sstevel@tonic-gate 	NFS3ERR_BADTYPE = 10007,
423*7c478bd9Sstevel@tonic-gate 	NFS3ERR_JUKEBOX = 10008
424*7c478bd9Sstevel@tonic-gate };
425*7c478bd9Sstevel@tonic-gate 
426*7c478bd9Sstevel@tonic-gate /*
427*7c478bd9Sstevel@tonic-gate  * File types
428*7c478bd9Sstevel@tonic-gate  */
429*7c478bd9Sstevel@tonic-gate enum ftype3 {
430*7c478bd9Sstevel@tonic-gate 	NF3REG = 1,
431*7c478bd9Sstevel@tonic-gate 	NF3DIR = 2,
432*7c478bd9Sstevel@tonic-gate 	NF3BLK = 3,
433*7c478bd9Sstevel@tonic-gate 	NF3CHR = 4,
434*7c478bd9Sstevel@tonic-gate 	NF3LNK = 5,
435*7c478bd9Sstevel@tonic-gate 	NF3SOCK = 6,
436*7c478bd9Sstevel@tonic-gate 	NF3FIFO = 7
437*7c478bd9Sstevel@tonic-gate };
438*7c478bd9Sstevel@tonic-gate 
439*7c478bd9Sstevel@tonic-gate struct specdata3 {
440*7c478bd9Sstevel@tonic-gate 	uint32	specdata1;
441*7c478bd9Sstevel@tonic-gate 	uint32	specdata2;
442*7c478bd9Sstevel@tonic-gate };
443*7c478bd9Sstevel@tonic-gate 
444*7c478bd9Sstevel@tonic-gate /*
445*7c478bd9Sstevel@tonic-gate  * File access handle
446*7c478bd9Sstevel@tonic-gate  */
447*7c478bd9Sstevel@tonic-gate struct nfs_fh3 {
448*7c478bd9Sstevel@tonic-gate 	opaque data<NFS3_FHSIZE>;
449*7c478bd9Sstevel@tonic-gate };
450*7c478bd9Sstevel@tonic-gate 
451*7c478bd9Sstevel@tonic-gate /*
452*7c478bd9Sstevel@tonic-gate  * Timeval
453*7c478bd9Sstevel@tonic-gate  */
454*7c478bd9Sstevel@tonic-gate struct nfstime3 {
455*7c478bd9Sstevel@tonic-gate 	uint32 seconds;
456*7c478bd9Sstevel@tonic-gate 	uint32 nseconds;
457*7c478bd9Sstevel@tonic-gate };
458*7c478bd9Sstevel@tonic-gate 
459*7c478bd9Sstevel@tonic-gate /*
460*7c478bd9Sstevel@tonic-gate  * File attributes
461*7c478bd9Sstevel@tonic-gate  */
462*7c478bd9Sstevel@tonic-gate struct fattr3 {
463*7c478bd9Sstevel@tonic-gate 	ftype3	  type;
464*7c478bd9Sstevel@tonic-gate 	mode3	  mode;
465*7c478bd9Sstevel@tonic-gate 	uint32	  nlink;
466*7c478bd9Sstevel@tonic-gate 	uid3	  uid;
467*7c478bd9Sstevel@tonic-gate 	gid3	  gid;
468*7c478bd9Sstevel@tonic-gate 	size3	  size;
469*7c478bd9Sstevel@tonic-gate 	size3	  used;
470*7c478bd9Sstevel@tonic-gate 	specdata3 rdev;
471*7c478bd9Sstevel@tonic-gate 	uint64	  fsid;
472*7c478bd9Sstevel@tonic-gate 	fileid3	  fileid;
473*7c478bd9Sstevel@tonic-gate 	nfstime3  atime;
474*7c478bd9Sstevel@tonic-gate 	nfstime3  mtime;
475*7c478bd9Sstevel@tonic-gate 	nfstime3  ctime;
476*7c478bd9Sstevel@tonic-gate };
477*7c478bd9Sstevel@tonic-gate 
478*7c478bd9Sstevel@tonic-gate /*
479*7c478bd9Sstevel@tonic-gate  * File attributes
480*7c478bd9Sstevel@tonic-gate  */
481*7c478bd9Sstevel@tonic-gate union post_op_attr switch (bool attributes_follow) {
482*7c478bd9Sstevel@tonic-gate case TRUE:
483*7c478bd9Sstevel@tonic-gate 	fattr3 attributes;
484*7c478bd9Sstevel@tonic-gate case FALSE:
485*7c478bd9Sstevel@tonic-gate 	void;
486*7c478bd9Sstevel@tonic-gate };
487*7c478bd9Sstevel@tonic-gate 
488*7c478bd9Sstevel@tonic-gate struct wcc_attr {
489*7c478bd9Sstevel@tonic-gate 	size3	 size;
490*7c478bd9Sstevel@tonic-gate 	nfstime3 mtime;
491*7c478bd9Sstevel@tonic-gate 	nfstime3 ctime;
492*7c478bd9Sstevel@tonic-gate };
493*7c478bd9Sstevel@tonic-gate 
494*7c478bd9Sstevel@tonic-gate union pre_op_attr switch (bool attributes_follow) {
495*7c478bd9Sstevel@tonic-gate case TRUE:
496*7c478bd9Sstevel@tonic-gate 	wcc_attr attributes;
497*7c478bd9Sstevel@tonic-gate case FALSE:
498*7c478bd9Sstevel@tonic-gate 	void;
499*7c478bd9Sstevel@tonic-gate };
500*7c478bd9Sstevel@tonic-gate 
501*7c478bd9Sstevel@tonic-gate struct wcc_data {
502*7c478bd9Sstevel@tonic-gate 	pre_op_attr  before;
503*7c478bd9Sstevel@tonic-gate 	post_op_attr after;
504*7c478bd9Sstevel@tonic-gate };
505*7c478bd9Sstevel@tonic-gate 
506*7c478bd9Sstevel@tonic-gate union post_op_fh3 switch (bool handle_follows) {
507*7c478bd9Sstevel@tonic-gate case TRUE:
508*7c478bd9Sstevel@tonic-gate 	nfs_fh3 handle;
509*7c478bd9Sstevel@tonic-gate case FALSE:
510*7c478bd9Sstevel@tonic-gate 	void;
511*7c478bd9Sstevel@tonic-gate };
512*7c478bd9Sstevel@tonic-gate 
513*7c478bd9Sstevel@tonic-gate enum time_how {
514*7c478bd9Sstevel@tonic-gate 	DONT_CHANGE	   = 0,
515*7c478bd9Sstevel@tonic-gate 	SET_TO_SERVER_TIME = 1,
516*7c478bd9Sstevel@tonic-gate 	SET_TO_CLIENT_TIME = 2
517*7c478bd9Sstevel@tonic-gate };
518*7c478bd9Sstevel@tonic-gate 
519*7c478bd9Sstevel@tonic-gate union set_mode3 switch (bool set_it) {
520*7c478bd9Sstevel@tonic-gate case TRUE:
521*7c478bd9Sstevel@tonic-gate 	mode3 mode;
522*7c478bd9Sstevel@tonic-gate default:
523*7c478bd9Sstevel@tonic-gate 	void;
524*7c478bd9Sstevel@tonic-gate };
525*7c478bd9Sstevel@tonic-gate 
526*7c478bd9Sstevel@tonic-gate union set_uid3 switch (bool set_it) {
527*7c478bd9Sstevel@tonic-gate case TRUE:
528*7c478bd9Sstevel@tonic-gate 	uid3 uid;
529*7c478bd9Sstevel@tonic-gate default:
530*7c478bd9Sstevel@tonic-gate 	void;
531*7c478bd9Sstevel@tonic-gate };
532*7c478bd9Sstevel@tonic-gate 
533*7c478bd9Sstevel@tonic-gate union set_gid3 switch (bool set_it) {
534*7c478bd9Sstevel@tonic-gate case TRUE:
535*7c478bd9Sstevel@tonic-gate 	gid3 gid;
536*7c478bd9Sstevel@tonic-gate default:
537*7c478bd9Sstevel@tonic-gate 	void;
538*7c478bd9Sstevel@tonic-gate };
539*7c478bd9Sstevel@tonic-gate 
540*7c478bd9Sstevel@tonic-gate union set_size3 switch (bool set_it) {
541*7c478bd9Sstevel@tonic-gate case TRUE:
542*7c478bd9Sstevel@tonic-gate 	size3	size;
543*7c478bd9Sstevel@tonic-gate default:
544*7c478bd9Sstevel@tonic-gate 	void;
545*7c478bd9Sstevel@tonic-gate };
546*7c478bd9Sstevel@tonic-gate 
547*7c478bd9Sstevel@tonic-gate union set_atime switch (time_how set_it) {
548*7c478bd9Sstevel@tonic-gate case SET_TO_CLIENT_TIME:
549*7c478bd9Sstevel@tonic-gate 	nfstime3 atime;
550*7c478bd9Sstevel@tonic-gate default:
551*7c478bd9Sstevel@tonic-gate 	void;
552*7c478bd9Sstevel@tonic-gate };
553*7c478bd9Sstevel@tonic-gate 
554*7c478bd9Sstevel@tonic-gate union set_mtime switch (time_how set_it) {
555*7c478bd9Sstevel@tonic-gate case SET_TO_CLIENT_TIME:
556*7c478bd9Sstevel@tonic-gate 	nfstime3 mtime;
557*7c478bd9Sstevel@tonic-gate default:
558*7c478bd9Sstevel@tonic-gate 	void;
559*7c478bd9Sstevel@tonic-gate };
560*7c478bd9Sstevel@tonic-gate 
561*7c478bd9Sstevel@tonic-gate struct sattr3 {
562*7c478bd9Sstevel@tonic-gate 	set_mode3 mode;
563*7c478bd9Sstevel@tonic-gate 	set_uid3  uid;
564*7c478bd9Sstevel@tonic-gate 	set_gid3  gid;
565*7c478bd9Sstevel@tonic-gate 	set_size3 size;
566*7c478bd9Sstevel@tonic-gate 	set_atime atime;
567*7c478bd9Sstevel@tonic-gate 	set_mtime mtime;
568*7c478bd9Sstevel@tonic-gate };
569*7c478bd9Sstevel@tonic-gate 
570*7c478bd9Sstevel@tonic-gate struct diropargs3 {
571*7c478bd9Sstevel@tonic-gate 	nfs_fh3   dir;
572*7c478bd9Sstevel@tonic-gate 	filename3 name;
573*7c478bd9Sstevel@tonic-gate };
574*7c478bd9Sstevel@tonic-gate 
575*7c478bd9Sstevel@tonic-gate /*
576*7c478bd9Sstevel@tonic-gate  * GETATTR: Get file attributes
577*7c478bd9Sstevel@tonic-gate  */
578*7c478bd9Sstevel@tonic-gate struct GETATTR3args {
579*7c478bd9Sstevel@tonic-gate 	nfs_fh3 object;
580*7c478bd9Sstevel@tonic-gate };
581*7c478bd9Sstevel@tonic-gate 
582*7c478bd9Sstevel@tonic-gate struct GETATTR3resok {
583*7c478bd9Sstevel@tonic-gate 	fattr3 obj_attributes;
584*7c478bd9Sstevel@tonic-gate };
585*7c478bd9Sstevel@tonic-gate 
586*7c478bd9Sstevel@tonic-gate union GETATTR3res switch (nfsstat3 status) {
587*7c478bd9Sstevel@tonic-gate case NFS3_OK:
588*7c478bd9Sstevel@tonic-gate 	GETATTR3resok resok;
589*7c478bd9Sstevel@tonic-gate default:
590*7c478bd9Sstevel@tonic-gate 	void;
591*7c478bd9Sstevel@tonic-gate };
592*7c478bd9Sstevel@tonic-gate 
593*7c478bd9Sstevel@tonic-gate /*
594*7c478bd9Sstevel@tonic-gate  * SETATTR: Set file attributes
595*7c478bd9Sstevel@tonic-gate  */
596*7c478bd9Sstevel@tonic-gate union sattrguard3 switch (bool check) {
597*7c478bd9Sstevel@tonic-gate case TRUE:
598*7c478bd9Sstevel@tonic-gate 	nfstime3 obj_ctime;
599*7c478bd9Sstevel@tonic-gate case FALSE:
600*7c478bd9Sstevel@tonic-gate 	void;
601*7c478bd9Sstevel@tonic-gate };
602*7c478bd9Sstevel@tonic-gate 
603*7c478bd9Sstevel@tonic-gate struct SETATTR3args {
604*7c478bd9Sstevel@tonic-gate 	nfs_fh3     object;
605*7c478bd9Sstevel@tonic-gate 	sattr3	    new_attributes;
606*7c478bd9Sstevel@tonic-gate 	sattrguard3 guard;
607*7c478bd9Sstevel@tonic-gate };
608*7c478bd9Sstevel@tonic-gate 
609*7c478bd9Sstevel@tonic-gate struct SETATTR3resok {
610*7c478bd9Sstevel@tonic-gate 	wcc_data obj_wcc;
611*7c478bd9Sstevel@tonic-gate };
612*7c478bd9Sstevel@tonic-gate 
613*7c478bd9Sstevel@tonic-gate struct SETATTR3resfail {
614*7c478bd9Sstevel@tonic-gate 	wcc_data obj_wcc;
615*7c478bd9Sstevel@tonic-gate };
616*7c478bd9Sstevel@tonic-gate 
617*7c478bd9Sstevel@tonic-gate union SETATTR3res switch (nfsstat3 status) {
618*7c478bd9Sstevel@tonic-gate case NFS3_OK:
619*7c478bd9Sstevel@tonic-gate 	SETATTR3resok	resok;
620*7c478bd9Sstevel@tonic-gate default:
621*7c478bd9Sstevel@tonic-gate 	SETATTR3resfail	resfail;
622*7c478bd9Sstevel@tonic-gate };
623*7c478bd9Sstevel@tonic-gate 
624*7c478bd9Sstevel@tonic-gate /*
625*7c478bd9Sstevel@tonic-gate  * LOOKUP: Lookup filename
626*7c478bd9Sstevel@tonic-gate  */
627*7c478bd9Sstevel@tonic-gate struct LOOKUP3args {
628*7c478bd9Sstevel@tonic-gate 	diropargs3 what;
629*7c478bd9Sstevel@tonic-gate };
630*7c478bd9Sstevel@tonic-gate 
631*7c478bd9Sstevel@tonic-gate struct LOOKUP3resok {
632*7c478bd9Sstevel@tonic-gate 	nfs_fh3		object;
633*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
634*7c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
635*7c478bd9Sstevel@tonic-gate };
636*7c478bd9Sstevel@tonic-gate 
637*7c478bd9Sstevel@tonic-gate struct LOOKUP3resfail {
638*7c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
639*7c478bd9Sstevel@tonic-gate };
640*7c478bd9Sstevel@tonic-gate 
641*7c478bd9Sstevel@tonic-gate union LOOKUP3res switch (nfsstat3 status) {
642*7c478bd9Sstevel@tonic-gate case NFS3_OK:
643*7c478bd9Sstevel@tonic-gate 	LOOKUP3resok	resok;
644*7c478bd9Sstevel@tonic-gate default:
645*7c478bd9Sstevel@tonic-gate 	LOOKUP3resfail	resfail;
646*7c478bd9Sstevel@tonic-gate };
647*7c478bd9Sstevel@tonic-gate 
648*7c478bd9Sstevel@tonic-gate /*
649*7c478bd9Sstevel@tonic-gate  * ACCESS: Check access permission
650*7c478bd9Sstevel@tonic-gate  */
651*7c478bd9Sstevel@tonic-gate const ACCESS3_READ	= 0x0001;
652*7c478bd9Sstevel@tonic-gate const ACCESS3_LOOKUP	= 0x0002;
653*7c478bd9Sstevel@tonic-gate const ACCESS3_MODIFY	= 0x0004;
654*7c478bd9Sstevel@tonic-gate const ACCESS3_EXTEND	= 0x0008;
655*7c478bd9Sstevel@tonic-gate const ACCESS3_DELETE	= 0x0010;
656*7c478bd9Sstevel@tonic-gate const ACCESS3_EXECUTE	= 0x0020;
657*7c478bd9Sstevel@tonic-gate 
658*7c478bd9Sstevel@tonic-gate struct ACCESS3args {
659*7c478bd9Sstevel@tonic-gate 	nfs_fh3	object;
660*7c478bd9Sstevel@tonic-gate 	uint32	access;
661*7c478bd9Sstevel@tonic-gate };
662*7c478bd9Sstevel@tonic-gate 
663*7c478bd9Sstevel@tonic-gate struct ACCESS3resok {
664*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
665*7c478bd9Sstevel@tonic-gate 	uint32		access;
666*7c478bd9Sstevel@tonic-gate };
667*7c478bd9Sstevel@tonic-gate 
668*7c478bd9Sstevel@tonic-gate struct ACCESS3resfail {
669*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
670*7c478bd9Sstevel@tonic-gate };
671*7c478bd9Sstevel@tonic-gate 
672*7c478bd9Sstevel@tonic-gate union ACCESS3res switch (nfsstat3 status) {
673*7c478bd9Sstevel@tonic-gate case NFS3_OK:
674*7c478bd9Sstevel@tonic-gate 	ACCESS3resok	resok;
675*7c478bd9Sstevel@tonic-gate default:
676*7c478bd9Sstevel@tonic-gate 	ACCESS3resfail	resfail;
677*7c478bd9Sstevel@tonic-gate };
678*7c478bd9Sstevel@tonic-gate 
679*7c478bd9Sstevel@tonic-gate /*
680*7c478bd9Sstevel@tonic-gate  * READLINK: Read from symbolic link
681*7c478bd9Sstevel@tonic-gate  */
682*7c478bd9Sstevel@tonic-gate struct READLINK3args {
683*7c478bd9Sstevel@tonic-gate 	nfs_fh3	symlink;
684*7c478bd9Sstevel@tonic-gate };
685*7c478bd9Sstevel@tonic-gate 
686*7c478bd9Sstevel@tonic-gate struct READLINK3resok {
687*7c478bd9Sstevel@tonic-gate 	post_op_attr	symlink_attributes;
688*7c478bd9Sstevel@tonic-gate 	nfspath3	data;
689*7c478bd9Sstevel@tonic-gate };
690*7c478bd9Sstevel@tonic-gate 
691*7c478bd9Sstevel@tonic-gate struct READLINK3resfail {
692*7c478bd9Sstevel@tonic-gate 	post_op_attr	symlink_attributes;
693*7c478bd9Sstevel@tonic-gate };
694*7c478bd9Sstevel@tonic-gate 
695*7c478bd9Sstevel@tonic-gate union READLINK3res switch (nfsstat3 status) {
696*7c478bd9Sstevel@tonic-gate case NFS3_OK:
697*7c478bd9Sstevel@tonic-gate 	READLINK3resok	 resok;
698*7c478bd9Sstevel@tonic-gate default:
699*7c478bd9Sstevel@tonic-gate 	READLINK3resfail resfail;
700*7c478bd9Sstevel@tonic-gate };
701*7c478bd9Sstevel@tonic-gate 
702*7c478bd9Sstevel@tonic-gate /*
703*7c478bd9Sstevel@tonic-gate  * READ: Read from file
704*7c478bd9Sstevel@tonic-gate  */
705*7c478bd9Sstevel@tonic-gate struct READ3args {
706*7c478bd9Sstevel@tonic-gate 	nfs_fh3		file;
707*7c478bd9Sstevel@tonic-gate 	offset3		offset;
708*7c478bd9Sstevel@tonic-gate 	count3		count;
709*7c478bd9Sstevel@tonic-gate };
710*7c478bd9Sstevel@tonic-gate 
711*7c478bd9Sstevel@tonic-gate struct READ3resok {
712*7c478bd9Sstevel@tonic-gate 	post_op_attr	file_attributes;
713*7c478bd9Sstevel@tonic-gate 	count3		count;
714*7c478bd9Sstevel@tonic-gate 	bool		eof;
715*7c478bd9Sstevel@tonic-gate 	opaque		data<>;
716*7c478bd9Sstevel@tonic-gate };
717*7c478bd9Sstevel@tonic-gate 
718*7c478bd9Sstevel@tonic-gate struct READ3resfail {
719*7c478bd9Sstevel@tonic-gate 	post_op_attr	file_attributes;
720*7c478bd9Sstevel@tonic-gate };
721*7c478bd9Sstevel@tonic-gate 
722*7c478bd9Sstevel@tonic-gate union READ3res switch (nfsstat3 status) {
723*7c478bd9Sstevel@tonic-gate case NFS3_OK:
724*7c478bd9Sstevel@tonic-gate 	READ3resok	resok;
725*7c478bd9Sstevel@tonic-gate default:
726*7c478bd9Sstevel@tonic-gate 	READ3resfail	resfail;
727*7c478bd9Sstevel@tonic-gate };
728*7c478bd9Sstevel@tonic-gate 
729*7c478bd9Sstevel@tonic-gate /*
730*7c478bd9Sstevel@tonic-gate  * WRITE: Write to file
731*7c478bd9Sstevel@tonic-gate  */
732*7c478bd9Sstevel@tonic-gate enum stable_how {
733*7c478bd9Sstevel@tonic-gate 	UNSTABLE  = 0,
734*7c478bd9Sstevel@tonic-gate 	DATA_SYNC = 1,
735*7c478bd9Sstevel@tonic-gate 	FILE_SYNC = 2
736*7c478bd9Sstevel@tonic-gate };
737*7c478bd9Sstevel@tonic-gate 
738*7c478bd9Sstevel@tonic-gate struct WRITE3args {
739*7c478bd9Sstevel@tonic-gate 	nfs_fh3		file;
740*7c478bd9Sstevel@tonic-gate 	offset3		offset;
741*7c478bd9Sstevel@tonic-gate 	count3		count;
742*7c478bd9Sstevel@tonic-gate 	stable_how	stable;
743*7c478bd9Sstevel@tonic-gate 	opaque		data<>;
744*7c478bd9Sstevel@tonic-gate };
745*7c478bd9Sstevel@tonic-gate 
746*7c478bd9Sstevel@tonic-gate struct WRITE3resok {
747*7c478bd9Sstevel@tonic-gate 	wcc_data	file_wcc;
748*7c478bd9Sstevel@tonic-gate 	count3		count;
749*7c478bd9Sstevel@tonic-gate 	stable_how	committed;
750*7c478bd9Sstevel@tonic-gate 	writeverf3	verf;
751*7c478bd9Sstevel@tonic-gate };
752*7c478bd9Sstevel@tonic-gate 
753*7c478bd9Sstevel@tonic-gate struct WRITE3resfail {
754*7c478bd9Sstevel@tonic-gate 	wcc_data	file_wcc;
755*7c478bd9Sstevel@tonic-gate };
756*7c478bd9Sstevel@tonic-gate 
757*7c478bd9Sstevel@tonic-gate union WRITE3res switch (nfsstat3 status) {
758*7c478bd9Sstevel@tonic-gate case NFS3_OK:
759*7c478bd9Sstevel@tonic-gate 	WRITE3resok	resok;
760*7c478bd9Sstevel@tonic-gate default:
761*7c478bd9Sstevel@tonic-gate 	WRITE3resfail	resfail;
762*7c478bd9Sstevel@tonic-gate };
763*7c478bd9Sstevel@tonic-gate 
764*7c478bd9Sstevel@tonic-gate /*
765*7c478bd9Sstevel@tonic-gate  * CREATE: Create a file
766*7c478bd9Sstevel@tonic-gate  */
767*7c478bd9Sstevel@tonic-gate enum createmode3 {
768*7c478bd9Sstevel@tonic-gate 	UNCHECKED = 0,
769*7c478bd9Sstevel@tonic-gate 	GUARDED	  = 1,
770*7c478bd9Sstevel@tonic-gate 	EXCLUSIVE = 2
771*7c478bd9Sstevel@tonic-gate };
772*7c478bd9Sstevel@tonic-gate 
773*7c478bd9Sstevel@tonic-gate union createhow3 switch (createmode3 mode) {
774*7c478bd9Sstevel@tonic-gate case UNCHECKED:
775*7c478bd9Sstevel@tonic-gate case GUARDED:
776*7c478bd9Sstevel@tonic-gate 	sattr3		obj_attributes;
777*7c478bd9Sstevel@tonic-gate case EXCLUSIVE:
778*7c478bd9Sstevel@tonic-gate 	createverf3	verf;
779*7c478bd9Sstevel@tonic-gate };
780*7c478bd9Sstevel@tonic-gate 
781*7c478bd9Sstevel@tonic-gate struct CREATE3args {
782*7c478bd9Sstevel@tonic-gate 	diropargs3	where;
783*7c478bd9Sstevel@tonic-gate 	createhow3	how;
784*7c478bd9Sstevel@tonic-gate };
785*7c478bd9Sstevel@tonic-gate 
786*7c478bd9Sstevel@tonic-gate struct CREATE3resok {
787*7c478bd9Sstevel@tonic-gate 	post_op_fh3	obj;
788*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
789*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
790*7c478bd9Sstevel@tonic-gate };
791*7c478bd9Sstevel@tonic-gate 
792*7c478bd9Sstevel@tonic-gate struct CREATE3resfail {
793*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
794*7c478bd9Sstevel@tonic-gate };
795*7c478bd9Sstevel@tonic-gate 
796*7c478bd9Sstevel@tonic-gate union CREATE3res switch (nfsstat3 status) {
797*7c478bd9Sstevel@tonic-gate case NFS3_OK:
798*7c478bd9Sstevel@tonic-gate 	CREATE3resok	resok;
799*7c478bd9Sstevel@tonic-gate default:
800*7c478bd9Sstevel@tonic-gate 	CREATE3resfail	resfail;
801*7c478bd9Sstevel@tonic-gate };
802*7c478bd9Sstevel@tonic-gate 
803*7c478bd9Sstevel@tonic-gate /*
804*7c478bd9Sstevel@tonic-gate  * MKDIR: Create a directory
805*7c478bd9Sstevel@tonic-gate  */
806*7c478bd9Sstevel@tonic-gate struct MKDIR3args {
807*7c478bd9Sstevel@tonic-gate 	diropargs3	where;
808*7c478bd9Sstevel@tonic-gate 	sattr3		attributes;
809*7c478bd9Sstevel@tonic-gate };
810*7c478bd9Sstevel@tonic-gate 
811*7c478bd9Sstevel@tonic-gate struct MKDIR3resok {
812*7c478bd9Sstevel@tonic-gate 	post_op_fh3	obj;
813*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
814*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
815*7c478bd9Sstevel@tonic-gate };
816*7c478bd9Sstevel@tonic-gate 
817*7c478bd9Sstevel@tonic-gate struct MKDIR3resfail {
818*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
819*7c478bd9Sstevel@tonic-gate };
820*7c478bd9Sstevel@tonic-gate 
821*7c478bd9Sstevel@tonic-gate union MKDIR3res switch (nfsstat3 status) {
822*7c478bd9Sstevel@tonic-gate case NFS3_OK:
823*7c478bd9Sstevel@tonic-gate 	MKDIR3resok	resok;
824*7c478bd9Sstevel@tonic-gate default:
825*7c478bd9Sstevel@tonic-gate 	MKDIR3resfail	resfail;
826*7c478bd9Sstevel@tonic-gate };
827*7c478bd9Sstevel@tonic-gate 
828*7c478bd9Sstevel@tonic-gate /*
829*7c478bd9Sstevel@tonic-gate  * SYMLINK: Create a symbolic link
830*7c478bd9Sstevel@tonic-gate  */
831*7c478bd9Sstevel@tonic-gate struct symlinkdata3 {
832*7c478bd9Sstevel@tonic-gate 	sattr3		symlink_attributes;
833*7c478bd9Sstevel@tonic-gate 	nfspath3	symlink_data;
834*7c478bd9Sstevel@tonic-gate };
835*7c478bd9Sstevel@tonic-gate 
836*7c478bd9Sstevel@tonic-gate struct SYMLINK3args {
837*7c478bd9Sstevel@tonic-gate 	diropargs3	where;
838*7c478bd9Sstevel@tonic-gate 	symlinkdata3	symlink;
839*7c478bd9Sstevel@tonic-gate };
840*7c478bd9Sstevel@tonic-gate 
841*7c478bd9Sstevel@tonic-gate struct SYMLINK3resok {
842*7c478bd9Sstevel@tonic-gate 	post_op_fh3	obj;
843*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
844*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
845*7c478bd9Sstevel@tonic-gate };
846*7c478bd9Sstevel@tonic-gate 
847*7c478bd9Sstevel@tonic-gate struct SYMLINK3resfail {
848*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
849*7c478bd9Sstevel@tonic-gate };
850*7c478bd9Sstevel@tonic-gate 
851*7c478bd9Sstevel@tonic-gate union SYMLINK3res switch (nfsstat3 status) {
852*7c478bd9Sstevel@tonic-gate case NFS3_OK:
853*7c478bd9Sstevel@tonic-gate 	SYMLINK3resok	resok;
854*7c478bd9Sstevel@tonic-gate default:
855*7c478bd9Sstevel@tonic-gate 	SYMLINK3resfail	resfail;
856*7c478bd9Sstevel@tonic-gate };
857*7c478bd9Sstevel@tonic-gate 
858*7c478bd9Sstevel@tonic-gate /*
859*7c478bd9Sstevel@tonic-gate  * MKNOD: Create a special file
860*7c478bd9Sstevel@tonic-gate  */
861*7c478bd9Sstevel@tonic-gate struct devicedata3 {
862*7c478bd9Sstevel@tonic-gate 	sattr3		dev_attributes;
863*7c478bd9Sstevel@tonic-gate 	specdata3	spec;
864*7c478bd9Sstevel@tonic-gate };
865*7c478bd9Sstevel@tonic-gate 
866*7c478bd9Sstevel@tonic-gate union mknoddata3 switch (ftype3 type) {
867*7c478bd9Sstevel@tonic-gate case NF3CHR:
868*7c478bd9Sstevel@tonic-gate case NF3BLK:
869*7c478bd9Sstevel@tonic-gate 	devicedata3	device;
870*7c478bd9Sstevel@tonic-gate case NF3SOCK:
871*7c478bd9Sstevel@tonic-gate case NF3FIFO:
872*7c478bd9Sstevel@tonic-gate 	sattr3		pipe_attributes;
873*7c478bd9Sstevel@tonic-gate default:
874*7c478bd9Sstevel@tonic-gate 	void;
875*7c478bd9Sstevel@tonic-gate };
876*7c478bd9Sstevel@tonic-gate 
877*7c478bd9Sstevel@tonic-gate struct MKNOD3args {
878*7c478bd9Sstevel@tonic-gate 	diropargs3	where;
879*7c478bd9Sstevel@tonic-gate 	mknoddata3	what;
880*7c478bd9Sstevel@tonic-gate };
881*7c478bd9Sstevel@tonic-gate 
882*7c478bd9Sstevel@tonic-gate struct MKNOD3resok {
883*7c478bd9Sstevel@tonic-gate 	post_op_fh3	obj;
884*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
885*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
886*7c478bd9Sstevel@tonic-gate };
887*7c478bd9Sstevel@tonic-gate 
888*7c478bd9Sstevel@tonic-gate struct MKNOD3resfail {
889*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
890*7c478bd9Sstevel@tonic-gate };
891*7c478bd9Sstevel@tonic-gate 
892*7c478bd9Sstevel@tonic-gate union MKNOD3res switch (nfsstat3 status) {
893*7c478bd9Sstevel@tonic-gate case NFS3_OK:
894*7c478bd9Sstevel@tonic-gate 	MKNOD3resok	resok;
895*7c478bd9Sstevel@tonic-gate default:
896*7c478bd9Sstevel@tonic-gate 	MKNOD3resfail	resfail;
897*7c478bd9Sstevel@tonic-gate };
898*7c478bd9Sstevel@tonic-gate 
899*7c478bd9Sstevel@tonic-gate /*
900*7c478bd9Sstevel@tonic-gate  * REMOVE: Remove a file
901*7c478bd9Sstevel@tonic-gate  */
902*7c478bd9Sstevel@tonic-gate struct REMOVE3args {
903*7c478bd9Sstevel@tonic-gate 	diropargs3	object;
904*7c478bd9Sstevel@tonic-gate };
905*7c478bd9Sstevel@tonic-gate 
906*7c478bd9Sstevel@tonic-gate struct REMOVE3resok {
907*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
908*7c478bd9Sstevel@tonic-gate };
909*7c478bd9Sstevel@tonic-gate 
910*7c478bd9Sstevel@tonic-gate struct REMOVE3resfail {
911*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
912*7c478bd9Sstevel@tonic-gate };
913*7c478bd9Sstevel@tonic-gate 
914*7c478bd9Sstevel@tonic-gate union REMOVE3res switch (nfsstat3 status) {
915*7c478bd9Sstevel@tonic-gate case NFS3_OK:
916*7c478bd9Sstevel@tonic-gate 	REMOVE3resok	resok;
917*7c478bd9Sstevel@tonic-gate default:
918*7c478bd9Sstevel@tonic-gate 	REMOVE3resfail	resfail;
919*7c478bd9Sstevel@tonic-gate };
920*7c478bd9Sstevel@tonic-gate 
921*7c478bd9Sstevel@tonic-gate /*
922*7c478bd9Sstevel@tonic-gate  * RMDIR: Remove a directory
923*7c478bd9Sstevel@tonic-gate  */
924*7c478bd9Sstevel@tonic-gate struct RMDIR3args {
925*7c478bd9Sstevel@tonic-gate 	diropargs3 object;
926*7c478bd9Sstevel@tonic-gate };
927*7c478bd9Sstevel@tonic-gate 
928*7c478bd9Sstevel@tonic-gate struct RMDIR3resok {
929*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
930*7c478bd9Sstevel@tonic-gate };
931*7c478bd9Sstevel@tonic-gate 
932*7c478bd9Sstevel@tonic-gate struct RMDIR3resfail {
933*7c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
934*7c478bd9Sstevel@tonic-gate };
935*7c478bd9Sstevel@tonic-gate 
936*7c478bd9Sstevel@tonic-gate union RMDIR3res switch (nfsstat3 status) {
937*7c478bd9Sstevel@tonic-gate case NFS3_OK:
938*7c478bd9Sstevel@tonic-gate 	RMDIR3resok	resok;
939*7c478bd9Sstevel@tonic-gate default:
940*7c478bd9Sstevel@tonic-gate 	RMDIR3resfail	resfail;
941*7c478bd9Sstevel@tonic-gate };
942*7c478bd9Sstevel@tonic-gate 
943*7c478bd9Sstevel@tonic-gate /*
944*7c478bd9Sstevel@tonic-gate  * RENAME: Rename a file or directory
945*7c478bd9Sstevel@tonic-gate  */
946*7c478bd9Sstevel@tonic-gate struct RENAME3args {
947*7c478bd9Sstevel@tonic-gate 	diropargs3	from;
948*7c478bd9Sstevel@tonic-gate 	diropargs3	to;
949*7c478bd9Sstevel@tonic-gate };
950*7c478bd9Sstevel@tonic-gate 
951*7c478bd9Sstevel@tonic-gate struct RENAME3resok {
952*7c478bd9Sstevel@tonic-gate 	wcc_data	fromdir_wcc;
953*7c478bd9Sstevel@tonic-gate 	wcc_data	todir_wcc;
954*7c478bd9Sstevel@tonic-gate };
955*7c478bd9Sstevel@tonic-gate 
956*7c478bd9Sstevel@tonic-gate struct RENAME3resfail {
957*7c478bd9Sstevel@tonic-gate 	wcc_data	fromdir_wcc;
958*7c478bd9Sstevel@tonic-gate 	wcc_data	todir_wcc;
959*7c478bd9Sstevel@tonic-gate };
960*7c478bd9Sstevel@tonic-gate 
961*7c478bd9Sstevel@tonic-gate union RENAME3res switch (nfsstat3 status) {
962*7c478bd9Sstevel@tonic-gate case NFS3_OK:
963*7c478bd9Sstevel@tonic-gate 	RENAME3resok	resok;
964*7c478bd9Sstevel@tonic-gate default:
965*7c478bd9Sstevel@tonic-gate 	RENAME3resfail	resfail;
966*7c478bd9Sstevel@tonic-gate };
967*7c478bd9Sstevel@tonic-gate 
968*7c478bd9Sstevel@tonic-gate /*
969*7c478bd9Sstevel@tonic-gate  * LINK: Create link to an object
970*7c478bd9Sstevel@tonic-gate  */
971*7c478bd9Sstevel@tonic-gate struct LINK3args {
972*7c478bd9Sstevel@tonic-gate 	nfs_fh3		file;
973*7c478bd9Sstevel@tonic-gate 	diropargs3	link;
974*7c478bd9Sstevel@tonic-gate };
975*7c478bd9Sstevel@tonic-gate 
976*7c478bd9Sstevel@tonic-gate struct LINK3resok {
977*7c478bd9Sstevel@tonic-gate 	post_op_attr	file_attributes;
978*7c478bd9Sstevel@tonic-gate 	wcc_data	linkdir_wcc;
979*7c478bd9Sstevel@tonic-gate };
980*7c478bd9Sstevel@tonic-gate 
981*7c478bd9Sstevel@tonic-gate struct LINK3resfail {
982*7c478bd9Sstevel@tonic-gate 	post_op_attr	file_attributes;
983*7c478bd9Sstevel@tonic-gate 	wcc_data	linkdir_wcc;
984*7c478bd9Sstevel@tonic-gate };
985*7c478bd9Sstevel@tonic-gate 
986*7c478bd9Sstevel@tonic-gate union LINK3res switch (nfsstat3 status) {
987*7c478bd9Sstevel@tonic-gate case NFS3_OK:
988*7c478bd9Sstevel@tonic-gate 	LINK3resok	resok;
989*7c478bd9Sstevel@tonic-gate default:
990*7c478bd9Sstevel@tonic-gate 	LINK3resfail	resfail;
991*7c478bd9Sstevel@tonic-gate };
992*7c478bd9Sstevel@tonic-gate 
993*7c478bd9Sstevel@tonic-gate /*
994*7c478bd9Sstevel@tonic-gate  * READDIR: Read from directory
995*7c478bd9Sstevel@tonic-gate  */
996*7c478bd9Sstevel@tonic-gate struct READDIR3args {
997*7c478bd9Sstevel@tonic-gate 	nfs_fh3		dir;
998*7c478bd9Sstevel@tonic-gate 	cookie3		cookie;
999*7c478bd9Sstevel@tonic-gate 	cookieverf3	cookieverf;
1000*7c478bd9Sstevel@tonic-gate 	count3		count;
1001*7c478bd9Sstevel@tonic-gate };
1002*7c478bd9Sstevel@tonic-gate 
1003*7c478bd9Sstevel@tonic-gate struct entry3 {
1004*7c478bd9Sstevel@tonic-gate 	fileid3		fileid;
1005*7c478bd9Sstevel@tonic-gate 	filename3	name;
1006*7c478bd9Sstevel@tonic-gate 	cookie3		cookie;
1007*7c478bd9Sstevel@tonic-gate 	entry3		*nextentry;
1008*7c478bd9Sstevel@tonic-gate };
1009*7c478bd9Sstevel@tonic-gate 
1010*7c478bd9Sstevel@tonic-gate struct dirlist3 {
1011*7c478bd9Sstevel@tonic-gate 	entry3	*entries;
1012*7c478bd9Sstevel@tonic-gate 	bool	eof;
1013*7c478bd9Sstevel@tonic-gate };
1014*7c478bd9Sstevel@tonic-gate 
1015*7c478bd9Sstevel@tonic-gate struct READDIR3resok {
1016*7c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
1017*7c478bd9Sstevel@tonic-gate 	cookieverf3	cookieverf;
1018*7c478bd9Sstevel@tonic-gate 	dirlist3	reply;
1019*7c478bd9Sstevel@tonic-gate };
1020*7c478bd9Sstevel@tonic-gate 
1021*7c478bd9Sstevel@tonic-gate struct READDIR3resfail {
1022*7c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
1023*7c478bd9Sstevel@tonic-gate };
1024*7c478bd9Sstevel@tonic-gate 
1025*7c478bd9Sstevel@tonic-gate union READDIR3res switch (nfsstat3 status) {
1026*7c478bd9Sstevel@tonic-gate case NFS3_OK:
1027*7c478bd9Sstevel@tonic-gate 	READDIR3resok	resok;
1028*7c478bd9Sstevel@tonic-gate default:
1029*7c478bd9Sstevel@tonic-gate 	READDIR3resfail	resfail;
1030*7c478bd9Sstevel@tonic-gate };
1031*7c478bd9Sstevel@tonic-gate 
1032*7c478bd9Sstevel@tonic-gate /*
1033*7c478bd9Sstevel@tonic-gate  * READDIRPLUS: Extended read from a directory
1034*7c478bd9Sstevel@tonic-gate  */
1035*7c478bd9Sstevel@tonic-gate struct READDIRPLUS3args {
1036*7c478bd9Sstevel@tonic-gate 	nfs_fh3		dir;
1037*7c478bd9Sstevel@tonic-gate 	cookie3		cookie;
1038*7c478bd9Sstevel@tonic-gate 	cookieverf3	cookieverf;
1039*7c478bd9Sstevel@tonic-gate 	count3		dircount;
1040*7c478bd9Sstevel@tonic-gate 	count3		maxcount;
1041*7c478bd9Sstevel@tonic-gate };
1042*7c478bd9Sstevel@tonic-gate 
1043*7c478bd9Sstevel@tonic-gate struct entryplus3 {
1044*7c478bd9Sstevel@tonic-gate 	fileid3		fileid;
1045*7c478bd9Sstevel@tonic-gate 	filename3	name;
1046*7c478bd9Sstevel@tonic-gate 	cookie3		cookie;
1047*7c478bd9Sstevel@tonic-gate 	post_op_attr	name_attributes;
1048*7c478bd9Sstevel@tonic-gate 	post_op_fh3	name_handle;
1049*7c478bd9Sstevel@tonic-gate 	entryplus3	*nextentry;
1050*7c478bd9Sstevel@tonic-gate };
1051*7c478bd9Sstevel@tonic-gate 
1052*7c478bd9Sstevel@tonic-gate struct dirlistplus3 {
1053*7c478bd9Sstevel@tonic-gate 	entryplus3	*entries;
1054*7c478bd9Sstevel@tonic-gate 	bool		eof;
1055*7c478bd9Sstevel@tonic-gate };
1056*7c478bd9Sstevel@tonic-gate 
1057*7c478bd9Sstevel@tonic-gate struct READDIRPLUS3resok {
1058*7c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
1059*7c478bd9Sstevel@tonic-gate 	cookieverf3	cookieverf;
1060*7c478bd9Sstevel@tonic-gate 	dirlistplus3	reply;
1061*7c478bd9Sstevel@tonic-gate };
1062*7c478bd9Sstevel@tonic-gate 
1063*7c478bd9Sstevel@tonic-gate struct READDIRPLUS3resfail {
1064*7c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
1065*7c478bd9Sstevel@tonic-gate };
1066*7c478bd9Sstevel@tonic-gate 
1067*7c478bd9Sstevel@tonic-gate union READDIRPLUS3res switch (nfsstat3 status) {
1068*7c478bd9Sstevel@tonic-gate case NFS3_OK:
1069*7c478bd9Sstevel@tonic-gate 	READDIRPLUS3resok	resok;
1070*7c478bd9Sstevel@tonic-gate default:
1071*7c478bd9Sstevel@tonic-gate 	READDIRPLUS3resfail	resfail;
1072*7c478bd9Sstevel@tonic-gate };
1073*7c478bd9Sstevel@tonic-gate 
1074*7c478bd9Sstevel@tonic-gate /*
1075*7c478bd9Sstevel@tonic-gate  * FSSTAT: Get dynamic file system information
1076*7c478bd9Sstevel@tonic-gate  */
1077*7c478bd9Sstevel@tonic-gate struct FSSTAT3args {
1078*7c478bd9Sstevel@tonic-gate 	nfs_fh3	fsroot;
1079*7c478bd9Sstevel@tonic-gate };
1080*7c478bd9Sstevel@tonic-gate 
1081*7c478bd9Sstevel@tonic-gate struct FSSTAT3resok {
1082*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
1083*7c478bd9Sstevel@tonic-gate 	size3		tbytes;
1084*7c478bd9Sstevel@tonic-gate 	size3		fbytes;
1085*7c478bd9Sstevel@tonic-gate 	size3		abytes;
1086*7c478bd9Sstevel@tonic-gate 	size3		tfiles;
1087*7c478bd9Sstevel@tonic-gate 	size3		ffiles;
1088*7c478bd9Sstevel@tonic-gate 	size3		afiles;
1089*7c478bd9Sstevel@tonic-gate 	uint32		invarsec;
1090*7c478bd9Sstevel@tonic-gate };
1091*7c478bd9Sstevel@tonic-gate 
1092*7c478bd9Sstevel@tonic-gate struct FSSTAT3resfail {
1093*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
1094*7c478bd9Sstevel@tonic-gate };
1095*7c478bd9Sstevel@tonic-gate 
1096*7c478bd9Sstevel@tonic-gate union FSSTAT3res switch (nfsstat3 status) {
1097*7c478bd9Sstevel@tonic-gate case NFS3_OK:
1098*7c478bd9Sstevel@tonic-gate 	FSSTAT3resok	resok;
1099*7c478bd9Sstevel@tonic-gate default:
1100*7c478bd9Sstevel@tonic-gate 	FSSTAT3resfail	resfail;
1101*7c478bd9Sstevel@tonic-gate };
1102*7c478bd9Sstevel@tonic-gate 
1103*7c478bd9Sstevel@tonic-gate /*
1104*7c478bd9Sstevel@tonic-gate  * FSINFO: Get static file system information
1105*7c478bd9Sstevel@tonic-gate  */
1106*7c478bd9Sstevel@tonic-gate 
1107*7c478bd9Sstevel@tonic-gate const FSF3_LINK		= 0x0001;
1108*7c478bd9Sstevel@tonic-gate const FSF3_SYMLINK	= 0x0002;
1109*7c478bd9Sstevel@tonic-gate const FSF3_HOMOGENEOUS	= 0x0008;
1110*7c478bd9Sstevel@tonic-gate const FSF3_CANSETTIME	= 0x0010;
1111*7c478bd9Sstevel@tonic-gate 
1112*7c478bd9Sstevel@tonic-gate struct FSINFO3args {
1113*7c478bd9Sstevel@tonic-gate 	nfs_fh3	fsroot;
1114*7c478bd9Sstevel@tonic-gate };
1115*7c478bd9Sstevel@tonic-gate 
1116*7c478bd9Sstevel@tonic-gate struct FSINFO3resok {
1117*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
1118*7c478bd9Sstevel@tonic-gate 	uint32		rtmax;
1119*7c478bd9Sstevel@tonic-gate 	uint32		rtpref;
1120*7c478bd9Sstevel@tonic-gate 	uint32		rtmult;
1121*7c478bd9Sstevel@tonic-gate 	uint32		wtmax;
1122*7c478bd9Sstevel@tonic-gate 	uint32		wtpref;
1123*7c478bd9Sstevel@tonic-gate 	uint32		wtmult;
1124*7c478bd9Sstevel@tonic-gate 	uint32		dtpref;
1125*7c478bd9Sstevel@tonic-gate 	size3		maxfilesize;
1126*7c478bd9Sstevel@tonic-gate 	nfstime3	time_delta;
1127*7c478bd9Sstevel@tonic-gate 	uint32		properties;
1128*7c478bd9Sstevel@tonic-gate };
1129*7c478bd9Sstevel@tonic-gate 
1130*7c478bd9Sstevel@tonic-gate struct FSINFO3resfail {
1131*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
1132*7c478bd9Sstevel@tonic-gate };
1133*7c478bd9Sstevel@tonic-gate 
1134*7c478bd9Sstevel@tonic-gate union FSINFO3res switch (nfsstat3 status) {
1135*7c478bd9Sstevel@tonic-gate case NFS3_OK:
1136*7c478bd9Sstevel@tonic-gate 	FSINFO3resok	resok;
1137*7c478bd9Sstevel@tonic-gate default:
1138*7c478bd9Sstevel@tonic-gate 	FSINFO3resfail	resfail;
1139*7c478bd9Sstevel@tonic-gate };
1140*7c478bd9Sstevel@tonic-gate 
1141*7c478bd9Sstevel@tonic-gate /*
1142*7c478bd9Sstevel@tonic-gate  * PATHCONF: Retrieve POSIX information
1143*7c478bd9Sstevel@tonic-gate  */
1144*7c478bd9Sstevel@tonic-gate struct PATHCONF3args {
1145*7c478bd9Sstevel@tonic-gate 	nfs_fh3	object;
1146*7c478bd9Sstevel@tonic-gate };
1147*7c478bd9Sstevel@tonic-gate 
1148*7c478bd9Sstevel@tonic-gate struct PATHCONF3resok {
1149*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
1150*7c478bd9Sstevel@tonic-gate 	uint32		linkmax;
1151*7c478bd9Sstevel@tonic-gate 	uint32		name_max;
1152*7c478bd9Sstevel@tonic-gate 	bool		no_trunc;
1153*7c478bd9Sstevel@tonic-gate 	bool		chown_restricted;
1154*7c478bd9Sstevel@tonic-gate 	bool		case_insensitive;
1155*7c478bd9Sstevel@tonic-gate 	bool		case_preserving;
1156*7c478bd9Sstevel@tonic-gate };
1157*7c478bd9Sstevel@tonic-gate 
1158*7c478bd9Sstevel@tonic-gate struct PATHCONF3resfail {
1159*7c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
1160*7c478bd9Sstevel@tonic-gate };
1161*7c478bd9Sstevel@tonic-gate 
1162*7c478bd9Sstevel@tonic-gate union PATHCONF3res switch (nfsstat3 status) {
1163*7c478bd9Sstevel@tonic-gate case NFS3_OK:
1164*7c478bd9Sstevel@tonic-gate 	PATHCONF3resok	 resok;
1165*7c478bd9Sstevel@tonic-gate default:
1166*7c478bd9Sstevel@tonic-gate 	PATHCONF3resfail resfail;
1167*7c478bd9Sstevel@tonic-gate };
1168*7c478bd9Sstevel@tonic-gate 
1169*7c478bd9Sstevel@tonic-gate /*
1170*7c478bd9Sstevel@tonic-gate  * COMMIT: Commit cached data on a server to stable storage
1171*7c478bd9Sstevel@tonic-gate  */
1172*7c478bd9Sstevel@tonic-gate struct COMMIT3args {
1173*7c478bd9Sstevel@tonic-gate 	nfs_fh3	file;
1174*7c478bd9Sstevel@tonic-gate 	offset3	offset;
1175*7c478bd9Sstevel@tonic-gate 	count3	count;
1176*7c478bd9Sstevel@tonic-gate };
1177*7c478bd9Sstevel@tonic-gate 
1178*7c478bd9Sstevel@tonic-gate struct COMMIT3resok {
1179*7c478bd9Sstevel@tonic-gate 	wcc_data	file_wcc;
1180*7c478bd9Sstevel@tonic-gate 	writeverf3	verf;
1181*7c478bd9Sstevel@tonic-gate };
1182*7c478bd9Sstevel@tonic-gate 
1183*7c478bd9Sstevel@tonic-gate struct COMMIT3resfail {
1184*7c478bd9Sstevel@tonic-gate 	wcc_data	file_wcc;
1185*7c478bd9Sstevel@tonic-gate };
1186*7c478bd9Sstevel@tonic-gate 
1187*7c478bd9Sstevel@tonic-gate union COMMIT3res switch (nfsstat3 status) {
1188*7c478bd9Sstevel@tonic-gate case NFS3_OK:
1189*7c478bd9Sstevel@tonic-gate 	COMMIT3resok	resok;
1190*7c478bd9Sstevel@tonic-gate default:
1191*7c478bd9Sstevel@tonic-gate 	COMMIT3resfail	resfail;
1192*7c478bd9Sstevel@tonic-gate };
1193*7c478bd9Sstevel@tonic-gate 
1194*7c478bd9Sstevel@tonic-gate /*
1195*7c478bd9Sstevel@tonic-gate  * Remote file service routines
1196*7c478bd9Sstevel@tonic-gate  */
1197*7c478bd9Sstevel@tonic-gate program NFS3_PROGRAM {
1198*7c478bd9Sstevel@tonic-gate 	version NFS_V3 {
1199*7c478bd9Sstevel@tonic-gate 		void
1200*7c478bd9Sstevel@tonic-gate 		NFSPROC3_NULL(void) = 0;
1201*7c478bd9Sstevel@tonic-gate 
1202*7c478bd9Sstevel@tonic-gate 		GETATTR3res
1203*7c478bd9Sstevel@tonic-gate 		NFSPROC3_GETATTR(GETATTR3args) = 1;
1204*7c478bd9Sstevel@tonic-gate 
1205*7c478bd9Sstevel@tonic-gate 		SETATTR3res
1206*7c478bd9Sstevel@tonic-gate 		NFSPROC3_SETATTR(SETATTR3args) = 2;
1207*7c478bd9Sstevel@tonic-gate 
1208*7c478bd9Sstevel@tonic-gate 		LOOKUP3res
1209*7c478bd9Sstevel@tonic-gate 		NFSPROC3_LOOKUP(LOOKUP3args) = 3;
1210*7c478bd9Sstevel@tonic-gate 
1211*7c478bd9Sstevel@tonic-gate 		ACCESS3res
1212*7c478bd9Sstevel@tonic-gate 		NFSPROC3_ACCESS(ACCESS3args) = 4;
1213*7c478bd9Sstevel@tonic-gate 
1214*7c478bd9Sstevel@tonic-gate 		READLINK3res
1215*7c478bd9Sstevel@tonic-gate 		NFSPROC3_READLINK(READLINK3args) = 5;
1216*7c478bd9Sstevel@tonic-gate 
1217*7c478bd9Sstevel@tonic-gate 		READ3res
1218*7c478bd9Sstevel@tonic-gate 		NFSPROC3_READ(READ3args) = 6;
1219*7c478bd9Sstevel@tonic-gate 
1220*7c478bd9Sstevel@tonic-gate 		WRITE3res
1221*7c478bd9Sstevel@tonic-gate 		NFSPROC3_WRITE(WRITE3args) = 7;
1222*7c478bd9Sstevel@tonic-gate 
1223*7c478bd9Sstevel@tonic-gate 		CREATE3res
1224*7c478bd9Sstevel@tonic-gate 		NFSPROC3_CREATE(CREATE3args) = 8;
1225*7c478bd9Sstevel@tonic-gate 
1226*7c478bd9Sstevel@tonic-gate 		MKDIR3res
1227*7c478bd9Sstevel@tonic-gate 		NFSPROC3_MKDIR(MKDIR3args) = 9;
1228*7c478bd9Sstevel@tonic-gate 
1229*7c478bd9Sstevel@tonic-gate 		SYMLINK3res
1230*7c478bd9Sstevel@tonic-gate 		NFSPROC3_SYMLINK(SYMLINK3args) = 10;
1231*7c478bd9Sstevel@tonic-gate 
1232*7c478bd9Sstevel@tonic-gate 		MKNOD3res
1233*7c478bd9Sstevel@tonic-gate 		NFSPROC3_MKNOD(MKNOD3args) = 11;
1234*7c478bd9Sstevel@tonic-gate 
1235*7c478bd9Sstevel@tonic-gate 		REMOVE3res
1236*7c478bd9Sstevel@tonic-gate 		NFSPROC3_REMOVE(REMOVE3args) = 12;
1237*7c478bd9Sstevel@tonic-gate 
1238*7c478bd9Sstevel@tonic-gate 		RMDIR3res
1239*7c478bd9Sstevel@tonic-gate 		NFSPROC3_RMDIR(RMDIR3args) = 13;
1240*7c478bd9Sstevel@tonic-gate 
1241*7c478bd9Sstevel@tonic-gate 		RENAME3res
1242*7c478bd9Sstevel@tonic-gate 		NFSPROC3_RENAME(RENAME3args) = 14;
1243*7c478bd9Sstevel@tonic-gate 
1244*7c478bd9Sstevel@tonic-gate 		LINK3res
1245*7c478bd9Sstevel@tonic-gate 		NFSPROC3_LINK(LINK3args) = 15;
1246*7c478bd9Sstevel@tonic-gate 
1247*7c478bd9Sstevel@tonic-gate 		READDIR3res
1248*7c478bd9Sstevel@tonic-gate 		NFSPROC3_READDIR(READDIR3args) = 16;
1249*7c478bd9Sstevel@tonic-gate 
1250*7c478bd9Sstevel@tonic-gate 		READDIRPLUS3res
1251*7c478bd9Sstevel@tonic-gate 		NFSPROC3_READDIRPLUS(READDIRPLUS3args) = 17;
1252*7c478bd9Sstevel@tonic-gate 
1253*7c478bd9Sstevel@tonic-gate 		FSSTAT3res
1254*7c478bd9Sstevel@tonic-gate 		NFSPROC3_FSSTAT(FSSTAT3args) = 18;
1255*7c478bd9Sstevel@tonic-gate 
1256*7c478bd9Sstevel@tonic-gate 		FSINFO3res
1257*7c478bd9Sstevel@tonic-gate 		NFSPROC3_FSINFO(FSINFO3args) = 19;
1258*7c478bd9Sstevel@tonic-gate 
1259*7c478bd9Sstevel@tonic-gate 		PATHCONF3res
1260*7c478bd9Sstevel@tonic-gate 		NFSPROC3_PATHCONF(PATHCONF3args) = 20;
1261*7c478bd9Sstevel@tonic-gate 
1262*7c478bd9Sstevel@tonic-gate 		COMMIT3res
1263*7c478bd9Sstevel@tonic-gate 		NFSPROC3_COMMIT(COMMIT3args) = 21;
1264*7c478bd9Sstevel@tonic-gate 	} = 3;
1265*7c478bd9Sstevel@tonic-gate } = 100003;
1266