1 #ifndef _LINUX_NFS_XDR_H
2 #define _LINUX_NFS_XDR_H
4 #include <linux/sunrpc/xprt.h>
12 unsigned short valid; /* which fields are valid */
13 __u64 pre_size; /* pre_op_attr.size */
14 struct timespec pre_mtime; /* pre_op_attr.mtime */
15 struct timespec pre_ctime; /* pre_op_attr.ctime */
16 enum nfs_ftype type; /* always use NFSv2 types */
33 __u64 nfs3; /* also nfs2 */
34 struct nfs4_fsid nfs4;
37 struct timespec atime;
38 struct timespec mtime;
39 struct timespec ctime;
40 __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */
41 __u64 change_attr; /* NFSv4 change attribute */
42 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
43 unsigned long timestamp;
46 #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
47 #define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
48 #define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
49 #define NFS_ATTR_FATTR_V4 0x0008
50 #define NFS_ATTR_PRE_CHANGE 0x0010
53 * Info on the file system
56 struct nfs_fattr *fattr; /* Post-op attributes */
57 __u32 rtmax; /* max. read transfer size */
58 __u32 rtpref; /* pref. read transfer size */
59 __u32 rtmult; /* reads should be multiple of this */
60 __u32 wtmax; /* max. write transfer size */
61 __u32 wtpref; /* pref. write transfer size */
62 __u32 wtmult; /* writes should be multiple of this */
63 __u32 dtpref; /* pref. readdir transfer size */
65 __u32 lease_time; /* in seconds */
69 struct nfs_fattr *fattr; /* Post-op attributes */
70 __u64 tbytes; /* total size in bytes */
71 __u64 fbytes; /* # of free bytes */
72 __u64 abytes; /* # of bytes available to user */
73 __u64 tfiles; /* # of files */
74 __u64 ffiles; /* # of free files */
75 __u64 afiles; /* # of files available to user */
79 __u32 tsize; /* Server transfer size */
80 __u32 bsize; /* Filesystem block size */
81 __u32 blocks; /* No. of "bsize" blocks on filesystem */
82 __u32 bfree; /* No. of free "bsize" blocks */
83 __u32 bavail; /* No. of available "bsize" blocks */
87 struct nfs_fattr *fattr; /* Post-op attributes */
88 __u32 max_link; /* max # of hard links */
89 __u32 max_namelen; /* max name length */
92 struct nfs4_change_info {
99 * Arguments to the open call.
101 struct nfs_openargs {
110 struct iattr * attrs; /* UNCHECKED, GUARDED */
111 nfs4_verifier verifier; /* EXCLUSIVE */
113 const struct qstr * name;
114 const struct nfs_server *server; /* Needed for ID mapping */
119 nfs4_stateid stateid;
121 struct nfs4_change_info cinfo;
123 struct nfs_fattr * f_attr;
124 const struct nfs_server *server;
128 * Arguments to the open_confirm call.
130 struct nfs_open_confirmargs {
132 nfs4_stateid stateid;
136 struct nfs_open_confirmres {
137 nfs4_stateid stateid;
141 * Arguments to the open_reclaim call.
143 struct nfs_open_reclaimargs {
150 const __u32 * bitmask;
154 * Arguments to the close call.
156 struct nfs_closeargs {
158 nfs4_stateid stateid;
163 struct nfs_closeres {
164 nfs4_stateid stateid;
167 * * Arguments to the lock,lockt, and locku call.
174 struct nfs_open_to_lock {
176 nfs4_stateid open_stateid;
178 struct nfs_lowner lock_owner;
181 struct nfs_exist_lock {
182 nfs4_stateid stateid;
186 struct nfs_lock_opargs {
188 __u32 new_lock_owner;
190 struct nfs_open_to_lock *open_lock;
191 struct nfs_exist_lock *exist_lock;
195 struct nfs_locku_opargs {
197 nfs4_stateid stateid;
200 struct nfs_lockargs {
206 struct nfs_lock_opargs *lock; /* LOCK */
207 struct nfs_lowner *lockt; /* LOCKT */
208 struct nfs_locku_opargs *locku; /* LOCKU */
212 struct nfs_lock_denied {
216 struct nfs_lowner owner;
221 nfs4_stateid stateid;/* LOCK success, LOCKU */
222 struct nfs_lock_denied denied; /* LOCK failed, LOCKT success */
224 const struct nfs_server * server;
228 * Arguments to the read call.
231 #define NFS_READ_MAXIOV (9U)
232 #if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
233 #error "NFS_READ_MAXIOV is too large"
236 struct nfs_readargs {
238 fl_owner_t lockowner;
239 struct nfs4_state * state;
243 struct page ** pages;
247 struct nfs_fattr * fattr;
253 * Arguments to the write call.
255 #define NFS_WRITE_MAXIOV (9U)
256 #if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
257 #error "NFS_WRITE_MAXIOV is too large"
260 struct nfs_writeargs {
262 fl_owner_t lockowner;
263 struct nfs4_state * state;
266 enum nfs3_stable_how stable;
268 struct page ** pages;
271 struct nfs_writeverf {
272 enum nfs3_stable_how committed;
276 struct nfs_writeres {
277 struct nfs_fattr * fattr;
278 struct nfs_writeverf * verf;
283 * Argument struct for decode_entry function
293 struct nfs_fattr * fattr;
297 * The following types are for NFSv2 only.
299 struct nfs_sattrargs {
301 struct iattr * sattr;
304 struct nfs_diropargs {
310 struct nfs_createargs {
314 struct iattr * sattr;
317 struct nfs_renameargs {
318 struct nfs_fh * fromfh;
319 const char * fromname;
320 unsigned int fromlen;
321 struct nfs_fh * tofh;
326 struct nfs_setattrargs {
328 nfs4_stateid stateid;
330 const struct nfs_server * server; /* Needed for name mapping */
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;
364 struct nfs_fattr * fattr;
367 struct nfs_readlinkargs {
370 struct page ** pages;
373 struct nfs3_sattrargs {
375 struct iattr * sattr;
377 struct timespec guardtime;
380 struct nfs3_diropargs {
386 struct nfs3_accessargs {
391 struct nfs3_createargs {
395 struct iattr * sattr;
396 enum nfs3_createmode createmode;
400 struct nfs3_mkdirargs {
404 struct iattr * sattr;
407 struct nfs3_symlinkargs {
408 struct nfs_fh * fromfh;
409 const char * fromname;
410 unsigned int fromlen;
413 struct iattr * sattr;
416 struct nfs3_mknodargs {
420 enum nfs3_ftype type;
421 struct iattr * sattr;
425 struct nfs3_renameargs {
426 struct nfs_fh * fromfh;
427 const char * fromname;
428 unsigned int fromlen;
429 struct nfs_fh * tofh;
434 struct nfs3_linkargs {
435 struct nfs_fh * fromfh;
436 struct nfs_fh * tofh;
441 struct nfs3_readdirargs {
447 struct page ** pages;
450 struct nfs3_diropres {
451 struct nfs_fattr * dir_attr;
453 struct nfs_fattr * fattr;
456 struct nfs3_accessres {
457 struct nfs_fattr * fattr;
461 struct nfs3_readlinkargs {
464 struct page ** pages;
467 struct nfs3_renameres {
468 struct nfs_fattr * fromattr;
469 struct nfs_fattr * toattr;
472 struct nfs3_linkres {
473 struct nfs_fattr * dir_attr;
474 struct nfs_fattr * fattr;
477 struct nfs3_readdirres {
478 struct nfs_fattr * dir_attr;
485 typedef u64 clientid4;
487 struct nfs4_accessargs {
488 const struct nfs_fh * fh;
492 struct nfs4_accessres {
497 struct nfs4_create_arg {
500 struct qstr * symlink; /* NF4LNK */
504 } device; /* NF4BLK, NF4CHR */
506 const struct qstr * name;
507 const struct nfs_server * server;
508 const struct iattr * attrs;
509 const struct nfs_fh * dir_fh;
513 struct nfs4_create_res {
514 const struct nfs_server * server;
516 struct nfs_fattr * fattr;
517 struct nfs4_change_info dir_cinfo;
520 struct nfs4_fsinfo_arg {
521 const struct nfs_fh * fh;
525 struct nfs4_getattr_arg {
526 const struct nfs_fh * fh;
530 struct nfs4_getattr_res {
531 const struct nfs_server * server;
532 struct nfs_fattr * fattr;
535 struct nfs4_link_arg {
536 const struct nfs_fh * fh;
537 const struct nfs_fh * dir_fh;
538 const struct qstr * name;
541 struct nfs4_lookup_arg {
542 const struct nfs_fh * dir_fh;
543 const struct qstr * name;
547 struct nfs4_lookup_res {
548 const struct nfs_server * server;
549 struct nfs_fattr * fattr;
553 struct nfs4_lookup_root_arg {
557 struct nfs4_pathconf_arg {
558 const struct nfs_fh * fh;
562 struct nfs4_readdir_arg {
563 const struct nfs_fh * fh;
565 nfs4_verifier verifier;
567 struct page ** pages; /* zero-copy data */
568 unsigned int pgbase; /* zero-copy data */
571 struct nfs4_readdir_res {
572 nfs4_verifier verifier;
576 struct nfs4_readlink {
577 const struct nfs_fh * fh;
578 u32 count; /* zero-copy data */
579 struct page ** pages; /* zero-copy data */
582 struct nfs4_remove_arg {
583 const struct nfs_fh * fh;
584 const struct qstr * name;
587 struct nfs4_rename_arg {
588 const struct nfs_fh * old_dir;
589 const struct nfs_fh * new_dir;
590 const struct qstr * old_name;
591 const struct qstr * new_name;
594 struct nfs4_rename_res {
595 struct nfs4_change_info old_cinfo;
596 struct nfs4_change_info new_cinfo;
599 struct nfs4_setclientid {
600 nfs4_verifier sc_verifier; /* request */
601 char * sc_name; /* request */
602 u32 sc_prog; /* request */
603 char sc_netid[4]; /* request */
604 char sc_uaddr[24]; /* request */
605 u32 sc_cb_ident; /* request */
606 struct nfs4_client * sc_state; /* response */
609 struct nfs4_statfs_arg {
610 const struct nfs_fh * fh;
614 struct nfs4_server_caps_res {
621 #endif /* CONFIG_NFS_V4 */
625 struct nfs_read_data {
627 struct rpc_task task;
629 struct rpc_cred *cred;
630 struct nfs_fattr fattr; /* fattr storage */
631 struct list_head pages; /* Coalesced read requests */
632 struct nfs_page *req; /* multi ops per nfs_page */
633 struct page *pagevec[NFS_READ_MAXIOV];
634 struct nfs_readargs args;
635 struct nfs_readres res;
637 unsigned long timestamp; /* For lease renewal */
639 void (*complete) (struct nfs_read_data *, int);
642 struct nfs_write_data {
644 struct rpc_task task;
646 struct rpc_cred *cred;
647 struct nfs_fattr fattr;
648 struct nfs_writeverf verf;
649 struct list_head pages; /* Coalesced requests we wish to flush */
650 struct nfs_page *req; /* multi ops per nfs_page */
651 struct page *pagevec[NFS_WRITE_MAXIOV];
652 struct nfs_writeargs args; /* argument struct */
653 struct nfs_writeres res; /* result struct */
655 unsigned long timestamp; /* For lease renewal */
657 void (*complete) (struct nfs_write_data *, int);
661 * RPC procedure vector for NFSv2/NFSv3 demuxing
664 int version; /* Protocol version */
665 struct dentry_operations *dentry_ops;
666 struct inode_operations *dir_inode_ops;
668 int (*getroot) (struct nfs_server *, struct nfs_fh *,
669 struct nfs_fsinfo *);
670 int (*getattr) (struct inode *, struct nfs_fattr *);
671 int (*setattr) (struct dentry *, struct nfs_fattr *,
673 int (*lookup) (struct inode *, struct qstr *,
674 struct nfs_fh *, struct nfs_fattr *);
675 int (*access) (struct inode *, struct rpc_cred *, int);
676 int (*readlink)(struct inode *, struct page *);
677 int (*read) (struct nfs_read_data *, struct file *);
678 int (*write) (struct nfs_write_data *, struct file *);
679 int (*commit) (struct nfs_write_data *, struct file *);
680 struct inode * (*create) (struct inode *, struct qstr *,
681 struct iattr *, int);
682 int (*remove) (struct inode *, struct qstr *);
683 int (*unlink_setup) (struct rpc_message *,
684 struct dentry *, struct qstr *);
685 int (*unlink_done) (struct dentry *, struct rpc_task *);
686 int (*rename) (struct inode *, struct qstr *,
687 struct inode *, struct qstr *);
688 int (*link) (struct inode *, struct inode *, struct qstr *);
689 int (*symlink) (struct inode *, struct qstr *, struct qstr *,
690 struct iattr *, struct nfs_fh *,
692 int (*mkdir) (struct inode *, struct qstr *, struct iattr *,
693 struct nfs_fh *, struct nfs_fattr *);
694 int (*rmdir) (struct inode *, struct qstr *);
695 int (*readdir) (struct dentry *, struct rpc_cred *,
696 u64, struct page *, unsigned int, int);
697 int (*mknod) (struct inode *, struct qstr *, struct iattr *,
698 dev_t, struct nfs_fh *, struct nfs_fattr *);
699 int (*statfs) (struct nfs_server *, struct nfs_fh *,
700 struct nfs_fsstat *);
701 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
702 struct nfs_fsinfo *);
703 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
704 struct nfs_pathconf *);
705 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
706 void (*read_setup) (struct nfs_read_data *);
707 void (*write_setup) (struct nfs_write_data *, int how);
708 void (*commit_setup) (struct nfs_write_data *, int how);
709 int (*file_open) (struct inode *, struct file *);
710 int (*file_release) (struct inode *, struct file *);
711 void (*request_init)(struct nfs_page *, struct file *);
712 int (*request_compatible)(struct nfs_page *, struct file *, struct page *);
713 int (*lock)(struct file *, int, struct file_lock *);
717 * NFS_CALL(getattr, inode, (fattr));
719 * NFS_PROTO(inode)->getattr(fattr);
721 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
724 * Function vectors etc. for the NFS client
726 extern struct nfs_rpc_ops nfs_v2_clientops;
727 extern struct nfs_rpc_ops nfs_v3_clientops;
728 extern struct nfs_rpc_ops nfs_v4_clientops;
729 extern struct rpc_version nfs_version2;
730 extern struct rpc_version nfs_version3;
731 extern struct rpc_version nfs_version4;
732 extern struct rpc_program nfs_program;
733 extern struct rpc_stat nfs_rpcstat;