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