[ARM] 3373/1: move uengine loader to arch/arm/common
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / linux / nfs_xdr.h
blob6d6f69ec5675bf1992dc8a6f532164fb8438fbc6
1 #ifndef _LINUX_NFS_XDR_H
2 #define _LINUX_NFS_XDR_H
4 #include <linux/sunrpc/xprt.h>
5 #include <linux/nfsacl.h>
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.
13 #define NFS_MAX_FILE_IO_SIZE (1048576U)
14 #define NFS_DEF_FILE_IO_SIZE (4096U)
15 #define NFS_MIN_FILE_IO_SIZE (1024U)
17 struct nfs4_fsid {
18 __u64 major;
19 __u64 minor;
22 struct nfs_fattr {
23 unsigned short valid; /* which fields are valid */
24 __u64 pre_size; /* pre_op_attr.size */
25 struct timespec pre_mtime; /* pre_op_attr.mtime */
26 struct timespec pre_ctime; /* pre_op_attr.ctime */
27 enum nfs_ftype type; /* always use NFSv2 types */
28 __u32 mode;
29 __u32 nlink;
30 __u32 uid;
31 __u32 gid;
32 __u64 size;
33 union {
34 struct {
35 __u32 blocksize;
36 __u32 blocks;
37 } nfs2;
38 struct {
39 __u64 used;
40 } nfs3;
41 } du;
42 dev_t rdev;
43 union {
44 __u64 nfs3; /* also nfs2 */
45 struct nfs4_fsid nfs4;
46 } fsid_u;
47 __u64 fileid;
48 struct timespec atime;
49 struct timespec mtime;
50 struct timespec ctime;
51 __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */
52 __u64 change_attr; /* NFSv4 change attribute */
53 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
54 unsigned long time_start;
57 #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
58 #define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
59 #define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
60 #define NFS_ATTR_FATTR_V4 0x0008
61 #define NFS_ATTR_PRE_CHANGE 0x0010
64 * Info on the file system
66 struct nfs_fsinfo {
67 struct nfs_fattr *fattr; /* Post-op attributes */
68 __u32 rtmax; /* max. read transfer size */
69 __u32 rtpref; /* pref. read transfer size */
70 __u32 rtmult; /* reads should be multiple of this */
71 __u32 wtmax; /* max. write transfer size */
72 __u32 wtpref; /* pref. write transfer size */
73 __u32 wtmult; /* writes should be multiple of this */
74 __u32 dtpref; /* pref. readdir transfer size */
75 __u64 maxfilesize;
76 __u32 lease_time; /* in seconds */
79 struct nfs_fsstat {
80 struct nfs_fattr *fattr; /* Post-op attributes */
81 __u64 tbytes; /* total size in bytes */
82 __u64 fbytes; /* # of free bytes */
83 __u64 abytes; /* # of bytes available to user */
84 __u64 tfiles; /* # of files */
85 __u64 ffiles; /* # of free files */
86 __u64 afiles; /* # of files available to user */
89 struct nfs2_fsstat {
90 __u32 tsize; /* Server transfer size */
91 __u32 bsize; /* Filesystem block size */
92 __u32 blocks; /* No. of "bsize" blocks on filesystem */
93 __u32 bfree; /* No. of free "bsize" blocks */
94 __u32 bavail; /* No. of available "bsize" blocks */
97 struct nfs_pathconf {
98 struct nfs_fattr *fattr; /* Post-op attributes */
99 __u32 max_link; /* max # of hard links */
100 __u32 max_namelen; /* max name length */
103 struct nfs4_change_info {
104 u32 atomic;
105 u64 before;
106 u64 after;
109 struct nfs_seqid;
111 * Arguments to the open call.
113 struct nfs_openargs {
114 const struct nfs_fh * fh;
115 struct nfs_seqid * seqid;
116 int open_flags;
117 __u64 clientid;
118 __u32 id;
119 union {
120 struct iattr * attrs; /* UNCHECKED, GUARDED */
121 nfs4_verifier verifier; /* EXCLUSIVE */
122 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
123 int delegation_type; /* CLAIM_PREVIOUS */
124 } u;
125 const struct qstr * name;
126 const struct nfs_server *server; /* Needed for ID mapping */
127 const u32 * bitmask;
128 __u32 claim;
131 struct nfs_openres {
132 nfs4_stateid stateid;
133 struct nfs_fh fh;
134 struct nfs4_change_info cinfo;
135 __u32 rflags;
136 struct nfs_fattr * f_attr;
137 struct nfs_fattr * dir_attr;
138 const struct nfs_server *server;
139 int delegation_type;
140 nfs4_stateid delegation;
141 __u32 do_recall;
142 __u64 maxsize;
146 * Arguments to the open_confirm call.
148 struct nfs_open_confirmargs {
149 const struct nfs_fh * fh;
150 nfs4_stateid * stateid;
151 struct nfs_seqid * seqid;
154 struct nfs_open_confirmres {
155 nfs4_stateid stateid;
159 * Arguments to the close call.
161 struct nfs_closeargs {
162 struct nfs_fh * fh;
163 nfs4_stateid * stateid;
164 struct nfs_seqid * seqid;
165 int open_flags;
166 const u32 * bitmask;
169 struct nfs_closeres {
170 nfs4_stateid stateid;
171 struct nfs_fattr * fattr;
172 const struct nfs_server *server;
175 * * Arguments to the lock,lockt, and locku call.
176 * */
177 struct nfs_lowner {
178 __u64 clientid;
179 u32 id;
182 struct nfs_lock_args {
183 struct nfs_fh * fh;
184 struct file_lock * fl;
185 struct nfs_seqid * lock_seqid;
186 nfs4_stateid * lock_stateid;
187 struct nfs_seqid * open_seqid;
188 nfs4_stateid * open_stateid;
189 struct nfs_lowner lock_owner;
190 unsigned char block : 1;
191 unsigned char reclaim : 1;
192 unsigned char new_lock_owner : 1;
195 struct nfs_lock_res {
196 nfs4_stateid stateid;
199 struct nfs_locku_args {
200 struct nfs_fh * fh;
201 struct file_lock * fl;
202 struct nfs_seqid * seqid;
203 nfs4_stateid * stateid;
206 struct nfs_locku_res {
207 nfs4_stateid stateid;
210 struct nfs_lockt_args {
211 struct nfs_fh * fh;
212 struct file_lock * fl;
213 struct nfs_lowner lock_owner;
216 struct nfs_lockt_res {
217 struct file_lock * denied; /* LOCK, LOCKT failed */
220 struct nfs4_delegreturnargs {
221 const struct nfs_fh *fhandle;
222 const nfs4_stateid *stateid;
223 const u32 * bitmask;
226 struct nfs4_delegreturnres {
227 struct nfs_fattr * fattr;
228 const struct nfs_server *server;
232 * Arguments to the read call.
234 struct nfs_readargs {
235 struct nfs_fh * fh;
236 struct nfs_open_context *context;
237 __u64 offset;
238 __u32 count;
239 unsigned int pgbase;
240 struct page ** pages;
243 struct nfs_readres {
244 struct nfs_fattr * fattr;
245 __u32 count;
246 int eof;
250 * Arguments to the write call.
252 struct nfs_writeargs {
253 struct nfs_fh * fh;
254 struct nfs_open_context *context;
255 __u64 offset;
256 __u32 count;
257 enum nfs3_stable_how stable;
258 unsigned int pgbase;
259 struct page ** pages;
260 const u32 * bitmask;
263 struct nfs_writeverf {
264 enum nfs3_stable_how committed;
265 __u32 verifier[2];
268 struct nfs_writeres {
269 struct nfs_fattr * fattr;
270 struct nfs_writeverf * verf;
271 __u32 count;
272 const struct nfs_server *server;
276 * Argument struct for decode_entry function
278 struct nfs_entry {
279 __u64 ino;
280 __u64 cookie,
281 prev_cookie;
282 const char * name;
283 unsigned int len;
284 int eof;
285 struct nfs_fh * fh;
286 struct nfs_fattr * fattr;
290 * The following types are for NFSv2 only.
292 struct nfs_sattrargs {
293 struct nfs_fh * fh;
294 struct iattr * sattr;
297 struct nfs_diropargs {
298 struct nfs_fh * fh;
299 const char * name;
300 unsigned int len;
303 struct nfs_createargs {
304 struct nfs_fh * fh;
305 const char * name;
306 unsigned int len;
307 struct iattr * sattr;
310 struct nfs_renameargs {
311 struct nfs_fh * fromfh;
312 const char * fromname;
313 unsigned int fromlen;
314 struct nfs_fh * tofh;
315 const char * toname;
316 unsigned int tolen;
319 struct nfs_setattrargs {
320 struct nfs_fh * fh;
321 nfs4_stateid stateid;
322 struct iattr * iap;
323 const struct nfs_server * server; /* Needed for name mapping */
324 const u32 * bitmask;
327 struct nfs_setaclargs {
328 struct nfs_fh * fh;
329 size_t acl_len;
330 unsigned int acl_pgbase;
331 struct page ** acl_pages;
334 struct nfs_getaclargs {
335 struct nfs_fh * fh;
336 size_t acl_len;
337 unsigned int acl_pgbase;
338 struct page ** acl_pages;
341 struct nfs_setattrres {
342 struct nfs_fattr * fattr;
343 const struct nfs_server * server;
346 struct nfs_linkargs {
347 struct nfs_fh * fromfh;
348 struct nfs_fh * tofh;
349 const char * toname;
350 unsigned int tolen;
353 struct nfs_symlinkargs {
354 struct nfs_fh * fromfh;
355 const char * fromname;
356 unsigned int fromlen;
357 const char * topath;
358 unsigned int tolen;
359 struct iattr * sattr;
362 struct nfs_readdirargs {
363 struct nfs_fh * fh;
364 __u32 cookie;
365 unsigned int count;
366 struct page ** pages;
369 struct nfs3_getaclargs {
370 struct nfs_fh * fh;
371 int mask;
372 struct page ** pages;
375 struct nfs3_setaclargs {
376 struct inode * inode;
377 int mask;
378 struct posix_acl * acl_access;
379 struct posix_acl * acl_default;
380 struct page ** pages;
383 struct nfs_diropok {
384 struct nfs_fh * fh;
385 struct nfs_fattr * fattr;
388 struct nfs_readlinkargs {
389 struct nfs_fh * fh;
390 unsigned int pgbase;
391 unsigned int pglen;
392 struct page ** pages;
395 struct nfs3_sattrargs {
396 struct nfs_fh * fh;
397 struct iattr * sattr;
398 unsigned int guard;
399 struct timespec guardtime;
402 struct nfs3_diropargs {
403 struct nfs_fh * fh;
404 const char * name;
405 unsigned int len;
408 struct nfs3_accessargs {
409 struct nfs_fh * fh;
410 __u32 access;
413 struct nfs3_createargs {
414 struct nfs_fh * fh;
415 const char * name;
416 unsigned int len;
417 struct iattr * sattr;
418 enum nfs3_createmode createmode;
419 __u32 verifier[2];
422 struct nfs3_mkdirargs {
423 struct nfs_fh * fh;
424 const char * name;
425 unsigned int len;
426 struct iattr * sattr;
429 struct nfs3_symlinkargs {
430 struct nfs_fh * fromfh;
431 const char * fromname;
432 unsigned int fromlen;
433 const char * topath;
434 unsigned int tolen;
435 struct iattr * sattr;
438 struct nfs3_mknodargs {
439 struct nfs_fh * fh;
440 const char * name;
441 unsigned int len;
442 enum nfs3_ftype type;
443 struct iattr * sattr;
444 dev_t rdev;
447 struct nfs3_renameargs {
448 struct nfs_fh * fromfh;
449 const char * fromname;
450 unsigned int fromlen;
451 struct nfs_fh * tofh;
452 const char * toname;
453 unsigned int tolen;
456 struct nfs3_linkargs {
457 struct nfs_fh * fromfh;
458 struct nfs_fh * tofh;
459 const char * toname;
460 unsigned int tolen;
463 struct nfs3_readdirargs {
464 struct nfs_fh * fh;
465 __u64 cookie;
466 __u32 verf[2];
467 int plus;
468 unsigned int count;
469 struct page ** pages;
472 struct nfs3_diropres {
473 struct nfs_fattr * dir_attr;
474 struct nfs_fh * fh;
475 struct nfs_fattr * fattr;
478 struct nfs3_accessres {
479 struct nfs_fattr * fattr;
480 __u32 access;
483 struct nfs3_readlinkargs {
484 struct nfs_fh * fh;
485 unsigned int pgbase;
486 unsigned int pglen;
487 struct page ** pages;
490 struct nfs3_renameres {
491 struct nfs_fattr * fromattr;
492 struct nfs_fattr * toattr;
495 struct nfs3_linkres {
496 struct nfs_fattr * dir_attr;
497 struct nfs_fattr * fattr;
500 struct nfs3_readdirres {
501 struct nfs_fattr * dir_attr;
502 __u32 * verf;
503 int plus;
506 struct nfs3_getaclres {
507 struct nfs_fattr * fattr;
508 int mask;
509 unsigned int acl_access_count;
510 unsigned int acl_default_count;
511 struct posix_acl * acl_access;
512 struct posix_acl * acl_default;
515 #ifdef CONFIG_NFS_V4
517 typedef u64 clientid4;
519 struct nfs4_accessargs {
520 const struct nfs_fh * fh;
521 u32 access;
524 struct nfs4_accessres {
525 u32 supported;
526 u32 access;
529 struct nfs4_create_arg {
530 u32 ftype;
531 union {
532 struct qstr * symlink; /* NF4LNK */
533 struct {
534 u32 specdata1;
535 u32 specdata2;
536 } device; /* NF4BLK, NF4CHR */
537 } u;
538 const struct qstr * name;
539 const struct nfs_server * server;
540 const struct iattr * attrs;
541 const struct nfs_fh * dir_fh;
542 const u32 * bitmask;
545 struct nfs4_create_res {
546 const struct nfs_server * server;
547 struct nfs_fh * fh;
548 struct nfs_fattr * fattr;
549 struct nfs4_change_info dir_cinfo;
550 struct nfs_fattr * dir_fattr;
553 struct nfs4_fsinfo_arg {
554 const struct nfs_fh * fh;
555 const u32 * bitmask;
558 struct nfs4_getattr_arg {
559 const struct nfs_fh * fh;
560 const u32 * bitmask;
563 struct nfs4_getattr_res {
564 const struct nfs_server * server;
565 struct nfs_fattr * fattr;
568 struct nfs4_link_arg {
569 const struct nfs_fh * fh;
570 const struct nfs_fh * dir_fh;
571 const struct qstr * name;
572 const u32 * bitmask;
575 struct nfs4_link_res {
576 const struct nfs_server * server;
577 struct nfs_fattr * fattr;
578 struct nfs4_change_info cinfo;
579 struct nfs_fattr * dir_attr;
583 struct nfs4_lookup_arg {
584 const struct nfs_fh * dir_fh;
585 const struct qstr * name;
586 const u32 * bitmask;
589 struct nfs4_lookup_res {
590 const struct nfs_server * server;
591 struct nfs_fattr * fattr;
592 struct nfs_fh * fh;
595 struct nfs4_lookup_root_arg {
596 const u32 * bitmask;
599 struct nfs4_pathconf_arg {
600 const struct nfs_fh * fh;
601 const u32 * bitmask;
604 struct nfs4_readdir_arg {
605 const struct nfs_fh * fh;
606 u64 cookie;
607 nfs4_verifier verifier;
608 u32 count;
609 struct page ** pages; /* zero-copy data */
610 unsigned int pgbase; /* zero-copy data */
611 const u32 * bitmask;
614 struct nfs4_readdir_res {
615 nfs4_verifier verifier;
616 unsigned int pgbase;
619 struct nfs4_readlink {
620 const struct nfs_fh * fh;
621 unsigned int pgbase;
622 unsigned int pglen; /* zero-copy data */
623 struct page ** pages; /* zero-copy data */
626 struct nfs4_remove_arg {
627 const struct nfs_fh * fh;
628 const struct qstr * name;
629 const u32 * bitmask;
632 struct nfs4_remove_res {
633 const struct nfs_server * server;
634 struct nfs4_change_info cinfo;
635 struct nfs_fattr * dir_attr;
638 struct nfs4_rename_arg {
639 const struct nfs_fh * old_dir;
640 const struct nfs_fh * new_dir;
641 const struct qstr * old_name;
642 const struct qstr * new_name;
643 const u32 * bitmask;
646 struct nfs4_rename_res {
647 const struct nfs_server * server;
648 struct nfs4_change_info old_cinfo;
649 struct nfs_fattr * old_fattr;
650 struct nfs4_change_info new_cinfo;
651 struct nfs_fattr * new_fattr;
654 struct nfs4_setclientid {
655 const nfs4_verifier * sc_verifier; /* request */
656 unsigned int sc_name_len;
657 char sc_name[32]; /* request */
658 u32 sc_prog; /* request */
659 unsigned int sc_netid_len;
660 char sc_netid[4]; /* request */
661 unsigned int sc_uaddr_len;
662 char sc_uaddr[24]; /* request */
663 u32 sc_cb_ident; /* request */
666 struct nfs4_statfs_arg {
667 const struct nfs_fh * fh;
668 const u32 * bitmask;
671 struct nfs4_server_caps_res {
672 u32 attr_bitmask[2];
673 u32 acl_bitmask;
674 u32 has_links;
675 u32 has_symlinks;
678 #endif /* CONFIG_NFS_V4 */
680 struct nfs_page;
682 #define NFS_PAGEVEC_SIZE (8U)
684 struct nfs_read_data {
685 int flags;
686 struct rpc_task task;
687 struct inode *inode;
688 struct rpc_cred *cred;
689 struct nfs_fattr fattr; /* fattr storage */
690 struct list_head pages; /* Coalesced read requests */
691 struct nfs_page *req; /* multi ops per nfs_page */
692 struct page **pagevec;
693 struct nfs_readargs args;
694 struct nfs_readres res;
695 #ifdef CONFIG_NFS_V4
696 unsigned long timestamp; /* For lease renewal */
697 #endif
698 void (*complete) (struct nfs_read_data *, int);
699 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
702 struct nfs_write_data {
703 int flags;
704 struct rpc_task task;
705 struct inode *inode;
706 struct rpc_cred *cred;
707 struct nfs_fattr fattr;
708 struct nfs_writeverf verf;
709 struct list_head pages; /* Coalesced requests we wish to flush */
710 struct nfs_page *req; /* multi ops per nfs_page */
711 struct page **pagevec;
712 struct nfs_writeargs args; /* argument struct */
713 struct nfs_writeres res; /* result struct */
714 #ifdef CONFIG_NFS_V4
715 unsigned long timestamp; /* For lease renewal */
716 #endif
717 void (*complete) (struct nfs_write_data *, int);
718 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
721 struct nfs_access_entry;
724 * RPC procedure vector for NFSv2/NFSv3 demuxing
726 struct nfs_rpc_ops {
727 int version; /* Protocol version */
728 struct dentry_operations *dentry_ops;
729 struct inode_operations *dir_inode_ops;
730 struct inode_operations *file_inode_ops;
732 int (*getroot) (struct nfs_server *, struct nfs_fh *,
733 struct nfs_fsinfo *);
734 int (*getattr) (struct nfs_server *, struct nfs_fh *,
735 struct nfs_fattr *);
736 int (*setattr) (struct dentry *, struct nfs_fattr *,
737 struct iattr *);
738 int (*lookup) (struct inode *, struct qstr *,
739 struct nfs_fh *, struct nfs_fattr *);
740 int (*access) (struct inode *, struct nfs_access_entry *);
741 int (*readlink)(struct inode *, struct page *, unsigned int,
742 unsigned int);
743 int (*read) (struct nfs_read_data *);
744 int (*write) (struct nfs_write_data *);
745 int (*commit) (struct nfs_write_data *);
746 int (*create) (struct inode *, struct dentry *,
747 struct iattr *, int, struct nameidata *);
748 int (*remove) (struct inode *, struct qstr *);
749 int (*unlink_setup) (struct rpc_message *,
750 struct dentry *, struct qstr *);
751 int (*unlink_done) (struct dentry *, struct rpc_task *);
752 int (*rename) (struct inode *, struct qstr *,
753 struct inode *, struct qstr *);
754 int (*link) (struct inode *, struct inode *, struct qstr *);
755 int (*symlink) (struct inode *, struct qstr *, struct qstr *,
756 struct iattr *, struct nfs_fh *,
757 struct nfs_fattr *);
758 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
759 int (*rmdir) (struct inode *, struct qstr *);
760 int (*readdir) (struct dentry *, struct rpc_cred *,
761 u64, struct page *, unsigned int, int);
762 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
763 dev_t);
764 int (*statfs) (struct nfs_server *, struct nfs_fh *,
765 struct nfs_fsstat *);
766 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
767 struct nfs_fsinfo *);
768 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
769 struct nfs_pathconf *);
770 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
771 void (*read_setup) (struct nfs_read_data *);
772 void (*write_setup) (struct nfs_write_data *, int how);
773 void (*commit_setup) (struct nfs_write_data *, int how);
774 int (*file_open) (struct inode *, struct file *);
775 int (*file_release) (struct inode *, struct file *);
776 int (*lock)(struct file *, int, struct file_lock *);
777 void (*clear_acl_cache)(struct inode *);
781 * NFS_CALL(getattr, inode, (fattr));
782 * into
783 * NFS_PROTO(inode)->getattr(fattr);
785 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
788 * Function vectors etc. for the NFS client
790 extern struct nfs_rpc_ops nfs_v2_clientops;
791 extern struct nfs_rpc_ops nfs_v3_clientops;
792 extern struct nfs_rpc_ops nfs_v4_clientops;
793 extern struct rpc_version nfs_version2;
794 extern struct rpc_version nfs_version3;
795 extern struct rpc_version nfs_version4;
797 extern struct rpc_version nfsacl_version3;
798 extern struct rpc_program nfsacl_program;
800 #endif