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