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
{
100 * Arguments to the open call.
102 struct nfs_openargs
{
103 const struct nfs_fh
* fh
;
109 struct iattr
* attrs
; /* UNCHECKED, GUARDED */
110 nfs4_verifier verifier
; /* EXCLUSIVE */
111 nfs4_stateid delegation
; /* CLAIM_DELEGATE_CUR */
112 int delegation_type
; /* CLAIM_PREVIOUS */
114 const struct qstr
* name
;
115 const struct nfs_server
*server
; /* Needed for ID mapping */
121 nfs4_stateid stateid
;
123 struct nfs4_change_info cinfo
;
125 struct nfs_fattr
* f_attr
;
126 const struct nfs_server
*server
;
128 nfs4_stateid delegation
;
134 * Arguments to the open_confirm call.
136 struct nfs_open_confirmargs
{
137 const struct nfs_fh
* fh
;
138 nfs4_stateid stateid
;
142 struct nfs_open_confirmres
{
143 nfs4_stateid stateid
;
147 * Arguments to the close call.
149 struct nfs_closeargs
{
151 nfs4_stateid stateid
;
156 struct nfs_closeres
{
157 nfs4_stateid stateid
;
160 * * Arguments to the lock,lockt, and locku call.
167 struct nfs_open_to_lock
{
169 nfs4_stateid open_stateid
;
171 struct nfs_lowner lock_owner
;
174 struct nfs_exist_lock
{
175 nfs4_stateid stateid
;
179 struct nfs_lock_opargs
{
181 __u32 new_lock_owner
;
183 struct nfs_open_to_lock
*open_lock
;
184 struct nfs_exist_lock
*exist_lock
;
188 struct nfs_locku_opargs
{
190 nfs4_stateid stateid
;
193 struct nfs_lockargs
{
199 struct nfs_lock_opargs
*lock
; /* LOCK */
200 struct nfs_lowner
*lockt
; /* LOCKT */
201 struct nfs_locku_opargs
*locku
; /* LOCKU */
205 struct nfs_lock_denied
{
209 struct nfs_lowner owner
;
214 nfs4_stateid stateid
;/* LOCK success, LOCKU */
215 struct nfs_lock_denied denied
; /* LOCK failed, LOCKT success */
217 const struct nfs_server
* server
;
220 struct nfs4_delegreturnargs
{
221 const struct nfs_fh
*fhandle
;
222 const nfs4_stateid
*stateid
;
226 * Arguments to the read call.
229 #define NFS_READ_MAXIOV (9U)
230 #if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
231 #error "NFS_READ_MAXIOV is too large"
234 struct nfs_readargs
{
236 struct nfs_open_context
*context
;
240 struct page
** pages
;
244 struct nfs_fattr
* fattr
;
250 * Arguments to the write call.
252 #define NFS_WRITE_MAXIOV (9U)
253 #if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
254 #error "NFS_WRITE_MAXIOV is too large"
257 struct nfs_writeargs
{
259 struct nfs_open_context
*context
;
262 enum nfs3_stable_how stable
;
264 struct page
** pages
;
267 struct nfs_writeverf
{
268 enum nfs3_stable_how committed
;
272 struct nfs_writeres
{
273 struct nfs_fattr
* fattr
;
274 struct nfs_writeverf
* verf
;
279 * Argument struct for decode_entry function
289 struct nfs_fattr
* fattr
;
293 * The following types are for NFSv2 only.
295 struct nfs_sattrargs
{
297 struct iattr
* sattr
;
300 struct nfs_diropargs
{
306 struct nfs_createargs
{
310 struct iattr
* sattr
;
313 struct nfs_renameargs
{
314 struct nfs_fh
* fromfh
;
315 const char * fromname
;
316 unsigned int fromlen
;
317 struct nfs_fh
* tofh
;
322 struct nfs_setattrargs
{
324 nfs4_stateid stateid
;
326 const struct nfs_server
* server
; /* Needed for name mapping */
330 struct nfs_setaclargs
{
333 unsigned int acl_pgbase
;
334 struct page
** acl_pages
;
337 struct nfs_getaclargs
{
340 unsigned int acl_pgbase
;
341 struct page
** acl_pages
;
344 struct nfs_setattrres
{
345 struct nfs_fattr
* fattr
;
346 const struct nfs_server
* server
;
349 struct nfs_linkargs
{
350 struct nfs_fh
* fromfh
;
351 struct nfs_fh
* tofh
;
356 struct nfs_symlinkargs
{
357 struct nfs_fh
* fromfh
;
358 const char * fromname
;
359 unsigned int fromlen
;
362 struct iattr
* sattr
;
365 struct nfs_readdirargs
{
369 struct page
** pages
;
372 struct nfs3_getaclargs
{
375 struct page
** pages
;
378 struct nfs3_setaclargs
{
379 struct inode
* inode
;
381 struct posix_acl
* acl_access
;
382 struct posix_acl
* acl_default
;
383 struct page
** pages
;
388 struct nfs_fattr
* fattr
;
391 struct nfs_readlinkargs
{
395 struct page
** pages
;
398 struct nfs3_sattrargs
{
400 struct iattr
* sattr
;
402 struct timespec guardtime
;
405 struct nfs3_diropargs
{
411 struct nfs3_accessargs
{
416 struct nfs3_createargs
{
420 struct iattr
* sattr
;
421 enum nfs3_createmode createmode
;
425 struct nfs3_mkdirargs
{
429 struct iattr
* sattr
;
432 struct nfs3_symlinkargs
{
433 struct nfs_fh
* fromfh
;
434 const char * fromname
;
435 unsigned int fromlen
;
438 struct iattr
* sattr
;
441 struct nfs3_mknodargs
{
445 enum nfs3_ftype type
;
446 struct iattr
* sattr
;
450 struct nfs3_renameargs
{
451 struct nfs_fh
* fromfh
;
452 const char * fromname
;
453 unsigned int fromlen
;
454 struct nfs_fh
* tofh
;
459 struct nfs3_linkargs
{
460 struct nfs_fh
* fromfh
;
461 struct nfs_fh
* tofh
;
466 struct nfs3_readdirargs
{
472 struct page
** pages
;
475 struct nfs3_diropres
{
476 struct nfs_fattr
* dir_attr
;
478 struct nfs_fattr
* fattr
;
481 struct nfs3_accessres
{
482 struct nfs_fattr
* fattr
;
486 struct nfs3_readlinkargs
{
490 struct page
** pages
;
493 struct nfs3_renameres
{
494 struct nfs_fattr
* fromattr
;
495 struct nfs_fattr
* toattr
;
498 struct nfs3_linkres
{
499 struct nfs_fattr
* dir_attr
;
500 struct nfs_fattr
* fattr
;
503 struct nfs3_readdirres
{
504 struct nfs_fattr
* dir_attr
;
509 struct nfs3_getaclres
{
510 struct nfs_fattr
* fattr
;
512 unsigned int acl_access_count
;
513 unsigned int acl_default_count
;
514 struct posix_acl
* acl_access
;
515 struct posix_acl
* acl_default
;
520 typedef u64 clientid4
;
522 struct nfs4_accessargs
{
523 const struct nfs_fh
* fh
;
527 struct nfs4_accessres
{
532 struct nfs4_create_arg
{
535 struct qstr
* symlink
; /* NF4LNK */
539 } device
; /* NF4BLK, NF4CHR */
541 const struct qstr
* name
;
542 const struct nfs_server
* server
;
543 const struct iattr
* attrs
;
544 const struct nfs_fh
* dir_fh
;
548 struct nfs4_create_res
{
549 const struct nfs_server
* server
;
551 struct nfs_fattr
* fattr
;
552 struct nfs4_change_info dir_cinfo
;
555 struct nfs4_fsinfo_arg
{
556 const struct nfs_fh
* fh
;
560 struct nfs4_getattr_arg
{
561 const struct nfs_fh
* fh
;
565 struct nfs4_getattr_res
{
566 const struct nfs_server
* server
;
567 struct nfs_fattr
* fattr
;
570 struct nfs4_link_arg
{
571 const struct nfs_fh
* fh
;
572 const struct nfs_fh
* dir_fh
;
573 const struct qstr
* name
;
576 struct nfs4_lookup_arg
{
577 const struct nfs_fh
* dir_fh
;
578 const struct qstr
* name
;
582 struct nfs4_lookup_res
{
583 const struct nfs_server
* server
;
584 struct nfs_fattr
* fattr
;
588 struct nfs4_lookup_root_arg
{
592 struct nfs4_pathconf_arg
{
593 const struct nfs_fh
* fh
;
597 struct nfs4_readdir_arg
{
598 const struct nfs_fh
* fh
;
600 nfs4_verifier verifier
;
602 struct page
** pages
; /* zero-copy data */
603 unsigned int pgbase
; /* zero-copy data */
607 struct nfs4_readdir_res
{
608 nfs4_verifier verifier
;
612 struct nfs4_readlink
{
613 const struct nfs_fh
* fh
;
615 unsigned int pglen
; /* zero-copy data */
616 struct page
** pages
; /* zero-copy data */
619 struct nfs4_remove_arg
{
620 const struct nfs_fh
* fh
;
621 const struct qstr
* name
;
624 struct nfs4_rename_arg
{
625 const struct nfs_fh
* old_dir
;
626 const struct nfs_fh
* new_dir
;
627 const struct qstr
* old_name
;
628 const struct qstr
* new_name
;
631 struct nfs4_rename_res
{
632 struct nfs4_change_info old_cinfo
;
633 struct nfs4_change_info new_cinfo
;
636 struct nfs4_setclientid
{
637 const nfs4_verifier
* sc_verifier
; /* request */
638 unsigned int sc_name_len
;
639 char sc_name
[32]; /* request */
640 u32 sc_prog
; /* request */
641 unsigned int sc_netid_len
;
642 char sc_netid
[4]; /* request */
643 unsigned int sc_uaddr_len
;
644 char sc_uaddr
[24]; /* request */
645 u32 sc_cb_ident
; /* request */
648 struct nfs4_statfs_arg
{
649 const struct nfs_fh
* fh
;
653 struct nfs4_server_caps_res
{
660 #endif /* CONFIG_NFS_V4 */
664 struct nfs_read_data
{
666 struct rpc_task task
;
668 struct rpc_cred
*cred
;
669 struct nfs_fattr fattr
; /* fattr storage */
670 struct list_head pages
; /* Coalesced read requests */
671 struct nfs_page
*req
; /* multi ops per nfs_page */
672 struct page
*pagevec
[NFS_READ_MAXIOV
];
673 struct nfs_readargs args
;
674 struct nfs_readres res
;
676 unsigned long timestamp
; /* For lease renewal */
678 void (*complete
) (struct nfs_read_data
*, int);
681 struct nfs_write_data
{
683 struct rpc_task task
;
685 struct rpc_cred
*cred
;
686 struct nfs_fattr fattr
;
687 struct nfs_writeverf verf
;
688 struct list_head pages
; /* Coalesced requests we wish to flush */
689 struct nfs_page
*req
; /* multi ops per nfs_page */
690 struct page
*pagevec
[NFS_WRITE_MAXIOV
];
691 struct nfs_writeargs args
; /* argument struct */
692 struct nfs_writeres res
; /* result struct */
694 unsigned long timestamp
; /* For lease renewal */
696 void (*complete
) (struct nfs_write_data
*, int);
699 struct nfs_access_entry
;
702 * RPC procedure vector for NFSv2/NFSv3 demuxing
705 int version
; /* Protocol version */
706 struct dentry_operations
*dentry_ops
;
707 struct inode_operations
*dir_inode_ops
;
708 struct inode_operations
*file_inode_ops
;
710 int (*getroot
) (struct nfs_server
*, struct nfs_fh
*,
711 struct nfs_fsinfo
*);
712 int (*getattr
) (struct nfs_server
*, struct nfs_fh
*,
714 int (*setattr
) (struct dentry
*, struct nfs_fattr
*,
716 int (*lookup
) (struct inode
*, struct qstr
*,
717 struct nfs_fh
*, struct nfs_fattr
*);
718 int (*access
) (struct inode
*, struct nfs_access_entry
*);
719 int (*readlink
)(struct inode
*, struct page
*, unsigned int,
721 int (*read
) (struct nfs_read_data
*);
722 int (*write
) (struct nfs_write_data
*);
723 int (*commit
) (struct nfs_write_data
*);
724 int (*create
) (struct inode
*, struct dentry
*,
725 struct iattr
*, int);
726 int (*remove
) (struct inode
*, struct qstr
*);
727 int (*unlink_setup
) (struct rpc_message
*,
728 struct dentry
*, struct qstr
*);
729 int (*unlink_done
) (struct dentry
*, struct rpc_task
*);
730 int (*rename
) (struct inode
*, struct qstr
*,
731 struct inode
*, struct qstr
*);
732 int (*link
) (struct inode
*, struct inode
*, struct qstr
*);
733 int (*symlink
) (struct inode
*, struct qstr
*, struct qstr
*,
734 struct iattr
*, struct nfs_fh
*,
736 int (*mkdir
) (struct inode
*, struct dentry
*, struct iattr
*);
737 int (*rmdir
) (struct inode
*, struct qstr
*);
738 int (*readdir
) (struct dentry
*, struct rpc_cred
*,
739 u64
, struct page
*, unsigned int, int);
740 int (*mknod
) (struct inode
*, struct dentry
*, struct iattr
*,
742 int (*statfs
) (struct nfs_server
*, struct nfs_fh
*,
743 struct nfs_fsstat
*);
744 int (*fsinfo
) (struct nfs_server
*, struct nfs_fh
*,
745 struct nfs_fsinfo
*);
746 int (*pathconf
) (struct nfs_server
*, struct nfs_fh
*,
747 struct nfs_pathconf
*);
748 u32
* (*decode_dirent
)(u32
*, struct nfs_entry
*, int plus
);
749 void (*read_setup
) (struct nfs_read_data
*);
750 void (*write_setup
) (struct nfs_write_data
*, int how
);
751 void (*commit_setup
) (struct nfs_write_data
*, int how
);
752 int (*file_open
) (struct inode
*, struct file
*);
753 int (*file_release
) (struct inode
*, struct file
*);
754 int (*lock
)(struct file
*, int, struct file_lock
*);
755 void (*clear_acl_cache
)(struct inode
*);
759 * NFS_CALL(getattr, inode, (fattr));
761 * NFS_PROTO(inode)->getattr(fattr);
763 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
766 * Function vectors etc. for the NFS client
768 extern struct nfs_rpc_ops nfs_v2_clientops
;
769 extern struct nfs_rpc_ops nfs_v3_clientops
;
770 extern struct nfs_rpc_ops nfs_v4_clientops
;
771 extern struct rpc_version nfs_version2
;
772 extern struct rpc_version nfs_version3
;
773 extern struct rpc_version nfs_version4
;
775 extern struct rpc_version nfsacl_version3
;
776 extern struct rpc_program nfsacl_program
;