[ALSA] Merge ad1816a-lib module to ad1816a
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / linux / nfs_xdr.h
blob40718669b9c896e45939e6490f38d843d67623ea
1 #ifndef _LINUX_NFS_XDR_H
2 #define _LINUX_NFS_XDR_H
4 #include <linux/sunrpc/xprt.h>
5 #include <linux/nfsacl.h>
7 struct nfs4_fsid {
8 __u64 major;
9 __u64 minor;
12 struct nfs_fattr {
13 unsigned short valid; /* which fields are valid */
14 __u64 pre_size; /* pre_op_attr.size */
15 struct timespec pre_mtime; /* pre_op_attr.mtime */
16 struct timespec pre_ctime; /* pre_op_attr.ctime */
17 enum nfs_ftype type; /* always use NFSv2 types */
18 __u32 mode;
19 __u32 nlink;
20 __u32 uid;
21 __u32 gid;
22 __u64 size;
23 union {
24 struct {
25 __u32 blocksize;
26 __u32 blocks;
27 } nfs2;
28 struct {
29 __u64 used;
30 } nfs3;
31 } du;
32 dev_t rdev;
33 union {
34 __u64 nfs3; /* also nfs2 */
35 struct nfs4_fsid nfs4;
36 } fsid_u;
37 __u64 fileid;
38 struct timespec atime;
39 struct timespec mtime;
40 struct timespec ctime;
41 __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */
42 __u64 change_attr; /* NFSv4 change attribute */
43 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
44 unsigned long time_start;
47 #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
48 #define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
49 #define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
50 #define NFS_ATTR_FATTR_V4 0x0008
51 #define NFS_ATTR_PRE_CHANGE 0x0010
54 * Info on the file system
56 struct nfs_fsinfo {
57 struct nfs_fattr *fattr; /* Post-op attributes */
58 __u32 rtmax; /* max. read transfer size */
59 __u32 rtpref; /* pref. read transfer size */
60 __u32 rtmult; /* reads should be multiple of this */
61 __u32 wtmax; /* max. write transfer size */
62 __u32 wtpref; /* pref. write transfer size */
63 __u32 wtmult; /* writes should be multiple of this */
64 __u32 dtpref; /* pref. readdir transfer size */
65 __u64 maxfilesize;
66 __u32 lease_time; /* in seconds */
69 struct nfs_fsstat {
70 struct nfs_fattr *fattr; /* Post-op attributes */
71 __u64 tbytes; /* total size in bytes */
72 __u64 fbytes; /* # of free bytes */
73 __u64 abytes; /* # of bytes available to user */
74 __u64 tfiles; /* # of files */
75 __u64 ffiles; /* # of free files */
76 __u64 afiles; /* # of files available to user */
79 struct nfs2_fsstat {
80 __u32 tsize; /* Server transfer size */
81 __u32 bsize; /* Filesystem block size */
82 __u32 blocks; /* No. of "bsize" blocks on filesystem */
83 __u32 bfree; /* No. of free "bsize" blocks */
84 __u32 bavail; /* No. of available "bsize" blocks */
87 struct nfs_pathconf {
88 struct nfs_fattr *fattr; /* Post-op attributes */
89 __u32 max_link; /* max # of hard links */
90 __u32 max_namelen; /* max name length */
93 struct nfs4_change_info {
94 u32 atomic;
95 u64 before;
96 u64 after;
99 struct nfs_seqid;
101 * Arguments to the open call.
103 struct nfs_openargs {
104 const struct nfs_fh * fh;
105 struct nfs_seqid * 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;
121 struct 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 struct nfs_fattr * dir_attr;
128 const struct nfs_server *server;
129 int delegation_type;
130 nfs4_stateid delegation;
131 __u32 do_recall;
132 __u64 maxsize;
136 * Arguments to the open_confirm call.
138 struct nfs_open_confirmargs {
139 const struct nfs_fh * fh;
140 nfs4_stateid stateid;
141 struct nfs_seqid * seqid;
144 struct nfs_open_confirmres {
145 nfs4_stateid stateid;
149 * Arguments to the close call.
151 struct nfs_closeargs {
152 struct nfs_fh * fh;
153 nfs4_stateid * stateid;
154 struct nfs_seqid * seqid;
155 int open_flags;
156 const u32 * bitmask;
159 struct nfs_closeres {
160 nfs4_stateid stateid;
161 struct nfs_fattr * fattr;
162 const struct nfs_server *server;
165 * * Arguments to the lock,lockt, and locku call.
166 * */
167 struct nfs_lowner {
168 __u64 clientid;
169 u32 id;
172 struct nfs_lock_opargs {
173 struct nfs_seqid * lock_seqid;
174 nfs4_stateid * lock_stateid;
175 struct nfs_seqid * open_seqid;
176 nfs4_stateid * open_stateid;
177 struct nfs_lowner lock_owner;
178 __u32 reclaim;
179 __u32 new_lock_owner;
182 struct nfs_locku_opargs {
183 struct nfs_seqid * seqid;
184 nfs4_stateid * stateid;
187 struct nfs_lockargs {
188 struct nfs_fh * fh;
189 __u32 type;
190 __u64 offset;
191 __u64 length;
192 union {
193 struct nfs_lock_opargs *lock; /* LOCK */
194 struct nfs_lowner *lockt; /* LOCKT */
195 struct nfs_locku_opargs *locku; /* LOCKU */
196 } u;
199 struct nfs_lock_denied {
200 __u64 offset;
201 __u64 length;
202 __u32 type;
203 struct nfs_lowner owner;
206 struct nfs_lockres {
207 union {
208 nfs4_stateid stateid;/* LOCK success, LOCKU */
209 struct nfs_lock_denied denied; /* LOCK failed, LOCKT success */
210 } u;
211 const struct nfs_server * server;
214 struct nfs4_delegreturnargs {
215 const struct nfs_fh *fhandle;
216 const nfs4_stateid *stateid;
220 * Arguments to the read call.
223 #define NFS_READ_MAXIOV (9U)
224 #if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
225 #error "NFS_READ_MAXIOV is too large"
226 #endif
228 struct nfs_readargs {
229 struct nfs_fh * fh;
230 struct nfs_open_context *context;
231 __u64 offset;
232 __u32 count;
233 unsigned int pgbase;
234 struct page ** pages;
237 struct nfs_readres {
238 struct nfs_fattr * fattr;
239 __u32 count;
240 int eof;
244 * Arguments to the write call.
246 #define NFS_WRITE_MAXIOV (9U)
247 #if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
248 #error "NFS_WRITE_MAXIOV is too large"
249 #endif
251 struct nfs_writeargs {
252 struct nfs_fh * fh;
253 struct nfs_open_context *context;
254 __u64 offset;
255 __u32 count;
256 enum nfs3_stable_how stable;
257 unsigned int pgbase;
258 struct page ** pages;
259 const u32 * bitmask;
262 struct nfs_writeverf {
263 enum nfs3_stable_how committed;
264 __u32 verifier[2];
267 struct nfs_writeres {
268 struct nfs_fattr * fattr;
269 struct nfs_writeverf * verf;
270 __u32 count;
271 const struct nfs_server *server;
275 * Argument struct for decode_entry function
277 struct nfs_entry {
278 __u64 ino;
279 __u64 cookie,
280 prev_cookie;
281 const char * name;
282 unsigned int len;
283 int eof;
284 struct nfs_fh * fh;
285 struct nfs_fattr * fattr;
289 * The following types are for NFSv2 only.
291 struct nfs_sattrargs {
292 struct nfs_fh * fh;
293 struct iattr * sattr;
296 struct nfs_diropargs {
297 struct nfs_fh * fh;
298 const char * name;
299 unsigned int len;
302 struct nfs_createargs {
303 struct nfs_fh * fh;
304 const char * name;
305 unsigned int len;
306 struct iattr * sattr;
309 struct nfs_renameargs {
310 struct nfs_fh * fromfh;
311 const char * fromname;
312 unsigned int fromlen;
313 struct nfs_fh * tofh;
314 const char * toname;
315 unsigned int tolen;
318 struct nfs_setattrargs {
319 struct nfs_fh * fh;
320 nfs4_stateid stateid;
321 struct iattr * iap;
322 const struct nfs_server * server; /* Needed for name mapping */
323 const u32 * bitmask;
326 struct nfs_setaclargs {
327 struct nfs_fh * fh;
328 size_t acl_len;
329 unsigned int acl_pgbase;
330 struct page ** acl_pages;
333 struct nfs_getaclargs {
334 struct nfs_fh * fh;
335 size_t acl_len;
336 unsigned int acl_pgbase;
337 struct page ** acl_pages;
340 struct nfs_setattrres {
341 struct nfs_fattr * fattr;
342 const struct nfs_server * server;
345 struct nfs_linkargs {
346 struct nfs_fh * fromfh;
347 struct nfs_fh * tofh;
348 const char * toname;
349 unsigned int tolen;
352 struct nfs_symlinkargs {
353 struct nfs_fh * fromfh;
354 const char * fromname;
355 unsigned int fromlen;
356 const char * topath;
357 unsigned int tolen;
358 struct iattr * sattr;
361 struct nfs_readdirargs {
362 struct nfs_fh * fh;
363 __u32 cookie;
364 unsigned int count;
365 struct page ** pages;
368 struct nfs3_getaclargs {
369 struct nfs_fh * fh;
370 int mask;
371 struct page ** pages;
374 struct nfs3_setaclargs {
375 struct inode * inode;
376 int mask;
377 struct posix_acl * acl_access;
378 struct posix_acl * acl_default;
379 struct page ** pages;
382 struct nfs_diropok {
383 struct nfs_fh * fh;
384 struct nfs_fattr * fattr;
387 struct nfs_readlinkargs {
388 struct nfs_fh * fh;
389 unsigned int pgbase;
390 unsigned int pglen;
391 struct page ** pages;
394 struct nfs3_sattrargs {
395 struct nfs_fh * fh;
396 struct iattr * sattr;
397 unsigned int guard;
398 struct timespec guardtime;
401 struct nfs3_diropargs {
402 struct nfs_fh * fh;
403 const char * name;
404 unsigned int len;
407 struct nfs3_accessargs {
408 struct nfs_fh * fh;
409 __u32 access;
412 struct nfs3_createargs {
413 struct nfs_fh * fh;
414 const char * name;
415 unsigned int len;
416 struct iattr * sattr;
417 enum nfs3_createmode createmode;
418 __u32 verifier[2];
421 struct nfs3_mkdirargs {
422 struct nfs_fh * fh;
423 const char * name;
424 unsigned int len;
425 struct iattr * sattr;
428 struct nfs3_symlinkargs {
429 struct nfs_fh * fromfh;
430 const char * fromname;
431 unsigned int fromlen;
432 const char * topath;
433 unsigned int tolen;
434 struct iattr * sattr;
437 struct nfs3_mknodargs {
438 struct nfs_fh * fh;
439 const char * name;
440 unsigned int len;
441 enum nfs3_ftype type;
442 struct iattr * sattr;
443 dev_t rdev;
446 struct nfs3_renameargs {
447 struct nfs_fh * fromfh;
448 const char * fromname;
449 unsigned int fromlen;
450 struct nfs_fh * tofh;
451 const char * toname;
452 unsigned int tolen;
455 struct nfs3_linkargs {
456 struct nfs_fh * fromfh;
457 struct nfs_fh * tofh;
458 const char * toname;
459 unsigned int tolen;
462 struct nfs3_readdirargs {
463 struct nfs_fh * fh;
464 __u64 cookie;
465 __u32 verf[2];
466 int plus;
467 unsigned int count;
468 struct page ** pages;
471 struct nfs3_diropres {
472 struct nfs_fattr * dir_attr;
473 struct nfs_fh * fh;
474 struct nfs_fattr * fattr;
477 struct nfs3_accessres {
478 struct nfs_fattr * fattr;
479 __u32 access;
482 struct nfs3_readlinkargs {
483 struct nfs_fh * fh;
484 unsigned int pgbase;
485 unsigned int pglen;
486 struct page ** pages;
489 struct nfs3_renameres {
490 struct nfs_fattr * fromattr;
491 struct nfs_fattr * toattr;
494 struct nfs3_linkres {
495 struct nfs_fattr * dir_attr;
496 struct nfs_fattr * fattr;
499 struct nfs3_readdirres {
500 struct nfs_fattr * dir_attr;
501 __u32 * verf;
502 int plus;
505 struct nfs3_getaclres {
506 struct nfs_fattr * fattr;
507 int mask;
508 unsigned int acl_access_count;
509 unsigned int acl_default_count;
510 struct posix_acl * acl_access;
511 struct posix_acl * acl_default;
514 #ifdef CONFIG_NFS_V4
516 typedef u64 clientid4;
518 struct nfs4_accessargs {
519 const struct nfs_fh * fh;
520 u32 access;
523 struct nfs4_accessres {
524 u32 supported;
525 u32 access;
528 struct nfs4_create_arg {
529 u32 ftype;
530 union {
531 struct qstr * symlink; /* NF4LNK */
532 struct {
533 u32 specdata1;
534 u32 specdata2;
535 } device; /* NF4BLK, NF4CHR */
536 } u;
537 const struct qstr * name;
538 const struct nfs_server * server;
539 const struct iattr * attrs;
540 const struct nfs_fh * dir_fh;
541 const u32 * bitmask;
544 struct nfs4_create_res {
545 const struct nfs_server * server;
546 struct nfs_fh * fh;
547 struct nfs_fattr * fattr;
548 struct nfs4_change_info dir_cinfo;
549 struct nfs_fattr * dir_fattr;
552 struct nfs4_fsinfo_arg {
553 const struct nfs_fh * fh;
554 const u32 * bitmask;
557 struct nfs4_getattr_arg {
558 const struct nfs_fh * fh;
559 const u32 * bitmask;
562 struct nfs4_getattr_res {
563 const struct nfs_server * server;
564 struct nfs_fattr * fattr;
567 struct nfs4_link_arg {
568 const struct nfs_fh * fh;
569 const struct nfs_fh * dir_fh;
570 const struct qstr * name;
571 const u32 * bitmask;
574 struct nfs4_link_res {
575 const struct nfs_server * server;
576 struct nfs_fattr * fattr;
577 struct nfs4_change_info cinfo;
578 struct nfs_fattr * dir_attr;
582 struct nfs4_lookup_arg {
583 const struct nfs_fh * dir_fh;
584 const struct qstr * name;
585 const u32 * bitmask;
588 struct nfs4_lookup_res {
589 const struct nfs_server * server;
590 struct nfs_fattr * fattr;
591 struct nfs_fh * fh;
594 struct nfs4_lookup_root_arg {
595 const u32 * bitmask;
598 struct nfs4_pathconf_arg {
599 const struct nfs_fh * fh;
600 const u32 * bitmask;
603 struct nfs4_readdir_arg {
604 const struct nfs_fh * fh;
605 u64 cookie;
606 nfs4_verifier verifier;
607 u32 count;
608 struct page ** pages; /* zero-copy data */
609 unsigned int pgbase; /* zero-copy data */
610 const u32 * bitmask;
613 struct nfs4_readdir_res {
614 nfs4_verifier verifier;
615 unsigned int pgbase;
618 struct nfs4_readlink {
619 const struct nfs_fh * fh;
620 unsigned int pgbase;
621 unsigned int pglen; /* zero-copy data */
622 struct page ** pages; /* zero-copy data */
625 struct nfs4_remove_arg {
626 const struct nfs_fh * fh;
627 const struct qstr * name;
628 const u32 * bitmask;
631 struct nfs4_remove_res {
632 const struct nfs_server * server;
633 struct nfs4_change_info cinfo;
634 struct nfs_fattr * dir_attr;
637 struct nfs4_rename_arg {
638 const struct nfs_fh * old_dir;
639 const struct nfs_fh * new_dir;
640 const struct qstr * old_name;
641 const struct qstr * new_name;
642 const u32 * bitmask;
645 struct nfs4_rename_res {
646 const struct nfs_server * server;
647 struct nfs4_change_info old_cinfo;
648 struct nfs_fattr * old_fattr;
649 struct nfs4_change_info new_cinfo;
650 struct nfs_fattr * new_fattr;
653 struct nfs4_setclientid {
654 const nfs4_verifier * sc_verifier; /* request */
655 unsigned int sc_name_len;
656 char sc_name[32]; /* request */
657 u32 sc_prog; /* request */
658 unsigned int sc_netid_len;
659 char sc_netid[4]; /* request */
660 unsigned int sc_uaddr_len;
661 char sc_uaddr[24]; /* request */
662 u32 sc_cb_ident; /* request */
665 struct nfs4_statfs_arg {
666 const struct nfs_fh * fh;
667 const u32 * bitmask;
670 struct nfs4_server_caps_res {
671 u32 attr_bitmask[2];
672 u32 acl_bitmask;
673 u32 has_links;
674 u32 has_symlinks;
677 #endif /* CONFIG_NFS_V4 */
679 struct nfs_page;
681 struct nfs_read_data {
682 int flags;
683 struct rpc_task task;
684 struct inode *inode;
685 struct rpc_cred *cred;
686 struct nfs_fattr fattr; /* fattr storage */
687 struct list_head pages; /* Coalesced read requests */
688 struct nfs_page *req; /* multi ops per nfs_page */
689 struct page *pagevec[NFS_READ_MAXIOV];
690 struct nfs_readargs args;
691 struct nfs_readres res;
692 #ifdef CONFIG_NFS_V4
693 unsigned long timestamp; /* For lease renewal */
694 #endif
695 void (*complete) (struct nfs_read_data *, int);
698 struct nfs_write_data {
699 int flags;
700 struct rpc_task task;
701 struct inode *inode;
702 struct rpc_cred *cred;
703 struct nfs_fattr fattr;
704 struct nfs_writeverf verf;
705 struct list_head pages; /* Coalesced requests we wish to flush */
706 struct nfs_page *req; /* multi ops per nfs_page */
707 struct page *pagevec[NFS_WRITE_MAXIOV];
708 struct nfs_writeargs args; /* argument struct */
709 struct nfs_writeres res; /* result struct */
710 #ifdef CONFIG_NFS_V4
711 unsigned long timestamp; /* For lease renewal */
712 #endif
713 void (*complete) (struct nfs_write_data *, int);
716 struct nfs_access_entry;
719 * RPC procedure vector for NFSv2/NFSv3 demuxing
721 struct nfs_rpc_ops {
722 int version; /* Protocol version */
723 struct dentry_operations *dentry_ops;
724 struct inode_operations *dir_inode_ops;
725 struct inode_operations *file_inode_ops;
727 int (*getroot) (struct nfs_server *, struct nfs_fh *,
728 struct nfs_fsinfo *);
729 int (*getattr) (struct nfs_server *, struct nfs_fh *,
730 struct nfs_fattr *);
731 int (*setattr) (struct dentry *, struct nfs_fattr *,
732 struct iattr *);
733 int (*lookup) (struct inode *, struct qstr *,
734 struct nfs_fh *, struct nfs_fattr *);
735 int (*access) (struct inode *, struct nfs_access_entry *);
736 int (*readlink)(struct inode *, struct page *, unsigned int,
737 unsigned int);
738 int (*read) (struct nfs_read_data *);
739 int (*write) (struct nfs_write_data *);
740 int (*commit) (struct nfs_write_data *);
741 int (*create) (struct inode *, struct dentry *,
742 struct iattr *, int, struct nameidata *);
743 int (*remove) (struct inode *, struct qstr *);
744 int (*unlink_setup) (struct rpc_message *,
745 struct dentry *, struct qstr *);
746 int (*unlink_done) (struct dentry *, struct rpc_task *);
747 int (*rename) (struct inode *, struct qstr *,
748 struct inode *, struct qstr *);
749 int (*link) (struct inode *, struct inode *, struct qstr *);
750 int (*symlink) (struct inode *, struct qstr *, struct qstr *,
751 struct iattr *, struct nfs_fh *,
752 struct nfs_fattr *);
753 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
754 int (*rmdir) (struct inode *, struct qstr *);
755 int (*readdir) (struct dentry *, struct rpc_cred *,
756 u64, struct page *, unsigned int, int);
757 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
758 dev_t);
759 int (*statfs) (struct nfs_server *, struct nfs_fh *,
760 struct nfs_fsstat *);
761 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
762 struct nfs_fsinfo *);
763 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
764 struct nfs_pathconf *);
765 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
766 void (*read_setup) (struct nfs_read_data *);
767 void (*write_setup) (struct nfs_write_data *, int how);
768 void (*commit_setup) (struct nfs_write_data *, int how);
769 int (*file_open) (struct inode *, struct file *);
770 int (*file_release) (struct inode *, struct file *);
771 int (*lock)(struct file *, int, struct file_lock *);
772 void (*clear_acl_cache)(struct inode *);
776 * NFS_CALL(getattr, inode, (fattr));
777 * into
778 * NFS_PROTO(inode)->getattr(fattr);
780 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
783 * Function vectors etc. for the NFS client
785 extern struct nfs_rpc_ops nfs_v2_clientops;
786 extern struct nfs_rpc_ops nfs_v3_clientops;
787 extern struct nfs_rpc_ops nfs_v4_clientops;
788 extern struct rpc_version nfs_version2;
789 extern struct rpc_version nfs_version3;
790 extern struct rpc_version nfs_version4;
792 extern struct rpc_version nfsacl_version3;
793 extern struct rpc_program nfsacl_program;
795 #endif