xref: /titanic_44/usr/src/head/rpcsvc/nfs4_prot.x (revision 2f172c55ef76964744bc62b4500ece87f3089b4d)
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
5*2f172c55SRobert Thurlow  * Common Development and Distribution License (the "License").
6*2f172c55SRobert Thurlow  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
227c478bd9Sstevel@tonic-gate  *  Copyright (C) The Internet Society (1998-2003).
237c478bd9Sstevel@tonic-gate  *  All Rights Reserved.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate  *	nfs4_prot.x
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * Basic typedefs for RFC 1832 data type definitions
327c478bd9Sstevel@tonic-gate  */
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * typedef int		int32_t;
367c478bd9Sstevel@tonic-gate  * typedef unsigned int	uint32_t;
377c478bd9Sstevel@tonic-gate  * typedef hyper		int64_t;
387c478bd9Sstevel@tonic-gate  * typedef unsigned hyper	uint64_t;
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate /*
427c478bd9Sstevel@tonic-gate  * Sizes
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate const NFS4_FHSIZE		= 128;
457c478bd9Sstevel@tonic-gate const NFS4_VERIFIER_SIZE	= 8;
467c478bd9Sstevel@tonic-gate const NFS4_OPAQUE_LIMIT		= 1024;
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * File types
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate enum nfs_ftype4 {
527c478bd9Sstevel@tonic-gate 	NF4REG		= 1,	/* Regular File */
537c478bd9Sstevel@tonic-gate 	NF4DIR		= 2,	/* Directory */
547c478bd9Sstevel@tonic-gate 	NF4BLK		= 3,	/* Special File - block device */
557c478bd9Sstevel@tonic-gate 	NF4CHR		= 4,	/* Special File - character device */
567c478bd9Sstevel@tonic-gate 	NF4LNK		= 5,	/* Symbolic Link */
577c478bd9Sstevel@tonic-gate 	NF4SOCK		= 6,	/* Special File - socket */
587c478bd9Sstevel@tonic-gate 	NF4FIFO		= 7,	/* Special File - fifo */
597c478bd9Sstevel@tonic-gate 	NF4ATTRDIR	= 8,	/* Attribute Directory */
607c478bd9Sstevel@tonic-gate 	NF4NAMEDATTR	= 9	/* Named Attribute */
617c478bd9Sstevel@tonic-gate };
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * Error status
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate enum nfsstat4 {
677c478bd9Sstevel@tonic-gate 	NFS4_OK			= 0,    /* everything is okay      */
687c478bd9Sstevel@tonic-gate 	NFS4ERR_PERM		= 1,    /* caller not privileged   */
697c478bd9Sstevel@tonic-gate 	NFS4ERR_NOENT		= 2,    /* no such file/directory  */
707c478bd9Sstevel@tonic-gate 	NFS4ERR_IO		= 5,    /* hard I/O error          */
717c478bd9Sstevel@tonic-gate 	NFS4ERR_NXIO		= 6,    /* no such device          */
727c478bd9Sstevel@tonic-gate 	NFS4ERR_ACCESS		= 13,   /* access denied           */
737c478bd9Sstevel@tonic-gate 	NFS4ERR_EXIST		= 17,   /* file already exists     */
747c478bd9Sstevel@tonic-gate 	NFS4ERR_XDEV		= 18,   /* different filesystems   */
757c478bd9Sstevel@tonic-gate 	/* Unused/reserved        19 */
767c478bd9Sstevel@tonic-gate 	NFS4ERR_NOTDIR		= 20,   /* should be a directory   */
777c478bd9Sstevel@tonic-gate 	NFS4ERR_ISDIR		= 21,   /* should not be directory */
787c478bd9Sstevel@tonic-gate 	NFS4ERR_INVAL		= 22,   /* invalid argument        */
797c478bd9Sstevel@tonic-gate 	NFS4ERR_FBIG		= 27,   /* file exceeds server max */
807c478bd9Sstevel@tonic-gate 	NFS4ERR_NOSPC		= 28,   /* no space on filesystem  */
817c478bd9Sstevel@tonic-gate 	NFS4ERR_ROFS		= 30,   /* read-only filesystem    */
827c478bd9Sstevel@tonic-gate 	NFS4ERR_MLINK		= 31,   /* too many hard links     */
837c478bd9Sstevel@tonic-gate 	NFS4ERR_NAMETOOLONG	= 63,   /* name exceeds server max */
847c478bd9Sstevel@tonic-gate 	NFS4ERR_NOTEMPTY	= 66,   /* directory not empty     */
857c478bd9Sstevel@tonic-gate 	NFS4ERR_DQUOT		= 69,   /* hard quota limit reached*/
867c478bd9Sstevel@tonic-gate 	NFS4ERR_STALE		= 70,   /* file no longer exists   */
877c478bd9Sstevel@tonic-gate 	NFS4ERR_BADHANDLE	= 10001,/* Illegal filehandle      */
887c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_COOKIE	= 10003,/* READDIR cookie is stale */
897c478bd9Sstevel@tonic-gate 	NFS4ERR_NOTSUPP		= 10004,/* operation not supported */
907c478bd9Sstevel@tonic-gate 	NFS4ERR_TOOSMALL	= 10005,/* response limit exceeded */
917c478bd9Sstevel@tonic-gate 	NFS4ERR_SERVERFAULT	= 10006,/* undefined server error  */
927c478bd9Sstevel@tonic-gate 	NFS4ERR_BADTYPE		= 10007,/* type invalid for CREATE */
937c478bd9Sstevel@tonic-gate 	NFS4ERR_DELAY		= 10008,/* file "busy" - retry     */
947c478bd9Sstevel@tonic-gate 	NFS4ERR_SAME		= 10009,/* nverify says attrs same */
957c478bd9Sstevel@tonic-gate 	NFS4ERR_DENIED		= 10010,/* lock unavailable	   */
967c478bd9Sstevel@tonic-gate 	NFS4ERR_EXPIRED		= 10011,/* lock lease expired	   */
977c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCKED		= 10012,/* I/O failed due to lock  */
987c478bd9Sstevel@tonic-gate 	NFS4ERR_GRACE		= 10013,/* in grace period	   */
997c478bd9Sstevel@tonic-gate 	NFS4ERR_FHEXPIRED	= 10014,/* filehandle expired	   */
1007c478bd9Sstevel@tonic-gate 	NFS4ERR_SHARE_DENIED	= 10015,/* share reserve denied	   */
1017c478bd9Sstevel@tonic-gate 	NFS4ERR_WRONGSEC	= 10016,/* wrong security flavor   */
1027c478bd9Sstevel@tonic-gate 	NFS4ERR_CLID_INUSE	= 10017,/* clientid in use	   */
1037c478bd9Sstevel@tonic-gate 	NFS4ERR_RESOURCE	= 10018,/* resource exhaustion	   */
1047c478bd9Sstevel@tonic-gate 	NFS4ERR_MOVED		= 10019,/* filesystem relocated	   */
1057c478bd9Sstevel@tonic-gate 	NFS4ERR_NOFILEHANDLE	= 10020,/* current FH is not set   */
1067c478bd9Sstevel@tonic-gate 	NFS4ERR_MINOR_VERS_MISMATCH = 10021,/* minor vers not supp */
1077c478bd9Sstevel@tonic-gate 	NFS4ERR_STALE_CLIENTID	= 10022,/* server has rebooted     */
1087c478bd9Sstevel@tonic-gate 	NFS4ERR_STALE_STATEID	= 10023,/* server has rebooted     */
1097c478bd9Sstevel@tonic-gate 	NFS4ERR_OLD_STATEID	= 10024,/* state is out of sync    */
1107c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_STATEID	= 10025,/* incorrect stateid       */
1117c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_SEQID	= 10026,/* request is out of seq.  */
1127c478bd9Sstevel@tonic-gate 	NFS4ERR_NOT_SAME	= 10027,/* verify - attrs not same */
1137c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCK_RANGE	= 10028,/* lock range not supported*/
1147c478bd9Sstevel@tonic-gate 	NFS4ERR_SYMLINK		= 10029,/* should be file/directory*/
1157c478bd9Sstevel@tonic-gate 	NFS4ERR_RESTOREFH	= 10030,/* no saved filehandle     */
1167c478bd9Sstevel@tonic-gate 	NFS4ERR_LEASE_MOVED	= 10031,/* some filesystem moved   */
1177c478bd9Sstevel@tonic-gate 	NFS4ERR_ATTRNOTSUPP	= 10032,/* recommended attr not sup*/
1187c478bd9Sstevel@tonic-gate 	NFS4ERR_NO_GRACE	= 10033,/* reclaim outside of grace*/
1197c478bd9Sstevel@tonic-gate 	NFS4ERR_RECLAIM_BAD	= 10034,/* reclaim error at server */
1207c478bd9Sstevel@tonic-gate 	NFS4ERR_RECLAIM_CONFLICT = 10035,/* conflict on reclaim    */
1217c478bd9Sstevel@tonic-gate 	NFS4ERR_BADXDR		= 10036,/* XDR decode failed       */
1227c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCKS_HELD	= 10037,/* file locks held at CLOSE*/
1237c478bd9Sstevel@tonic-gate 	NFS4ERR_OPENMODE	= 10038,/* conflict in OPEN and I/O*/
1247c478bd9Sstevel@tonic-gate 	NFS4ERR_BADOWNER	= 10039,/* owner translation bad   */
1257c478bd9Sstevel@tonic-gate 	NFS4ERR_BADCHAR		= 10040,/* utf-8 char not supported*/
1267c478bd9Sstevel@tonic-gate 	NFS4ERR_BADNAME		= 10041,/* name not supported      */
1277c478bd9Sstevel@tonic-gate 	NFS4ERR_BAD_RANGE	= 10042,/* lock range not supported*/
1287c478bd9Sstevel@tonic-gate 	NFS4ERR_LOCK_NOTSUPP	= 10043,/* no atomic up/downgrade  */
1297c478bd9Sstevel@tonic-gate 	NFS4ERR_OP_ILLEGAL	= 10044,/* undefined operation     */
1307c478bd9Sstevel@tonic-gate 	NFS4ERR_DEADLOCK	= 10045,/* file locking deadlock   */
1317c478bd9Sstevel@tonic-gate 	NFS4ERR_FILE_OPEN	= 10046,/* open file blocks op.    */
1327c478bd9Sstevel@tonic-gate 	NFS4ERR_ADMIN_REVOKED	= 10047,/* lockowner state revoked */
1337c478bd9Sstevel@tonic-gate 	NFS4ERR_CB_PATH_DOWN    = 10048 /* callback path down      */
1347c478bd9Sstevel@tonic-gate };
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate /*
1377c478bd9Sstevel@tonic-gate  * Basic data types
1387c478bd9Sstevel@tonic-gate  */
1397c478bd9Sstevel@tonic-gate typedef uint32_t	bitmap4<>;
1407c478bd9Sstevel@tonic-gate typedef uint64_t	offset4;
1417c478bd9Sstevel@tonic-gate typedef uint32_t	count4;
1427c478bd9Sstevel@tonic-gate typedef	uint64_t	length4;
1437c478bd9Sstevel@tonic-gate typedef uint64_t	clientid4;
1447c478bd9Sstevel@tonic-gate typedef uint32_t	seqid4;
1457c478bd9Sstevel@tonic-gate typedef opaque		utf8string<>;
1467c478bd9Sstevel@tonic-gate typedef utf8string	utf8str_cis;
1477c478bd9Sstevel@tonic-gate typedef utf8string	utf8str_cs;
1487c478bd9Sstevel@tonic-gate typedef utf8string	utf8str_mixed;
1497c478bd9Sstevel@tonic-gate typedef utf8str_cs	component4;
1507c478bd9Sstevel@tonic-gate typedef	component4	pathname4<>;
1517c478bd9Sstevel@tonic-gate typedef uint64_t	nfs_lockid4;
1527c478bd9Sstevel@tonic-gate typedef	uint64_t	nfs_cookie4;
1537c478bd9Sstevel@tonic-gate typedef	utf8str_cs	linktext4;
1547c478bd9Sstevel@tonic-gate typedef opaque		sec_oid4<>;
1557c478bd9Sstevel@tonic-gate typedef uint32_t	qop4;
1567c478bd9Sstevel@tonic-gate typedef	uint32_t	mode4;
1577c478bd9Sstevel@tonic-gate typedef	uint64_t	changeid4;
1587c478bd9Sstevel@tonic-gate typedef opaque		verifier4[NFS4_VERIFIER_SIZE];
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate /*
1617c478bd9Sstevel@tonic-gate  * Timeval
1627c478bd9Sstevel@tonic-gate  */
1637c478bd9Sstevel@tonic-gate struct nfstime4 {
1647c478bd9Sstevel@tonic-gate 	int64_t		seconds;
1657c478bd9Sstevel@tonic-gate 	uint32_t	nseconds;
1667c478bd9Sstevel@tonic-gate };
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate enum time_how4 {
1697c478bd9Sstevel@tonic-gate 	SET_TO_SERVER_TIME4 = 0,
1707c478bd9Sstevel@tonic-gate 	SET_TO_CLIENT_TIME4 = 1
1717c478bd9Sstevel@tonic-gate };
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate union settime4 switch (time_how4 set_it) {
1747c478bd9Sstevel@tonic-gate  case SET_TO_CLIENT_TIME4:
1757c478bd9Sstevel@tonic-gate 	 nfstime4	time;
1767c478bd9Sstevel@tonic-gate  default:
1777c478bd9Sstevel@tonic-gate 	 void;
1787c478bd9Sstevel@tonic-gate };
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate /*
1817c478bd9Sstevel@tonic-gate  * File access handle
1827c478bd9Sstevel@tonic-gate  */
1837c478bd9Sstevel@tonic-gate typedef	opaque	nfs_fh4<NFS4_FHSIZE>;
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate  * File attribute definitions
1887c478bd9Sstevel@tonic-gate  */
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate /*
1917c478bd9Sstevel@tonic-gate  * FSID structure for major/minor
1927c478bd9Sstevel@tonic-gate  */
1937c478bd9Sstevel@tonic-gate struct fsid4 {
1947c478bd9Sstevel@tonic-gate 	uint64_t	major;
1957c478bd9Sstevel@tonic-gate 	uint64_t	minor;
1967c478bd9Sstevel@tonic-gate };
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate /*
1997c478bd9Sstevel@tonic-gate  * Filesystem locations attribute for relocation/migration
2007c478bd9Sstevel@tonic-gate  */
2017c478bd9Sstevel@tonic-gate struct fs_location4 {
2027c478bd9Sstevel@tonic-gate 	utf8str_cis	server<>;
2037c478bd9Sstevel@tonic-gate 	pathname4	rootpath;
2047c478bd9Sstevel@tonic-gate };
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate struct fs_locations4 {
2077c478bd9Sstevel@tonic-gate 	pathname4	fs_root;
2087c478bd9Sstevel@tonic-gate 	fs_location4	locations<>;
2097c478bd9Sstevel@tonic-gate };
2107c478bd9Sstevel@tonic-gate 
211*2f172c55SRobert Thurlow struct nfs_fsl_info {
212*2f172c55SRobert Thurlow 	uint_t			netbuf_len;
213*2f172c55SRobert Thurlow 	uint_t			netnm_len;
214*2f172c55SRobert Thurlow 	uint_t			knconf_len;
215*2f172c55SRobert Thurlow 	string			netname<MAXNETNAMELEN>;
216*2f172c55SRobert Thurlow 	struct netbuf		*addr;
217*2f172c55SRobert Thurlow 	struct knetconfig	*knconf;
218*2f172c55SRobert Thurlow };
219*2f172c55SRobert Thurlow 
220*2f172c55SRobert Thurlow 
2217c478bd9Sstevel@tonic-gate /*
2227c478bd9Sstevel@tonic-gate  * Various Access Control Entry definitions
2237c478bd9Sstevel@tonic-gate  */
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate /*
2267c478bd9Sstevel@tonic-gate  * Mask that indicates which Access Control Entries are supported.
2277c478bd9Sstevel@tonic-gate  * Values for the fattr4_aclsupport attribute.
2287c478bd9Sstevel@tonic-gate  */
2297c478bd9Sstevel@tonic-gate const ACL4_SUPPORT_ALLOW_ACL	= 0x00000001;
2307c478bd9Sstevel@tonic-gate const ACL4_SUPPORT_DENY_ACL	= 0x00000002;
2317c478bd9Sstevel@tonic-gate const ACL4_SUPPORT_AUDIT_ACL	= 0x00000004;
2327c478bd9Sstevel@tonic-gate const ACL4_SUPPORT_ALARM_ACL	= 0x00000008;
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate 
2357c478bd9Sstevel@tonic-gate typedef	uint32_t	acetype4;
2367c478bd9Sstevel@tonic-gate 
2377c478bd9Sstevel@tonic-gate /*
2387c478bd9Sstevel@tonic-gate  * acetype4 values, others can be added as needed.
2397c478bd9Sstevel@tonic-gate  */
2407c478bd9Sstevel@tonic-gate const ACE4_ACCESS_ALLOWED_ACE_TYPE	= 0x00000000;
2417c478bd9Sstevel@tonic-gate const ACE4_ACCESS_DENIED_ACE_TYPE	= 0x00000001;
2427c478bd9Sstevel@tonic-gate const ACE4_SYSTEM_AUDIT_ACE_TYPE	= 0x00000002;
2437c478bd9Sstevel@tonic-gate const ACE4_SYSTEM_ALARM_ACE_TYPE	= 0x00000003;
2447c478bd9Sstevel@tonic-gate 
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate /*
2477c478bd9Sstevel@tonic-gate  * ACE flag
2487c478bd9Sstevel@tonic-gate  */
2497c478bd9Sstevel@tonic-gate typedef uint32_t aceflag4;
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate /*
2527c478bd9Sstevel@tonic-gate  * ACE flag values
2537c478bd9Sstevel@tonic-gate  */
2547c478bd9Sstevel@tonic-gate const ACE4_FILE_INHERIT_ACE		= 0x00000001;
2557c478bd9Sstevel@tonic-gate const ACE4_DIRECTORY_INHERIT_ACE	= 0x00000002;
2567c478bd9Sstevel@tonic-gate const ACE4_NO_PROPAGATE_INHERIT_ACE	= 0x00000004;
2577c478bd9Sstevel@tonic-gate const ACE4_INHERIT_ONLY_ACE		= 0x00000008;
2587c478bd9Sstevel@tonic-gate const ACE4_SUCCESSFUL_ACCESS_ACE_FLAG	= 0x00000010;
2597c478bd9Sstevel@tonic-gate const ACE4_FAILED_ACCESS_ACE_FLAG	= 0x00000020;
2607c478bd9Sstevel@tonic-gate const ACE4_IDENTIFIER_GROUP		= 0x00000040;
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate /*
2647c478bd9Sstevel@tonic-gate  * ACE mask
2657c478bd9Sstevel@tonic-gate  */
2667c478bd9Sstevel@tonic-gate typedef uint32_t	acemask4;
2677c478bd9Sstevel@tonic-gate 
2687c478bd9Sstevel@tonic-gate /*
2697c478bd9Sstevel@tonic-gate  * ACE mask values
2707c478bd9Sstevel@tonic-gate  */
2717c478bd9Sstevel@tonic-gate const ACE4_READ_DATA		= 0x00000001;
2727c478bd9Sstevel@tonic-gate const ACE4_LIST_DIRECTORY	= 0x00000001;
2737c478bd9Sstevel@tonic-gate const ACE4_WRITE_DATA		= 0x00000002;
2747c478bd9Sstevel@tonic-gate const ACE4_ADD_FILE		= 0x00000002;
2757c478bd9Sstevel@tonic-gate const ACE4_APPEND_DATA		= 0x00000004;
2767c478bd9Sstevel@tonic-gate const ACE4_ADD_SUBDIRECTORY	= 0x00000004;
2777c478bd9Sstevel@tonic-gate const ACE4_READ_NAMED_ATTRS	= 0x00000008;
2787c478bd9Sstevel@tonic-gate const ACE4_WRITE_NAMED_ATTRS	= 0x00000010;
2797c478bd9Sstevel@tonic-gate const ACE4_EXECUTE		= 0x00000020;
2807c478bd9Sstevel@tonic-gate const ACE4_DELETE_CHILD		= 0x00000040;
2817c478bd9Sstevel@tonic-gate const ACE4_READ_ATTRIBUTES	= 0x00000080;
2827c478bd9Sstevel@tonic-gate const ACE4_WRITE_ATTRIBUTES	= 0x00000100;
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate const ACE4_DELETE		= 0x00010000;
2857c478bd9Sstevel@tonic-gate const ACE4_READ_ACL		= 0x00020000;
2867c478bd9Sstevel@tonic-gate const ACE4_WRITE_ACL		= 0x00040000;
2877c478bd9Sstevel@tonic-gate const ACE4_WRITE_OWNER		= 0x00080000;
2887c478bd9Sstevel@tonic-gate const ACE4_SYNCHRONIZE		= 0x00100000;
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate /*
2917c478bd9Sstevel@tonic-gate  * ACE4_GENERIC_READ -- defined as combination of
2927c478bd9Sstevel@tonic-gate  *	ACE4_READ_ACL |
2937c478bd9Sstevel@tonic-gate  *	ACE4_READ_DATA |
2947c478bd9Sstevel@tonic-gate  *	ACE4_READ_ATTRIBUTES |
2957c478bd9Sstevel@tonic-gate  *	ACE4_SYNCHRONIZE
2967c478bd9Sstevel@tonic-gate  */
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate const ACE4_GENERIC_READ	= 0x00120081;
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate /*
3017c478bd9Sstevel@tonic-gate  * ACE4_GENERIC_WRITE -- defined as combination of
3027c478bd9Sstevel@tonic-gate  *	ACE4_READ_ACL |
3037c478bd9Sstevel@tonic-gate  *	ACE4_WRITE_DATA |
3047c478bd9Sstevel@tonic-gate  *	ACE4_WRITE_ATTRIBUTES |
3057c478bd9Sstevel@tonic-gate  *	ACE4_WRITE_ACL |
3067c478bd9Sstevel@tonic-gate  *	ACE4_APPEND_DATA |
3077c478bd9Sstevel@tonic-gate  *	ACE4_SYNCHRONIZE
3087c478bd9Sstevel@tonic-gate  */
3097c478bd9Sstevel@tonic-gate const ACE4_GENERIC_WRITE = 0x00160106;
3107c478bd9Sstevel@tonic-gate 
3117c478bd9Sstevel@tonic-gate 
3127c478bd9Sstevel@tonic-gate /*
3137c478bd9Sstevel@tonic-gate  * ACE4_GENERIC_EXECUTE -- defined as combination of
3147c478bd9Sstevel@tonic-gate  *	ACE4_READ_ACL
3157c478bd9Sstevel@tonic-gate  *	ACE4_READ_ATTRIBUTES
3167c478bd9Sstevel@tonic-gate  *	ACE4_EXECUTE
3177c478bd9Sstevel@tonic-gate  *	ACE4_SYNCHRONIZE
3187c478bd9Sstevel@tonic-gate  */
3197c478bd9Sstevel@tonic-gate const ACE4_GENERIC_EXECUTE = 0x001200A0;
3207c478bd9Sstevel@tonic-gate 
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate /*
3237c478bd9Sstevel@tonic-gate  * Access Control Entry definition
3247c478bd9Sstevel@tonic-gate  */
3257c478bd9Sstevel@tonic-gate struct nfsace4 {
3267c478bd9Sstevel@tonic-gate 	acetype4	type;
3277c478bd9Sstevel@tonic-gate 	aceflag4	flag;
3287c478bd9Sstevel@tonic-gate 	acemask4	access_mask;
3297c478bd9Sstevel@tonic-gate 	utf8str_mixed	who;
3307c478bd9Sstevel@tonic-gate };
3317c478bd9Sstevel@tonic-gate 
3327c478bd9Sstevel@tonic-gate /*
3337c478bd9Sstevel@tonic-gate  * Field definitions for the fattr4_mode attribute
3347c478bd9Sstevel@tonic-gate  */
3357c478bd9Sstevel@tonic-gate const MODE4_SUID = 0x800;  /* set user id on execution */
3367c478bd9Sstevel@tonic-gate const MODE4_SGID = 0x400;  /* set group id on execution */
3377c478bd9Sstevel@tonic-gate const MODE4_SVTX = 0x200;  /* save text even after use */
3387c478bd9Sstevel@tonic-gate const MODE4_RUSR = 0x100;  /* read permission: owner */
3397c478bd9Sstevel@tonic-gate const MODE4_WUSR = 0x080;  /* write permission: owner */
3407c478bd9Sstevel@tonic-gate const MODE4_XUSR = 0x040;  /* execute permission: owner */
3417c478bd9Sstevel@tonic-gate const MODE4_RGRP = 0x020;  /* read permission: group */
3427c478bd9Sstevel@tonic-gate const MODE4_WGRP = 0x010;  /* write permission: group */
3437c478bd9Sstevel@tonic-gate const MODE4_XGRP = 0x008;  /* execute permission: group */
3447c478bd9Sstevel@tonic-gate const MODE4_ROTH = 0x004;  /* read permission: other */
3457c478bd9Sstevel@tonic-gate const MODE4_WOTH = 0x002;  /* write permission: other */
3467c478bd9Sstevel@tonic-gate const MODE4_XOTH = 0x001;  /* execute permission: other */
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate /*
3497c478bd9Sstevel@tonic-gate  * Special data/attribute associated with
3507c478bd9Sstevel@tonic-gate  * file types NF4BLK and NF4CHR.
3517c478bd9Sstevel@tonic-gate  */
3527c478bd9Sstevel@tonic-gate struct specdata4 {
3537c478bd9Sstevel@tonic-gate 	uint32_t	specdata1;	/* major device number */
3547c478bd9Sstevel@tonic-gate 	uint32_t	specdata2;	/* minor device number */
3557c478bd9Sstevel@tonic-gate };
3567c478bd9Sstevel@tonic-gate 
3577c478bd9Sstevel@tonic-gate /*
3587c478bd9Sstevel@tonic-gate  * Values for fattr4_fh_expire_type
3597c478bd9Sstevel@tonic-gate  */
3607c478bd9Sstevel@tonic-gate const	FH4_PERSISTENT		= 0x00000000;
3617c478bd9Sstevel@tonic-gate const	FH4_NOEXPIRE_WITH_OPEN	= 0x00000001;
3627c478bd9Sstevel@tonic-gate const	FH4_VOLATILE_ANY	= 0x00000002;
3637c478bd9Sstevel@tonic-gate const	FH4_VOL_MIGRATION	= 0x00000004;
3647c478bd9Sstevel@tonic-gate const	FH4_VOL_RENAME		= 0x00000008;
3657c478bd9Sstevel@tonic-gate 
3667c478bd9Sstevel@tonic-gate 
3677c478bd9Sstevel@tonic-gate typedef bitmap4		fattr4_supported_attrs;
3687c478bd9Sstevel@tonic-gate typedef nfs_ftype4	fattr4_type;
3697c478bd9Sstevel@tonic-gate typedef	uint32_t	fattr4_fh_expire_type;
3707c478bd9Sstevel@tonic-gate typedef	changeid4	fattr4_change;
3717c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_size;
3727c478bd9Sstevel@tonic-gate typedef	bool		fattr4_link_support;
3737c478bd9Sstevel@tonic-gate typedef	bool		fattr4_symlink_support;
3747c478bd9Sstevel@tonic-gate typedef bool		fattr4_named_attr;
3757c478bd9Sstevel@tonic-gate typedef fsid4		fattr4_fsid;
3767c478bd9Sstevel@tonic-gate typedef	bool		fattr4_unique_handles;
3777c478bd9Sstevel@tonic-gate typedef uint32_t	fattr4_lease_time;
3787c478bd9Sstevel@tonic-gate typedef	nfsstat4	fattr4_rdattr_error;
3797c478bd9Sstevel@tonic-gate 
3807c478bd9Sstevel@tonic-gate typedef nfsace4		fattr4_acl<>;
3817c478bd9Sstevel@tonic-gate typedef uint32_t	fattr4_aclsupport;
3827c478bd9Sstevel@tonic-gate typedef	bool		fattr4_archive;
3837c478bd9Sstevel@tonic-gate typedef	bool		fattr4_cansettime;
3847c478bd9Sstevel@tonic-gate typedef	bool		fattr4_case_insensitive;
3857c478bd9Sstevel@tonic-gate typedef	bool		fattr4_case_preserving;
3867c478bd9Sstevel@tonic-gate typedef	bool		fattr4_chown_restricted;
3877c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_fileid;
3887c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_files_avail;
3897c478bd9Sstevel@tonic-gate typedef nfs_fh4		fattr4_filehandle;
3907c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_files_free;
3917c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_files_total;
3927c478bd9Sstevel@tonic-gate typedef fs_locations4	fattr4_fs_locations;
3937c478bd9Sstevel@tonic-gate typedef bool		fattr4_hidden;
3947c478bd9Sstevel@tonic-gate typedef bool		fattr4_homogeneous;
3957c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_maxfilesize;
3967c478bd9Sstevel@tonic-gate typedef uint32_t	fattr4_maxlink;
3977c478bd9Sstevel@tonic-gate typedef uint32_t	fattr4_maxname;
3987c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_maxread;
3997c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_maxwrite;
4007c478bd9Sstevel@tonic-gate typedef	utf8str_cs	fattr4_mimetype;
4017c478bd9Sstevel@tonic-gate typedef mode4		fattr4_mode;
4027c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_mounted_on_fileid;
4037c478bd9Sstevel@tonic-gate typedef	bool		fattr4_no_trunc;
4047c478bd9Sstevel@tonic-gate typedef	uint32_t	fattr4_numlinks;
4057c478bd9Sstevel@tonic-gate typedef	utf8str_mixed	fattr4_owner;
4067c478bd9Sstevel@tonic-gate typedef	utf8str_mixed	fattr4_owner_group;
4077c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_quota_avail_hard;
4087c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_quota_avail_soft;
4097c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_quota_used;
4107c478bd9Sstevel@tonic-gate typedef specdata4	fattr4_rawdev;
4117c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_space_avail;
4127c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_space_free;
4137c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_space_total;
4147c478bd9Sstevel@tonic-gate typedef uint64_t	fattr4_space_used;
4157c478bd9Sstevel@tonic-gate typedef bool		fattr4_system;
4167c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_access;
4177c478bd9Sstevel@tonic-gate typedef settime4	fattr4_time_access_set;
4187c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_backup;
4197c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_create;
4207c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_delta;
4217c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_metadata;
4227c478bd9Sstevel@tonic-gate typedef nfstime4	fattr4_time_modify;
4237c478bd9Sstevel@tonic-gate typedef settime4	fattr4_time_modify_set;
4247c478bd9Sstevel@tonic-gate 
4257c478bd9Sstevel@tonic-gate 
4267c478bd9Sstevel@tonic-gate /*
4277c478bd9Sstevel@tonic-gate  * Mandatory Attributes
4287c478bd9Sstevel@tonic-gate  */
4297c478bd9Sstevel@tonic-gate const FATTR4_SUPPORTED_ATTRS	= 0;
4307c478bd9Sstevel@tonic-gate const FATTR4_TYPE		= 1;
4317c478bd9Sstevel@tonic-gate const FATTR4_FH_EXPIRE_TYPE	= 2;
4327c478bd9Sstevel@tonic-gate const FATTR4_CHANGE		= 3;
4337c478bd9Sstevel@tonic-gate const FATTR4_SIZE		= 4;
4347c478bd9Sstevel@tonic-gate const FATTR4_LINK_SUPPORT	= 5;
4357c478bd9Sstevel@tonic-gate const FATTR4_SYMLINK_SUPPORT	= 6;
4367c478bd9Sstevel@tonic-gate const FATTR4_NAMED_ATTR		= 7;
4377c478bd9Sstevel@tonic-gate const FATTR4_FSID		= 8;
4387c478bd9Sstevel@tonic-gate const FATTR4_UNIQUE_HANDLES	= 9;
4397c478bd9Sstevel@tonic-gate const FATTR4_LEASE_TIME		= 10;
4407c478bd9Sstevel@tonic-gate const FATTR4_RDATTR_ERROR	= 11;
4417c478bd9Sstevel@tonic-gate const FATTR4_FILEHANDLE		= 19;
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate /*
4447c478bd9Sstevel@tonic-gate  * Recommended Attributes
4457c478bd9Sstevel@tonic-gate  */
4467c478bd9Sstevel@tonic-gate const FATTR4_ACL		= 12;
4477c478bd9Sstevel@tonic-gate const FATTR4_ACLSUPPORT		= 13;
4487c478bd9Sstevel@tonic-gate const FATTR4_ARCHIVE		= 14;
4497c478bd9Sstevel@tonic-gate const FATTR4_CANSETTIME		= 15;
4507c478bd9Sstevel@tonic-gate const FATTR4_CASE_INSENSITIVE	= 16;
4517c478bd9Sstevel@tonic-gate const FATTR4_CASE_PRESERVING	= 17;
4527c478bd9Sstevel@tonic-gate const FATTR4_CHOWN_RESTRICTED	= 18;
4537c478bd9Sstevel@tonic-gate const FATTR4_FILEID		= 20;
4547c478bd9Sstevel@tonic-gate const FATTR4_FILES_AVAIL	= 21;
4557c478bd9Sstevel@tonic-gate const FATTR4_FILES_FREE		= 22;
4567c478bd9Sstevel@tonic-gate const FATTR4_FILES_TOTAL	= 23;
4577c478bd9Sstevel@tonic-gate const FATTR4_FS_LOCATIONS	= 24;
4587c478bd9Sstevel@tonic-gate const FATTR4_HIDDEN		= 25;
4597c478bd9Sstevel@tonic-gate const FATTR4_HOMOGENEOUS	= 26;
4607c478bd9Sstevel@tonic-gate const FATTR4_MAXFILESIZE	= 27;
4617c478bd9Sstevel@tonic-gate const FATTR4_MAXLINK		= 28;
4627c478bd9Sstevel@tonic-gate const FATTR4_MAXNAME		= 29;
4637c478bd9Sstevel@tonic-gate const FATTR4_MAXREAD		= 30;
4647c478bd9Sstevel@tonic-gate const FATTR4_MAXWRITE		= 31;
4657c478bd9Sstevel@tonic-gate const FATTR4_MIMETYPE		= 32;
4667c478bd9Sstevel@tonic-gate const FATTR4_MODE		= 33;
4677c478bd9Sstevel@tonic-gate const FATTR4_NO_TRUNC		= 34;
4687c478bd9Sstevel@tonic-gate const FATTR4_NUMLINKS		= 35;
4697c478bd9Sstevel@tonic-gate const FATTR4_OWNER		= 36;
4707c478bd9Sstevel@tonic-gate const FATTR4_OWNER_GROUP	= 37;
4717c478bd9Sstevel@tonic-gate const FATTR4_QUOTA_AVAIL_HARD	= 38;
4727c478bd9Sstevel@tonic-gate const FATTR4_QUOTA_AVAIL_SOFT	= 39;
4737c478bd9Sstevel@tonic-gate const FATTR4_QUOTA_USED		= 40;
4747c478bd9Sstevel@tonic-gate const FATTR4_RAWDEV		= 41;
4757c478bd9Sstevel@tonic-gate const FATTR4_SPACE_AVAIL	= 42;
4767c478bd9Sstevel@tonic-gate const FATTR4_SPACE_FREE		= 43;
4777c478bd9Sstevel@tonic-gate const FATTR4_SPACE_TOTAL	= 44;
4787c478bd9Sstevel@tonic-gate const FATTR4_SPACE_USED		= 45;
4797c478bd9Sstevel@tonic-gate const FATTR4_SYSTEM		= 46;
4807c478bd9Sstevel@tonic-gate const FATTR4_TIME_ACCESS	= 47;
4817c478bd9Sstevel@tonic-gate const FATTR4_TIME_ACCESS_SET	= 48;
4827c478bd9Sstevel@tonic-gate const FATTR4_TIME_BACKUP	= 49;
4837c478bd9Sstevel@tonic-gate const FATTR4_TIME_CREATE	= 50;
4847c478bd9Sstevel@tonic-gate const FATTR4_TIME_DELTA		= 51;
4857c478bd9Sstevel@tonic-gate const FATTR4_TIME_METADATA	= 52;
4867c478bd9Sstevel@tonic-gate const FATTR4_TIME_MODIFY	= 53;
4877c478bd9Sstevel@tonic-gate const FATTR4_TIME_MODIFY_SET	= 54;
4887c478bd9Sstevel@tonic-gate const FATTR4_MOUNTED_ON_FILEID	= 55;
4897c478bd9Sstevel@tonic-gate 
4907c478bd9Sstevel@tonic-gate typedef	opaque	attrlist4<>;
4917c478bd9Sstevel@tonic-gate 
4927c478bd9Sstevel@tonic-gate /*
4937c478bd9Sstevel@tonic-gate  * File attribute container
4947c478bd9Sstevel@tonic-gate  */
4957c478bd9Sstevel@tonic-gate struct fattr4 {
4967c478bd9Sstevel@tonic-gate 	bitmap4		attrmask;
4977c478bd9Sstevel@tonic-gate 	attrlist4	attr_vals;
4987c478bd9Sstevel@tonic-gate };
4997c478bd9Sstevel@tonic-gate 
5007c478bd9Sstevel@tonic-gate /*
5017c478bd9Sstevel@tonic-gate  * Change info for the client
5027c478bd9Sstevel@tonic-gate  */
5037c478bd9Sstevel@tonic-gate struct change_info4 {
5047c478bd9Sstevel@tonic-gate 	bool		atomic;
5057c478bd9Sstevel@tonic-gate 	changeid4	before;
5067c478bd9Sstevel@tonic-gate 	changeid4	after;
5077c478bd9Sstevel@tonic-gate };
5087c478bd9Sstevel@tonic-gate 
5097c478bd9Sstevel@tonic-gate struct clientaddr4 {
5107c478bd9Sstevel@tonic-gate 	/* see struct rpcb in RFC 1833 */
5117c478bd9Sstevel@tonic-gate 	string r_netid<>;		/* network id */
5127c478bd9Sstevel@tonic-gate 	string r_addr<>;		/* universal address */
5137c478bd9Sstevel@tonic-gate };
5147c478bd9Sstevel@tonic-gate 
5157c478bd9Sstevel@tonic-gate /*
5167c478bd9Sstevel@tonic-gate  * Callback program info as provided by the client
5177c478bd9Sstevel@tonic-gate  */
5187c478bd9Sstevel@tonic-gate struct cb_client4 {
5197c478bd9Sstevel@tonic-gate 	uint32_t	cb_program;
5207c478bd9Sstevel@tonic-gate 	clientaddr4	cb_location;
5217c478bd9Sstevel@tonic-gate };
5227c478bd9Sstevel@tonic-gate 
5237c478bd9Sstevel@tonic-gate /*
5247c478bd9Sstevel@tonic-gate  * Stateid
5257c478bd9Sstevel@tonic-gate  */
5267c478bd9Sstevel@tonic-gate struct stateid4 {
5277c478bd9Sstevel@tonic-gate 	uint32_t	seqid;
5287c478bd9Sstevel@tonic-gate 	opaque		other[12];
5297c478bd9Sstevel@tonic-gate };
5307c478bd9Sstevel@tonic-gate 
5317c478bd9Sstevel@tonic-gate /*
5327c478bd9Sstevel@tonic-gate  * Client ID
5337c478bd9Sstevel@tonic-gate  */
5347c478bd9Sstevel@tonic-gate struct nfs_client_id4 {
5357c478bd9Sstevel@tonic-gate 	verifier4	verifier;
5367c478bd9Sstevel@tonic-gate 	opaque		id<NFS4_OPAQUE_LIMIT>;
5377c478bd9Sstevel@tonic-gate };
5387c478bd9Sstevel@tonic-gate 
5397c478bd9Sstevel@tonic-gate struct open_owner4 {
5407c478bd9Sstevel@tonic-gate 	clientid4	clientid;
5417c478bd9Sstevel@tonic-gate 	opaque		owner<NFS4_OPAQUE_LIMIT>;
5427c478bd9Sstevel@tonic-gate };
5437c478bd9Sstevel@tonic-gate 
5447c478bd9Sstevel@tonic-gate struct lock_owner4 {
5457c478bd9Sstevel@tonic-gate 	clientid4	clientid;
5467c478bd9Sstevel@tonic-gate 	opaque		owner<NFS4_OPAQUE_LIMIT>;
5477c478bd9Sstevel@tonic-gate };
5487c478bd9Sstevel@tonic-gate 
5497c478bd9Sstevel@tonic-gate enum nfs_lock_type4 {
5507c478bd9Sstevel@tonic-gate 	READ_LT		= 1,
5517c478bd9Sstevel@tonic-gate 	WRITE_LT	= 2,
5527c478bd9Sstevel@tonic-gate 	READW_LT	= 3,	/* blocking read */
5537c478bd9Sstevel@tonic-gate 	WRITEW_LT	= 4	/* blocking write */
5547c478bd9Sstevel@tonic-gate };
5557c478bd9Sstevel@tonic-gate 
5567c478bd9Sstevel@tonic-gate /*
5577c478bd9Sstevel@tonic-gate  * ACCESS: Check access permission
5587c478bd9Sstevel@tonic-gate  */
5597c478bd9Sstevel@tonic-gate const ACCESS4_READ	= 0x00000001;
5607c478bd9Sstevel@tonic-gate const ACCESS4_LOOKUP	= 0x00000002;
5617c478bd9Sstevel@tonic-gate const ACCESS4_MODIFY	= 0x00000004;
5627c478bd9Sstevel@tonic-gate const ACCESS4_EXTEND	= 0x00000008;
5637c478bd9Sstevel@tonic-gate const ACCESS4_DELETE	= 0x00000010;
5647c478bd9Sstevel@tonic-gate const ACCESS4_EXECUTE	= 0x00000020;
5657c478bd9Sstevel@tonic-gate 
5667c478bd9Sstevel@tonic-gate struct ACCESS4args {
5677c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
5687c478bd9Sstevel@tonic-gate 	uint32_t	access;
5697c478bd9Sstevel@tonic-gate };
5707c478bd9Sstevel@tonic-gate 
5717c478bd9Sstevel@tonic-gate struct ACCESS4resok {
5727c478bd9Sstevel@tonic-gate 	uint32_t	supported;
5737c478bd9Sstevel@tonic-gate 	uint32_t	access;
5747c478bd9Sstevel@tonic-gate };
5757c478bd9Sstevel@tonic-gate 
5767c478bd9Sstevel@tonic-gate union ACCESS4res switch (nfsstat4 status) {
5777c478bd9Sstevel@tonic-gate  case NFS4_OK:
5787c478bd9Sstevel@tonic-gate 	 ACCESS4resok	resok4;
5797c478bd9Sstevel@tonic-gate  default:
5807c478bd9Sstevel@tonic-gate 	 void;
5817c478bd9Sstevel@tonic-gate };
5827c478bd9Sstevel@tonic-gate 
5837c478bd9Sstevel@tonic-gate /*
5847c478bd9Sstevel@tonic-gate  * CLOSE: Close a file and release share reservations
5857c478bd9Sstevel@tonic-gate  */
5867c478bd9Sstevel@tonic-gate struct CLOSE4args {
5877c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
5887c478bd9Sstevel@tonic-gate 	seqid4		seqid;
5897c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
5907c478bd9Sstevel@tonic-gate };
5917c478bd9Sstevel@tonic-gate 
5927c478bd9Sstevel@tonic-gate union CLOSE4res switch (nfsstat4 status) {
5937c478bd9Sstevel@tonic-gate  case NFS4_OK:
5947c478bd9Sstevel@tonic-gate 	 stateid4	open_stateid;
5957c478bd9Sstevel@tonic-gate  default:
5967c478bd9Sstevel@tonic-gate 	 void;
5977c478bd9Sstevel@tonic-gate };
5987c478bd9Sstevel@tonic-gate 
5997c478bd9Sstevel@tonic-gate /*
6007c478bd9Sstevel@tonic-gate  * COMMIT: Commit cached data on server to stable storage
6017c478bd9Sstevel@tonic-gate  */
6027c478bd9Sstevel@tonic-gate struct COMMIT4args {
6037c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
6047c478bd9Sstevel@tonic-gate 	offset4		offset;
6057c478bd9Sstevel@tonic-gate 	count4		count;
6067c478bd9Sstevel@tonic-gate };
6077c478bd9Sstevel@tonic-gate 
6087c478bd9Sstevel@tonic-gate struct COMMIT4resok {
6097c478bd9Sstevel@tonic-gate 	verifier4	writeverf;
6107c478bd9Sstevel@tonic-gate };
6117c478bd9Sstevel@tonic-gate 
6127c478bd9Sstevel@tonic-gate 
6137c478bd9Sstevel@tonic-gate union COMMIT4res switch (nfsstat4 status) {
6147c478bd9Sstevel@tonic-gate  case NFS4_OK:
6157c478bd9Sstevel@tonic-gate 	 COMMIT4resok	resok4;
6167c478bd9Sstevel@tonic-gate  default:
6177c478bd9Sstevel@tonic-gate 	 void;
6187c478bd9Sstevel@tonic-gate };
6197c478bd9Sstevel@tonic-gate 
6207c478bd9Sstevel@tonic-gate /*
6217c478bd9Sstevel@tonic-gate  * CREATE: Create a non-regular file
6227c478bd9Sstevel@tonic-gate  */
6237c478bd9Sstevel@tonic-gate union createtype4 switch (nfs_ftype4 type) {
6247c478bd9Sstevel@tonic-gate  case NF4LNK:
6257c478bd9Sstevel@tonic-gate 	 linktext4	linkdata;
6267c478bd9Sstevel@tonic-gate  case NF4BLK:
6277c478bd9Sstevel@tonic-gate  case NF4CHR:
6287c478bd9Sstevel@tonic-gate 	 specdata4	devdata;
6297c478bd9Sstevel@tonic-gate  case NF4SOCK:
6307c478bd9Sstevel@tonic-gate  case NF4FIFO:
6317c478bd9Sstevel@tonic-gate  case NF4DIR:
6327c478bd9Sstevel@tonic-gate 	 void;
6337c478bd9Sstevel@tonic-gate  default:
6347c478bd9Sstevel@tonic-gate 	 void;		/* server should return NFS4ERR_BADTYPE */
6357c478bd9Sstevel@tonic-gate };
6367c478bd9Sstevel@tonic-gate 
6377c478bd9Sstevel@tonic-gate struct CREATE4args {
6387c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory for creation */
6397c478bd9Sstevel@tonic-gate 	createtype4	objtype;
6407c478bd9Sstevel@tonic-gate 	component4	objname;
6417c478bd9Sstevel@tonic-gate 	fattr4		createattrs;
6427c478bd9Sstevel@tonic-gate };
6437c478bd9Sstevel@tonic-gate 
6447c478bd9Sstevel@tonic-gate struct CREATE4resok {
6457c478bd9Sstevel@tonic-gate 	change_info4	cinfo;
6467c478bd9Sstevel@tonic-gate 	bitmap4		attrset;	/* attributes set */
6477c478bd9Sstevel@tonic-gate };
6487c478bd9Sstevel@tonic-gate 
6497c478bd9Sstevel@tonic-gate union CREATE4res switch (nfsstat4 status) {
6507c478bd9Sstevel@tonic-gate  case NFS4_OK:
6517c478bd9Sstevel@tonic-gate 	 CREATE4resok resok4;
6527c478bd9Sstevel@tonic-gate  default:
6537c478bd9Sstevel@tonic-gate 	 void;
6547c478bd9Sstevel@tonic-gate };
6557c478bd9Sstevel@tonic-gate 
6567c478bd9Sstevel@tonic-gate /*
6577c478bd9Sstevel@tonic-gate  * DELEGPURGE: Purge Delegations Awaiting Recovery
6587c478bd9Sstevel@tonic-gate  */
6597c478bd9Sstevel@tonic-gate struct DELEGPURGE4args {
6607c478bd9Sstevel@tonic-gate 	clientid4	clientid;
6617c478bd9Sstevel@tonic-gate };
6627c478bd9Sstevel@tonic-gate 
6637c478bd9Sstevel@tonic-gate struct DELEGPURGE4res {
6647c478bd9Sstevel@tonic-gate 	nfsstat4	status;
6657c478bd9Sstevel@tonic-gate };
6667c478bd9Sstevel@tonic-gate 
6677c478bd9Sstevel@tonic-gate /*
6687c478bd9Sstevel@tonic-gate  * DELEGRETURN: Return a delegation
6697c478bd9Sstevel@tonic-gate  */
6707c478bd9Sstevel@tonic-gate struct DELEGRETURN4args {
6717c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: delegated file */
6727c478bd9Sstevel@tonic-gate 	stateid4	deleg_stateid;
6737c478bd9Sstevel@tonic-gate };
6747c478bd9Sstevel@tonic-gate 
6757c478bd9Sstevel@tonic-gate struct DELEGRETURN4res {
6767c478bd9Sstevel@tonic-gate 	nfsstat4	status;
6777c478bd9Sstevel@tonic-gate };
6787c478bd9Sstevel@tonic-gate 
6797c478bd9Sstevel@tonic-gate /*
6807c478bd9Sstevel@tonic-gate  * GETATTR: Get file attributes
6817c478bd9Sstevel@tonic-gate  */
6827c478bd9Sstevel@tonic-gate struct GETATTR4args {
6837c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory or file */
6847c478bd9Sstevel@tonic-gate 	bitmap4		attr_request;
6857c478bd9Sstevel@tonic-gate };
6867c478bd9Sstevel@tonic-gate 
6877c478bd9Sstevel@tonic-gate struct GETATTR4resok {
6887c478bd9Sstevel@tonic-gate 	fattr4		obj_attributes;
6897c478bd9Sstevel@tonic-gate };
6907c478bd9Sstevel@tonic-gate 
6917c478bd9Sstevel@tonic-gate union GETATTR4res switch (nfsstat4 status) {
6927c478bd9Sstevel@tonic-gate  case NFS4_OK:
6937c478bd9Sstevel@tonic-gate 	 GETATTR4resok	resok4;
6947c478bd9Sstevel@tonic-gate  default:
6957c478bd9Sstevel@tonic-gate 	 void;
6967c478bd9Sstevel@tonic-gate };
6977c478bd9Sstevel@tonic-gate 
6987c478bd9Sstevel@tonic-gate /*
6997c478bd9Sstevel@tonic-gate  * GETFH: Get current filehandle
7007c478bd9Sstevel@tonic-gate  */
7017c478bd9Sstevel@tonic-gate struct GETFH4resok {
7027c478bd9Sstevel@tonic-gate 	nfs_fh4		object;
7037c478bd9Sstevel@tonic-gate };
7047c478bd9Sstevel@tonic-gate 
7057c478bd9Sstevel@tonic-gate union GETFH4res switch (nfsstat4 status) {
7067c478bd9Sstevel@tonic-gate  case NFS4_OK:
7077c478bd9Sstevel@tonic-gate 	GETFH4resok	resok4;
7087c478bd9Sstevel@tonic-gate  default:
7097c478bd9Sstevel@tonic-gate 	void;
7107c478bd9Sstevel@tonic-gate };
7117c478bd9Sstevel@tonic-gate 
7127c478bd9Sstevel@tonic-gate /*
7137c478bd9Sstevel@tonic-gate  * LINK: Create link to an object
7147c478bd9Sstevel@tonic-gate  */
7157c478bd9Sstevel@tonic-gate struct LINK4args {
7167c478bd9Sstevel@tonic-gate 	/* SAVED_FH: source object */
7177c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: target directory */
7187c478bd9Sstevel@tonic-gate 	component4	newname;
7197c478bd9Sstevel@tonic-gate };
7207c478bd9Sstevel@tonic-gate 
7217c478bd9Sstevel@tonic-gate struct LINK4resok {
7227c478bd9Sstevel@tonic-gate 	change_info4	cinfo;
7237c478bd9Sstevel@tonic-gate };
7247c478bd9Sstevel@tonic-gate 
7257c478bd9Sstevel@tonic-gate union LINK4res switch (nfsstat4 status) {
7267c478bd9Sstevel@tonic-gate  case NFS4_OK:
7277c478bd9Sstevel@tonic-gate 	 LINK4resok resok4;
7287c478bd9Sstevel@tonic-gate  default:
7297c478bd9Sstevel@tonic-gate 	 void;
7307c478bd9Sstevel@tonic-gate };
7317c478bd9Sstevel@tonic-gate 
7327c478bd9Sstevel@tonic-gate /*
7337c478bd9Sstevel@tonic-gate  * For LOCK, transition from open_owner to new lock_owner
7347c478bd9Sstevel@tonic-gate  */
7357c478bd9Sstevel@tonic-gate struct open_to_lock_owner4 {
7367c478bd9Sstevel@tonic-gate 	seqid4		open_seqid;
7377c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
7387c478bd9Sstevel@tonic-gate 	seqid4		lock_seqid;
7397c478bd9Sstevel@tonic-gate 	lock_owner4	lock_owner;
7407c478bd9Sstevel@tonic-gate };
7417c478bd9Sstevel@tonic-gate 
7427c478bd9Sstevel@tonic-gate /*
7437c478bd9Sstevel@tonic-gate  * For LOCK, existing lock_owner continues to request file locks
7447c478bd9Sstevel@tonic-gate  */
7457c478bd9Sstevel@tonic-gate struct exist_lock_owner4 {
7467c478bd9Sstevel@tonic-gate 	stateid4	lock_stateid;
7477c478bd9Sstevel@tonic-gate 	seqid4		lock_seqid;
7487c478bd9Sstevel@tonic-gate };
7497c478bd9Sstevel@tonic-gate 
7507c478bd9Sstevel@tonic-gate union locker4 switch (bool new_lock_owner) {
7517c478bd9Sstevel@tonic-gate  case TRUE:
7527c478bd9Sstevel@tonic-gate 	open_to_lock_owner4	open_owner;
7537c478bd9Sstevel@tonic-gate  case FALSE:
7547c478bd9Sstevel@tonic-gate 	exist_lock_owner4	lock_owner;
7557c478bd9Sstevel@tonic-gate };
7567c478bd9Sstevel@tonic-gate 
7577c478bd9Sstevel@tonic-gate /*
7587c478bd9Sstevel@tonic-gate  * LOCK/LOCKT/LOCKU: Record lock management
7597c478bd9Sstevel@tonic-gate  */
7607c478bd9Sstevel@tonic-gate struct LOCK4args {
7617c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
7627c478bd9Sstevel@tonic-gate 	nfs_lock_type4	locktype;
7637c478bd9Sstevel@tonic-gate 	bool		reclaim;
7647c478bd9Sstevel@tonic-gate 	offset4		offset;
7657c478bd9Sstevel@tonic-gate 	length4		length;
7667c478bd9Sstevel@tonic-gate 	locker4		locker;
7677c478bd9Sstevel@tonic-gate };
7687c478bd9Sstevel@tonic-gate 
7697c478bd9Sstevel@tonic-gate struct LOCK4denied {
7707c478bd9Sstevel@tonic-gate 	offset4		offset;
7717c478bd9Sstevel@tonic-gate 	length4		length;
7727c478bd9Sstevel@tonic-gate 	nfs_lock_type4	locktype;
7737c478bd9Sstevel@tonic-gate 	lock_owner4	owner;
7747c478bd9Sstevel@tonic-gate };
7757c478bd9Sstevel@tonic-gate 
7767c478bd9Sstevel@tonic-gate struct LOCK4resok {
7777c478bd9Sstevel@tonic-gate 	stateid4	lock_stateid;
7787c478bd9Sstevel@tonic-gate };
7797c478bd9Sstevel@tonic-gate 
7807c478bd9Sstevel@tonic-gate union LOCK4res switch (nfsstat4 status) {
7817c478bd9Sstevel@tonic-gate  case NFS4_OK:
7827c478bd9Sstevel@tonic-gate 	 LOCK4resok	resok4;
7837c478bd9Sstevel@tonic-gate  case NFS4ERR_DENIED:
7847c478bd9Sstevel@tonic-gate 	 LOCK4denied	denied;
7857c478bd9Sstevel@tonic-gate  default:
7867c478bd9Sstevel@tonic-gate 	 void;
7877c478bd9Sstevel@tonic-gate };
7887c478bd9Sstevel@tonic-gate 
7897c478bd9Sstevel@tonic-gate struct LOCKT4args {
7907c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
7917c478bd9Sstevel@tonic-gate 	nfs_lock_type4	locktype;
7927c478bd9Sstevel@tonic-gate 	offset4		offset;
7937c478bd9Sstevel@tonic-gate 	length4		length;
7947c478bd9Sstevel@tonic-gate 	lock_owner4	owner;
7957c478bd9Sstevel@tonic-gate };
7967c478bd9Sstevel@tonic-gate 
7977c478bd9Sstevel@tonic-gate union LOCKT4res switch (nfsstat4 status) {
7987c478bd9Sstevel@tonic-gate  case NFS4ERR_DENIED:
7997c478bd9Sstevel@tonic-gate 	 LOCK4denied	denied;
8007c478bd9Sstevel@tonic-gate  case NFS4_OK:
8017c478bd9Sstevel@tonic-gate 	 void;
8027c478bd9Sstevel@tonic-gate  default:
8037c478bd9Sstevel@tonic-gate 	 void;
8047c478bd9Sstevel@tonic-gate };
8057c478bd9Sstevel@tonic-gate 
8067c478bd9Sstevel@tonic-gate struct LOCKU4args {
8077c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
8087c478bd9Sstevel@tonic-gate 	nfs_lock_type4	locktype;
8097c478bd9Sstevel@tonic-gate 	seqid4		seqid;
8107c478bd9Sstevel@tonic-gate 	stateid4	lock_stateid;
8117c478bd9Sstevel@tonic-gate 	offset4		offset;
8127c478bd9Sstevel@tonic-gate 	length4		length;
8137c478bd9Sstevel@tonic-gate };
8147c478bd9Sstevel@tonic-gate 
8157c478bd9Sstevel@tonic-gate union LOCKU4res switch (nfsstat4 status) {
8167c478bd9Sstevel@tonic-gate  case	NFS4_OK:
8177c478bd9Sstevel@tonic-gate 	 stateid4	lock_stateid;
8187c478bd9Sstevel@tonic-gate  default:
8197c478bd9Sstevel@tonic-gate 	 void;
8207c478bd9Sstevel@tonic-gate };
8217c478bd9Sstevel@tonic-gate 
8227c478bd9Sstevel@tonic-gate /*
8237c478bd9Sstevel@tonic-gate  * LOOKUP: Lookup filename
8247c478bd9Sstevel@tonic-gate  */
8257c478bd9Sstevel@tonic-gate struct LOOKUP4args {
8267c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
8277c478bd9Sstevel@tonic-gate 	component4	objname;
8287c478bd9Sstevel@tonic-gate };
8297c478bd9Sstevel@tonic-gate 
8307c478bd9Sstevel@tonic-gate struct LOOKUP4res {
8317c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
8327c478bd9Sstevel@tonic-gate 	nfsstat4	status;
8337c478bd9Sstevel@tonic-gate };
8347c478bd9Sstevel@tonic-gate 
8357c478bd9Sstevel@tonic-gate /*
8367c478bd9Sstevel@tonic-gate  * LOOKUPP: Lookup parent directory
8377c478bd9Sstevel@tonic-gate  */
8387c478bd9Sstevel@tonic-gate struct LOOKUPP4res {
8397c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
8407c478bd9Sstevel@tonic-gate 	nfsstat4	status;
8417c478bd9Sstevel@tonic-gate };
8427c478bd9Sstevel@tonic-gate 
8437c478bd9Sstevel@tonic-gate /*
8447c478bd9Sstevel@tonic-gate  * NVERIFY: Verify attributes different
8457c478bd9Sstevel@tonic-gate  */
8467c478bd9Sstevel@tonic-gate struct NVERIFY4args {
8477c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
8487c478bd9Sstevel@tonic-gate 	fattr4		obj_attributes;
8497c478bd9Sstevel@tonic-gate };
8507c478bd9Sstevel@tonic-gate 
8517c478bd9Sstevel@tonic-gate struct NVERIFY4res {
8527c478bd9Sstevel@tonic-gate 	nfsstat4	status;
8537c478bd9Sstevel@tonic-gate };
8547c478bd9Sstevel@tonic-gate 
8557c478bd9Sstevel@tonic-gate /*
8567c478bd9Sstevel@tonic-gate  * Various definitions for OPEN
8577c478bd9Sstevel@tonic-gate  */
8587c478bd9Sstevel@tonic-gate enum createmode4 {
8597c478bd9Sstevel@tonic-gate 	UNCHECKED4	= 0,
8607c478bd9Sstevel@tonic-gate 	GUARDED4	= 1,
8617c478bd9Sstevel@tonic-gate 	EXCLUSIVE4	= 2
8627c478bd9Sstevel@tonic-gate };
8637c478bd9Sstevel@tonic-gate 
8647c478bd9Sstevel@tonic-gate union createhow4 switch (createmode4 mode) {
8657c478bd9Sstevel@tonic-gate  case UNCHECKED4:
8667c478bd9Sstevel@tonic-gate  case GUARDED4:
8677c478bd9Sstevel@tonic-gate 	 fattr4		createattrs;
8687c478bd9Sstevel@tonic-gate  case EXCLUSIVE4:
8697c478bd9Sstevel@tonic-gate 	 verifier4	createverf;
8707c478bd9Sstevel@tonic-gate };
8717c478bd9Sstevel@tonic-gate 
8727c478bd9Sstevel@tonic-gate enum opentype4 {
8737c478bd9Sstevel@tonic-gate 	OPEN4_NOCREATE	= 0,
8747c478bd9Sstevel@tonic-gate 	OPEN4_CREATE	= 1
8757c478bd9Sstevel@tonic-gate };
8767c478bd9Sstevel@tonic-gate 
8777c478bd9Sstevel@tonic-gate union openflag4 switch (opentype4 opentype) {
8787c478bd9Sstevel@tonic-gate  case OPEN4_CREATE:
8797c478bd9Sstevel@tonic-gate 	 createhow4	how;
8807c478bd9Sstevel@tonic-gate  default:
8817c478bd9Sstevel@tonic-gate 	 void;
8827c478bd9Sstevel@tonic-gate };
8837c478bd9Sstevel@tonic-gate 
8847c478bd9Sstevel@tonic-gate /* Next definitions used for OPEN delegation */
8857c478bd9Sstevel@tonic-gate enum limit_by4 {
8867c478bd9Sstevel@tonic-gate 	NFS_LIMIT_SIZE		= 1,
8877c478bd9Sstevel@tonic-gate 	NFS_LIMIT_BLOCKS	= 2
8887c478bd9Sstevel@tonic-gate 	/* others as needed */
8897c478bd9Sstevel@tonic-gate };
8907c478bd9Sstevel@tonic-gate 
8917c478bd9Sstevel@tonic-gate struct nfs_modified_limit4 {
8927c478bd9Sstevel@tonic-gate 	uint32_t	num_blocks;
8937c478bd9Sstevel@tonic-gate 	uint32_t	bytes_per_block;
8947c478bd9Sstevel@tonic-gate };
8957c478bd9Sstevel@tonic-gate 
8967c478bd9Sstevel@tonic-gate union nfs_space_limit4 switch (limit_by4 limitby) {
8977c478bd9Sstevel@tonic-gate  /* limit specified as file size */
8987c478bd9Sstevel@tonic-gate  case NFS_LIMIT_SIZE:
8997c478bd9Sstevel@tonic-gate 	 uint64_t		filesize;
9007c478bd9Sstevel@tonic-gate  /* limit specified by number of blocks */
9017c478bd9Sstevel@tonic-gate  case NFS_LIMIT_BLOCKS:
9027c478bd9Sstevel@tonic-gate 	 nfs_modified_limit4	mod_blocks;
9037c478bd9Sstevel@tonic-gate } ;
9047c478bd9Sstevel@tonic-gate 
9057c478bd9Sstevel@tonic-gate /*
9067c478bd9Sstevel@tonic-gate  * Share Access and Deny constants for open argument
9077c478bd9Sstevel@tonic-gate  */
9087c478bd9Sstevel@tonic-gate const OPEN4_SHARE_ACCESS_READ	= 0x00000001;
9097c478bd9Sstevel@tonic-gate const OPEN4_SHARE_ACCESS_WRITE	= 0x00000002;
9107c478bd9Sstevel@tonic-gate const OPEN4_SHARE_ACCESS_BOTH	= 0x00000003;
9117c478bd9Sstevel@tonic-gate 
9127c478bd9Sstevel@tonic-gate const OPEN4_SHARE_DENY_NONE	= 0x00000000;
9137c478bd9Sstevel@tonic-gate const OPEN4_SHARE_DENY_READ	= 0x00000001;
9147c478bd9Sstevel@tonic-gate const OPEN4_SHARE_DENY_WRITE	= 0x00000002;
9157c478bd9Sstevel@tonic-gate const OPEN4_SHARE_DENY_BOTH	= 0x00000003;
9167c478bd9Sstevel@tonic-gate 
9177c478bd9Sstevel@tonic-gate enum open_delegation_type4 {
9187c478bd9Sstevel@tonic-gate 	OPEN_DELEGATE_NONE	= 0,
9197c478bd9Sstevel@tonic-gate 	OPEN_DELEGATE_READ	= 1,
9207c478bd9Sstevel@tonic-gate 	OPEN_DELEGATE_WRITE	= 2
9217c478bd9Sstevel@tonic-gate };
9227c478bd9Sstevel@tonic-gate 
9237c478bd9Sstevel@tonic-gate enum open_claim_type4 {
9247c478bd9Sstevel@tonic-gate 	CLAIM_NULL		= 0,
9257c478bd9Sstevel@tonic-gate 	CLAIM_PREVIOUS		= 1,
9267c478bd9Sstevel@tonic-gate 	CLAIM_DELEGATE_CUR	= 2,
9277c478bd9Sstevel@tonic-gate 	CLAIM_DELEGATE_PREV	= 3
9287c478bd9Sstevel@tonic-gate };
9297c478bd9Sstevel@tonic-gate 
9307c478bd9Sstevel@tonic-gate struct open_claim_delegate_cur4 {
9317c478bd9Sstevel@tonic-gate 	stateid4	delegate_stateid;
9327c478bd9Sstevel@tonic-gate 	component4	file;
9337c478bd9Sstevel@tonic-gate };
9347c478bd9Sstevel@tonic-gate 
9357c478bd9Sstevel@tonic-gate union open_claim4 switch (open_claim_type4 claim) {
9367c478bd9Sstevel@tonic-gate  /*
9377c478bd9Sstevel@tonic-gate   * No special rights to file. Ordinary OPEN of the specified file.
9387c478bd9Sstevel@tonic-gate   */
9397c478bd9Sstevel@tonic-gate  case CLAIM_NULL:
9407c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
9417c478bd9Sstevel@tonic-gate 	component4	file;
9427c478bd9Sstevel@tonic-gate 
9437c478bd9Sstevel@tonic-gate  /*
9447c478bd9Sstevel@tonic-gate   * Right to the file established by an open previous to server
9457c478bd9Sstevel@tonic-gate   * reboot.  File identified by filehandle obtained at that time
9467c478bd9Sstevel@tonic-gate   * rather than by name.
9477c478bd9Sstevel@tonic-gate   */
9487c478bd9Sstevel@tonic-gate  case CLAIM_PREVIOUS:
9497c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file being reclaimed */
9507c478bd9Sstevel@tonic-gate 	open_delegation_type4	delegate_type;
9517c478bd9Sstevel@tonic-gate 
9527c478bd9Sstevel@tonic-gate  /*
9537c478bd9Sstevel@tonic-gate   * Right to file based on a delegation granted by the server.
9547c478bd9Sstevel@tonic-gate   * File is specified by name.
9557c478bd9Sstevel@tonic-gate   */
9567c478bd9Sstevel@tonic-gate  case CLAIM_DELEGATE_CUR:
9577c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
9587c478bd9Sstevel@tonic-gate 	open_claim_delegate_cur4	delegate_cur_info;
9597c478bd9Sstevel@tonic-gate 
9607c478bd9Sstevel@tonic-gate  /* Right to file based on a delegation granted to a previous boot
9617c478bd9Sstevel@tonic-gate   * instance of the client.  File is specified by name.
9627c478bd9Sstevel@tonic-gate   */
9637c478bd9Sstevel@tonic-gate  case CLAIM_DELEGATE_PREV:
9647c478bd9Sstevel@tonic-gate 	 /* CURRENT_FH: directory */
9657c478bd9Sstevel@tonic-gate 	component4	file_delegate_prev;
9667c478bd9Sstevel@tonic-gate };
9677c478bd9Sstevel@tonic-gate 
9687c478bd9Sstevel@tonic-gate /*
9697c478bd9Sstevel@tonic-gate  * OPEN: Open a file, potentially receiving an open delegation
9707c478bd9Sstevel@tonic-gate  */
9717c478bd9Sstevel@tonic-gate struct OPEN4args {
9727c478bd9Sstevel@tonic-gate 	seqid4		seqid;
9737c478bd9Sstevel@tonic-gate 	uint32_t	share_access;
9747c478bd9Sstevel@tonic-gate 	uint32_t	share_deny;
9757c478bd9Sstevel@tonic-gate 	open_owner4	owner;
9767c478bd9Sstevel@tonic-gate 	openflag4	openhow;
9777c478bd9Sstevel@tonic-gate 	open_claim4	claim;
9787c478bd9Sstevel@tonic-gate };
9797c478bd9Sstevel@tonic-gate 
9807c478bd9Sstevel@tonic-gate struct open_read_delegation4 {
9817c478bd9Sstevel@tonic-gate 	stateid4	stateid;	/* Stateid for delegation*/
9827c478bd9Sstevel@tonic-gate 	bool		recall;		/* Pre-recalled flag for
9837c478bd9Sstevel@tonic-gate 					   delegations obtained
9847c478bd9Sstevel@tonic-gate 					   by reclaim
9857c478bd9Sstevel@tonic-gate 					   (CLAIM_PREVIOUS) */
9867c478bd9Sstevel@tonic-gate 	nfsace4		permissions;	/* Defines users who don't
9877c478bd9Sstevel@tonic-gate 					   need an ACCESS call to
9887c478bd9Sstevel@tonic-gate 					   open for read */
9897c478bd9Sstevel@tonic-gate };
9907c478bd9Sstevel@tonic-gate 
9917c478bd9Sstevel@tonic-gate struct open_write_delegation4 {
9927c478bd9Sstevel@tonic-gate 	stateid4	stateid;	/* Stateid for delegation */
9937c478bd9Sstevel@tonic-gate 	bool		recall;		/* Pre-recalled flag for
9947c478bd9Sstevel@tonic-gate 					   delegations obtained
9957c478bd9Sstevel@tonic-gate 					   by reclaim
9967c478bd9Sstevel@tonic-gate 					   (CLAIM_PREVIOUS) */
9977c478bd9Sstevel@tonic-gate 	nfs_space_limit4 space_limit;	/* Defines condition that
9987c478bd9Sstevel@tonic-gate 					   the client must check to
9997c478bd9Sstevel@tonic-gate 					   determine whether the
10007c478bd9Sstevel@tonic-gate 					   file needs to be flushed
10017c478bd9Sstevel@tonic-gate 					   to the server on close.
10027c478bd9Sstevel@tonic-gate 					   */
10037c478bd9Sstevel@tonic-gate 	nfsace4		permissions;	/* Defines users who don't
10047c478bd9Sstevel@tonic-gate 					   need an ACCESS call as
10057c478bd9Sstevel@tonic-gate 					   part of a delegated
10067c478bd9Sstevel@tonic-gate 					   open. */
10077c478bd9Sstevel@tonic-gate };
10087c478bd9Sstevel@tonic-gate 
10097c478bd9Sstevel@tonic-gate union open_delegation4
10107c478bd9Sstevel@tonic-gate switch (open_delegation_type4 delegation_type) {
10117c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_NONE:
10127c478bd9Sstevel@tonic-gate 		void;
10137c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_READ:
10147c478bd9Sstevel@tonic-gate 		open_read_delegation4 read;
10157c478bd9Sstevel@tonic-gate 	case OPEN_DELEGATE_WRITE:
10167c478bd9Sstevel@tonic-gate 		open_write_delegation4 write;
10177c478bd9Sstevel@tonic-gate };
10187c478bd9Sstevel@tonic-gate 
10197c478bd9Sstevel@tonic-gate /*
10207c478bd9Sstevel@tonic-gate  * Result flags
10217c478bd9Sstevel@tonic-gate  */
10227c478bd9Sstevel@tonic-gate /* Client must confirm open */
10237c478bd9Sstevel@tonic-gate const OPEN4_RESULT_CONFIRM	= 0x00000002;
10247c478bd9Sstevel@tonic-gate /* Type of file locking behavior at the server */
10257c478bd9Sstevel@tonic-gate const OPEN4_RESULT_LOCKTYPE_POSIX = 0x00000004;
10267c478bd9Sstevel@tonic-gate 
10277c478bd9Sstevel@tonic-gate struct OPEN4resok {
10287c478bd9Sstevel@tonic-gate 	stateid4	stateid;	/* Stateid for open */
10297c478bd9Sstevel@tonic-gate 	change_info4	cinfo;		/* Directory Change Info */
10307c478bd9Sstevel@tonic-gate 	uint32_t	rflags;		/* Result flags */
10317c478bd9Sstevel@tonic-gate 	bitmap4		attrset;	/* attribute set for create*/
10327c478bd9Sstevel@tonic-gate 	open_delegation4 delegation;	/* Info on any open
10337c478bd9Sstevel@tonic-gate 					   delegation */
10347c478bd9Sstevel@tonic-gate };
10357c478bd9Sstevel@tonic-gate 
10367c478bd9Sstevel@tonic-gate union OPEN4res switch (nfsstat4 status) {
10377c478bd9Sstevel@tonic-gate  case NFS4_OK:
10387c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: opened file */
10397c478bd9Sstevel@tonic-gate 	OPEN4resok	resok4;
10407c478bd9Sstevel@tonic-gate  default:
10417c478bd9Sstevel@tonic-gate 	void;
10427c478bd9Sstevel@tonic-gate };
10437c478bd9Sstevel@tonic-gate 
10447c478bd9Sstevel@tonic-gate /*
10457c478bd9Sstevel@tonic-gate  * OPENATTR: open named attributes directory
10467c478bd9Sstevel@tonic-gate  */
10477c478bd9Sstevel@tonic-gate struct OPENATTR4args {
10487c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
10497c478bd9Sstevel@tonic-gate 	bool	createdir;
10507c478bd9Sstevel@tonic-gate };
10517c478bd9Sstevel@tonic-gate 
10527c478bd9Sstevel@tonic-gate struct OPENATTR4res {
10537c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: named attr directory */
10547c478bd9Sstevel@tonic-gate 	nfsstat4	status;
10557c478bd9Sstevel@tonic-gate };
10567c478bd9Sstevel@tonic-gate 
10577c478bd9Sstevel@tonic-gate /*
10587c478bd9Sstevel@tonic-gate  * OPEN_CONFIRM: confirm the open
10597c478bd9Sstevel@tonic-gate  */
10607c478bd9Sstevel@tonic-gate struct OPEN_CONFIRM4args {
10617c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: opened file */
10627c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
10637c478bd9Sstevel@tonic-gate 	seqid4		seqid;
10647c478bd9Sstevel@tonic-gate };
10657c478bd9Sstevel@tonic-gate 
10667c478bd9Sstevel@tonic-gate struct OPEN_CONFIRM4resok {
10677c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
10687c478bd9Sstevel@tonic-gate };
10697c478bd9Sstevel@tonic-gate 
10707c478bd9Sstevel@tonic-gate union OPEN_CONFIRM4res switch (nfsstat4 status) {
10717c478bd9Sstevel@tonic-gate  case NFS4_OK:
10727c478bd9Sstevel@tonic-gate 	 OPEN_CONFIRM4resok	resok4;
10737c478bd9Sstevel@tonic-gate  default:
10747c478bd9Sstevel@tonic-gate 	 void;
10757c478bd9Sstevel@tonic-gate };
10767c478bd9Sstevel@tonic-gate 
10777c478bd9Sstevel@tonic-gate /*
10787c478bd9Sstevel@tonic-gate  * OPEN_DOWNGRADE: downgrade the access/deny for a file
10797c478bd9Sstevel@tonic-gate  */
10807c478bd9Sstevel@tonic-gate struct OPEN_DOWNGRADE4args {
10817c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: opened file */
10827c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
10837c478bd9Sstevel@tonic-gate 	seqid4		seqid;
10847c478bd9Sstevel@tonic-gate 	uint32_t	share_access;
10857c478bd9Sstevel@tonic-gate 	uint32_t	share_deny;
10867c478bd9Sstevel@tonic-gate };
10877c478bd9Sstevel@tonic-gate 
10887c478bd9Sstevel@tonic-gate struct OPEN_DOWNGRADE4resok {
10897c478bd9Sstevel@tonic-gate 	stateid4	open_stateid;
10907c478bd9Sstevel@tonic-gate };
10917c478bd9Sstevel@tonic-gate 
10927c478bd9Sstevel@tonic-gate union OPEN_DOWNGRADE4res switch(nfsstat4 status) {
10937c478bd9Sstevel@tonic-gate  case NFS4_OK:
10947c478bd9Sstevel@tonic-gate 	OPEN_DOWNGRADE4resok	resok4;
10957c478bd9Sstevel@tonic-gate  default:
10967c478bd9Sstevel@tonic-gate 	 void;
10977c478bd9Sstevel@tonic-gate };
10987c478bd9Sstevel@tonic-gate 
10997c478bd9Sstevel@tonic-gate /*
11007c478bd9Sstevel@tonic-gate  * PUTFH: Set current filehandle
11017c478bd9Sstevel@tonic-gate  */
11027c478bd9Sstevel@tonic-gate struct PUTFH4args {
11037c478bd9Sstevel@tonic-gate 	nfs_fh4		object;
11047c478bd9Sstevel@tonic-gate };
11057c478bd9Sstevel@tonic-gate 
11067c478bd9Sstevel@tonic-gate struct PUTFH4res {
11077c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: */
11087c478bd9Sstevel@tonic-gate 	nfsstat4	status;
11097c478bd9Sstevel@tonic-gate };
11107c478bd9Sstevel@tonic-gate 
11117c478bd9Sstevel@tonic-gate /*
11127c478bd9Sstevel@tonic-gate  * PUTPUBFH: Set public filehandle
11137c478bd9Sstevel@tonic-gate  */
11147c478bd9Sstevel@tonic-gate struct PUTPUBFH4res {
11157c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: public fh */
11167c478bd9Sstevel@tonic-gate 	nfsstat4	status;
11177c478bd9Sstevel@tonic-gate };
11187c478bd9Sstevel@tonic-gate 
11197c478bd9Sstevel@tonic-gate /*
11207c478bd9Sstevel@tonic-gate  * PUTROOTFH: Set root filehandle
11217c478bd9Sstevel@tonic-gate  */
11227c478bd9Sstevel@tonic-gate struct PUTROOTFH4res {
11237c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: root fh */
11247c478bd9Sstevel@tonic-gate 	nfsstat4	status;
11257c478bd9Sstevel@tonic-gate };
11267c478bd9Sstevel@tonic-gate 
11277c478bd9Sstevel@tonic-gate /*
11287c478bd9Sstevel@tonic-gate  * READ: Read from file
11297c478bd9Sstevel@tonic-gate  */
11307c478bd9Sstevel@tonic-gate struct READ4args {
11317c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
11327c478bd9Sstevel@tonic-gate 	stateid4	stateid;
11337c478bd9Sstevel@tonic-gate 	offset4		offset;
11347c478bd9Sstevel@tonic-gate 	count4		count;
11357c478bd9Sstevel@tonic-gate };
11367c478bd9Sstevel@tonic-gate 
11377c478bd9Sstevel@tonic-gate struct READ4resok {
11387c478bd9Sstevel@tonic-gate 	bool		eof;
11397c478bd9Sstevel@tonic-gate 	opaque		data<>;
11407c478bd9Sstevel@tonic-gate };
11417c478bd9Sstevel@tonic-gate 
11427c478bd9Sstevel@tonic-gate union READ4res switch (nfsstat4 status) {
11437c478bd9Sstevel@tonic-gate  case NFS4_OK:
11447c478bd9Sstevel@tonic-gate 	 READ4resok	resok4;
11457c478bd9Sstevel@tonic-gate  default:
11467c478bd9Sstevel@tonic-gate 	 void;
11477c478bd9Sstevel@tonic-gate };
11487c478bd9Sstevel@tonic-gate 
11497c478bd9Sstevel@tonic-gate /*
11507c478bd9Sstevel@tonic-gate  * READDIR: Read directory
11517c478bd9Sstevel@tonic-gate  */
11527c478bd9Sstevel@tonic-gate struct READDIR4args {
11537c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
11547c478bd9Sstevel@tonic-gate 	nfs_cookie4	cookie;
11557c478bd9Sstevel@tonic-gate 	verifier4	cookieverf;
11567c478bd9Sstevel@tonic-gate 	count4		dircount;
11577c478bd9Sstevel@tonic-gate 	count4		maxcount;
11587c478bd9Sstevel@tonic-gate 	bitmap4		attr_request;
11597c478bd9Sstevel@tonic-gate };
11607c478bd9Sstevel@tonic-gate 
11617c478bd9Sstevel@tonic-gate struct entry4 {
11627c478bd9Sstevel@tonic-gate 	nfs_cookie4	cookie;
11637c478bd9Sstevel@tonic-gate 	component4	name;
11647c478bd9Sstevel@tonic-gate 	fattr4		attrs;
11657c478bd9Sstevel@tonic-gate 	entry4		*nextentry;
11667c478bd9Sstevel@tonic-gate };
11677c478bd9Sstevel@tonic-gate 
11687c478bd9Sstevel@tonic-gate struct dirlist4 {
11697c478bd9Sstevel@tonic-gate 	entry4		*entries;
11707c478bd9Sstevel@tonic-gate 	bool		eof;
11717c478bd9Sstevel@tonic-gate };
11727c478bd9Sstevel@tonic-gate 
11737c478bd9Sstevel@tonic-gate struct READDIR4resok {
11747c478bd9Sstevel@tonic-gate 	verifier4	cookieverf;
11757c478bd9Sstevel@tonic-gate 	dirlist4	reply;
11767c478bd9Sstevel@tonic-gate };
11777c478bd9Sstevel@tonic-gate 
11787c478bd9Sstevel@tonic-gate 
11797c478bd9Sstevel@tonic-gate union READDIR4res switch (nfsstat4 status) {
11807c478bd9Sstevel@tonic-gate  case NFS4_OK:
11817c478bd9Sstevel@tonic-gate 	 READDIR4resok	resok4;
11827c478bd9Sstevel@tonic-gate  default:
11837c478bd9Sstevel@tonic-gate 	 void;
11847c478bd9Sstevel@tonic-gate };
11857c478bd9Sstevel@tonic-gate 
11867c478bd9Sstevel@tonic-gate 
11877c478bd9Sstevel@tonic-gate /*
11887c478bd9Sstevel@tonic-gate  * READLINK: Read symbolic link
11897c478bd9Sstevel@tonic-gate  */
11907c478bd9Sstevel@tonic-gate struct READLINK4resok {
11917c478bd9Sstevel@tonic-gate 	linktext4	link;
11927c478bd9Sstevel@tonic-gate };
11937c478bd9Sstevel@tonic-gate 
11947c478bd9Sstevel@tonic-gate union READLINK4res switch (nfsstat4 status) {
11957c478bd9Sstevel@tonic-gate  case NFS4_OK:
11967c478bd9Sstevel@tonic-gate 	 READLINK4resok	resok4;
11977c478bd9Sstevel@tonic-gate  default:
11987c478bd9Sstevel@tonic-gate 	 void;
11997c478bd9Sstevel@tonic-gate };
12007c478bd9Sstevel@tonic-gate 
12017c478bd9Sstevel@tonic-gate /*
12027c478bd9Sstevel@tonic-gate  * REMOVE: Remove filesystem object
12037c478bd9Sstevel@tonic-gate  */
12047c478bd9Sstevel@tonic-gate struct REMOVE4args {
12057c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
12067c478bd9Sstevel@tonic-gate 	component4	target;
12077c478bd9Sstevel@tonic-gate };
12087c478bd9Sstevel@tonic-gate 
12097c478bd9Sstevel@tonic-gate struct REMOVE4resok {
12107c478bd9Sstevel@tonic-gate 	change_info4	cinfo;
12117c478bd9Sstevel@tonic-gate };
12127c478bd9Sstevel@tonic-gate 
12137c478bd9Sstevel@tonic-gate union REMOVE4res switch (nfsstat4 status) {
12147c478bd9Sstevel@tonic-gate  case NFS4_OK:
12157c478bd9Sstevel@tonic-gate 	 REMOVE4resok	resok4;
12167c478bd9Sstevel@tonic-gate  default:
12177c478bd9Sstevel@tonic-gate 	 void;
12187c478bd9Sstevel@tonic-gate };
12197c478bd9Sstevel@tonic-gate 
12207c478bd9Sstevel@tonic-gate /*
12217c478bd9Sstevel@tonic-gate  * RENAME: Rename directory entry
12227c478bd9Sstevel@tonic-gate  */
12237c478bd9Sstevel@tonic-gate struct RENAME4args {
12247c478bd9Sstevel@tonic-gate 	/* SAVED_FH: source directory */
12257c478bd9Sstevel@tonic-gate 	component4	oldname;
12267c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: target directory */
12277c478bd9Sstevel@tonic-gate 	component4	newname;
12287c478bd9Sstevel@tonic-gate };
12297c478bd9Sstevel@tonic-gate 
12307c478bd9Sstevel@tonic-gate struct RENAME4resok {
12317c478bd9Sstevel@tonic-gate 	change_info4	source_cinfo;
12327c478bd9Sstevel@tonic-gate 	change_info4	target_cinfo;
12337c478bd9Sstevel@tonic-gate };
12347c478bd9Sstevel@tonic-gate 
12357c478bd9Sstevel@tonic-gate union RENAME4res switch (nfsstat4 status) {
12367c478bd9Sstevel@tonic-gate  case NFS4_OK:
12377c478bd9Sstevel@tonic-gate 	RENAME4resok	resok4;
12387c478bd9Sstevel@tonic-gate  default:
12397c478bd9Sstevel@tonic-gate 	void;
12407c478bd9Sstevel@tonic-gate };
12417c478bd9Sstevel@tonic-gate 
12427c478bd9Sstevel@tonic-gate /*
12437c478bd9Sstevel@tonic-gate  * RENEW: Renew a Lease
12447c478bd9Sstevel@tonic-gate  */
12457c478bd9Sstevel@tonic-gate struct RENEW4args {
12467c478bd9Sstevel@tonic-gate 	clientid4	clientid;
12477c478bd9Sstevel@tonic-gate };
12487c478bd9Sstevel@tonic-gate 
12497c478bd9Sstevel@tonic-gate struct RENEW4res {
12507c478bd9Sstevel@tonic-gate 	nfsstat4	status;
12517c478bd9Sstevel@tonic-gate };
12527c478bd9Sstevel@tonic-gate 
12537c478bd9Sstevel@tonic-gate /*
12547c478bd9Sstevel@tonic-gate  * RESTOREFH: Restore saved filehandle
12557c478bd9Sstevel@tonic-gate  */
12567c478bd9Sstevel@tonic-gate 
12577c478bd9Sstevel@tonic-gate struct RESTOREFH4res {
12587c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: value of saved fh */
12597c478bd9Sstevel@tonic-gate 	nfsstat4	status;
12607c478bd9Sstevel@tonic-gate };
12617c478bd9Sstevel@tonic-gate 
12627c478bd9Sstevel@tonic-gate /*
12637c478bd9Sstevel@tonic-gate  * SAVEFH: Save current filehandle
12647c478bd9Sstevel@tonic-gate  */
12657c478bd9Sstevel@tonic-gate struct SAVEFH4res {
12667c478bd9Sstevel@tonic-gate 	/* SAVED_FH: value of current fh */
12677c478bd9Sstevel@tonic-gate 	nfsstat4	status;
12687c478bd9Sstevel@tonic-gate };
12697c478bd9Sstevel@tonic-gate 
12707c478bd9Sstevel@tonic-gate /*
12717c478bd9Sstevel@tonic-gate  * SECINFO: Obtain Available Security Mechanisms
12727c478bd9Sstevel@tonic-gate  */
12737c478bd9Sstevel@tonic-gate struct SECINFO4args {
12747c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: directory */
12757c478bd9Sstevel@tonic-gate 	component4	name;
12767c478bd9Sstevel@tonic-gate };
12777c478bd9Sstevel@tonic-gate 
12787c478bd9Sstevel@tonic-gate /*
12797c478bd9Sstevel@tonic-gate  * From RFC 2203
12807c478bd9Sstevel@tonic-gate  */
12817c478bd9Sstevel@tonic-gate enum rpc_gss_svc_t {
12827c478bd9Sstevel@tonic-gate 	RPC_GSS_SVC_NONE	= 1,
12837c478bd9Sstevel@tonic-gate 	RPC_GSS_SVC_INTEGRITY	= 2,
12847c478bd9Sstevel@tonic-gate 	RPC_GSS_SVC_PRIVACY	= 3
12857c478bd9Sstevel@tonic-gate };
12867c478bd9Sstevel@tonic-gate 
12877c478bd9Sstevel@tonic-gate struct rpcsec_gss_info {
12887c478bd9Sstevel@tonic-gate 	sec_oid4	oid;
12897c478bd9Sstevel@tonic-gate 	qop4		qop;
12907c478bd9Sstevel@tonic-gate 	rpc_gss_svc_t	service;
12917c478bd9Sstevel@tonic-gate };
12927c478bd9Sstevel@tonic-gate 
12937c478bd9Sstevel@tonic-gate /* RPCSEC_GSS has a value of '6' - See RFC 2203 */
12947c478bd9Sstevel@tonic-gate union secinfo4 switch (uint32_t flavor) {
12957c478bd9Sstevel@tonic-gate  case RPCSEC_GSS:
12967c478bd9Sstevel@tonic-gate 	 rpcsec_gss_info	flavor_info;
12977c478bd9Sstevel@tonic-gate  default:
12987c478bd9Sstevel@tonic-gate 	 void;
12997c478bd9Sstevel@tonic-gate };
13007c478bd9Sstevel@tonic-gate 
13017c478bd9Sstevel@tonic-gate typedef secinfo4 SECINFO4resok<>;
13027c478bd9Sstevel@tonic-gate 
13037c478bd9Sstevel@tonic-gate union SECINFO4res switch (nfsstat4 status) {
13047c478bd9Sstevel@tonic-gate  case NFS4_OK:
13057c478bd9Sstevel@tonic-gate 	 SECINFO4resok resok4;
13067c478bd9Sstevel@tonic-gate  default:
13077c478bd9Sstevel@tonic-gate 	 void;
13087c478bd9Sstevel@tonic-gate };
13097c478bd9Sstevel@tonic-gate 
13107c478bd9Sstevel@tonic-gate /*
13117c478bd9Sstevel@tonic-gate  * SETATTR: Set attributes
13127c478bd9Sstevel@tonic-gate  */
13137c478bd9Sstevel@tonic-gate struct SETATTR4args {
13147c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: target object */
13157c478bd9Sstevel@tonic-gate 	stateid4	stateid;
13167c478bd9Sstevel@tonic-gate 	fattr4		obj_attributes;
13177c478bd9Sstevel@tonic-gate };
13187c478bd9Sstevel@tonic-gate 
13197c478bd9Sstevel@tonic-gate struct SETATTR4res {
13207c478bd9Sstevel@tonic-gate 	nfsstat4	status;
13217c478bd9Sstevel@tonic-gate 	bitmap4		attrsset;
13227c478bd9Sstevel@tonic-gate };
13237c478bd9Sstevel@tonic-gate 
13247c478bd9Sstevel@tonic-gate /*
13257c478bd9Sstevel@tonic-gate  * SETCLIENTID
13267c478bd9Sstevel@tonic-gate  */
13277c478bd9Sstevel@tonic-gate struct SETCLIENTID4args {
13287c478bd9Sstevel@tonic-gate 	nfs_client_id4	client;
13297c478bd9Sstevel@tonic-gate 	cb_client4	callback;
13307c478bd9Sstevel@tonic-gate 	uint32_t	callback_ident;
13317c478bd9Sstevel@tonic-gate };
13327c478bd9Sstevel@tonic-gate 
13337c478bd9Sstevel@tonic-gate struct SETCLIENTID4resok {
13347c478bd9Sstevel@tonic-gate 	clientid4	clientid;
13357c478bd9Sstevel@tonic-gate 	verifier4	setclientid_confirm;
13367c478bd9Sstevel@tonic-gate };
13377c478bd9Sstevel@tonic-gate 
13387c478bd9Sstevel@tonic-gate union SETCLIENTID4res switch (nfsstat4 status) {
13397c478bd9Sstevel@tonic-gate  case NFS4_OK:
13407c478bd9Sstevel@tonic-gate 	 SETCLIENTID4resok	resok4;
13417c478bd9Sstevel@tonic-gate  case NFS4ERR_CLID_INUSE:
13427c478bd9Sstevel@tonic-gate 	 clientaddr4	client_using;
13437c478bd9Sstevel@tonic-gate  default:
13447c478bd9Sstevel@tonic-gate 	 void;
13457c478bd9Sstevel@tonic-gate };
13467c478bd9Sstevel@tonic-gate 
13477c478bd9Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4args {
13487c478bd9Sstevel@tonic-gate 	clientid4	clientid;
13497c478bd9Sstevel@tonic-gate 	verifier4	setclientid_confirm;
13507c478bd9Sstevel@tonic-gate };
13517c478bd9Sstevel@tonic-gate 
13527c478bd9Sstevel@tonic-gate struct SETCLIENTID_CONFIRM4res {
13537c478bd9Sstevel@tonic-gate 	nfsstat4	status;
13547c478bd9Sstevel@tonic-gate };
13557c478bd9Sstevel@tonic-gate 
13567c478bd9Sstevel@tonic-gate /*
13577c478bd9Sstevel@tonic-gate  * VERIFY: Verify attributes same
13587c478bd9Sstevel@tonic-gate  */
13597c478bd9Sstevel@tonic-gate struct VERIFY4args {
13607c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: object */
13617c478bd9Sstevel@tonic-gate 	fattr4		obj_attributes;
13627c478bd9Sstevel@tonic-gate };
13637c478bd9Sstevel@tonic-gate 
13647c478bd9Sstevel@tonic-gate struct VERIFY4res {
13657c478bd9Sstevel@tonic-gate 	nfsstat4	status;
13667c478bd9Sstevel@tonic-gate };
13677c478bd9Sstevel@tonic-gate 
13687c478bd9Sstevel@tonic-gate /*
13697c478bd9Sstevel@tonic-gate  * WRITE: Write to file
13707c478bd9Sstevel@tonic-gate  */
13717c478bd9Sstevel@tonic-gate enum stable_how4 {
13727c478bd9Sstevel@tonic-gate 	UNSTABLE4	= 0,
13737c478bd9Sstevel@tonic-gate 	DATA_SYNC4	= 1,
13747c478bd9Sstevel@tonic-gate 	FILE_SYNC4	= 2
13757c478bd9Sstevel@tonic-gate };
13767c478bd9Sstevel@tonic-gate 
13777c478bd9Sstevel@tonic-gate struct WRITE4args {
13787c478bd9Sstevel@tonic-gate 	/* CURRENT_FH: file */
13797c478bd9Sstevel@tonic-gate 	stateid4	stateid;
13807c478bd9Sstevel@tonic-gate 	offset4		offset;
13817c478bd9Sstevel@tonic-gate 	stable_how4	stable;
13827c478bd9Sstevel@tonic-gate 	opaque		data<>;
13837c478bd9Sstevel@tonic-gate };
13847c478bd9Sstevel@tonic-gate 
13857c478bd9Sstevel@tonic-gate struct WRITE4resok {
13867c478bd9Sstevel@tonic-gate 	count4		count;
13877c478bd9Sstevel@tonic-gate 	stable_how4	committed;
13887c478bd9Sstevel@tonic-gate 	verifier4	writeverf;
13897c478bd9Sstevel@tonic-gate };
13907c478bd9Sstevel@tonic-gate 
13917c478bd9Sstevel@tonic-gate union WRITE4res switch (nfsstat4 status) {
13927c478bd9Sstevel@tonic-gate  case NFS4_OK:
13937c478bd9Sstevel@tonic-gate 	 WRITE4resok	resok4;
13947c478bd9Sstevel@tonic-gate  default:
13957c478bd9Sstevel@tonic-gate 	 void;
13967c478bd9Sstevel@tonic-gate };
13977c478bd9Sstevel@tonic-gate 
13987c478bd9Sstevel@tonic-gate /*
13997c478bd9Sstevel@tonic-gate  * RELEASE_LOCKOWNER: Notify server to release lockowner
14007c478bd9Sstevel@tonic-gate  */
14017c478bd9Sstevel@tonic-gate struct RELEASE_LOCKOWNER4args {
14027c478bd9Sstevel@tonic-gate 	lock_owner4	lock_owner;
14037c478bd9Sstevel@tonic-gate };
14047c478bd9Sstevel@tonic-gate 
14057c478bd9Sstevel@tonic-gate struct RELEASE_LOCKOWNER4res {
14067c478bd9Sstevel@tonic-gate 	nfsstat4	status;
14077c478bd9Sstevel@tonic-gate };
14087c478bd9Sstevel@tonic-gate 
14097c478bd9Sstevel@tonic-gate /*
14107c478bd9Sstevel@tonic-gate  * ILLEGAL: Response for illegal operation numbers
14117c478bd9Sstevel@tonic-gate  */
14127c478bd9Sstevel@tonic-gate struct ILLEGAL4res {
14137c478bd9Sstevel@tonic-gate 	nfsstat4        status;
14147c478bd9Sstevel@tonic-gate };
14157c478bd9Sstevel@tonic-gate 
14167c478bd9Sstevel@tonic-gate /*
14177c478bd9Sstevel@tonic-gate  * Operation arrays
14187c478bd9Sstevel@tonic-gate  */
14197c478bd9Sstevel@tonic-gate 
14207c478bd9Sstevel@tonic-gate enum nfs_opnum4 {
14217c478bd9Sstevel@tonic-gate 	OP_ACCESS		= 3,
14227c478bd9Sstevel@tonic-gate 	OP_CLOSE		= 4,
14237c478bd9Sstevel@tonic-gate 	OP_COMMIT		= 5,
14247c478bd9Sstevel@tonic-gate 	OP_CREATE		= 6,
14257c478bd9Sstevel@tonic-gate 	OP_DELEGPURGE		= 7,
14267c478bd9Sstevel@tonic-gate 	OP_DELEGRETURN		= 8,
14277c478bd9Sstevel@tonic-gate 	OP_GETATTR		= 9,
14287c478bd9Sstevel@tonic-gate 	OP_GETFH		= 10,
14297c478bd9Sstevel@tonic-gate 	OP_LINK			= 11,
14307c478bd9Sstevel@tonic-gate 	OP_LOCK			= 12,
14317c478bd9Sstevel@tonic-gate 	OP_LOCKT		= 13,
14327c478bd9Sstevel@tonic-gate 	OP_LOCKU		= 14,
14337c478bd9Sstevel@tonic-gate 	OP_LOOKUP		= 15,
14347c478bd9Sstevel@tonic-gate 	OP_LOOKUPP		= 16,
14357c478bd9Sstevel@tonic-gate 	OP_NVERIFY		= 17,
14367c478bd9Sstevel@tonic-gate 	OP_OPEN			= 18,
14377c478bd9Sstevel@tonic-gate 	OP_OPENATTR		= 19,
14387c478bd9Sstevel@tonic-gate 	OP_OPEN_CONFIRM		= 20,
14397c478bd9Sstevel@tonic-gate 	OP_OPEN_DOWNGRADE	= 21,
14407c478bd9Sstevel@tonic-gate 	OP_PUTFH		= 22,
14417c478bd9Sstevel@tonic-gate 	OP_PUTPUBFH		= 23,
14427c478bd9Sstevel@tonic-gate 	OP_PUTROOTFH		= 24,
14437c478bd9Sstevel@tonic-gate 	OP_READ			= 25,
14447c478bd9Sstevel@tonic-gate 	OP_READDIR		= 26,
14457c478bd9Sstevel@tonic-gate 	OP_READLINK		= 27,
14467c478bd9Sstevel@tonic-gate 	OP_REMOVE		= 28,
14477c478bd9Sstevel@tonic-gate 	OP_RENAME		= 29,
14487c478bd9Sstevel@tonic-gate 	OP_RENEW		= 30,
14497c478bd9Sstevel@tonic-gate 	OP_RESTOREFH		= 31,
14507c478bd9Sstevel@tonic-gate 	OP_SAVEFH		= 32,
14517c478bd9Sstevel@tonic-gate 	OP_SECINFO		= 33,
14527c478bd9Sstevel@tonic-gate 	OP_SETATTR		= 34,
14537c478bd9Sstevel@tonic-gate 	OP_SETCLIENTID		= 35,
14547c478bd9Sstevel@tonic-gate 	OP_SETCLIENTID_CONFIRM	= 36,
14557c478bd9Sstevel@tonic-gate 	OP_VERIFY		= 37,
14567c478bd9Sstevel@tonic-gate 	OP_WRITE		= 38,
14577c478bd9Sstevel@tonic-gate 	OP_RELEASE_LOCKOWNER	= 39,
14587c478bd9Sstevel@tonic-gate 	OP_ILLEGAL		= 10044
14597c478bd9Sstevel@tonic-gate };
14607c478bd9Sstevel@tonic-gate 
14617c478bd9Sstevel@tonic-gate union nfs_argop4 switch (nfs_opnum4 argop) {
14627c478bd9Sstevel@tonic-gate  case OP_ACCESS:	ACCESS4args opaccess;
14637c478bd9Sstevel@tonic-gate  case OP_CLOSE:		CLOSE4args opclose;
14647c478bd9Sstevel@tonic-gate  case OP_COMMIT:	COMMIT4args opcommit;
14657c478bd9Sstevel@tonic-gate  case OP_CREATE:	CREATE4args opcreate;
14667c478bd9Sstevel@tonic-gate  case OP_DELEGPURGE:	DELEGPURGE4args opdelegpurge;
14677c478bd9Sstevel@tonic-gate  case OP_DELEGRETURN:	DELEGRETURN4args opdelegreturn;
14687c478bd9Sstevel@tonic-gate  case OP_GETATTR:	GETATTR4args opgetattr;
14697c478bd9Sstevel@tonic-gate  case OP_GETFH:		void;
14707c478bd9Sstevel@tonic-gate  case OP_LINK:		LINK4args oplink;
14717c478bd9Sstevel@tonic-gate  case OP_LOCK:		LOCK4args oplock;
14727c478bd9Sstevel@tonic-gate  case OP_LOCKT:		LOCKT4args oplockt;
14737c478bd9Sstevel@tonic-gate  case OP_LOCKU:		LOCKU4args oplocku;
14747c478bd9Sstevel@tonic-gate  case OP_LOOKUP:	LOOKUP4args oplookup;
14757c478bd9Sstevel@tonic-gate  case OP_LOOKUPP:	void;
14767c478bd9Sstevel@tonic-gate  case OP_NVERIFY:	NVERIFY4args opnverify;
14777c478bd9Sstevel@tonic-gate  case OP_OPEN:		OPEN4args opopen;
14787c478bd9Sstevel@tonic-gate  case OP_OPENATTR:	OPENATTR4args opopenattr;
14797c478bd9Sstevel@tonic-gate  case OP_OPEN_CONFIRM:	OPEN_CONFIRM4args opopen_confirm;
14807c478bd9Sstevel@tonic-gate  case OP_OPEN_DOWNGRADE:	OPEN_DOWNGRADE4args opopen_downgrade;
14817c478bd9Sstevel@tonic-gate  case OP_PUTFH:		PUTFH4args opputfh;
14827c478bd9Sstevel@tonic-gate  case OP_PUTPUBFH:	void;
14837c478bd9Sstevel@tonic-gate  case OP_PUTROOTFH:	void;
14847c478bd9Sstevel@tonic-gate  case OP_READ:		READ4args opread;
14857c478bd9Sstevel@tonic-gate  case OP_READDIR:	READDIR4args opreaddir;
14867c478bd9Sstevel@tonic-gate  case OP_READLINK:	void;
14877c478bd9Sstevel@tonic-gate  case OP_REMOVE:	REMOVE4args opremove;
14887c478bd9Sstevel@tonic-gate  case OP_RENAME:	RENAME4args oprename;
14897c478bd9Sstevel@tonic-gate  case OP_RENEW:		RENEW4args oprenew;
14907c478bd9Sstevel@tonic-gate  case OP_RESTOREFH:	void;
14917c478bd9Sstevel@tonic-gate  case OP_SAVEFH:	void;
14927c478bd9Sstevel@tonic-gate  case OP_SECINFO:	SECINFO4args opsecinfo;
14937c478bd9Sstevel@tonic-gate  case OP_SETATTR:	SETATTR4args opsetattr;
14947c478bd9Sstevel@tonic-gate  case OP_SETCLIENTID:	SETCLIENTID4args opsetclientid;
14957c478bd9Sstevel@tonic-gate  case OP_SETCLIENTID_CONFIRM:	SETCLIENTID_CONFIRM4args
14967c478bd9Sstevel@tonic-gate 					opsetclientid_confirm;
14977c478bd9Sstevel@tonic-gate  case OP_VERIFY:	VERIFY4args opverify;
14987c478bd9Sstevel@tonic-gate  case OP_WRITE:		WRITE4args opwrite;
14997c478bd9Sstevel@tonic-gate  case OP_RELEASE_LOCKOWNER:	RELEASE_LOCKOWNER4args
15007c478bd9Sstevel@tonic-gate 				    oprelease_lockowner;
15017c478bd9Sstevel@tonic-gate  case OP_ILLEGAL:	void;
15027c478bd9Sstevel@tonic-gate };
15037c478bd9Sstevel@tonic-gate 
15047c478bd9Sstevel@tonic-gate union nfs_resop4 switch (nfs_opnum4 resop){
15057c478bd9Sstevel@tonic-gate  case OP_ACCESS:	ACCESS4res opaccess;
15067c478bd9Sstevel@tonic-gate  case OP_CLOSE:		CLOSE4res opclose;
15077c478bd9Sstevel@tonic-gate  case OP_COMMIT:	COMMIT4res opcommit;
15087c478bd9Sstevel@tonic-gate  case OP_CREATE:	CREATE4res opcreate;
15097c478bd9Sstevel@tonic-gate  case OP_DELEGPURGE:	DELEGPURGE4res opdelegpurge;
15107c478bd9Sstevel@tonic-gate  case OP_DELEGRETURN:	DELEGRETURN4res opdelegreturn;
15117c478bd9Sstevel@tonic-gate  case OP_GETATTR:	GETATTR4res opgetattr;
15127c478bd9Sstevel@tonic-gate  case OP_GETFH:		GETFH4res opgetfh;
15137c478bd9Sstevel@tonic-gate  case OP_LINK:		LINK4res oplink;
15147c478bd9Sstevel@tonic-gate  case OP_LOCK:		LOCK4res oplock;
15157c478bd9Sstevel@tonic-gate  case OP_LOCKT:		LOCKT4res oplockt;
15167c478bd9Sstevel@tonic-gate  case OP_LOCKU:		LOCKU4res oplocku;
15177c478bd9Sstevel@tonic-gate  case OP_LOOKUP:	LOOKUP4res oplookup;
15187c478bd9Sstevel@tonic-gate  case OP_LOOKUPP:	LOOKUPP4res oplookupp;
15197c478bd9Sstevel@tonic-gate  case OP_NVERIFY:	NVERIFY4res opnverify;
15207c478bd9Sstevel@tonic-gate  case OP_OPEN:		OPEN4res opopen;
15217c478bd9Sstevel@tonic-gate  case OP_OPENATTR:	OPENATTR4res opopenattr;
15227c478bd9Sstevel@tonic-gate  case OP_OPEN_CONFIRM:	OPEN_CONFIRM4res opopen_confirm;
15237c478bd9Sstevel@tonic-gate  case OP_OPEN_DOWNGRADE:	OPEN_DOWNGRADE4res opopen_downgrade;
15247c478bd9Sstevel@tonic-gate  case OP_PUTFH:		PUTFH4res opputfh;
15257c478bd9Sstevel@tonic-gate  case OP_PUTPUBFH:	PUTPUBFH4res opputpubfh;
15267c478bd9Sstevel@tonic-gate  case OP_PUTROOTFH:	PUTROOTFH4res opputrootfh;
15277c478bd9Sstevel@tonic-gate  case OP_READ:		READ4res opread;
15287c478bd9Sstevel@tonic-gate  case OP_READDIR:	READDIR4res opreaddir;
15297c478bd9Sstevel@tonic-gate  case OP_READLINK:	READLINK4res opreadlink;
15307c478bd9Sstevel@tonic-gate  case OP_REMOVE:	REMOVE4res opremove;
15317c478bd9Sstevel@tonic-gate  case OP_RENAME:	RENAME4res oprename;
15327c478bd9Sstevel@tonic-gate  case OP_RENEW:		RENEW4res oprenew;
15337c478bd9Sstevel@tonic-gate  case OP_RESTOREFH:	RESTOREFH4res oprestorefh;
15347c478bd9Sstevel@tonic-gate  case OP_SAVEFH:	SAVEFH4res opsavefh;
15357c478bd9Sstevel@tonic-gate  case OP_SECINFO:	SECINFO4res opsecinfo;
15367c478bd9Sstevel@tonic-gate  case OP_SETATTR:	SETATTR4res opsetattr;
15377c478bd9Sstevel@tonic-gate  case OP_SETCLIENTID:	SETCLIENTID4res opsetclientid;
15387c478bd9Sstevel@tonic-gate  case OP_SETCLIENTID_CONFIRM:	SETCLIENTID_CONFIRM4res
15397c478bd9Sstevel@tonic-gate 					opsetclientid_confirm;
15407c478bd9Sstevel@tonic-gate  case OP_VERIFY:	VERIFY4res opverify;
15417c478bd9Sstevel@tonic-gate  case OP_WRITE:		WRITE4res opwrite;
15427c478bd9Sstevel@tonic-gate  case OP_RELEASE_LOCKOWNER:	RELEASE_LOCKOWNER4res
15437c478bd9Sstevel@tonic-gate 				    oprelease_lockowner;
15447c478bd9Sstevel@tonic-gate  case OP_ILLEGAL:	ILLEGAL4res opillegal;
15457c478bd9Sstevel@tonic-gate };
15467c478bd9Sstevel@tonic-gate 
15477c478bd9Sstevel@tonic-gate struct COMPOUND4args {
15487c478bd9Sstevel@tonic-gate 	utf8str_cs	tag;
15497c478bd9Sstevel@tonic-gate 	uint32_t	minorversion;
15507c478bd9Sstevel@tonic-gate 	nfs_argop4	argarray<>;
15517c478bd9Sstevel@tonic-gate };
15527c478bd9Sstevel@tonic-gate 
15537c478bd9Sstevel@tonic-gate struct COMPOUND4res {
15547c478bd9Sstevel@tonic-gate 	nfsstat4 status;
15557c478bd9Sstevel@tonic-gate 	utf8str_cs	tag;
15567c478bd9Sstevel@tonic-gate 	nfs_resop4	resarray<>;
15577c478bd9Sstevel@tonic-gate };
15587c478bd9Sstevel@tonic-gate 
15597c478bd9Sstevel@tonic-gate /*
15607c478bd9Sstevel@tonic-gate  * Remote file service routines
15617c478bd9Sstevel@tonic-gate  */
15627c478bd9Sstevel@tonic-gate program NFS4_PROGRAM {
15637c478bd9Sstevel@tonic-gate 	version NFS_V4 {
15647c478bd9Sstevel@tonic-gate 		void
15657c478bd9Sstevel@tonic-gate 			NFSPROC4_NULL(void) = 0;
15667c478bd9Sstevel@tonic-gate 
15677c478bd9Sstevel@tonic-gate 		COMPOUND4res
15687c478bd9Sstevel@tonic-gate 			NFSPROC4_COMPOUND(COMPOUND4args) = 1;
15697c478bd9Sstevel@tonic-gate 
15707c478bd9Sstevel@tonic-gate 	} = 4;
15717c478bd9Sstevel@tonic-gate } = 100003;
15727c478bd9Sstevel@tonic-gate 
15737c478bd9Sstevel@tonic-gate 
15747c478bd9Sstevel@tonic-gate 
15757c478bd9Sstevel@tonic-gate /*
15767c478bd9Sstevel@tonic-gate  * NFS4 Callback Procedure Definitions and Program
15777c478bd9Sstevel@tonic-gate  */
15787c478bd9Sstevel@tonic-gate 
15797c478bd9Sstevel@tonic-gate /*
15807c478bd9Sstevel@tonic-gate  * CB_GETATTR: Get Current Attributes
15817c478bd9Sstevel@tonic-gate  */
15827c478bd9Sstevel@tonic-gate struct CB_GETATTR4args {
15837c478bd9Sstevel@tonic-gate 	nfs_fh4	fh;
15847c478bd9Sstevel@tonic-gate 	bitmap4	attr_request;
15857c478bd9Sstevel@tonic-gate };
15867c478bd9Sstevel@tonic-gate 
15877c478bd9Sstevel@tonic-gate struct CB_GETATTR4resok {
15887c478bd9Sstevel@tonic-gate 	fattr4	obj_attributes;
15897c478bd9Sstevel@tonic-gate };
15907c478bd9Sstevel@tonic-gate 
15917c478bd9Sstevel@tonic-gate union CB_GETATTR4res switch (nfsstat4 status) {
15927c478bd9Sstevel@tonic-gate  case NFS4_OK:
15937c478bd9Sstevel@tonic-gate 	 CB_GETATTR4resok	resok4;
15947c478bd9Sstevel@tonic-gate  default:
15957c478bd9Sstevel@tonic-gate 	 void;
15967c478bd9Sstevel@tonic-gate };
15977c478bd9Sstevel@tonic-gate 
15987c478bd9Sstevel@tonic-gate /*
15997c478bd9Sstevel@tonic-gate  * CB_RECALL: Recall an Open Delegation
16007c478bd9Sstevel@tonic-gate  */
16017c478bd9Sstevel@tonic-gate struct CB_RECALL4args {
16027c478bd9Sstevel@tonic-gate 	stateid4	stateid;
16037c478bd9Sstevel@tonic-gate 	bool		truncate;
16047c478bd9Sstevel@tonic-gate 	nfs_fh4		fh;
16057c478bd9Sstevel@tonic-gate };
16067c478bd9Sstevel@tonic-gate 
16077c478bd9Sstevel@tonic-gate struct CB_RECALL4res {
16087c478bd9Sstevel@tonic-gate 	nfsstat4	status;
16097c478bd9Sstevel@tonic-gate };
16107c478bd9Sstevel@tonic-gate 
16117c478bd9Sstevel@tonic-gate /*
16127c478bd9Sstevel@tonic-gate  * CB_ILLEGAL: Response for illegal operation numbers
16137c478bd9Sstevel@tonic-gate  */
16147c478bd9Sstevel@tonic-gate struct CB_ILLEGAL4res {
16157c478bd9Sstevel@tonic-gate 	nfsstat4        status;
16167c478bd9Sstevel@tonic-gate };
16177c478bd9Sstevel@tonic-gate 
16187c478bd9Sstevel@tonic-gate /*
16197c478bd9Sstevel@tonic-gate  * Various definitions for CB_COMPOUND
16207c478bd9Sstevel@tonic-gate  */
16217c478bd9Sstevel@tonic-gate enum nfs_cb_opnum4 {
16227c478bd9Sstevel@tonic-gate 	OP_CB_GETATTR		= 3,
16237c478bd9Sstevel@tonic-gate 	OP_CB_RECALL		= 4,
16247c478bd9Sstevel@tonic-gate 	OP_CB_ILLEGAL		= 10044
16257c478bd9Sstevel@tonic-gate };
16267c478bd9Sstevel@tonic-gate 
16277c478bd9Sstevel@tonic-gate union nfs_cb_argop4 switch (unsigned argop) {
16287c478bd9Sstevel@tonic-gate  case OP_CB_GETATTR:	CB_GETATTR4args opcbgetattr;
16297c478bd9Sstevel@tonic-gate  case OP_CB_RECALL:	CB_RECALL4args	opcbrecall;
16307c478bd9Sstevel@tonic-gate  case OP_CB_ILLEGAL:	void;
16317c478bd9Sstevel@tonic-gate };
16327c478bd9Sstevel@tonic-gate 
16337c478bd9Sstevel@tonic-gate union nfs_cb_resop4 switch (unsigned resop){
16347c478bd9Sstevel@tonic-gate  case OP_CB_GETATTR:	CB_GETATTR4res	opcbgetattr;
16357c478bd9Sstevel@tonic-gate  case OP_CB_RECALL:	CB_RECALL4res	opcbrecall;
16367c478bd9Sstevel@tonic-gate  case OP_CB_ILLEGAL:	CB_ILLEGAL4res	opcbillegal;
16377c478bd9Sstevel@tonic-gate };
16387c478bd9Sstevel@tonic-gate 
16397c478bd9Sstevel@tonic-gate struct CB_COMPOUND4args {
16407c478bd9Sstevel@tonic-gate 	utf8str_cs	tag;
16417c478bd9Sstevel@tonic-gate 	uint32_t	minorversion;
16427c478bd9Sstevel@tonic-gate 	uint32_t	callback_ident;
16437c478bd9Sstevel@tonic-gate 	nfs_cb_argop4	argarray<>;
16447c478bd9Sstevel@tonic-gate };
16457c478bd9Sstevel@tonic-gate 
16467c478bd9Sstevel@tonic-gate struct CB_COMPOUND4res {
16477c478bd9Sstevel@tonic-gate 	nfsstat4 status;
16487c478bd9Sstevel@tonic-gate 	utf8str_cs	tag;
16497c478bd9Sstevel@tonic-gate 	nfs_cb_resop4	resarray<>;
16507c478bd9Sstevel@tonic-gate };
16517c478bd9Sstevel@tonic-gate 
16527c478bd9Sstevel@tonic-gate 
16537c478bd9Sstevel@tonic-gate /*
16547c478bd9Sstevel@tonic-gate  * Program number is in the transient range since the client
16557c478bd9Sstevel@tonic-gate  * will assign the exact transient program number and provide
16567c478bd9Sstevel@tonic-gate  * that to the server via the SETCLIENTID operation.
16577c478bd9Sstevel@tonic-gate  */
16587c478bd9Sstevel@tonic-gate program NFS4_CALLBACK {
16597c478bd9Sstevel@tonic-gate 	version NFS_CB {
16607c478bd9Sstevel@tonic-gate 		void
16617c478bd9Sstevel@tonic-gate 			CB_NULL(void) = 0;
16627c478bd9Sstevel@tonic-gate 		CB_COMPOUND4res
16637c478bd9Sstevel@tonic-gate 			CB_COMPOUND(CB_COMPOUND4args) = 1;
16647c478bd9Sstevel@tonic-gate 	} = 1;
16657c478bd9Sstevel@tonic-gate } = 0x40000000;
1666