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        struct pnfs_layout_hdr *lo;
 281        gfp_t gfp_flags;
 282};
 283
 284struct nfs4_getdeviceinfo_args {
 285        struct nfs4_sequence_args seq_args;
 286        struct pnfs_device *pdev;
 287        __u32 notify_types;
 288};
 289
 290struct nfs4_getdeviceinfo_res {
 291        struct nfs4_sequence_res seq_res;
 292        struct pnfs_device *pdev;
 293        __u32 notification;
 294};
 295
 296struct nfs4_layoutcommit_args {
 297        struct nfs4_sequence_args seq_args;
 298        nfs4_stateid stateid;
 299        __u64 lastbytewritten;
 300        struct inode *inode;
 301        const u32 *bitmask;
 302        size_t layoutupdate_len;
 303        struct page *layoutupdate_page;
 304        struct page **layoutupdate_pages;
 305        __be32 *start_p;
 306};
 307
 308struct nfs4_layoutcommit_res {
 309        struct nfs4_sequence_res seq_res;
 310        struct nfs_fattr *fattr;
 311        const struct nfs_server *server;
 312        int status;
 313};
 314
 315struct nfs4_layoutcommit_data {
 316        struct rpc_task task;
 317        struct nfs_fattr fattr;
 318        struct list_head lseg_list;
 319        const struct cred *cred;
 320        struct inode *inode;
 321        struct nfs4_layoutcommit_args args;
 322        struct nfs4_layoutcommit_res res;
 323};
 324
 325struct nfs4_layoutreturn_args {
 326        struct nfs4_sequence_args seq_args;
 327        struct pnfs_layout_hdr *layout;
 328        struct inode *inode;
 329        struct pnfs_layout_range range;
 330        nfs4_stateid stateid;
 331        __u32   layout_type;
 332        struct nfs4_xdr_opaque_data *ld_private;
 333};
 334
 335struct nfs4_layoutreturn_res {
 336        struct nfs4_sequence_res seq_res;
 337        u32 lrs_present;
 338        nfs4_stateid stateid;
 339};
 340
 341struct nfs4_layoutreturn {
 342        struct nfs4_layoutreturn_args args;
 343        struct nfs4_layoutreturn_res res;
 344        const struct cred *cred;
 345        struct nfs_client *clp;
 346        struct inode *inode;
 347        int rpc_status;
 348        struct nfs4_xdr_opaque_data ld_private;
 349};
 350
 351#define PNFS_LAYOUTSTATS_MAXSIZE 256
 352
 353struct nfs42_layoutstat_args;
 354struct nfs42_layoutstat_devinfo;
 355typedef void (*layoutstats_encode_t)(struct xdr_stream *,
 356                struct nfs42_layoutstat_args *,
 357                struct nfs42_layoutstat_devinfo *);
 358
 359/* Per file per deviceid layoutstats */
 360struct nfs42_layoutstat_devinfo {
 361        struct nfs4_deviceid dev_id;
 362        __u64 offset;
 363        __u64 length;
 364        __u64 read_count;
 365        __u64 read_bytes;
 366        __u64 write_count;
 367        __u64 write_bytes;
 368        __u32 layout_type;
 369        struct nfs4_xdr_opaque_data ld_private;
 370};
 371
 372struct nfs42_layoutstat_args {
 373        struct nfs4_sequence_args seq_args;
 374        struct nfs_fh *fh;
 375        struct inode *inode;
 376        nfs4_stateid stateid;
 377        int num_dev;
 378        struct nfs42_layoutstat_devinfo *devinfo;
 379};
 380
 381struct nfs42_layoutstat_res {
 382        struct nfs4_sequence_res seq_res;
 383        int num_dev;
 384        int rpc_status;
 385};
 386
 387struct nfs42_layoutstat_data {
 388        struct inode *inode;
 389        struct nfs42_layoutstat_args args;
 390        struct nfs42_layoutstat_res res;
 391};
 392
 393struct nfs42_device_error {
 394        struct nfs4_deviceid dev_id;
 395        int status;
 396        enum nfs_opnum4 opnum;
 397};
 398
 399struct nfs42_layout_error {
 400        __u64 offset;
 401        __u64 length;
 402        nfs4_stateid stateid;
 403        struct nfs42_device_error errors[1];
 404};
 405
 406#define NFS42_LAYOUTERROR_MAX 5
 407
 408struct nfs42_layouterror_args {
 409        struct nfs4_sequence_args seq_args;
 410        struct inode *inode;
 411        unsigned int num_errors;
 412        struct nfs42_layout_error errors[NFS42_LAYOUTERROR_MAX];
 413};
 414
 415struct nfs42_layouterror_res {
 416        struct nfs4_sequence_res seq_res;
 417        unsigned int num_errors;
 418        int rpc_status;
 419};
 420
 421struct nfs42_layouterror_data {
 422        struct nfs42_layouterror_args args;
 423        struct nfs42_layouterror_res res;
 424        struct inode *inode;
 425        struct pnfs_layout_segment *lseg;
 426};
 427
 428struct nfs42_clone_args {
 429        struct nfs4_sequence_args       seq_args;
 430        struct nfs_fh                   *src_fh;
 431        struct nfs_fh                   *dst_fh;
 432        nfs4_stateid                    src_stateid;
 433        nfs4_stateid                    dst_stateid;
 434        __u64                           src_offset;
 435        __u64                           dst_offset;
 436        __u64                           count;
 437        const u32                       *dst_bitmask;
 438};
 439
 440struct nfs42_clone_res {
 441        struct nfs4_sequence_res        seq_res;
 442        unsigned int                    rpc_status;
 443        struct nfs_fattr                *dst_fattr;
 444        const struct nfs_server         *server;
 445};
 446
 447struct stateowner_id {
 448        __u64   create_time;
 449        __u32   uniquifier;
 450};
 451
 452/*
 453 * Arguments to the open call.
 454 */
 455struct nfs_openargs {
 456        struct nfs4_sequence_args       seq_args;
 457        const struct nfs_fh *   fh;
 458        struct nfs_seqid *      seqid;
 459        int                     open_flags;
 460        fmode_t                 fmode;
 461        u32                     share_access;
 462        u32                     access;
 463        __u64                   clientid;
 464        struct stateowner_id    id;
 465        union {
 466                struct {
 467                        struct iattr *  attrs;    /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */
 468                        nfs4_verifier   verifier; /* EXCLUSIVE */
 469                };
 470                nfs4_stateid    delegation;             /* CLAIM_DELEGATE_CUR */
 471                fmode_t         delegation_type;        /* CLAIM_PREVIOUS */
 472        } u;
 473        const struct qstr *     name;
 474        const struct nfs_server *server;         /* Needed for ID mapping */
 475        const u32 *             bitmask;
 476        const u32 *             open_bitmap;
 477        enum open_claim_type4   claim;
 478        enum createmode4        createmode;
 479        const struct nfs4_label *label;
 480        umode_t                 umask;
 481        struct nfs4_layoutget_args *lg_args;
 482};
 483
 484struct nfs_openres {
 485        struct nfs4_sequence_res        seq_res;
 486        nfs4_stateid            stateid;
 487        struct nfs_fh           fh;
 488        struct nfs4_change_info cinfo;
 489        __u32                   rflags;
 490        struct nfs_fattr *      f_attr;
 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        unsigned char           d_type;
 756        struct nfs_server *     server;
 757};
 758
 759struct nfs_readdir_arg {
 760        struct dentry           *dentry;
 761        const struct cred       *cred;
 762        __be32                  *verf;
 763        u64                     cookie;
 764        struct page             **pages;
 765        unsigned int            page_len;
 766        bool                    plus;
 767};
 768
 769struct nfs_readdir_res {
 770        __be32                  *verf;
 771};
 772
 773/*
 774 * The following types are for NFSv2 only.
 775 */
 776struct nfs_sattrargs {
 777        struct nfs_fh *         fh;
 778        struct iattr *          sattr;
 779};
 780
 781struct nfs_diropargs {
 782        struct nfs_fh *         fh;
 783        const char *            name;
 784        unsigned int            len;
 785};
 786
 787struct nfs_createargs {
 788        struct nfs_fh *         fh;
 789        const char *            name;
 790        unsigned int            len;
 791        struct iattr *          sattr;
 792};
 793
 794struct nfs_setattrargs {
 795        struct nfs4_sequence_args       seq_args;
 796        struct nfs_fh *                 fh;
 797        nfs4_stateid                    stateid;
 798        struct iattr *                  iap;
 799        const struct nfs_server *       server; /* Needed for name mapping */
 800        const u32 *                     bitmask;
 801        const struct nfs4_label         *label;
 802};
 803
 804struct nfs_setaclargs {
 805        struct nfs4_sequence_args       seq_args;
 806        struct nfs_fh *                 fh;
 807        size_t                          acl_len;
 808        struct page **                  acl_pages;
 809};
 810
 811struct nfs_setaclres {
 812        struct nfs4_sequence_res        seq_res;
 813};
 814
 815struct nfs_getaclargs {
 816        struct nfs4_sequence_args       seq_args;
 817        struct nfs_fh *                 fh;
 818        size_t                          acl_len;
 819        struct page **                  acl_pages;
 820};
 821
 822/* getxattr ACL interface flags */
 823#define NFS4_ACL_TRUNC          0x0001  /* ACL was truncated */
 824struct nfs_getaclres {
 825        struct nfs4_sequence_res        seq_res;
 826        size_t                          acl_len;
 827        size_t                          acl_data_offset;
 828        int                             acl_flags;
 829        struct page *                   acl_scratch;
 830};
 831
 832struct nfs_setattrres {
 833        struct nfs4_sequence_res        seq_res;
 834        struct nfs_fattr *              fattr;
 835        const struct nfs_server *       server;
 836};
 837
 838struct nfs_linkargs {
 839        struct nfs_fh *         fromfh;
 840        struct nfs_fh *         tofh;
 841        const char *            toname;
 842        unsigned int            tolen;
 843};
 844
 845struct nfs_symlinkargs {
 846        struct nfs_fh *         fromfh;
 847        const char *            fromname;
 848        unsigned int            fromlen;
 849        struct page **          pages;
 850        unsigned int            pathlen;
 851        struct iattr *          sattr;
 852};
 853
 854struct nfs_readdirargs {
 855        struct nfs_fh *         fh;
 856        __u32                   cookie;
 857        unsigned int            count;
 858        struct page **          pages;
 859};
 860
 861struct nfs3_getaclargs {
 862        struct nfs_fh *         fh;
 863        int                     mask;
 864        struct page **          pages;
 865};
 866
 867struct nfs3_setaclargs {
 868        struct inode *          inode;
 869        int                     mask;
 870        struct posix_acl *      acl_access;
 871        struct posix_acl *      acl_default;
 872        size_t                  len;
 873        unsigned int            npages;
 874        struct page **          pages;
 875};
 876
 877struct nfs_diropok {
 878        struct nfs_fh *         fh;
 879        struct nfs_fattr *      fattr;
 880};
 881
 882struct nfs_readlinkargs {
 883        struct nfs_fh *         fh;
 884        unsigned int            pgbase;
 885        unsigned int            pglen;
 886        struct page **          pages;
 887};
 888
 889struct nfs3_sattrargs {
 890        struct nfs_fh *         fh;
 891        struct iattr *          sattr;
 892        unsigned int            guard;
 893        struct timespec64       guardtime;
 894};
 895
 896struct nfs3_diropargs {
 897        struct nfs_fh *         fh;
 898        const char *            name;
 899        unsigned int            len;
 900};
 901
 902struct nfs3_accessargs {
 903        struct nfs_fh *         fh;
 904        __u32                   access;
 905};
 906
 907struct nfs3_createargs {
 908        struct nfs_fh *         fh;
 909        const char *            name;
 910        unsigned int            len;
 911        struct iattr *          sattr;
 912        enum nfs3_createmode    createmode;
 913        __be32                  verifier[2];
 914};
 915
 916struct nfs3_mkdirargs {
 917        struct nfs_fh *         fh;
 918        const char *            name;
 919        unsigned int            len;
 920        struct iattr *          sattr;
 921};
 922
 923struct nfs3_symlinkargs {
 924        struct nfs_fh *         fromfh;
 925        const char *            fromname;
 926        unsigned int            fromlen;
 927        struct page **          pages;
 928        unsigned int            pathlen;
 929        struct iattr *          sattr;
 930};
 931
 932struct nfs3_mknodargs {
 933        struct nfs_fh *         fh;
 934        const char *            name;
 935        unsigned int            len;
 936        enum nfs3_ftype         type;
 937        struct iattr *          sattr;
 938        dev_t                   rdev;
 939};
 940
 941struct nfs3_linkargs {
 942        struct nfs_fh *         fromfh;
 943        struct nfs_fh *         tofh;
 944        const char *            toname;
 945        unsigned int            tolen;
 946};
 947
 948struct nfs3_readdirargs {
 949        struct nfs_fh *         fh;
 950        __u64                   cookie;
 951        __be32                  verf[2];
 952        bool                    plus;
 953        unsigned int            count;
 954        struct page **          pages;
 955};
 956
 957struct nfs3_diropres {
 958        struct nfs_fattr *      dir_attr;
 959        struct nfs_fh *         fh;
 960        struct nfs_fattr *      fattr;
 961};
 962
 963struct nfs3_accessres {
 964        struct nfs_fattr *      fattr;
 965        __u32                   access;
 966};
 967
 968struct nfs3_readlinkargs {
 969        struct nfs_fh *         fh;
 970        unsigned int            pgbase;
 971        unsigned int            pglen;
 972        struct page **          pages;
 973};
 974
 975struct nfs3_linkres {
 976        struct nfs_fattr *      dir_attr;
 977        struct nfs_fattr *      fattr;
 978};
 979
 980struct nfs3_readdirres {
 981        struct nfs_fattr *      dir_attr;
 982        __be32 *                verf;
 983        bool                    plus;
 984};
 985
 986struct nfs3_getaclres {
 987        struct nfs_fattr *      fattr;
 988        int                     mask;
 989        unsigned int            acl_access_count;
 990        unsigned int            acl_default_count;
 991        struct posix_acl *      acl_access;
 992        struct posix_acl *      acl_default;
 993};
 994
 995#if IS_ENABLED(CONFIG_NFS_V4)
 996
 997typedef u64 clientid4;
 998
 999struct nfs4_accessargs {
1000        struct nfs4_sequence_args       seq_args;
1001        const struct nfs_fh *           fh;
1002        const u32 *                     bitmask;
1003        u32                             access;
1004};
1005
1006struct nfs4_accessres {
1007        struct nfs4_sequence_res        seq_res;
1008        const struct nfs_server *       server;
1009        struct nfs_fattr *              fattr;
1010        u32                             supported;
1011        u32                             access;
1012};
1013
1014struct nfs4_create_arg {
1015        struct nfs4_sequence_args       seq_args;
1016        u32                             ftype;
1017        union {
1018                struct {
1019                        struct page **  pages;
1020                        unsigned int    len;
1021                } symlink;   /* NF4LNK */
1022                struct {
1023                        u32             specdata1;
1024                        u32             specdata2;
1025                } device;    /* NF4BLK, NF4CHR */
1026        } u;
1027        const struct qstr *             name;
1028        const struct nfs_server *       server;
1029        const struct iattr *            attrs;
1030        const struct nfs_fh *           dir_fh;
1031        const u32 *                     bitmask;
1032        const struct nfs4_label         *label;
1033        umode_t                         umask;
1034};
1035
1036struct nfs4_create_res {
1037        struct nfs4_sequence_res        seq_res;
1038        const struct nfs_server *       server;
1039        struct nfs_fh *                 fh;
1040        struct nfs_fattr *              fattr;
1041        struct nfs4_change_info         dir_cinfo;
1042};
1043
1044struct nfs4_fsinfo_arg {
1045        struct nfs4_sequence_args       seq_args;
1046        const struct nfs_fh *           fh;
1047        const u32 *                     bitmask;
1048};
1049
1050struct nfs4_fsinfo_res {
1051        struct nfs4_sequence_res        seq_res;
1052        struct nfs_fsinfo              *fsinfo;
1053};
1054
1055struct nfs4_getattr_arg {
1056        struct nfs4_sequence_args       seq_args;
1057        const struct nfs_fh *           fh;
1058        const u32 *                     bitmask;
1059};
1060
1061struct nfs4_getattr_res {
1062        struct nfs4_sequence_res        seq_res;
1063        const struct nfs_server *       server;
1064        struct nfs_fattr *              fattr;
1065};
1066
1067struct nfs4_link_arg {
1068        struct nfs4_sequence_args       seq_args;
1069        const struct nfs_fh *           fh;
1070        const struct nfs_fh *           dir_fh;
1071        const struct qstr *             name;
1072        const u32 *                     bitmask;
1073};
1074
1075struct nfs4_link_res {
1076        struct nfs4_sequence_res        seq_res;
1077        const struct nfs_server *       server;
1078        struct nfs_fattr *              fattr;
1079        struct nfs4_change_info         cinfo;
1080        struct nfs_fattr *              dir_attr;
1081};
1082
1083struct nfs4_lookup_arg {
1084        struct nfs4_sequence_args       seq_args;
1085        const struct nfs_fh *           dir_fh;
1086        const struct qstr *             name;
1087        const u32 *                     bitmask;
1088};
1089
1090struct nfs4_lookup_res {
1091        struct nfs4_sequence_res        seq_res;
1092        const struct nfs_server *       server;
1093        struct nfs_fattr *              fattr;
1094        struct nfs_fh *                 fh;
1095};
1096
1097struct nfs4_lookupp_arg {
1098        struct nfs4_sequence_args       seq_args;
1099        const struct nfs_fh             *fh;
1100        const u32                       *bitmask;
1101};
1102
1103struct nfs4_lookupp_res {
1104        struct nfs4_sequence_res        seq_res;
1105        const struct nfs_server         *server;
1106        struct nfs_fattr                *fattr;
1107        struct nfs_fh                   *fh;
1108};
1109
1110struct nfs4_lookup_root_arg {
1111        struct nfs4_sequence_args       seq_args;
1112        const u32 *                     bitmask;
1113};
1114
1115struct nfs4_pathconf_arg {
1116        struct nfs4_sequence_args       seq_args;
1117        const struct nfs_fh *           fh;
1118        const u32 *                     bitmask;
1119};
1120
1121struct nfs4_pathconf_res {
1122        struct nfs4_sequence_res        seq_res;
1123        struct nfs_pathconf            *pathconf;
1124};
1125
1126struct nfs4_readdir_arg {
1127        struct nfs4_sequence_args       seq_args;
1128        const struct nfs_fh *           fh;
1129        u64                             cookie;
1130        nfs4_verifier                   verifier;
1131        u32                             count;
1132        struct page **                  pages;  /* zero-copy data */
1133        unsigned int                    pgbase; /* zero-copy data */
1134        const u32 *                     bitmask;
1135        bool                            plus;
1136};
1137
1138struct nfs4_readdir_res {
1139        struct nfs4_sequence_res        seq_res;
1140        nfs4_verifier                   verifier;
1141        unsigned int                    pgbase;
1142};
1143
1144struct nfs4_readlink {
1145        struct nfs4_sequence_args       seq_args;
1146        const struct nfs_fh *           fh;
1147        unsigned int                    pgbase;
1148        unsigned int                    pglen;   /* zero-copy data */
1149        struct page **                  pages;   /* zero-copy data */
1150};
1151
1152struct nfs4_readlink_res {
1153        struct nfs4_sequence_res        seq_res;
1154};
1155
1156struct nfs4_setclientid {
1157        const nfs4_verifier *           sc_verifier;
1158        u32                             sc_prog;
1159        unsigned int                    sc_netid_len;
1160        char                            sc_netid[RPCBIND_MAXNETIDLEN + 1];
1161        unsigned int                    sc_uaddr_len;
1162        char                            sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
1163        struct nfs_client               *sc_clnt;
1164        struct rpc_cred                 *sc_cred;
1165};
1166
1167struct nfs4_setclientid_res {
1168        u64                             clientid;
1169        nfs4_verifier                   confirm;
1170};
1171
1172struct nfs4_statfs_arg {
1173        struct nfs4_sequence_args       seq_args;
1174        const struct nfs_fh *           fh;
1175        const u32 *                     bitmask;
1176};
1177
1178struct nfs4_statfs_res {
1179        struct nfs4_sequence_res        seq_res;
1180        struct nfs_fsstat              *fsstat;
1181};
1182
1183struct nfs4_server_caps_arg {
1184        struct nfs4_sequence_args       seq_args;
1185        struct nfs_fh                  *fhandle;
1186        const u32 *                     bitmask;
1187};
1188
1189struct nfs4_server_caps_res {
1190        struct nfs4_sequence_res        seq_res;
1191        u32                             attr_bitmask[3];
1192        u32                             exclcreat_bitmask[3];
1193        u32                             acl_bitmask;
1194        u32                             has_links;
1195        u32                             has_symlinks;
1196        u32                             fh_expire_type;
1197        u32                             case_insensitive;
1198        u32                             case_preserving;
1199};
1200
1201#define NFS4_PATHNAME_MAXCOMPONENTS 512
1202struct nfs4_pathname {
1203        unsigned int ncomponents;
1204        struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
1205};
1206
1207#define NFS4_FS_LOCATION_MAXSERVERS 10
1208struct nfs4_fs_location {
1209        unsigned int nservers;
1210        struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
1211        struct nfs4_pathname rootpath;
1212};
1213
1214#define NFS4_FS_LOCATIONS_MAXENTRIES 10
1215struct nfs4_fs_locations {
1216        struct nfs_fattr fattr;
1217        const struct nfs_server *server;
1218        struct nfs4_pathname fs_path;
1219        int nlocations;
1220        struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
1221};
1222
1223struct nfs4_fs_locations_arg {
1224        struct nfs4_sequence_args       seq_args;
1225        const struct nfs_fh *dir_fh;
1226        const struct nfs_fh *fh;
1227        const struct qstr *name;
1228        struct page *page;
1229        const u32 *bitmask;
1230        clientid4 clientid;
1231        unsigned char migration:1, renew:1;
1232};
1233
1234struct nfs4_fs_locations_res {
1235        struct nfs4_sequence_res        seq_res;
1236        struct nfs4_fs_locations       *fs_locations;
1237        unsigned char                   migration:1, renew:1;
1238};
1239
1240struct nfs4_secinfo4 {
1241        u32                     flavor;
1242        struct rpcsec_gss_info  flavor_info;
1243};
1244
1245struct nfs4_secinfo_flavors {
1246        unsigned int            num_flavors;
1247        struct nfs4_secinfo4    flavors[];
1248};
1249
1250struct nfs4_secinfo_arg {
1251        struct nfs4_sequence_args       seq_args;
1252        const struct nfs_fh             *dir_fh;
1253        const struct qstr               *name;
1254};
1255
1256struct nfs4_secinfo_res {
1257        struct nfs4_sequence_res        seq_res;
1258        struct nfs4_secinfo_flavors     *flavors;
1259};
1260
1261struct nfs4_fsid_present_arg {
1262        struct nfs4_sequence_args       seq_args;
1263        const struct nfs_fh             *fh;
1264        clientid4                       clientid;
1265        unsigned char                   renew:1;
1266};
1267
1268struct nfs4_fsid_present_res {
1269        struct nfs4_sequence_res        seq_res;
1270        struct nfs_fh                   *fh;
1271        unsigned char                   renew:1;
1272};
1273
1274#endif /* CONFIG_NFS_V4 */
1275
1276struct nfstime4 {
1277        u64     seconds;
1278        u32     nseconds;
1279};
1280
1281#ifdef CONFIG_NFS_V4_1
1282
1283struct pnfs_commit_bucket {
1284        struct list_head written;
1285        struct list_head committing;
1286        struct pnfs_layout_segment *lseg;
1287        struct nfs_writeverf direct_verf;
1288};
1289
1290struct pnfs_commit_array {
1291        struct list_head cinfo_list;
1292        struct list_head lseg_list;
1293        struct pnfs_layout_segment *lseg;
1294        struct rcu_head rcu;
1295        refcount_t refcount;
1296        unsigned int nbuckets;
1297        struct pnfs_commit_bucket buckets[];
1298};
1299
1300struct pnfs_ds_commit_info {
1301        struct list_head commits;
1302        unsigned int nwritten;
1303        unsigned int ncommitting;
1304        const struct pnfs_commit_ops *ops;
1305};
1306
1307struct nfs41_state_protection {
1308        u32 how;
1309        struct nfs4_op_map enforce;
1310        struct nfs4_op_map allow;
1311};
1312
1313struct nfs41_exchange_id_args {
1314        struct nfs_client               *client;
1315        nfs4_verifier                   verifier;
1316        u32                             flags;
1317        struct nfs41_state_protection   state_protect;
1318};
1319
1320struct nfs41_server_owner {
1321        uint64_t                        minor_id;
1322        uint32_t                        major_id_sz;
1323        char                            major_id[NFS4_OPAQUE_LIMIT];
1324};
1325
1326struct nfs41_server_scope {
1327        uint32_t                        server_scope_sz;
1328        char                            server_scope[NFS4_OPAQUE_LIMIT];
1329};
1330
1331struct nfs41_impl_id {
1332        char                            domain[NFS4_OPAQUE_LIMIT + 1];
1333        char                            name[NFS4_OPAQUE_LIMIT + 1];
1334        struct nfstime4                 date;
1335};
1336
1337#define MAX_BIND_CONN_TO_SESSION_RETRIES 3
1338struct nfs41_bind_conn_to_session_args {
1339        struct nfs_client               *client;
1340        struct nfs4_sessionid           sessionid;
1341        u32                             dir;
1342        bool                            use_conn_in_rdma_mode;
1343        int                             retries;
1344};
1345
1346struct nfs41_bind_conn_to_session_res {
1347        struct nfs4_sessionid           sessionid;
1348        u32                             dir;
1349        bool                            use_conn_in_rdma_mode;
1350};
1351
1352struct nfs41_exchange_id_res {
1353        u64                             clientid;
1354        u32                             seqid;
1355        u32                             flags;
1356        struct nfs41_server_owner       *server_owner;
1357        struct nfs41_server_scope       *server_scope;
1358        struct nfs41_impl_id            *impl_id;
1359        struct nfs41_state_protection   state_protect;
1360};
1361
1362struct nfs41_create_session_args {
1363        struct nfs_client              *client;
1364        u64                             clientid;
1365        uint32_t                        seqid;
1366        uint32_t                        flags;
1367        uint32_t                        cb_program;
1368        struct nfs4_channel_attrs       fc_attrs;       /* Fore Channel */
1369        struct nfs4_channel_attrs       bc_attrs;       /* Back Channel */
1370};
1371
1372struct nfs41_create_session_res {
1373        struct nfs4_sessionid           sessionid;
1374        uint32_t                        seqid;
1375        uint32_t                        flags;
1376        struct nfs4_channel_attrs       fc_attrs;       /* Fore Channel */
1377        struct nfs4_channel_attrs       bc_attrs;       /* Back Channel */
1378};
1379
1380struct nfs41_reclaim_complete_args {
1381        struct nfs4_sequence_args       seq_args;
1382        /* In the future extend to include curr_fh for use with migration */
1383        unsigned char                   one_fs:1;
1384};
1385
1386struct nfs41_reclaim_complete_res {
1387        struct nfs4_sequence_res        seq_res;
1388};
1389
1390#define SECINFO_STYLE_CURRENT_FH 0
1391#define SECINFO_STYLE_PARENT 1
1392struct nfs41_secinfo_no_name_args {
1393        struct nfs4_sequence_args       seq_args;
1394        int                             style;
1395};
1396
1397struct nfs41_test_stateid_args {
1398        struct nfs4_sequence_args       seq_args;
1399        nfs4_stateid                    *stateid;
1400};
1401
1402struct nfs41_test_stateid_res {
1403        struct nfs4_sequence_res        seq_res;
1404        unsigned int                    status;
1405};
1406
1407struct nfs41_free_stateid_args {
1408        struct nfs4_sequence_args       seq_args;
1409        nfs4_stateid                    stateid;
1410};
1411
1412struct nfs41_free_stateid_res {
1413        struct nfs4_sequence_res        seq_res;
1414        unsigned int                    status;
1415};
1416
1417#else
1418
1419struct pnfs_ds_commit_info {
1420};
1421
1422#endif /* CONFIG_NFS_V4_1 */
1423
1424#ifdef CONFIG_NFS_V4_2
1425struct nfs42_falloc_args {
1426        struct nfs4_sequence_args       seq_args;
1427
1428        struct nfs_fh                   *falloc_fh;
1429        nfs4_stateid                     falloc_stateid;
1430        u64                              falloc_offset;
1431        u64                              falloc_length;
1432        const u32                       *falloc_bitmask;
1433};
1434
1435struct nfs42_falloc_res {
1436        struct nfs4_sequence_res        seq_res;
1437        unsigned int                    status;
1438
1439        struct nfs_fattr                *falloc_fattr;
1440        const struct nfs_server         *falloc_server;
1441};
1442
1443struct nfs42_copy_args {
1444        struct nfs4_sequence_args       seq_args;
1445
1446        struct nfs_fh                   *src_fh;
1447        nfs4_stateid                    src_stateid;
1448        u64                             src_pos;
1449
1450        struct nfs_fh                   *dst_fh;
1451        nfs4_stateid                    dst_stateid;
1452        u64                             dst_pos;
1453
1454        u64                             count;
1455        bool                            sync;
1456        struct nl4_server               *cp_src;
1457};
1458
1459struct nfs42_write_res {
1460        nfs4_stateid            stateid;
1461        u64                     count;
1462        struct nfs_writeverf    verifier;
1463};
1464
1465struct nfs42_copy_res {
1466        struct nfs4_sequence_res        seq_res;
1467        struct nfs42_write_res          write_res;
1468        bool                            consecutive;
1469        bool                            synchronous;
1470        struct nfs_commitres            commit_res;
1471};
1472
1473struct nfs42_offload_status_args {
1474        struct nfs4_sequence_args       osa_seq_args;
1475        struct nfs_fh                   *osa_src_fh;
1476        nfs4_stateid                    osa_stateid;
1477};
1478
1479struct nfs42_offload_status_res {
1480        struct nfs4_sequence_res        osr_seq_res;
1481        uint64_t                        osr_count;
1482        int                             osr_status;
1483};
1484
1485struct nfs42_copy_notify_args {
1486        struct nfs4_sequence_args       cna_seq_args;
1487
1488        struct nfs_fh           *cna_src_fh;
1489        nfs4_stateid            cna_src_stateid;
1490        struct nl4_server       cna_dst;
1491};
1492
1493struct nfs42_copy_notify_res {
1494        struct nfs4_sequence_res        cnr_seq_res;
1495
1496        struct nfstime4         cnr_lease_time;
1497        nfs4_stateid            cnr_stateid;
1498        struct nl4_server       cnr_src;
1499};
1500
1501struct nfs42_seek_args {
1502        struct nfs4_sequence_args       seq_args;
1503
1504        struct nfs_fh                   *sa_fh;
1505        nfs4_stateid                    sa_stateid;
1506        u64                             sa_offset;
1507        u32                             sa_what;
1508};
1509
1510struct nfs42_seek_res {
1511        struct nfs4_sequence_res        seq_res;
1512        unsigned int                    status;
1513
1514        u32     sr_eof;
1515        u64     sr_offset;
1516};
1517
1518struct nfs42_setxattrargs {
1519        struct nfs4_sequence_args       seq_args;
1520        struct nfs_fh                   *fh;
1521        const char                      *xattr_name;
1522        u32                             xattr_flags;
1523        size_t                          xattr_len;
1524        struct page                     **xattr_pages;
1525};
1526
1527struct nfs42_setxattrres {
1528        struct nfs4_sequence_res        seq_res;
1529        struct nfs4_change_info         cinfo;
1530};
1531
1532struct nfs42_getxattrargs {
1533        struct nfs4_sequence_args       seq_args;
1534        struct nfs_fh                   *fh;
1535        const char                      *xattr_name;
1536        size_t                          xattr_len;
1537        struct page                     **xattr_pages;
1538};
1539
1540struct nfs42_getxattrres {
1541        struct nfs4_sequence_res        seq_res;
1542        size_t                          xattr_len;
1543};
1544
1545struct nfs42_listxattrsargs {
1546        struct nfs4_sequence_args       seq_args;
1547        struct nfs_fh                   *fh;
1548        u32                             count;
1549        u64                             cookie;
1550        struct page                     **xattr_pages;
1551};
1552
1553struct nfs42_listxattrsres {
1554        struct nfs4_sequence_res        seq_res;
1555        struct page                     *scratch;
1556        void                            *xattr_buf;
1557        size_t                          xattr_len;
1558        u64                             cookie;
1559        bool                            eof;
1560        size_t                          copied;
1561};
1562
1563struct nfs42_removexattrargs {
1564        struct nfs4_sequence_args       seq_args;
1565        struct nfs_fh                   *fh;
1566        const char                      *xattr_name;
1567};
1568
1569struct nfs42_removexattrres {
1570        struct nfs4_sequence_res        seq_res;
1571        struct nfs4_change_info         cinfo;
1572};
1573
1574#endif /* CONFIG_NFS_V4_2 */
1575
1576struct nfs_page;
1577
1578#define NFS_PAGEVEC_SIZE        (8U)
1579
1580struct nfs_page_array {
1581        struct page             **pagevec;
1582        unsigned int            npages;         /* Max length of pagevec */
1583        struct page             *page_array[NFS_PAGEVEC_SIZE];
1584};
1585
1586/* used as flag bits in nfs_pgio_header */
1587enum {
1588        NFS_IOHDR_ERROR = 0,
1589        NFS_IOHDR_EOF,
1590        NFS_IOHDR_REDO,
1591        NFS_IOHDR_STAT,
1592        NFS_IOHDR_RESEND_PNFS,
1593        NFS_IOHDR_RESEND_MDS,
1594};
1595
1596struct nfs_io_completion;
1597struct nfs_pgio_header {
1598        struct inode            *inode;
1599        const struct cred               *cred;
1600        struct list_head        pages;
1601        struct nfs_page         *req;
1602        struct nfs_writeverf    verf;           /* Used for writes */
1603        fmode_t                 rw_mode;
1604        struct pnfs_layout_segment *lseg;
1605        loff_t                  io_start;
1606        const struct rpc_call_ops *mds_ops;
1607        void (*release) (struct nfs_pgio_header *hdr);
1608        const struct nfs_pgio_completion_ops *completion_ops;
1609        const struct nfs_rw_ops *rw_ops;
1610        struct nfs_io_completion *io_completion;
1611        struct nfs_direct_req   *dreq;
1612
1613        int                     pnfs_error;
1614        int                     error;          /* merge with pnfs_error */
1615        unsigned int            good_bytes;     /* boundary of good data */
1616        unsigned long           flags;
1617
1618        /*
1619         * rpc data
1620         */
1621        struct rpc_task         task;
1622        struct nfs_fattr        fattr;
1623        struct nfs_pgio_args    args;           /* argument struct */
1624        struct nfs_pgio_res     res;            /* result struct */
1625        unsigned long           timestamp;      /* For lease renewal */
1626        int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
1627        __u64                   mds_offset;     /* Filelayout dense stripe */
1628        struct nfs_page_array   page_array;
1629        struct nfs_client       *ds_clp;        /* pNFS data server */
1630        u32                     ds_commit_idx;  /* ds index if ds_clp is set */
1631        u32                     pgio_mirror_idx;/* mirror index in pgio layer */
1632};
1633
1634struct nfs_mds_commit_info {
1635        atomic_t rpcs_out;
1636        atomic_long_t           ncommit;
1637        struct list_head        list;
1638};
1639
1640struct nfs_commit_info;
1641struct nfs_commit_data;
1642struct nfs_inode;
1643struct nfs_commit_completion_ops {
1644        void (*completion) (struct nfs_commit_data *data);
1645        void (*resched_write) (struct nfs_commit_info *, struct nfs_page *);
1646};
1647
1648struct nfs_commit_info {
1649        struct inode                    *inode; /* Needed for inode->i_lock */
1650        struct nfs_mds_commit_info      *mds;
1651        struct pnfs_ds_commit_info      *ds;
1652        struct nfs_direct_req           *dreq;  /* O_DIRECT request */
1653        const struct nfs_commit_completion_ops *completion_ops;
1654};
1655
1656struct nfs_commit_data {
1657        struct rpc_task         task;
1658        struct inode            *inode;
1659        const struct cred               *cred;
1660        struct nfs_fattr        fattr;
1661        struct nfs_writeverf    verf;
1662        struct list_head        pages;          /* Coalesced requests we wish to flush */
1663        struct list_head        list;           /* lists of struct nfs_write_data */
1664        struct nfs_direct_req   *dreq;          /* O_DIRECT request */
1665        struct nfs_commitargs   args;           /* argument struct */
1666        struct nfs_commitres    res;            /* result struct */
1667        struct nfs_open_context *context;
1668        struct pnfs_layout_segment *lseg;
1669        struct nfs_client       *ds_clp;        /* pNFS data server */
1670        int                     ds_commit_index;
1671        loff_t                  lwb;
1672        const struct rpc_call_ops *mds_ops;
1673        const struct nfs_commit_completion_ops *completion_ops;
1674        int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
1675        unsigned long           flags;
1676};
1677
1678struct nfs_pgio_completion_ops {
1679        void    (*error_cleanup)(struct list_head *head, int);
1680        void    (*init_hdr)(struct nfs_pgio_header *hdr);
1681        void    (*completion)(struct nfs_pgio_header *hdr);
1682        void    (*reschedule_io)(struct nfs_pgio_header *hdr);
1683};
1684
1685struct nfs_unlinkdata {
1686        struct nfs_removeargs args;
1687        struct nfs_removeres res;
1688        struct dentry *dentry;
1689        wait_queue_head_t wq;
1690        const struct cred *cred;
1691        struct nfs_fattr dir_attr;
1692        long timeout;
1693};
1694
1695struct nfs_renamedata {
1696        struct nfs_renameargs   args;
1697        struct nfs_renameres    res;
1698        const struct cred       *cred;
1699        struct inode            *old_dir;
1700        struct dentry           *old_dentry;
1701        struct nfs_fattr        old_fattr;
1702        struct inode            *new_dir;
1703        struct dentry           *new_dentry;
1704        struct nfs_fattr        new_fattr;
1705        void (*complete)(struct rpc_task *, struct nfs_renamedata *);
1706        long timeout;
1707        bool cancelled;
1708};
1709
1710struct nfs_access_entry;
1711struct nfs_client;
1712struct rpc_timeout;
1713struct nfs_subversion;
1714struct nfs_mount_info;
1715struct nfs_client_initdata;
1716struct nfs_pageio_descriptor;
1717struct fs_context;
1718
1719/*
1720 * RPC procedure vector for NFSv2/NFSv3 demuxing
1721 */
1722struct nfs_rpc_ops {
1723        u32     version;                /* Protocol version */
1724        const struct dentry_operations *dentry_ops;
1725        const struct inode_operations *dir_inode_ops;
1726        const struct inode_operations *file_inode_ops;
1727        const struct file_operations *file_ops;
1728        const struct nlmclnt_operations *nlmclnt_ops;
1729
1730        int     (*getroot) (struct nfs_server *, struct nfs_fh *,
1731                            struct nfs_fsinfo *);
1732        int     (*submount) (struct fs_context *, struct nfs_server *);
1733        int     (*try_get_tree) (struct fs_context *);
1734        int     (*getattr) (struct nfs_server *, struct nfs_fh *,
1735                            struct nfs_fattr *, struct inode *);
1736        int     (*setattr) (struct dentry *, struct nfs_fattr *,
1737                            struct iattr *);
1738        int     (*lookup)  (struct inode *, struct dentry *,
1739                            struct nfs_fh *, struct nfs_fattr *);
1740        int     (*lookupp) (struct inode *, struct nfs_fh *,
1741                            struct nfs_fattr *);
1742        int     (*access)  (struct inode *, struct nfs_access_entry *, const struct cred *);
1743        int     (*readlink)(struct inode *, struct page *, unsigned int,
1744                            unsigned int);
1745        int     (*create)  (struct inode *, struct dentry *,
1746                            struct iattr *, int);
1747        int     (*remove)  (struct inode *, struct dentry *);
1748        void    (*unlink_setup)  (struct rpc_message *, struct dentry *, struct inode *);
1749        void    (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1750        int     (*unlink_done) (struct rpc_task *, struct inode *);
1751        void    (*rename_setup)  (struct rpc_message *msg,
1752                        struct dentry *old_dentry,
1753                        struct dentry *new_dentry);
1754        void    (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
1755        int     (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1756        int     (*link)    (struct inode *, struct inode *, const struct qstr *);
1757        int     (*symlink) (struct inode *, struct dentry *, struct page *,
1758                            unsigned int, struct iattr *);
1759        int     (*mkdir)   (struct inode *, struct dentry *, struct iattr *);
1760        int     (*rmdir)   (struct inode *, const struct qstr *);
1761        int     (*readdir) (struct nfs_readdir_arg *, struct nfs_readdir_res *);
1762        int     (*mknod)   (struct inode *, struct dentry *, struct iattr *,
1763                            dev_t);
1764        int     (*statfs)  (struct nfs_server *, struct nfs_fh *,
1765                            struct nfs_fsstat *);
1766        int     (*fsinfo)  (struct nfs_server *, struct nfs_fh *,
1767                            struct nfs_fsinfo *);
1768        int     (*pathconf) (struct nfs_server *, struct nfs_fh *,
1769                             struct nfs_pathconf *);
1770        int     (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1771        int     (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, bool);
1772        int     (*pgio_rpc_prepare)(struct rpc_task *,
1773                                    struct nfs_pgio_header *);
1774        void    (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
1775        int     (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
1776        void    (*write_setup)(struct nfs_pgio_header *, struct rpc_message *,
1777                                struct rpc_clnt **);
1778        int     (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
1779        void    (*commit_setup) (struct nfs_commit_data *, struct rpc_message *,
1780                                struct rpc_clnt **);
1781        void    (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1782        int     (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
1783        int     (*lock)(struct file *, int, struct file_lock *);
1784        int     (*lock_check_bounds)(const struct file_lock *);
1785        void    (*clear_acl_cache)(struct inode *);
1786        void    (*close_context)(struct nfs_open_context *ctx, int);
1787        struct inode * (*open_context) (struct inode *dir,
1788                                struct nfs_open_context *ctx,
1789                                int open_flags,
1790                                struct iattr *iattr,
1791                                int *);
1792        int (*have_delegation)(struct inode *, fmode_t);
1793        struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
1794        struct nfs_client *(*init_client) (struct nfs_client *,
1795                                const struct nfs_client_initdata *);
1796        void    (*free_client) (struct nfs_client *);
1797        struct nfs_server *(*create_server)(struct fs_context *);
1798        struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
1799                                           struct nfs_fattr *, rpc_authflavor_t);
1800        int     (*discover_trunking)(struct nfs_server *, struct nfs_fh *);
1801};
1802
1803/*
1804 *      NFS_CALL(getattr, inode, (fattr));
1805 * into
1806 *      NFS_PROTO(inode)->getattr(fattr);
1807 */
1808#define NFS_CALL(op, inode, args)       NFS_PROTO(inode)->op args
1809
1810/*
1811 * Function vectors etc. for the NFS client
1812 */
1813extern const struct nfs_rpc_ops nfs_v2_clientops;
1814extern const struct nfs_rpc_ops nfs_v3_clientops;
1815extern const struct nfs_rpc_ops nfs_v4_clientops;
1816extern const struct rpc_version nfs_version2;
1817extern const struct rpc_version nfs_version3;
1818extern const struct rpc_version nfs_version4;
1819
1820extern const struct rpc_version nfsacl_version3;
1821extern const struct rpc_program nfsacl_program;
1822
1823#endif
1824