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