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