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 timestamp;
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 const struct nfs_server *server;
129 nfs4_stateid delegation;
135 * Arguments to the open_confirm call.
137 struct nfs_open_confirmargs {
138 const struct nfs_fh * fh;
139 nfs4_stateid stateid;
140 struct nfs_seqid * seqid;
143 struct nfs_open_confirmres {
144 nfs4_stateid stateid;
148 * Arguments to the close call.
150 struct nfs_closeargs {
152 nfs4_stateid * stateid;
153 struct nfs_seqid * seqid;
157 struct nfs_closeres {
158 nfs4_stateid stateid;
161 * * Arguments to the lock,lockt, and locku call.
168 struct nfs_lock_opargs {
169 struct nfs_seqid * lock_seqid;
170 nfs4_stateid * lock_stateid;
171 struct nfs_seqid * open_seqid;
172 nfs4_stateid * open_stateid;
173 struct nfs_lowner lock_owner;
175 __u32 new_lock_owner;
178 struct nfs_locku_opargs {
179 struct nfs_seqid * seqid;
180 nfs4_stateid * stateid;
183 struct nfs_lockargs {
189 struct nfs_lock_opargs *lock; /* LOCK */
190 struct nfs_lowner *lockt; /* LOCKT */
191 struct nfs_locku_opargs *locku; /* LOCKU */
195 struct nfs_lock_denied {
199 struct nfs_lowner owner;
204 nfs4_stateid stateid;/* LOCK success, LOCKU */
205 struct nfs_lock_denied denied; /* LOCK failed, LOCKT success */
207 const struct nfs_server * server;
210 struct nfs4_delegreturnargs {
211 const struct nfs_fh *fhandle;
212 const nfs4_stateid *stateid;
216 * Arguments to the read call.
219 #define NFS_READ_MAXIOV (9U)
220 #if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
221 #error "NFS_READ_MAXIOV is too large"
224 struct nfs_readargs {
226 struct nfs_open_context *context;
230 struct page ** pages;
234 struct nfs_fattr * fattr;
240 * Arguments to the write call.
242 #define NFS_WRITE_MAXIOV (9U)
243 #if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
244 #error "NFS_WRITE_MAXIOV is too large"
247 struct nfs_writeargs {
249 struct nfs_open_context *context;
252 enum nfs3_stable_how stable;
254 struct page ** pages;
257 struct nfs_writeverf {
258 enum nfs3_stable_how committed;
262 struct nfs_writeres {
263 struct nfs_fattr * fattr;
264 struct nfs_writeverf * verf;
269 * Argument struct for decode_entry function
279 struct nfs_fattr * fattr;
283 * The following types are for NFSv2 only.
285 struct nfs_sattrargs {
287 struct iattr * sattr;
290 struct nfs_diropargs {
296 struct nfs_createargs {
300 struct iattr * sattr;
303 struct nfs_renameargs {
304 struct nfs_fh * fromfh;
305 const char * fromname;
306 unsigned int fromlen;
307 struct nfs_fh * tofh;
312 struct nfs_setattrargs {
314 nfs4_stateid stateid;
316 const struct nfs_server * server; /* Needed for name mapping */
320 struct nfs_setaclargs {
323 unsigned int acl_pgbase;
324 struct page ** acl_pages;
327 struct nfs_getaclargs {
330 unsigned int acl_pgbase;
331 struct page ** acl_pages;
334 struct nfs_setattrres {
335 struct nfs_fattr * fattr;
336 const struct nfs_server * server;
339 struct nfs_linkargs {
340 struct nfs_fh * fromfh;
341 struct nfs_fh * tofh;
346 struct nfs_symlinkargs {
347 struct nfs_fh * fromfh;
348 const char * fromname;
349 unsigned int fromlen;
352 struct iattr * sattr;
355 struct nfs_readdirargs {
359 struct page ** pages;
362 struct nfs3_getaclargs {
365 struct page ** pages;
368 struct nfs3_setaclargs {
369 struct inode * inode;
371 struct posix_acl * acl_access;
372 struct posix_acl * acl_default;
373 struct page ** pages;
378 struct nfs_fattr * fattr;
381 struct nfs_readlinkargs {
385 struct page ** pages;
388 struct nfs3_sattrargs {
390 struct iattr * sattr;
392 struct timespec guardtime;
395 struct nfs3_diropargs {
401 struct nfs3_accessargs {
406 struct nfs3_createargs {
410 struct iattr * sattr;
411 enum nfs3_createmode createmode;
415 struct nfs3_mkdirargs {
419 struct iattr * sattr;
422 struct nfs3_symlinkargs {
423 struct nfs_fh * fromfh;
424 const char * fromname;
425 unsigned int fromlen;
428 struct iattr * sattr;
431 struct nfs3_mknodargs {
435 enum nfs3_ftype type;
436 struct iattr * sattr;
440 struct nfs3_renameargs {
441 struct nfs_fh * fromfh;
442 const char * fromname;
443 unsigned int fromlen;
444 struct nfs_fh * tofh;
449 struct nfs3_linkargs {
450 struct nfs_fh * fromfh;
451 struct nfs_fh * tofh;
456 struct nfs3_readdirargs {
462 struct page ** pages;
465 struct nfs3_diropres {
466 struct nfs_fattr * dir_attr;
468 struct nfs_fattr * fattr;
471 struct nfs3_accessres {
472 struct nfs_fattr * fattr;
476 struct nfs3_readlinkargs {
480 struct page ** pages;
483 struct nfs3_renameres {
484 struct nfs_fattr * fromattr;
485 struct nfs_fattr * toattr;
488 struct nfs3_linkres {
489 struct nfs_fattr * dir_attr;
490 struct nfs_fattr * fattr;
493 struct nfs3_readdirres {
494 struct nfs_fattr * dir_attr;
499 struct nfs3_getaclres {
500 struct nfs_fattr * fattr;
502 unsigned int acl_access_count;
503 unsigned int acl_default_count;
504 struct posix_acl * acl_access;
505 struct posix_acl * acl_default;
510 typedef u64 clientid4;
512 struct nfs4_accessargs {
513 const struct nfs_fh * fh;
517 struct nfs4_accessres {
522 struct nfs4_create_arg {
525 struct qstr * symlink; /* NF4LNK */
529 } device; /* NF4BLK, NF4CHR */
531 const struct qstr * name;
532 const struct nfs_server * server;
533 const struct iattr * attrs;
534 const struct nfs_fh * dir_fh;
538 struct nfs4_create_res {
539 const struct nfs_server * server;
541 struct nfs_fattr * fattr;
542 struct nfs4_change_info dir_cinfo;
545 struct nfs4_fsinfo_arg {
546 const struct nfs_fh * fh;
550 struct nfs4_getattr_arg {
551 const struct nfs_fh * fh;
555 struct nfs4_getattr_res {
556 const struct nfs_server * server;
557 struct nfs_fattr * fattr;
560 struct nfs4_link_arg {
561 const struct nfs_fh * fh;
562 const struct nfs_fh * dir_fh;
563 const struct qstr * name;
566 struct nfs4_lookup_arg {
567 const struct nfs_fh * dir_fh;
568 const struct qstr * name;
572 struct nfs4_lookup_res {
573 const struct nfs_server * server;
574 struct nfs_fattr * fattr;
578 struct nfs4_lookup_root_arg {
582 struct nfs4_pathconf_arg {
583 const struct nfs_fh * fh;
587 struct nfs4_readdir_arg {
588 const struct nfs_fh * fh;
590 nfs4_verifier verifier;
592 struct page ** pages; /* zero-copy data */
593 unsigned int pgbase; /* zero-copy data */
597 struct nfs4_readdir_res {
598 nfs4_verifier verifier;
602 struct nfs4_readlink {
603 const struct nfs_fh * fh;
605 unsigned int pglen; /* zero-copy data */
606 struct page ** pages; /* zero-copy data */
609 struct nfs4_remove_arg {
610 const struct nfs_fh * fh;
611 const struct qstr * name;
614 struct nfs4_rename_arg {
615 const struct nfs_fh * old_dir;
616 const struct nfs_fh * new_dir;
617 const struct qstr * old_name;
618 const struct qstr * new_name;
621 struct nfs4_rename_res {
622 struct nfs4_change_info old_cinfo;
623 struct nfs4_change_info new_cinfo;
626 struct nfs4_setclientid {
627 const nfs4_verifier * sc_verifier; /* request */
628 unsigned int sc_name_len;
629 char sc_name[32]; /* request */
630 u32 sc_prog; /* request */
631 unsigned int sc_netid_len;
632 char sc_netid[4]; /* request */
633 unsigned int sc_uaddr_len;
634 char sc_uaddr[24]; /* request */
635 u32 sc_cb_ident; /* request */
638 struct nfs4_statfs_arg {
639 const struct nfs_fh * fh;
643 struct nfs4_server_caps_res {
650 #endif /* CONFIG_NFS_V4 */
654 struct nfs_read_data {
656 struct rpc_task task;
658 struct rpc_cred *cred;
659 struct nfs_fattr fattr; /* fattr storage */
660 struct list_head pages; /* Coalesced read requests */
661 struct nfs_page *req; /* multi ops per nfs_page */
662 struct page *pagevec[NFS_READ_MAXIOV];
663 struct nfs_readargs args;
664 struct nfs_readres res;
666 unsigned long timestamp; /* For lease renewal */
668 void (*complete) (struct nfs_read_data *, int);
671 struct nfs_write_data {
673 struct rpc_task task;
675 struct rpc_cred *cred;
676 struct nfs_fattr fattr;
677 struct nfs_writeverf verf;
678 struct list_head pages; /* Coalesced requests we wish to flush */
679 struct nfs_page *req; /* multi ops per nfs_page */
680 struct page *pagevec[NFS_WRITE_MAXIOV];
681 struct nfs_writeargs args; /* argument struct */
682 struct nfs_writeres res; /* result struct */
684 unsigned long timestamp; /* For lease renewal */
686 void (*complete) (struct nfs_write_data *, int);
689 struct nfs_access_entry;
692 * RPC procedure vector for NFSv2/NFSv3 demuxing
695 int version; /* Protocol version */
696 struct dentry_operations *dentry_ops;
697 struct inode_operations *dir_inode_ops;
698 struct inode_operations *file_inode_ops;
700 int (*getroot) (struct nfs_server *, struct nfs_fh *,
701 struct nfs_fsinfo *);
702 int (*getattr) (struct nfs_server *, struct nfs_fh *,
704 int (*setattr) (struct dentry *, struct nfs_fattr *,
706 int (*lookup) (struct inode *, struct qstr *,
707 struct nfs_fh *, struct nfs_fattr *);
708 int (*access) (struct inode *, struct nfs_access_entry *);
709 int (*readlink)(struct inode *, struct page *, unsigned int,
711 int (*read) (struct nfs_read_data *);
712 int (*write) (struct nfs_write_data *);
713 int (*commit) (struct nfs_write_data *);
714 int (*create) (struct inode *, struct dentry *,
715 struct iattr *, int, struct nameidata *);
716 int (*remove) (struct inode *, struct qstr *);
717 int (*unlink_setup) (struct rpc_message *,
718 struct dentry *, struct qstr *);
719 int (*unlink_done) (struct dentry *, struct rpc_task *);
720 int (*rename) (struct inode *, struct qstr *,
721 struct inode *, struct qstr *);
722 int (*link) (struct inode *, struct inode *, struct qstr *);
723 int (*symlink) (struct inode *, struct qstr *, struct qstr *,
724 struct iattr *, struct nfs_fh *,
726 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
727 int (*rmdir) (struct inode *, struct qstr *);
728 int (*readdir) (struct dentry *, struct rpc_cred *,
729 u64, struct page *, unsigned int, int);
730 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
732 int (*statfs) (struct nfs_server *, struct nfs_fh *,
733 struct nfs_fsstat *);
734 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
735 struct nfs_fsinfo *);
736 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
737 struct nfs_pathconf *);
738 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
739 void (*read_setup) (struct nfs_read_data *);
740 void (*write_setup) (struct nfs_write_data *, int how);
741 void (*commit_setup) (struct nfs_write_data *, int how);
742 int (*file_open) (struct inode *, struct file *);
743 int (*file_release) (struct inode *, struct file *);
744 int (*lock)(struct file *, int, struct file_lock *);
745 void (*clear_acl_cache)(struct inode *);
749 * NFS_CALL(getattr, inode, (fattr));
751 * NFS_PROTO(inode)->getattr(fattr);
753 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
756 * Function vectors etc. for the NFS client
758 extern struct nfs_rpc_ops nfs_v2_clientops;
759 extern struct nfs_rpc_ops nfs_v3_clientops;
760 extern struct nfs_rpc_ops nfs_v4_clientops;
761 extern struct rpc_version nfs_version2;
762 extern struct rpc_version nfs_version3;
763 extern struct rpc_version nfs_version4;
765 extern struct rpc_version nfsacl_version3;
766 extern struct rpc_program nfsacl_program;