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