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_open_to_lock
{
169 struct nfs_seqid
* open_seqid
;
170 nfs4_stateid open_stateid
;
171 struct nfs_seqid
* lock_seqid
;
172 struct nfs_lowner lock_owner
;
175 struct nfs_exist_lock
{
176 nfs4_stateid stateid
;
177 struct nfs_seqid
* seqid
;
180 struct nfs_lock_opargs
{
182 __u32 new_lock_owner
;
184 struct nfs_open_to_lock
*open_lock
;
185 struct nfs_exist_lock
*exist_lock
;
189 struct nfs_locku_opargs
{
190 struct nfs_seqid
* seqid
;
191 nfs4_stateid stateid
;
194 struct nfs_lockargs
{
200 struct nfs_lock_opargs
*lock
; /* LOCK */
201 struct nfs_lowner
*lockt
; /* LOCKT */
202 struct nfs_locku_opargs
*locku
; /* LOCKU */
206 struct nfs_lock_denied
{
210 struct nfs_lowner owner
;
215 nfs4_stateid stateid
;/* LOCK success, LOCKU */
216 struct nfs_lock_denied denied
; /* LOCK failed, LOCKT success */
218 const struct nfs_server
* server
;
221 struct nfs4_delegreturnargs
{
222 const struct nfs_fh
*fhandle
;
223 const nfs4_stateid
*stateid
;
227 * Arguments to the read call.
230 #define NFS_READ_MAXIOV (9U)
231 #if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
232 #error "NFS_READ_MAXIOV is too large"
235 struct nfs_readargs
{
237 struct nfs_open_context
*context
;
241 struct page
** pages
;
245 struct nfs_fattr
* fattr
;
251 * Arguments to the write call.
253 #define NFS_WRITE_MAXIOV (9U)
254 #if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
255 #error "NFS_WRITE_MAXIOV is too large"
258 struct nfs_writeargs
{
260 struct nfs_open_context
*context
;
263 enum nfs3_stable_how stable
;
265 struct page
** pages
;
268 struct nfs_writeverf
{
269 enum nfs3_stable_how committed
;
273 struct nfs_writeres
{
274 struct nfs_fattr
* fattr
;
275 struct nfs_writeverf
* verf
;
280 * Argument struct for decode_entry function
290 struct nfs_fattr
* fattr
;
294 * The following types are for NFSv2 only.
296 struct nfs_sattrargs
{
298 struct iattr
* sattr
;
301 struct nfs_diropargs
{
307 struct nfs_createargs
{
311 struct iattr
* sattr
;
314 struct nfs_renameargs
{
315 struct nfs_fh
* fromfh
;
316 const char * fromname
;
317 unsigned int fromlen
;
318 struct nfs_fh
* tofh
;
323 struct nfs_setattrargs
{
325 nfs4_stateid stateid
;
327 const struct nfs_server
* server
; /* Needed for name mapping */
331 struct nfs_setaclargs
{
334 unsigned int acl_pgbase
;
335 struct page
** acl_pages
;
338 struct nfs_getaclargs
{
341 unsigned int acl_pgbase
;
342 struct page
** acl_pages
;
345 struct nfs_setattrres
{
346 struct nfs_fattr
* fattr
;
347 const struct nfs_server
* server
;
350 struct nfs_linkargs
{
351 struct nfs_fh
* fromfh
;
352 struct nfs_fh
* tofh
;
357 struct nfs_symlinkargs
{
358 struct nfs_fh
* fromfh
;
359 const char * fromname
;
360 unsigned int fromlen
;
363 struct iattr
* sattr
;
366 struct nfs_readdirargs
{
370 struct page
** pages
;
373 struct nfs3_getaclargs
{
376 struct page
** pages
;
379 struct nfs3_setaclargs
{
380 struct inode
* inode
;
382 struct posix_acl
* acl_access
;
383 struct posix_acl
* acl_default
;
384 struct page
** pages
;
389 struct nfs_fattr
* fattr
;
392 struct nfs_readlinkargs
{
396 struct page
** pages
;
399 struct nfs3_sattrargs
{
401 struct iattr
* sattr
;
403 struct timespec guardtime
;
406 struct nfs3_diropargs
{
412 struct nfs3_accessargs
{
417 struct nfs3_createargs
{
421 struct iattr
* sattr
;
422 enum nfs3_createmode createmode
;
426 struct nfs3_mkdirargs
{
430 struct iattr
* sattr
;
433 struct nfs3_symlinkargs
{
434 struct nfs_fh
* fromfh
;
435 const char * fromname
;
436 unsigned int fromlen
;
439 struct iattr
* sattr
;
442 struct nfs3_mknodargs
{
446 enum nfs3_ftype type
;
447 struct iattr
* sattr
;
451 struct nfs3_renameargs
{
452 struct nfs_fh
* fromfh
;
453 const char * fromname
;
454 unsigned int fromlen
;
455 struct nfs_fh
* tofh
;
460 struct nfs3_linkargs
{
461 struct nfs_fh
* fromfh
;
462 struct nfs_fh
* tofh
;
467 struct nfs3_readdirargs
{
473 struct page
** pages
;
476 struct nfs3_diropres
{
477 struct nfs_fattr
* dir_attr
;
479 struct nfs_fattr
* fattr
;
482 struct nfs3_accessres
{
483 struct nfs_fattr
* fattr
;
487 struct nfs3_readlinkargs
{
491 struct page
** pages
;
494 struct nfs3_renameres
{
495 struct nfs_fattr
* fromattr
;
496 struct nfs_fattr
* toattr
;
499 struct nfs3_linkres
{
500 struct nfs_fattr
* dir_attr
;
501 struct nfs_fattr
* fattr
;
504 struct nfs3_readdirres
{
505 struct nfs_fattr
* dir_attr
;
510 struct nfs3_getaclres
{
511 struct nfs_fattr
* fattr
;
513 unsigned int acl_access_count
;
514 unsigned int acl_default_count
;
515 struct posix_acl
* acl_access
;
516 struct posix_acl
* acl_default
;
521 typedef u64 clientid4
;
523 struct nfs4_accessargs
{
524 const struct nfs_fh
* fh
;
528 struct nfs4_accessres
{
533 struct nfs4_create_arg
{
536 struct qstr
* symlink
; /* NF4LNK */
540 } device
; /* NF4BLK, NF4CHR */
542 const struct qstr
* name
;
543 const struct nfs_server
* server
;
544 const struct iattr
* attrs
;
545 const struct nfs_fh
* dir_fh
;
549 struct nfs4_create_res
{
550 const struct nfs_server
* server
;
552 struct nfs_fattr
* fattr
;
553 struct nfs4_change_info dir_cinfo
;
556 struct nfs4_fsinfo_arg
{
557 const struct nfs_fh
* fh
;
561 struct nfs4_getattr_arg
{
562 const struct nfs_fh
* fh
;
566 struct nfs4_getattr_res
{
567 const struct nfs_server
* server
;
568 struct nfs_fattr
* fattr
;
571 struct nfs4_link_arg
{
572 const struct nfs_fh
* fh
;
573 const struct nfs_fh
* dir_fh
;
574 const struct qstr
* name
;
577 struct nfs4_lookup_arg
{
578 const struct nfs_fh
* dir_fh
;
579 const struct qstr
* name
;
583 struct nfs4_lookup_res
{
584 const struct nfs_server
* server
;
585 struct nfs_fattr
* fattr
;
589 struct nfs4_lookup_root_arg
{
593 struct nfs4_pathconf_arg
{
594 const struct nfs_fh
* fh
;
598 struct nfs4_readdir_arg
{
599 const struct nfs_fh
* fh
;
601 nfs4_verifier verifier
;
603 struct page
** pages
; /* zero-copy data */
604 unsigned int pgbase
; /* zero-copy data */
608 struct nfs4_readdir_res
{
609 nfs4_verifier verifier
;
613 struct nfs4_readlink
{
614 const struct nfs_fh
* fh
;
616 unsigned int pglen
; /* zero-copy data */
617 struct page
** pages
; /* zero-copy data */
620 struct nfs4_remove_arg
{
621 const struct nfs_fh
* fh
;
622 const struct qstr
* name
;
625 struct nfs4_rename_arg
{
626 const struct nfs_fh
* old_dir
;
627 const struct nfs_fh
* new_dir
;
628 const struct qstr
* old_name
;
629 const struct qstr
* new_name
;
632 struct nfs4_rename_res
{
633 struct nfs4_change_info old_cinfo
;
634 struct nfs4_change_info new_cinfo
;
637 struct nfs4_setclientid
{
638 const nfs4_verifier
* sc_verifier
; /* request */
639 unsigned int sc_name_len
;
640 char sc_name
[32]; /* request */
641 u32 sc_prog
; /* request */
642 unsigned int sc_netid_len
;
643 char sc_netid
[4]; /* request */
644 unsigned int sc_uaddr_len
;
645 char sc_uaddr
[24]; /* request */
646 u32 sc_cb_ident
; /* request */
649 struct nfs4_statfs_arg
{
650 const struct nfs_fh
* fh
;
654 struct nfs4_server_caps_res
{
661 #endif /* CONFIG_NFS_V4 */
665 struct nfs_read_data
{
667 struct rpc_task task
;
669 struct rpc_cred
*cred
;
670 struct nfs_fattr fattr
; /* fattr storage */
671 struct list_head pages
; /* Coalesced read requests */
672 struct nfs_page
*req
; /* multi ops per nfs_page */
673 struct page
*pagevec
[NFS_READ_MAXIOV
];
674 struct nfs_readargs args
;
675 struct nfs_readres res
;
677 unsigned long timestamp
; /* For lease renewal */
679 void (*complete
) (struct nfs_read_data
*, int);
682 struct nfs_write_data
{
684 struct rpc_task task
;
686 struct rpc_cred
*cred
;
687 struct nfs_fattr fattr
;
688 struct nfs_writeverf verf
;
689 struct list_head pages
; /* Coalesced requests we wish to flush */
690 struct nfs_page
*req
; /* multi ops per nfs_page */
691 struct page
*pagevec
[NFS_WRITE_MAXIOV
];
692 struct nfs_writeargs args
; /* argument struct */
693 struct nfs_writeres res
; /* result struct */
695 unsigned long timestamp
; /* For lease renewal */
697 void (*complete
) (struct nfs_write_data
*, int);
700 struct nfs_access_entry
;
703 * RPC procedure vector for NFSv2/NFSv3 demuxing
706 int version
; /* Protocol version */
707 struct dentry_operations
*dentry_ops
;
708 struct inode_operations
*dir_inode_ops
;
709 struct inode_operations
*file_inode_ops
;
711 int (*getroot
) (struct nfs_server
*, struct nfs_fh
*,
712 struct nfs_fsinfo
*);
713 int (*getattr
) (struct nfs_server
*, struct nfs_fh
*,
715 int (*setattr
) (struct dentry
*, struct nfs_fattr
*,
717 int (*lookup
) (struct inode
*, struct qstr
*,
718 struct nfs_fh
*, struct nfs_fattr
*);
719 int (*access
) (struct inode
*, struct nfs_access_entry
*);
720 int (*readlink
)(struct inode
*, struct page
*, unsigned int,
722 int (*read
) (struct nfs_read_data
*);
723 int (*write
) (struct nfs_write_data
*);
724 int (*commit
) (struct nfs_write_data
*);
725 int (*create
) (struct inode
*, struct dentry
*,
726 struct iattr
*, int);
727 int (*remove
) (struct inode
*, struct qstr
*);
728 int (*unlink_setup
) (struct rpc_message
*,
729 struct dentry
*, struct qstr
*);
730 int (*unlink_done
) (struct dentry
*, struct rpc_task
*);
731 int (*rename
) (struct inode
*, struct qstr
*,
732 struct inode
*, struct qstr
*);
733 int (*link
) (struct inode
*, struct inode
*, struct qstr
*);
734 int (*symlink
) (struct inode
*, struct qstr
*, struct qstr
*,
735 struct iattr
*, struct nfs_fh
*,
737 int (*mkdir
) (struct inode
*, struct dentry
*, struct iattr
*);
738 int (*rmdir
) (struct inode
*, struct qstr
*);
739 int (*readdir
) (struct dentry
*, struct rpc_cred
*,
740 u64
, struct page
*, unsigned int, int);
741 int (*mknod
) (struct inode
*, struct dentry
*, struct iattr
*,
743 int (*statfs
) (struct nfs_server
*, struct nfs_fh
*,
744 struct nfs_fsstat
*);
745 int (*fsinfo
) (struct nfs_server
*, struct nfs_fh
*,
746 struct nfs_fsinfo
*);
747 int (*pathconf
) (struct nfs_server
*, struct nfs_fh
*,
748 struct nfs_pathconf
*);
749 u32
* (*decode_dirent
)(u32
*, struct nfs_entry
*, int plus
);
750 void (*read_setup
) (struct nfs_read_data
*);
751 void (*write_setup
) (struct nfs_write_data
*, int how
);
752 void (*commit_setup
) (struct nfs_write_data
*, int how
);
753 int (*file_open
) (struct inode
*, struct file
*);
754 int (*file_release
) (struct inode
*, struct file
*);
755 int (*lock
)(struct file
*, int, struct file_lock
*);
756 void (*clear_acl_cache
)(struct inode
*);
760 * NFS_CALL(getattr, inode, (fattr));
762 * NFS_PROTO(inode)->getattr(fattr);
764 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
767 * Function vectors etc. for the NFS client
769 extern struct nfs_rpc_ops nfs_v2_clientops
;
770 extern struct nfs_rpc_ops nfs_v3_clientops
;
771 extern struct nfs_rpc_ops nfs_v4_clientops
;
772 extern struct rpc_version nfs_version2
;
773 extern struct rpc_version nfs_version3
;
774 extern struct rpc_version nfs_version4
;
776 extern struct rpc_version nfsacl_version3
;
777 extern struct rpc_program nfsacl_program
;