1 #ifndef _LINUX_NFS_XDR_H
2 #define _LINUX_NFS_XDR_H
4 #include <linux/sunrpc/xprt.h>
5 #include <linux/nfsacl.h>
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 */
34 __u64 nfs3; /* also nfs2 */
35 struct nfs4_fsid nfs4;
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
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 */
66 __u32 lease_time; /* in seconds */
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 */
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 */
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 {
101 * Arguments to the open call.
103 struct nfs_openargs {
104 const struct nfs_fh * fh;
105 struct nfs_seqid * seqid;
110 struct iattr * attrs; /* UNCHECKED, GUARDED */
111 nfs4_verifier verifier; /* EXCLUSIVE */
112 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
113 int delegation_type; /* CLAIM_PREVIOUS */
115 const struct qstr * name;
116 const struct nfs_server *server; /* Needed for ID mapping */
122 nfs4_stateid stateid;
124 struct nfs4_change_info cinfo;
126 struct nfs_fattr * f_attr;
127 struct nfs_fattr * dir_attr;
128 const struct nfs_server *server;
130 nfs4_stateid delegation;
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 {
153 nfs4_stateid * stateid;
154 struct nfs_seqid * seqid;
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.
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;
179 __u32 new_lock_owner;
182 struct nfs_locku_opargs {
183 struct nfs_seqid * seqid;
184 nfs4_stateid * stateid;
187 struct nfs_lockargs {
193 struct nfs_lock_opargs *lock; /* LOCK */
194 struct nfs_lowner *lockt; /* LOCKT */
195 struct nfs_locku_opargs *locku; /* LOCKU */
199 struct nfs_lock_denied {
203 struct nfs_lowner owner;
208 nfs4_stateid stateid;/* LOCK success, LOCKU */
209 struct nfs_lock_denied denied; /* LOCK failed, LOCKT success */
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"
228 struct nfs_readargs {
230 struct nfs_open_context *context;
234 struct page ** pages;
238 struct nfs_fattr * fattr;
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"
251 struct nfs_writeargs {
253 struct nfs_open_context *context;
256 enum nfs3_stable_how stable;
258 struct page ** pages;
261 struct nfs_writeverf {
262 enum nfs3_stable_how committed;
266 struct nfs_writeres {
267 struct nfs_fattr * fattr;
268 struct nfs_writeverf * verf;
273 * Argument struct for decode_entry function
283 struct nfs_fattr * fattr;
287 * The following types are for NFSv2 only.
289 struct nfs_sattrargs {
291 struct iattr * sattr;
294 struct nfs_diropargs {
300 struct nfs_createargs {
304 struct iattr * sattr;
307 struct nfs_renameargs {
308 struct nfs_fh * fromfh;
309 const char * fromname;
310 unsigned int fromlen;
311 struct nfs_fh * tofh;
316 struct nfs_setattrargs {
318 nfs4_stateid stateid;
320 const struct nfs_server * server; /* Needed for name mapping */
324 struct nfs_setaclargs {
327 unsigned int acl_pgbase;
328 struct page ** acl_pages;
331 struct nfs_getaclargs {
334 unsigned int acl_pgbase;
335 struct page ** acl_pages;
338 struct nfs_setattrres {
339 struct nfs_fattr * fattr;
340 const struct nfs_server * server;
343 struct nfs_linkargs {
344 struct nfs_fh * fromfh;
345 struct nfs_fh * tofh;
350 struct nfs_symlinkargs {
351 struct nfs_fh * fromfh;
352 const char * fromname;
353 unsigned int fromlen;
356 struct iattr * sattr;
359 struct nfs_readdirargs {
363 struct page ** pages;
366 struct nfs3_getaclargs {
369 struct page ** pages;
372 struct nfs3_setaclargs {
373 struct inode * inode;
375 struct posix_acl * acl_access;
376 struct posix_acl * acl_default;
377 struct page ** pages;
382 struct nfs_fattr * fattr;
385 struct nfs_readlinkargs {
389 struct page ** pages;
392 struct nfs3_sattrargs {
394 struct iattr * sattr;
396 struct timespec guardtime;
399 struct nfs3_diropargs {
405 struct nfs3_accessargs {
410 struct nfs3_createargs {
414 struct iattr * sattr;
415 enum nfs3_createmode createmode;
419 struct nfs3_mkdirargs {
423 struct iattr * sattr;
426 struct nfs3_symlinkargs {
427 struct nfs_fh * fromfh;
428 const char * fromname;
429 unsigned int fromlen;
432 struct iattr * sattr;
435 struct nfs3_mknodargs {
439 enum nfs3_ftype type;
440 struct iattr * sattr;
444 struct nfs3_renameargs {
445 struct nfs_fh * fromfh;
446 const char * fromname;
447 unsigned int fromlen;
448 struct nfs_fh * tofh;
453 struct nfs3_linkargs {
454 struct nfs_fh * fromfh;
455 struct nfs_fh * tofh;
460 struct nfs3_readdirargs {
466 struct page ** pages;
469 struct nfs3_diropres {
470 struct nfs_fattr * dir_attr;
472 struct nfs_fattr * fattr;
475 struct nfs3_accessres {
476 struct nfs_fattr * fattr;
480 struct nfs3_readlinkargs {
484 struct page ** pages;
487 struct nfs3_renameres {
488 struct nfs_fattr * fromattr;
489 struct nfs_fattr * toattr;
492 struct nfs3_linkres {
493 struct nfs_fattr * dir_attr;
494 struct nfs_fattr * fattr;
497 struct nfs3_readdirres {
498 struct nfs_fattr * dir_attr;
503 struct nfs3_getaclres {
504 struct nfs_fattr * fattr;
506 unsigned int acl_access_count;
507 unsigned int acl_default_count;
508 struct posix_acl * acl_access;
509 struct posix_acl * acl_default;
514 typedef u64 clientid4;
516 struct nfs4_accessargs {
517 const struct nfs_fh * fh;
521 struct nfs4_accessres {
526 struct nfs4_create_arg {
529 struct qstr * symlink; /* NF4LNK */
533 } device; /* NF4BLK, NF4CHR */
535 const struct qstr * name;
536 const struct nfs_server * server;
537 const struct iattr * attrs;
538 const struct nfs_fh * dir_fh;
542 struct nfs4_create_res {
543 const struct nfs_server * server;
545 struct nfs_fattr * fattr;
546 struct nfs4_change_info dir_cinfo;
547 struct nfs_fattr * dir_fattr;
550 struct nfs4_fsinfo_arg {
551 const struct nfs_fh * fh;
555 struct nfs4_getattr_arg {
556 const struct nfs_fh * fh;
560 struct nfs4_getattr_res {
561 const struct nfs_server * server;
562 struct nfs_fattr * fattr;
565 struct nfs4_link_arg {
566 const struct nfs_fh * fh;
567 const struct nfs_fh * dir_fh;
568 const struct qstr * name;
572 struct nfs4_link_res {
573 const struct nfs_server * server;
574 struct nfs_fattr * fattr;
575 struct nfs4_change_info cinfo;
576 struct nfs_fattr * dir_attr;
580 struct nfs4_lookup_arg {
581 const struct nfs_fh * dir_fh;
582 const struct qstr * name;
586 struct nfs4_lookup_res {
587 const struct nfs_server * server;
588 struct nfs_fattr * fattr;
592 struct nfs4_lookup_root_arg {
596 struct nfs4_pathconf_arg {
597 const struct nfs_fh * fh;
601 struct nfs4_readdir_arg {
602 const struct nfs_fh * fh;
604 nfs4_verifier verifier;
606 struct page ** pages; /* zero-copy data */
607 unsigned int pgbase; /* zero-copy data */
611 struct nfs4_readdir_res {
612 nfs4_verifier verifier;
616 struct nfs4_readlink {
617 const struct nfs_fh * fh;
619 unsigned int pglen; /* zero-copy data */
620 struct page ** pages; /* zero-copy data */
623 struct nfs4_remove_arg {
624 const struct nfs_fh * fh;
625 const struct qstr * name;
628 struct nfs4_rename_arg {
629 const struct nfs_fh * old_dir;
630 const struct nfs_fh * new_dir;
631 const struct qstr * old_name;
632 const struct qstr * new_name;
636 struct nfs4_rename_res {
637 const struct nfs_server * server;
638 struct nfs4_change_info old_cinfo;
639 struct nfs_fattr * old_fattr;
640 struct nfs4_change_info new_cinfo;
641 struct nfs_fattr * new_fattr;
644 struct nfs4_setclientid {
645 const nfs4_verifier * sc_verifier; /* request */
646 unsigned int sc_name_len;
647 char sc_name[32]; /* request */
648 u32 sc_prog; /* request */
649 unsigned int sc_netid_len;
650 char sc_netid[4]; /* request */
651 unsigned int sc_uaddr_len;
652 char sc_uaddr[24]; /* request */
653 u32 sc_cb_ident; /* request */
656 struct nfs4_statfs_arg {
657 const struct nfs_fh * fh;
661 struct nfs4_server_caps_res {
668 #endif /* CONFIG_NFS_V4 */
672 struct nfs_read_data {
674 struct rpc_task task;
676 struct rpc_cred *cred;
677 struct nfs_fattr fattr; /* fattr storage */
678 struct list_head pages; /* Coalesced read requests */
679 struct nfs_page *req; /* multi ops per nfs_page */
680 struct page *pagevec[NFS_READ_MAXIOV];
681 struct nfs_readargs args;
682 struct nfs_readres res;
684 unsigned long timestamp; /* For lease renewal */
686 void (*complete) (struct nfs_read_data *, int);
689 struct nfs_write_data {
691 struct rpc_task task;
693 struct rpc_cred *cred;
694 struct nfs_fattr fattr;
695 struct nfs_writeverf verf;
696 struct list_head pages; /* Coalesced requests we wish to flush */
697 struct nfs_page *req; /* multi ops per nfs_page */
698 struct page *pagevec[NFS_WRITE_MAXIOV];
699 struct nfs_writeargs args; /* argument struct */
700 struct nfs_writeres res; /* result struct */
702 unsigned long timestamp; /* For lease renewal */
704 void (*complete) (struct nfs_write_data *, int);
707 struct nfs_access_entry;
710 * RPC procedure vector for NFSv2/NFSv3 demuxing
713 int version; /* Protocol version */
714 struct dentry_operations *dentry_ops;
715 struct inode_operations *dir_inode_ops;
716 struct inode_operations *file_inode_ops;
718 int (*getroot) (struct nfs_server *, struct nfs_fh *,
719 struct nfs_fsinfo *);
720 int (*getattr) (struct nfs_server *, struct nfs_fh *,
722 int (*setattr) (struct dentry *, struct nfs_fattr *,
724 int (*lookup) (struct inode *, struct qstr *,
725 struct nfs_fh *, struct nfs_fattr *);
726 int (*access) (struct inode *, struct nfs_access_entry *);
727 int (*readlink)(struct inode *, struct page *, unsigned int,
729 int (*read) (struct nfs_read_data *);
730 int (*write) (struct nfs_write_data *);
731 int (*commit) (struct nfs_write_data *);
732 int (*create) (struct inode *, struct dentry *,
733 struct iattr *, int, struct nameidata *);
734 int (*remove) (struct inode *, struct qstr *);
735 int (*unlink_setup) (struct rpc_message *,
736 struct dentry *, struct qstr *);
737 int (*unlink_done) (struct dentry *, struct rpc_task *);
738 int (*rename) (struct inode *, struct qstr *,
739 struct inode *, struct qstr *);
740 int (*link) (struct inode *, struct inode *, struct qstr *);
741 int (*symlink) (struct inode *, struct qstr *, struct qstr *,
742 struct iattr *, struct nfs_fh *,
744 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
745 int (*rmdir) (struct inode *, struct qstr *);
746 int (*readdir) (struct dentry *, struct rpc_cred *,
747 u64, struct page *, unsigned int, int);
748 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
750 int (*statfs) (struct nfs_server *, struct nfs_fh *,
751 struct nfs_fsstat *);
752 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
753 struct nfs_fsinfo *);
754 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
755 struct nfs_pathconf *);
756 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
757 void (*read_setup) (struct nfs_read_data *);
758 void (*write_setup) (struct nfs_write_data *, int how);
759 void (*commit_setup) (struct nfs_write_data *, int how);
760 int (*file_open) (struct inode *, struct file *);
761 int (*file_release) (struct inode *, struct file *);
762 int (*lock)(struct file *, int, struct file_lock *);
763 void (*clear_acl_cache)(struct inode *);
767 * NFS_CALL(getattr, inode, (fattr));
769 * NFS_PROTO(inode)->getattr(fattr);
771 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
774 * Function vectors etc. for the NFS client
776 extern struct nfs_rpc_ops nfs_v2_clientops;
777 extern struct nfs_rpc_ops nfs_v3_clientops;
778 extern struct nfs_rpc_ops nfs_v4_clientops;
779 extern struct rpc_version nfs_version2;
780 extern struct rpc_version nfs_version3;
781 extern struct rpc_version nfs_version4;
783 extern struct rpc_version nfsacl_version3;
784 extern struct rpc_program nfsacl_program;