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