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
{
102 const struct nfs_fh
* fh
;
108 struct iattr
* attrs
; /* UNCHECKED, GUARDED */
109 nfs4_verifier verifier
; /* EXCLUSIVE */
110 nfs4_stateid delegation
; /* CLAIM_DELEGATE_CUR */
111 int delegation_type
; /* CLAIM_PREVIOUS */
113 const struct qstr
* name
;
114 const struct nfs_server
*server
; /* Needed for ID mapping */
120 nfs4_stateid stateid
;
122 struct nfs4_change_info cinfo
;
124 struct nfs_fattr
* f_attr
;
125 const struct nfs_server
*server
;
127 nfs4_stateid delegation
;
133 * Arguments to the open_confirm call.
135 struct nfs_open_confirmargs
{
136 const struct nfs_fh
* fh
;
137 nfs4_stateid stateid
;
141 struct nfs_open_confirmres
{
142 nfs4_stateid stateid
;
146 * Arguments to the close call.
148 struct nfs_closeargs
{
150 nfs4_stateid stateid
;
155 struct nfs_closeres
{
156 nfs4_stateid stateid
;
159 * * Arguments to the lock,lockt, and locku call.
166 struct nfs_open_to_lock
{
168 nfs4_stateid open_stateid
;
170 struct nfs_lowner lock_owner
;
173 struct nfs_exist_lock
{
174 nfs4_stateid stateid
;
178 struct nfs_lock_opargs
{
180 __u32 new_lock_owner
;
182 struct nfs_open_to_lock
*open_lock
;
183 struct nfs_exist_lock
*exist_lock
;
187 struct nfs_locku_opargs
{
189 nfs4_stateid stateid
;
192 struct nfs_lockargs
{
198 struct nfs_lock_opargs
*lock
; /* LOCK */
199 struct nfs_lowner
*lockt
; /* LOCKT */
200 struct nfs_locku_opargs
*locku
; /* LOCKU */
204 struct nfs_lock_denied
{
208 struct nfs_lowner owner
;
213 nfs4_stateid stateid
;/* LOCK success, LOCKU */
214 struct nfs_lock_denied denied
; /* LOCK failed, LOCKT success */
216 const struct nfs_server
* server
;
219 struct nfs4_delegreturnargs
{
220 const struct nfs_fh
*fhandle
;
221 const nfs4_stateid
*stateid
;
225 * Arguments to the read call.
228 #define NFS_READ_MAXIOV (9U)
229 #if (NFS_READ_MAXIOV > (MAX_IOVEC -2))
230 #error "NFS_READ_MAXIOV is too large"
233 struct nfs_readargs
{
235 struct nfs_open_context
*context
;
239 struct page
** pages
;
243 struct nfs_fattr
* fattr
;
249 * Arguments to the write call.
251 #define NFS_WRITE_MAXIOV (9U)
252 #if (NFS_WRITE_MAXIOV > (MAX_IOVEC -2))
253 #error "NFS_WRITE_MAXIOV is too large"
256 struct nfs_writeargs
{
258 struct nfs_open_context
*context
;
261 enum nfs3_stable_how stable
;
263 struct page
** pages
;
266 struct nfs_writeverf
{
267 enum nfs3_stable_how committed
;
271 struct nfs_writeres
{
272 struct nfs_fattr
* fattr
;
273 struct nfs_writeverf
* verf
;
278 * Argument struct for decode_entry function
288 struct nfs_fattr
* fattr
;
292 * The following types are for NFSv2 only.
294 struct nfs_sattrargs
{
296 struct iattr
* sattr
;
299 struct nfs_diropargs
{
305 struct nfs_createargs
{
309 struct iattr
* sattr
;
312 struct nfs_renameargs
{
313 struct nfs_fh
* fromfh
;
314 const char * fromname
;
315 unsigned int fromlen
;
316 struct nfs_fh
* tofh
;
321 struct nfs_setattrargs
{
323 nfs4_stateid stateid
;
325 const struct nfs_server
* server
; /* Needed for name mapping */
329 struct nfs_setaclargs
{
332 unsigned int acl_pgbase
;
333 struct page
** acl_pages
;
336 struct nfs_getaclargs
{
339 unsigned int acl_pgbase
;
340 struct page
** acl_pages
;
343 struct nfs_setattrres
{
344 struct nfs_fattr
* fattr
;
345 const struct nfs_server
* server
;
348 struct nfs_linkargs
{
349 struct nfs_fh
* fromfh
;
350 struct nfs_fh
* tofh
;
355 struct nfs_symlinkargs
{
356 struct nfs_fh
* fromfh
;
357 const char * fromname
;
358 unsigned int fromlen
;
361 struct iattr
* sattr
;
364 struct nfs_readdirargs
{
368 struct page
** pages
;
373 struct nfs_fattr
* fattr
;
376 struct nfs_readlinkargs
{
380 struct page
** pages
;
383 struct nfs3_sattrargs
{
385 struct iattr
* sattr
;
387 struct timespec guardtime
;
390 struct nfs3_diropargs
{
396 struct nfs3_accessargs
{
401 struct nfs3_createargs
{
405 struct iattr
* sattr
;
406 enum nfs3_createmode createmode
;
410 struct nfs3_mkdirargs
{
414 struct iattr
* sattr
;
417 struct nfs3_symlinkargs
{
418 struct nfs_fh
* fromfh
;
419 const char * fromname
;
420 unsigned int fromlen
;
423 struct iattr
* sattr
;
426 struct nfs3_mknodargs
{
430 enum nfs3_ftype type
;
431 struct iattr
* sattr
;
435 struct nfs3_renameargs
{
436 struct nfs_fh
* fromfh
;
437 const char * fromname
;
438 unsigned int fromlen
;
439 struct nfs_fh
* tofh
;
444 struct nfs3_linkargs
{
445 struct nfs_fh
* fromfh
;
446 struct nfs_fh
* tofh
;
451 struct nfs3_readdirargs
{
457 struct page
** pages
;
460 struct nfs3_diropres
{
461 struct nfs_fattr
* dir_attr
;
463 struct nfs_fattr
* fattr
;
466 struct nfs3_accessres
{
467 struct nfs_fattr
* fattr
;
471 struct nfs3_readlinkargs
{
475 struct page
** pages
;
478 struct nfs3_renameres
{
479 struct nfs_fattr
* fromattr
;
480 struct nfs_fattr
* toattr
;
483 struct nfs3_linkres
{
484 struct nfs_fattr
* dir_attr
;
485 struct nfs_fattr
* fattr
;
488 struct nfs3_readdirres
{
489 struct nfs_fattr
* dir_attr
;
496 typedef u64 clientid4
;
498 struct nfs4_accessargs
{
499 const struct nfs_fh
* fh
;
503 struct nfs4_accessres
{
508 struct nfs4_create_arg
{
511 struct qstr
* symlink
; /* NF4LNK */
515 } device
; /* NF4BLK, NF4CHR */
517 const struct qstr
* name
;
518 const struct nfs_server
* server
;
519 const struct iattr
* attrs
;
520 const struct nfs_fh
* dir_fh
;
524 struct nfs4_create_res
{
525 const struct nfs_server
* server
;
527 struct nfs_fattr
* fattr
;
528 struct nfs4_change_info dir_cinfo
;
531 struct nfs4_fsinfo_arg
{
532 const struct nfs_fh
* fh
;
536 struct nfs4_getattr_arg
{
537 const struct nfs_fh
* fh
;
541 struct nfs4_getattr_res
{
542 const struct nfs_server
* server
;
543 struct nfs_fattr
* fattr
;
546 struct nfs4_link_arg
{
547 const struct nfs_fh
* fh
;
548 const struct nfs_fh
* dir_fh
;
549 const struct qstr
* name
;
552 struct nfs4_lookup_arg
{
553 const struct nfs_fh
* dir_fh
;
554 const struct qstr
* name
;
558 struct nfs4_lookup_res
{
559 const struct nfs_server
* server
;
560 struct nfs_fattr
* fattr
;
564 struct nfs4_lookup_root_arg
{
568 struct nfs4_pathconf_arg
{
569 const struct nfs_fh
* fh
;
573 struct nfs4_readdir_arg
{
574 const struct nfs_fh
* fh
;
576 nfs4_verifier verifier
;
578 struct page
** pages
; /* zero-copy data */
579 unsigned int pgbase
; /* zero-copy data */
583 struct nfs4_readdir_res
{
584 nfs4_verifier verifier
;
588 struct nfs4_readlink
{
589 const struct nfs_fh
* fh
;
591 unsigned int pglen
; /* zero-copy data */
592 struct page
** pages
; /* zero-copy data */
595 struct nfs4_remove_arg
{
596 const struct nfs_fh
* fh
;
597 const struct qstr
* name
;
600 struct nfs4_rename_arg
{
601 const struct nfs_fh
* old_dir
;
602 const struct nfs_fh
* new_dir
;
603 const struct qstr
* old_name
;
604 const struct qstr
* new_name
;
607 struct nfs4_rename_res
{
608 struct nfs4_change_info old_cinfo
;
609 struct nfs4_change_info new_cinfo
;
612 struct nfs4_setclientid
{
613 const nfs4_verifier
* sc_verifier
; /* request */
614 unsigned int sc_name_len
;
615 char sc_name
[32]; /* request */
616 u32 sc_prog
; /* request */
617 unsigned int sc_netid_len
;
618 char sc_netid
[4]; /* request */
619 unsigned int sc_uaddr_len
;
620 char sc_uaddr
[24]; /* request */
621 u32 sc_cb_ident
; /* request */
624 struct nfs4_statfs_arg
{
625 const struct nfs_fh
* fh
;
629 struct nfs4_server_caps_res
{
636 #endif /* CONFIG_NFS_V4 */
640 struct nfs_read_data
{
642 struct rpc_task task
;
644 struct rpc_cred
*cred
;
645 struct nfs_fattr fattr
; /* fattr storage */
646 struct list_head pages
; /* Coalesced read requests */
647 struct nfs_page
*req
; /* multi ops per nfs_page */
648 struct page
*pagevec
[NFS_READ_MAXIOV
];
649 struct nfs_readargs args
;
650 struct nfs_readres res
;
652 unsigned long timestamp
; /* For lease renewal */
654 void (*complete
) (struct nfs_read_data
*, int);
657 struct nfs_write_data
{
659 struct rpc_task task
;
661 struct rpc_cred
*cred
;
662 struct nfs_fattr fattr
;
663 struct nfs_writeverf verf
;
664 struct list_head pages
; /* Coalesced requests we wish to flush */
665 struct nfs_page
*req
; /* multi ops per nfs_page */
666 struct page
*pagevec
[NFS_WRITE_MAXIOV
];
667 struct nfs_writeargs args
; /* argument struct */
668 struct nfs_writeres res
; /* result struct */
670 unsigned long timestamp
; /* For lease renewal */
672 void (*complete
) (struct nfs_write_data
*, int);
675 struct nfs_access_entry
;
678 * RPC procedure vector for NFSv2/NFSv3 demuxing
681 int version
; /* Protocol version */
682 struct dentry_operations
*dentry_ops
;
683 struct inode_operations
*dir_inode_ops
;
684 struct inode_operations
*file_inode_ops
;
686 int (*getroot
) (struct nfs_server
*, struct nfs_fh
*,
687 struct nfs_fsinfo
*);
688 int (*getattr
) (struct nfs_server
*, struct nfs_fh
*,
690 int (*setattr
) (struct dentry
*, struct nfs_fattr
*,
692 int (*lookup
) (struct inode
*, struct qstr
*,
693 struct nfs_fh
*, struct nfs_fattr
*);
694 int (*access
) (struct inode
*, struct nfs_access_entry
*);
695 int (*readlink
)(struct inode
*, struct page
*, unsigned int,
697 int (*read
) (struct nfs_read_data
*);
698 int (*write
) (struct nfs_write_data
*);
699 int (*commit
) (struct nfs_write_data
*);
700 int (*create
) (struct inode
*, struct dentry
*,
701 struct iattr
*, int);
702 int (*remove
) (struct inode
*, struct qstr
*);
703 int (*unlink_setup
) (struct rpc_message
*,
704 struct dentry
*, struct qstr
*);
705 int (*unlink_done
) (struct dentry
*, struct rpc_task
*);
706 int (*rename
) (struct inode
*, struct qstr
*,
707 struct inode
*, struct qstr
*);
708 int (*link
) (struct inode
*, struct inode
*, struct qstr
*);
709 int (*symlink
) (struct inode
*, struct qstr
*, struct qstr
*,
710 struct iattr
*, struct nfs_fh
*,
712 int (*mkdir
) (struct inode
*, struct dentry
*, struct iattr
*);
713 int (*rmdir
) (struct inode
*, struct qstr
*);
714 int (*readdir
) (struct dentry
*, struct rpc_cred
*,
715 u64
, struct page
*, unsigned int, int);
716 int (*mknod
) (struct inode
*, struct dentry
*, struct iattr
*,
718 int (*statfs
) (struct nfs_server
*, struct nfs_fh
*,
719 struct nfs_fsstat
*);
720 int (*fsinfo
) (struct nfs_server
*, struct nfs_fh
*,
721 struct nfs_fsinfo
*);
722 int (*pathconf
) (struct nfs_server
*, struct nfs_fh
*,
723 struct nfs_pathconf
*);
724 u32
* (*decode_dirent
)(u32
*, struct nfs_entry
*, int plus
);
725 void (*read_setup
) (struct nfs_read_data
*);
726 void (*write_setup
) (struct nfs_write_data
*, int how
);
727 void (*commit_setup
) (struct nfs_write_data
*, int how
);
728 int (*file_open
) (struct inode
*, struct file
*);
729 int (*file_release
) (struct inode
*, struct file
*);
730 int (*lock
)(struct file
*, int, struct file_lock
*);
731 void (*clear_acl_cache
)(struct inode
*);
735 * NFS_CALL(getattr, inode, (fattr));
737 * NFS_PROTO(inode)->getattr(fattr);
739 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
742 * Function vectors etc. for the NFS client
744 extern struct nfs_rpc_ops nfs_v2_clientops
;
745 extern struct nfs_rpc_ops nfs_v3_clientops
;
746 extern struct nfs_rpc_ops nfs_v4_clientops
;
747 extern struct rpc_version nfs_version2
;
748 extern struct rpc_version nfs_version3
;
749 extern struct rpc_version nfs_version4
;