1 /* 2 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 3 * unrestricted use provided that this legend is included on all tape 4 * media and as a part of the software program in whole or part. Users 5 * may copy or modify Sun RPC without charge, but are not authorized 6 * to license or distribute it to anyone else except as part of a product or 7 * program developed by the user. 8 * 9 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 10 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 11 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 12 * 13 * Sun RPC is provided with no support and without any obligation on the 14 * part of Sun Microsystems, Inc. to assist in its use, correction, 15 * modification or enhancement. 16 * 17 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 18 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 19 * OR ANY PART THEREOF. 20 * 21 * In no event will Sun Microsystems, Inc. be liable for any lost revenue 22 * or profits or other special, indirect and consequential damages, even if 23 * Sun has been advised of the possibility of such damages. 24 * 25 * Sun Microsystems, Inc. 26 * 2550 Garcia Avenue 27 * Mountain View, California 94043 28 */ 29 30 #ifndef RPC_HDR 31 %#ifndef lint 32 %/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/ 33 %/*static char sccsid[] = "from: @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ 34 %#endif /* not lint */ 35 %#include <sys/cdefs.h> 36 %__FBSDID("$FreeBSD$"); 37 #endif 38 39 const NFS_PORT = 2049; 40 const NFS_MAXDATA = 8192; 41 const NFS_MAXPATHLEN = 1024; 42 const NFS_MAXNAMLEN = 255; 43 const NFS_FHSIZE = 32; 44 const NFS_COOKIESIZE = 4; 45 const NFS_FIFO_DEV = -1; /* size kludge for named pipes */ 46 47 /* 48 * File types 49 */ 50 const NFSMODE_FMT = 0170000; /* type of file */ 51 const NFSMODE_DIR = 0040000; /* directory */ 52 const NFSMODE_CHR = 0020000; /* character special */ 53 const NFSMODE_BLK = 0060000; /* block special */ 54 const NFSMODE_REG = 0100000; /* regular */ 55 const NFSMODE_LNK = 0120000; /* symbolic link */ 56 const NFSMODE_SOCK = 0140000; /* socket */ 57 const NFSMODE_FIFO = 0010000; /* fifo */ 58 59 /* 60 * Error status 61 */ 62 enum nfsstat { 63 NFS_OK= 0, /* no error */ 64 NFSERR_PERM=1, /* Not owner */ 65 NFSERR_NOENT=2, /* No such file or directory */ 66 NFSERR_IO=5, /* I/O error */ 67 NFSERR_NXIO=6, /* No such device or address */ 68 NFSERR_ACCES=13, /* Permission denied */ 69 NFSERR_EXIST=17, /* File exists */ 70 NFSERR_NODEV=19, /* No such device */ 71 NFSERR_NOTDIR=20, /* Not a directory*/ 72 NFSERR_ISDIR=21, /* Is a directory */ 73 NFSERR_FBIG=27, /* File too large */ 74 NFSERR_NOSPC=28, /* No space left on device */ 75 NFSERR_ROFS=30, /* Read-only file system */ 76 NFSERR_NAMETOOLONG=63, /* File name too long */ 77 NFSERR_NOTEMPTY=66, /* Directory not empty */ 78 NFSERR_DQUOT=69, /* Disc quota exceeded */ 79 NFSERR_STALE=70, /* Stale NFS file handle */ 80 NFSERR_WFLUSH=99 /* write cache flushed */ 81 }; 82 83 /* 84 * File types 85 */ 86 enum ftype { 87 NFNON = 0, /* non-file */ 88 NFREG = 1, /* regular file */ 89 NFDIR = 2, /* directory */ 90 NFBLK = 3, /* block special */ 91 NFCHR = 4, /* character special */ 92 NFLNK = 5, /* symbolic link */ 93 NFSOCK = 6, /* unix domain sockets */ 94 NFBAD = 7, /* unused */ 95 NFFIFO = 8 /* named pipe */ 96 }; 97 98 /* 99 * File access handle 100 */ 101 struct nfs_fh { 102 opaque data[NFS_FHSIZE]; 103 }; 104 105 /* 106 * Timeval 107 */ 108 struct nfstime { 109 unsigned seconds; 110 unsigned useconds; 111 }; 112 113 114 /* 115 * File attributes 116 */ 117 struct fattr { 118 ftype type; /* file type */ 119 unsigned mode; /* protection mode bits */ 120 unsigned nlink; /* # hard links */ 121 unsigned uid; /* owner user id */ 122 unsigned gid; /* owner group id */ 123 unsigned size; /* file size in bytes */ 124 unsigned blocksize; /* preferred block size */ 125 unsigned rdev; /* special device # */ 126 unsigned blocks; /* Kb of disk used by file */ 127 unsigned fsid; /* device # */ 128 unsigned fileid; /* inode # */ 129 nfstime atime; /* time of last access */ 130 nfstime mtime; /* time of last modification */ 131 nfstime ctime; /* time of last change */ 132 }; 133 134 /* 135 * File attributes which can be set 136 */ 137 struct sattr { 138 unsigned mode; /* protection mode bits */ 139 unsigned uid; /* owner user id */ 140 unsigned gid; /* owner group id */ 141 unsigned size; /* file size in bytes */ 142 nfstime atime; /* time of last access */ 143 nfstime mtime; /* time of last modification */ 144 }; 145 146 147 typedef string filename<NFS_MAXNAMLEN>; 148 typedef string nfspath<NFS_MAXPATHLEN>; 149 150 /* 151 * Reply status with file attributes 152 */ 153 union attrstat switch (nfsstat status) { 154 case NFS_OK: 155 fattr attributes; 156 default: 157 void; 158 }; 159 160 struct sattrargs { 161 nfs_fh file; 162 sattr attributes; 163 }; 164 165 /* 166 * Arguments for directory operations 167 */ 168 struct diropargs { 169 nfs_fh dir; /* directory file handle */ 170 filename name; /* name (up to NFS_MAXNAMLEN bytes) */ 171 }; 172 173 struct diropokres { 174 nfs_fh file; 175 fattr attributes; 176 }; 177 178 /* 179 * Results from directory operation 180 */ 181 union diropres switch (nfsstat status) { 182 case NFS_OK: 183 diropokres diropres; 184 default: 185 void; 186 }; 187 188 union readlinkres switch (nfsstat status) { 189 case NFS_OK: 190 nfspath data; 191 default: 192 void; 193 }; 194 195 /* 196 * Arguments to remote read 197 */ 198 struct readargs { 199 nfs_fh file; /* handle for file */ 200 unsigned offset; /* byte offset in file */ 201 unsigned count; /* immediate read count */ 202 unsigned totalcount; /* total read count (from this offset)*/ 203 }; 204 205 /* 206 * Status OK portion of remote read reply 207 */ 208 struct readokres { 209 fattr attributes; /* attributes, need for pagin*/ 210 opaque data<NFS_MAXDATA>; 211 }; 212 213 union readres switch (nfsstat status) { 214 case NFS_OK: 215 readokres reply; 216 default: 217 void; 218 }; 219 220 /* 221 * Arguments to remote write 222 */ 223 struct writeargs { 224 nfs_fh file; /* handle for file */ 225 unsigned beginoffset; /* beginning byte offset in file */ 226 unsigned offset; /* current byte offset in file */ 227 unsigned totalcount; /* total write count (to this offset)*/ 228 opaque data<NFS_MAXDATA>; 229 }; 230 231 struct createargs { 232 diropargs where; 233 sattr attributes; 234 }; 235 236 struct renameargs { 237 diropargs from; 238 diropargs to; 239 }; 240 241 struct linkargs { 242 nfs_fh from; 243 diropargs to; 244 }; 245 246 struct symlinkargs { 247 diropargs from; 248 nfspath to; 249 sattr attributes; 250 }; 251 252 253 typedef opaque nfscookie[NFS_COOKIESIZE]; 254 255 /* 256 * Arguments to readdir 257 */ 258 struct readdirargs { 259 nfs_fh dir; /* directory handle */ 260 nfscookie cookie; 261 unsigned count; /* number of directory bytes to read */ 262 }; 263 264 struct entry { 265 unsigned fileid; 266 filename name; 267 nfscookie cookie; 268 entry *nextentry; 269 }; 270 271 struct dirlist { 272 entry *entries; 273 bool eof; 274 }; 275 276 union readdirres switch (nfsstat status) { 277 case NFS_OK: 278 dirlist reply; 279 default: 280 void; 281 }; 282 283 struct statfsokres { 284 unsigned tsize; /* preferred transfer size in bytes */ 285 unsigned bsize; /* fundamental file system block size */ 286 unsigned blocks; /* total blocks in file system */ 287 unsigned bfree; /* free blocks in fs */ 288 unsigned bavail; /* free blocks avail to non-superuser */ 289 }; 290 291 union statfsres switch (nfsstat status) { 292 case NFS_OK: 293 statfsokres reply; 294 default: 295 void; 296 }; 297 298 #ifdef WANT_NFS3 299 300 /* 301 * NFSv3 constants and types 302 */ 303 const NFS3_FHSIZE = 64; /* maximum size in bytes of a file handle */ 304 const NFS3_COOKIEVERFSIZE = 8; /* size of a cookie verifier for READDIR */ 305 const NFS3_CREATEVERFSIZE = 8; /* size of the verifier used for CREATE */ 306 const NFS3_WRITEVERFSIZE = 8; /* size of the verifier used for WRITE */ 307 308 typedef unsigned hyper uint64; 309 typedef hyper int64; 310 typedef unsigned long uint32; 311 typedef long int32; 312 typedef string filename3<>; 313 typedef string nfspath3<>; 314 typedef uint64 fileid3; 315 typedef uint64 cookie3; 316 typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE]; 317 typedef opaque createverf3[NFS3_CREATEVERFSIZE]; 318 typedef opaque writeverf3[NFS3_WRITEVERFSIZE]; 319 typedef uint32 uid3; 320 typedef uint32 gid3; 321 typedef uint64 size3; 322 typedef uint64 offset3; 323 typedef uint32 mode3; 324 typedef uint32 count3; 325 326 /* 327 * Error status (v3) 328 */ 329 enum nfsstat3 { 330 NFS3_OK = 0, 331 NFS3ERR_PERM = 1, 332 NFS3ERR_NOENT = 2, 333 NFS3ERR_IO = 5, 334 NFS3ERR_NXIO = 6, 335 NFS3ERR_ACCES = 13, 336 NFS3ERR_EXIST = 17, 337 NFS3ERR_XDEV = 18, 338 NFS3ERR_NODEV = 19, 339 NFS3ERR_NOTDIR = 20, 340 NFS3ERR_ISDIR = 21, 341 NFS3ERR_INVAL = 22, 342 NFS3ERR_FBIG = 27, 343 NFS3ERR_NOSPC = 28, 344 NFS3ERR_ROFS = 30, 345 NFS3ERR_MLINK = 31, 346 NFS3ERR_NAMETOOLONG = 63, 347 NFS3ERR_NOTEMPTY = 66, 348 NFS3ERR_DQUOT = 69, 349 NFS3ERR_STALE = 70, 350 NFS3ERR_REMOTE = 71, 351 NFS3ERR_BADHANDLE = 10001, 352 NFS3ERR_NOT_SYNC = 10002, 353 NFS3ERR_BAD_COOKIE = 10003, 354 NFS3ERR_NOTSUPP = 10004, 355 NFS3ERR_TOOSMALL = 10005, 356 NFS3ERR_SERVERFAULT = 10006, 357 NFS3ERR_BADTYPE = 10007, 358 NFS3ERR_JUKEBOX = 10008 359 }; 360 361 /* 362 * File types (v3) 363 */ 364 enum ftype3 { 365 NF3REG = 1, /* regular file */ 366 NF3DIR = 2, /* directory */ 367 NF3BLK = 3, /* block special */ 368 NF3CHR = 4, /* character special */ 369 NF3LNK = 5, /* symbolic link */ 370 NF3SOCK = 6, /* unix domain sockets */ 371 NF3FIFO = 7 /* named pipe */ 372 }; 373 374 struct specdata3 { 375 uint32 specdata1; 376 uint32 specdata2; 377 }; 378 379 /* 380 * File access handle (v3) 381 */ 382 struct nfs_fh3 { 383 opaque data<NFS3_FHSIZE>; 384 }; 385 386 /* 387 * Timeval (v3) 388 */ 389 struct nfstime3 { 390 uint32 seconds; 391 uint32 nseconds; 392 }; 393 394 395 /* 396 * File attributes (v3) 397 */ 398 struct fattr3 { 399 ftype3 type; /* file type */ 400 mode3 mode; /* protection mode bits */ 401 uint32 nlink; /* # hard links */ 402 uid3 uid; /* owner user id */ 403 gid3 gid; /* owner group id */ 404 size3 size; /* file size in bytes */ 405 size3 used; /* preferred block size */ 406 specdata3 rdev; /* special device # */ 407 uint64 fsid; /* device # */ 408 fileid3 fileid; /* inode # */ 409 nfstime3 atime; /* time of last access */ 410 nfstime3 mtime; /* time of last modification */ 411 nfstime3 ctime; /* time of last change */ 412 }; 413 414 union post_op_attr switch (bool attributes_follow) { 415 case TRUE: 416 fattr3 attributes; 417 case FALSE: 418 void; 419 }; 420 421 struct wcc_attr { 422 size3 size; 423 nfstime3 mtime; 424 nfstime3 ctime; 425 }; 426 427 union pre_op_attr switch (bool attributes_follow) { 428 case TRUE: 429 wcc_attr attributes; 430 case FALSE: 431 void; 432 }; 433 434 struct wcc_data { 435 pre_op_attr before; 436 post_op_attr after; 437 }; 438 439 union post_op_fh3 switch (bool handle_follows) { 440 case TRUE: 441 nfs_fh3 handle; 442 case FALSE: 443 void; 444 }; 445 446 /* 447 * File attributes which can be set (v3) 448 */ 449 enum time_how { 450 DONT_CHANGE = 0, 451 SET_TO_SERVER_TIME = 1, 452 SET_TO_CLIENT_TIME = 2 453 }; 454 455 union set_mode3 switch (bool set_it) { 456 case TRUE: 457 mode3 mode; 458 default: 459 void; 460 }; 461 462 union set_uid3 switch (bool set_it) { 463 case TRUE: 464 uid3 uid; 465 default: 466 void; 467 }; 468 469 union set_gid3 switch (bool set_it) { 470 case TRUE: 471 gid3 gid; 472 default: 473 void; 474 }; 475 476 union set_size3 switch (bool set_it) { 477 case TRUE: 478 size3 size; 479 default: 480 void; 481 }; 482 483 union set_atime switch (time_how set_it) { 484 case SET_TO_CLIENT_TIME: 485 nfstime3 atime; 486 default: 487 void; 488 }; 489 490 union set_mtime switch (time_how set_it) { 491 case SET_TO_CLIENT_TIME: 492 nfstime3 mtime; 493 default: 494 void; 495 }; 496 497 struct sattr3 { 498 set_mode3 mode; 499 set_uid3 uid; 500 set_gid3 gid; 501 set_size3 size; 502 set_atime atime; 503 set_mtime mtime; 504 }; 505 506 /* 507 * Arguments for directory operations (v3) 508 */ 509 struct diropargs3 { 510 nfs_fh3 dir; /* directory file handle */ 511 filename3 name; /* name (up to NFS_MAXNAMLEN bytes) */ 512 }; 513 514 /* 515 * Arguments to getattr (v3). 516 */ 517 struct GETATTR3args { 518 nfs_fh3 object; 519 }; 520 521 struct GETATTR3resok { 522 fattr3 obj_attributes; 523 }; 524 525 union GETATTR3res switch (nfsstat3 status) { 526 case NFS3_OK: 527 GETATTR3resok resok; 528 default: 529 void; 530 }; 531 532 /* 533 * Arguments to setattr (v3). 534 */ 535 union sattrguard3 switch (bool check) { 536 case TRUE: 537 nfstime3 obj_ctime; 538 case FALSE: 539 void; 540 }; 541 542 struct SETATTR3args { 543 nfs_fh3 object; 544 sattr3 new_attributes; 545 sattrguard3 guard; 546 }; 547 548 struct SETATTR3resok { 549 wcc_data obj_wcc; 550 }; 551 552 struct SETATTR3resfail { 553 wcc_data obj_wcc; 554 }; 555 556 union SETATTR3res switch (nfsstat3 status) { 557 case NFS3_OK: 558 SETATTR3resok resok; 559 default: 560 SETATTR3resfail resfail; 561 }; 562 563 /* 564 * Arguments to lookup (v3). 565 */ 566 struct LOOKUP3args { 567 diropargs3 what; 568 }; 569 570 struct LOOKUP3resok { 571 nfs_fh3 object; 572 post_op_attr obj_attributes; 573 post_op_attr dir_attributes; 574 }; 575 576 struct LOOKUP3resfail { 577 post_op_attr dir_attributes; 578 }; 579 580 union LOOKUP3res switch (nfsstat3 status) { 581 case NFS3_OK: 582 LOOKUP3resok resok; 583 default: 584 LOOKUP3resfail resfail; 585 }; 586 587 /* 588 * Arguments to access (v3). 589 */ 590 const ACCESS3_READ = 0x0001; 591 const ACCESS3_LOOKUP = 0x0002; 592 const ACCESS3_MODIFY = 0x0004; 593 const ACCESS3_EXTEND = 0x0008; 594 const ACCESS3_DELETE = 0x0010; 595 const ACCESS3_EXECUTE = 0x0020; 596 597 struct ACCESS3args { 598 nfs_fh3 object; 599 uint32 access; 600 }; 601 602 struct ACCESS3resok { 603 post_op_attr obj_attributes; 604 uint32 access; 605 }; 606 607 struct ACCESS3resfail { 608 post_op_attr obj_attributes; 609 }; 610 611 union ACCESS3res switch (nfsstat3 status) { 612 case NFS3_OK: 613 ACCESS3resok resok; 614 default: 615 ACCESS3resfail resfail; 616 }; 617 618 /* 619 * Arguments to readlink (v3). 620 */ 621 struct READLINK3args { 622 nfs_fh3 symlink; 623 }; 624 625 struct READLINK3resok { 626 post_op_attr symlink_attributes; 627 nfspath3 data; 628 }; 629 630 struct READLINK3resfail { 631 post_op_attr symlink_attributes; 632 }; 633 634 union READLINK3res switch (nfsstat3 status) { 635 case NFS3_OK: 636 READLINK3resok resok; 637 default: 638 READLINK3resfail resfail; 639 }; 640 641 /* 642 * Arguments to read (v3). 643 */ 644 struct READ3args { 645 nfs_fh3 file; 646 offset3 offset; 647 count3 count; 648 }; 649 650 struct READ3resok { 651 post_op_attr file_attributes; 652 count3 count; 653 bool eof; 654 opaque data<>; 655 }; 656 657 struct READ3resfail { 658 post_op_attr file_attributes; 659 }; 660 661 /* XXX: solaris 2.6 uses ``nfsstat'' here */ 662 union READ3res switch (nfsstat3 status) { 663 case NFS3_OK: 664 READ3resok resok; 665 default: 666 READ3resfail resfail; 667 }; 668 669 /* 670 * Arguments to write (v3). 671 */ 672 enum stable_how { 673 UNSTABLE = 0, 674 DATA_SYNC = 1, 675 FILE_SYNC = 2 676 }; 677 678 struct WRITE3args { 679 nfs_fh3 file; 680 offset3 offset; 681 count3 count; 682 stable_how stable; 683 opaque data<>; 684 }; 685 686 struct WRITE3resok { 687 wcc_data file_wcc; 688 count3 count; 689 stable_how committed; 690 writeverf3 verf; 691 }; 692 693 struct WRITE3resfail { 694 wcc_data file_wcc; 695 }; 696 697 union WRITE3res switch (nfsstat3 status) { 698 case NFS3_OK: 699 WRITE3resok resok; 700 default: 701 WRITE3resfail resfail; 702 }; 703 704 /* 705 * Arguments to create (v3). 706 */ 707 enum createmode3 { 708 UNCHECKED = 0, 709 GUARDED = 1, 710 EXCLUSIVE = 2 711 }; 712 713 union createhow3 switch (createmode3 mode) { 714 case UNCHECKED: 715 case GUARDED: 716 sattr3 obj_attributes; 717 case EXCLUSIVE: 718 createverf3 verf; 719 }; 720 721 struct CREATE3args { 722 diropargs3 where; 723 createhow3 how; 724 }; 725 726 struct CREATE3resok { 727 post_op_fh3 obj; 728 post_op_attr obj_attributes; 729 wcc_data dir_wcc; 730 }; 731 732 struct CREATE3resfail { 733 wcc_data dir_wcc; 734 }; 735 736 union CREATE3res switch (nfsstat3 status) { 737 case NFS3_OK: 738 CREATE3resok resok; 739 default: 740 CREATE3resfail resfail; 741 }; 742 743 /* 744 * Arguments to mkdir (v3). 745 */ 746 struct MKDIR3args { 747 diropargs3 where; 748 sattr3 attributes; 749 }; 750 751 struct MKDIR3resok { 752 post_op_fh3 obj; 753 post_op_attr obj_attributes; 754 wcc_data dir_wcc; 755 }; 756 757 struct MKDIR3resfail { 758 wcc_data dir_wcc; 759 }; 760 761 union MKDIR3res switch (nfsstat3 status) { 762 case NFS3_OK: 763 MKDIR3resok resok; 764 default: 765 MKDIR3resfail resfail; 766 }; 767 768 /* 769 * Arguments to symlink (v3). 770 */ 771 struct symlinkdata3 { 772 sattr3 symlink_attributes; 773 nfspath3 symlink_data; 774 }; 775 776 struct SYMLINK3args { 777 diropargs3 where; 778 symlinkdata3 symlink; 779 }; 780 781 struct SYMLINK3resok { 782 post_op_fh3 obj; 783 post_op_attr obj_attributes; 784 wcc_data dir_wcc; 785 }; 786 787 struct SYMLINK3resfail { 788 wcc_data dir_wcc; 789 }; 790 791 union SYMLINK3res switch (nfsstat3 status) { 792 case NFS3_OK: 793 SYMLINK3resok resok; 794 default: 795 SYMLINK3resfail resfail; 796 }; 797 798 /* 799 * Arguments to mknod (v3). 800 */ 801 struct devicedata3 { 802 sattr3 dev_attributes; 803 specdata3 spec; 804 }; 805 806 union mknoddata3 switch (ftype3 type) { 807 case NF3CHR: 808 case NF3BLK: 809 devicedata3 device; 810 case NF3SOCK: 811 case NF3FIFO: 812 sattr3 pipe_attributes; 813 default: 814 void; 815 }; 816 817 struct MKNOD3args { 818 diropargs3 where; 819 mknoddata3 what; 820 }; 821 822 struct MKNOD3resok { 823 post_op_fh3 obj; 824 post_op_attr obj_attributes; 825 wcc_data dir_wcc; 826 }; 827 828 struct MKNOD3resfail { 829 wcc_data dir_wcc; 830 }; 831 832 union MKNOD3res switch (nfsstat3 status) { 833 case NFS3_OK: 834 MKNOD3resok resok; 835 default: 836 MKNOD3resfail resfail; 837 }; 838 839 /* 840 * Arguments to remove (v3). 841 */ 842 struct REMOVE3args { 843 diropargs3 object; 844 }; 845 846 struct REMOVE3resok { 847 wcc_data dir_wcc; 848 }; 849 850 struct REMOVE3resfail { 851 wcc_data dir_wcc; 852 }; 853 854 union REMOVE3res switch (nfsstat3 status) { 855 case NFS3_OK: 856 REMOVE3resok resok; 857 default: 858 REMOVE3resfail resfail; 859 }; 860 861 /* 862 * Arguments to rmdir (v3). 863 */ 864 struct RMDIR3args { 865 diropargs3 object; 866 }; 867 868 struct RMDIR3resok { 869 wcc_data dir_wcc; 870 }; 871 872 struct RMDIR3resfail { 873 wcc_data dir_wcc; 874 }; 875 876 union RMDIR3res switch (nfsstat3 status) { 877 case NFS3_OK: 878 RMDIR3resok resok; 879 default: 880 RMDIR3resfail resfail; 881 }; 882 883 /* 884 * Arguments to rename (v3). 885 */ 886 struct RENAME3args { 887 diropargs3 from; 888 diropargs3 to; 889 }; 890 891 struct RENAME3resok { 892 wcc_data fromdir_wcc; 893 wcc_data todir_wcc; 894 }; 895 896 struct RENAME3resfail { 897 wcc_data fromdir_wcc; 898 wcc_data todir_wcc; 899 }; 900 901 union RENAME3res switch (nfsstat3 status) { 902 case NFS3_OK: 903 RENAME3resok resok; 904 default: 905 RENAME3resfail resfail; 906 }; 907 908 /* 909 * Arguments to link (v3). 910 */ 911 struct LINK3args { 912 nfs_fh3 file; 913 diropargs3 link; 914 }; 915 916 struct LINK3resok { 917 post_op_attr file_attributes; 918 wcc_data linkdir_wcc; 919 }; 920 921 struct LINK3resfail { 922 post_op_attr file_attributes; 923 wcc_data linkdir_wcc; 924 }; 925 926 union LINK3res switch (nfsstat3 status) { 927 case NFS3_OK: 928 LINK3resok resok; 929 default: 930 LINK3resfail resfail; 931 }; 932 933 /* 934 * Arguments to readdir (v3). 935 */ 936 struct READDIR3args { 937 nfs_fh3 dir; 938 cookie3 cookie; 939 cookieverf3 cookieverf; 940 count3 count; 941 }; 942 943 struct entry3 { 944 fileid3 fileid; 945 filename3 name; 946 cookie3 cookie; 947 entry3 *nextentry; 948 }; 949 950 struct dirlist3 { 951 entry3 *entries; 952 bool eof; 953 }; 954 955 struct READDIR3resok { 956 post_op_attr dir_attributes; 957 cookieverf3 cookieverf; 958 dirlist3 reply; 959 }; 960 961 struct READDIR3resfail { 962 post_op_attr dir_attributes; 963 }; 964 965 union READDIR3res switch (nfsstat3 status) { 966 case NFS3_OK: 967 READDIR3resok resok; 968 default: 969 READDIR3resfail resfail; 970 }; 971 972 /* 973 * Arguments to readdirplus (v3). 974 */ 975 struct READDIRPLUS3args { 976 nfs_fh3 dir; 977 cookie3 cookie; 978 cookieverf3 cookieverf; 979 count3 dircount; 980 count3 maxcount; 981 }; 982 983 struct entryplus3 { 984 fileid3 fileid; 985 filename3 name; 986 cookie3 cookie; 987 post_op_attr name_attributes; 988 post_op_fh3 name_handle; 989 entryplus3 *nextentry; 990 }; 991 992 struct dirlistplus3 { 993 entryplus3 *entries; 994 bool eof; 995 }; 996 997 struct READDIRPLUS3resok { 998 post_op_attr dir_attributes; 999 cookieverf3 cookieverf; 1000 dirlistplus3 reply; 1001 }; 1002 1003 struct READDIRPLUS3resfail { 1004 post_op_attr dir_attributes; 1005 }; 1006 1007 union READDIRPLUS3res switch (nfsstat3 status) { 1008 case NFS3_OK: 1009 READDIRPLUS3resok resok; 1010 default: 1011 READDIRPLUS3resfail resfail; 1012 }; 1013 1014 /* 1015 * Arguments to fsstat (v3). 1016 */ 1017 struct FSSTAT3args { 1018 nfs_fh3 fsroot; 1019 }; 1020 1021 struct FSSTAT3resok { 1022 post_op_attr obj_attributes; 1023 size3 tbytes; 1024 size3 fbytes; 1025 size3 abytes; 1026 size3 tfiles; 1027 size3 ffiles; 1028 size3 afiles; 1029 uint32 invarsec; 1030 }; 1031 1032 struct FSSTAT3resfail { 1033 post_op_attr obj_attributes; 1034 }; 1035 1036 union FSSTAT3res switch (nfsstat3 status) { 1037 case NFS3_OK: 1038 FSSTAT3resok resok; 1039 default: 1040 FSSTAT3resfail resfail; 1041 }; 1042 1043 /* 1044 * Arguments to fsinfo (v3). 1045 */ 1046 const FSF3_LINK = 0x0001; 1047 const FSF3_SYMLINK = 0x0002; 1048 const FSF3_HOMOGENEOUS = 0x0008; 1049 const FSF3_CANSETTIME = 0x0010; 1050 1051 struct FSINFO3args { 1052 nfs_fh3 fsroot; 1053 }; 1054 1055 struct FSINFO3resok { 1056 post_op_attr obj_attributes; 1057 uint32 rtmax; 1058 uint32 rtpref; 1059 uint32 rtmult; 1060 uint32 wtmax; 1061 uint32 wtpref; 1062 uint32 wtmult; 1063 uint32 dtpref; 1064 size3 maxfilesize; 1065 nfstime3 time_delta; 1066 uint32 properties; 1067 }; 1068 1069 struct FSINFO3resfail { 1070 post_op_attr obj_attributes; 1071 }; 1072 1073 union FSINFO3res switch (nfsstat3 status) { 1074 case NFS3_OK: 1075 FSINFO3resok resok; 1076 default: 1077 FSINFO3resfail resfail; 1078 }; 1079 1080 /* 1081 * Arguments to pathconf (v3). 1082 */ 1083 struct PATHCONF3args { 1084 nfs_fh3 object; 1085 }; 1086 1087 struct PATHCONF3resok { 1088 post_op_attr obj_attributes; 1089 uint32 linkmax; 1090 uint32 name_max; 1091 bool no_trunc; 1092 bool chown_restricted; 1093 bool case_insensitive; 1094 bool case_preserving; 1095 }; 1096 1097 struct PATHCONF3resfail { 1098 post_op_attr obj_attributes; 1099 }; 1100 1101 union PATHCONF3res switch (nfsstat3 status) { 1102 case NFS3_OK: 1103 PATHCONF3resok resok; 1104 default: 1105 PATHCONF3resfail resfail; 1106 }; 1107 1108 /* 1109 * Arguments to commit (v3). 1110 */ 1111 struct COMMIT3args { 1112 nfs_fh3 file; 1113 offset3 offset; 1114 count3 count; 1115 }; 1116 1117 struct COMMIT3resok { 1118 wcc_data file_wcc; 1119 writeverf3 verf; 1120 }; 1121 1122 struct COMMIT3resfail { 1123 wcc_data file_wcc; 1124 }; 1125 1126 union COMMIT3res switch (nfsstat3 status) { 1127 case NFS3_OK: 1128 COMMIT3resok resok; 1129 default: 1130 COMMIT3resfail resfail; 1131 }; 1132 1133 #endif /* WANT_NFS3 */ 1134 1135 /* 1136 * Remote file service routines 1137 */ 1138 program NFS_PROGRAM { 1139 version NFS_VERSION { 1140 void 1141 NFSPROC_NULL(void) = 0; 1142 1143 attrstat 1144 NFSPROC_GETATTR(nfs_fh) = 1; 1145 1146 attrstat 1147 NFSPROC_SETATTR(sattrargs) = 2; 1148 1149 void 1150 NFSPROC_ROOT(void) = 3; 1151 1152 diropres 1153 NFSPROC_LOOKUP(diropargs) = 4; 1154 1155 readlinkres 1156 NFSPROC_READLINK(nfs_fh) = 5; 1157 1158 readres 1159 NFSPROC_READ(readargs) = 6; 1160 1161 void 1162 NFSPROC_WRITECACHE(void) = 7; 1163 1164 attrstat 1165 NFSPROC_WRITE(writeargs) = 8; 1166 1167 diropres 1168 NFSPROC_CREATE(createargs) = 9; 1169 1170 nfsstat 1171 NFSPROC_REMOVE(diropargs) = 10; 1172 1173 nfsstat 1174 NFSPROC_RENAME(renameargs) = 11; 1175 1176 nfsstat 1177 NFSPROC_LINK(linkargs) = 12; 1178 1179 nfsstat 1180 NFSPROC_SYMLINK(symlinkargs) = 13; 1181 1182 diropres 1183 NFSPROC_MKDIR(createargs) = 14; 1184 1185 nfsstat 1186 NFSPROC_RMDIR(diropargs) = 15; 1187 1188 readdirres 1189 NFSPROC_READDIR(readdirargs) = 16; 1190 1191 statfsres 1192 NFSPROC_STATFS(nfs_fh) = 17; 1193 } = 2; 1194 } = 100003; 1195 #ifdef WANT_NFS3 1196 program NFS3_PROGRAM { 1197 version NFS_V3 { 1198 void 1199 NFSPROC3_NULL(void) = 0; 1200 1201 GETATTR3res 1202 NFSPROC3_GETATTR(GETATTR3args) = 1; 1203 1204 SETATTR3res 1205 NFSPROC3_SETATTR(SETATTR3args) = 2; 1206 1207 LOOKUP3res 1208 NFSPROC3_LOOKUP(LOOKUP3args) = 3; 1209 1210 ACCESS3res 1211 NFSPROC3_ACCESS(ACCESS3args) = 4; 1212 1213 READLINK3res 1214 NFSPROC3_READLINK(READLINK3args) = 5; 1215 1216 READ3res 1217 NFSPROC3_READ(READ3args) = 6; 1218 1219 WRITE3res 1220 NFSPROC3_WRITE(WRITE3args) = 7; 1221 1222 CREATE3res 1223 NFSPROC3_CREATE(CREATE3args) = 8; 1224 1225 MKDIR3res 1226 NFSPROC3_MKDIR(MKDIR3args) = 9; 1227 1228 SYMLINK3res 1229 NFSPROC3_SYMLINK(SYMLINK3args) = 10; 1230 1231 MKNOD3res 1232 NFSPROC3_MKNOD(MKNOD3args) = 11; 1233 1234 REMOVE3res 1235 NFSPROC3_REMOVE(REMOVE3args) = 12; 1236 1237 RMDIR3res 1238 NFSPROC3_RMDIR(RMDIR3args) = 13; 1239 1240 RENAME3res 1241 NFSPROC3_RENAME(RENAME3args) = 14; 1242 1243 LINK3res 1244 NFSPROC3_LINK(LINK3args) = 15; 1245 1246 READDIR3res 1247 NFSPROC3_READDIR(READDIR3args) = 16; 1248 1249 READDIRPLUS3res 1250 NFSPROC3_READDIRPLUS(READDIRPLUS3args) = 17; 1251 1252 FSSTAT3res 1253 NFSPROC3_FSSTAT(FSSTAT3args) = 18; 1254 1255 FSINFO3res 1256 NFSPROC3_FSINFO(FSINFO3args) = 19; 1257 1258 PATHCONF3res 1259 NFSPROC3_PATHCONF(PATHCONF3args) = 20; 1260 1261 COMMIT3res 1262 NFSPROC3_COMMIT(COMMIT3args) = 21; 1263 } = 3; 1264 } = 100003; 1265 #endif 1266 1267