at master 45 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_NFS_XDR_H 3#define _LINUX_NFS_XDR_H 4 5#include <linux/nfsacl.h> 6#include <linux/sunrpc/gss_api.h> 7 8/* 9 * To change the maximum rsize and wsize supported by the NFS client, adjust 10 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can 11 * support a megabyte or more. The default is left at 4096 bytes, which is 12 * reasonable for NFS over UDP. 13 */ 14#define NFS_MAX_FILE_IO_SIZE (1048576U) 15#define NFS_DEF_FILE_IO_SIZE (4096U) 16#define NFS_MIN_FILE_IO_SIZE (1024U) 17 18#define NFS_BITMASK_SZ 3 19 20struct nfs4_string { 21 unsigned int len; 22 char *data; 23}; 24 25struct nfs_fsid { 26 uint64_t major; 27 uint64_t minor; 28}; 29 30/* 31 * Helper for checking equality between 2 fsids. 32 */ 33static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b) 34{ 35 return a->major == b->major && a->minor == b->minor; 36} 37 38struct nfs4_threshold { 39 __u32 bm; 40 __u32 l_type; 41 __u64 rd_sz; 42 __u64 wr_sz; 43 __u64 rd_io_sz; 44 __u64 wr_io_sz; 45}; 46 47struct nfs_fattr { 48 __u64 valid; /* which fields are valid */ 49 umode_t mode; 50 __u32 nlink; 51 kuid_t uid; 52 kgid_t gid; 53 dev_t rdev; 54 __u64 size; 55 union { 56 struct { 57 __u32 blocksize; 58 __u32 blocks; 59 } nfs2; 60 struct { 61 __u64 used; 62 } nfs3; 63 } du; 64 struct nfs_fsid fsid; 65 __u64 fileid; 66 __u64 mounted_on_fileid; 67 struct timespec64 atime; 68 struct timespec64 mtime; 69 struct timespec64 ctime; 70 struct timespec64 btime; 71 __u64 change_attr; /* NFSv4 change attribute */ 72 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ 73 __u64 pre_size; /* pre_op_attr.size */ 74 struct timespec64 pre_mtime; /* pre_op_attr.mtime */ 75 struct timespec64 pre_ctime; /* pre_op_attr.ctime */ 76 unsigned long time_start; 77 unsigned long gencount; 78 struct nfs4_string *owner_name; 79 struct nfs4_string *group_name; 80 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */ 81 struct nfs4_label *label; 82}; 83 84#define NFS_ATTR_FATTR_TYPE BIT_ULL(0) 85#define NFS_ATTR_FATTR_MODE BIT_ULL(1) 86#define NFS_ATTR_FATTR_NLINK BIT_ULL(2) 87#define NFS_ATTR_FATTR_OWNER BIT_ULL(3) 88#define NFS_ATTR_FATTR_GROUP BIT_ULL(4) 89#define NFS_ATTR_FATTR_RDEV BIT_ULL(5) 90#define NFS_ATTR_FATTR_SIZE BIT_ULL(6) 91#define NFS_ATTR_FATTR_PRESIZE BIT_ULL(7) 92#define NFS_ATTR_FATTR_BLOCKS_USED BIT_ULL(8) 93#define NFS_ATTR_FATTR_SPACE_USED BIT_ULL(9) 94#define NFS_ATTR_FATTR_FSID BIT_ULL(10) 95#define NFS_ATTR_FATTR_FILEID BIT_ULL(11) 96#define NFS_ATTR_FATTR_ATIME BIT_ULL(12) 97#define NFS_ATTR_FATTR_MTIME BIT_ULL(13) 98#define NFS_ATTR_FATTR_CTIME BIT_ULL(14) 99#define NFS_ATTR_FATTR_PREMTIME BIT_ULL(15) 100#define NFS_ATTR_FATTR_PRECTIME BIT_ULL(16) 101#define NFS_ATTR_FATTR_CHANGE BIT_ULL(17) 102#define NFS_ATTR_FATTR_PRECHANGE BIT_ULL(18) 103#define NFS_ATTR_FATTR_V4_LOCATIONS BIT_ULL(19) 104#define NFS_ATTR_FATTR_V4_REFERRAL BIT_ULL(20) 105#define NFS_ATTR_FATTR_MOUNTPOINT BIT_ULL(21) 106#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID BIT_ULL(22) 107#define NFS_ATTR_FATTR_OWNER_NAME BIT_ULL(23) 108#define NFS_ATTR_FATTR_GROUP_NAME BIT_ULL(24) 109#define NFS_ATTR_FATTR_V4_SECURITY_LABEL BIT_ULL(25) 110#define NFS_ATTR_FATTR_BTIME BIT_ULL(26) 111 112#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 113 | NFS_ATTR_FATTR_MODE \ 114 | NFS_ATTR_FATTR_NLINK \ 115 | NFS_ATTR_FATTR_OWNER \ 116 | NFS_ATTR_FATTR_GROUP \ 117 | NFS_ATTR_FATTR_RDEV \ 118 | NFS_ATTR_FATTR_SIZE \ 119 | NFS_ATTR_FATTR_FSID \ 120 | NFS_ATTR_FATTR_FILEID \ 121 | NFS_ATTR_FATTR_ATIME \ 122 | NFS_ATTR_FATTR_MTIME \ 123 | NFS_ATTR_FATTR_CTIME \ 124 | NFS_ATTR_FATTR_CHANGE) 125#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \ 126 | NFS_ATTR_FATTR_BLOCKS_USED) 127#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \ 128 | NFS_ATTR_FATTR_SPACE_USED) 129#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \ 130 | NFS_ATTR_FATTR_SPACE_USED \ 131 | NFS_ATTR_FATTR_BTIME \ 132 | NFS_ATTR_FATTR_V4_SECURITY_LABEL) 133 134/* 135 * Maximal number of supported layout drivers. 136 */ 137#define NFS_MAX_LAYOUT_TYPES 8 138 139/* 140 * Info on the file system 141 */ 142struct nfs_fsinfo { 143 struct nfs_fattr *fattr; /* Post-op attributes */ 144 __u32 rtmax; /* max. read transfer size */ 145 __u32 rtpref; /* pref. read transfer size */ 146 __u32 rtmult; /* reads should be multiple of this */ 147 __u32 wtmax; /* max. write transfer size */ 148 __u32 wtpref; /* pref. write transfer size */ 149 __u32 wtmult; /* writes should be multiple of this */ 150 __u32 dtpref; /* pref. readdir transfer size */ 151 __u64 maxfilesize; 152 struct timespec64 time_delta; /* server time granularity */ 153 __u32 lease_time; /* in seconds */ 154 __u32 nlayouttypes; /* number of layouttypes */ 155 __u32 layouttype[NFS_MAX_LAYOUT_TYPES]; /* supported pnfs layout driver */ 156 __u32 blksize; /* preferred pnfs io block size */ 157 __u32 clone_blksize; /* granularity of a CLONE operation */ 158 enum nfs4_change_attr_type 159 change_attr_type; /* Info about change attr */ 160 __u32 xattr_support; /* User xattrs supported */ 161}; 162 163struct nfs_fsstat { 164 struct nfs_fattr *fattr; /* Post-op attributes */ 165 __u64 tbytes; /* total size in bytes */ 166 __u64 fbytes; /* # of free bytes */ 167 __u64 abytes; /* # of bytes available to user */ 168 __u64 tfiles; /* # of files */ 169 __u64 ffiles; /* # of free files */ 170 __u64 afiles; /* # of files available to user */ 171}; 172 173struct nfs2_fsstat { 174 __u32 tsize; /* Server transfer size */ 175 __u32 bsize; /* Filesystem block size */ 176 __u32 blocks; /* No. of "bsize" blocks on filesystem */ 177 __u32 bfree; /* No. of free "bsize" blocks */ 178 __u32 bavail; /* No. of available "bsize" blocks */ 179}; 180 181struct nfs_pathconf { 182 struct nfs_fattr *fattr; /* Post-op attributes */ 183 __u32 max_link; /* max # of hard links */ 184 __u32 max_namelen; /* max name length */ 185}; 186 187struct nfs4_change_info { 188 u32 atomic; 189 u64 before; 190 u64 after; 191}; 192 193struct nfs_seqid; 194 195/* nfs41 sessions channel attributes */ 196struct nfs4_channel_attrs { 197 u32 max_rqst_sz; 198 u32 max_resp_sz; 199 u32 max_resp_sz_cached; 200 u32 max_ops; 201 u32 max_reqs; 202}; 203 204struct nfs4_slot; 205struct nfs4_sequence_args { 206 struct nfs4_slot *sa_slot; 207 u8 sa_cache_this : 1, 208 sa_privileged : 1; 209}; 210 211struct nfs4_sequence_res { 212 struct nfs4_slot *sr_slot; /* slot used to send request */ 213 unsigned long sr_timestamp; 214 int sr_status; /* sequence operation status */ 215 u32 sr_status_flags; 216 u32 sr_highest_slotid; 217 u32 sr_target_highest_slotid; 218}; 219 220struct nfs4_get_lease_time_args { 221 struct nfs4_sequence_args la_seq_args; 222}; 223 224struct nfs4_get_lease_time_res { 225 struct nfs4_sequence_res lr_seq_res; 226 struct nfs_fsinfo *lr_fsinfo; 227}; 228 229struct xdr_stream; 230struct nfs4_xdr_opaque_data; 231 232struct nfs4_xdr_opaque_ops { 233 void (*encode)(struct xdr_stream *, const void *args, 234 const struct nfs4_xdr_opaque_data *); 235 void (*free)(struct nfs4_xdr_opaque_data *); 236}; 237 238struct nfs4_xdr_opaque_data { 239 const struct nfs4_xdr_opaque_ops *ops; 240 void *data; 241}; 242 243#define PNFS_LAYOUT_MAXSIZE 4096 244 245struct nfs4_layoutdriver_data { 246 struct page **pages; 247 __u32 pglen; 248 __u32 len; 249}; 250 251struct pnfs_layout_range { 252 u32 iomode; 253 u64 offset; 254 u64 length; 255}; 256 257struct nfs4_layoutget_args { 258 struct nfs4_sequence_args seq_args; 259 __u32 type; 260 struct pnfs_layout_range range; 261 __u64 minlength; 262 __u32 maxcount; 263 struct inode *inode; 264 struct nfs_open_context *ctx; 265 nfs4_stateid stateid; 266 struct nfs4_layoutdriver_data layout; 267}; 268 269struct nfs4_layoutget_res { 270 struct nfs4_sequence_res seq_res; 271 int status; 272 __u32 return_on_close; 273 struct pnfs_layout_range range; 274 __u32 type; 275 nfs4_stateid stateid; 276 struct nfs4_layoutdriver_data *layoutp; 277}; 278 279struct nfs4_layoutget { 280 struct nfs4_layoutget_args args; 281 struct nfs4_layoutget_res res; 282 const struct cred *cred; 283 struct pnfs_layout_hdr *lo; 284 gfp_t gfp_flags; 285}; 286 287struct nfs4_getdeviceinfo_args { 288 struct nfs4_sequence_args seq_args; 289 struct pnfs_device *pdev; 290 __u32 notify_types; 291}; 292 293struct nfs4_getdeviceinfo_res { 294 struct nfs4_sequence_res seq_res; 295 struct pnfs_device *pdev; 296 __u32 notification; 297}; 298 299struct nfs4_layoutcommit_args { 300 struct nfs4_sequence_args seq_args; 301 nfs4_stateid stateid; 302 __u64 lastbytewritten; 303 struct inode *inode; 304 const u32 *bitmask; 305 size_t layoutupdate_len; 306 struct page *layoutupdate_page; 307 struct page **layoutupdate_pages; 308 __be32 *start_p; 309}; 310 311struct nfs4_layoutcommit_res { 312 struct nfs4_sequence_res seq_res; 313 struct nfs_fattr *fattr; 314 const struct nfs_server *server; 315 int status; 316}; 317 318struct nfs4_layoutcommit_data { 319 struct rpc_task task; 320 struct nfs_fattr fattr; 321 struct list_head lseg_list; 322 const struct cred *cred; 323 struct inode *inode; 324 struct nfs4_layoutcommit_args args; 325 struct nfs4_layoutcommit_res res; 326}; 327 328struct nfs4_layoutreturn_args { 329 struct nfs4_sequence_args seq_args; 330 struct pnfs_layout_hdr *layout; 331 struct inode *inode; 332 struct pnfs_layout_range range; 333 nfs4_stateid stateid; 334 __u32 layout_type; 335 struct nfs4_xdr_opaque_data *ld_private; 336}; 337 338struct nfs4_layoutreturn_res { 339 struct nfs4_sequence_res seq_res; 340 u32 lrs_present; 341 nfs4_stateid stateid; 342}; 343 344struct nfs4_layoutreturn { 345 struct nfs4_layoutreturn_args args; 346 struct nfs4_layoutreturn_res res; 347 const struct cred *cred; 348 struct nfs_client *clp; 349 struct inode *inode; 350 int rpc_status; 351 struct nfs4_xdr_opaque_data ld_private; 352}; 353 354#define PNFS_LAYOUTSTATS_MAXSIZE 256 355 356struct nfs42_layoutstat_args; 357struct nfs42_layoutstat_devinfo; 358typedef void (*layoutstats_encode_t)(struct xdr_stream *, 359 struct nfs42_layoutstat_args *, 360 struct nfs42_layoutstat_devinfo *); 361 362/* Per file per deviceid layoutstats */ 363struct nfs42_layoutstat_devinfo { 364 struct nfs4_deviceid dev_id; 365 __u64 offset; 366 __u64 length; 367 __u64 read_count; 368 __u64 read_bytes; 369 __u64 write_count; 370 __u64 write_bytes; 371 __u32 layout_type; 372 struct nfs4_xdr_opaque_data ld_private; 373}; 374 375struct nfs42_layoutstat_args { 376 struct nfs4_sequence_args seq_args; 377 struct nfs_fh *fh; 378 struct inode *inode; 379 nfs4_stateid stateid; 380 int num_dev; 381 struct nfs42_layoutstat_devinfo *devinfo; 382}; 383 384struct nfs42_layoutstat_res { 385 struct nfs4_sequence_res seq_res; 386 int num_dev; 387 int rpc_status; 388}; 389 390struct nfs42_layoutstat_data { 391 struct inode *inode; 392 struct nfs42_layoutstat_args args; 393 struct nfs42_layoutstat_res res; 394}; 395 396struct nfs42_device_error { 397 struct nfs4_deviceid dev_id; 398 int status; 399 enum nfs_opnum4 opnum; 400}; 401 402struct nfs42_layout_error { 403 __u64 offset; 404 __u64 length; 405 nfs4_stateid stateid; 406 struct nfs42_device_error errors[1]; 407}; 408 409#define NFS42_LAYOUTERROR_MAX 5 410 411struct nfs42_layouterror_args { 412 struct nfs4_sequence_args seq_args; 413 struct inode *inode; 414 unsigned int num_errors; 415 struct nfs42_layout_error errors[NFS42_LAYOUTERROR_MAX]; 416}; 417 418struct nfs42_layouterror_res { 419 struct nfs4_sequence_res seq_res; 420 unsigned int num_errors; 421 int rpc_status; 422}; 423 424struct nfs42_layouterror_data { 425 struct nfs42_layouterror_args args; 426 struct nfs42_layouterror_res res; 427 struct inode *inode; 428 struct pnfs_layout_segment *lseg; 429}; 430 431struct nfs42_clone_args { 432 struct nfs4_sequence_args seq_args; 433 struct nfs_fh *src_fh; 434 struct nfs_fh *dst_fh; 435 nfs4_stateid src_stateid; 436 nfs4_stateid dst_stateid; 437 __u64 src_offset; 438 __u64 dst_offset; 439 __u64 count; 440 const u32 *dst_bitmask; 441}; 442 443struct nfs42_clone_res { 444 struct nfs4_sequence_res seq_res; 445 unsigned int rpc_status; 446 struct nfs_fattr *dst_fattr; 447 const struct nfs_server *server; 448}; 449 450struct stateowner_id { 451 __u64 create_time; 452 __u64 uniquifier; 453}; 454 455struct nfs4_open_delegation { 456 __u32 open_delegation_type; 457 union { 458 struct { 459 fmode_t type; 460 __u32 do_recall; 461 nfs4_stateid stateid; 462 unsigned long pagemod_limit; 463 }; 464 struct { 465 __u32 why_no_delegation; 466 __u32 will_notify; 467 }; 468 }; 469}; 470 471/* 472 * Arguments to the open call. 473 */ 474struct nfs_openargs { 475 struct nfs4_sequence_args seq_args; 476 const struct nfs_fh * fh; 477 struct nfs_seqid * seqid; 478 int open_flags; 479 fmode_t fmode; 480 u32 share_access; 481 u32 access; 482 __u64 clientid; 483 struct stateowner_id id; 484 union { 485 struct { 486 struct iattr * attrs; /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */ 487 nfs4_verifier verifier; /* EXCLUSIVE */ 488 }; 489 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */ 490 __u32 delegation_type; /* CLAIM_PREVIOUS */ 491 } u; 492 const struct qstr * name; 493 const struct nfs_server *server; /* Needed for ID mapping */ 494 const u32 * bitmask; 495 const u32 * open_bitmap; 496 enum open_claim_type4 claim; 497 enum createmode4 createmode; 498 const struct nfs4_label *label; 499 umode_t umask; 500 struct nfs4_layoutget_args *lg_args; 501}; 502 503struct nfs_openres { 504 struct nfs4_sequence_res seq_res; 505 nfs4_stateid stateid; 506 struct nfs_fh fh; 507 struct nfs4_change_info cinfo; 508 __u32 rflags; 509 struct nfs_fattr * f_attr; 510 struct nfs_seqid * seqid; 511 const struct nfs_server *server; 512 __u32 attrset[NFS4_BITMAP_SIZE]; 513 struct nfs4_string *owner; 514 struct nfs4_string *group_owner; 515 struct nfs4_open_delegation delegation; 516 __u32 access_request; 517 __u32 access_supported; 518 __u32 access_result; 519 struct nfs4_layoutget_res *lg_res; 520}; 521 522/* 523 * Arguments to the open_confirm call. 524 */ 525struct nfs_open_confirmargs { 526 struct nfs4_sequence_args seq_args; 527 const struct nfs_fh * fh; 528 nfs4_stateid * stateid; 529 struct nfs_seqid * seqid; 530}; 531 532struct nfs_open_confirmres { 533 struct nfs4_sequence_res seq_res; 534 nfs4_stateid stateid; 535 struct nfs_seqid * seqid; 536}; 537 538/* 539 * Arguments to the close call. 540 */ 541struct nfs_closeargs { 542 struct nfs4_sequence_args seq_args; 543 struct nfs_fh * fh; 544 nfs4_stateid stateid; 545 struct nfs_seqid * seqid; 546 fmode_t fmode; 547 u32 share_access; 548 const u32 * bitmask; 549 u32 bitmask_store[NFS_BITMASK_SZ]; 550 struct nfs4_layoutreturn_args *lr_args; 551}; 552 553struct nfs_closeres { 554 struct nfs4_sequence_res seq_res; 555 nfs4_stateid stateid; 556 struct nfs_fattr * fattr; 557 struct nfs_seqid * seqid; 558 const struct nfs_server *server; 559 struct nfs4_layoutreturn_res *lr_res; 560 int lr_ret; 561}; 562/* 563 * * Arguments to the lock,lockt, and locku call. 564 * */ 565struct nfs_lowner { 566 __u64 clientid; 567 __u64 id; 568 dev_t s_dev; 569}; 570 571struct nfs_lock_args { 572 struct nfs4_sequence_args seq_args; 573 struct nfs_fh * fh; 574 struct file_lock * fl; 575 struct nfs_seqid * lock_seqid; 576 nfs4_stateid lock_stateid; 577 struct nfs_seqid * open_seqid; 578 nfs4_stateid open_stateid; 579 struct nfs_lowner lock_owner; 580 unsigned char block : 1; 581 unsigned char reclaim : 1; 582 unsigned char new_lock : 1; 583 unsigned char new_lock_owner : 1; 584}; 585 586struct nfs_lock_res { 587 struct nfs4_sequence_res seq_res; 588 nfs4_stateid stateid; 589 struct nfs_seqid * lock_seqid; 590 struct nfs_seqid * open_seqid; 591}; 592 593struct nfs_locku_args { 594 struct nfs4_sequence_args seq_args; 595 struct nfs_fh * fh; 596 struct file_lock * fl; 597 struct nfs_seqid * seqid; 598 nfs4_stateid stateid; 599}; 600 601struct nfs_locku_res { 602 struct nfs4_sequence_res seq_res; 603 nfs4_stateid stateid; 604 struct nfs_seqid * seqid; 605}; 606 607struct nfs_lockt_args { 608 struct nfs4_sequence_args seq_args; 609 struct nfs_fh * fh; 610 struct file_lock * fl; 611 struct nfs_lowner lock_owner; 612}; 613 614struct nfs_lockt_res { 615 struct nfs4_sequence_res seq_res; 616 struct file_lock * denied; /* LOCK, LOCKT failed */ 617}; 618 619struct nfs_release_lockowner_args { 620 struct nfs4_sequence_args seq_args; 621 struct nfs_lowner lock_owner; 622}; 623 624struct nfs_release_lockowner_res { 625 struct nfs4_sequence_res seq_res; 626}; 627 628struct nfs4_delegattr { 629 struct timespec64 atime; 630 struct timespec64 mtime; 631 bool atime_set; 632 bool mtime_set; 633}; 634 635struct nfs4_delegreturnargs { 636 struct nfs4_sequence_args seq_args; 637 const struct nfs_fh *fhandle; 638 const nfs4_stateid *stateid; 639 const u32 *bitmask; 640 u32 bitmask_store[NFS_BITMASK_SZ]; 641 struct nfs4_layoutreturn_args *lr_args; 642 struct nfs4_delegattr *sattr_args; 643}; 644 645struct nfs4_delegreturnres { 646 struct nfs4_sequence_res seq_res; 647 struct nfs_fattr * fattr; 648 struct nfs_server *server; 649 struct nfs4_layoutreturn_res *lr_res; 650 int lr_ret; 651 bool sattr_res; 652 int sattr_ret; 653}; 654 655/* 656 * Arguments to the write call. 657 */ 658struct nfs_write_verifier { 659 char data[8]; 660}; 661 662struct nfs_writeverf { 663 struct nfs_write_verifier verifier; 664 enum nfs3_stable_how committed; 665}; 666 667/* 668 * Arguments shared by the read and write call. 669 */ 670struct nfs_pgio_args { 671 struct nfs4_sequence_args seq_args; 672 struct nfs_fh * fh; 673 struct nfs_open_context *context; 674 struct nfs_lock_context *lock_context; 675 nfs4_stateid stateid; 676 __u64 offset; 677 __u32 count; 678 unsigned int pgbase; 679 struct page ** pages; 680 union { 681 unsigned int replen; /* used by read */ 682 struct { 683 const u32 * bitmask; /* used by write */ 684 u32 bitmask_store[NFS_BITMASK_SZ]; /* used by write */ 685 enum nfs3_stable_how stable; /* used by write */ 686 }; 687 }; 688}; 689 690struct nfs_pgio_res { 691 struct nfs4_sequence_res seq_res; 692 struct nfs_fattr * fattr; 693 __u64 count; 694 __u32 op_status; 695 union { 696 struct { 697 unsigned int replen; /* used by read */ 698 int eof; /* used by read */ 699 void * scratch; /* used by read */ 700 }; 701 struct { 702 struct nfs_writeverf * verf; /* used by write */ 703 const struct nfs_server *server; /* used by write */ 704 }; 705 }; 706}; 707 708/* 709 * Arguments to the commit call. 710 */ 711struct nfs_commitargs { 712 struct nfs4_sequence_args seq_args; 713 struct nfs_fh *fh; 714 __u64 offset; 715 __u32 count; 716 const u32 *bitmask; 717}; 718 719struct nfs_commitres { 720 struct nfs4_sequence_res seq_res; 721 __u32 op_status; 722 struct nfs_fattr *fattr; 723 struct nfs_writeverf *verf; 724 const struct nfs_server *server; 725}; 726 727/* 728 * Common arguments to the unlink call 729 */ 730struct nfs_removeargs { 731 struct nfs4_sequence_args seq_args; 732 const struct nfs_fh *fh; 733 struct qstr name; 734}; 735 736struct nfs_removeres { 737 struct nfs4_sequence_res seq_res; 738 struct nfs_server *server; 739 struct nfs_fattr *dir_attr; 740 struct nfs4_change_info cinfo; 741}; 742 743/* 744 * Common arguments to the rename call 745 */ 746struct nfs_renameargs { 747 struct nfs4_sequence_args seq_args; 748 const struct nfs_fh *old_dir; 749 const struct nfs_fh *new_dir; 750 const struct qstr *old_name; 751 const struct qstr *new_name; 752}; 753 754struct nfs_renameres { 755 struct nfs4_sequence_res seq_res; 756 struct nfs_server *server; 757 struct nfs4_change_info old_cinfo; 758 struct nfs_fattr *old_fattr; 759 struct nfs4_change_info new_cinfo; 760 struct nfs_fattr *new_fattr; 761}; 762 763/* parsed sec= options */ 764#define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */ 765struct nfs_auth_info { 766 unsigned int flavor_len; 767 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS]; 768}; 769 770/* 771 * Argument struct for decode_entry function 772 */ 773struct nfs_entry { 774 __u64 ino; 775 __u64 cookie; 776 const char * name; 777 unsigned int len; 778 int eof; 779 struct nfs_fh * fh; 780 struct nfs_fattr * fattr; 781 unsigned char d_type; 782 struct nfs_server * server; 783}; 784 785struct nfs_readdir_arg { 786 struct dentry *dentry; 787 const struct cred *cred; 788 __be32 *verf; 789 u64 cookie; 790 struct page **pages; 791 unsigned int page_len; 792 bool plus; 793}; 794 795struct nfs_readdir_res { 796 __be32 *verf; 797}; 798 799/* 800 * The following types are for NFSv2 only. 801 */ 802struct nfs_sattrargs { 803 struct nfs_fh * fh; 804 struct iattr * sattr; 805}; 806 807struct nfs_diropargs { 808 struct nfs_fh * fh; 809 const char * name; 810 unsigned int len; 811}; 812 813struct nfs_createargs { 814 struct nfs_fh * fh; 815 const char * name; 816 unsigned int len; 817 struct iattr * sattr; 818}; 819 820struct nfs_setattrargs { 821 struct nfs4_sequence_args seq_args; 822 struct nfs_fh * fh; 823 nfs4_stateid stateid; 824 struct iattr * iap; 825 const struct nfs_server * server; /* Needed for name mapping */ 826 const u32 * bitmask; 827 const struct nfs4_label *label; 828}; 829 830enum nfs4_acl_type { 831 NFS4ACL_NONE = 0, 832 NFS4ACL_ACL, 833 NFS4ACL_DACL, 834 NFS4ACL_SACL, 835}; 836 837struct nfs_setaclargs { 838 struct nfs4_sequence_args seq_args; 839 struct nfs_fh * fh; 840 enum nfs4_acl_type acl_type; 841 size_t acl_len; 842 struct page ** acl_pages; 843}; 844 845struct nfs_setaclres { 846 struct nfs4_sequence_res seq_res; 847}; 848 849struct nfs_getaclargs { 850 struct nfs4_sequence_args seq_args; 851 struct nfs_fh * fh; 852 enum nfs4_acl_type acl_type; 853 size_t acl_len; 854 struct page ** acl_pages; 855}; 856 857/* getxattr ACL interface flags */ 858#define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */ 859struct nfs_getaclres { 860 struct nfs4_sequence_res seq_res; 861 enum nfs4_acl_type acl_type; 862 size_t acl_len; 863 size_t acl_data_offset; 864 int acl_flags; 865 struct folio * acl_scratch; 866}; 867 868struct nfs_setattrres { 869 struct nfs4_sequence_res seq_res; 870 struct nfs_fattr * fattr; 871 const struct nfs_server * server; 872}; 873 874struct nfs_linkargs { 875 struct nfs_fh * fromfh; 876 struct nfs_fh * tofh; 877 const char * toname; 878 unsigned int tolen; 879}; 880 881struct nfs_symlinkargs { 882 struct nfs_fh * fromfh; 883 const char * fromname; 884 unsigned int fromlen; 885 struct page ** pages; 886 unsigned int pathlen; 887 struct iattr * sattr; 888}; 889 890struct nfs_readdirargs { 891 struct nfs_fh * fh; 892 __u32 cookie; 893 unsigned int count; 894 struct page ** pages; 895}; 896 897struct nfs3_getaclargs { 898 struct nfs_fh * fh; 899 int mask; 900 struct page ** pages; 901}; 902 903struct nfs3_setaclargs { 904 struct inode * inode; 905 int mask; 906 struct posix_acl * acl_access; 907 struct posix_acl * acl_default; 908 size_t len; 909 unsigned int npages; 910 struct page ** pages; 911}; 912 913struct nfs_diropok { 914 struct nfs_fh * fh; 915 struct nfs_fattr * fattr; 916}; 917 918struct nfs_readlinkargs { 919 struct nfs_fh * fh; 920 unsigned int pgbase; 921 unsigned int pglen; 922 struct page ** pages; 923}; 924 925struct nfs3_sattrargs { 926 struct nfs_fh * fh; 927 struct iattr * sattr; 928 unsigned int guard; 929 struct timespec64 guardtime; 930}; 931 932struct nfs3_diropargs { 933 struct nfs_fh * fh; 934 const char * name; 935 unsigned int len; 936}; 937 938struct nfs3_accessargs { 939 struct nfs_fh * fh; 940 __u32 access; 941}; 942 943struct nfs3_createargs { 944 struct nfs_fh * fh; 945 const char * name; 946 unsigned int len; 947 struct iattr * sattr; 948 enum nfs3_createmode createmode; 949 __be32 verifier[2]; 950}; 951 952struct nfs3_mkdirargs { 953 struct nfs_fh * fh; 954 const char * name; 955 unsigned int len; 956 struct iattr * sattr; 957}; 958 959struct nfs3_symlinkargs { 960 struct nfs_fh * fromfh; 961 const char * fromname; 962 unsigned int fromlen; 963 struct page ** pages; 964 unsigned int pathlen; 965 struct iattr * sattr; 966}; 967 968struct nfs3_mknodargs { 969 struct nfs_fh * fh; 970 const char * name; 971 unsigned int len; 972 enum nfs3_ftype type; 973 struct iattr * sattr; 974 dev_t rdev; 975}; 976 977struct nfs3_linkargs { 978 struct nfs_fh * fromfh; 979 struct nfs_fh * tofh; 980 const char * toname; 981 unsigned int tolen; 982}; 983 984struct nfs3_readdirargs { 985 struct nfs_fh * fh; 986 __u64 cookie; 987 __be32 verf[2]; 988 bool plus; 989 unsigned int count; 990 struct page ** pages; 991}; 992 993struct nfs3_diropres { 994 struct nfs_fattr * dir_attr; 995 struct nfs_fh * fh; 996 struct nfs_fattr * fattr; 997}; 998 999struct nfs3_accessres { 1000 struct nfs_fattr * fattr; 1001 __u32 access; 1002}; 1003 1004struct nfs3_readlinkargs { 1005 struct nfs_fh * fh; 1006 unsigned int pgbase; 1007 unsigned int pglen; 1008 struct page ** pages; 1009}; 1010 1011struct nfs3_linkres { 1012 struct nfs_fattr * dir_attr; 1013 struct nfs_fattr * fattr; 1014}; 1015 1016struct nfs3_readdirres { 1017 struct nfs_fattr * dir_attr; 1018 __be32 * verf; 1019 bool plus; 1020}; 1021 1022struct nfs3_getaclres { 1023 struct nfs_fattr * fattr; 1024 int mask; 1025 unsigned int acl_access_count; 1026 unsigned int acl_default_count; 1027 struct posix_acl * acl_access; 1028 struct posix_acl * acl_default; 1029}; 1030 1031#if IS_ENABLED(CONFIG_NFS_V4) 1032 1033typedef u64 clientid4; 1034 1035struct nfs4_accessargs { 1036 struct nfs4_sequence_args seq_args; 1037 const struct nfs_fh * fh; 1038 const u32 * bitmask; 1039 u32 access; 1040}; 1041 1042struct nfs4_accessres { 1043 struct nfs4_sequence_res seq_res; 1044 const struct nfs_server * server; 1045 struct nfs_fattr * fattr; 1046 u32 supported; 1047 u32 access; 1048}; 1049 1050struct nfs4_create_arg { 1051 struct nfs4_sequence_args seq_args; 1052 u32 ftype; 1053 union { 1054 struct { 1055 struct page ** pages; 1056 unsigned int len; 1057 } symlink; /* NF4LNK */ 1058 struct { 1059 u32 specdata1; 1060 u32 specdata2; 1061 } device; /* NF4BLK, NF4CHR */ 1062 } u; 1063 const struct qstr * name; 1064 const struct nfs_server * server; 1065 const struct iattr * attrs; 1066 const struct nfs_fh * dir_fh; 1067 const u32 * bitmask; 1068 const struct nfs4_label *label; 1069 umode_t umask; 1070}; 1071 1072struct nfs4_create_res { 1073 struct nfs4_sequence_res seq_res; 1074 const struct nfs_server * server; 1075 struct nfs_fh * fh; 1076 struct nfs_fattr * fattr; 1077 struct nfs4_change_info dir_cinfo; 1078}; 1079 1080struct nfs4_fsinfo_arg { 1081 struct nfs4_sequence_args seq_args; 1082 const struct nfs_fh * fh; 1083 const u32 * bitmask; 1084}; 1085 1086struct nfs4_fsinfo_res { 1087 struct nfs4_sequence_res seq_res; 1088 struct nfs_fsinfo *fsinfo; 1089}; 1090 1091struct nfs4_getattr_arg { 1092 struct nfs4_sequence_args seq_args; 1093 const struct nfs_fh * fh; 1094 const u32 * bitmask; 1095 bool get_dir_deleg; 1096}; 1097 1098struct nfs4_gdd_res { 1099 u32 status; 1100 nfs4_stateid deleg; 1101}; 1102 1103struct nfs4_getattr_res { 1104 struct nfs4_sequence_res seq_res; 1105 const struct nfs_server * server; 1106 struct nfs_fattr * fattr; 1107 struct nfs4_gdd_res * gdd_res; 1108}; 1109 1110struct nfs4_link_arg { 1111 struct nfs4_sequence_args seq_args; 1112 const struct nfs_fh * fh; 1113 const struct nfs_fh * dir_fh; 1114 const struct qstr * name; 1115 const u32 * bitmask; 1116}; 1117 1118struct nfs4_link_res { 1119 struct nfs4_sequence_res seq_res; 1120 const struct nfs_server * server; 1121 struct nfs_fattr * fattr; 1122 struct nfs4_change_info cinfo; 1123 struct nfs_fattr * dir_attr; 1124}; 1125 1126struct nfs4_lookup_arg { 1127 struct nfs4_sequence_args seq_args; 1128 const struct nfs_fh * dir_fh; 1129 const struct qstr * name; 1130 const u32 * bitmask; 1131}; 1132 1133struct nfs4_lookup_res { 1134 struct nfs4_sequence_res seq_res; 1135 const struct nfs_server * server; 1136 struct nfs_fattr * fattr; 1137 struct nfs_fh * fh; 1138}; 1139 1140struct nfs4_lookupp_arg { 1141 struct nfs4_sequence_args seq_args; 1142 const struct nfs_fh *fh; 1143 const u32 *bitmask; 1144}; 1145 1146struct nfs4_lookupp_res { 1147 struct nfs4_sequence_res seq_res; 1148 const struct nfs_server *server; 1149 struct nfs_fattr *fattr; 1150 struct nfs_fh *fh; 1151}; 1152 1153struct nfs4_lookup_root_arg { 1154 struct nfs4_sequence_args seq_args; 1155 const u32 * bitmask; 1156}; 1157 1158struct nfs4_pathconf_arg { 1159 struct nfs4_sequence_args seq_args; 1160 const struct nfs_fh * fh; 1161 const u32 * bitmask; 1162}; 1163 1164struct nfs4_pathconf_res { 1165 struct nfs4_sequence_res seq_res; 1166 struct nfs_pathconf *pathconf; 1167}; 1168 1169struct nfs4_readdir_arg { 1170 struct nfs4_sequence_args seq_args; 1171 const struct nfs_fh * fh; 1172 u64 cookie; 1173 nfs4_verifier verifier; 1174 u32 count; 1175 struct page ** pages; /* zero-copy data */ 1176 unsigned int pgbase; /* zero-copy data */ 1177 const u32 * bitmask; 1178 bool plus; 1179}; 1180 1181struct nfs4_readdir_res { 1182 struct nfs4_sequence_res seq_res; 1183 nfs4_verifier verifier; 1184 unsigned int pgbase; 1185}; 1186 1187struct nfs4_readlink { 1188 struct nfs4_sequence_args seq_args; 1189 const struct nfs_fh * fh; 1190 unsigned int pgbase; 1191 unsigned int pglen; /* zero-copy data */ 1192 struct page ** pages; /* zero-copy data */ 1193}; 1194 1195struct nfs4_readlink_res { 1196 struct nfs4_sequence_res seq_res; 1197}; 1198 1199struct nfs4_setclientid { 1200 const nfs4_verifier * sc_verifier; 1201 u32 sc_prog; 1202 unsigned int sc_netid_len; 1203 char sc_netid[RPCBIND_MAXNETIDLEN + 1]; 1204 unsigned int sc_uaddr_len; 1205 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1]; 1206 struct nfs_client *sc_clnt; 1207 struct rpc_cred *sc_cred; 1208}; 1209 1210struct nfs4_setclientid_res { 1211 u64 clientid; 1212 nfs4_verifier confirm; 1213}; 1214 1215struct nfs4_statfs_arg { 1216 struct nfs4_sequence_args seq_args; 1217 const struct nfs_fh * fh; 1218 const u32 * bitmask; 1219}; 1220 1221struct nfs4_statfs_res { 1222 struct nfs4_sequence_res seq_res; 1223 struct nfs_fsstat *fsstat; 1224}; 1225 1226struct nfs4_open_caps { 1227 u32 oa_share_access[1]; 1228 u32 oa_share_deny[1]; 1229 u32 oa_share_access_want[1]; 1230 u32 oa_open_claim[1]; 1231 u32 oa_createmode[1]; 1232}; 1233 1234struct nfs4_server_caps_arg { 1235 struct nfs4_sequence_args seq_args; 1236 struct nfs_fh *fhandle; 1237 const u32 * bitmask; 1238}; 1239 1240struct nfs4_server_caps_res { 1241 struct nfs4_sequence_res seq_res; 1242 u32 attr_bitmask[3]; 1243 u32 exclcreat_bitmask[3]; 1244 u32 acl_bitmask; 1245 u32 has_links; 1246 u32 has_symlinks; 1247 u32 fh_expire_type; 1248 u32 case_insensitive; 1249 u32 case_preserving; 1250 struct nfs4_open_caps open_caps; 1251}; 1252 1253#define NFS4_PATHNAME_MAXCOMPONENTS 512 1254struct nfs4_pathname { 1255 unsigned int ncomponents; 1256 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS]; 1257}; 1258 1259#define NFS4_FS_LOCATION_MAXSERVERS 10 1260struct nfs4_fs_location { 1261 unsigned int nservers; 1262 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS]; 1263 struct nfs4_pathname rootpath; 1264}; 1265 1266#define NFS4_FS_LOCATIONS_MAXENTRIES 10 1267struct nfs4_fs_locations { 1268 struct nfs_fattr *fattr; 1269 const struct nfs_server *server; 1270 struct nfs4_pathname fs_path; 1271 int nlocations; 1272 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES]; 1273}; 1274 1275struct nfs4_fs_locations_arg { 1276 struct nfs4_sequence_args seq_args; 1277 const struct nfs_fh *dir_fh; 1278 const struct nfs_fh *fh; 1279 const struct qstr *name; 1280 struct page *page; 1281 const u32 *bitmask; 1282 clientid4 clientid; 1283 unsigned char migration:1, renew:1; 1284}; 1285 1286struct nfs4_fs_locations_res { 1287 struct nfs4_sequence_res seq_res; 1288 struct nfs4_fs_locations *fs_locations; 1289 unsigned char migration:1, renew:1; 1290}; 1291 1292struct nfs4_secinfo4 { 1293 u32 flavor; 1294 struct rpcsec_gss_info flavor_info; 1295}; 1296 1297struct nfs4_secinfo_flavors { 1298 unsigned int num_flavors; 1299 struct nfs4_secinfo4 flavors[]; 1300}; 1301 1302struct nfs4_secinfo_arg { 1303 struct nfs4_sequence_args seq_args; 1304 const struct nfs_fh *dir_fh; 1305 const struct qstr *name; 1306}; 1307 1308struct nfs4_secinfo_res { 1309 struct nfs4_sequence_res seq_res; 1310 struct nfs4_secinfo_flavors *flavors; 1311}; 1312 1313struct nfs4_fsid_present_arg { 1314 struct nfs4_sequence_args seq_args; 1315 const struct nfs_fh *fh; 1316 clientid4 clientid; 1317 unsigned char renew:1; 1318}; 1319 1320struct nfs4_fsid_present_res { 1321 struct nfs4_sequence_res seq_res; 1322 struct nfs_fh *fh; 1323 unsigned char renew:1; 1324}; 1325 1326#endif /* CONFIG_NFS_V4 */ 1327 1328#ifdef CONFIG_NFS_V4_1 1329 1330struct pnfs_commit_bucket { 1331 struct list_head written; 1332 struct list_head committing; 1333 struct pnfs_layout_segment *lseg; 1334 struct nfs_writeverf direct_verf; 1335}; 1336 1337struct pnfs_commit_array { 1338 struct list_head cinfo_list; 1339 struct list_head lseg_list; 1340 struct pnfs_layout_segment *lseg; 1341 struct rcu_head rcu; 1342 refcount_t refcount; 1343 unsigned int nbuckets; 1344 struct pnfs_commit_bucket buckets[] __counted_by(nbuckets); 1345}; 1346 1347struct pnfs_ds_commit_info { 1348 struct list_head commits; 1349 unsigned int nwritten; 1350 unsigned int ncommitting; 1351 const struct pnfs_commit_ops *ops; 1352}; 1353 1354struct nfs41_state_protection { 1355 u32 how; 1356 struct nfs4_op_map enforce; 1357 struct nfs4_op_map allow; 1358}; 1359 1360struct nfs41_exchange_id_args { 1361 struct nfs_client *client; 1362 nfs4_verifier verifier; 1363 u32 flags; 1364 struct nfs41_state_protection state_protect; 1365}; 1366 1367struct nfs41_server_owner { 1368 uint64_t minor_id; 1369 uint32_t major_id_sz; 1370 char major_id[NFS4_OPAQUE_LIMIT]; 1371}; 1372 1373struct nfs41_server_scope { 1374 uint32_t server_scope_sz; 1375 char server_scope[NFS4_OPAQUE_LIMIT]; 1376}; 1377 1378struct nfs41_impl_id { 1379 char domain[NFS4_OPAQUE_LIMIT + 1]; 1380 char name[NFS4_OPAQUE_LIMIT + 1]; 1381 struct nfstime4 date; 1382}; 1383 1384#define MAX_BIND_CONN_TO_SESSION_RETRIES 3 1385struct nfs41_bind_conn_to_session_args { 1386 struct nfs_client *client; 1387 struct nfs4_sessionid sessionid; 1388 u32 dir; 1389 bool use_conn_in_rdma_mode; 1390 int retries; 1391}; 1392 1393struct nfs41_bind_conn_to_session_res { 1394 struct nfs4_sessionid sessionid; 1395 u32 dir; 1396 bool use_conn_in_rdma_mode; 1397}; 1398 1399struct nfs41_exchange_id_res { 1400 u64 clientid; 1401 u32 seqid; 1402 u32 flags; 1403 struct nfs41_server_owner *server_owner; 1404 struct nfs41_server_scope *server_scope; 1405 struct nfs41_impl_id *impl_id; 1406 struct nfs41_state_protection state_protect; 1407}; 1408 1409struct nfs41_create_session_args { 1410 struct nfs_client *client; 1411 u64 clientid; 1412 uint32_t seqid; 1413 uint32_t flags; 1414 uint32_t cb_program; 1415 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */ 1416 struct nfs4_channel_attrs bc_attrs; /* Back Channel */ 1417}; 1418 1419struct nfs41_create_session_res { 1420 struct nfs4_sessionid sessionid; 1421 uint32_t seqid; 1422 uint32_t flags; 1423 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */ 1424 struct nfs4_channel_attrs bc_attrs; /* Back Channel */ 1425}; 1426 1427struct nfs41_reclaim_complete_args { 1428 struct nfs4_sequence_args seq_args; 1429 /* In the future extend to include curr_fh for use with migration */ 1430 unsigned char one_fs:1; 1431}; 1432 1433struct nfs41_reclaim_complete_res { 1434 struct nfs4_sequence_res seq_res; 1435}; 1436 1437#define SECINFO_STYLE_CURRENT_FH 0 1438#define SECINFO_STYLE_PARENT 1 1439struct nfs41_secinfo_no_name_args { 1440 struct nfs4_sequence_args seq_args; 1441 int style; 1442}; 1443 1444struct nfs41_test_stateid_args { 1445 struct nfs4_sequence_args seq_args; 1446 nfs4_stateid stateid; 1447}; 1448 1449struct nfs41_test_stateid_res { 1450 struct nfs4_sequence_res seq_res; 1451 unsigned int status; 1452}; 1453 1454struct nfs41_free_stateid_args { 1455 struct nfs4_sequence_args seq_args; 1456 nfs4_stateid stateid; 1457}; 1458 1459struct nfs41_free_stateid_res { 1460 struct nfs4_sequence_res seq_res; 1461 unsigned int status; 1462}; 1463 1464#else 1465 1466struct pnfs_ds_commit_info { 1467}; 1468 1469#endif /* CONFIG_NFS_V4_1 */ 1470 1471#ifdef CONFIG_NFS_V4_2 1472struct nfs42_falloc_args { 1473 struct nfs4_sequence_args seq_args; 1474 1475 struct nfs_fh *falloc_fh; 1476 nfs4_stateid falloc_stateid; 1477 u64 falloc_offset; 1478 u64 falloc_length; 1479 const u32 *falloc_bitmask; 1480}; 1481 1482struct nfs42_falloc_res { 1483 struct nfs4_sequence_res seq_res; 1484 unsigned int status; 1485 1486 struct nfs_fattr *falloc_fattr; 1487 const struct nfs_server *falloc_server; 1488}; 1489 1490struct nfs42_copy_args { 1491 struct nfs4_sequence_args seq_args; 1492 1493 struct nfs_fh *src_fh; 1494 nfs4_stateid src_stateid; 1495 u64 src_pos; 1496 1497 struct nfs_fh *dst_fh; 1498 nfs4_stateid dst_stateid; 1499 u64 dst_pos; 1500 1501 u64 count; 1502 bool sync; 1503 struct nl4_server *cp_src; 1504}; 1505 1506struct nfs42_write_res { 1507 nfs4_stateid stateid; 1508 u64 count; 1509 struct nfs_writeverf verifier; 1510}; 1511 1512struct nfs42_copy_res { 1513 struct nfs4_sequence_res seq_res; 1514 struct nfs42_write_res write_res; 1515 bool consecutive; 1516 bool synchronous; 1517 struct nfs_commitres commit_res; 1518}; 1519 1520struct nfs42_offload_status_args { 1521 struct nfs4_sequence_args osa_seq_args; 1522 struct nfs_fh *osa_src_fh; 1523 nfs4_stateid osa_stateid; 1524}; 1525 1526struct nfs42_offload_status_res { 1527 struct nfs4_sequence_res osr_seq_res; 1528 u64 osr_count; 1529 int complete_count; 1530 u32 osr_complete; 1531}; 1532 1533struct nfs42_copy_notify_args { 1534 struct nfs4_sequence_args cna_seq_args; 1535 1536 struct nfs_fh *cna_src_fh; 1537 nfs4_stateid cna_src_stateid; 1538 struct nl4_server cna_dst; 1539}; 1540 1541struct nfs42_copy_notify_res { 1542 struct nfs4_sequence_res cnr_seq_res; 1543 1544 struct nfstime4 cnr_lease_time; 1545 nfs4_stateid cnr_stateid; 1546 struct nl4_server cnr_src; 1547}; 1548 1549struct nfs42_seek_args { 1550 struct nfs4_sequence_args seq_args; 1551 1552 struct nfs_fh *sa_fh; 1553 nfs4_stateid sa_stateid; 1554 u64 sa_offset; 1555 u32 sa_what; 1556}; 1557 1558struct nfs42_seek_res { 1559 struct nfs4_sequence_res seq_res; 1560 unsigned int status; 1561 1562 u32 sr_eof; 1563 u64 sr_offset; 1564}; 1565 1566struct nfs42_setxattrargs { 1567 struct nfs4_sequence_args seq_args; 1568 struct nfs_fh *fh; 1569 const u32 *bitmask; 1570 const char *xattr_name; 1571 u32 xattr_flags; 1572 size_t xattr_len; 1573 struct page **xattr_pages; 1574}; 1575 1576struct nfs42_setxattrres { 1577 struct nfs4_sequence_res seq_res; 1578 struct nfs4_change_info cinfo; 1579 struct nfs_fattr *fattr; 1580 const struct nfs_server *server; 1581}; 1582 1583struct nfs42_getxattrargs { 1584 struct nfs4_sequence_args seq_args; 1585 struct nfs_fh *fh; 1586 const char *xattr_name; 1587 size_t xattr_len; 1588 struct page **xattr_pages; 1589}; 1590 1591struct nfs42_getxattrres { 1592 struct nfs4_sequence_res seq_res; 1593 size_t xattr_len; 1594}; 1595 1596struct nfs42_listxattrsargs { 1597 struct nfs4_sequence_args seq_args; 1598 struct nfs_fh *fh; 1599 u32 count; 1600 u64 cookie; 1601 struct page **xattr_pages; 1602}; 1603 1604struct nfs42_listxattrsres { 1605 struct nfs4_sequence_res seq_res; 1606 struct folio *scratch; 1607 void *xattr_buf; 1608 size_t xattr_len; 1609 u64 cookie; 1610 bool eof; 1611 size_t copied; 1612}; 1613 1614struct nfs42_removexattrargs { 1615 struct nfs4_sequence_args seq_args; 1616 struct nfs_fh *fh; 1617 const char *xattr_name; 1618}; 1619 1620struct nfs42_removexattrres { 1621 struct nfs4_sequence_res seq_res; 1622 struct nfs4_change_info cinfo; 1623}; 1624 1625#endif /* CONFIG_NFS_V4_2 */ 1626 1627struct nfs_page; 1628 1629#define NFS_PAGEVEC_SIZE (8U) 1630 1631struct nfs_page_array { 1632 struct page **pagevec; 1633 unsigned int npages; /* Max length of pagevec */ 1634 struct page *page_array[NFS_PAGEVEC_SIZE]; 1635}; 1636 1637/* used as flag bits in nfs_pgio_header */ 1638enum { 1639 NFS_IOHDR_ERROR = 0, 1640 NFS_IOHDR_EOF, 1641 NFS_IOHDR_REDO, 1642 NFS_IOHDR_STAT, 1643 NFS_IOHDR_RESEND_PNFS, 1644 NFS_IOHDR_RESEND_MDS, 1645 NFS_IOHDR_UNSTABLE_WRITES, 1646 NFS_IOHDR_ODIRECT, 1647}; 1648 1649struct nfs_io_completion; 1650struct nfs_pgio_header { 1651 struct inode *inode; 1652 const struct cred *cred; 1653 struct list_head pages; 1654 struct nfs_page *req; 1655 struct nfs_writeverf verf; /* Used for writes */ 1656 fmode_t rw_mode; 1657 struct pnfs_layout_segment *lseg; 1658 loff_t io_start; 1659 const struct rpc_call_ops *mds_ops; 1660 void (*release) (struct nfs_pgio_header *hdr); 1661 const struct nfs_pgio_completion_ops *completion_ops; 1662 const struct nfs_rw_ops *rw_ops; 1663 struct nfs_io_completion *io_completion; 1664 struct nfs_direct_req *dreq; 1665#ifdef CONFIG_NFS_FSCACHE 1666 void *netfs; 1667#endif 1668 1669 unsigned short retrans; 1670 int pnfs_error; 1671 int error; /* merge with pnfs_error */ 1672 unsigned int good_bytes; /* boundary of good data */ 1673 unsigned long flags; 1674 1675 /* 1676 * rpc data 1677 */ 1678 struct rpc_task task; 1679 struct nfs_fattr fattr; 1680 struct nfs_pgio_args args; /* argument struct */ 1681 struct nfs_pgio_res res; /* result struct */ 1682 unsigned long timestamp; /* For lease renewal */ 1683 int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *); 1684 __u64 mds_offset; /* Filelayout dense stripe */ 1685 struct nfs_page_array page_array; 1686 struct nfs_client *ds_clp; /* pNFS data server */ 1687 u32 ds_commit_idx; /* ds index if ds_clp is set */ 1688 u32 pgio_mirror_idx;/* mirror index in pgio layer */ 1689}; 1690 1691struct nfs_mds_commit_info { 1692 atomic_t rpcs_out; 1693 atomic_long_t ncommit; 1694 struct list_head list; 1695}; 1696 1697struct nfs_commit_info; 1698struct nfs_commit_data; 1699struct nfs_inode; 1700struct nfs_commit_completion_ops { 1701 void (*completion) (struct nfs_commit_data *data); 1702 void (*resched_write) (struct nfs_commit_info *, struct nfs_page *); 1703}; 1704 1705struct nfs_commit_info { 1706 struct inode *inode; /* Needed for inode->i_lock */ 1707 struct nfs_mds_commit_info *mds; 1708 struct pnfs_ds_commit_info *ds; 1709 struct nfs_direct_req *dreq; /* O_DIRECT request */ 1710 const struct nfs_commit_completion_ops *completion_ops; 1711}; 1712 1713struct nfs_commit_data { 1714 struct rpc_task task; 1715 struct inode *inode; 1716 const struct cred *cred; 1717 struct nfs_fattr fattr; 1718 struct nfs_writeverf verf; 1719 struct list_head pages; /* Coalesced requests we wish to flush */ 1720 struct list_head list; /* lists of struct nfs_write_data */ 1721 struct nfs_direct_req *dreq; /* O_DIRECT request */ 1722 struct nfs_commitargs args; /* argument struct */ 1723 struct nfs_commitres res; /* result struct */ 1724 struct nfs_open_context *context; 1725 struct pnfs_layout_segment *lseg; 1726 struct nfs_client *ds_clp; /* pNFS data server */ 1727 int ds_commit_index; 1728 loff_t lwb; 1729 const struct rpc_call_ops *mds_ops; 1730 const struct nfs_commit_completion_ops *completion_ops; 1731 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data); 1732 unsigned long flags; 1733}; 1734 1735struct nfs_pgio_completion_ops { 1736 void (*error_cleanup)(struct list_head *head, int); 1737 void (*init_hdr)(struct nfs_pgio_header *hdr); 1738 void (*completion)(struct nfs_pgio_header *hdr); 1739 void (*reschedule_io)(struct nfs_pgio_header *hdr); 1740}; 1741 1742struct nfs_unlinkdata { 1743 struct nfs_removeargs args; 1744 struct nfs_removeres res; 1745 struct dentry *dentry; 1746 wait_queue_head_t wq; 1747 const struct cred *cred; 1748 struct nfs_fattr dir_attr; 1749 long timeout; 1750}; 1751 1752struct nfs_renamedata { 1753 struct nfs_renameargs args; 1754 struct nfs_renameres res; 1755 struct rpc_task task; 1756 const struct cred *cred; 1757 struct inode *old_dir; 1758 struct dentry *old_dentry; 1759 struct nfs_fattr old_fattr; 1760 struct inode *new_dir; 1761 struct dentry *new_dentry; 1762 struct nfs_fattr new_fattr; 1763 void (*complete)(struct rpc_task *, struct nfs_renamedata *); 1764 long timeout; 1765 bool cancelled; 1766}; 1767 1768struct nfs_access_entry; 1769struct nfs_client; 1770struct rpc_timeout; 1771struct nfs_subversion; 1772struct nfs_mount_info; 1773struct nfs_client_initdata; 1774struct nfs_pageio_descriptor; 1775struct fs_context; 1776 1777/* 1778 * RPC procedure vector for NFSv2/NFSv3 demuxing 1779 */ 1780struct nfs_rpc_ops { 1781 u32 version; /* Protocol version */ 1782 const struct dentry_operations *dentry_ops; 1783 const struct inode_operations *dir_inode_ops; 1784 const struct inode_operations *file_inode_ops; 1785 const struct file_operations *file_ops; 1786 const struct nlmclnt_operations *nlmclnt_ops; 1787 1788 int (*getroot) (struct nfs_server *, struct nfs_fh *, 1789 struct nfs_fsinfo *); 1790 int (*submount) (struct fs_context *, struct nfs_server *); 1791 int (*try_get_tree) (struct fs_context *); 1792 int (*getattr) (struct nfs_server *, struct nfs_fh *, 1793 struct nfs_fattr *, struct inode *); 1794 int (*setattr) (struct dentry *, struct nfs_fattr *, 1795 struct iattr *); 1796 int (*lookup) (struct inode *, struct dentry *, const struct qstr *, 1797 struct nfs_fh *, struct nfs_fattr *); 1798 int (*lookupp) (struct inode *, struct nfs_fh *, 1799 struct nfs_fattr *); 1800 int (*access) (struct inode *, struct nfs_access_entry *, const struct cred *); 1801 int (*readlink)(struct inode *, struct page *, unsigned int, 1802 unsigned int); 1803 int (*create) (struct inode *, struct dentry *, 1804 struct iattr *, int); 1805 int (*remove) (struct inode *, struct dentry *); 1806 void (*unlink_setup) (struct rpc_message *, struct dentry *, struct inode *); 1807 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *); 1808 int (*unlink_done) (struct rpc_task *, struct inode *); 1809 void (*rename_setup) (struct rpc_message *msg, 1810 struct dentry *old_dentry, 1811 struct dentry *new_dentry, 1812 struct inode *same_parent); 1813 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *); 1814 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); 1815 int (*link) (struct inode *, struct inode *, const struct qstr *); 1816 int (*symlink) (struct inode *, struct dentry *, struct folio *, 1817 unsigned int, struct iattr *); 1818 struct dentry *(*mkdir) (struct inode *, struct dentry *, struct iattr *); 1819 int (*rmdir) (struct inode *, const struct qstr *); 1820 int (*readdir) (struct nfs_readdir_arg *, struct nfs_readdir_res *); 1821 int (*mknod) (struct inode *, struct dentry *, struct iattr *, 1822 dev_t); 1823 int (*statfs) (struct nfs_server *, struct nfs_fh *, 1824 struct nfs_fsstat *); 1825 int (*fsinfo) (struct nfs_server *, struct nfs_fh *, 1826 struct nfs_fsinfo *); 1827 int (*pathconf) (struct nfs_server *, struct nfs_fh *, 1828 struct nfs_pathconf *); 1829 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 1830 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, bool); 1831 int (*pgio_rpc_prepare)(struct rpc_task *, 1832 struct nfs_pgio_header *); 1833 void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *); 1834 int (*read_done)(struct rpc_task *, struct nfs_pgio_header *); 1835 void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *, 1836 struct rpc_clnt **); 1837 int (*write_done)(struct rpc_task *, struct nfs_pgio_header *); 1838 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *, 1839 struct rpc_clnt **); 1840 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); 1841 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *); 1842 int (*lock)(struct file *, int, struct file_lock *); 1843 int (*lock_check_bounds)(const struct file_lock *); 1844 void (*clear_acl_cache)(struct inode *); 1845 void (*close_context)(struct nfs_open_context *ctx, int); 1846 struct inode * (*open_context) (struct inode *dir, 1847 struct nfs_open_context *ctx, 1848 int open_flags, 1849 struct iattr *iattr, 1850 int *); 1851 int (*have_delegation)(struct inode *, fmode_t, int); 1852 int (*return_delegation)(struct inode *); 1853 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *); 1854 struct nfs_client *(*init_client) (struct nfs_client *, 1855 const struct nfs_client_initdata *); 1856 void (*free_client) (struct nfs_client *); 1857 struct nfs_server *(*create_server)(struct fs_context *); 1858 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *, 1859 struct nfs_fattr *, rpc_authflavor_t); 1860 int (*discover_trunking)(struct nfs_server *, struct nfs_fh *); 1861 void (*enable_swap)(struct inode *inode); 1862 void (*disable_swap)(struct inode *inode); 1863}; 1864 1865/* 1866 * Helper functions used by NFS client and/or server 1867 */ 1868static inline void encode_opaque_fixed(struct xdr_stream *xdr, 1869 const void *buf, size_t len) 1870{ 1871 WARN_ON_ONCE(xdr_stream_encode_opaque_fixed(xdr, buf, len) < 0); 1872} 1873 1874static inline int decode_opaque_fixed(struct xdr_stream *xdr, 1875 void *buf, size_t len) 1876{ 1877 ssize_t ret = xdr_stream_decode_opaque_fixed(xdr, buf, len); 1878 if (unlikely(ret < 0)) 1879 return -EIO; 1880 return 0; 1881} 1882 1883/* 1884 * Function vectors etc. for the NFS client 1885 */ 1886extern const struct nfs_rpc_ops nfs_v2_clientops; 1887extern const struct nfs_rpc_ops nfs_v3_clientops; 1888extern const struct nfs_rpc_ops nfs_v4_clientops; 1889extern const struct rpc_version nfs_version2; 1890extern const struct rpc_version nfs_version3; 1891extern const struct rpc_version nfs_version4; 1892 1893extern const struct rpc_version nfsacl_version3; 1894extern const struct rpc_program nfsacl_program; 1895 1896#endif /* _LINUX_NFS_XDR_H */