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