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_args
{
174 struct file_lock
* fl
;
175 struct nfs_seqid
* lock_seqid
;
176 nfs4_stateid
* lock_stateid
;
177 struct nfs_seqid
* open_seqid
;
178 nfs4_stateid
* open_stateid
;
179 struct nfs_lowner lock_owner
;
180 unsigned char block
: 1;
181 unsigned char reclaim
: 1;
182 unsigned char new_lock_owner
: 1;
185 struct nfs_lock_res
{
186 nfs4_stateid stateid
;
189 struct nfs_locku_args
{
191 struct file_lock
* fl
;
192 struct nfs_seqid
* seqid
;
193 nfs4_stateid
* stateid
;
196 struct nfs_locku_res
{
197 nfs4_stateid stateid
;
200 struct nfs_lockt_args
{
202 struct file_lock
* fl
;
203 struct nfs_lowner lock_owner
;
206 struct nfs_lockt_res
{
207 struct file_lock
* denied
; /* LOCK, LOCKT failed */
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
;
258 struct nfs_writeverf
{
259 enum nfs3_stable_how committed
;
263 struct nfs_writeres
{
264 struct nfs_fattr
* fattr
;
265 struct nfs_writeverf
* verf
;
267 const struct nfs_server
*server
;
271 * Argument struct for decode_entry function
281 struct nfs_fattr
* fattr
;
285 * The following types are for NFSv2 only.
287 struct nfs_sattrargs
{
289 struct iattr
* sattr
;
292 struct nfs_diropargs
{
298 struct nfs_createargs
{
302 struct iattr
* sattr
;
305 struct nfs_renameargs
{
306 struct nfs_fh
* fromfh
;
307 const char * fromname
;
308 unsigned int fromlen
;
309 struct nfs_fh
* tofh
;
314 struct nfs_setattrargs
{
316 nfs4_stateid stateid
;
318 const struct nfs_server
* server
; /* Needed for name mapping */
322 struct nfs_setaclargs
{
325 unsigned int acl_pgbase
;
326 struct page
** acl_pages
;
329 struct nfs_getaclargs
{
332 unsigned int acl_pgbase
;
333 struct page
** acl_pages
;
336 struct nfs_setattrres
{
337 struct nfs_fattr
* fattr
;
338 const struct nfs_server
* server
;
341 struct nfs_linkargs
{
342 struct nfs_fh
* fromfh
;
343 struct nfs_fh
* tofh
;
348 struct nfs_symlinkargs
{
349 struct nfs_fh
* fromfh
;
350 const char * fromname
;
351 unsigned int fromlen
;
354 struct iattr
* sattr
;
357 struct nfs_readdirargs
{
361 struct page
** pages
;
364 struct nfs3_getaclargs
{
367 struct page
** pages
;
370 struct nfs3_setaclargs
{
371 struct inode
* inode
;
373 struct posix_acl
* acl_access
;
374 struct posix_acl
* acl_default
;
375 struct page
** pages
;
380 struct nfs_fattr
* fattr
;
383 struct nfs_readlinkargs
{
387 struct page
** pages
;
390 struct nfs3_sattrargs
{
392 struct iattr
* sattr
;
394 struct timespec guardtime
;
397 struct nfs3_diropargs
{
403 struct nfs3_accessargs
{
408 struct nfs3_createargs
{
412 struct iattr
* sattr
;
413 enum nfs3_createmode createmode
;
417 struct nfs3_mkdirargs
{
421 struct iattr
* sattr
;
424 struct nfs3_symlinkargs
{
425 struct nfs_fh
* fromfh
;
426 const char * fromname
;
427 unsigned int fromlen
;
430 struct iattr
* sattr
;
433 struct nfs3_mknodargs
{
437 enum nfs3_ftype type
;
438 struct iattr
* sattr
;
442 struct nfs3_renameargs
{
443 struct nfs_fh
* fromfh
;
444 const char * fromname
;
445 unsigned int fromlen
;
446 struct nfs_fh
* tofh
;
451 struct nfs3_linkargs
{
452 struct nfs_fh
* fromfh
;
453 struct nfs_fh
* tofh
;
458 struct nfs3_readdirargs
{
464 struct page
** pages
;
467 struct nfs3_diropres
{
468 struct nfs_fattr
* dir_attr
;
470 struct nfs_fattr
* fattr
;
473 struct nfs3_accessres
{
474 struct nfs_fattr
* fattr
;
478 struct nfs3_readlinkargs
{
482 struct page
** pages
;
485 struct nfs3_renameres
{
486 struct nfs_fattr
* fromattr
;
487 struct nfs_fattr
* toattr
;
490 struct nfs3_linkres
{
491 struct nfs_fattr
* dir_attr
;
492 struct nfs_fattr
* fattr
;
495 struct nfs3_readdirres
{
496 struct nfs_fattr
* dir_attr
;
501 struct nfs3_getaclres
{
502 struct nfs_fattr
* fattr
;
504 unsigned int acl_access_count
;
505 unsigned int acl_default_count
;
506 struct posix_acl
* acl_access
;
507 struct posix_acl
* acl_default
;
512 typedef u64 clientid4
;
514 struct nfs4_accessargs
{
515 const struct nfs_fh
* fh
;
519 struct nfs4_accessres
{
524 struct nfs4_create_arg
{
527 struct qstr
* symlink
; /* NF4LNK */
531 } device
; /* NF4BLK, NF4CHR */
533 const struct qstr
* name
;
534 const struct nfs_server
* server
;
535 const struct iattr
* attrs
;
536 const struct nfs_fh
* dir_fh
;
540 struct nfs4_create_res
{
541 const struct nfs_server
* server
;
543 struct nfs_fattr
* fattr
;
544 struct nfs4_change_info dir_cinfo
;
545 struct nfs_fattr
* dir_fattr
;
548 struct nfs4_fsinfo_arg
{
549 const struct nfs_fh
* fh
;
553 struct nfs4_getattr_arg
{
554 const struct nfs_fh
* fh
;
558 struct nfs4_getattr_res
{
559 const struct nfs_server
* server
;
560 struct nfs_fattr
* fattr
;
563 struct nfs4_link_arg
{
564 const struct nfs_fh
* fh
;
565 const struct nfs_fh
* dir_fh
;
566 const struct qstr
* name
;
570 struct nfs4_link_res
{
571 const struct nfs_server
* server
;
572 struct nfs_fattr
* fattr
;
573 struct nfs4_change_info cinfo
;
574 struct nfs_fattr
* dir_attr
;
578 struct nfs4_lookup_arg
{
579 const struct nfs_fh
* dir_fh
;
580 const struct qstr
* name
;
584 struct nfs4_lookup_res
{
585 const struct nfs_server
* server
;
586 struct nfs_fattr
* fattr
;
590 struct nfs4_lookup_root_arg
{
594 struct nfs4_pathconf_arg
{
595 const struct nfs_fh
* fh
;
599 struct nfs4_readdir_arg
{
600 const struct nfs_fh
* fh
;
602 nfs4_verifier verifier
;
604 struct page
** pages
; /* zero-copy data */
605 unsigned int pgbase
; /* zero-copy data */
609 struct nfs4_readdir_res
{
610 nfs4_verifier verifier
;
614 struct nfs4_readlink
{
615 const struct nfs_fh
* fh
;
617 unsigned int pglen
; /* zero-copy data */
618 struct page
** pages
; /* zero-copy data */
621 struct nfs4_remove_arg
{
622 const struct nfs_fh
* fh
;
623 const struct qstr
* name
;
627 struct nfs4_remove_res
{
628 const struct nfs_server
* server
;
629 struct nfs4_change_info cinfo
;
630 struct nfs_fattr
* dir_attr
;
633 struct nfs4_rename_arg
{
634 const struct nfs_fh
* old_dir
;
635 const struct nfs_fh
* new_dir
;
636 const struct qstr
* old_name
;
637 const struct qstr
* new_name
;
641 struct nfs4_rename_res
{
642 const struct nfs_server
* server
;
643 struct nfs4_change_info old_cinfo
;
644 struct nfs_fattr
* old_fattr
;
645 struct nfs4_change_info new_cinfo
;
646 struct nfs_fattr
* new_fattr
;
649 struct nfs4_setclientid
{
650 const nfs4_verifier
* sc_verifier
; /* request */
651 unsigned int sc_name_len
;
652 char sc_name
[32]; /* request */
653 u32 sc_prog
; /* request */
654 unsigned int sc_netid_len
;
655 char sc_netid
[4]; /* request */
656 unsigned int sc_uaddr_len
;
657 char sc_uaddr
[24]; /* request */
658 u32 sc_cb_ident
; /* request */
661 struct nfs4_statfs_arg
{
662 const struct nfs_fh
* fh
;
666 struct nfs4_server_caps_res
{
673 #endif /* CONFIG_NFS_V4 */
677 struct nfs_read_data
{
679 struct rpc_task task
;
681 struct rpc_cred
*cred
;
682 struct nfs_fattr fattr
; /* fattr storage */
683 struct list_head pages
; /* Coalesced read requests */
684 struct nfs_page
*req
; /* multi ops per nfs_page */
685 struct page
*pagevec
[NFS_READ_MAXIOV
];
686 struct nfs_readargs args
;
687 struct nfs_readres res
;
689 unsigned long timestamp
; /* For lease renewal */
691 void (*complete
) (struct nfs_read_data
*, int);
694 struct nfs_write_data
{
696 struct rpc_task task
;
698 struct rpc_cred
*cred
;
699 struct nfs_fattr fattr
;
700 struct nfs_writeverf verf
;
701 struct list_head pages
; /* Coalesced requests we wish to flush */
702 struct nfs_page
*req
; /* multi ops per nfs_page */
703 struct page
*pagevec
[NFS_WRITE_MAXIOV
];
704 struct nfs_writeargs args
; /* argument struct */
705 struct nfs_writeres res
; /* result struct */
707 unsigned long timestamp
; /* For lease renewal */
709 void (*complete
) (struct nfs_write_data
*, int);
712 struct nfs_access_entry
;
715 * RPC procedure vector for NFSv2/NFSv3 demuxing
718 int version
; /* Protocol version */
719 struct dentry_operations
*dentry_ops
;
720 struct inode_operations
*dir_inode_ops
;
721 struct inode_operations
*file_inode_ops
;
723 int (*getroot
) (struct nfs_server
*, struct nfs_fh
*,
724 struct nfs_fsinfo
*);
725 int (*getattr
) (struct nfs_server
*, struct nfs_fh
*,
727 int (*setattr
) (struct dentry
*, struct nfs_fattr
*,
729 int (*lookup
) (struct inode
*, struct qstr
*,
730 struct nfs_fh
*, struct nfs_fattr
*);
731 int (*access
) (struct inode
*, struct nfs_access_entry
*);
732 int (*readlink
)(struct inode
*, struct page
*, unsigned int,
734 int (*read
) (struct nfs_read_data
*);
735 int (*write
) (struct nfs_write_data
*);
736 int (*commit
) (struct nfs_write_data
*);
737 int (*create
) (struct inode
*, struct dentry
*,
738 struct iattr
*, int, struct nameidata
*);
739 int (*remove
) (struct inode
*, struct qstr
*);
740 int (*unlink_setup
) (struct rpc_message
*,
741 struct dentry
*, struct qstr
*);
742 int (*unlink_done
) (struct dentry
*, struct rpc_task
*);
743 int (*rename
) (struct inode
*, struct qstr
*,
744 struct inode
*, struct qstr
*);
745 int (*link
) (struct inode
*, struct inode
*, struct qstr
*);
746 int (*symlink
) (struct inode
*, struct qstr
*, struct qstr
*,
747 struct iattr
*, struct nfs_fh
*,
749 int (*mkdir
) (struct inode
*, struct dentry
*, struct iattr
*);
750 int (*rmdir
) (struct inode
*, struct qstr
*);
751 int (*readdir
) (struct dentry
*, struct rpc_cred
*,
752 u64
, struct page
*, unsigned int, int);
753 int (*mknod
) (struct inode
*, struct dentry
*, struct iattr
*,
755 int (*statfs
) (struct nfs_server
*, struct nfs_fh
*,
756 struct nfs_fsstat
*);
757 int (*fsinfo
) (struct nfs_server
*, struct nfs_fh
*,
758 struct nfs_fsinfo
*);
759 int (*pathconf
) (struct nfs_server
*, struct nfs_fh
*,
760 struct nfs_pathconf
*);
761 u32
* (*decode_dirent
)(u32
*, struct nfs_entry
*, int plus
);
762 void (*read_setup
) (struct nfs_read_data
*);
763 void (*write_setup
) (struct nfs_write_data
*, int how
);
764 void (*commit_setup
) (struct nfs_write_data
*, int how
);
765 int (*file_open
) (struct inode
*, struct file
*);
766 int (*file_release
) (struct inode
*, struct file
*);
767 int (*lock
)(struct file
*, int, struct file_lock
*);
768 void (*clear_acl_cache
)(struct inode
*);
772 * NFS_CALL(getattr, inode, (fattr));
774 * NFS_PROTO(inode)->getattr(fattr);
776 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
779 * Function vectors etc. for the NFS client
781 extern struct nfs_rpc_ops nfs_v2_clientops
;
782 extern struct nfs_rpc_ops nfs_v3_clientops
;
783 extern struct nfs_rpc_ops nfs_v4_clientops
;
784 extern struct rpc_version nfs_version2
;
785 extern struct rpc_version nfs_version3
;
786 extern struct rpc_version nfs_version4
;
788 extern struct rpc_version nfsacl_version3
;
789 extern struct rpc_program nfsacl_program
;