source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/nfs_xdr.h

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 13.0 KB
Line 
1#ifndef _LINUX_NFS_XDR_H
2#define _LINUX_NFS_XDR_H
3
4#include <asm/types.h>
5
6#include <linux/sunrpc/xprt.h>
7
8struct nfs4_fsid {
9        __u64 major;
10        __u64 minor;
11};
12
13struct nfs_fattr {
14        unsigned short          valid;          /* which fields are valid */
15        __u64                   pre_size;       /* pre_op_attr.size       */
16        struct timespec         pre_mtime;      /* pre_op_attr.mtime      */
17        struct timespec         pre_ctime;      /* pre_op_attr.ctime      */
18        enum nfs_ftype          type;           /* always use NFSv2 types */
19        __u32                   mode;
20        __u32                   nlink;
21        __u32                   uid;
22        __u32                   gid;
23        __u64                   size;
24        union {
25                struct {
26                        __u32   blocksize;
27                        __u32   blocks;
28                } nfs2;
29                struct {
30                        __u64   used;
31                } nfs3;
32        } du;
33        dev_t                   rdev;
34        union {
35                __u64           nfs3;           /* also nfs2 */
36                struct nfs4_fsid nfs4;
37        } fsid_u;
38        __u64                   fileid;
39        struct timespec         atime;
40        struct timespec         mtime;
41        struct timespec         ctime;
42        __u32                   bitmap[2];      /* NFSv4 returned attribute bitmap */
43        __u64                   change_attr;    /* NFSv4 change attribute */
44        __u64                   pre_change_attr;/* pre-op NFSv4 change attribute */
45        unsigned long           timestamp;
46};
47
48#define NFS_ATTR_WCC            0x0001          /* pre-op WCC data    */
49#define NFS_ATTR_FATTR          0x0002          /* post-op attributes */
50#define NFS_ATTR_FATTR_V3       0x0004          /* NFSv3 attributes */
51#define NFS_ATTR_FATTR_V4       0x0008
52#define NFS_ATTR_PRE_CHANGE     0x0010
53
54/*
55 * Info on the file system
56 */
57struct nfs_fsinfo {
58        struct nfs_fattr        *fattr; /* Post-op attributes */
59        __u32                   rtmax;  /* max.  read transfer size */
60        __u32                   rtpref; /* pref. read transfer size */
61        __u32                   rtmult; /* reads should be multiple of this */
62        __u32                   wtmax;  /* max.  write transfer size */
63        __u32                   wtpref; /* pref. write transfer size */
64        __u32                   wtmult; /* writes should be multiple of this */
65        __u32                   dtpref; /* pref. readdir transfer size */
66        __u64                   maxfilesize;
67        __u32                   lease_time; /* in seconds */
68};
69
70struct nfs_fsstat {
71        struct nfs_fattr        *fattr; /* Post-op attributes */
72        __u64                   tbytes; /* total size in bytes */
73        __u64                   fbytes; /* # of free bytes */
74        __u64                   abytes; /* # of bytes available to user */
75        __u64                   tfiles; /* # of files */
76        __u64                   ffiles; /* # of free files */
77        __u64                   afiles; /* # of files available to user */
78};
79
80struct nfs2_fsstat {
81        __u32                   tsize;  /* Server transfer size */
82        __u32                   bsize;  /* Filesystem block size */
83        __u32                   blocks; /* No. of "bsize" blocks on filesystem */
84        __u32                   bfree;  /* No. of free "bsize" blocks */
85        __u32                   bavail; /* No. of available "bsize" blocks */
86};
87
88struct nfs_pathconf {
89        struct nfs_fattr        *fattr; /* Post-op attributes */
90        __u32                   max_link; /* max # of hard links */
91        __u32                   max_namelen; /* max name length */
92};
93
94struct nfs4_change_info {
95        __u32                   atomic;
96        __u64                   before;
97        __u64                   after;
98};
99
100/*
101 * Arguments to the open call.
102 */
103struct nfs_openargs {
104        const struct nfs_fh *   fh;
105        __u32                   seqid;
106        int                     open_flags;
107        __u64                   clientid;
108        __u32                   id;
109        union {
110                struct iattr *  attrs;    /* UNCHECKED, GUARDED */
111                nfs4_verifier   verifier; /* EXCLUSIVE */
112                nfs4_stateid    delegation;             /* CLAIM_DELEGATE_CUR */
113                int             delegation_type;        /* CLAIM_PREVIOUS */
114        } u;
115        const struct qstr *     name;
116        const struct nfs_server *server;         /* Needed for ID mapping */
117        const __u32 *           bitmask;
118        __u32                   claim;
119};
120
121struct nfs_openres {
122        nfs4_stateid            stateid;
123        struct nfs_fh           fh;
124        struct nfs4_change_info cinfo;
125        __u32                   rflags;
126        struct nfs_fattr *      f_attr;
127        const struct nfs_server *server;
128        int                     delegation_type;
129        nfs4_stateid            delegation;
130        __u32                   do_recall;
131        __u64                   maxsize;
132};
133
134/*
135 * Arguments to the open_confirm call.
136 */
137struct nfs_open_confirmargs {
138        const struct nfs_fh *   fh;
139        nfs4_stateid            stateid;
140        __u32                   seqid;
141};
142
143struct nfs_open_confirmres {
144        nfs4_stateid            stateid;
145};
146
147/*
148 * Arguments to the close call.
149 */
150struct nfs_closeargs {
151        struct nfs_fh *         fh;
152        nfs4_stateid            stateid;
153        __u32                   seqid;
154        int                     open_flags;
155};
156
157struct nfs_closeres {
158        nfs4_stateid            stateid;
159};
160/*
161 *  * Arguments to the lock,lockt, and locku call.
162 *   */
163struct nfs_lowner {
164        __u64           clientid;
165        __u32                     id;
166};
167
168struct nfs_open_to_lock {
169        __u32                   open_seqid;
170        nfs4_stateid            open_stateid;
171        __u32                   lock_seqid;
172        struct nfs_lowner       lock_owner;
173};
174
175struct nfs_exist_lock {
176        nfs4_stateid            stateid;
177        __u32                   seqid;
178};
179
180struct nfs_lock_opargs {
181        __u32                   reclaim;
182        __u32                   new_lock_owner;
183        union {
184                struct nfs_open_to_lock *open_lock;
185                struct nfs_exist_lock   *exist_lock;
186        } u;
187};
188
189struct nfs_locku_opargs {
190        __u32                   seqid;
191        nfs4_stateid            stateid;
192};
193
194struct nfs_lockargs {
195        struct nfs_fh *         fh;
196        __u32                   type;
197        __u64                   offset; 
198        __u64                   length; 
199        union {
200                struct nfs_lock_opargs  *lock;    /* LOCK  */
201                struct nfs_lowner       *lockt;  /* LOCKT */
202                struct nfs_locku_opargs *locku;  /* LOCKU */
203        } u;
204};
205
206struct nfs_lock_denied {
207        __u64                   offset;
208        __u64                   length;
209        __u32                   type;
210        struct nfs_lowner       owner;
211};
212
213struct nfs_lockres {
214        union {
215                nfs4_stateid            stateid;/* LOCK success, LOCKU */
216                struct nfs_lock_denied  denied; /* LOCK failed, LOCKT success */
217        } u;
218        const struct nfs_server *       server;
219};
220
221struct nfs4_delegreturnargs {
222        const struct nfs_fh *fhandle;
223        const nfs4_stateid *stateid;
224};
225
226/*
227 * Arguments to the read call.
228 */
229
230#define NFS_READ_MAXIOV         (9U)
231#if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
232#error "NFS_READ_MAXIOV is too large"
233#endif
234
235struct nfs_readargs {
236        struct nfs_fh *         fh;
237        struct nfs_open_context *context;
238        __u64                   offset;
239        __u32                   count;
240        unsigned int            pgbase;
241        struct page **          pages;
242};
243
244struct nfs_readres {
245        struct nfs_fattr *      fattr;
246        __u32                   count;
247        int                     eof;
248};
249
250/*
251 * Arguments to the write call.
252 */
253#define NFS_WRITE_MAXIOV        (9U)
254#if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
255#error "NFS_WRITE_MAXIOV is too large"
256#endif
257
258struct nfs_writeargs {
259        struct nfs_fh *         fh;
260        struct nfs_open_context *context;
261        __u64                   offset;
262        __u32                   count;
263        enum nfs3_stable_how    stable;
264        unsigned int            pgbase;
265        struct page **          pages;
266};
267
268struct nfs_writeverf {
269        enum nfs3_stable_how    committed;
270        __u32                   verifier[2];
271};
272
273struct nfs_writeres {
274        struct nfs_fattr *      fattr;
275        struct nfs_writeverf *  verf;
276        __u32                   count;
277};
278
279/*
280 * Argument struct for decode_entry function
281 */
282struct nfs_entry {
283        __u64                   ino;
284        __u64                   cookie,
285                                prev_cookie;
286        const char *            name;
287        unsigned int            len;
288        int                     eof;
289        struct nfs_fh *         fh;
290        struct nfs_fattr *      fattr;
291};
292
293/*
294 * The following types are for NFSv2 only.
295 */
296struct nfs_sattrargs {
297        struct nfs_fh *         fh;
298        struct iattr *          sattr;
299};
300
301struct nfs_diropargs {
302        struct nfs_fh *         fh;
303        const char *            name;
304        unsigned int            len;
305};
306
307struct nfs_createargs {
308        struct nfs_fh *         fh;
309        const char *            name;
310        unsigned int            len;
311        struct iattr *          sattr;
312};
313
314struct nfs_renameargs {
315        struct nfs_fh *         fromfh;
316        const char *            fromname;
317        unsigned int            fromlen;
318        struct nfs_fh *         tofh;
319        const char *            toname;
320        unsigned int            tolen;
321};
322
323struct nfs_setattrargs {
324        struct nfs_fh *                 fh;
325        nfs4_stateid                    stateid;
326        struct iattr *                  iap;
327        const struct nfs_server *       server; /* Needed for name mapping */
328        const __u32 *                   bitmask;
329};
330
331struct nfs_setattrres {
332        struct nfs_fattr *              fattr;
333        const struct nfs_server *       server;
334};
335
336struct nfs_linkargs {
337        struct nfs_fh *         fromfh;
338        struct nfs_fh *         tofh;
339        const char *            toname;
340        unsigned int            tolen;
341};
342
343struct nfs_symlinkargs {
344        struct nfs_fh *         fromfh;
345        const char *            fromname;
346        unsigned int            fromlen;
347        const char *            topath;
348        unsigned int            tolen;
349        struct iattr *          sattr;
350};
351
352struct nfs_readdirargs {
353        struct nfs_fh *         fh;
354        __u32                   cookie;
355        unsigned int            count;
356        struct page **          pages;
357};
358
359struct nfs_diropok {
360        struct nfs_fh *         fh;
361        struct nfs_fattr *      fattr;
362};
363
364struct nfs_readlinkargs {
365        struct nfs_fh *         fh;
366        unsigned int            pgbase;
367        unsigned int            pglen;
368        struct page **          pages;
369};
370
371struct nfs3_sattrargs {
372        struct nfs_fh *         fh;
373        struct iattr *          sattr;
374        unsigned int            guard;
375        struct timespec         guardtime;
376};
377
378struct nfs3_diropargs {
379        struct nfs_fh *         fh;
380        const char *            name;
381        unsigned int            len;
382};
383
384struct nfs3_accessargs {
385        struct nfs_fh *         fh;
386        __u32                   access;
387};
388
389struct nfs3_createargs {
390        struct nfs_fh *         fh;
391        const char *            name;
392        unsigned int            len;
393        struct iattr *          sattr;
394        enum nfs3_createmode    createmode;
395        __u32                   verifier[2];
396};
397
398struct nfs3_mkdirargs {
399        struct nfs_fh *         fh;
400        const char *            name;
401        unsigned int            len;
402        struct iattr *          sattr;
403};
404
405struct nfs3_symlinkargs {
406        struct nfs_fh *         fromfh;
407        const char *            fromname;
408        unsigned int            fromlen;
409        const char *            topath;
410        unsigned int            tolen;
411        struct iattr *          sattr;
412};
413
414struct nfs3_mknodargs {
415        struct nfs_fh *         fh;
416        const char *            name;
417        unsigned int            len;
418        enum nfs3_ftype         type;
419        struct iattr *          sattr;
420        dev_t                   rdev;
421};
422
423struct nfs3_renameargs {
424        struct nfs_fh *         fromfh;
425        const char *            fromname;
426        unsigned int            fromlen;
427        struct nfs_fh *         tofh;
428        const char *            toname;
429        unsigned int            tolen;
430};
431
432struct nfs3_linkargs {
433        struct nfs_fh *         fromfh;
434        struct nfs_fh *         tofh;
435        const char *            toname;
436        unsigned int            tolen;
437};
438
439struct nfs3_readdirargs {
440        struct nfs_fh *         fh;
441        __u64                   cookie;
442        __u32                   verf[2];
443        int                     plus;
444        unsigned int            count;
445        struct page **          pages;
446};
447
448struct nfs3_diropres {
449        struct nfs_fattr *      dir_attr;
450        struct nfs_fh *         fh;
451        struct nfs_fattr *      fattr;
452};
453
454struct nfs3_accessres {
455        struct nfs_fattr *      fattr;
456        __u32                   access;
457};
458
459struct nfs3_readlinkargs {
460        struct nfs_fh *         fh;
461        unsigned int            pgbase;
462        unsigned int            pglen;
463        struct page **          pages;
464};
465
466struct nfs3_renameres {
467        struct nfs_fattr *      fromattr;
468        struct nfs_fattr *      toattr;
469};
470
471struct nfs3_linkres {
472        struct nfs_fattr *      dir_attr;
473        struct nfs_fattr *      fattr;
474};
475
476struct nfs3_readdirres {
477        struct nfs_fattr *      dir_attr;
478        __u32 *                 verf;
479        int                     plus;
480};
481
482#ifdef CONFIG_NFS_V4
483
484typedef __u64 clientid4;
485
486struct nfs4_accessargs {
487        const struct nfs_fh *           fh;
488        __u32                           access;
489};
490
491struct nfs4_accessres {
492        __u32                           supported;
493        __u32                           access;
494};
495
496struct nfs4_create_arg {
497        __u32                           ftype;
498        union {
499                struct qstr *           symlink;    /* NF4LNK */
500                struct {
501                        __u32           specdata1;
502                        __u32           specdata2;
503                } device;    /* NF4BLK, NF4CHR */
504        } u;
505        const struct qstr *             name;
506        const struct nfs_server *       server;
507        const struct iattr *            attrs;
508        const struct nfs_fh *           dir_fh;
509        const __u32 *                   bitmask;
510};
511
512struct nfs4_create_res {
513        const struct nfs_server *       server;
514        struct nfs_fh *                 fh;
515        struct nfs_fattr *              fattr;
516        struct nfs4_change_info         dir_cinfo;
517};
518
519struct nfs4_fsinfo_arg {
520        const struct nfs_fh *           fh;
521        const __u32 *                   bitmask;
522};
523
524struct nfs4_getattr_arg {
525        const struct nfs_fh *           fh;
526        const __u32 *                   bitmask;
527};
528
529struct nfs4_getattr_res {
530        const struct nfs_server *       server;
531        struct nfs_fattr *              fattr;
532};
533
534struct nfs4_link_arg {
535        const struct nfs_fh *           fh;
536        const struct nfs_fh *           dir_fh;
537        const struct qstr *             name;
538};
539
540struct nfs4_lookup_arg {
541        const struct nfs_fh *           dir_fh;
542        const struct qstr *             name;
543        const __u32 *                   bitmask;
544};
545
546struct nfs4_lookup_res {
547        const struct nfs_server *       server;
548        struct nfs_fattr *              fattr;
549        struct nfs_fh *                 fh;
550};
551
552struct nfs4_lookup_root_arg {
553        const __u32 *                   bitmask;
554};
555
556struct nfs4_pathconf_arg {
557        const struct nfs_fh *           fh;
558        const __u32 *                   bitmask;
559};
560
561struct nfs4_readdir_arg {
562        const struct nfs_fh *           fh;
563        __u64                           cookie;
564        nfs4_verifier                   verifier;
565        __u32                           count;
566        struct page **                  pages;  /* zero-copy data */
567        unsigned int                    pgbase; /* zero-copy data */
568        const __u32 *                   bitmask;
569};
570
571struct nfs4_readdir_res {
572        nfs4_verifier                   verifier;
573        unsigned int                    pgbase;
574};
575
576struct nfs4_readlink {
577        const struct nfs_fh *           fh;
578        unsigned int                    pgbase;
579        unsigned int                    pglen;   /* zero-copy data */
580        struct page **                  pages;   /* zero-copy data */
581};
582
583struct nfs4_remove_arg {
584        const struct nfs_fh *           fh;
585        const struct qstr *             name;
586};
587
588struct nfs4_rename_arg {
589        const struct nfs_fh *           old_dir;
590        const struct nfs_fh *           new_dir;
591        const struct qstr *             old_name;
592        const struct qstr *             new_name;
593};
594
595struct nfs4_rename_res {
596        struct nfs4_change_info         old_cinfo;
597        struct nfs4_change_info         new_cinfo;
598};
599
600struct nfs4_setclientid {
601        const nfs4_verifier *           sc_verifier;      /* request */
602        unsigned int                    sc_name_len;
603        char                            sc_name[32];      /* request */
604        __u32                           sc_prog;          /* request */
605        unsigned int                    sc_netid_len;
606        char                            sc_netid[4];      /* request */
607        unsigned int                    sc_uaddr_len;
608        char                            sc_uaddr[24];     /* request */
609        __u32                           sc_cb_ident;      /* request */
610};
611
612struct nfs4_statfs_arg {
613        const struct nfs_fh *           fh;
614        const __u32 *                   bitmask;
615};
616
617struct nfs4_server_caps_res {
618        __u32                           attr_bitmask[2];
619        __u32                           acl_bitmask;
620        __u32                           has_links;
621        __u32                           has_symlinks;
622};
623
624#endif /* CONFIG_NFS_V4 */
625
626
627
628/*
629 *      NFS_CALL(getattr, inode, (fattr));
630 * into
631 *      NFS_PROTO(inode)->getattr(fattr);
632 */
633#define NFS_CALL(op, inode, args)       NFS_PROTO(inode)->op args
634
635struct nfs_access_entry;
636
637/*
638 * Function vectors etc. for the NFS client
639 */
640extern struct nfs_rpc_ops       nfs_v2_clientops;
641extern struct nfs_rpc_ops       nfs_v3_clientops;
642extern struct nfs_rpc_ops       nfs_v4_clientops;
643extern struct rpc_version       nfs_version2;
644extern struct rpc_version       nfs_version3;
645extern struct rpc_version       nfs_version4;
646
647#endif
Note: See TracBrowser for help on using the repository browser.