Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at ee9dce44362b2d8132c32964656ab6dff7dfbc6a 1896 lines 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 const struct nfs4_sequence_slot_ops *sr_slot_ops; 213 struct nfs4_slot *sr_slot; /* slot used to send request */ 214 unsigned long sr_timestamp; 215 int sr_status; /* sequence operation status */ 216 u32 sr_status_flags; 217 u32 sr_highest_slotid; 218 u32 sr_target_highest_slotid; 219}; 220 221struct nfs4_get_lease_time_args { 222 struct nfs4_sequence_args la_seq_args; 223}; 224 225struct nfs4_get_lease_time_res { 226 struct nfs4_sequence_res lr_seq_res; 227 struct nfs_fsinfo *lr_fsinfo; 228}; 229 230struct xdr_stream; 231struct nfs4_xdr_opaque_data; 232 233struct nfs4_xdr_opaque_ops { 234 void (*encode)(struct xdr_stream *, const void *args, 235 const struct nfs4_xdr_opaque_data *); 236 void (*free)(struct nfs4_xdr_opaque_data *); 237}; 238 239struct nfs4_xdr_opaque_data { 240 const struct nfs4_xdr_opaque_ops *ops; 241 void *data; 242}; 243 244#define PNFS_LAYOUT_MAXSIZE 4096 245 246struct nfs4_layoutdriver_data { 247 struct page **pages; 248 __u32 pglen; 249 __u32 len; 250}; 251 252struct pnfs_layout_range { 253 u32 iomode; 254 u64 offset; 255 u64 length; 256}; 257 258struct nfs4_layoutget_args { 259 struct nfs4_sequence_args seq_args; 260 __u32 type; 261 struct pnfs_layout_range range; 262 __u64 minlength; 263 __u32 maxcount; 264 struct inode *inode; 265 struct nfs_open_context *ctx; 266 nfs4_stateid stateid; 267 struct nfs4_layoutdriver_data layout; 268}; 269 270struct nfs4_layoutget_res { 271 struct nfs4_sequence_res seq_res; 272 int status; 273 __u32 return_on_close; 274 struct pnfs_layout_range range; 275 __u32 type; 276 nfs4_stateid stateid; 277 struct nfs4_layoutdriver_data *layoutp; 278}; 279 280struct nfs4_layoutget { 281 struct nfs4_layoutget_args args; 282 struct nfs4_layoutget_res res; 283 const struct cred *cred; 284 struct pnfs_layout_hdr *lo; 285 gfp_t gfp_flags; 286}; 287 288struct nfs4_getdeviceinfo_args { 289 struct nfs4_sequence_args seq_args; 290 struct pnfs_device *pdev; 291 __u32 notify_types; 292}; 293 294struct nfs4_getdeviceinfo_res { 295 struct nfs4_sequence_res seq_res; 296 struct pnfs_device *pdev; 297 __u32 notification; 298}; 299 300struct nfs4_layoutcommit_args { 301 struct nfs4_sequence_args seq_args; 302 nfs4_stateid stateid; 303 __u64 lastbytewritten; 304 struct inode *inode; 305 const u32 *bitmask; 306 size_t layoutupdate_len; 307 struct page *layoutupdate_page; 308 struct page **layoutupdate_pages; 309 __be32 *start_p; 310}; 311 312struct nfs4_layoutcommit_res { 313 struct nfs4_sequence_res seq_res; 314 struct nfs_fattr *fattr; 315 const struct nfs_server *server; 316 int status; 317}; 318 319struct nfs4_layoutcommit_data { 320 struct rpc_task task; 321 struct nfs_fattr fattr; 322 struct list_head lseg_list; 323 const struct cred *cred; 324 struct inode *inode; 325 struct nfs4_layoutcommit_args args; 326 struct nfs4_layoutcommit_res res; 327}; 328 329struct nfs4_layoutreturn_args { 330 struct nfs4_sequence_args seq_args; 331 struct pnfs_layout_hdr *layout; 332 struct inode *inode; 333 struct pnfs_layout_range range; 334 nfs4_stateid stateid; 335 __u32 layout_type; 336 struct nfs4_xdr_opaque_data *ld_private; 337}; 338 339struct nfs4_layoutreturn_res { 340 struct nfs4_sequence_res seq_res; 341 u32 lrs_present; 342 nfs4_stateid stateid; 343}; 344 345struct nfs4_layoutreturn { 346 struct nfs4_layoutreturn_args args; 347 struct nfs4_layoutreturn_res res; 348 const struct cred *cred; 349 struct nfs_client *clp; 350 struct inode *inode; 351 int rpc_status; 352 struct nfs4_xdr_opaque_data ld_private; 353}; 354 355#define PNFS_LAYOUTSTATS_MAXSIZE 256 356 357struct nfs42_layoutstat_args; 358struct nfs42_layoutstat_devinfo; 359typedef void (*layoutstats_encode_t)(struct xdr_stream *, 360 struct nfs42_layoutstat_args *, 361 struct nfs42_layoutstat_devinfo *); 362 363/* Per file per deviceid layoutstats */ 364struct nfs42_layoutstat_devinfo { 365 struct nfs4_deviceid dev_id; 366 __u64 offset; 367 __u64 length; 368 __u64 read_count; 369 __u64 read_bytes; 370 __u64 write_count; 371 __u64 write_bytes; 372 __u32 layout_type; 373 struct nfs4_xdr_opaque_data ld_private; 374}; 375 376struct nfs42_layoutstat_args { 377 struct nfs4_sequence_args seq_args; 378 struct nfs_fh *fh; 379 struct inode *inode; 380 nfs4_stateid stateid; 381 int num_dev; 382 struct nfs42_layoutstat_devinfo *devinfo; 383}; 384 385struct nfs42_layoutstat_res { 386 struct nfs4_sequence_res seq_res; 387 int num_dev; 388 int rpc_status; 389}; 390 391struct nfs42_layoutstat_data { 392 struct inode *inode; 393 struct nfs42_layoutstat_args args; 394 struct nfs42_layoutstat_res res; 395}; 396 397struct nfs42_device_error { 398 struct nfs4_deviceid dev_id; 399 int status; 400 enum nfs_opnum4 opnum; 401}; 402 403struct nfs42_layout_error { 404 __u64 offset; 405 __u64 length; 406 nfs4_stateid stateid; 407 struct nfs42_device_error errors[1]; 408}; 409 410#define NFS42_LAYOUTERROR_MAX 5 411 412struct nfs42_layouterror_args { 413 struct nfs4_sequence_args seq_args; 414 struct inode *inode; 415 unsigned int num_errors; 416 struct nfs42_layout_error errors[NFS42_LAYOUTERROR_MAX]; 417}; 418 419struct nfs42_layouterror_res { 420 struct nfs4_sequence_res seq_res; 421 unsigned int num_errors; 422 int rpc_status; 423}; 424 425struct nfs42_layouterror_data { 426 struct nfs42_layouterror_args args; 427 struct nfs42_layouterror_res res; 428 struct inode *inode; 429 struct pnfs_layout_segment *lseg; 430}; 431 432struct nfs42_clone_args { 433 struct nfs4_sequence_args seq_args; 434 struct nfs_fh *src_fh; 435 struct nfs_fh *dst_fh; 436 nfs4_stateid src_stateid; 437 nfs4_stateid dst_stateid; 438 __u64 src_offset; 439 __u64 dst_offset; 440 __u64 count; 441 const u32 *dst_bitmask; 442}; 443 444struct nfs42_clone_res { 445 struct nfs4_sequence_res seq_res; 446 unsigned int rpc_status; 447 struct nfs_fattr *dst_fattr; 448 const struct nfs_server *server; 449}; 450 451struct stateowner_id { 452 __u64 create_time; 453 __u64 uniquifier; 454}; 455 456struct nfs4_open_delegation { 457 __u32 open_delegation_type; 458 union { 459 struct { 460 fmode_t type; 461 __u32 do_recall; 462 nfs4_stateid stateid; 463 unsigned long pagemod_limit; 464 }; 465 struct { 466 __u32 why_no_delegation; 467 __u32 will_notify; 468 }; 469 }; 470}; 471 472/* 473 * Arguments to the open call. 474 */ 475struct nfs_openargs { 476 struct nfs4_sequence_args seq_args; 477 const struct nfs_fh * fh; 478 struct nfs_seqid * seqid; 479 int open_flags; 480 fmode_t fmode; 481 u32 share_access; 482 u32 access; 483 __u64 clientid; 484 struct stateowner_id id; 485 union { 486 struct { 487 struct iattr * attrs; /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */ 488 nfs4_verifier verifier; /* EXCLUSIVE */ 489 }; 490 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */ 491 __u32 delegation_type; /* CLAIM_PREVIOUS */ 492 } u; 493 const struct qstr * name; 494 const struct nfs_server *server; /* Needed for ID mapping */ 495 const u32 * bitmask; 496 const u32 * open_bitmap; 497 enum open_claim_type4 claim; 498 enum createmode4 createmode; 499 const struct nfs4_label *label; 500 umode_t umask; 501 struct nfs4_layoutget_args *lg_args; 502}; 503 504struct nfs_openres { 505 struct nfs4_sequence_res seq_res; 506 nfs4_stateid stateid; 507 struct nfs_fh fh; 508 struct nfs4_change_info cinfo; 509 __u32 rflags; 510 struct nfs_fattr * f_attr; 511 struct nfs_seqid * seqid; 512 const struct nfs_server *server; 513 __u32 attrset[NFS4_BITMAP_SIZE]; 514 struct nfs4_string *owner; 515 struct nfs4_string *group_owner; 516 struct nfs4_open_delegation delegation; 517 __u32 access_request; 518 __u32 access_supported; 519 __u32 access_result; 520 struct nfs4_layoutget_res *lg_res; 521}; 522 523/* 524 * Arguments to the open_confirm call. 525 */ 526struct nfs_open_confirmargs { 527 struct nfs4_sequence_args seq_args; 528 const struct nfs_fh * fh; 529 nfs4_stateid * stateid; 530 struct nfs_seqid * seqid; 531}; 532 533struct nfs_open_confirmres { 534 struct nfs4_sequence_res seq_res; 535 nfs4_stateid stateid; 536 struct nfs_seqid * seqid; 537}; 538 539/* 540 * Arguments to the close call. 541 */ 542struct nfs_closeargs { 543 struct nfs4_sequence_args seq_args; 544 struct nfs_fh * fh; 545 nfs4_stateid stateid; 546 struct nfs_seqid * seqid; 547 fmode_t fmode; 548 u32 share_access; 549 const u32 * bitmask; 550 u32 bitmask_store[NFS_BITMASK_SZ]; 551 struct nfs4_layoutreturn_args *lr_args; 552}; 553 554struct nfs_closeres { 555 struct nfs4_sequence_res seq_res; 556 nfs4_stateid stateid; 557 struct nfs_fattr * fattr; 558 struct nfs_seqid * seqid; 559 const struct nfs_server *server; 560 struct nfs4_layoutreturn_res *lr_res; 561 int lr_ret; 562}; 563/* 564 * * Arguments to the lock,lockt, and locku call. 565 * */ 566struct nfs_lowner { 567 __u64 clientid; 568 __u64 id; 569 dev_t s_dev; 570}; 571 572struct nfs_lock_args { 573 struct nfs4_sequence_args seq_args; 574 struct nfs_fh * fh; 575 struct file_lock * fl; 576 struct nfs_seqid * lock_seqid; 577 nfs4_stateid lock_stateid; 578 struct nfs_seqid * open_seqid; 579 nfs4_stateid open_stateid; 580 struct nfs_lowner lock_owner; 581 unsigned char block : 1; 582 unsigned char reclaim : 1; 583 unsigned char new_lock : 1; 584 unsigned char new_lock_owner : 1; 585}; 586 587struct nfs_lock_res { 588 struct nfs4_sequence_res seq_res; 589 nfs4_stateid stateid; 590 struct nfs_seqid * lock_seqid; 591 struct nfs_seqid * open_seqid; 592}; 593 594struct nfs_locku_args { 595 struct nfs4_sequence_args seq_args; 596 struct nfs_fh * fh; 597 struct file_lock * fl; 598 struct nfs_seqid * seqid; 599 nfs4_stateid stateid; 600}; 601 602struct nfs_locku_res { 603 struct nfs4_sequence_res seq_res; 604 nfs4_stateid stateid; 605 struct nfs_seqid * seqid; 606}; 607 608struct nfs_lockt_args { 609 struct nfs4_sequence_args seq_args; 610 struct nfs_fh * fh; 611 struct file_lock * fl; 612 struct nfs_lowner lock_owner; 613}; 614 615struct nfs_lockt_res { 616 struct nfs4_sequence_res seq_res; 617 struct file_lock * denied; /* LOCK, LOCKT failed */ 618}; 619 620struct nfs_release_lockowner_args { 621 struct nfs4_sequence_args seq_args; 622 struct nfs_lowner lock_owner; 623}; 624 625struct nfs_release_lockowner_res { 626 struct nfs4_sequence_res seq_res; 627}; 628 629struct nfs4_delegattr { 630 struct timespec64 atime; 631 struct timespec64 mtime; 632 bool atime_set; 633 bool mtime_set; 634}; 635 636struct nfs4_delegreturnargs { 637 struct nfs4_sequence_args seq_args; 638 const struct nfs_fh *fhandle; 639 const nfs4_stateid *stateid; 640 const u32 *bitmask; 641 u32 bitmask_store[NFS_BITMASK_SZ]; 642 struct nfs4_layoutreturn_args *lr_args; 643 struct nfs4_delegattr *sattr_args; 644}; 645 646struct nfs4_delegreturnres { 647 struct nfs4_sequence_res seq_res; 648 struct nfs_fattr * fattr; 649 struct nfs_server *server; 650 struct nfs4_layoutreturn_res *lr_res; 651 int lr_ret; 652 bool sattr_res; 653 int sattr_ret; 654}; 655 656/* 657 * Arguments to the write call. 658 */ 659struct nfs_write_verifier { 660 char data[8]; 661}; 662 663struct nfs_writeverf { 664 struct nfs_write_verifier verifier; 665 enum nfs3_stable_how committed; 666}; 667 668/* 669 * Arguments shared by the read and write call. 670 */ 671struct nfs_pgio_args { 672 struct nfs4_sequence_args seq_args; 673 struct nfs_fh * fh; 674 struct nfs_open_context *context; 675 struct nfs_lock_context *lock_context; 676 nfs4_stateid stateid; 677 __u64 offset; 678 __u32 count; 679 unsigned int pgbase; 680 struct page ** pages; 681 union { 682 unsigned int replen; /* used by read */ 683 struct { 684 const u32 * bitmask; /* used by write */ 685 u32 bitmask_store[NFS_BITMASK_SZ]; /* used by write */ 686 enum nfs3_stable_how stable; /* used by write */ 687 }; 688 }; 689}; 690 691struct nfs_pgio_res { 692 struct nfs4_sequence_res seq_res; 693 struct nfs_fattr * fattr; 694 __u64 count; 695 __u32 op_status; 696 union { 697 struct { 698 unsigned int replen; /* used by read */ 699 int eof; /* used by read */ 700 void * scratch; /* used by read */ 701 }; 702 struct { 703 struct nfs_writeverf * verf; /* used by write */ 704 const struct nfs_server *server; /* used by write */ 705 }; 706 }; 707}; 708 709/* 710 * Arguments to the commit call. 711 */ 712struct nfs_commitargs { 713 struct nfs4_sequence_args seq_args; 714 struct nfs_fh *fh; 715 __u64 offset; 716 __u32 count; 717 const u32 *bitmask; 718}; 719 720struct nfs_commitres { 721 struct nfs4_sequence_res seq_res; 722 __u32 op_status; 723 struct nfs_fattr *fattr; 724 struct nfs_writeverf *verf; 725 const struct nfs_server *server; 726}; 727 728/* 729 * Common arguments to the unlink call 730 */ 731struct nfs_removeargs { 732 struct nfs4_sequence_args seq_args; 733 const struct nfs_fh *fh; 734 struct qstr name; 735}; 736 737struct nfs_removeres { 738 struct nfs4_sequence_res seq_res; 739 struct nfs_server *server; 740 struct nfs_fattr *dir_attr; 741 struct nfs4_change_info cinfo; 742}; 743 744/* 745 * Common arguments to the rename call 746 */ 747struct nfs_renameargs { 748 struct nfs4_sequence_args seq_args; 749 const struct nfs_fh *old_dir; 750 const struct nfs_fh *new_dir; 751 const struct qstr *old_name; 752 const struct qstr *new_name; 753}; 754 755struct nfs_renameres { 756 struct nfs4_sequence_res seq_res; 757 struct nfs_server *server; 758 struct nfs4_change_info old_cinfo; 759 struct nfs_fattr *old_fattr; 760 struct nfs4_change_info new_cinfo; 761 struct nfs_fattr *new_fattr; 762}; 763 764/* parsed sec= options */ 765#define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */ 766struct nfs_auth_info { 767 unsigned int flavor_len; 768 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS]; 769}; 770 771/* 772 * Argument struct for decode_entry function 773 */ 774struct nfs_entry { 775 __u64 ino; 776 __u64 cookie; 777 const char * name; 778 unsigned int len; 779 int eof; 780 struct nfs_fh * fh; 781 struct nfs_fattr * fattr; 782 unsigned char d_type; 783 struct nfs_server * server; 784}; 785 786struct nfs_readdir_arg { 787 struct dentry *dentry; 788 const struct cred *cred; 789 __be32 *verf; 790 u64 cookie; 791 struct page **pages; 792 unsigned int page_len; 793 bool plus; 794}; 795 796struct nfs_readdir_res { 797 __be32 *verf; 798}; 799 800/* 801 * The following types are for NFSv2 only. 802 */ 803struct nfs_sattrargs { 804 struct nfs_fh * fh; 805 struct iattr * sattr; 806}; 807 808struct nfs_diropargs { 809 struct nfs_fh * fh; 810 const char * name; 811 unsigned int len; 812}; 813 814struct nfs_createargs { 815 struct nfs_fh * fh; 816 const char * name; 817 unsigned int len; 818 struct iattr * sattr; 819}; 820 821struct nfs_setattrargs { 822 struct nfs4_sequence_args seq_args; 823 struct nfs_fh * fh; 824 nfs4_stateid stateid; 825 struct iattr * iap; 826 const struct nfs_server * server; /* Needed for name mapping */ 827 const u32 * bitmask; 828 const struct nfs4_label *label; 829}; 830 831enum nfs4_acl_type { 832 NFS4ACL_NONE = 0, 833 NFS4ACL_ACL, 834 NFS4ACL_DACL, 835 NFS4ACL_SACL, 836}; 837 838struct nfs_setaclargs { 839 struct nfs4_sequence_args seq_args; 840 struct nfs_fh * fh; 841 enum nfs4_acl_type acl_type; 842 size_t acl_len; 843 struct page ** acl_pages; 844}; 845 846struct nfs_setaclres { 847 struct nfs4_sequence_res seq_res; 848}; 849 850struct nfs_getaclargs { 851 struct nfs4_sequence_args seq_args; 852 struct nfs_fh * fh; 853 enum nfs4_acl_type acl_type; 854 size_t acl_len; 855 struct page ** acl_pages; 856}; 857 858/* getxattr ACL interface flags */ 859#define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */ 860struct nfs_getaclres { 861 struct nfs4_sequence_res seq_res; 862 enum nfs4_acl_type acl_type; 863 size_t acl_len; 864 size_t acl_data_offset; 865 int acl_flags; 866 struct folio * acl_scratch; 867}; 868 869struct nfs_setattrres { 870 struct nfs4_sequence_res seq_res; 871 struct nfs_fattr * fattr; 872 const struct nfs_server * server; 873}; 874 875struct nfs_linkargs { 876 struct nfs_fh * fromfh; 877 struct nfs_fh * tofh; 878 const char * toname; 879 unsigned int tolen; 880}; 881 882struct nfs_symlinkargs { 883 struct nfs_fh * fromfh; 884 const char * fromname; 885 unsigned int fromlen; 886 struct page ** pages; 887 unsigned int pathlen; 888 struct iattr * sattr; 889}; 890 891struct nfs_readdirargs { 892 struct nfs_fh * fh; 893 __u32 cookie; 894 unsigned int count; 895 struct page ** pages; 896}; 897 898struct nfs3_getaclargs { 899 struct nfs_fh * fh; 900 int mask; 901 struct page ** pages; 902}; 903 904struct nfs3_setaclargs { 905 struct inode * inode; 906 int mask; 907 struct posix_acl * acl_access; 908 struct posix_acl * acl_default; 909 size_t len; 910 unsigned int npages; 911 struct page ** pages; 912}; 913 914struct nfs_diropok { 915 struct nfs_fh * fh; 916 struct nfs_fattr * fattr; 917}; 918 919struct nfs_readlinkargs { 920 struct nfs_fh * fh; 921 unsigned int pgbase; 922 unsigned int pglen; 923 struct page ** pages; 924}; 925 926struct nfs3_sattrargs { 927 struct nfs_fh * fh; 928 struct iattr * sattr; 929 unsigned int guard; 930 struct timespec64 guardtime; 931}; 932 933struct nfs3_diropargs { 934 struct nfs_fh * fh; 935 const char * name; 936 unsigned int len; 937}; 938 939struct nfs3_accessargs { 940 struct nfs_fh * fh; 941 __u32 access; 942}; 943 944struct nfs3_createargs { 945 struct nfs_fh * fh; 946 const char * name; 947 unsigned int len; 948 struct iattr * sattr; 949 enum nfs3_createmode createmode; 950 __be32 verifier[2]; 951}; 952 953struct nfs3_mkdirargs { 954 struct nfs_fh * fh; 955 const char * name; 956 unsigned int len; 957 struct iattr * sattr; 958}; 959 960struct nfs3_symlinkargs { 961 struct nfs_fh * fromfh; 962 const char * fromname; 963 unsigned int fromlen; 964 struct page ** pages; 965 unsigned int pathlen; 966 struct iattr * sattr; 967}; 968 969struct nfs3_mknodargs { 970 struct nfs_fh * fh; 971 const char * name; 972 unsigned int len; 973 enum nfs3_ftype type; 974 struct iattr * sattr; 975 dev_t rdev; 976}; 977 978struct nfs3_linkargs { 979 struct nfs_fh * fromfh; 980 struct nfs_fh * tofh; 981 const char * toname; 982 unsigned int tolen; 983}; 984 985struct nfs3_readdirargs { 986 struct nfs_fh * fh; 987 __u64 cookie; 988 __be32 verf[2]; 989 bool plus; 990 unsigned int count; 991 struct page ** pages; 992}; 993 994struct nfs3_diropres { 995 struct nfs_fattr * dir_attr; 996 struct nfs_fh * fh; 997 struct nfs_fattr * fattr; 998}; 999 1000struct nfs3_accessres { 1001 struct nfs_fattr * fattr; 1002 __u32 access; 1003}; 1004 1005struct nfs3_readlinkargs { 1006 struct nfs_fh * fh; 1007 unsigned int pgbase; 1008 unsigned int pglen; 1009 struct page ** pages; 1010}; 1011 1012struct nfs3_linkres { 1013 struct nfs_fattr * dir_attr; 1014 struct nfs_fattr * fattr; 1015}; 1016 1017struct nfs3_readdirres { 1018 struct nfs_fattr * dir_attr; 1019 __be32 * verf; 1020 bool plus; 1021}; 1022 1023struct nfs3_getaclres { 1024 struct nfs_fattr * fattr; 1025 int mask; 1026 unsigned int acl_access_count; 1027 unsigned int acl_default_count; 1028 struct posix_acl * acl_access; 1029 struct posix_acl * acl_default; 1030}; 1031 1032#if IS_ENABLED(CONFIG_NFS_V4) 1033 1034typedef u64 clientid4; 1035 1036struct nfs4_accessargs { 1037 struct nfs4_sequence_args seq_args; 1038 const struct nfs_fh * fh; 1039 const u32 * bitmask; 1040 u32 access; 1041}; 1042 1043struct nfs4_accessres { 1044 struct nfs4_sequence_res seq_res; 1045 const struct nfs_server * server; 1046 struct nfs_fattr * fattr; 1047 u32 supported; 1048 u32 access; 1049}; 1050 1051struct nfs4_create_arg { 1052 struct nfs4_sequence_args seq_args; 1053 u32 ftype; 1054 union { 1055 struct { 1056 struct page ** pages; 1057 unsigned int len; 1058 } symlink; /* NF4LNK */ 1059 struct { 1060 u32 specdata1; 1061 u32 specdata2; 1062 } device; /* NF4BLK, NF4CHR */ 1063 } u; 1064 const struct qstr * name; 1065 const struct nfs_server * server; 1066 const struct iattr * attrs; 1067 const struct nfs_fh * dir_fh; 1068 const u32 * bitmask; 1069 const struct nfs4_label *label; 1070 umode_t umask; 1071}; 1072 1073struct nfs4_create_res { 1074 struct nfs4_sequence_res seq_res; 1075 const struct nfs_server * server; 1076 struct nfs_fh * fh; 1077 struct nfs_fattr * fattr; 1078 struct nfs4_change_info dir_cinfo; 1079}; 1080 1081struct nfs4_fsinfo_arg { 1082 struct nfs4_sequence_args seq_args; 1083 const struct nfs_fh * fh; 1084 const u32 * bitmask; 1085}; 1086 1087struct nfs4_fsinfo_res { 1088 struct nfs4_sequence_res seq_res; 1089 struct nfs_fsinfo *fsinfo; 1090}; 1091 1092struct nfs4_getattr_arg { 1093 struct nfs4_sequence_args seq_args; 1094 const struct nfs_fh * fh; 1095 const u32 * bitmask; 1096 bool get_dir_deleg; 1097}; 1098 1099struct nfs4_gdd_res { 1100 u32 status; 1101 nfs4_stateid deleg; 1102}; 1103 1104struct nfs4_getattr_res { 1105 struct nfs4_sequence_res seq_res; 1106 const struct nfs_server * server; 1107 struct nfs_fattr * fattr; 1108 struct nfs4_gdd_res * gdd_res; 1109}; 1110 1111struct nfs4_link_arg { 1112 struct nfs4_sequence_args seq_args; 1113 const struct nfs_fh * fh; 1114 const struct nfs_fh * dir_fh; 1115 const struct qstr * name; 1116 const u32 * bitmask; 1117}; 1118 1119struct nfs4_link_res { 1120 struct nfs4_sequence_res seq_res; 1121 const struct nfs_server * server; 1122 struct nfs_fattr * fattr; 1123 struct nfs4_change_info cinfo; 1124 struct nfs_fattr * dir_attr; 1125}; 1126 1127struct nfs4_lookup_arg { 1128 struct nfs4_sequence_args seq_args; 1129 const struct nfs_fh * dir_fh; 1130 const struct qstr * name; 1131 const u32 * bitmask; 1132}; 1133 1134struct nfs4_lookup_res { 1135 struct nfs4_sequence_res seq_res; 1136 const struct nfs_server * server; 1137 struct nfs_fattr * fattr; 1138 struct nfs_fh * fh; 1139}; 1140 1141struct nfs4_lookupp_arg { 1142 struct nfs4_sequence_args seq_args; 1143 const struct nfs_fh *fh; 1144 const u32 *bitmask; 1145}; 1146 1147struct nfs4_lookupp_res { 1148 struct nfs4_sequence_res seq_res; 1149 const struct nfs_server *server; 1150 struct nfs_fattr *fattr; 1151 struct nfs_fh *fh; 1152}; 1153 1154struct nfs4_lookup_root_arg { 1155 struct nfs4_sequence_args seq_args; 1156 const u32 * bitmask; 1157}; 1158 1159struct nfs4_pathconf_arg { 1160 struct nfs4_sequence_args seq_args; 1161 const struct nfs_fh * fh; 1162 const u32 * bitmask; 1163}; 1164 1165struct nfs4_pathconf_res { 1166 struct nfs4_sequence_res seq_res; 1167 struct nfs_pathconf *pathconf; 1168}; 1169 1170struct nfs4_readdir_arg { 1171 struct nfs4_sequence_args seq_args; 1172 const struct nfs_fh * fh; 1173 u64 cookie; 1174 nfs4_verifier verifier; 1175 u32 count; 1176 struct page ** pages; /* zero-copy data */ 1177 unsigned int pgbase; /* zero-copy data */ 1178 const u32 * bitmask; 1179 bool plus; 1180}; 1181 1182struct nfs4_readdir_res { 1183 struct nfs4_sequence_res seq_res; 1184 nfs4_verifier verifier; 1185 unsigned int pgbase; 1186}; 1187 1188struct nfs4_readlink { 1189 struct nfs4_sequence_args seq_args; 1190 const struct nfs_fh * fh; 1191 unsigned int pgbase; 1192 unsigned int pglen; /* zero-copy data */ 1193 struct page ** pages; /* zero-copy data */ 1194}; 1195 1196struct nfs4_readlink_res { 1197 struct nfs4_sequence_res seq_res; 1198}; 1199 1200struct nfs4_setclientid { 1201 const nfs4_verifier * sc_verifier; 1202 u32 sc_prog; 1203 unsigned int sc_netid_len; 1204 char sc_netid[RPCBIND_MAXNETIDLEN + 1]; 1205 unsigned int sc_uaddr_len; 1206 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1]; 1207 struct nfs_client *sc_clnt; 1208 struct rpc_cred *sc_cred; 1209}; 1210 1211struct nfs4_setclientid_res { 1212 u64 clientid; 1213 nfs4_verifier confirm; 1214}; 1215 1216struct nfs4_statfs_arg { 1217 struct nfs4_sequence_args seq_args; 1218 const struct nfs_fh * fh; 1219 const u32 * bitmask; 1220}; 1221 1222struct nfs4_statfs_res { 1223 struct nfs4_sequence_res seq_res; 1224 struct nfs_fsstat *fsstat; 1225}; 1226 1227struct nfs4_open_caps { 1228 u32 oa_share_access[1]; 1229 u32 oa_share_deny[1]; 1230 u32 oa_share_access_want[1]; 1231 u32 oa_open_claim[1]; 1232 u32 oa_createmode[1]; 1233}; 1234 1235struct nfs4_server_caps_arg { 1236 struct nfs4_sequence_args seq_args; 1237 struct nfs_fh *fhandle; 1238 const u32 * bitmask; 1239}; 1240 1241struct nfs4_server_caps_res { 1242 struct nfs4_sequence_res seq_res; 1243 u32 attr_bitmask[3]; 1244 u32 exclcreat_bitmask[3]; 1245 u32 acl_bitmask; 1246 u32 has_links; 1247 u32 has_symlinks; 1248 u32 fh_expire_type; 1249 u32 case_insensitive; 1250 u32 case_preserving; 1251 struct nfs4_open_caps open_caps; 1252}; 1253 1254#define NFS4_PATHNAME_MAXCOMPONENTS 512 1255struct nfs4_pathname { 1256 unsigned int ncomponents; 1257 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS]; 1258}; 1259 1260#define NFS4_FS_LOCATION_MAXSERVERS 10 1261struct nfs4_fs_location { 1262 unsigned int nservers; 1263 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS]; 1264 struct nfs4_pathname rootpath; 1265}; 1266 1267#define NFS4_FS_LOCATIONS_MAXENTRIES 10 1268struct nfs4_fs_locations { 1269 struct nfs_fattr *fattr; 1270 const struct nfs_server *server; 1271 struct nfs4_pathname fs_path; 1272 int nlocations; 1273 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES]; 1274}; 1275 1276struct nfs4_fs_locations_arg { 1277 struct nfs4_sequence_args seq_args; 1278 const struct nfs_fh *dir_fh; 1279 const struct nfs_fh *fh; 1280 const struct qstr *name; 1281 struct page *page; 1282 const u32 *bitmask; 1283 clientid4 clientid; 1284 unsigned char migration:1, renew:1; 1285}; 1286 1287struct nfs4_fs_locations_res { 1288 struct nfs4_sequence_res seq_res; 1289 struct nfs4_fs_locations *fs_locations; 1290 unsigned char migration:1, renew:1; 1291}; 1292 1293struct nfs4_secinfo4 { 1294 u32 flavor; 1295 struct rpcsec_gss_info flavor_info; 1296}; 1297 1298struct nfs4_secinfo_flavors { 1299 unsigned int num_flavors; 1300 struct nfs4_secinfo4 flavors[]; 1301}; 1302 1303struct nfs4_secinfo_arg { 1304 struct nfs4_sequence_args seq_args; 1305 const struct nfs_fh *dir_fh; 1306 const struct qstr *name; 1307}; 1308 1309struct nfs4_secinfo_res { 1310 struct nfs4_sequence_res seq_res; 1311 struct nfs4_secinfo_flavors *flavors; 1312}; 1313 1314struct nfs4_fsid_present_arg { 1315 struct nfs4_sequence_args seq_args; 1316 const struct nfs_fh *fh; 1317 clientid4 clientid; 1318 unsigned char renew:1; 1319}; 1320 1321struct nfs4_fsid_present_res { 1322 struct nfs4_sequence_res seq_res; 1323 struct nfs_fh *fh; 1324 unsigned char renew:1; 1325}; 1326 1327struct pnfs_commit_bucket { 1328 struct list_head written; 1329 struct list_head committing; 1330 struct pnfs_layout_segment *lseg; 1331 struct nfs_writeverf direct_verf; 1332}; 1333 1334struct pnfs_commit_array { 1335 struct list_head cinfo_list; 1336 struct list_head lseg_list; 1337 struct pnfs_layout_segment *lseg; 1338 struct rcu_head rcu; 1339 refcount_t refcount; 1340 unsigned int nbuckets; 1341 struct pnfs_commit_bucket buckets[] __counted_by(nbuckets); 1342}; 1343 1344struct pnfs_ds_commit_info { 1345 struct list_head commits; 1346 unsigned int nwritten; 1347 unsigned int ncommitting; 1348 const struct pnfs_commit_ops *ops; 1349}; 1350 1351struct nfs41_state_protection { 1352 u32 how; 1353 struct nfs4_op_map enforce; 1354 struct nfs4_op_map allow; 1355}; 1356 1357struct nfs41_exchange_id_args { 1358 struct nfs_client *client; 1359 nfs4_verifier verifier; 1360 u32 flags; 1361 struct nfs41_state_protection state_protect; 1362}; 1363 1364struct nfs41_server_owner { 1365 uint64_t minor_id; 1366 uint32_t major_id_sz; 1367 char major_id[NFS4_OPAQUE_LIMIT]; 1368}; 1369 1370struct nfs41_server_scope { 1371 uint32_t server_scope_sz; 1372 char server_scope[NFS4_OPAQUE_LIMIT]; 1373}; 1374 1375struct nfs41_impl_id { 1376 char domain[NFS4_OPAQUE_LIMIT + 1]; 1377 char name[NFS4_OPAQUE_LIMIT + 1]; 1378 struct nfstime4 date; 1379}; 1380 1381#define MAX_BIND_CONN_TO_SESSION_RETRIES 3 1382struct nfs41_bind_conn_to_session_args { 1383 struct nfs_client *client; 1384 struct nfs4_sessionid sessionid; 1385 u32 dir; 1386 bool use_conn_in_rdma_mode; 1387 int retries; 1388}; 1389 1390struct nfs41_bind_conn_to_session_res { 1391 struct nfs4_sessionid sessionid; 1392 u32 dir; 1393 bool use_conn_in_rdma_mode; 1394}; 1395 1396struct nfs41_exchange_id_res { 1397 u64 clientid; 1398 u32 seqid; 1399 u32 flags; 1400 struct nfs41_server_owner *server_owner; 1401 struct nfs41_server_scope *server_scope; 1402 struct nfs41_impl_id *impl_id; 1403 struct nfs41_state_protection state_protect; 1404}; 1405 1406struct nfs41_create_session_args { 1407 struct nfs_client *client; 1408 u64 clientid; 1409 uint32_t seqid; 1410 uint32_t flags; 1411 uint32_t cb_program; 1412 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */ 1413 struct nfs4_channel_attrs bc_attrs; /* Back Channel */ 1414}; 1415 1416struct nfs41_create_session_res { 1417 struct nfs4_sessionid sessionid; 1418 uint32_t seqid; 1419 uint32_t flags; 1420 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */ 1421 struct nfs4_channel_attrs bc_attrs; /* Back Channel */ 1422}; 1423 1424struct nfs41_reclaim_complete_args { 1425 struct nfs4_sequence_args seq_args; 1426 /* In the future extend to include curr_fh for use with migration */ 1427 unsigned char one_fs:1; 1428}; 1429 1430struct nfs41_reclaim_complete_res { 1431 struct nfs4_sequence_res seq_res; 1432}; 1433 1434#define SECINFO_STYLE_CURRENT_FH 0 1435#define SECINFO_STYLE_PARENT 1 1436struct nfs41_secinfo_no_name_args { 1437 struct nfs4_sequence_args seq_args; 1438 int style; 1439}; 1440 1441struct nfs41_test_stateid_args { 1442 struct nfs4_sequence_args seq_args; 1443 nfs4_stateid stateid; 1444}; 1445 1446struct nfs41_test_stateid_res { 1447 struct nfs4_sequence_res seq_res; 1448 unsigned int status; 1449}; 1450 1451struct nfs41_free_stateid_args { 1452 struct nfs4_sequence_args seq_args; 1453 nfs4_stateid stateid; 1454}; 1455 1456struct nfs41_free_stateid_res { 1457 struct nfs4_sequence_res seq_res; 1458 unsigned int status; 1459}; 1460 1461#else 1462 1463struct pnfs_ds_commit_info { 1464}; 1465 1466#endif /* CONFIG_NFS_V4 */ 1467 1468#ifdef CONFIG_NFS_V4_2 1469struct nfs42_falloc_args { 1470 struct nfs4_sequence_args seq_args; 1471 1472 struct nfs_fh *falloc_fh; 1473 nfs4_stateid falloc_stateid; 1474 u64 falloc_offset; 1475 u64 falloc_length; 1476 const u32 *falloc_bitmask; 1477}; 1478 1479struct nfs42_falloc_res { 1480 struct nfs4_sequence_res seq_res; 1481 unsigned int status; 1482 1483 struct nfs_fattr *falloc_fattr; 1484 const struct nfs_server *falloc_server; 1485}; 1486 1487struct nfs42_copy_args { 1488 struct nfs4_sequence_args seq_args; 1489 1490 struct nfs_fh *src_fh; 1491 nfs4_stateid src_stateid; 1492 u64 src_pos; 1493 1494 struct nfs_fh *dst_fh; 1495 nfs4_stateid dst_stateid; 1496 u64 dst_pos; 1497 1498 u64 count; 1499 bool sync; 1500 struct nl4_server *cp_src; 1501}; 1502 1503struct nfs42_write_res { 1504 nfs4_stateid stateid; 1505 u64 count; 1506 struct nfs_writeverf verifier; 1507}; 1508 1509struct nfs42_copy_res { 1510 struct nfs4_sequence_res seq_res; 1511 struct nfs42_write_res write_res; 1512 bool consecutive; 1513 bool synchronous; 1514 struct nfs_commitres commit_res; 1515}; 1516 1517struct nfs42_offload_status_args { 1518 struct nfs4_sequence_args osa_seq_args; 1519 struct nfs_fh *osa_src_fh; 1520 nfs4_stateid osa_stateid; 1521}; 1522 1523struct nfs42_offload_status_res { 1524 struct nfs4_sequence_res osr_seq_res; 1525 u64 osr_count; 1526 int complete_count; 1527 u32 osr_complete; 1528}; 1529 1530struct nfs42_copy_notify_args { 1531 struct nfs4_sequence_args cna_seq_args; 1532 1533 struct nfs_fh *cna_src_fh; 1534 nfs4_stateid cna_src_stateid; 1535 struct nl4_server cna_dst; 1536}; 1537 1538struct nfs42_copy_notify_res { 1539 struct nfs4_sequence_res cnr_seq_res; 1540 1541 struct nfstime4 cnr_lease_time; 1542 nfs4_stateid cnr_stateid; 1543 struct nl4_server cnr_src; 1544}; 1545 1546struct nfs42_seek_args { 1547 struct nfs4_sequence_args seq_args; 1548 1549 struct nfs_fh *sa_fh; 1550 nfs4_stateid sa_stateid; 1551 u64 sa_offset; 1552 u32 sa_what; 1553}; 1554 1555struct nfs42_seek_res { 1556 struct nfs4_sequence_res seq_res; 1557 unsigned int status; 1558 1559 u32 sr_eof; 1560 u64 sr_offset; 1561}; 1562 1563struct nfs42_setxattrargs { 1564 struct nfs4_sequence_args seq_args; 1565 struct nfs_fh *fh; 1566 const u32 *bitmask; 1567 const char *xattr_name; 1568 u32 xattr_flags; 1569 size_t xattr_len; 1570 struct page **xattr_pages; 1571}; 1572 1573struct nfs42_setxattrres { 1574 struct nfs4_sequence_res seq_res; 1575 struct nfs4_change_info cinfo; 1576 struct nfs_fattr *fattr; 1577 const struct nfs_server *server; 1578}; 1579 1580struct nfs42_getxattrargs { 1581 struct nfs4_sequence_args seq_args; 1582 struct nfs_fh *fh; 1583 const char *xattr_name; 1584 size_t xattr_len; 1585 struct page **xattr_pages; 1586}; 1587 1588struct nfs42_getxattrres { 1589 struct nfs4_sequence_res seq_res; 1590 size_t xattr_len; 1591}; 1592 1593struct nfs42_listxattrsargs { 1594 struct nfs4_sequence_args seq_args; 1595 struct nfs_fh *fh; 1596 u32 count; 1597 u64 cookie; 1598 struct page **xattr_pages; 1599}; 1600 1601struct nfs42_listxattrsres { 1602 struct nfs4_sequence_res seq_res; 1603 struct folio *scratch; 1604 void *xattr_buf; 1605 size_t xattr_len; 1606 u64 cookie; 1607 bool eof; 1608 size_t copied; 1609}; 1610 1611struct nfs42_removexattrargs { 1612 struct nfs4_sequence_args seq_args; 1613 struct nfs_fh *fh; 1614 const u32 *bitmask; 1615 const char *xattr_name; 1616}; 1617 1618struct nfs42_removexattrres { 1619 struct nfs4_sequence_res seq_res; 1620 struct nfs4_change_info cinfo; 1621 struct nfs_fattr *fattr; 1622 const struct nfs_server *server; 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 void (*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 */