xref: /illumos-gate/usr/src/head/rpcsvc/nfs_prot.x (revision e13f9236)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifdef RPC_HDR
287c478bd9Sstevel@tonic-gate %/*
297c478bd9Sstevel@tonic-gate % * Definitions for uint64, int64, uint32, and int32
307c478bd9Sstevel@tonic-gate % */
317c478bd9Sstevel@tonic-gate %#include <rpc/rpc_sztypes.h>
327c478bd9Sstevel@tonic-gate %
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate const NFS_PORT          = 2049;
367c478bd9Sstevel@tonic-gate const NFS_MAXDATA       = 8192;
377c478bd9Sstevel@tonic-gate const NFS_MAXPATHLEN    = 1024;
387c478bd9Sstevel@tonic-gate const NFS_MAXNAMLEN	= 255;
397c478bd9Sstevel@tonic-gate const NFS_FHSIZE	= 32;
407c478bd9Sstevel@tonic-gate const NFS_COOKIESIZE	= 4;
417c478bd9Sstevel@tonic-gate const NFS_FIFO_DEV	= -1;	/* size kludge for named pipes */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * File types
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate const NFSMODE_FMT  = 0170000;	/* type of file */
477c478bd9Sstevel@tonic-gate const NFSMODE_DIR  = 0040000;	/* directory */
487c478bd9Sstevel@tonic-gate const NFSMODE_CHR  = 0020000;	/* character special */
497c478bd9Sstevel@tonic-gate const NFSMODE_BLK  = 0060000;	/* block special */
507c478bd9Sstevel@tonic-gate const NFSMODE_REG  = 0100000;	/* regular */
517c478bd9Sstevel@tonic-gate const NFSMODE_LNK  = 0120000;	/* symbolic link */
527c478bd9Sstevel@tonic-gate const NFSMODE_SOCK = 0140000;	/* socket */
537c478bd9Sstevel@tonic-gate const NFSMODE_FIFO = 0010000;	/* fifo */
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * Error status
577c478bd9Sstevel@tonic-gate  */
587c478bd9Sstevel@tonic-gate enum nfsstat {
597c478bd9Sstevel@tonic-gate 	NFS_OK= 0,		/* no error */
607c478bd9Sstevel@tonic-gate 	NFSERR_PERM=1,		/* Not owner */
617c478bd9Sstevel@tonic-gate 	NFSERR_NOENT=2,		/* No such file or directory */
627c478bd9Sstevel@tonic-gate 	NFSERR_IO=5,		/* I/O error */
637c478bd9Sstevel@tonic-gate 	NFSERR_NXIO=6,		/* No such device or address */
647c478bd9Sstevel@tonic-gate 	NFSERR_ACCES=13,	/* Permission denied */
657c478bd9Sstevel@tonic-gate 	NFSERR_EXIST=17,	/* File exists */
667c478bd9Sstevel@tonic-gate 	NFSERR_XDEV=18,		/* Cross-device link */
677c478bd9Sstevel@tonic-gate 	NFSERR_NODEV=19,	/* No such device */
687c478bd9Sstevel@tonic-gate 	NFSERR_NOTDIR=20,	/* Not a directory*/
697c478bd9Sstevel@tonic-gate 	NFSERR_ISDIR=21,	/* Is a directory */
707c478bd9Sstevel@tonic-gate 	NFSERR_INVAL=22,	/* Invalid argument */
717c478bd9Sstevel@tonic-gate 	NFSERR_FBIG=27,		/* File too large */
727c478bd9Sstevel@tonic-gate 	NFSERR_NOSPC=28,	/* No space left on device */
737c478bd9Sstevel@tonic-gate 	NFSERR_ROFS=30,		/* Read-only file system */
747c478bd9Sstevel@tonic-gate 	NFSERR_OPNOTSUPP=45,	/* Operation not supported */
757c478bd9Sstevel@tonic-gate 	NFSERR_NAMETOOLONG=63,	/* File name too long */
767c478bd9Sstevel@tonic-gate 	NFSERR_NOTEMPTY=66,	/* Directory not empty */
777c478bd9Sstevel@tonic-gate 	NFSERR_DQUOT=69,	/* Disc quota exceeded */
787c478bd9Sstevel@tonic-gate 	NFSERR_STALE=70,	/* Stale NFS file handle */
797c478bd9Sstevel@tonic-gate 	NFSERR_REMOTE=71,	/* Object is remote */
807c478bd9Sstevel@tonic-gate 	NFSERR_WFLUSH=72	/* write cache flushed */
817c478bd9Sstevel@tonic-gate };
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate /*
847c478bd9Sstevel@tonic-gate  * File types
857c478bd9Sstevel@tonic-gate  */
867c478bd9Sstevel@tonic-gate enum ftype {
877c478bd9Sstevel@tonic-gate 	NFNON = 0,	/* non-file */
887c478bd9Sstevel@tonic-gate 	NFREG = 1,	/* regular file */
897c478bd9Sstevel@tonic-gate 	NFDIR = 2,	/* directory */
907c478bd9Sstevel@tonic-gate 	NFBLK = 3,	/* block special */
917c478bd9Sstevel@tonic-gate 	NFCHR = 4,	/* character special */
927c478bd9Sstevel@tonic-gate 	NFLNK = 5,	/* symbolic link */
937c478bd9Sstevel@tonic-gate 	NFSOCK = 6,	/* unix domain sockets */
947c478bd9Sstevel@tonic-gate 	NFBAD = 7,	/* unused */
957c478bd9Sstevel@tonic-gate 	NFFIFO = 8 	/* named pipe */
967c478bd9Sstevel@tonic-gate };
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate /*
997c478bd9Sstevel@tonic-gate  * File access handle
1007c478bd9Sstevel@tonic-gate  */
1017c478bd9Sstevel@tonic-gate struct nfs_fh {
1027c478bd9Sstevel@tonic-gate 	opaque data[NFS_FHSIZE];
1037c478bd9Sstevel@tonic-gate };
1047c478bd9Sstevel@tonic-gate 
105*e13f9236SToomas Soome /*
1067c478bd9Sstevel@tonic-gate  * Timeval
1077c478bd9Sstevel@tonic-gate  */
1087c478bd9Sstevel@tonic-gate struct nfstime {
1097c478bd9Sstevel@tonic-gate 	unsigned seconds;
1107c478bd9Sstevel@tonic-gate 	unsigned useconds;
1117c478bd9Sstevel@tonic-gate };
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate /*
1157c478bd9Sstevel@tonic-gate  * File attributes
1167c478bd9Sstevel@tonic-gate  */
1177c478bd9Sstevel@tonic-gate struct fattr {
1187c478bd9Sstevel@tonic-gate 	ftype type;		/* file type */
1197c478bd9Sstevel@tonic-gate 	unsigned mode;		/* protection mode bits */
1207c478bd9Sstevel@tonic-gate 	unsigned nlink;		/* # hard links */
1217c478bd9Sstevel@tonic-gate 	unsigned uid;		/* owner user id */
1227c478bd9Sstevel@tonic-gate 	unsigned gid;		/* owner group id */
1237c478bd9Sstevel@tonic-gate 	unsigned size;		/* file size in bytes */
1247c478bd9Sstevel@tonic-gate 	unsigned blocksize;	/* prefered block size */
1257c478bd9Sstevel@tonic-gate 	unsigned rdev;		/* special device # */
1267c478bd9Sstevel@tonic-gate 	unsigned blocks;	/* Kb of disk used by file */
1277c478bd9Sstevel@tonic-gate 	unsigned fsid;		/* device # */
1287c478bd9Sstevel@tonic-gate 	unsigned fileid;	/* inode # */
1297c478bd9Sstevel@tonic-gate 	nfstime	atime;		/* time of last access */
1307c478bd9Sstevel@tonic-gate 	nfstime	mtime;		/* time of last modification */
1317c478bd9Sstevel@tonic-gate 	nfstime	ctime;		/* time of last change */
1327c478bd9Sstevel@tonic-gate };
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate /*
1357c478bd9Sstevel@tonic-gate  * File attributes which can be set
1367c478bd9Sstevel@tonic-gate  */
1377c478bd9Sstevel@tonic-gate struct sattr {
1387c478bd9Sstevel@tonic-gate 	unsigned mode;	/* protection mode bits */
1397c478bd9Sstevel@tonic-gate 	unsigned uid;	/* owner user id */
1407c478bd9Sstevel@tonic-gate 	unsigned gid;	/* owner group id */
1417c478bd9Sstevel@tonic-gate 	unsigned size;	/* file size in bytes */
1427c478bd9Sstevel@tonic-gate 	nfstime	atime;	/* time of last access */
1437c478bd9Sstevel@tonic-gate 	nfstime	mtime;	/* time of last modification */
1447c478bd9Sstevel@tonic-gate };
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate 
147*e13f9236SToomas Soome typedef string filename<NFS_MAXNAMLEN>;
1487c478bd9Sstevel@tonic-gate typedef string nfspath<NFS_MAXPATHLEN>;
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate /*
1517c478bd9Sstevel@tonic-gate  * Reply status with file attributes
1527c478bd9Sstevel@tonic-gate  */
1537c478bd9Sstevel@tonic-gate union attrstat switch (nfsstat status) {
1547c478bd9Sstevel@tonic-gate case NFS_OK:
1557c478bd9Sstevel@tonic-gate 	fattr attributes;
1567c478bd9Sstevel@tonic-gate default:
1577c478bd9Sstevel@tonic-gate 	void;
1587c478bd9Sstevel@tonic-gate };
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate struct sattrargs {
1617c478bd9Sstevel@tonic-gate 	nfs_fh file;
1627c478bd9Sstevel@tonic-gate 	sattr attributes;
1637c478bd9Sstevel@tonic-gate };
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate /*
1667c478bd9Sstevel@tonic-gate  * Arguments for directory operations
1677c478bd9Sstevel@tonic-gate  */
1687c478bd9Sstevel@tonic-gate struct diropargs {
1697c478bd9Sstevel@tonic-gate 	nfs_fh	dir;	/* directory file handle */
1707c478bd9Sstevel@tonic-gate 	filename name;		/* name (up to NFS_MAXNAMLEN bytes) */
1717c478bd9Sstevel@tonic-gate };
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate struct diropokres {
1747c478bd9Sstevel@tonic-gate 	nfs_fh file;
1757c478bd9Sstevel@tonic-gate 	fattr attributes;
1767c478bd9Sstevel@tonic-gate };
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate /*
1797c478bd9Sstevel@tonic-gate  * Results from directory operation
1807c478bd9Sstevel@tonic-gate  */
1817c478bd9Sstevel@tonic-gate union diropres switch (nfsstat status) {
1827c478bd9Sstevel@tonic-gate case NFS_OK:
1837c478bd9Sstevel@tonic-gate 	diropokres diropres;
1847c478bd9Sstevel@tonic-gate default:
1857c478bd9Sstevel@tonic-gate 	void;
1867c478bd9Sstevel@tonic-gate };
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate union readlinkres switch (nfsstat status) {
1897c478bd9Sstevel@tonic-gate case NFS_OK:
1907c478bd9Sstevel@tonic-gate 	nfspath data;
1917c478bd9Sstevel@tonic-gate default:
1927c478bd9Sstevel@tonic-gate 	void;
1937c478bd9Sstevel@tonic-gate };
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate /*
1967c478bd9Sstevel@tonic-gate  * Arguments to remote read
1977c478bd9Sstevel@tonic-gate  */
1987c478bd9Sstevel@tonic-gate struct readargs {
1997c478bd9Sstevel@tonic-gate 	nfs_fh file;		/* handle for file */
2007c478bd9Sstevel@tonic-gate 	unsigned offset;	/* byte offset in file */
2017c478bd9Sstevel@tonic-gate 	unsigned count;		/* immediate read count */
2027c478bd9Sstevel@tonic-gate 	unsigned totalcount;	/* total read count (from this offset)*/
2037c478bd9Sstevel@tonic-gate };
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate /*
2067c478bd9Sstevel@tonic-gate  * Status OK portion of remote read reply
2077c478bd9Sstevel@tonic-gate  */
2087c478bd9Sstevel@tonic-gate struct readokres {
2097c478bd9Sstevel@tonic-gate 	fattr	attributes;	/* attributes, need for pagin*/
2107c478bd9Sstevel@tonic-gate 	opaque data<NFS_MAXDATA>;
2117c478bd9Sstevel@tonic-gate };
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate union readres switch (nfsstat status) {
2147c478bd9Sstevel@tonic-gate case NFS_OK:
2157c478bd9Sstevel@tonic-gate 	readokres reply;
2167c478bd9Sstevel@tonic-gate default:
2177c478bd9Sstevel@tonic-gate 	void;
2187c478bd9Sstevel@tonic-gate };
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate /*
221*e13f9236SToomas Soome  * Arguments to remote write
2227c478bd9Sstevel@tonic-gate  */
2237c478bd9Sstevel@tonic-gate struct writeargs {
2247c478bd9Sstevel@tonic-gate 	nfs_fh	file;		/* handle for file */
2257c478bd9Sstevel@tonic-gate 	unsigned beginoffset;	/* beginning byte offset in file */
2267c478bd9Sstevel@tonic-gate 	unsigned offset;	/* current byte offset in file */
2277c478bd9Sstevel@tonic-gate 	unsigned totalcount;	/* total write count (to this offset)*/
2287c478bd9Sstevel@tonic-gate 	opaque data<NFS_MAXDATA>;
2297c478bd9Sstevel@tonic-gate };
2307c478bd9Sstevel@tonic-gate 
2317c478bd9Sstevel@tonic-gate struct createargs {
2327c478bd9Sstevel@tonic-gate 	diropargs where;
2337c478bd9Sstevel@tonic-gate 	sattr attributes;
2347c478bd9Sstevel@tonic-gate };
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate struct renameargs {
2377c478bd9Sstevel@tonic-gate 	diropargs from;
2387c478bd9Sstevel@tonic-gate 	diropargs to;
2397c478bd9Sstevel@tonic-gate };
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate struct linkargs {
2427c478bd9Sstevel@tonic-gate 	nfs_fh from;
2437c478bd9Sstevel@tonic-gate 	diropargs to;
2447c478bd9Sstevel@tonic-gate };
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate struct symlinkargs {
2477c478bd9Sstevel@tonic-gate 	diropargs from;
2487c478bd9Sstevel@tonic-gate 	nfspath to;
2497c478bd9Sstevel@tonic-gate 	sattr attributes;
2507c478bd9Sstevel@tonic-gate };
2517c478bd9Sstevel@tonic-gate 
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate typedef opaque nfscookie[NFS_COOKIESIZE];
2547c478bd9Sstevel@tonic-gate 
2557c478bd9Sstevel@tonic-gate /*
2567c478bd9Sstevel@tonic-gate  * Arguments to readdir
2577c478bd9Sstevel@tonic-gate  */
2587c478bd9Sstevel@tonic-gate struct readdirargs {
2597c478bd9Sstevel@tonic-gate 	nfs_fh dir;		/* directory handle */
2607c478bd9Sstevel@tonic-gate 	nfscookie cookie;
2617c478bd9Sstevel@tonic-gate 	unsigned count;		/* number of directory bytes to read */
2627c478bd9Sstevel@tonic-gate };
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate struct entry {
2657c478bd9Sstevel@tonic-gate 	unsigned fileid;
2667c478bd9Sstevel@tonic-gate 	filename name;
2677c478bd9Sstevel@tonic-gate 	nfscookie cookie;
2687c478bd9Sstevel@tonic-gate 	entry *nextentry;
2697c478bd9Sstevel@tonic-gate };
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate struct dirlist {
2727c478bd9Sstevel@tonic-gate 	entry *entries;
2737c478bd9Sstevel@tonic-gate 	bool eof;
2747c478bd9Sstevel@tonic-gate };
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate union readdirres switch (nfsstat status) {
2777c478bd9Sstevel@tonic-gate case NFS_OK:
2787c478bd9Sstevel@tonic-gate 	dirlist reply;
2797c478bd9Sstevel@tonic-gate default:
2807c478bd9Sstevel@tonic-gate 	void;
2817c478bd9Sstevel@tonic-gate };
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate struct statfsokres {
2847c478bd9Sstevel@tonic-gate 	unsigned tsize;	/* preferred transfer size in bytes */
2857c478bd9Sstevel@tonic-gate 	unsigned bsize;	/* fundamental file system block size */
2867c478bd9Sstevel@tonic-gate 	unsigned blocks;	/* total blocks in file system */
2877c478bd9Sstevel@tonic-gate 	unsigned bfree;	/* free blocks in fs */
2887c478bd9Sstevel@tonic-gate 	unsigned bavail;	/* free blocks avail to non-superuser */
2897c478bd9Sstevel@tonic-gate };
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate union statfsres switch (nfsstat status) {
2927c478bd9Sstevel@tonic-gate case NFS_OK:
2937c478bd9Sstevel@tonic-gate 	statfsokres reply;
2947c478bd9Sstevel@tonic-gate default:
2957c478bd9Sstevel@tonic-gate 	void;
2967c478bd9Sstevel@tonic-gate };
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate /*
2997c478bd9Sstevel@tonic-gate  * Remote file service routines
3007c478bd9Sstevel@tonic-gate  */
3017c478bd9Sstevel@tonic-gate program NFS_PROGRAM {
3027c478bd9Sstevel@tonic-gate 	version NFS_VERSION {
303*e13f9236SToomas Soome 		void
3047c478bd9Sstevel@tonic-gate 		NFSPROC_NULL(void) = 0;
3057c478bd9Sstevel@tonic-gate 
306*e13f9236SToomas Soome 		attrstat
3077c478bd9Sstevel@tonic-gate 		NFSPROC_GETATTR(nfs_fh) =	1;
3087c478bd9Sstevel@tonic-gate 
309*e13f9236SToomas Soome 		attrstat
3107c478bd9Sstevel@tonic-gate 		NFSPROC_SETATTR(sattrargs) = 2;
3117c478bd9Sstevel@tonic-gate 
312*e13f9236SToomas Soome 		void
3137c478bd9Sstevel@tonic-gate 		NFSPROC_ROOT(void) = 3;
3147c478bd9Sstevel@tonic-gate 
315*e13f9236SToomas Soome 		diropres
3167c478bd9Sstevel@tonic-gate 		NFSPROC_LOOKUP(diropargs) = 4;
3177c478bd9Sstevel@tonic-gate 
318*e13f9236SToomas Soome 		readlinkres
3197c478bd9Sstevel@tonic-gate 		NFSPROC_READLINK(nfs_fh) = 5;
3207c478bd9Sstevel@tonic-gate 
321*e13f9236SToomas Soome 		readres
3227c478bd9Sstevel@tonic-gate 		NFSPROC_READ(readargs) = 6;
3237c478bd9Sstevel@tonic-gate 
324*e13f9236SToomas Soome 		void
3257c478bd9Sstevel@tonic-gate 		NFSPROC_WRITECACHE(void) = 7;
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate 		attrstat
3287c478bd9Sstevel@tonic-gate 		NFSPROC_WRITE(writeargs) = 8;
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate 		diropres
3317c478bd9Sstevel@tonic-gate 		NFSPROC_CREATE(createargs) = 9;
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate 		nfsstat
3347c478bd9Sstevel@tonic-gate 		NFSPROC_REMOVE(diropargs) = 10;
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate 		nfsstat
3377c478bd9Sstevel@tonic-gate 		NFSPROC_RENAME(renameargs) = 11;
3387c478bd9Sstevel@tonic-gate 
3397c478bd9Sstevel@tonic-gate 		nfsstat
3407c478bd9Sstevel@tonic-gate 		NFSPROC_LINK(linkargs) = 12;
3417c478bd9Sstevel@tonic-gate 
3427c478bd9Sstevel@tonic-gate 		nfsstat
3437c478bd9Sstevel@tonic-gate 		NFSPROC_SYMLINK(symlinkargs) = 13;
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate 		diropres
3467c478bd9Sstevel@tonic-gate 		NFSPROC_MKDIR(createargs) = 14;
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate 		nfsstat
3497c478bd9Sstevel@tonic-gate 		NFSPROC_RMDIR(diropargs) = 15;
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate 		readdirres
3527c478bd9Sstevel@tonic-gate 		NFSPROC_READDIR(readdirargs) = 16;
3537c478bd9Sstevel@tonic-gate 
3547c478bd9Sstevel@tonic-gate 		statfsres
3557c478bd9Sstevel@tonic-gate 		NFSPROC_STATFS(nfs_fh) = 17;
3567c478bd9Sstevel@tonic-gate 	} = 2;
3577c478bd9Sstevel@tonic-gate } = 100003;
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate /*
3607c478bd9Sstevel@tonic-gate  * Version 3 declarations and definitions.
3617c478bd9Sstevel@tonic-gate  */
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate /*
3647c478bd9Sstevel@tonic-gate  * Sizes
3657c478bd9Sstevel@tonic-gate  */
3667c478bd9Sstevel@tonic-gate const NFS3_FHSIZE         = 64;
3677c478bd9Sstevel@tonic-gate const NFS3_COOKIEVERFSIZE = 8;
3687c478bd9Sstevel@tonic-gate const NFS3_CREATEVERFSIZE = 8;
3697c478bd9Sstevel@tonic-gate const NFS3_WRITEVERFSIZE  = 8;
3707c478bd9Sstevel@tonic-gate 
3717c478bd9Sstevel@tonic-gate /*
3727c478bd9Sstevel@tonic-gate  * Basic data types
3737c478bd9Sstevel@tonic-gate  */
3747c478bd9Sstevel@tonic-gate typedef string		filename3<>;
3757c478bd9Sstevel@tonic-gate typedef string		nfspath3<>;
3767c478bd9Sstevel@tonic-gate typedef uint64		fileid3;
3777c478bd9Sstevel@tonic-gate typedef uint64		cookie3;
3787c478bd9Sstevel@tonic-gate typedef opaque		cookieverf3[NFS3_COOKIEVERFSIZE];
3797c478bd9Sstevel@tonic-gate typedef opaque		createverf3[NFS3_CREATEVERFSIZE];
3807c478bd9Sstevel@tonic-gate typedef opaque		writeverf3[NFS3_WRITEVERFSIZE];
3817c478bd9Sstevel@tonic-gate typedef uint32		uid3;
3827c478bd9Sstevel@tonic-gate typedef uint32		gid3;
3837c478bd9Sstevel@tonic-gate typedef uint64		size3;
3847c478bd9Sstevel@tonic-gate typedef uint64		offset3;
3857c478bd9Sstevel@tonic-gate typedef uint32		mode3;
3867c478bd9Sstevel@tonic-gate typedef uint32		count3;
3877c478bd9Sstevel@tonic-gate 
3887c478bd9Sstevel@tonic-gate /*
3897c478bd9Sstevel@tonic-gate  * Error status
3907c478bd9Sstevel@tonic-gate  */
3917c478bd9Sstevel@tonic-gate enum nfsstat3 {
3927c478bd9Sstevel@tonic-gate 	NFS3_OK = 0,
3937c478bd9Sstevel@tonic-gate 	NFS3ERR_PERM = 1,
3947c478bd9Sstevel@tonic-gate 	NFS3ERR_NOENT = 2,
3957c478bd9Sstevel@tonic-gate 	NFS3ERR_IO = 5,
3967c478bd9Sstevel@tonic-gate 	NFS3ERR_NXIO = 6,
3977c478bd9Sstevel@tonic-gate 	NFS3ERR_ACCES = 13,
3987c478bd9Sstevel@tonic-gate 	NFS3ERR_EXIST = 17,
3997c478bd9Sstevel@tonic-gate 	NFS3ERR_XDEV = 18,
4007c478bd9Sstevel@tonic-gate 	NFS3ERR_NODEV = 19,
4017c478bd9Sstevel@tonic-gate 	NFS3ERR_NOTDIR = 20,
4027c478bd9Sstevel@tonic-gate 	NFS3ERR_ISDIR = 21,
4037c478bd9Sstevel@tonic-gate 	NFS3ERR_INVAL = 22,
4047c478bd9Sstevel@tonic-gate 	NFS3ERR_FBIG = 27,
4057c478bd9Sstevel@tonic-gate 	NFS3ERR_NOSPC = 28,
4067c478bd9Sstevel@tonic-gate 	NFS3ERR_ROFS = 30,
4077c478bd9Sstevel@tonic-gate 	NFS3ERR_MLINK = 31,
4087c478bd9Sstevel@tonic-gate 	NFS3ERR_NAMETOOLONG = 63,
4097c478bd9Sstevel@tonic-gate 	NFS3ERR_NOTEMPTY = 66,
4107c478bd9Sstevel@tonic-gate 	NFS3ERR_DQUOT = 69,
4117c478bd9Sstevel@tonic-gate 	NFS3ERR_STALE = 70,
4127c478bd9Sstevel@tonic-gate 	NFS3ERR_REMOTE = 71,
4137c478bd9Sstevel@tonic-gate 	NFS3ERR_BADHANDLE = 10001,
4147c478bd9Sstevel@tonic-gate 	NFS3ERR_NOT_SYNC = 10002,
4157c478bd9Sstevel@tonic-gate 	NFS3ERR_BAD_COOKIE = 10003,
4167c478bd9Sstevel@tonic-gate 	NFS3ERR_NOTSUPP = 10004,
4177c478bd9Sstevel@tonic-gate 	NFS3ERR_TOOSMALL = 10005,
4187c478bd9Sstevel@tonic-gate 	NFS3ERR_SERVERFAULT = 10006,
4197c478bd9Sstevel@tonic-gate 	NFS3ERR_BADTYPE = 10007,
4207c478bd9Sstevel@tonic-gate 	NFS3ERR_JUKEBOX = 10008
4217c478bd9Sstevel@tonic-gate };
4227c478bd9Sstevel@tonic-gate 
4237c478bd9Sstevel@tonic-gate /*
4247c478bd9Sstevel@tonic-gate  * File types
4257c478bd9Sstevel@tonic-gate  */
4267c478bd9Sstevel@tonic-gate enum ftype3 {
4277c478bd9Sstevel@tonic-gate 	NF3REG = 1,
4287c478bd9Sstevel@tonic-gate 	NF3DIR = 2,
4297c478bd9Sstevel@tonic-gate 	NF3BLK = 3,
4307c478bd9Sstevel@tonic-gate 	NF3CHR = 4,
4317c478bd9Sstevel@tonic-gate 	NF3LNK = 5,
4327c478bd9Sstevel@tonic-gate 	NF3SOCK = 6,
4337c478bd9Sstevel@tonic-gate 	NF3FIFO = 7
4347c478bd9Sstevel@tonic-gate };
4357c478bd9Sstevel@tonic-gate 
4367c478bd9Sstevel@tonic-gate struct specdata3 {
4377c478bd9Sstevel@tonic-gate 	uint32	specdata1;
4387c478bd9Sstevel@tonic-gate 	uint32	specdata2;
4397c478bd9Sstevel@tonic-gate };
4407c478bd9Sstevel@tonic-gate 
4417c478bd9Sstevel@tonic-gate /*
4427c478bd9Sstevel@tonic-gate  * File access handle
4437c478bd9Sstevel@tonic-gate  */
4447c478bd9Sstevel@tonic-gate struct nfs_fh3 {
4457c478bd9Sstevel@tonic-gate 	opaque data<NFS3_FHSIZE>;
4467c478bd9Sstevel@tonic-gate };
4477c478bd9Sstevel@tonic-gate 
448*e13f9236SToomas Soome /*
4497c478bd9Sstevel@tonic-gate  * Timeval
4507c478bd9Sstevel@tonic-gate  */
4517c478bd9Sstevel@tonic-gate struct nfstime3 {
4527c478bd9Sstevel@tonic-gate 	uint32 seconds;
4537c478bd9Sstevel@tonic-gate 	uint32 nseconds;
4547c478bd9Sstevel@tonic-gate };
4557c478bd9Sstevel@tonic-gate 
4567c478bd9Sstevel@tonic-gate /*
4577c478bd9Sstevel@tonic-gate  * File attributes
4587c478bd9Sstevel@tonic-gate  */
4597c478bd9Sstevel@tonic-gate struct fattr3 {
4607c478bd9Sstevel@tonic-gate 	ftype3	  type;
4617c478bd9Sstevel@tonic-gate 	mode3	  mode;
4627c478bd9Sstevel@tonic-gate 	uint32	  nlink;
4637c478bd9Sstevel@tonic-gate 	uid3	  uid;
4647c478bd9Sstevel@tonic-gate 	gid3	  gid;
4657c478bd9Sstevel@tonic-gate 	size3	  size;
4667c478bd9Sstevel@tonic-gate 	size3	  used;
4677c478bd9Sstevel@tonic-gate 	specdata3 rdev;
4687c478bd9Sstevel@tonic-gate 	uint64	  fsid;
4697c478bd9Sstevel@tonic-gate 	fileid3	  fileid;
4707c478bd9Sstevel@tonic-gate 	nfstime3  atime;
4717c478bd9Sstevel@tonic-gate 	nfstime3  mtime;
4727c478bd9Sstevel@tonic-gate 	nfstime3  ctime;
4737c478bd9Sstevel@tonic-gate };
4747c478bd9Sstevel@tonic-gate 
4757c478bd9Sstevel@tonic-gate /*
4767c478bd9Sstevel@tonic-gate  * File attributes
4777c478bd9Sstevel@tonic-gate  */
4787c478bd9Sstevel@tonic-gate union post_op_attr switch (bool attributes_follow) {
4797c478bd9Sstevel@tonic-gate case TRUE:
4807c478bd9Sstevel@tonic-gate 	fattr3 attributes;
4817c478bd9Sstevel@tonic-gate case FALSE:
4827c478bd9Sstevel@tonic-gate 	void;
483*e13f9236SToomas Soome };
4847c478bd9Sstevel@tonic-gate 
4857c478bd9Sstevel@tonic-gate struct wcc_attr {
4867c478bd9Sstevel@tonic-gate 	size3	 size;
4877c478bd9Sstevel@tonic-gate 	nfstime3 mtime;
4887c478bd9Sstevel@tonic-gate 	nfstime3 ctime;
4897c478bd9Sstevel@tonic-gate };
4907c478bd9Sstevel@tonic-gate 
4917c478bd9Sstevel@tonic-gate union pre_op_attr switch (bool attributes_follow) {
4927c478bd9Sstevel@tonic-gate case TRUE:
4937c478bd9Sstevel@tonic-gate 	wcc_attr attributes;
4947c478bd9Sstevel@tonic-gate case FALSE:
4957c478bd9Sstevel@tonic-gate 	void;
4967c478bd9Sstevel@tonic-gate };
4977c478bd9Sstevel@tonic-gate 
4987c478bd9Sstevel@tonic-gate struct wcc_data {
4997c478bd9Sstevel@tonic-gate 	pre_op_attr  before;
5007c478bd9Sstevel@tonic-gate 	post_op_attr after;
5017c478bd9Sstevel@tonic-gate };
5027c478bd9Sstevel@tonic-gate 
5037c478bd9Sstevel@tonic-gate union post_op_fh3 switch (bool handle_follows) {
5047c478bd9Sstevel@tonic-gate case TRUE:
5057c478bd9Sstevel@tonic-gate 	nfs_fh3 handle;
5067c478bd9Sstevel@tonic-gate case FALSE:
5077c478bd9Sstevel@tonic-gate 	void;
5087c478bd9Sstevel@tonic-gate };
5097c478bd9Sstevel@tonic-gate 
5107c478bd9Sstevel@tonic-gate enum time_how {
5117c478bd9Sstevel@tonic-gate 	DONT_CHANGE	   = 0,
5127c478bd9Sstevel@tonic-gate 	SET_TO_SERVER_TIME = 1,
5137c478bd9Sstevel@tonic-gate 	SET_TO_CLIENT_TIME = 2
5147c478bd9Sstevel@tonic-gate };
5157c478bd9Sstevel@tonic-gate 
5167c478bd9Sstevel@tonic-gate union set_mode3 switch (bool set_it) {
5177c478bd9Sstevel@tonic-gate case TRUE:
5187c478bd9Sstevel@tonic-gate 	mode3 mode;
5197c478bd9Sstevel@tonic-gate default:
5207c478bd9Sstevel@tonic-gate 	void;
5217c478bd9Sstevel@tonic-gate };
5227c478bd9Sstevel@tonic-gate 
5237c478bd9Sstevel@tonic-gate union set_uid3 switch (bool set_it) {
5247c478bd9Sstevel@tonic-gate case TRUE:
5257c478bd9Sstevel@tonic-gate 	uid3 uid;
5267c478bd9Sstevel@tonic-gate default:
5277c478bd9Sstevel@tonic-gate 	void;
5287c478bd9Sstevel@tonic-gate };
5297c478bd9Sstevel@tonic-gate 
5307c478bd9Sstevel@tonic-gate union set_gid3 switch (bool set_it) {
5317c478bd9Sstevel@tonic-gate case TRUE:
5327c478bd9Sstevel@tonic-gate 	gid3 gid;
5337c478bd9Sstevel@tonic-gate default:
5347c478bd9Sstevel@tonic-gate 	void;
5357c478bd9Sstevel@tonic-gate };
5367c478bd9Sstevel@tonic-gate 
5377c478bd9Sstevel@tonic-gate union set_size3 switch (bool set_it) {
5387c478bd9Sstevel@tonic-gate case TRUE:
5397c478bd9Sstevel@tonic-gate 	size3	size;
5407c478bd9Sstevel@tonic-gate default:
5417c478bd9Sstevel@tonic-gate 	void;
5427c478bd9Sstevel@tonic-gate };
5437c478bd9Sstevel@tonic-gate 
5447c478bd9Sstevel@tonic-gate union set_atime switch (time_how set_it) {
5457c478bd9Sstevel@tonic-gate case SET_TO_CLIENT_TIME:
5467c478bd9Sstevel@tonic-gate 	nfstime3 atime;
5477c478bd9Sstevel@tonic-gate default:
5487c478bd9Sstevel@tonic-gate 	void;
5497c478bd9Sstevel@tonic-gate };
5507c478bd9Sstevel@tonic-gate 
5517c478bd9Sstevel@tonic-gate union set_mtime switch (time_how set_it) {
5527c478bd9Sstevel@tonic-gate case SET_TO_CLIENT_TIME:
5537c478bd9Sstevel@tonic-gate 	nfstime3 mtime;
5547c478bd9Sstevel@tonic-gate default:
5557c478bd9Sstevel@tonic-gate 	void;
5567c478bd9Sstevel@tonic-gate };
5577c478bd9Sstevel@tonic-gate 
5587c478bd9Sstevel@tonic-gate struct sattr3 {
559*e13f9236SToomas Soome 	set_mode3 mode;
560*e13f9236SToomas Soome 	set_uid3  uid;
561*e13f9236SToomas Soome 	set_gid3  gid;
562*e13f9236SToomas Soome 	set_size3 size;
563*e13f9236SToomas Soome 	set_atime atime;
564*e13f9236SToomas Soome 	set_mtime mtime;
5657c478bd9Sstevel@tonic-gate };
5667c478bd9Sstevel@tonic-gate 
5677c478bd9Sstevel@tonic-gate struct diropargs3 {
5687c478bd9Sstevel@tonic-gate 	nfs_fh3   dir;
5697c478bd9Sstevel@tonic-gate 	filename3 name;
5707c478bd9Sstevel@tonic-gate };
5717c478bd9Sstevel@tonic-gate 
5727c478bd9Sstevel@tonic-gate /*
5737c478bd9Sstevel@tonic-gate  * GETATTR: Get file attributes
5747c478bd9Sstevel@tonic-gate  */
5757c478bd9Sstevel@tonic-gate struct GETATTR3args {
5767c478bd9Sstevel@tonic-gate 	nfs_fh3 object;
5777c478bd9Sstevel@tonic-gate };
5787c478bd9Sstevel@tonic-gate 
5797c478bd9Sstevel@tonic-gate struct GETATTR3resok {
5807c478bd9Sstevel@tonic-gate 	fattr3 obj_attributes;
5817c478bd9Sstevel@tonic-gate };
5827c478bd9Sstevel@tonic-gate 
5837c478bd9Sstevel@tonic-gate union GETATTR3res switch (nfsstat3 status) {
5847c478bd9Sstevel@tonic-gate case NFS3_OK:
5857c478bd9Sstevel@tonic-gate 	GETATTR3resok resok;
5867c478bd9Sstevel@tonic-gate default:
5877c478bd9Sstevel@tonic-gate 	void;
5887c478bd9Sstevel@tonic-gate };
5897c478bd9Sstevel@tonic-gate 
5907c478bd9Sstevel@tonic-gate /*
5917c478bd9Sstevel@tonic-gate  * SETATTR: Set file attributes
5927c478bd9Sstevel@tonic-gate  */
5937c478bd9Sstevel@tonic-gate union sattrguard3 switch (bool check) {
5947c478bd9Sstevel@tonic-gate case TRUE:
5957c478bd9Sstevel@tonic-gate 	nfstime3 obj_ctime;
5967c478bd9Sstevel@tonic-gate case FALSE:
5977c478bd9Sstevel@tonic-gate 	void;
5987c478bd9Sstevel@tonic-gate };
5997c478bd9Sstevel@tonic-gate 
6007c478bd9Sstevel@tonic-gate struct SETATTR3args {
6017c478bd9Sstevel@tonic-gate 	nfs_fh3     object;
6027c478bd9Sstevel@tonic-gate 	sattr3	    new_attributes;
6037c478bd9Sstevel@tonic-gate 	sattrguard3 guard;
6047c478bd9Sstevel@tonic-gate };
6057c478bd9Sstevel@tonic-gate 
6067c478bd9Sstevel@tonic-gate struct SETATTR3resok {
6077c478bd9Sstevel@tonic-gate 	wcc_data obj_wcc;
6087c478bd9Sstevel@tonic-gate };
6097c478bd9Sstevel@tonic-gate 
6107c478bd9Sstevel@tonic-gate struct SETATTR3resfail {
6117c478bd9Sstevel@tonic-gate 	wcc_data obj_wcc;
6127c478bd9Sstevel@tonic-gate };
6137c478bd9Sstevel@tonic-gate 
6147c478bd9Sstevel@tonic-gate union SETATTR3res switch (nfsstat3 status) {
6157c478bd9Sstevel@tonic-gate case NFS3_OK:
6167c478bd9Sstevel@tonic-gate 	SETATTR3resok	resok;
6177c478bd9Sstevel@tonic-gate default:
6187c478bd9Sstevel@tonic-gate 	SETATTR3resfail	resfail;
6197c478bd9Sstevel@tonic-gate };
6207c478bd9Sstevel@tonic-gate 
6217c478bd9Sstevel@tonic-gate /*
6227c478bd9Sstevel@tonic-gate  * LOOKUP: Lookup filename
6237c478bd9Sstevel@tonic-gate  */
6247c478bd9Sstevel@tonic-gate struct LOOKUP3args {
6257c478bd9Sstevel@tonic-gate 	diropargs3 what;
6267c478bd9Sstevel@tonic-gate };
6277c478bd9Sstevel@tonic-gate 
6287c478bd9Sstevel@tonic-gate struct LOOKUP3resok {
6297c478bd9Sstevel@tonic-gate 	nfs_fh3		object;
6307c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
6317c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
6327c478bd9Sstevel@tonic-gate };
6337c478bd9Sstevel@tonic-gate 
6347c478bd9Sstevel@tonic-gate struct LOOKUP3resfail {
6357c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
6367c478bd9Sstevel@tonic-gate };
6377c478bd9Sstevel@tonic-gate 
6387c478bd9Sstevel@tonic-gate union LOOKUP3res switch (nfsstat3 status) {
6397c478bd9Sstevel@tonic-gate case NFS3_OK:
6407c478bd9Sstevel@tonic-gate 	LOOKUP3resok	resok;
6417c478bd9Sstevel@tonic-gate default:
6427c478bd9Sstevel@tonic-gate 	LOOKUP3resfail	resfail;
6437c478bd9Sstevel@tonic-gate };
6447c478bd9Sstevel@tonic-gate 
6457c478bd9Sstevel@tonic-gate /*
6467c478bd9Sstevel@tonic-gate  * ACCESS: Check access permission
6477c478bd9Sstevel@tonic-gate  */
6487c478bd9Sstevel@tonic-gate const ACCESS3_READ	= 0x0001;
6497c478bd9Sstevel@tonic-gate const ACCESS3_LOOKUP	= 0x0002;
6507c478bd9Sstevel@tonic-gate const ACCESS3_MODIFY	= 0x0004;
6517c478bd9Sstevel@tonic-gate const ACCESS3_EXTEND	= 0x0008;
6527c478bd9Sstevel@tonic-gate const ACCESS3_DELETE	= 0x0010;
6537c478bd9Sstevel@tonic-gate const ACCESS3_EXECUTE	= 0x0020;
6547c478bd9Sstevel@tonic-gate 
6557c478bd9Sstevel@tonic-gate struct ACCESS3args {
6567c478bd9Sstevel@tonic-gate 	nfs_fh3	object;
6577c478bd9Sstevel@tonic-gate 	uint32	access;
6587c478bd9Sstevel@tonic-gate };
6597c478bd9Sstevel@tonic-gate 
6607c478bd9Sstevel@tonic-gate struct ACCESS3resok {
6617c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
6627c478bd9Sstevel@tonic-gate 	uint32		access;
6637c478bd9Sstevel@tonic-gate };
6647c478bd9Sstevel@tonic-gate 
6657c478bd9Sstevel@tonic-gate struct ACCESS3resfail {
6667c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
6677c478bd9Sstevel@tonic-gate };
6687c478bd9Sstevel@tonic-gate 
6697c478bd9Sstevel@tonic-gate union ACCESS3res switch (nfsstat3 status) {
6707c478bd9Sstevel@tonic-gate case NFS3_OK:
6717c478bd9Sstevel@tonic-gate 	ACCESS3resok	resok;
6727c478bd9Sstevel@tonic-gate default:
6737c478bd9Sstevel@tonic-gate 	ACCESS3resfail	resfail;
6747c478bd9Sstevel@tonic-gate };
6757c478bd9Sstevel@tonic-gate 
6767c478bd9Sstevel@tonic-gate /*
6777c478bd9Sstevel@tonic-gate  * READLINK: Read from symbolic link
6787c478bd9Sstevel@tonic-gate  */
6797c478bd9Sstevel@tonic-gate struct READLINK3args {
6807c478bd9Sstevel@tonic-gate 	nfs_fh3	symlink;
6817c478bd9Sstevel@tonic-gate };
6827c478bd9Sstevel@tonic-gate 
6837c478bd9Sstevel@tonic-gate struct READLINK3resok {
6847c478bd9Sstevel@tonic-gate 	post_op_attr	symlink_attributes;
6857c478bd9Sstevel@tonic-gate 	nfspath3	data;
6867c478bd9Sstevel@tonic-gate };
6877c478bd9Sstevel@tonic-gate 
6887c478bd9Sstevel@tonic-gate struct READLINK3resfail {
6897c478bd9Sstevel@tonic-gate 	post_op_attr	symlink_attributes;
6907c478bd9Sstevel@tonic-gate };
691*e13f9236SToomas Soome 
6927c478bd9Sstevel@tonic-gate union READLINK3res switch (nfsstat3 status) {
6937c478bd9Sstevel@tonic-gate case NFS3_OK:
6947c478bd9Sstevel@tonic-gate 	READLINK3resok	 resok;
6957c478bd9Sstevel@tonic-gate default:
6967c478bd9Sstevel@tonic-gate 	READLINK3resfail resfail;
6977c478bd9Sstevel@tonic-gate };
6987c478bd9Sstevel@tonic-gate 
6997c478bd9Sstevel@tonic-gate /*
7007c478bd9Sstevel@tonic-gate  * READ: Read from file
7017c478bd9Sstevel@tonic-gate  */
7027c478bd9Sstevel@tonic-gate struct READ3args {
7037c478bd9Sstevel@tonic-gate 	nfs_fh3		file;
7047c478bd9Sstevel@tonic-gate 	offset3		offset;
7057c478bd9Sstevel@tonic-gate 	count3		count;
7067c478bd9Sstevel@tonic-gate };
7077c478bd9Sstevel@tonic-gate 
7087c478bd9Sstevel@tonic-gate struct READ3resok {
7097c478bd9Sstevel@tonic-gate 	post_op_attr	file_attributes;
7107c478bd9Sstevel@tonic-gate 	count3		count;
7117c478bd9Sstevel@tonic-gate 	bool		eof;
7127c478bd9Sstevel@tonic-gate 	opaque		data<>;
7137c478bd9Sstevel@tonic-gate };
7147c478bd9Sstevel@tonic-gate 
7157c478bd9Sstevel@tonic-gate struct READ3resfail {
7167c478bd9Sstevel@tonic-gate 	post_op_attr	file_attributes;
7177c478bd9Sstevel@tonic-gate };
7187c478bd9Sstevel@tonic-gate 
7197c478bd9Sstevel@tonic-gate union READ3res switch (nfsstat3 status) {
7207c478bd9Sstevel@tonic-gate case NFS3_OK:
7217c478bd9Sstevel@tonic-gate 	READ3resok	resok;
7227c478bd9Sstevel@tonic-gate default:
7237c478bd9Sstevel@tonic-gate 	READ3resfail	resfail;
7247c478bd9Sstevel@tonic-gate };
7257c478bd9Sstevel@tonic-gate 
7267c478bd9Sstevel@tonic-gate /*
7277c478bd9Sstevel@tonic-gate  * WRITE: Write to file
7287c478bd9Sstevel@tonic-gate  */
7297c478bd9Sstevel@tonic-gate enum stable_how {
7307c478bd9Sstevel@tonic-gate 	UNSTABLE  = 0,
7317c478bd9Sstevel@tonic-gate 	DATA_SYNC = 1,
7327c478bd9Sstevel@tonic-gate 	FILE_SYNC = 2
7337c478bd9Sstevel@tonic-gate };
7347c478bd9Sstevel@tonic-gate 
7357c478bd9Sstevel@tonic-gate struct WRITE3args {
7367c478bd9Sstevel@tonic-gate 	nfs_fh3		file;
7377c478bd9Sstevel@tonic-gate 	offset3		offset;
7387c478bd9Sstevel@tonic-gate 	count3		count;
7397c478bd9Sstevel@tonic-gate 	stable_how	stable;
7407c478bd9Sstevel@tonic-gate 	opaque		data<>;
7417c478bd9Sstevel@tonic-gate };
7427c478bd9Sstevel@tonic-gate 
7437c478bd9Sstevel@tonic-gate struct WRITE3resok {
7447c478bd9Sstevel@tonic-gate 	wcc_data	file_wcc;
7457c478bd9Sstevel@tonic-gate 	count3		count;
7467c478bd9Sstevel@tonic-gate 	stable_how	committed;
7477c478bd9Sstevel@tonic-gate 	writeverf3	verf;
7487c478bd9Sstevel@tonic-gate };
7497c478bd9Sstevel@tonic-gate 
7507c478bd9Sstevel@tonic-gate struct WRITE3resfail {
7517c478bd9Sstevel@tonic-gate 	wcc_data	file_wcc;
7527c478bd9Sstevel@tonic-gate };
7537c478bd9Sstevel@tonic-gate 
7547c478bd9Sstevel@tonic-gate union WRITE3res switch (nfsstat3 status) {
7557c478bd9Sstevel@tonic-gate case NFS3_OK:
7567c478bd9Sstevel@tonic-gate 	WRITE3resok	resok;
7577c478bd9Sstevel@tonic-gate default:
7587c478bd9Sstevel@tonic-gate 	WRITE3resfail	resfail;
7597c478bd9Sstevel@tonic-gate };
7607c478bd9Sstevel@tonic-gate 
7617c478bd9Sstevel@tonic-gate /*
7627c478bd9Sstevel@tonic-gate  * CREATE: Create a file
7637c478bd9Sstevel@tonic-gate  */
7647c478bd9Sstevel@tonic-gate enum createmode3 {
7657c478bd9Sstevel@tonic-gate 	UNCHECKED = 0,
7667c478bd9Sstevel@tonic-gate 	GUARDED	  = 1,
7677c478bd9Sstevel@tonic-gate 	EXCLUSIVE = 2
7687c478bd9Sstevel@tonic-gate };
7697c478bd9Sstevel@tonic-gate 
7707c478bd9Sstevel@tonic-gate union createhow3 switch (createmode3 mode) {
7717c478bd9Sstevel@tonic-gate case UNCHECKED:
7727c478bd9Sstevel@tonic-gate case GUARDED:
7737c478bd9Sstevel@tonic-gate 	sattr3		obj_attributes;
7747c478bd9Sstevel@tonic-gate case EXCLUSIVE:
7757c478bd9Sstevel@tonic-gate 	createverf3	verf;
7767c478bd9Sstevel@tonic-gate };
7777c478bd9Sstevel@tonic-gate 
7787c478bd9Sstevel@tonic-gate struct CREATE3args {
7797c478bd9Sstevel@tonic-gate 	diropargs3	where;
7807c478bd9Sstevel@tonic-gate 	createhow3	how;
7817c478bd9Sstevel@tonic-gate };
7827c478bd9Sstevel@tonic-gate 
7837c478bd9Sstevel@tonic-gate struct CREATE3resok {
7847c478bd9Sstevel@tonic-gate 	post_op_fh3	obj;
7857c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
7867c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
7877c478bd9Sstevel@tonic-gate };
7887c478bd9Sstevel@tonic-gate 
7897c478bd9Sstevel@tonic-gate struct CREATE3resfail {
7907c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
7917c478bd9Sstevel@tonic-gate };
7927c478bd9Sstevel@tonic-gate 
7937c478bd9Sstevel@tonic-gate union CREATE3res switch (nfsstat3 status) {
7947c478bd9Sstevel@tonic-gate case NFS3_OK:
7957c478bd9Sstevel@tonic-gate 	CREATE3resok	resok;
7967c478bd9Sstevel@tonic-gate default:
7977c478bd9Sstevel@tonic-gate 	CREATE3resfail	resfail;
7987c478bd9Sstevel@tonic-gate };
7997c478bd9Sstevel@tonic-gate 
8007c478bd9Sstevel@tonic-gate /*
8017c478bd9Sstevel@tonic-gate  * MKDIR: Create a directory
8027c478bd9Sstevel@tonic-gate  */
8037c478bd9Sstevel@tonic-gate struct MKDIR3args {
8047c478bd9Sstevel@tonic-gate 	diropargs3	where;
8057c478bd9Sstevel@tonic-gate 	sattr3		attributes;
8067c478bd9Sstevel@tonic-gate };
8077c478bd9Sstevel@tonic-gate 
8087c478bd9Sstevel@tonic-gate struct MKDIR3resok {
8097c478bd9Sstevel@tonic-gate 	post_op_fh3	obj;
8107c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
8117c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
8127c478bd9Sstevel@tonic-gate };
8137c478bd9Sstevel@tonic-gate 
8147c478bd9Sstevel@tonic-gate struct MKDIR3resfail {
8157c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
8167c478bd9Sstevel@tonic-gate };
8177c478bd9Sstevel@tonic-gate 
8187c478bd9Sstevel@tonic-gate union MKDIR3res switch (nfsstat3 status) {
8197c478bd9Sstevel@tonic-gate case NFS3_OK:
8207c478bd9Sstevel@tonic-gate 	MKDIR3resok	resok;
8217c478bd9Sstevel@tonic-gate default:
8227c478bd9Sstevel@tonic-gate 	MKDIR3resfail	resfail;
8237c478bd9Sstevel@tonic-gate };
8247c478bd9Sstevel@tonic-gate 
8257c478bd9Sstevel@tonic-gate /*
8267c478bd9Sstevel@tonic-gate  * SYMLINK: Create a symbolic link
8277c478bd9Sstevel@tonic-gate  */
8287c478bd9Sstevel@tonic-gate struct symlinkdata3 {
8297c478bd9Sstevel@tonic-gate 	sattr3		symlink_attributes;
8307c478bd9Sstevel@tonic-gate 	nfspath3	symlink_data;
8317c478bd9Sstevel@tonic-gate };
8327c478bd9Sstevel@tonic-gate 
8337c478bd9Sstevel@tonic-gate struct SYMLINK3args {
8347c478bd9Sstevel@tonic-gate 	diropargs3	where;
8357c478bd9Sstevel@tonic-gate 	symlinkdata3	symlink;
8367c478bd9Sstevel@tonic-gate };
8377c478bd9Sstevel@tonic-gate 
8387c478bd9Sstevel@tonic-gate struct SYMLINK3resok {
8397c478bd9Sstevel@tonic-gate 	post_op_fh3	obj;
8407c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
8417c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
8427c478bd9Sstevel@tonic-gate };
8437c478bd9Sstevel@tonic-gate 
8447c478bd9Sstevel@tonic-gate struct SYMLINK3resfail {
8457c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
8467c478bd9Sstevel@tonic-gate };
8477c478bd9Sstevel@tonic-gate 
8487c478bd9Sstevel@tonic-gate union SYMLINK3res switch (nfsstat3 status) {
8497c478bd9Sstevel@tonic-gate case NFS3_OK:
8507c478bd9Sstevel@tonic-gate 	SYMLINK3resok	resok;
8517c478bd9Sstevel@tonic-gate default:
8527c478bd9Sstevel@tonic-gate 	SYMLINK3resfail	resfail;
8537c478bd9Sstevel@tonic-gate };
8547c478bd9Sstevel@tonic-gate 
8557c478bd9Sstevel@tonic-gate /*
8567c478bd9Sstevel@tonic-gate  * MKNOD: Create a special file
8577c478bd9Sstevel@tonic-gate  */
8587c478bd9Sstevel@tonic-gate struct devicedata3 {
8597c478bd9Sstevel@tonic-gate 	sattr3		dev_attributes;
8607c478bd9Sstevel@tonic-gate 	specdata3	spec;
8617c478bd9Sstevel@tonic-gate };
8627c478bd9Sstevel@tonic-gate 
8637c478bd9Sstevel@tonic-gate union mknoddata3 switch (ftype3 type) {
8647c478bd9Sstevel@tonic-gate case NF3CHR:
8657c478bd9Sstevel@tonic-gate case NF3BLK:
8667c478bd9Sstevel@tonic-gate 	devicedata3	device;
8677c478bd9Sstevel@tonic-gate case NF3SOCK:
8687c478bd9Sstevel@tonic-gate case NF3FIFO:
8697c478bd9Sstevel@tonic-gate 	sattr3		pipe_attributes;
8707c478bd9Sstevel@tonic-gate default:
8717c478bd9Sstevel@tonic-gate 	void;
8727c478bd9Sstevel@tonic-gate };
8737c478bd9Sstevel@tonic-gate 
8747c478bd9Sstevel@tonic-gate struct MKNOD3args {
8757c478bd9Sstevel@tonic-gate 	diropargs3	where;
8767c478bd9Sstevel@tonic-gate 	mknoddata3	what;
8777c478bd9Sstevel@tonic-gate };
8787c478bd9Sstevel@tonic-gate 
8797c478bd9Sstevel@tonic-gate struct MKNOD3resok {
8807c478bd9Sstevel@tonic-gate 	post_op_fh3	obj;
8817c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
8827c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
8837c478bd9Sstevel@tonic-gate };
8847c478bd9Sstevel@tonic-gate 
8857c478bd9Sstevel@tonic-gate struct MKNOD3resfail {
8867c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
8877c478bd9Sstevel@tonic-gate };
8887c478bd9Sstevel@tonic-gate 
8897c478bd9Sstevel@tonic-gate union MKNOD3res switch (nfsstat3 status) {
8907c478bd9Sstevel@tonic-gate case NFS3_OK:
8917c478bd9Sstevel@tonic-gate 	MKNOD3resok	resok;
8927c478bd9Sstevel@tonic-gate default:
8937c478bd9Sstevel@tonic-gate 	MKNOD3resfail	resfail;
8947c478bd9Sstevel@tonic-gate };
8957c478bd9Sstevel@tonic-gate 
8967c478bd9Sstevel@tonic-gate /*
8977c478bd9Sstevel@tonic-gate  * REMOVE: Remove a file
8987c478bd9Sstevel@tonic-gate  */
8997c478bd9Sstevel@tonic-gate struct REMOVE3args {
9007c478bd9Sstevel@tonic-gate 	diropargs3	object;
9017c478bd9Sstevel@tonic-gate };
9027c478bd9Sstevel@tonic-gate 
9037c478bd9Sstevel@tonic-gate struct REMOVE3resok {
9047c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
9057c478bd9Sstevel@tonic-gate };
9067c478bd9Sstevel@tonic-gate 
9077c478bd9Sstevel@tonic-gate struct REMOVE3resfail {
9087c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
9097c478bd9Sstevel@tonic-gate };
9107c478bd9Sstevel@tonic-gate 
9117c478bd9Sstevel@tonic-gate union REMOVE3res switch (nfsstat3 status) {
9127c478bd9Sstevel@tonic-gate case NFS3_OK:
9137c478bd9Sstevel@tonic-gate 	REMOVE3resok	resok;
9147c478bd9Sstevel@tonic-gate default:
9157c478bd9Sstevel@tonic-gate 	REMOVE3resfail	resfail;
9167c478bd9Sstevel@tonic-gate };
9177c478bd9Sstevel@tonic-gate 
9187c478bd9Sstevel@tonic-gate /*
9197c478bd9Sstevel@tonic-gate  * RMDIR: Remove a directory
9207c478bd9Sstevel@tonic-gate  */
9217c478bd9Sstevel@tonic-gate struct RMDIR3args {
9227c478bd9Sstevel@tonic-gate 	diropargs3 object;
9237c478bd9Sstevel@tonic-gate };
9247c478bd9Sstevel@tonic-gate 
9257c478bd9Sstevel@tonic-gate struct RMDIR3resok {
9267c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
9277c478bd9Sstevel@tonic-gate };
9287c478bd9Sstevel@tonic-gate 
9297c478bd9Sstevel@tonic-gate struct RMDIR3resfail {
9307c478bd9Sstevel@tonic-gate 	wcc_data	dir_wcc;
9317c478bd9Sstevel@tonic-gate };
9327c478bd9Sstevel@tonic-gate 
9337c478bd9Sstevel@tonic-gate union RMDIR3res switch (nfsstat3 status) {
9347c478bd9Sstevel@tonic-gate case NFS3_OK:
9357c478bd9Sstevel@tonic-gate 	RMDIR3resok	resok;
9367c478bd9Sstevel@tonic-gate default:
9377c478bd9Sstevel@tonic-gate 	RMDIR3resfail	resfail;
9387c478bd9Sstevel@tonic-gate };
9397c478bd9Sstevel@tonic-gate 
9407c478bd9Sstevel@tonic-gate /*
9417c478bd9Sstevel@tonic-gate  * RENAME: Rename a file or directory
9427c478bd9Sstevel@tonic-gate  */
9437c478bd9Sstevel@tonic-gate struct RENAME3args {
9447c478bd9Sstevel@tonic-gate 	diropargs3	from;
9457c478bd9Sstevel@tonic-gate 	diropargs3	to;
9467c478bd9Sstevel@tonic-gate };
9477c478bd9Sstevel@tonic-gate 
9487c478bd9Sstevel@tonic-gate struct RENAME3resok {
9497c478bd9Sstevel@tonic-gate 	wcc_data	fromdir_wcc;
9507c478bd9Sstevel@tonic-gate 	wcc_data	todir_wcc;
9517c478bd9Sstevel@tonic-gate };
9527c478bd9Sstevel@tonic-gate 
9537c478bd9Sstevel@tonic-gate struct RENAME3resfail {
9547c478bd9Sstevel@tonic-gate 	wcc_data	fromdir_wcc;
9557c478bd9Sstevel@tonic-gate 	wcc_data	todir_wcc;
9567c478bd9Sstevel@tonic-gate };
9577c478bd9Sstevel@tonic-gate 
9587c478bd9Sstevel@tonic-gate union RENAME3res switch (nfsstat3 status) {
9597c478bd9Sstevel@tonic-gate case NFS3_OK:
9607c478bd9Sstevel@tonic-gate 	RENAME3resok	resok;
9617c478bd9Sstevel@tonic-gate default:
9627c478bd9Sstevel@tonic-gate 	RENAME3resfail	resfail;
9637c478bd9Sstevel@tonic-gate };
9647c478bd9Sstevel@tonic-gate 
9657c478bd9Sstevel@tonic-gate /*
9667c478bd9Sstevel@tonic-gate  * LINK: Create link to an object
9677c478bd9Sstevel@tonic-gate  */
9687c478bd9Sstevel@tonic-gate struct LINK3args {
9697c478bd9Sstevel@tonic-gate 	nfs_fh3		file;
9707c478bd9Sstevel@tonic-gate 	diropargs3	link;
9717c478bd9Sstevel@tonic-gate };
9727c478bd9Sstevel@tonic-gate 
9737c478bd9Sstevel@tonic-gate struct LINK3resok {
9747c478bd9Sstevel@tonic-gate 	post_op_attr	file_attributes;
9757c478bd9Sstevel@tonic-gate 	wcc_data	linkdir_wcc;
9767c478bd9Sstevel@tonic-gate };
9777c478bd9Sstevel@tonic-gate 
9787c478bd9Sstevel@tonic-gate struct LINK3resfail {
9797c478bd9Sstevel@tonic-gate 	post_op_attr	file_attributes;
9807c478bd9Sstevel@tonic-gate 	wcc_data	linkdir_wcc;
9817c478bd9Sstevel@tonic-gate };
9827c478bd9Sstevel@tonic-gate 
9837c478bd9Sstevel@tonic-gate union LINK3res switch (nfsstat3 status) {
9847c478bd9Sstevel@tonic-gate case NFS3_OK:
9857c478bd9Sstevel@tonic-gate 	LINK3resok	resok;
9867c478bd9Sstevel@tonic-gate default:
9877c478bd9Sstevel@tonic-gate 	LINK3resfail	resfail;
9887c478bd9Sstevel@tonic-gate };
9897c478bd9Sstevel@tonic-gate 
9907c478bd9Sstevel@tonic-gate /*
9917c478bd9Sstevel@tonic-gate  * READDIR: Read from directory
9927c478bd9Sstevel@tonic-gate  */
9937c478bd9Sstevel@tonic-gate struct READDIR3args {
9947c478bd9Sstevel@tonic-gate 	nfs_fh3		dir;
9957c478bd9Sstevel@tonic-gate 	cookie3		cookie;
9967c478bd9Sstevel@tonic-gate 	cookieverf3	cookieverf;
9977c478bd9Sstevel@tonic-gate 	count3		count;
9987c478bd9Sstevel@tonic-gate };
9997c478bd9Sstevel@tonic-gate 
10007c478bd9Sstevel@tonic-gate struct entry3 {
10017c478bd9Sstevel@tonic-gate 	fileid3		fileid;
10027c478bd9Sstevel@tonic-gate 	filename3	name;
10037c478bd9Sstevel@tonic-gate 	cookie3		cookie;
10047c478bd9Sstevel@tonic-gate 	entry3		*nextentry;
10057c478bd9Sstevel@tonic-gate };
10067c478bd9Sstevel@tonic-gate 
10077c478bd9Sstevel@tonic-gate struct dirlist3 {
10087c478bd9Sstevel@tonic-gate 	entry3	*entries;
10097c478bd9Sstevel@tonic-gate 	bool	eof;
10107c478bd9Sstevel@tonic-gate };
10117c478bd9Sstevel@tonic-gate 
10127c478bd9Sstevel@tonic-gate struct READDIR3resok {
10137c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
10147c478bd9Sstevel@tonic-gate 	cookieverf3	cookieverf;
10157c478bd9Sstevel@tonic-gate 	dirlist3	reply;
10167c478bd9Sstevel@tonic-gate };
10177c478bd9Sstevel@tonic-gate 
10187c478bd9Sstevel@tonic-gate struct READDIR3resfail {
10197c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
10207c478bd9Sstevel@tonic-gate };
10217c478bd9Sstevel@tonic-gate 
10227c478bd9Sstevel@tonic-gate union READDIR3res switch (nfsstat3 status) {
10237c478bd9Sstevel@tonic-gate case NFS3_OK:
10247c478bd9Sstevel@tonic-gate 	READDIR3resok	resok;
10257c478bd9Sstevel@tonic-gate default:
10267c478bd9Sstevel@tonic-gate 	READDIR3resfail	resfail;
10277c478bd9Sstevel@tonic-gate };
10287c478bd9Sstevel@tonic-gate 
10297c478bd9Sstevel@tonic-gate /*
10307c478bd9Sstevel@tonic-gate  * READDIRPLUS: Extended read from a directory
10317c478bd9Sstevel@tonic-gate  */
10327c478bd9Sstevel@tonic-gate struct READDIRPLUS3args {
10337c478bd9Sstevel@tonic-gate 	nfs_fh3		dir;
10347c478bd9Sstevel@tonic-gate 	cookie3		cookie;
10357c478bd9Sstevel@tonic-gate 	cookieverf3	cookieverf;
10367c478bd9Sstevel@tonic-gate 	count3		dircount;
10377c478bd9Sstevel@tonic-gate 	count3		maxcount;
10387c478bd9Sstevel@tonic-gate };
10397c478bd9Sstevel@tonic-gate 
10407c478bd9Sstevel@tonic-gate struct entryplus3 {
10417c478bd9Sstevel@tonic-gate 	fileid3		fileid;
10427c478bd9Sstevel@tonic-gate 	filename3	name;
10437c478bd9Sstevel@tonic-gate 	cookie3		cookie;
10447c478bd9Sstevel@tonic-gate 	post_op_attr	name_attributes;
10457c478bd9Sstevel@tonic-gate 	post_op_fh3	name_handle;
10467c478bd9Sstevel@tonic-gate 	entryplus3	*nextentry;
10477c478bd9Sstevel@tonic-gate };
10487c478bd9Sstevel@tonic-gate 
10497c478bd9Sstevel@tonic-gate struct dirlistplus3 {
10507c478bd9Sstevel@tonic-gate 	entryplus3	*entries;
10517c478bd9Sstevel@tonic-gate 	bool		eof;
10527c478bd9Sstevel@tonic-gate };
10537c478bd9Sstevel@tonic-gate 
10547c478bd9Sstevel@tonic-gate struct READDIRPLUS3resok {
10557c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
10567c478bd9Sstevel@tonic-gate 	cookieverf3	cookieverf;
10577c478bd9Sstevel@tonic-gate 	dirlistplus3	reply;
10587c478bd9Sstevel@tonic-gate };
10597c478bd9Sstevel@tonic-gate 
10607c478bd9Sstevel@tonic-gate struct READDIRPLUS3resfail {
10617c478bd9Sstevel@tonic-gate 	post_op_attr	dir_attributes;
10627c478bd9Sstevel@tonic-gate };
10637c478bd9Sstevel@tonic-gate 
10647c478bd9Sstevel@tonic-gate union READDIRPLUS3res switch (nfsstat3 status) {
10657c478bd9Sstevel@tonic-gate case NFS3_OK:
10667c478bd9Sstevel@tonic-gate 	READDIRPLUS3resok	resok;
10677c478bd9Sstevel@tonic-gate default:
10687c478bd9Sstevel@tonic-gate 	READDIRPLUS3resfail	resfail;
10697c478bd9Sstevel@tonic-gate };
10707c478bd9Sstevel@tonic-gate 
10717c478bd9Sstevel@tonic-gate /*
10727c478bd9Sstevel@tonic-gate  * FSSTAT: Get dynamic file system information
10737c478bd9Sstevel@tonic-gate  */
10747c478bd9Sstevel@tonic-gate struct FSSTAT3args {
10757c478bd9Sstevel@tonic-gate 	nfs_fh3	fsroot;
10767c478bd9Sstevel@tonic-gate };
10777c478bd9Sstevel@tonic-gate 
10787c478bd9Sstevel@tonic-gate struct FSSTAT3resok {
10797c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
10807c478bd9Sstevel@tonic-gate 	size3		tbytes;
10817c478bd9Sstevel@tonic-gate 	size3		fbytes;
10827c478bd9Sstevel@tonic-gate 	size3		abytes;
10837c478bd9Sstevel@tonic-gate 	size3		tfiles;
10847c478bd9Sstevel@tonic-gate 	size3		ffiles;
10857c478bd9Sstevel@tonic-gate 	size3		afiles;
10867c478bd9Sstevel@tonic-gate 	uint32		invarsec;
10877c478bd9Sstevel@tonic-gate };
10887c478bd9Sstevel@tonic-gate 
10897c478bd9Sstevel@tonic-gate struct FSSTAT3resfail {
10907c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
10917c478bd9Sstevel@tonic-gate };
10927c478bd9Sstevel@tonic-gate 
10937c478bd9Sstevel@tonic-gate union FSSTAT3res switch (nfsstat3 status) {
10947c478bd9Sstevel@tonic-gate case NFS3_OK:
10957c478bd9Sstevel@tonic-gate 	FSSTAT3resok	resok;
10967c478bd9Sstevel@tonic-gate default:
10977c478bd9Sstevel@tonic-gate 	FSSTAT3resfail	resfail;
10987c478bd9Sstevel@tonic-gate };
10997c478bd9Sstevel@tonic-gate 
11007c478bd9Sstevel@tonic-gate /*
11017c478bd9Sstevel@tonic-gate  * FSINFO: Get static file system information
11027c478bd9Sstevel@tonic-gate  */
11037c478bd9Sstevel@tonic-gate 
11047c478bd9Sstevel@tonic-gate const FSF3_LINK		= 0x0001;
11057c478bd9Sstevel@tonic-gate const FSF3_SYMLINK	= 0x0002;
11067c478bd9Sstevel@tonic-gate const FSF3_HOMOGENEOUS	= 0x0008;
11077c478bd9Sstevel@tonic-gate const FSF3_CANSETTIME	= 0x0010;
11087c478bd9Sstevel@tonic-gate 
11097c478bd9Sstevel@tonic-gate struct FSINFO3args {
11107c478bd9Sstevel@tonic-gate 	nfs_fh3	fsroot;
11117c478bd9Sstevel@tonic-gate };
11127c478bd9Sstevel@tonic-gate 
11137c478bd9Sstevel@tonic-gate struct FSINFO3resok {
11147c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
11157c478bd9Sstevel@tonic-gate 	uint32		rtmax;
11167c478bd9Sstevel@tonic-gate 	uint32		rtpref;
11177c478bd9Sstevel@tonic-gate 	uint32		rtmult;
11187c478bd9Sstevel@tonic-gate 	uint32		wtmax;
11197c478bd9Sstevel@tonic-gate 	uint32		wtpref;
11207c478bd9Sstevel@tonic-gate 	uint32		wtmult;
11217c478bd9Sstevel@tonic-gate 	uint32		dtpref;
11227c478bd9Sstevel@tonic-gate 	size3		maxfilesize;
11237c478bd9Sstevel@tonic-gate 	nfstime3	time_delta;
11247c478bd9Sstevel@tonic-gate 	uint32		properties;
11257c478bd9Sstevel@tonic-gate };
11267c478bd9Sstevel@tonic-gate 
11277c478bd9Sstevel@tonic-gate struct FSINFO3resfail {
11287c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
11297c478bd9Sstevel@tonic-gate };
11307c478bd9Sstevel@tonic-gate 
11317c478bd9Sstevel@tonic-gate union FSINFO3res switch (nfsstat3 status) {
11327c478bd9Sstevel@tonic-gate case NFS3_OK:
11337c478bd9Sstevel@tonic-gate 	FSINFO3resok	resok;
11347c478bd9Sstevel@tonic-gate default:
11357c478bd9Sstevel@tonic-gate 	FSINFO3resfail	resfail;
11367c478bd9Sstevel@tonic-gate };
11377c478bd9Sstevel@tonic-gate 
11387c478bd9Sstevel@tonic-gate /*
11397c478bd9Sstevel@tonic-gate  * PATHCONF: Retrieve POSIX information
11407c478bd9Sstevel@tonic-gate  */
11417c478bd9Sstevel@tonic-gate struct PATHCONF3args {
11427c478bd9Sstevel@tonic-gate 	nfs_fh3	object;
11437c478bd9Sstevel@tonic-gate };
11447c478bd9Sstevel@tonic-gate 
11457c478bd9Sstevel@tonic-gate struct PATHCONF3resok {
11467c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
11477c478bd9Sstevel@tonic-gate 	uint32		linkmax;
11487c478bd9Sstevel@tonic-gate 	uint32		name_max;
11497c478bd9Sstevel@tonic-gate 	bool		no_trunc;
11507c478bd9Sstevel@tonic-gate 	bool		chown_restricted;
11517c478bd9Sstevel@tonic-gate 	bool		case_insensitive;
11527c478bd9Sstevel@tonic-gate 	bool		case_preserving;
11537c478bd9Sstevel@tonic-gate };
11547c478bd9Sstevel@tonic-gate 
11557c478bd9Sstevel@tonic-gate struct PATHCONF3resfail {
11567c478bd9Sstevel@tonic-gate 	post_op_attr	obj_attributes;
11577c478bd9Sstevel@tonic-gate };
11587c478bd9Sstevel@tonic-gate 
11597c478bd9Sstevel@tonic-gate union PATHCONF3res switch (nfsstat3 status) {
11607c478bd9Sstevel@tonic-gate case NFS3_OK:
11617c478bd9Sstevel@tonic-gate 	PATHCONF3resok	 resok;
11627c478bd9Sstevel@tonic-gate default:
11637c478bd9Sstevel@tonic-gate 	PATHCONF3resfail resfail;
11647c478bd9Sstevel@tonic-gate };
11657c478bd9Sstevel@tonic-gate 
11667c478bd9Sstevel@tonic-gate /*
11677c478bd9Sstevel@tonic-gate  * COMMIT: Commit cached data on a server to stable storage
11687c478bd9Sstevel@tonic-gate  */
11697c478bd9Sstevel@tonic-gate struct COMMIT3args {
11707c478bd9Sstevel@tonic-gate 	nfs_fh3	file;
11717c478bd9Sstevel@tonic-gate 	offset3	offset;
11727c478bd9Sstevel@tonic-gate 	count3	count;
11737c478bd9Sstevel@tonic-gate };
11747c478bd9Sstevel@tonic-gate 
11757c478bd9Sstevel@tonic-gate struct COMMIT3resok {
11767c478bd9Sstevel@tonic-gate 	wcc_data	file_wcc;
11777c478bd9Sstevel@tonic-gate 	writeverf3	verf;
11787c478bd9Sstevel@tonic-gate };
11797c478bd9Sstevel@tonic-gate 
11807c478bd9Sstevel@tonic-gate struct COMMIT3resfail {
11817c478bd9Sstevel@tonic-gate 	wcc_data	file_wcc;
11827c478bd9Sstevel@tonic-gate };
11837c478bd9Sstevel@tonic-gate 
11847c478bd9Sstevel@tonic-gate union COMMIT3res switch (nfsstat3 status) {
11857c478bd9Sstevel@tonic-gate case NFS3_OK:
11867c478bd9Sstevel@tonic-gate 	COMMIT3resok	resok;
11877c478bd9Sstevel@tonic-gate default:
11887c478bd9Sstevel@tonic-gate 	COMMIT3resfail	resfail;
11897c478bd9Sstevel@tonic-gate };
11907c478bd9Sstevel@tonic-gate 
11917c478bd9Sstevel@tonic-gate /*
11927c478bd9Sstevel@tonic-gate  * Remote file service routines
11937c478bd9Sstevel@tonic-gate  */
11947c478bd9Sstevel@tonic-gate program NFS3_PROGRAM {
11957c478bd9Sstevel@tonic-gate 	version NFS_V3 {
1196*e13f9236SToomas Soome 		void
11977c478bd9Sstevel@tonic-gate 		NFSPROC3_NULL(void) = 0;
11987c478bd9Sstevel@tonic-gate 
1199*e13f9236SToomas Soome 		GETATTR3res
12007c478bd9Sstevel@tonic-gate 		NFSPROC3_GETATTR(GETATTR3args) = 1;
12017c478bd9Sstevel@tonic-gate 
1202*e13f9236SToomas Soome 		SETATTR3res
12037c478bd9Sstevel@tonic-gate 		NFSPROC3_SETATTR(SETATTR3args) = 2;
12047c478bd9Sstevel@tonic-gate 
1205*e13f9236SToomas Soome 		LOOKUP3res
12067c478bd9Sstevel@tonic-gate 		NFSPROC3_LOOKUP(LOOKUP3args) = 3;
12077c478bd9Sstevel@tonic-gate 
1208*e13f9236SToomas Soome 		ACCESS3res
12097c478bd9Sstevel@tonic-gate 		NFSPROC3_ACCESS(ACCESS3args) = 4;
12107c478bd9Sstevel@tonic-gate 
1211*e13f9236SToomas Soome 		READLINK3res
12127c478bd9Sstevel@tonic-gate 		NFSPROC3_READLINK(READLINK3args) = 5;
12137c478bd9Sstevel@tonic-gate 
1214*e13f9236SToomas Soome 		READ3res
12157c478bd9Sstevel@tonic-gate 		NFSPROC3_READ(READ3args) = 6;
12167c478bd9Sstevel@tonic-gate 
1217*e13f9236SToomas Soome 		WRITE3res
12187c478bd9Sstevel@tonic-gate 		NFSPROC3_WRITE(WRITE3args) = 7;
12197c478bd9Sstevel@tonic-gate 
1220*e13f9236SToomas Soome 		CREATE3res
12217c478bd9Sstevel@tonic-gate 		NFSPROC3_CREATE(CREATE3args) = 8;
12227c478bd9Sstevel@tonic-gate 
12237c478bd9Sstevel@tonic-gate 		MKDIR3res
12247c478bd9Sstevel@tonic-gate 		NFSPROC3_MKDIR(MKDIR3args) = 9;
12257c478bd9Sstevel@tonic-gate 
1226*e13f9236SToomas Soome 		SYMLINK3res
12277c478bd9Sstevel@tonic-gate 		NFSPROC3_SYMLINK(SYMLINK3args) = 10;
12287c478bd9Sstevel@tonic-gate 
12297c478bd9Sstevel@tonic-gate 		MKNOD3res
12307c478bd9Sstevel@tonic-gate 		NFSPROC3_MKNOD(MKNOD3args) = 11;
12317c478bd9Sstevel@tonic-gate 
1232*e13f9236SToomas Soome 		REMOVE3res
12337c478bd9Sstevel@tonic-gate 		NFSPROC3_REMOVE(REMOVE3args) = 12;
12347c478bd9Sstevel@tonic-gate 
1235*e13f9236SToomas Soome 		RMDIR3res
12367c478bd9Sstevel@tonic-gate 		NFSPROC3_RMDIR(RMDIR3args) = 13;
12377c478bd9Sstevel@tonic-gate 
1238*e13f9236SToomas Soome 		RENAME3res
12397c478bd9Sstevel@tonic-gate 		NFSPROC3_RENAME(RENAME3args) = 14;
12407c478bd9Sstevel@tonic-gate 
1241*e13f9236SToomas Soome 		LINK3res
12427c478bd9Sstevel@tonic-gate 		NFSPROC3_LINK(LINK3args) = 15;
12437c478bd9Sstevel@tonic-gate 
1244*e13f9236SToomas Soome 		READDIR3res
12457c478bd9Sstevel@tonic-gate 		NFSPROC3_READDIR(READDIR3args) = 16;
12467c478bd9Sstevel@tonic-gate 
1247*e13f9236SToomas Soome 		READDIRPLUS3res
12487c478bd9Sstevel@tonic-gate 		NFSPROC3_READDIRPLUS(READDIRPLUS3args) = 17;
12497c478bd9Sstevel@tonic-gate 
12507c478bd9Sstevel@tonic-gate 		FSSTAT3res
12517c478bd9Sstevel@tonic-gate 		NFSPROC3_FSSTAT(FSSTAT3args) = 18;
12527c478bd9Sstevel@tonic-gate 
12537c478bd9Sstevel@tonic-gate 		FSINFO3res
12547c478bd9Sstevel@tonic-gate 		NFSPROC3_FSINFO(FSINFO3args) = 19;
12557c478bd9Sstevel@tonic-gate 
12567c478bd9Sstevel@tonic-gate 		PATHCONF3res
12577c478bd9Sstevel@tonic-gate 		NFSPROC3_PATHCONF(PATHCONF3args) = 20;
12587c478bd9Sstevel@tonic-gate 
12597c478bd9Sstevel@tonic-gate 		COMMIT3res
12607c478bd9Sstevel@tonic-gate 		NFSPROC3_COMMIT(COMMIT3args) = 21;
12617c478bd9Sstevel@tonic-gate 	} = 3;
12627c478bd9Sstevel@tonic-gate } = 100003;
1263