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