nfsd: Fix independence of a few nfsd related headers
[safe/jmp/linux-2.6] / 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/nfs3.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 nfs_fsid {
18         uint64_t                major;
19         uint64_t                minor;
20 };
21
22 /*
23  * Helper for checking equality between 2 fsids.
24  */
25 static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
26 {
27         return a->major == b->major && a->minor == b->minor;
28 }
29
30 struct nfs_fattr {
31         unsigned int            valid;          /* which fields are valid */
32         umode_t                 mode;
33         __u32                   nlink;
34         __u32                   uid;
35         __u32                   gid;
36         dev_t                   rdev;
37         __u64                   size;
38         union {
39                 struct {
40                         __u32   blocksize;
41                         __u32   blocks;
42                 } nfs2;
43                 struct {
44                         __u64   used;
45                 } nfs3;
46         } du;
47         struct nfs_fsid         fsid;
48         __u64                   fileid;
49         struct timespec         atime;
50         struct timespec         mtime;
51         struct timespec         ctime;
52         __u64                   change_attr;    /* NFSv4 change attribute */
53         __u64                   pre_change_attr;/* pre-op NFSv4 change attribute */
54         __u64                   pre_size;       /* pre_op_attr.size       */
55         struct timespec         pre_mtime;      /* pre_op_attr.mtime      */
56         struct timespec         pre_ctime;      /* pre_op_attr.ctime      */
57         unsigned long           time_start;
58         unsigned long           gencount;
59 };
60
61 #define NFS_ATTR_FATTR_TYPE             (1U << 0)
62 #define NFS_ATTR_FATTR_MODE             (1U << 1)
63 #define NFS_ATTR_FATTR_NLINK            (1U << 2)
64 #define NFS_ATTR_FATTR_OWNER            (1U << 3)
65 #define NFS_ATTR_FATTR_GROUP            (1U << 4)
66 #define NFS_ATTR_FATTR_RDEV             (1U << 5)
67 #define NFS_ATTR_FATTR_SIZE             (1U << 6)
68 #define NFS_ATTR_FATTR_PRESIZE          (1U << 7)
69 #define NFS_ATTR_FATTR_BLOCKS_USED      (1U << 8)
70 #define NFS_ATTR_FATTR_SPACE_USED       (1U << 9)
71 #define NFS_ATTR_FATTR_FSID             (1U << 10)
72 #define NFS_ATTR_FATTR_FILEID           (1U << 11)
73 #define NFS_ATTR_FATTR_ATIME            (1U << 12)
74 #define NFS_ATTR_FATTR_MTIME            (1U << 13)
75 #define NFS_ATTR_FATTR_CTIME            (1U << 14)
76 #define NFS_ATTR_FATTR_PREMTIME         (1U << 15)
77 #define NFS_ATTR_FATTR_PRECTIME         (1U << 16)
78 #define NFS_ATTR_FATTR_CHANGE           (1U << 17)
79 #define NFS_ATTR_FATTR_PRECHANGE        (1U << 18)
80 #define NFS_ATTR_FATTR_V4_REFERRAL      (1U << 19)      /* NFSv4 referral */
81
82 #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
83                 | NFS_ATTR_FATTR_MODE \
84                 | NFS_ATTR_FATTR_NLINK \
85                 | NFS_ATTR_FATTR_OWNER \
86                 | NFS_ATTR_FATTR_GROUP \
87                 | NFS_ATTR_FATTR_RDEV \
88                 | NFS_ATTR_FATTR_SIZE \
89                 | NFS_ATTR_FATTR_FSID \
90                 | NFS_ATTR_FATTR_FILEID \
91                 | NFS_ATTR_FATTR_ATIME \
92                 | NFS_ATTR_FATTR_MTIME \
93                 | NFS_ATTR_FATTR_CTIME)
94 #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
95                 | NFS_ATTR_FATTR_BLOCKS_USED)
96 #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
97                 | NFS_ATTR_FATTR_SPACE_USED)
98 #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
99                 | NFS_ATTR_FATTR_SPACE_USED \
100                 | NFS_ATTR_FATTR_CHANGE)
101
102 /*
103  * Info on the file system
104  */
105 struct nfs_fsinfo {
106         struct nfs_fattr        *fattr; /* Post-op attributes */
107         __u32                   rtmax;  /* max.  read transfer size */
108         __u32                   rtpref; /* pref. read transfer size */
109         __u32                   rtmult; /* reads should be multiple of this */
110         __u32                   wtmax;  /* max.  write transfer size */
111         __u32                   wtpref; /* pref. write transfer size */
112         __u32                   wtmult; /* writes should be multiple of this */
113         __u32                   dtpref; /* pref. readdir transfer size */
114         __u64                   maxfilesize;
115         __u32                   lease_time; /* in seconds */
116 };
117
118 struct nfs_fsstat {
119         struct nfs_fattr        *fattr; /* Post-op attributes */
120         __u64                   tbytes; /* total size in bytes */
121         __u64                   fbytes; /* # of free bytes */
122         __u64                   abytes; /* # of bytes available to user */
123         __u64                   tfiles; /* # of files */
124         __u64                   ffiles; /* # of free files */
125         __u64                   afiles; /* # of files available to user */
126 };
127
128 struct nfs2_fsstat {
129         __u32                   tsize;  /* Server transfer size */
130         __u32                   bsize;  /* Filesystem block size */
131         __u32                   blocks; /* No. of "bsize" blocks on filesystem */
132         __u32                   bfree;  /* No. of free "bsize" blocks */
133         __u32                   bavail; /* No. of available "bsize" blocks */
134 };
135
136 struct nfs_pathconf {
137         struct nfs_fattr        *fattr; /* Post-op attributes */
138         __u32                   max_link; /* max # of hard links */
139         __u32                   max_namelen; /* max name length */
140 };
141
142 struct nfs4_change_info {
143         u32                     atomic;
144         u64                     before;
145         u64                     after;
146 };
147
148 struct nfs_seqid;
149
150 /* nfs41 sessions channel attributes */
151 struct nfs4_channel_attrs {
152         u32                     headerpadsz;
153         u32                     max_rqst_sz;
154         u32                     max_resp_sz;
155         u32                     max_resp_sz_cached;
156         u32                     max_ops;
157         u32                     max_reqs;
158 };
159
160 /* nfs41 sessions slot seqid */
161 struct nfs4_slot {
162         u32                     seq_nr;
163 };
164
165 struct nfs4_sequence_args {
166         struct nfs4_session     *sa_session;
167         u8                      sa_slotid;
168         u8                      sa_cache_this;
169 };
170
171 struct nfs4_sequence_res {
172         struct nfs4_session     *sr_session;
173         u8                      sr_slotid;      /* slot used to send request */
174         unsigned long           sr_renewal_time;
175         int                     sr_status;      /* sequence operation status */
176 };
177
178 struct nfs4_get_lease_time_args {
179         struct nfs4_sequence_args       la_seq_args;
180 };
181
182 struct nfs4_get_lease_time_res {
183         struct nfs_fsinfo              *lr_fsinfo;
184         struct nfs4_sequence_res        lr_seq_res;
185 };
186
187 /*
188  * Arguments to the open call.
189  */
190 struct nfs_openargs {
191         const struct nfs_fh *   fh;
192         struct nfs_seqid *      seqid;
193         int                     open_flags;
194         fmode_t                 fmode;
195         __u64                   clientid;
196         __u64                   id;
197         union {
198                 struct iattr *  attrs;    /* UNCHECKED, GUARDED */
199                 nfs4_verifier   verifier; /* EXCLUSIVE */
200                 nfs4_stateid    delegation;             /* CLAIM_DELEGATE_CUR */
201                 fmode_t         delegation_type;        /* CLAIM_PREVIOUS */
202         } u;
203         const struct qstr *     name;
204         const struct nfs_server *server;         /* Needed for ID mapping */
205         const u32 *             bitmask;
206         __u32                   claim;
207         struct nfs4_sequence_args       seq_args;
208 };
209
210 struct nfs_openres {
211         nfs4_stateid            stateid;
212         struct nfs_fh           fh;
213         struct nfs4_change_info cinfo;
214         __u32                   rflags;
215         struct nfs_fattr *      f_attr;
216         struct nfs_fattr *      dir_attr;
217         struct nfs_seqid *      seqid;
218         const struct nfs_server *server;
219         fmode_t                 delegation_type;
220         nfs4_stateid            delegation;
221         __u32                   do_recall;
222         __u64                   maxsize;
223         __u32                   attrset[NFS4_BITMAP_SIZE];
224         struct nfs4_sequence_res        seq_res;
225 };
226
227 /*
228  * Arguments to the open_confirm call.
229  */
230 struct nfs_open_confirmargs {
231         const struct nfs_fh *   fh;
232         nfs4_stateid *          stateid;
233         struct nfs_seqid *      seqid;
234 };
235
236 struct nfs_open_confirmres {
237         nfs4_stateid            stateid;
238         struct nfs_seqid *      seqid;
239 };
240
241 /*
242  * Arguments to the close call.
243  */
244 struct nfs_closeargs {
245         struct nfs_fh *         fh;
246         nfs4_stateid *          stateid;
247         struct nfs_seqid *      seqid;
248         fmode_t                 fmode;
249         const u32 *             bitmask;
250         struct nfs4_sequence_args       seq_args;
251 };
252
253 struct nfs_closeres {
254         nfs4_stateid            stateid;
255         struct nfs_fattr *      fattr;
256         struct nfs_seqid *      seqid;
257         const struct nfs_server *server;
258         struct nfs4_sequence_res        seq_res;
259 };
260 /*
261  *  * Arguments to the lock,lockt, and locku call.
262  *   */
263 struct nfs_lowner {
264         __u64                   clientid;
265         __u64                   id;
266 };
267
268 struct nfs_lock_args {
269         struct nfs_fh *         fh;
270         struct file_lock *      fl;
271         struct nfs_seqid *      lock_seqid;
272         nfs4_stateid *          lock_stateid;
273         struct nfs_seqid *      open_seqid;
274         nfs4_stateid *          open_stateid;
275         struct nfs_lowner       lock_owner;
276         unsigned char           block : 1;
277         unsigned char           reclaim : 1;
278         unsigned char           new_lock_owner : 1;
279         struct nfs4_sequence_args       seq_args;
280 };
281
282 struct nfs_lock_res {
283         nfs4_stateid            stateid;
284         struct nfs_seqid *      lock_seqid;
285         struct nfs_seqid *      open_seqid;
286         struct nfs4_sequence_res        seq_res;
287 };
288
289 struct nfs_locku_args {
290         struct nfs_fh *         fh;
291         struct file_lock *      fl;
292         struct nfs_seqid *      seqid;
293         nfs4_stateid *          stateid;
294         struct nfs4_sequence_args       seq_args;
295 };
296
297 struct nfs_locku_res {
298         nfs4_stateid            stateid;
299         struct nfs_seqid *      seqid;
300         struct nfs4_sequence_res        seq_res;
301 };
302
303 struct nfs_lockt_args {
304         struct nfs_fh *         fh;
305         struct file_lock *      fl;
306         struct nfs_lowner       lock_owner;
307         struct nfs4_sequence_args       seq_args;
308 };
309
310 struct nfs_lockt_res {
311         struct file_lock *      denied; /* LOCK, LOCKT failed */
312         struct nfs4_sequence_res        seq_res;
313 };
314
315 struct nfs4_delegreturnargs {
316         const struct nfs_fh *fhandle;
317         const nfs4_stateid *stateid;
318         const u32 * bitmask;
319         struct nfs4_sequence_args       seq_args;
320 };
321
322 struct nfs4_delegreturnres {
323         struct nfs_fattr * fattr;
324         const struct nfs_server *server;
325         struct nfs4_sequence_res        seq_res;
326 };
327
328 /*
329  * Arguments to the read call.
330  */
331 struct nfs_readargs {
332         struct nfs_fh *         fh;
333         struct nfs_open_context *context;
334         __u64                   offset;
335         __u32                   count;
336         unsigned int            pgbase;
337         struct page **          pages;
338         struct nfs4_sequence_args       seq_args;
339 };
340
341 struct nfs_readres {
342         struct nfs_fattr *      fattr;
343         __u32                   count;
344         int                     eof;
345         struct nfs4_sequence_res        seq_res;
346 };
347
348 /*
349  * Arguments to the write call.
350  */
351 struct nfs_writeargs {
352         struct nfs_fh *         fh;
353         struct nfs_open_context *context;
354         __u64                   offset;
355         __u32                   count;
356         enum nfs3_stable_how    stable;
357         unsigned int            pgbase;
358         struct page **          pages;
359         const u32 *             bitmask;
360         struct nfs4_sequence_args       seq_args;
361 };
362
363 struct nfs_writeverf {
364         enum nfs3_stable_how    committed;
365         __be32                  verifier[2];
366 };
367
368 struct nfs_writeres {
369         struct nfs_fattr *      fattr;
370         struct nfs_writeverf *  verf;
371         __u32                   count;
372         const struct nfs_server *server;
373         struct nfs4_sequence_res        seq_res;
374 };
375
376 /*
377  * Common arguments to the unlink call
378  */
379 struct nfs_removeargs {
380         const struct nfs_fh     *fh;
381         struct qstr             name;
382         const u32 *             bitmask;
383         struct nfs4_sequence_args       seq_args;
384 };
385
386 struct nfs_removeres {
387         const struct nfs_server *server;
388         struct nfs4_change_info cinfo;
389         struct nfs_fattr        dir_attr;
390         struct nfs4_sequence_res        seq_res;
391 };
392
393 /*
394  * Argument struct for decode_entry function
395  */
396 struct nfs_entry {
397         __u64                   ino;
398         __u64                   cookie,
399                                 prev_cookie;
400         const char *            name;
401         unsigned int            len;
402         int                     eof;
403         struct nfs_fh *         fh;
404         struct nfs_fattr *      fattr;
405 };
406
407 /*
408  * The following types are for NFSv2 only.
409  */
410 struct nfs_sattrargs {
411         struct nfs_fh *         fh;
412         struct iattr *          sattr;
413 };
414
415 struct nfs_diropargs {
416         struct nfs_fh *         fh;
417         const char *            name;
418         unsigned int            len;
419 };
420
421 struct nfs_createargs {
422         struct nfs_fh *         fh;
423         const char *            name;
424         unsigned int            len;
425         struct iattr *          sattr;
426 };
427
428 struct nfs_renameargs {
429         struct nfs_fh *         fromfh;
430         const char *            fromname;
431         unsigned int            fromlen;
432         struct nfs_fh *         tofh;
433         const char *            toname;
434         unsigned int            tolen;
435 };
436
437 struct nfs_setattrargs {
438         struct nfs_fh *                 fh;
439         nfs4_stateid                    stateid;
440         struct iattr *                  iap;
441         const struct nfs_server *       server; /* Needed for name mapping */
442         const u32 *                     bitmask;
443         struct nfs4_sequence_args       seq_args;
444 };
445
446 struct nfs_setaclargs {
447         struct nfs_fh *                 fh;
448         size_t                          acl_len;
449         unsigned int                    acl_pgbase;
450         struct page **                  acl_pages;
451         struct nfs4_sequence_args       seq_args;
452 };
453
454 struct nfs_setaclres {
455         struct nfs4_sequence_res        seq_res;
456 };
457
458 struct nfs_getaclargs {
459         struct nfs_fh *                 fh;
460         size_t                          acl_len;
461         unsigned int                    acl_pgbase;
462         struct page **                  acl_pages;
463         struct nfs4_sequence_args       seq_args;
464 };
465
466 struct nfs_getaclres {
467         size_t                          acl_len;
468         struct nfs4_sequence_res        seq_res;
469 };
470
471 struct nfs_setattrres {
472         struct nfs_fattr *              fattr;
473         const struct nfs_server *       server;
474         struct nfs4_sequence_res        seq_res;
475 };
476
477 struct nfs_linkargs {
478         struct nfs_fh *         fromfh;
479         struct nfs_fh *         tofh;
480         const char *            toname;
481         unsigned int            tolen;
482 };
483
484 struct nfs_symlinkargs {
485         struct nfs_fh *         fromfh;
486         const char *            fromname;
487         unsigned int            fromlen;
488         struct page **          pages;
489         unsigned int            pathlen;
490         struct iattr *          sattr;
491 };
492
493 struct nfs_readdirargs {
494         struct nfs_fh *         fh;
495         __u32                   cookie;
496         unsigned int            count;
497         struct page **          pages;
498 };
499
500 struct nfs3_getaclargs {
501         struct nfs_fh *         fh;
502         int                     mask;
503         struct page **          pages;
504 };
505
506 struct nfs3_setaclargs {
507         struct inode *          inode;
508         int                     mask;
509         struct posix_acl *      acl_access;
510         struct posix_acl *      acl_default;
511         size_t                  len;
512         unsigned int            npages;
513         struct page **          pages;
514 };
515
516 struct nfs_diropok {
517         struct nfs_fh *         fh;
518         struct nfs_fattr *      fattr;
519 };
520
521 struct nfs_readlinkargs {
522         struct nfs_fh *         fh;
523         unsigned int            pgbase;
524         unsigned int            pglen;
525         struct page **          pages;
526 };
527
528 struct nfs3_sattrargs {
529         struct nfs_fh *         fh;
530         struct iattr *          sattr;
531         unsigned int            guard;
532         struct timespec         guardtime;
533 };
534
535 struct nfs3_diropargs {
536         struct nfs_fh *         fh;
537         const char *            name;
538         unsigned int            len;
539 };
540
541 struct nfs3_accessargs {
542         struct nfs_fh *         fh;
543         __u32                   access;
544 };
545
546 struct nfs3_createargs {
547         struct nfs_fh *         fh;
548         const char *            name;
549         unsigned int            len;
550         struct iattr *          sattr;
551         enum nfs3_createmode    createmode;
552         __be32                  verifier[2];
553 };
554
555 struct nfs3_mkdirargs {
556         struct nfs_fh *         fh;
557         const char *            name;
558         unsigned int            len;
559         struct iattr *          sattr;
560 };
561
562 struct nfs3_symlinkargs {
563         struct nfs_fh *         fromfh;
564         const char *            fromname;
565         unsigned int            fromlen;
566         struct page **          pages;
567         unsigned int            pathlen;
568         struct iattr *          sattr;
569 };
570
571 struct nfs3_mknodargs {
572         struct nfs_fh *         fh;
573         const char *            name;
574         unsigned int            len;
575         enum nfs3_ftype         type;
576         struct iattr *          sattr;
577         dev_t                   rdev;
578 };
579
580 struct nfs3_renameargs {
581         struct nfs_fh *         fromfh;
582         const char *            fromname;
583         unsigned int            fromlen;
584         struct nfs_fh *         tofh;
585         const char *            toname;
586         unsigned int            tolen;
587 };
588
589 struct nfs3_linkargs {
590         struct nfs_fh *         fromfh;
591         struct nfs_fh *         tofh;
592         const char *            toname;
593         unsigned int            tolen;
594 };
595
596 struct nfs3_readdirargs {
597         struct nfs_fh *         fh;
598         __u64                   cookie;
599         __be32                  verf[2];
600         int                     plus;
601         unsigned int            count;
602         struct page **          pages;
603 };
604
605 struct nfs3_diropres {
606         struct nfs_fattr *      dir_attr;
607         struct nfs_fh *         fh;
608         struct nfs_fattr *      fattr;
609 };
610
611 struct nfs3_accessres {
612         struct nfs_fattr *      fattr;
613         __u32                   access;
614 };
615
616 struct nfs3_readlinkargs {
617         struct nfs_fh *         fh;
618         unsigned int            pgbase;
619         unsigned int            pglen;
620         struct page **          pages;
621 };
622
623 struct nfs3_renameres {
624         struct nfs_fattr *      fromattr;
625         struct nfs_fattr *      toattr;
626 };
627
628 struct nfs3_linkres {
629         struct nfs_fattr *      dir_attr;
630         struct nfs_fattr *      fattr;
631 };
632
633 struct nfs3_readdirres {
634         struct nfs_fattr *      dir_attr;
635         __be32 *                verf;
636         int                     plus;
637 };
638
639 struct nfs3_getaclres {
640         struct nfs_fattr *      fattr;
641         int                     mask;
642         unsigned int            acl_access_count;
643         unsigned int            acl_default_count;
644         struct posix_acl *      acl_access;
645         struct posix_acl *      acl_default;
646 };
647
648 #ifdef CONFIG_NFS_V4
649
650 typedef u64 clientid4;
651
652 struct nfs4_accessargs {
653         const struct nfs_fh *           fh;
654         const u32 *                     bitmask;
655         u32                             access;
656         struct nfs4_sequence_args       seq_args;
657 };
658
659 struct nfs4_accessres {
660         const struct nfs_server *       server;
661         struct nfs_fattr *              fattr;
662         u32                             supported;
663         u32                             access;
664         struct nfs4_sequence_res        seq_res;
665 };
666
667 struct nfs4_create_arg {
668         u32                             ftype;
669         union {
670                 struct {
671                         struct page **  pages;
672                         unsigned int    len;
673                 } symlink;   /* NF4LNK */
674                 struct {
675                         u32             specdata1;
676                         u32             specdata2;
677                 } device;    /* NF4BLK, NF4CHR */
678         } u;
679         const struct qstr *             name;
680         const struct nfs_server *       server;
681         const struct iattr *            attrs;
682         const struct nfs_fh *           dir_fh;
683         const u32 *                     bitmask;
684         struct nfs4_sequence_args       seq_args;
685 };
686
687 struct nfs4_create_res {
688         const struct nfs_server *       server;
689         struct nfs_fh *                 fh;
690         struct nfs_fattr *              fattr;
691         struct nfs4_change_info         dir_cinfo;
692         struct nfs_fattr *              dir_fattr;
693         struct nfs4_sequence_res        seq_res;
694 };
695
696 struct nfs4_fsinfo_arg {
697         const struct nfs_fh *           fh;
698         const u32 *                     bitmask;
699         struct nfs4_sequence_args       seq_args;
700 };
701
702 struct nfs4_fsinfo_res {
703         struct nfs_fsinfo              *fsinfo;
704         struct nfs4_sequence_res        seq_res;
705 };
706
707 struct nfs4_getattr_arg {
708         const struct nfs_fh *           fh;
709         const u32 *                     bitmask;
710         struct nfs4_sequence_args       seq_args;
711 };
712
713 struct nfs4_getattr_res {
714         const struct nfs_server *       server;
715         struct nfs_fattr *              fattr;
716         struct nfs4_sequence_res        seq_res;
717 };
718
719 struct nfs4_link_arg {
720         const struct nfs_fh *           fh;
721         const struct nfs_fh *           dir_fh;
722         const struct qstr *             name;
723         const u32 *                     bitmask;
724         struct nfs4_sequence_args       seq_args;
725 };
726
727 struct nfs4_link_res {
728         const struct nfs_server *       server;
729         struct nfs_fattr *              fattr;
730         struct nfs4_change_info         cinfo;
731         struct nfs_fattr *              dir_attr;
732         struct nfs4_sequence_res        seq_res;
733 };
734
735
736 struct nfs4_lookup_arg {
737         const struct nfs_fh *           dir_fh;
738         const struct qstr *             name;
739         const u32 *                     bitmask;
740         struct nfs4_sequence_args       seq_args;
741 };
742
743 struct nfs4_lookup_res {
744         const struct nfs_server *       server;
745         struct nfs_fattr *              fattr;
746         struct nfs_fh *                 fh;
747         struct nfs4_sequence_res        seq_res;
748 };
749
750 struct nfs4_lookup_root_arg {
751         const u32 *                     bitmask;
752         struct nfs4_sequence_args       seq_args;
753 };
754
755 struct nfs4_pathconf_arg {
756         const struct nfs_fh *           fh;
757         const u32 *                     bitmask;
758         struct nfs4_sequence_args       seq_args;
759 };
760
761 struct nfs4_pathconf_res {
762         struct nfs_pathconf            *pathconf;
763         struct nfs4_sequence_res        seq_res;
764 };
765
766 struct nfs4_readdir_arg {
767         const struct nfs_fh *           fh;
768         u64                             cookie;
769         nfs4_verifier                   verifier;
770         u32                             count;
771         struct page **                  pages;  /* zero-copy data */
772         unsigned int                    pgbase; /* zero-copy data */
773         const u32 *                     bitmask;
774         struct nfs4_sequence_args       seq_args;
775 };
776
777 struct nfs4_readdir_res {
778         nfs4_verifier                   verifier;
779         unsigned int                    pgbase;
780         struct nfs4_sequence_res        seq_res;
781 };
782
783 struct nfs4_readlink {
784         const struct nfs_fh *           fh;
785         unsigned int                    pgbase;
786         unsigned int                    pglen;   /* zero-copy data */
787         struct page **                  pages;   /* zero-copy data */
788         struct nfs4_sequence_args       seq_args;
789 };
790
791 struct nfs4_readlink_res {
792         struct nfs4_sequence_res        seq_res;
793 };
794
795 struct nfs4_rename_arg {
796         const struct nfs_fh *           old_dir;
797         const struct nfs_fh *           new_dir;
798         const struct qstr *             old_name;
799         const struct qstr *             new_name;
800         const u32 *                     bitmask;
801         struct nfs4_sequence_args       seq_args;
802 };
803
804 struct nfs4_rename_res {
805         const struct nfs_server *       server;
806         struct nfs4_change_info         old_cinfo;
807         struct nfs_fattr *              old_fattr;
808         struct nfs4_change_info         new_cinfo;
809         struct nfs_fattr *              new_fattr;
810         struct nfs4_sequence_res        seq_res;
811 };
812
813 #define NFS4_SETCLIENTID_NAMELEN        (127)
814 struct nfs4_setclientid {
815         const nfs4_verifier *           sc_verifier;
816         unsigned int                    sc_name_len;
817         char                            sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
818         u32                             sc_prog;
819         unsigned int                    sc_netid_len;
820         char                            sc_netid[RPCBIND_MAXNETIDLEN + 1];
821         unsigned int                    sc_uaddr_len;
822         char                            sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
823         u32                             sc_cb_ident;
824 };
825
826 struct nfs4_statfs_arg {
827         const struct nfs_fh *           fh;
828         const u32 *                     bitmask;
829         struct nfs4_sequence_args       seq_args;
830 };
831
832 struct nfs4_statfs_res {
833         struct nfs_fsstat              *fsstat;
834         struct nfs4_sequence_res        seq_res;
835 };
836
837 struct nfs4_server_caps_arg {
838         struct nfs_fh                  *fhandle;
839         struct nfs4_sequence_args       seq_args;
840 };
841
842 struct nfs4_server_caps_res {
843         u32                             attr_bitmask[2];
844         u32                             acl_bitmask;
845         u32                             has_links;
846         u32                             has_symlinks;
847         struct nfs4_sequence_res        seq_res;
848 };
849
850 struct nfs4_string {
851         unsigned int len;
852         char *data;
853 };
854
855 #define NFS4_PATHNAME_MAXCOMPONENTS 512
856 struct nfs4_pathname {
857         unsigned int ncomponents;
858         struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
859 };
860
861 #define NFS4_FS_LOCATION_MAXSERVERS 10
862 struct nfs4_fs_location {
863         unsigned int nservers;
864         struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
865         struct nfs4_pathname rootpath;
866 };
867
868 #define NFS4_FS_LOCATIONS_MAXENTRIES 10
869 struct nfs4_fs_locations {
870         struct nfs_fattr fattr;
871         const struct nfs_server *server;
872         struct nfs4_pathname fs_path;
873         int nlocations;
874         struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
875 };
876
877 struct nfs4_fs_locations_arg {
878         const struct nfs_fh *dir_fh;
879         const struct qstr *name;
880         struct page *page;
881         const u32 *bitmask;
882         struct nfs4_sequence_args       seq_args;
883 };
884
885 struct nfs4_fs_locations_res {
886         struct nfs4_fs_locations       *fs_locations;
887         struct nfs4_sequence_res        seq_res;
888 };
889
890 #endif /* CONFIG_NFS_V4 */
891
892 struct nfstime4 {
893         u64     seconds;
894         u32     nseconds;
895 };
896
897 #ifdef CONFIG_NFS_V4_1
898 struct nfs_impl_id4 {
899         u32             domain_len;
900         char            *domain;
901         u32             name_len;
902         char            *name;
903         struct nfstime4 date;
904 };
905
906 #define NFS4_EXCHANGE_ID_LEN    (48)
907 struct nfs41_exchange_id_args {
908         struct nfs_client               *client;
909         nfs4_verifier                   *verifier;
910         unsigned int                    id_len;
911         char                            id[NFS4_EXCHANGE_ID_LEN];
912         u32                             flags;
913 };
914
915 struct server_owner {
916         uint64_t                        minor_id;
917         uint32_t                        major_id_sz;
918         char                            major_id[NFS4_OPAQUE_LIMIT];
919 };
920
921 struct server_scope {
922         uint32_t                        server_scope_sz;
923         char                            server_scope[NFS4_OPAQUE_LIMIT];
924 };
925
926 struct nfs41_exchange_id_res {
927         struct nfs_client               *client;
928         u32                             flags;
929 };
930
931 struct nfs41_create_session_args {
932         struct nfs_client              *client;
933         uint32_t                        flags;
934         uint32_t                        cb_program;
935         struct nfs4_channel_attrs       fc_attrs;       /* Fore Channel */
936         struct nfs4_channel_attrs       bc_attrs;       /* Back Channel */
937 };
938
939 struct nfs41_create_session_res {
940         struct nfs_client              *client;
941 };
942 #endif /* CONFIG_NFS_V4_1 */
943
944 struct nfs_page;
945
946 #define NFS_PAGEVEC_SIZE        (8U)
947
948 struct nfs_read_data {
949         int                     flags;
950         struct rpc_task         task;
951         struct inode            *inode;
952         struct rpc_cred         *cred;
953         struct nfs_fattr        fattr;  /* fattr storage */
954         struct list_head        pages;  /* Coalesced read requests */
955         struct nfs_page         *req;   /* multi ops per nfs_page */
956         struct page             **pagevec;
957         unsigned int            npages; /* Max length of pagevec */
958         struct nfs_readargs args;
959         struct nfs_readres  res;
960 #ifdef CONFIG_NFS_V4
961         unsigned long           timestamp;      /* For lease renewal */
962 #endif
963         struct page             *page_array[NFS_PAGEVEC_SIZE];
964 };
965
966 struct nfs_write_data {
967         int                     flags;
968         struct rpc_task         task;
969         struct inode            *inode;
970         struct rpc_cred         *cred;
971         struct nfs_fattr        fattr;
972         struct nfs_writeverf    verf;
973         struct list_head        pages;          /* Coalesced requests we wish to flush */
974         struct nfs_page         *req;           /* multi ops per nfs_page */
975         struct page             **pagevec;
976         unsigned int            npages;         /* Max length of pagevec */
977         struct nfs_writeargs    args;           /* argument struct */
978         struct nfs_writeres     res;            /* result struct */
979 #ifdef CONFIG_NFS_V4
980         unsigned long           timestamp;      /* For lease renewal */
981 #endif
982         struct page             *page_array[NFS_PAGEVEC_SIZE];
983 };
984
985 struct nfs_access_entry;
986
987 /*
988  * RPC procedure vector for NFSv2/NFSv3 demuxing
989  */
990 struct nfs_rpc_ops {
991         u32     version;                /* Protocol version */
992         const struct dentry_operations *dentry_ops;
993         const struct inode_operations *dir_inode_ops;
994         const struct inode_operations *file_inode_ops;
995
996         int     (*getroot) (struct nfs_server *, struct nfs_fh *,
997                             struct nfs_fsinfo *);
998         int     (*lookupfh)(struct nfs_server *, struct nfs_fh *,
999                             struct qstr *, struct nfs_fh *,
1000                             struct nfs_fattr *);
1001         int     (*getattr) (struct nfs_server *, struct nfs_fh *,
1002                             struct nfs_fattr *);
1003         int     (*setattr) (struct dentry *, struct nfs_fattr *,
1004                             struct iattr *);
1005         int     (*lookup)  (struct inode *, struct qstr *,
1006                             struct nfs_fh *, struct nfs_fattr *);
1007         int     (*access)  (struct inode *, struct nfs_access_entry *);
1008         int     (*readlink)(struct inode *, struct page *, unsigned int,
1009                             unsigned int);
1010         int     (*create)  (struct inode *, struct dentry *,
1011                             struct iattr *, int, struct nameidata *);
1012         int     (*remove)  (struct inode *, struct qstr *);
1013         void    (*unlink_setup)  (struct rpc_message *, struct inode *dir);
1014         int     (*unlink_done) (struct rpc_task *, struct inode *);
1015         int     (*rename)  (struct inode *, struct qstr *,
1016                             struct inode *, struct qstr *);
1017         int     (*link)    (struct inode *, struct inode *, struct qstr *);
1018         int     (*symlink) (struct inode *, struct dentry *, struct page *,
1019                             unsigned int, struct iattr *);
1020         int     (*mkdir)   (struct inode *, struct dentry *, struct iattr *);
1021         int     (*rmdir)   (struct inode *, struct qstr *);
1022         int     (*readdir) (struct dentry *, struct rpc_cred *,
1023                             u64, struct page *, unsigned int, int);
1024         int     (*mknod)   (struct inode *, struct dentry *, struct iattr *,
1025                             dev_t);
1026         int     (*statfs)  (struct nfs_server *, struct nfs_fh *,
1027                             struct nfs_fsstat *);
1028         int     (*fsinfo)  (struct nfs_server *, struct nfs_fh *,
1029                             struct nfs_fsinfo *);
1030         int     (*pathconf) (struct nfs_server *, struct nfs_fh *,
1031                              struct nfs_pathconf *);
1032         int     (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1033         __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
1034         void    (*read_setup)   (struct nfs_read_data *, struct rpc_message *);
1035         int     (*read_done)  (struct rpc_task *, struct nfs_read_data *);
1036         void    (*write_setup)  (struct nfs_write_data *, struct rpc_message *);
1037         int     (*write_done)  (struct rpc_task *, struct nfs_write_data *);
1038         void    (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
1039         int     (*commit_done) (struct rpc_task *, struct nfs_write_data *);
1040         int     (*lock)(struct file *, int, struct file_lock *);
1041         int     (*lock_check_bounds)(const struct file_lock *);
1042         void    (*clear_acl_cache)(struct inode *);
1043         void    (*close_context)(struct nfs_open_context *ctx, int);
1044 };
1045
1046 /*
1047  *      NFS_CALL(getattr, inode, (fattr));
1048  * into
1049  *      NFS_PROTO(inode)->getattr(fattr);
1050  */
1051 #define NFS_CALL(op, inode, args)       NFS_PROTO(inode)->op args
1052
1053 /*
1054  * Function vectors etc. for the NFS client
1055  */
1056 extern const struct nfs_rpc_ops nfs_v2_clientops;
1057 extern const struct nfs_rpc_ops nfs_v3_clientops;
1058 extern const struct nfs_rpc_ops nfs_v4_clientops;
1059 extern struct rpc_version       nfs_version2;
1060 extern struct rpc_version       nfs_version3;
1061 extern struct rpc_version       nfs_version4;
1062
1063 extern struct rpc_version       nfsacl_version3;
1064 extern struct rpc_program       nfsacl_program;
1065
1066 #endif