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