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