nfs41: use nfs4_getaclres
[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
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         /* stub */
166 };
167
168 struct nfs4_sequence_res {
169         /* stub */
170 };
171
172 /*
173  * Arguments to the open call.
174  */
175 struct nfs_openargs {
176         const struct nfs_fh *   fh;
177         struct nfs_seqid *      seqid;
178         int                     open_flags;
179         fmode_t                 fmode;
180         __u64                   clientid;
181         __u64                   id;
182         union {
183                 struct iattr *  attrs;    /* UNCHECKED, GUARDED */
184                 nfs4_verifier   verifier; /* EXCLUSIVE */
185                 nfs4_stateid    delegation;             /* CLAIM_DELEGATE_CUR */
186                 fmode_t         delegation_type;        /* CLAIM_PREVIOUS */
187         } u;
188         const struct qstr *     name;
189         const struct nfs_server *server;         /* Needed for ID mapping */
190         const u32 *             bitmask;
191         __u32                   claim;
192         struct nfs4_sequence_args       seq_args;
193 };
194
195 struct nfs_openres {
196         nfs4_stateid            stateid;
197         struct nfs_fh           fh;
198         struct nfs4_change_info cinfo;
199         __u32                   rflags;
200         struct nfs_fattr *      f_attr;
201         struct nfs_fattr *      dir_attr;
202         struct nfs_seqid *      seqid;
203         const struct nfs_server *server;
204         fmode_t                 delegation_type;
205         nfs4_stateid            delegation;
206         __u32                   do_recall;
207         __u64                   maxsize;
208         __u32                   attrset[NFS4_BITMAP_SIZE];
209         struct nfs4_sequence_res        seq_res;
210 };
211
212 /*
213  * Arguments to the open_confirm call.
214  */
215 struct nfs_open_confirmargs {
216         const struct nfs_fh *   fh;
217         nfs4_stateid *          stateid;
218         struct nfs_seqid *      seqid;
219 };
220
221 struct nfs_open_confirmres {
222         nfs4_stateid            stateid;
223         struct nfs_seqid *      seqid;
224 };
225
226 /*
227  * Arguments to the close call.
228  */
229 struct nfs_closeargs {
230         struct nfs_fh *         fh;
231         nfs4_stateid *          stateid;
232         struct nfs_seqid *      seqid;
233         fmode_t                 fmode;
234         const u32 *             bitmask;
235         struct nfs4_sequence_args       seq_args;
236 };
237
238 struct nfs_closeres {
239         nfs4_stateid            stateid;
240         struct nfs_fattr *      fattr;
241         struct nfs_seqid *      seqid;
242         const struct nfs_server *server;
243         struct nfs4_sequence_res        seq_res;
244 };
245 /*
246  *  * Arguments to the lock,lockt, and locku call.
247  *   */
248 struct nfs_lowner {
249         __u64                   clientid;
250         __u64                   id;
251 };
252
253 struct nfs_lock_args {
254         struct nfs_fh *         fh;
255         struct file_lock *      fl;
256         struct nfs_seqid *      lock_seqid;
257         nfs4_stateid *          lock_stateid;
258         struct nfs_seqid *      open_seqid;
259         nfs4_stateid *          open_stateid;
260         struct nfs_lowner       lock_owner;
261         unsigned char           block : 1;
262         unsigned char           reclaim : 1;
263         unsigned char           new_lock_owner : 1;
264         struct nfs4_sequence_args       seq_args;
265 };
266
267 struct nfs_lock_res {
268         nfs4_stateid            stateid;
269         struct nfs_seqid *      lock_seqid;
270         struct nfs_seqid *      open_seqid;
271         struct nfs4_sequence_res        seq_res;
272 };
273
274 struct nfs_locku_args {
275         struct nfs_fh *         fh;
276         struct file_lock *      fl;
277         struct nfs_seqid *      seqid;
278         nfs4_stateid *          stateid;
279         struct nfs4_sequence_args       seq_args;
280 };
281
282 struct nfs_locku_res {
283         nfs4_stateid            stateid;
284         struct nfs_seqid *      seqid;
285         struct nfs4_sequence_res        seq_res;
286 };
287
288 struct nfs_lockt_args {
289         struct nfs_fh *         fh;
290         struct file_lock *      fl;
291         struct nfs_lowner       lock_owner;
292         struct nfs4_sequence_args       seq_args;
293 };
294
295 struct nfs_lockt_res {
296         struct file_lock *      denied; /* LOCK, LOCKT failed */
297         struct nfs4_sequence_res        seq_res;
298 };
299
300 struct nfs4_delegreturnargs {
301         const struct nfs_fh *fhandle;
302         const nfs4_stateid *stateid;
303         const u32 * bitmask;
304         struct nfs4_sequence_args       seq_args;
305 };
306
307 struct nfs4_delegreturnres {
308         struct nfs_fattr * fattr;
309         const struct nfs_server *server;
310         struct nfs4_sequence_res        seq_res;
311 };
312
313 /*
314  * Arguments to the read call.
315  */
316 struct nfs_readargs {
317         struct nfs_fh *         fh;
318         struct nfs_open_context *context;
319         __u64                   offset;
320         __u32                   count;
321         unsigned int            pgbase;
322         struct page **          pages;
323         struct nfs4_sequence_args       seq_args;
324 };
325
326 struct nfs_readres {
327         struct nfs_fattr *      fattr;
328         __u32                   count;
329         int                     eof;
330         struct nfs4_sequence_res        seq_res;
331 };
332
333 /*
334  * Arguments to the write call.
335  */
336 struct nfs_writeargs {
337         struct nfs_fh *         fh;
338         struct nfs_open_context *context;
339         __u64                   offset;
340         __u32                   count;
341         enum nfs3_stable_how    stable;
342         unsigned int            pgbase;
343         struct page **          pages;
344         const u32 *             bitmask;
345         struct nfs4_sequence_args       seq_args;
346 };
347
348 struct nfs_writeverf {
349         enum nfs3_stable_how    committed;
350         __be32                  verifier[2];
351 };
352
353 struct nfs_writeres {
354         struct nfs_fattr *      fattr;
355         struct nfs_writeverf *  verf;
356         __u32                   count;
357         const struct nfs_server *server;
358         struct nfs4_sequence_res        seq_res;
359 };
360
361 /*
362  * Common arguments to the unlink call
363  */
364 struct nfs_removeargs {
365         const struct nfs_fh     *fh;
366         struct qstr             name;
367         const u32 *             bitmask;
368         struct nfs4_sequence_args       seq_args;
369 };
370
371 struct nfs_removeres {
372         const struct nfs_server *server;
373         struct nfs4_change_info cinfo;
374         struct nfs_fattr        dir_attr;
375         struct nfs4_sequence_res        seq_res;
376 };
377
378 /*
379  * Argument struct for decode_entry function
380  */
381 struct nfs_entry {
382         __u64                   ino;
383         __u64                   cookie,
384                                 prev_cookie;
385         const char *            name;
386         unsigned int            len;
387         int                     eof;
388         struct nfs_fh *         fh;
389         struct nfs_fattr *      fattr;
390 };
391
392 /*
393  * The following types are for NFSv2 only.
394  */
395 struct nfs_sattrargs {
396         struct nfs_fh *         fh;
397         struct iattr *          sattr;
398 };
399
400 struct nfs_diropargs {
401         struct nfs_fh *         fh;
402         const char *            name;
403         unsigned int            len;
404 };
405
406 struct nfs_createargs {
407         struct nfs_fh *         fh;
408         const char *            name;
409         unsigned int            len;
410         struct iattr *          sattr;
411 };
412
413 struct nfs_renameargs {
414         struct nfs_fh *         fromfh;
415         const char *            fromname;
416         unsigned int            fromlen;
417         struct nfs_fh *         tofh;
418         const char *            toname;
419         unsigned int            tolen;
420 };
421
422 struct nfs_setattrargs {
423         struct nfs_fh *                 fh;
424         nfs4_stateid                    stateid;
425         struct iattr *                  iap;
426         const struct nfs_server *       server; /* Needed for name mapping */
427         const u32 *                     bitmask;
428         struct nfs4_sequence_args       seq_args;
429 };
430
431 struct nfs_setaclargs {
432         struct nfs_fh *                 fh;
433         size_t                          acl_len;
434         unsigned int                    acl_pgbase;
435         struct page **                  acl_pages;
436         struct nfs4_sequence_args       seq_args;
437 };
438
439 struct nfs_getaclargs {
440         struct nfs_fh *                 fh;
441         size_t                          acl_len;
442         unsigned int                    acl_pgbase;
443         struct page **                  acl_pages;
444         struct nfs4_sequence_args       seq_args;
445 };
446
447 struct nfs_getaclres {
448         size_t                          acl_len;
449         struct nfs4_sequence_res        seq_res;
450 };
451
452 struct nfs_setattrres {
453         struct nfs_fattr *              fattr;
454         const struct nfs_server *       server;
455         struct nfs4_sequence_res        seq_res;
456 };
457
458 struct nfs_linkargs {
459         struct nfs_fh *         fromfh;
460         struct nfs_fh *         tofh;
461         const char *            toname;
462         unsigned int            tolen;
463 };
464
465 struct nfs_symlinkargs {
466         struct nfs_fh *         fromfh;
467         const char *            fromname;
468         unsigned int            fromlen;
469         struct page **          pages;
470         unsigned int            pathlen;
471         struct iattr *          sattr;
472 };
473
474 struct nfs_readdirargs {
475         struct nfs_fh *         fh;
476         __u32                   cookie;
477         unsigned int            count;
478         struct page **          pages;
479 };
480
481 struct nfs3_getaclargs {
482         struct nfs_fh *         fh;
483         int                     mask;
484         struct page **          pages;
485 };
486
487 struct nfs3_setaclargs {
488         struct inode *          inode;
489         int                     mask;
490         struct posix_acl *      acl_access;
491         struct posix_acl *      acl_default;
492         size_t                  len;
493         unsigned int            npages;
494         struct page **          pages;
495 };
496
497 struct nfs_diropok {
498         struct nfs_fh *         fh;
499         struct nfs_fattr *      fattr;
500 };
501
502 struct nfs_readlinkargs {
503         struct nfs_fh *         fh;
504         unsigned int            pgbase;
505         unsigned int            pglen;
506         struct page **          pages;
507 };
508
509 struct nfs3_sattrargs {
510         struct nfs_fh *         fh;
511         struct iattr *          sattr;
512         unsigned int            guard;
513         struct timespec         guardtime;
514 };
515
516 struct nfs3_diropargs {
517         struct nfs_fh *         fh;
518         const char *            name;
519         unsigned int            len;
520 };
521
522 struct nfs3_accessargs {
523         struct nfs_fh *         fh;
524         __u32                   access;
525 };
526
527 struct nfs3_createargs {
528         struct nfs_fh *         fh;
529         const char *            name;
530         unsigned int            len;
531         struct iattr *          sattr;
532         enum nfs3_createmode    createmode;
533         __be32                  verifier[2];
534 };
535
536 struct nfs3_mkdirargs {
537         struct nfs_fh *         fh;
538         const char *            name;
539         unsigned int            len;
540         struct iattr *          sattr;
541 };
542
543 struct nfs3_symlinkargs {
544         struct nfs_fh *         fromfh;
545         const char *            fromname;
546         unsigned int            fromlen;
547         struct page **          pages;
548         unsigned int            pathlen;
549         struct iattr *          sattr;
550 };
551
552 struct nfs3_mknodargs {
553         struct nfs_fh *         fh;
554         const char *            name;
555         unsigned int            len;
556         enum nfs3_ftype         type;
557         struct iattr *          sattr;
558         dev_t                   rdev;
559 };
560
561 struct nfs3_renameargs {
562         struct nfs_fh *         fromfh;
563         const char *            fromname;
564         unsigned int            fromlen;
565         struct nfs_fh *         tofh;
566         const char *            toname;
567         unsigned int            tolen;
568 };
569
570 struct nfs3_linkargs {
571         struct nfs_fh *         fromfh;
572         struct nfs_fh *         tofh;
573         const char *            toname;
574         unsigned int            tolen;
575 };
576
577 struct nfs3_readdirargs {
578         struct nfs_fh *         fh;
579         __u64                   cookie;
580         __be32                  verf[2];
581         int                     plus;
582         unsigned int            count;
583         struct page **          pages;
584 };
585
586 struct nfs3_diropres {
587         struct nfs_fattr *      dir_attr;
588         struct nfs_fh *         fh;
589         struct nfs_fattr *      fattr;
590 };
591
592 struct nfs3_accessres {
593         struct nfs_fattr *      fattr;
594         __u32                   access;
595 };
596
597 struct nfs3_readlinkargs {
598         struct nfs_fh *         fh;
599         unsigned int            pgbase;
600         unsigned int            pglen;
601         struct page **          pages;
602 };
603
604 struct nfs3_renameres {
605         struct nfs_fattr *      fromattr;
606         struct nfs_fattr *      toattr;
607 };
608
609 struct nfs3_linkres {
610         struct nfs_fattr *      dir_attr;
611         struct nfs_fattr *      fattr;
612 };
613
614 struct nfs3_readdirres {
615         struct nfs_fattr *      dir_attr;
616         __be32 *                verf;
617         int                     plus;
618 };
619
620 struct nfs3_getaclres {
621         struct nfs_fattr *      fattr;
622         int                     mask;
623         unsigned int            acl_access_count;
624         unsigned int            acl_default_count;
625         struct posix_acl *      acl_access;
626         struct posix_acl *      acl_default;
627 };
628
629 #ifdef CONFIG_NFS_V4
630
631 typedef u64 clientid4;
632
633 struct nfs4_accessargs {
634         const struct nfs_fh *           fh;
635         const u32 *                     bitmask;
636         u32                             access;
637         struct nfs4_sequence_args       seq_args;
638 };
639
640 struct nfs4_accessres {
641         const struct nfs_server *       server;
642         struct nfs_fattr *              fattr;
643         u32                             supported;
644         u32                             access;
645         struct nfs4_sequence_res        seq_res;
646 };
647
648 struct nfs4_create_arg {
649         u32                             ftype;
650         union {
651                 struct {
652                         struct page **  pages;
653                         unsigned int    len;
654                 } symlink;   /* NF4LNK */
655                 struct {
656                         u32             specdata1;
657                         u32             specdata2;
658                 } device;    /* NF4BLK, NF4CHR */
659         } u;
660         const struct qstr *             name;
661         const struct nfs_server *       server;
662         const struct iattr *            attrs;
663         const struct nfs_fh *           dir_fh;
664         const u32 *                     bitmask;
665         struct nfs4_sequence_args       seq_args;
666 };
667
668 struct nfs4_create_res {
669         const struct nfs_server *       server;
670         struct nfs_fh *                 fh;
671         struct nfs_fattr *              fattr;
672         struct nfs4_change_info         dir_cinfo;
673         struct nfs_fattr *              dir_fattr;
674         struct nfs4_sequence_res        seq_res;
675 };
676
677 struct nfs4_fsinfo_arg {
678         const struct nfs_fh *           fh;
679         const u32 *                     bitmask;
680         struct nfs4_sequence_args       seq_args;
681 };
682
683 struct nfs4_fsinfo_res {
684         struct nfs_fsinfo              *fsinfo;
685         struct nfs4_sequence_res        seq_res;
686 };
687
688 struct nfs4_getattr_arg {
689         const struct nfs_fh *           fh;
690         const u32 *                     bitmask;
691         struct nfs4_sequence_args       seq_args;
692 };
693
694 struct nfs4_getattr_res {
695         const struct nfs_server *       server;
696         struct nfs_fattr *              fattr;
697         struct nfs4_sequence_res        seq_res;
698 };
699
700 struct nfs4_link_arg {
701         const struct nfs_fh *           fh;
702         const struct nfs_fh *           dir_fh;
703         const struct qstr *             name;
704         const u32 *                     bitmask;
705         struct nfs4_sequence_args       seq_args;
706 };
707
708 struct nfs4_link_res {
709         const struct nfs_server *       server;
710         struct nfs_fattr *              fattr;
711         struct nfs4_change_info         cinfo;
712         struct nfs_fattr *              dir_attr;
713         struct nfs4_sequence_res        seq_res;
714 };
715
716
717 struct nfs4_lookup_arg {
718         const struct nfs_fh *           dir_fh;
719         const struct qstr *             name;
720         const u32 *                     bitmask;
721         struct nfs4_sequence_args       seq_args;
722 };
723
724 struct nfs4_lookup_res {
725         const struct nfs_server *       server;
726         struct nfs_fattr *              fattr;
727         struct nfs_fh *                 fh;
728         struct nfs4_sequence_res        seq_res;
729 };
730
731 struct nfs4_lookup_root_arg {
732         const u32 *                     bitmask;
733         struct nfs4_sequence_args       seq_args;
734 };
735
736 struct nfs4_pathconf_arg {
737         const struct nfs_fh *           fh;
738         const u32 *                     bitmask;
739         struct nfs4_sequence_args       seq_args;
740 };
741
742 struct nfs4_pathconf_res {
743         struct nfs_pathconf            *pathconf;
744         struct nfs4_sequence_res        seq_res;
745 };
746
747 struct nfs4_readdir_arg {
748         const struct nfs_fh *           fh;
749         u64                             cookie;
750         nfs4_verifier                   verifier;
751         u32                             count;
752         struct page **                  pages;  /* zero-copy data */
753         unsigned int                    pgbase; /* zero-copy data */
754         const u32 *                     bitmask;
755         struct nfs4_sequence_args       seq_args;
756 };
757
758 struct nfs4_readdir_res {
759         nfs4_verifier                   verifier;
760         unsigned int                    pgbase;
761         struct nfs4_sequence_res        seq_res;
762 };
763
764 struct nfs4_readlink {
765         const struct nfs_fh *           fh;
766         unsigned int                    pgbase;
767         unsigned int                    pglen;   /* zero-copy data */
768         struct page **                  pages;   /* zero-copy data */
769         struct nfs4_sequence_args       seq_args;
770 };
771
772 struct nfs4_readlink_res {
773         struct nfs4_sequence_res        seq_res;
774 };
775
776 struct nfs4_rename_arg {
777         const struct nfs_fh *           old_dir;
778         const struct nfs_fh *           new_dir;
779         const struct qstr *             old_name;
780         const struct qstr *             new_name;
781         const u32 *                     bitmask;
782         struct nfs4_sequence_args       seq_args;
783 };
784
785 struct nfs4_rename_res {
786         const struct nfs_server *       server;
787         struct nfs4_change_info         old_cinfo;
788         struct nfs_fattr *              old_fattr;
789         struct nfs4_change_info         new_cinfo;
790         struct nfs_fattr *              new_fattr;
791         struct nfs4_sequence_res        seq_res;
792 };
793
794 #define NFS4_SETCLIENTID_NAMELEN        (127)
795 struct nfs4_setclientid {
796         const nfs4_verifier *           sc_verifier;
797         unsigned int                    sc_name_len;
798         char                            sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
799         u32                             sc_prog;
800         unsigned int                    sc_netid_len;
801         char                            sc_netid[RPCBIND_MAXNETIDLEN + 1];
802         unsigned int                    sc_uaddr_len;
803         char                            sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
804         u32                             sc_cb_ident;
805 };
806
807 struct nfs4_statfs_arg {
808         const struct nfs_fh *           fh;
809         const u32 *                     bitmask;
810         struct nfs4_sequence_args       seq_args;
811 };
812
813 struct nfs4_statfs_res {
814         struct nfs_fsstat              *fsstat;
815         struct nfs4_sequence_res        seq_res;
816 };
817
818 struct nfs4_server_caps_arg {
819         struct nfs_fh                  *fhandle;
820         struct nfs4_sequence_args       seq_args;
821 };
822
823 struct nfs4_server_caps_res {
824         u32                             attr_bitmask[2];
825         u32                             acl_bitmask;
826         u32                             has_links;
827         u32                             has_symlinks;
828         struct nfs4_sequence_res        seq_res;
829 };
830
831 struct nfs4_string {
832         unsigned int len;
833         char *data;
834 };
835
836 #define NFS4_PATHNAME_MAXCOMPONENTS 512
837 struct nfs4_pathname {
838         unsigned int ncomponents;
839         struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
840 };
841
842 #define NFS4_FS_LOCATION_MAXSERVERS 10
843 struct nfs4_fs_location {
844         unsigned int nservers;
845         struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
846         struct nfs4_pathname rootpath;
847 };
848
849 #define NFS4_FS_LOCATIONS_MAXENTRIES 10
850 struct nfs4_fs_locations {
851         struct nfs_fattr fattr;
852         const struct nfs_server *server;
853         struct nfs4_pathname fs_path;
854         int nlocations;
855         struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
856 };
857
858 struct nfs4_fs_locations_arg {
859         const struct nfs_fh *dir_fh;
860         const struct qstr *name;
861         struct page *page;
862         const u32 *bitmask;
863         struct nfs4_sequence_args       seq_args;
864 };
865
866 #endif /* CONFIG_NFS_V4 */
867
868 struct nfs_page;
869
870 #define NFS_PAGEVEC_SIZE        (8U)
871
872 struct nfs_read_data {
873         int                     flags;
874         struct rpc_task         task;
875         struct inode            *inode;
876         struct rpc_cred         *cred;
877         struct nfs_fattr        fattr;  /* fattr storage */
878         struct list_head        pages;  /* Coalesced read requests */
879         struct nfs_page         *req;   /* multi ops per nfs_page */
880         struct page             **pagevec;
881         unsigned int            npages; /* Max length of pagevec */
882         struct nfs_readargs args;
883         struct nfs_readres  res;
884 #ifdef CONFIG_NFS_V4
885         unsigned long           timestamp;      /* For lease renewal */
886 #endif
887         struct page             *page_array[NFS_PAGEVEC_SIZE];
888 };
889
890 struct nfs_write_data {
891         int                     flags;
892         struct rpc_task         task;
893         struct inode            *inode;
894         struct rpc_cred         *cred;
895         struct nfs_fattr        fattr;
896         struct nfs_writeverf    verf;
897         struct list_head        pages;          /* Coalesced requests we wish to flush */
898         struct nfs_page         *req;           /* multi ops per nfs_page */
899         struct page             **pagevec;
900         unsigned int            npages;         /* Max length of pagevec */
901         struct nfs_writeargs    args;           /* argument struct */
902         struct nfs_writeres     res;            /* result struct */
903 #ifdef CONFIG_NFS_V4
904         unsigned long           timestamp;      /* For lease renewal */
905 #endif
906         struct page             *page_array[NFS_PAGEVEC_SIZE];
907 };
908
909 struct nfs_access_entry;
910
911 /*
912  * RPC procedure vector for NFSv2/NFSv3 demuxing
913  */
914 struct nfs_rpc_ops {
915         u32     version;                /* Protocol version */
916         const struct dentry_operations *dentry_ops;
917         const struct inode_operations *dir_inode_ops;
918         const struct inode_operations *file_inode_ops;
919
920         int     (*getroot) (struct nfs_server *, struct nfs_fh *,
921                             struct nfs_fsinfo *);
922         int     (*lookupfh)(struct nfs_server *, struct nfs_fh *,
923                             struct qstr *, struct nfs_fh *,
924                             struct nfs_fattr *);
925         int     (*getattr) (struct nfs_server *, struct nfs_fh *,
926                             struct nfs_fattr *);
927         int     (*setattr) (struct dentry *, struct nfs_fattr *,
928                             struct iattr *);
929         int     (*lookup)  (struct inode *, struct qstr *,
930                             struct nfs_fh *, struct nfs_fattr *);
931         int     (*access)  (struct inode *, struct nfs_access_entry *);
932         int     (*readlink)(struct inode *, struct page *, unsigned int,
933                             unsigned int);
934         int     (*create)  (struct inode *, struct dentry *,
935                             struct iattr *, int, struct nameidata *);
936         int     (*remove)  (struct inode *, struct qstr *);
937         void    (*unlink_setup)  (struct rpc_message *, struct inode *dir);
938         int     (*unlink_done) (struct rpc_task *, struct inode *);
939         int     (*rename)  (struct inode *, struct qstr *,
940                             struct inode *, struct qstr *);
941         int     (*link)    (struct inode *, struct inode *, struct qstr *);
942         int     (*symlink) (struct inode *, struct dentry *, struct page *,
943                             unsigned int, struct iattr *);
944         int     (*mkdir)   (struct inode *, struct dentry *, struct iattr *);
945         int     (*rmdir)   (struct inode *, struct qstr *);
946         int     (*readdir) (struct dentry *, struct rpc_cred *,
947                             u64, struct page *, unsigned int, int);
948         int     (*mknod)   (struct inode *, struct dentry *, struct iattr *,
949                             dev_t);
950         int     (*statfs)  (struct nfs_server *, struct nfs_fh *,
951                             struct nfs_fsstat *);
952         int     (*fsinfo)  (struct nfs_server *, struct nfs_fh *,
953                             struct nfs_fsinfo *);
954         int     (*pathconf) (struct nfs_server *, struct nfs_fh *,
955                              struct nfs_pathconf *);
956         int     (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
957         __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
958         void    (*read_setup)   (struct nfs_read_data *, struct rpc_message *);
959         int     (*read_done)  (struct rpc_task *, struct nfs_read_data *);
960         void    (*write_setup)  (struct nfs_write_data *, struct rpc_message *);
961         int     (*write_done)  (struct rpc_task *, struct nfs_write_data *);
962         void    (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
963         int     (*commit_done) (struct rpc_task *, struct nfs_write_data *);
964         int     (*lock)(struct file *, int, struct file_lock *);
965         int     (*lock_check_bounds)(const struct file_lock *);
966         void    (*clear_acl_cache)(struct inode *);
967         void    (*close_context)(struct nfs_open_context *ctx, int);
968 };
969
970 /*
971  *      NFS_CALL(getattr, inode, (fattr));
972  * into
973  *      NFS_PROTO(inode)->getattr(fattr);
974  */
975 #define NFS_CALL(op, inode, args)       NFS_PROTO(inode)->op args
976
977 /*
978  * Function vectors etc. for the NFS client
979  */
980 extern const struct nfs_rpc_ops nfs_v2_clientops;
981 extern const struct nfs_rpc_ops nfs_v3_clientops;
982 extern const struct nfs_rpc_ops nfs_v4_clientops;
983 extern struct rpc_version       nfs_version2;
984 extern struct rpc_version       nfs_version3;
985 extern struct rpc_version       nfs_version4;
986
987 extern struct rpc_version       nfsacl_version3;
988 extern struct rpc_program       nfsacl_program;
989
990 #endif