1 #ifndef _LINUX_NFS_XDR_H
2 #define _LINUX_NFS_XDR_H
4 #include <linux/nfsacl.h>
5 #include <linux/sunrpc/gss_api.h>
8 * To change the maximum rsize and wsize supported by the NFS client, adjust
9 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
10 * support a megabyte or more. The default is left at 4096 bytes, which is
11 * reasonable for NFS over UDP.
13 #define NFS_MAX_FILE_IO_SIZE (1048576U)
14 #define NFS_DEF_FILE_IO_SIZE (4096U)
15 #define NFS_MIN_FILE_IO_SIZE (1024U)
28 * Helper for checking equality between 2 fsids.
30 static inline int nfs_fsid_equal(const struct nfs_fsid
*a
, const struct nfs_fsid
*b
)
32 return a
->major
== b
->major
&& a
->minor
== b
->minor
;
35 struct nfs4_threshold
{
45 unsigned int valid
; /* which fields are valid */
63 __u64 mounted_on_fileid
;
64 struct timespec atime
;
65 struct timespec mtime
;
66 struct timespec ctime
;
67 __u64 change_attr
; /* NFSv4 change attribute */
68 __u64 pre_change_attr
;/* pre-op NFSv4 change attribute */
69 __u64 pre_size
; /* pre_op_attr.size */
70 struct timespec pre_mtime
; /* pre_op_attr.mtime */
71 struct timespec pre_ctime
; /* pre_op_attr.ctime */
72 unsigned long time_start
;
73 unsigned long gencount
;
74 struct nfs4_string
*owner_name
;
75 struct nfs4_string
*group_name
;
76 struct nfs4_threshold
*mdsthreshold
; /* pNFS threshold hints */
79 #define NFS_ATTR_FATTR_TYPE (1U << 0)
80 #define NFS_ATTR_FATTR_MODE (1U << 1)
81 #define NFS_ATTR_FATTR_NLINK (1U << 2)
82 #define NFS_ATTR_FATTR_OWNER (1U << 3)
83 #define NFS_ATTR_FATTR_GROUP (1U << 4)
84 #define NFS_ATTR_FATTR_RDEV (1U << 5)
85 #define NFS_ATTR_FATTR_SIZE (1U << 6)
86 #define NFS_ATTR_FATTR_PRESIZE (1U << 7)
87 #define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
88 #define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
89 #define NFS_ATTR_FATTR_FSID (1U << 10)
90 #define NFS_ATTR_FATTR_FILEID (1U << 11)
91 #define NFS_ATTR_FATTR_ATIME (1U << 12)
92 #define NFS_ATTR_FATTR_MTIME (1U << 13)
93 #define NFS_ATTR_FATTR_CTIME (1U << 14)
94 #define NFS_ATTR_FATTR_PREMTIME (1U << 15)
95 #define NFS_ATTR_FATTR_PRECTIME (1U << 16)
96 #define NFS_ATTR_FATTR_CHANGE (1U << 17)
97 #define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
98 #define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
99 #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
100 #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
101 #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
102 #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
103 #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
104 #define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
106 #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
107 | NFS_ATTR_FATTR_MODE \
108 | NFS_ATTR_FATTR_NLINK \
109 | NFS_ATTR_FATTR_OWNER \
110 | NFS_ATTR_FATTR_GROUP \
111 | NFS_ATTR_FATTR_RDEV \
112 | NFS_ATTR_FATTR_SIZE \
113 | NFS_ATTR_FATTR_FSID \
114 | NFS_ATTR_FATTR_FILEID \
115 | NFS_ATTR_FATTR_ATIME \
116 | NFS_ATTR_FATTR_MTIME \
117 | NFS_ATTR_FATTR_CTIME \
118 | NFS_ATTR_FATTR_CHANGE)
119 #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
120 | NFS_ATTR_FATTR_BLOCKS_USED)
121 #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
122 | NFS_ATTR_FATTR_SPACE_USED)
123 #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
124 | NFS_ATTR_FATTR_SPACE_USED \
125 | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
128 * Maximal number of supported layout drivers.
130 #define NFS_MAX_LAYOUT_TYPES 8
133 * Info on the file system
136 struct nfs_fattr
*fattr
; /* Post-op attributes */
137 __u32 rtmax
; /* max. read transfer size */
138 __u32 rtpref
; /* pref. read transfer size */
139 __u32 rtmult
; /* reads should be multiple of this */
140 __u32 wtmax
; /* max. write transfer size */
141 __u32 wtpref
; /* pref. write transfer size */
142 __u32 wtmult
; /* writes should be multiple of this */
143 __u32 dtpref
; /* pref. readdir transfer size */
145 struct timespec time_delta
; /* server time granularity */
146 __u32 lease_time
; /* in seconds */
147 __u32 nlayouttypes
; /* number of layouttypes */
148 __u32 layouttype
[NFS_MAX_LAYOUT_TYPES
]; /* supported pnfs layout driver */
149 __u32 blksize
; /* preferred pnfs io block size */
150 __u32 clone_blksize
; /* granularity of a CLONE operation */
154 struct nfs_fattr
*fattr
; /* Post-op attributes */
155 __u64 tbytes
; /* total size in bytes */
156 __u64 fbytes
; /* # of free bytes */
157 __u64 abytes
; /* # of bytes available to user */
158 __u64 tfiles
; /* # of files */
159 __u64 ffiles
; /* # of free files */
160 __u64 afiles
; /* # of files available to user */
164 __u32 tsize
; /* Server transfer size */
165 __u32 bsize
; /* Filesystem block size */
166 __u32 blocks
; /* No. of "bsize" blocks on filesystem */
167 __u32 bfree
; /* No. of free "bsize" blocks */
168 __u32 bavail
; /* No. of available "bsize" blocks */
171 struct nfs_pathconf
{
172 struct nfs_fattr
*fattr
; /* Post-op attributes */
173 __u32 max_link
; /* max # of hard links */
174 __u32 max_namelen
; /* max name length */
177 struct nfs4_change_info
{
185 /* nfs41 sessions channel attributes */
186 struct nfs4_channel_attrs
{
189 u32 max_resp_sz_cached
;
195 struct nfs4_sequence_args
{
196 struct nfs4_slot
*sa_slot
;
197 u8 sa_cache_this
: 1,
201 struct nfs4_sequence_res
{
202 struct nfs4_slot
*sr_slot
; /* slot used to send request */
203 unsigned long sr_timestamp
;
204 int sr_status
; /* sequence operation status */
206 u32 sr_highest_slotid
;
207 u32 sr_target_highest_slotid
;
210 struct nfs4_get_lease_time_args
{
211 struct nfs4_sequence_args la_seq_args
;
214 struct nfs4_get_lease_time_res
{
215 struct nfs4_sequence_res lr_seq_res
;
216 struct nfs_fsinfo
*lr_fsinfo
;
219 #define PNFS_LAYOUT_MAXSIZE 4096
221 struct nfs4_layoutdriver_data
{
227 struct pnfs_layout_range
{
233 struct nfs4_layoutget_args
{
234 struct nfs4_sequence_args seq_args
;
236 struct pnfs_layout_range range
;
240 struct nfs_open_context
*ctx
;
241 nfs4_stateid stateid
;
242 struct nfs4_layoutdriver_data layout
;
245 struct nfs4_layoutget_res
{
246 struct nfs4_sequence_res seq_res
;
247 __u32 return_on_close
;
248 struct pnfs_layout_range range
;
250 nfs4_stateid stateid
;
251 struct nfs4_layoutdriver_data
*layoutp
;
254 struct nfs4_layoutget
{
255 struct nfs4_layoutget_args args
;
256 struct nfs4_layoutget_res res
;
257 struct rpc_cred
*cred
;
261 struct nfs4_getdeviceinfo_args
{
262 struct nfs4_sequence_args seq_args
;
263 struct pnfs_device
*pdev
;
267 struct nfs4_getdeviceinfo_res
{
268 struct nfs4_sequence_res seq_res
;
269 struct pnfs_device
*pdev
;
273 struct nfs4_layoutcommit_args
{
274 struct nfs4_sequence_args seq_args
;
275 nfs4_stateid stateid
;
276 __u64 lastbytewritten
;
279 size_t layoutupdate_len
;
280 struct page
*layoutupdate_page
;
281 struct page
**layoutupdate_pages
;
285 struct nfs4_layoutcommit_res
{
286 struct nfs4_sequence_res seq_res
;
287 struct nfs_fattr
*fattr
;
288 const struct nfs_server
*server
;
292 struct nfs4_layoutcommit_data
{
293 struct rpc_task task
;
294 struct nfs_fattr fattr
;
295 struct list_head lseg_list
;
296 struct rpc_cred
*cred
;
298 struct nfs4_layoutcommit_args args
;
299 struct nfs4_layoutcommit_res res
;
302 struct nfs4_layoutreturn_args
{
303 struct nfs4_sequence_args seq_args
;
304 struct pnfs_layout_hdr
*layout
;
306 struct pnfs_layout_range range
;
307 nfs4_stateid stateid
;
311 struct nfs4_layoutreturn_res
{
312 struct nfs4_sequence_res seq_res
;
314 nfs4_stateid stateid
;
317 struct nfs4_layoutreturn
{
318 struct nfs4_layoutreturn_args args
;
319 struct nfs4_layoutreturn_res res
;
320 struct rpc_cred
*cred
;
321 struct nfs_client
*clp
;
326 #define PNFS_LAYOUTSTATS_MAXSIZE 256
328 struct nfs42_layoutstat_args
;
329 struct nfs42_layoutstat_devinfo
;
330 typedef void (*layoutstats_encode_t
)(struct xdr_stream
*,
331 struct nfs42_layoutstat_args
*,
332 struct nfs42_layoutstat_devinfo
*);
334 /* Per file per deviceid layoutstats */
335 struct nfs42_layoutstat_devinfo
{
336 struct nfs4_deviceid dev_id
;
344 layoutstats_encode_t layoutstats_encode
;
345 void *layout_private
;
348 struct nfs42_layoutstat_args
{
349 struct nfs4_sequence_args seq_args
;
352 nfs4_stateid stateid
;
354 struct nfs42_layoutstat_devinfo
*devinfo
;
357 struct nfs42_layoutstat_res
{
358 struct nfs4_sequence_res seq_res
;
363 struct nfs42_layoutstat_data
{
365 struct nfs42_layoutstat_args args
;
366 struct nfs42_layoutstat_res res
;
369 struct nfs42_clone_args
{
370 struct nfs4_sequence_args seq_args
;
371 struct nfs_fh
*src_fh
;
372 struct nfs_fh
*dst_fh
;
373 nfs4_stateid src_stateid
;
374 nfs4_stateid dst_stateid
;
378 const u32
*dst_bitmask
;
381 struct nfs42_clone_res
{
382 struct nfs4_sequence_res seq_res
;
383 unsigned int rpc_status
;
384 struct nfs_fattr
*dst_fattr
;
385 const struct nfs_server
*server
;
388 struct stateowner_id
{
394 * Arguments to the open call.
396 struct nfs_openargs
{
397 struct nfs4_sequence_args seq_args
;
398 const struct nfs_fh
* fh
;
399 struct nfs_seqid
* seqid
;
405 struct stateowner_id id
;
408 struct iattr
* attrs
; /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */
409 nfs4_verifier verifier
; /* EXCLUSIVE */
411 nfs4_stateid delegation
; /* CLAIM_DELEGATE_CUR */
412 fmode_t delegation_type
; /* CLAIM_PREVIOUS */
414 const struct qstr
* name
;
415 const struct nfs_server
*server
; /* Needed for ID mapping */
417 const u32
* open_bitmap
;
418 enum open_claim_type4 claim
;
419 enum createmode4 createmode
;
420 const struct nfs4_label
*label
;
424 struct nfs4_sequence_res seq_res
;
425 nfs4_stateid stateid
;
427 struct nfs4_change_info cinfo
;
429 struct nfs_fattr
* f_attr
;
430 struct nfs4_label
*f_label
;
431 struct nfs_seqid
* seqid
;
432 const struct nfs_server
*server
;
433 fmode_t delegation_type
;
434 nfs4_stateid delegation
;
435 unsigned long pagemod_limit
;
437 __u32 attrset
[NFS4_BITMAP_SIZE
];
438 struct nfs4_string
*owner
;
439 struct nfs4_string
*group_owner
;
440 __u32 access_request
;
441 __u32 access_supported
;
446 * Arguments to the open_confirm call.
448 struct nfs_open_confirmargs
{
449 struct nfs4_sequence_args seq_args
;
450 const struct nfs_fh
* fh
;
451 nfs4_stateid
* stateid
;
452 struct nfs_seqid
* seqid
;
455 struct nfs_open_confirmres
{
456 struct nfs4_sequence_res seq_res
;
457 nfs4_stateid stateid
;
458 struct nfs_seqid
* seqid
;
462 * Arguments to the close call.
464 struct nfs_closeargs
{
465 struct nfs4_sequence_args seq_args
;
467 nfs4_stateid stateid
;
468 struct nfs_seqid
* seqid
;
474 struct nfs_closeres
{
475 struct nfs4_sequence_res seq_res
;
476 nfs4_stateid stateid
;
477 struct nfs_fattr
* fattr
;
478 struct nfs_seqid
* seqid
;
479 const struct nfs_server
*server
;
482 * * Arguments to the lock,lockt, and locku call.
490 struct nfs_lock_args
{
491 struct nfs4_sequence_args seq_args
;
493 struct file_lock
* fl
;
494 struct nfs_seqid
* lock_seqid
;
495 nfs4_stateid lock_stateid
;
496 struct nfs_seqid
* open_seqid
;
497 nfs4_stateid open_stateid
;
498 struct nfs_lowner lock_owner
;
499 unsigned char block
: 1;
500 unsigned char reclaim
: 1;
501 unsigned char new_lock
: 1;
502 unsigned char new_lock_owner
: 1;
505 struct nfs_lock_res
{
506 struct nfs4_sequence_res seq_res
;
507 nfs4_stateid stateid
;
508 struct nfs_seqid
* lock_seqid
;
509 struct nfs_seqid
* open_seqid
;
512 struct nfs_locku_args
{
513 struct nfs4_sequence_args seq_args
;
515 struct file_lock
* fl
;
516 struct nfs_seqid
* seqid
;
517 nfs4_stateid stateid
;
520 struct nfs_locku_res
{
521 struct nfs4_sequence_res seq_res
;
522 nfs4_stateid stateid
;
523 struct nfs_seqid
* seqid
;
526 struct nfs_lockt_args
{
527 struct nfs4_sequence_args seq_args
;
529 struct file_lock
* fl
;
530 struct nfs_lowner lock_owner
;
533 struct nfs_lockt_res
{
534 struct nfs4_sequence_res seq_res
;
535 struct file_lock
* denied
; /* LOCK, LOCKT failed */
538 struct nfs_release_lockowner_args
{
539 struct nfs4_sequence_args seq_args
;
540 struct nfs_lowner lock_owner
;
543 struct nfs_release_lockowner_res
{
544 struct nfs4_sequence_res seq_res
;
547 struct nfs4_delegreturnargs
{
548 struct nfs4_sequence_args seq_args
;
549 const struct nfs_fh
*fhandle
;
550 const nfs4_stateid
*stateid
;
554 struct nfs4_delegreturnres
{
555 struct nfs4_sequence_res seq_res
;
556 struct nfs_fattr
* fattr
;
557 struct nfs_server
*server
;
561 * Arguments to the write call.
563 struct nfs_write_verifier
{
567 struct nfs_writeverf
{
568 struct nfs_write_verifier verifier
;
569 enum nfs3_stable_how committed
;
573 * Arguments shared by the read and write call.
575 struct nfs_pgio_args
{
576 struct nfs4_sequence_args seq_args
;
578 struct nfs_open_context
*context
;
579 struct nfs_lock_context
*lock_context
;
580 nfs4_stateid stateid
;
584 struct page
** pages
;
585 const u32
* bitmask
; /* used by write */
586 enum nfs3_stable_how stable
; /* used by write */
589 struct nfs_pgio_res
{
590 struct nfs4_sequence_res seq_res
;
591 struct nfs_fattr
* fattr
;
594 int eof
; /* used by read */
595 struct nfs_writeverf
* verf
; /* used by write */
596 const struct nfs_server
*server
; /* used by write */
601 * Arguments to the commit call.
603 struct nfs_commitargs
{
604 struct nfs4_sequence_args seq_args
;
611 struct nfs_commitres
{
612 struct nfs4_sequence_res seq_res
;
614 struct nfs_fattr
*fattr
;
615 struct nfs_writeverf
*verf
;
616 const struct nfs_server
*server
;
620 * Common arguments to the unlink call
622 struct nfs_removeargs
{
623 struct nfs4_sequence_args seq_args
;
624 const struct nfs_fh
*fh
;
628 struct nfs_removeres
{
629 struct nfs4_sequence_res seq_res
;
630 struct nfs_server
*server
;
631 struct nfs_fattr
*dir_attr
;
632 struct nfs4_change_info cinfo
;
636 * Common arguments to the rename call
638 struct nfs_renameargs
{
639 struct nfs4_sequence_args seq_args
;
640 const struct nfs_fh
*old_dir
;
641 const struct nfs_fh
*new_dir
;
642 const struct qstr
*old_name
;
643 const struct qstr
*new_name
;
646 struct nfs_renameres
{
647 struct nfs4_sequence_res seq_res
;
648 struct nfs_server
*server
;
649 struct nfs4_change_info old_cinfo
;
650 struct nfs_fattr
*old_fattr
;
651 struct nfs4_change_info new_cinfo
;
652 struct nfs_fattr
*new_fattr
;
655 /* parsed sec= options */
656 #define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
657 struct nfs_auth_info
{
658 unsigned int flavor_len
;
659 rpc_authflavor_t flavors
[NFS_AUTH_INFO_MAX_FLAVORS
];
663 * Argument struct for decode_entry function
673 struct nfs_fattr
* fattr
;
674 struct nfs4_label
*label
;
675 unsigned char d_type
;
676 struct nfs_server
* server
;
680 * The following types are for NFSv2 only.
682 struct nfs_sattrargs
{
684 struct iattr
* sattr
;
687 struct nfs_diropargs
{
693 struct nfs_createargs
{
697 struct iattr
* sattr
;
700 struct nfs_setattrargs
{
701 struct nfs4_sequence_args seq_args
;
703 nfs4_stateid stateid
;
705 const struct nfs_server
* server
; /* Needed for name mapping */
707 const struct nfs4_label
*label
;
710 struct nfs_setaclargs
{
711 struct nfs4_sequence_args seq_args
;
714 struct page
** acl_pages
;
717 struct nfs_setaclres
{
718 struct nfs4_sequence_res seq_res
;
721 struct nfs_getaclargs
{
722 struct nfs4_sequence_args seq_args
;
725 struct page
** acl_pages
;
728 /* getxattr ACL interface flags */
729 #define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
730 struct nfs_getaclres
{
731 struct nfs4_sequence_res seq_res
;
733 size_t acl_data_offset
;
735 struct page
* acl_scratch
;
738 struct nfs_setattrres
{
739 struct nfs4_sequence_res seq_res
;
740 struct nfs_fattr
* fattr
;
741 struct nfs4_label
*label
;
742 const struct nfs_server
* server
;
745 struct nfs_linkargs
{
746 struct nfs_fh
* fromfh
;
747 struct nfs_fh
* tofh
;
752 struct nfs_symlinkargs
{
753 struct nfs_fh
* fromfh
;
754 const char * fromname
;
755 unsigned int fromlen
;
756 struct page
** pages
;
757 unsigned int pathlen
;
758 struct iattr
* sattr
;
761 struct nfs_readdirargs
{
765 struct page
** pages
;
768 struct nfs3_getaclargs
{
771 struct page
** pages
;
774 struct nfs3_setaclargs
{
775 struct inode
* inode
;
777 struct posix_acl
* acl_access
;
778 struct posix_acl
* acl_default
;
781 struct page
** pages
;
786 struct nfs_fattr
* fattr
;
789 struct nfs_readlinkargs
{
793 struct page
** pages
;
796 struct nfs3_sattrargs
{
798 struct iattr
* sattr
;
800 struct timespec guardtime
;
803 struct nfs3_diropargs
{
809 struct nfs3_accessargs
{
814 struct nfs3_createargs
{
818 struct iattr
* sattr
;
819 enum nfs3_createmode createmode
;
823 struct nfs3_mkdirargs
{
827 struct iattr
* sattr
;
830 struct nfs3_symlinkargs
{
831 struct nfs_fh
* fromfh
;
832 const char * fromname
;
833 unsigned int fromlen
;
834 struct page
** pages
;
835 unsigned int pathlen
;
836 struct iattr
* sattr
;
839 struct nfs3_mknodargs
{
843 enum nfs3_ftype type
;
844 struct iattr
* sattr
;
848 struct nfs3_linkargs
{
849 struct nfs_fh
* fromfh
;
850 struct nfs_fh
* tofh
;
855 struct nfs3_readdirargs
{
861 struct page
** pages
;
864 struct nfs3_diropres
{
865 struct nfs_fattr
* dir_attr
;
867 struct nfs_fattr
* fattr
;
870 struct nfs3_accessres
{
871 struct nfs_fattr
* fattr
;
875 struct nfs3_readlinkargs
{
879 struct page
** pages
;
882 struct nfs3_linkres
{
883 struct nfs_fattr
* dir_attr
;
884 struct nfs_fattr
* fattr
;
887 struct nfs3_readdirres
{
888 struct nfs_fattr
* dir_attr
;
893 struct nfs3_getaclres
{
894 struct nfs_fattr
* fattr
;
896 unsigned int acl_access_count
;
897 unsigned int acl_default_count
;
898 struct posix_acl
* acl_access
;
899 struct posix_acl
* acl_default
;
902 #if IS_ENABLED(CONFIG_NFS_V4)
904 typedef u64 clientid4
;
906 struct nfs4_accessargs
{
907 struct nfs4_sequence_args seq_args
;
908 const struct nfs_fh
* fh
;
913 struct nfs4_accessres
{
914 struct nfs4_sequence_res seq_res
;
915 const struct nfs_server
* server
;
916 struct nfs_fattr
* fattr
;
921 struct nfs4_create_arg
{
922 struct nfs4_sequence_args seq_args
;
926 struct page
** pages
;
928 } symlink
; /* NF4LNK */
932 } device
; /* NF4BLK, NF4CHR */
934 const struct qstr
* name
;
935 const struct nfs_server
* server
;
936 const struct iattr
* attrs
;
937 const struct nfs_fh
* dir_fh
;
939 const struct nfs4_label
*label
;
942 struct nfs4_create_res
{
943 struct nfs4_sequence_res seq_res
;
944 const struct nfs_server
* server
;
946 struct nfs_fattr
* fattr
;
947 struct nfs4_label
*label
;
948 struct nfs4_change_info dir_cinfo
;
951 struct nfs4_fsinfo_arg
{
952 struct nfs4_sequence_args seq_args
;
953 const struct nfs_fh
* fh
;
957 struct nfs4_fsinfo_res
{
958 struct nfs4_sequence_res seq_res
;
959 struct nfs_fsinfo
*fsinfo
;
962 struct nfs4_getattr_arg
{
963 struct nfs4_sequence_args seq_args
;
964 const struct nfs_fh
* fh
;
968 struct nfs4_getattr_res
{
969 struct nfs4_sequence_res seq_res
;
970 const struct nfs_server
* server
;
971 struct nfs_fattr
* fattr
;
972 struct nfs4_label
*label
;
975 struct nfs4_link_arg
{
976 struct nfs4_sequence_args seq_args
;
977 const struct nfs_fh
* fh
;
978 const struct nfs_fh
* dir_fh
;
979 const struct qstr
* name
;
983 struct nfs4_link_res
{
984 struct nfs4_sequence_res seq_res
;
985 const struct nfs_server
* server
;
986 struct nfs_fattr
* fattr
;
987 struct nfs4_label
*label
;
988 struct nfs4_change_info cinfo
;
989 struct nfs_fattr
* dir_attr
;
993 struct nfs4_lookup_arg
{
994 struct nfs4_sequence_args seq_args
;
995 const struct nfs_fh
* dir_fh
;
996 const struct qstr
* name
;
1000 struct nfs4_lookup_res
{
1001 struct nfs4_sequence_res seq_res
;
1002 const struct nfs_server
* server
;
1003 struct nfs_fattr
* fattr
;
1005 struct nfs4_label
*label
;
1008 struct nfs4_lookup_root_arg
{
1009 struct nfs4_sequence_args seq_args
;
1010 const u32
* bitmask
;
1013 struct nfs4_pathconf_arg
{
1014 struct nfs4_sequence_args seq_args
;
1015 const struct nfs_fh
* fh
;
1016 const u32
* bitmask
;
1019 struct nfs4_pathconf_res
{
1020 struct nfs4_sequence_res seq_res
;
1021 struct nfs_pathconf
*pathconf
;
1024 struct nfs4_readdir_arg
{
1025 struct nfs4_sequence_args seq_args
;
1026 const struct nfs_fh
* fh
;
1028 nfs4_verifier verifier
;
1030 struct page
** pages
; /* zero-copy data */
1031 unsigned int pgbase
; /* zero-copy data */
1032 const u32
* bitmask
;
1036 struct nfs4_readdir_res
{
1037 struct nfs4_sequence_res seq_res
;
1038 nfs4_verifier verifier
;
1039 unsigned int pgbase
;
1042 struct nfs4_readlink
{
1043 struct nfs4_sequence_args seq_args
;
1044 const struct nfs_fh
* fh
;
1045 unsigned int pgbase
;
1046 unsigned int pglen
; /* zero-copy data */
1047 struct page
** pages
; /* zero-copy data */
1050 struct nfs4_readlink_res
{
1051 struct nfs4_sequence_res seq_res
;
1054 struct nfs4_setclientid
{
1055 const nfs4_verifier
* sc_verifier
;
1057 unsigned int sc_netid_len
;
1058 char sc_netid
[RPCBIND_MAXNETIDLEN
+ 1];
1059 unsigned int sc_uaddr_len
;
1060 char sc_uaddr
[RPCBIND_MAXUADDRLEN
+ 1];
1061 struct nfs_client
*sc_clnt
;
1062 struct rpc_cred
*sc_cred
;
1065 struct nfs4_setclientid_res
{
1067 nfs4_verifier confirm
;
1070 struct nfs4_statfs_arg
{
1071 struct nfs4_sequence_args seq_args
;
1072 const struct nfs_fh
* fh
;
1073 const u32
* bitmask
;
1076 struct nfs4_statfs_res
{
1077 struct nfs4_sequence_res seq_res
;
1078 struct nfs_fsstat
*fsstat
;
1081 struct nfs4_server_caps_arg
{
1082 struct nfs4_sequence_args seq_args
;
1083 struct nfs_fh
*fhandle
;
1084 const u32
* bitmask
;
1087 struct nfs4_server_caps_res
{
1088 struct nfs4_sequence_res seq_res
;
1089 u32 attr_bitmask
[3];
1090 u32 exclcreat_bitmask
[3];
1097 #define NFS4_PATHNAME_MAXCOMPONENTS 512
1098 struct nfs4_pathname
{
1099 unsigned int ncomponents
;
1100 struct nfs4_string components
[NFS4_PATHNAME_MAXCOMPONENTS
];
1103 #define NFS4_FS_LOCATION_MAXSERVERS 10
1104 struct nfs4_fs_location
{
1105 unsigned int nservers
;
1106 struct nfs4_string servers
[NFS4_FS_LOCATION_MAXSERVERS
];
1107 struct nfs4_pathname rootpath
;
1110 #define NFS4_FS_LOCATIONS_MAXENTRIES 10
1111 struct nfs4_fs_locations
{
1112 struct nfs_fattr fattr
;
1113 const struct nfs_server
*server
;
1114 struct nfs4_pathname fs_path
;
1116 struct nfs4_fs_location locations
[NFS4_FS_LOCATIONS_MAXENTRIES
];
1119 struct nfs4_fs_locations_arg
{
1120 struct nfs4_sequence_args seq_args
;
1121 const struct nfs_fh
*dir_fh
;
1122 const struct nfs_fh
*fh
;
1123 const struct qstr
*name
;
1127 unsigned char migration
:1, renew
:1;
1130 struct nfs4_fs_locations_res
{
1131 struct nfs4_sequence_res seq_res
;
1132 struct nfs4_fs_locations
*fs_locations
;
1133 unsigned char migration
:1, renew
:1;
1136 struct nfs4_secinfo4
{
1138 struct rpcsec_gss_info flavor_info
;
1141 struct nfs4_secinfo_flavors
{
1142 unsigned int num_flavors
;
1143 struct nfs4_secinfo4 flavors
[0];
1146 struct nfs4_secinfo_arg
{
1147 struct nfs4_sequence_args seq_args
;
1148 const struct nfs_fh
*dir_fh
;
1149 const struct qstr
*name
;
1152 struct nfs4_secinfo_res
{
1153 struct nfs4_sequence_res seq_res
;
1154 struct nfs4_secinfo_flavors
*flavors
;
1157 struct nfs4_fsid_present_arg
{
1158 struct nfs4_sequence_args seq_args
;
1159 const struct nfs_fh
*fh
;
1161 unsigned char renew
:1;
1164 struct nfs4_fsid_present_res
{
1165 struct nfs4_sequence_res seq_res
;
1167 unsigned char renew
:1;
1170 #endif /* CONFIG_NFS_V4 */
1177 #ifdef CONFIG_NFS_V4_1
1179 struct pnfs_commit_bucket
{
1180 struct list_head written
;
1181 struct list_head committing
;
1182 struct pnfs_layout_segment
*wlseg
;
1183 struct pnfs_layout_segment
*clseg
;
1184 struct nfs_writeverf direct_verf
;
1187 struct pnfs_ds_commit_info
{
1191 struct pnfs_commit_bucket
*buckets
;
1194 struct nfs41_state_protection
{
1196 struct nfs4_op_map enforce
;
1197 struct nfs4_op_map allow
;
1200 struct nfs41_exchange_id_args
{
1201 struct nfs_client
*client
;
1202 nfs4_verifier
*verifier
;
1204 struct nfs41_state_protection state_protect
;
1207 struct nfs41_server_owner
{
1209 uint32_t major_id_sz
;
1210 char major_id
[NFS4_OPAQUE_LIMIT
];
1213 struct nfs41_server_scope
{
1214 uint32_t server_scope_sz
;
1215 char server_scope
[NFS4_OPAQUE_LIMIT
];
1218 struct nfs41_impl_id
{
1219 char domain
[NFS4_OPAQUE_LIMIT
+ 1];
1220 char name
[NFS4_OPAQUE_LIMIT
+ 1];
1221 struct nfstime4 date
;
1224 struct nfs41_bind_conn_to_session_args
{
1225 struct nfs_client
*client
;
1226 struct nfs4_sessionid sessionid
;
1228 bool use_conn_in_rdma_mode
;
1231 struct nfs41_bind_conn_to_session_res
{
1232 struct nfs4_sessionid sessionid
;
1234 bool use_conn_in_rdma_mode
;
1237 struct nfs41_exchange_id_res
{
1241 struct nfs41_server_owner
*server_owner
;
1242 struct nfs41_server_scope
*server_scope
;
1243 struct nfs41_impl_id
*impl_id
;
1244 struct nfs41_state_protection state_protect
;
1247 struct nfs41_create_session_args
{
1248 struct nfs_client
*client
;
1252 uint32_t cb_program
;
1253 struct nfs4_channel_attrs fc_attrs
; /* Fore Channel */
1254 struct nfs4_channel_attrs bc_attrs
; /* Back Channel */
1257 struct nfs41_create_session_res
{
1258 struct nfs4_sessionid sessionid
;
1261 struct nfs4_channel_attrs fc_attrs
; /* Fore Channel */
1262 struct nfs4_channel_attrs bc_attrs
; /* Back Channel */
1265 struct nfs41_reclaim_complete_args
{
1266 struct nfs4_sequence_args seq_args
;
1267 /* In the future extend to include curr_fh for use with migration */
1268 unsigned char one_fs
:1;
1271 struct nfs41_reclaim_complete_res
{
1272 struct nfs4_sequence_res seq_res
;
1275 #define SECINFO_STYLE_CURRENT_FH 0
1276 #define SECINFO_STYLE_PARENT 1
1277 struct nfs41_secinfo_no_name_args
{
1278 struct nfs4_sequence_args seq_args
;
1282 struct nfs41_test_stateid_args
{
1283 struct nfs4_sequence_args seq_args
;
1284 nfs4_stateid
*stateid
;
1287 struct nfs41_test_stateid_res
{
1288 struct nfs4_sequence_res seq_res
;
1289 unsigned int status
;
1292 struct nfs41_free_stateid_args
{
1293 struct nfs4_sequence_args seq_args
;
1294 nfs4_stateid stateid
;
1297 struct nfs41_free_stateid_res
{
1298 struct nfs4_sequence_res seq_res
;
1299 unsigned int status
;
1303 nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info
*cinfo
)
1305 kfree(cinfo
->buckets
);
1310 struct pnfs_ds_commit_info
{
1314 nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info
*cinfo
)
1318 #endif /* CONFIG_NFS_V4_1 */
1320 #ifdef CONFIG_NFS_V4_2
1321 struct nfs42_falloc_args
{
1322 struct nfs4_sequence_args seq_args
;
1324 struct nfs_fh
*falloc_fh
;
1325 nfs4_stateid falloc_stateid
;
1328 const u32
*falloc_bitmask
;
1331 struct nfs42_falloc_res
{
1332 struct nfs4_sequence_res seq_res
;
1333 unsigned int status
;
1335 struct nfs_fattr
*falloc_fattr
;
1336 const struct nfs_server
*falloc_server
;
1339 struct nfs42_copy_args
{
1340 struct nfs4_sequence_args seq_args
;
1342 struct nfs_fh
*src_fh
;
1343 nfs4_stateid src_stateid
;
1346 struct nfs_fh
*dst_fh
;
1347 nfs4_stateid dst_stateid
;
1353 struct nfs42_write_res
{
1355 struct nfs_writeverf verifier
;
1358 struct nfs42_copy_res
{
1359 struct nfs4_sequence_res seq_res
;
1360 struct nfs42_write_res write_res
;
1365 struct nfs42_seek_args
{
1366 struct nfs4_sequence_args seq_args
;
1368 struct nfs_fh
*sa_fh
;
1369 nfs4_stateid sa_stateid
;
1374 struct nfs42_seek_res
{
1375 struct nfs4_sequence_res seq_res
;
1376 unsigned int status
;
1385 #define NFS_PAGEVEC_SIZE (8U)
1387 struct nfs_page_array
{
1388 struct page
**pagevec
;
1389 unsigned int npages
; /* Max length of pagevec */
1390 struct page
*page_array
[NFS_PAGEVEC_SIZE
];
1393 /* used as flag bits in nfs_pgio_header */
1395 NFS_IOHDR_ERROR
= 0,
1401 struct nfs_pgio_header
{
1402 struct inode
*inode
;
1403 struct rpc_cred
*cred
;
1404 struct list_head pages
;
1405 struct nfs_page
*req
;
1406 struct nfs_writeverf verf
; /* Used for writes */
1407 struct pnfs_layout_segment
*lseg
;
1409 const struct rpc_call_ops
*mds_ops
;
1410 void (*release
) (struct nfs_pgio_header
*hdr
);
1411 const struct nfs_pgio_completion_ops
*completion_ops
;
1412 const struct nfs_rw_ops
*rw_ops
;
1413 struct nfs_direct_req
*dreq
;
1414 void *layout_private
;
1416 /* fields protected by lock */
1418 int error
; /* merge with pnfs_error */
1419 unsigned long good_bytes
; /* boundary of good data */
1420 unsigned long flags
;
1425 struct rpc_task task
;
1426 struct nfs_fattr fattr
;
1427 struct nfs_pgio_args args
; /* argument struct */
1428 struct nfs_pgio_res res
; /* result struct */
1429 unsigned long timestamp
; /* For lease renewal */
1430 int (*pgio_done_cb
)(struct rpc_task
*, struct nfs_pgio_header
*);
1431 __u64 mds_offset
; /* Filelayout dense stripe */
1432 struct nfs_page_array page_array
;
1433 struct nfs_client
*ds_clp
; /* pNFS data server */
1434 int ds_commit_idx
; /* ds index if ds_clp is set */
1435 int pgio_mirror_idx
;/* mirror index in pgio layer */
1438 struct nfs_mds_commit_info
{
1440 unsigned long ncommit
;
1441 struct list_head list
;
1444 struct nfs_commit_info
;
1445 struct nfs_commit_data
;
1447 struct nfs_commit_completion_ops
{
1448 void (*completion
) (struct nfs_commit_data
*data
);
1449 void (*resched_write
) (struct nfs_commit_info
*, struct nfs_page
*);
1452 struct nfs_commit_info
{
1453 struct inode
*inode
; /* Needed for inode->i_lock */
1454 struct nfs_mds_commit_info
*mds
;
1455 struct pnfs_ds_commit_info
*ds
;
1456 struct nfs_direct_req
*dreq
; /* O_DIRECT request */
1457 const struct nfs_commit_completion_ops
*completion_ops
;
1460 struct nfs_commit_data
{
1461 struct rpc_task task
;
1462 struct inode
*inode
;
1463 struct rpc_cred
*cred
;
1464 struct nfs_fattr fattr
;
1465 struct nfs_writeverf verf
;
1466 struct list_head pages
; /* Coalesced requests we wish to flush */
1467 struct list_head list
; /* lists of struct nfs_write_data */
1468 struct nfs_direct_req
*dreq
; /* O_DIRECT request */
1469 struct nfs_commitargs args
; /* argument struct */
1470 struct nfs_commitres res
; /* result struct */
1471 struct nfs_open_context
*context
;
1472 struct pnfs_layout_segment
*lseg
;
1473 struct nfs_client
*ds_clp
; /* pNFS data server */
1474 int ds_commit_index
;
1476 const struct rpc_call_ops
*mds_ops
;
1477 const struct nfs_commit_completion_ops
*completion_ops
;
1478 int (*commit_done_cb
) (struct rpc_task
*task
, struct nfs_commit_data
*data
);
1479 unsigned long flags
;
1482 struct nfs_pgio_completion_ops
{
1483 void (*error_cleanup
)(struct list_head
*head
);
1484 void (*init_hdr
)(struct nfs_pgio_header
*hdr
);
1485 void (*completion
)(struct nfs_pgio_header
*hdr
);
1486 void (*reschedule_io
)(struct nfs_pgio_header
*hdr
);
1489 struct nfs_unlinkdata
{
1490 struct nfs_removeargs args
;
1491 struct nfs_removeres res
;
1492 struct dentry
*dentry
;
1493 wait_queue_head_t wq
;
1494 struct rpc_cred
*cred
;
1495 struct nfs_fattr dir_attr
;
1499 struct nfs_renamedata
{
1500 struct nfs_renameargs args
;
1501 struct nfs_renameres res
;
1502 struct rpc_cred
*cred
;
1503 struct inode
*old_dir
;
1504 struct dentry
*old_dentry
;
1505 struct nfs_fattr old_fattr
;
1506 struct inode
*new_dir
;
1507 struct dentry
*new_dentry
;
1508 struct nfs_fattr new_fattr
;
1509 void (*complete
)(struct rpc_task
*, struct nfs_renamedata
*);
1513 struct nfs_access_entry
;
1516 struct nfs_subversion
;
1517 struct nfs_mount_info
;
1518 struct nfs_client_initdata
;
1519 struct nfs_pageio_descriptor
;
1522 * RPC procedure vector for NFSv2/NFSv3 demuxing
1524 struct nfs_rpc_ops
{
1525 u32 version
; /* Protocol version */
1526 const struct dentry_operations
*dentry_ops
;
1527 const struct inode_operations
*dir_inode_ops
;
1528 const struct inode_operations
*file_inode_ops
;
1529 const struct file_operations
*file_ops
;
1531 int (*getroot
) (struct nfs_server
*, struct nfs_fh
*,
1532 struct nfs_fsinfo
*);
1533 struct vfsmount
*(*submount
) (struct nfs_server
*, struct dentry
*,
1534 struct nfs_fh
*, struct nfs_fattr
*);
1535 struct dentry
*(*try_mount
) (int, const char *, struct nfs_mount_info
*,
1536 struct nfs_subversion
*);
1537 int (*getattr
) (struct nfs_server
*, struct nfs_fh
*,
1538 struct nfs_fattr
*, struct nfs4_label
*);
1539 int (*setattr
) (struct dentry
*, struct nfs_fattr
*,
1541 int (*lookup
) (struct inode
*, const struct qstr
*,
1542 struct nfs_fh
*, struct nfs_fattr
*,
1543 struct nfs4_label
*);
1544 int (*access
) (struct inode
*, struct nfs_access_entry
*);
1545 int (*readlink
)(struct inode
*, struct page
*, unsigned int,
1547 int (*create
) (struct inode
*, struct dentry
*,
1548 struct iattr
*, int);
1549 int (*remove
) (struct inode
*, const struct qstr
*);
1550 void (*unlink_setup
) (struct rpc_message
*, struct inode
*dir
);
1551 void (*unlink_rpc_prepare
) (struct rpc_task
*, struct nfs_unlinkdata
*);
1552 int (*unlink_done
) (struct rpc_task
*, struct inode
*);
1553 void (*rename_setup
) (struct rpc_message
*msg
, struct inode
*dir
);
1554 void (*rename_rpc_prepare
)(struct rpc_task
*task
, struct nfs_renamedata
*);
1555 int (*rename_done
) (struct rpc_task
*task
, struct inode
*old_dir
, struct inode
*new_dir
);
1556 int (*link
) (struct inode
*, struct inode
*, const struct qstr
*);
1557 int (*symlink
) (struct inode
*, struct dentry
*, struct page
*,
1558 unsigned int, struct iattr
*);
1559 int (*mkdir
) (struct inode
*, struct dentry
*, struct iattr
*);
1560 int (*rmdir
) (struct inode
*, const struct qstr
*);
1561 int (*readdir
) (struct dentry
*, struct rpc_cred
*,
1562 u64
, struct page
**, unsigned int, int);
1563 int (*mknod
) (struct inode
*, struct dentry
*, struct iattr
*,
1565 int (*statfs
) (struct nfs_server
*, struct nfs_fh
*,
1566 struct nfs_fsstat
*);
1567 int (*fsinfo
) (struct nfs_server
*, struct nfs_fh
*,
1568 struct nfs_fsinfo
*);
1569 int (*pathconf
) (struct nfs_server
*, struct nfs_fh
*,
1570 struct nfs_pathconf
*);
1571 int (*set_capabilities
)(struct nfs_server
*, struct nfs_fh
*);
1572 int (*decode_dirent
)(struct xdr_stream
*, struct nfs_entry
*, int);
1573 int (*pgio_rpc_prepare
)(struct rpc_task
*,
1574 struct nfs_pgio_header
*);
1575 void (*read_setup
)(struct nfs_pgio_header
*, struct rpc_message
*);
1576 int (*read_done
)(struct rpc_task
*, struct nfs_pgio_header
*);
1577 void (*write_setup
)(struct nfs_pgio_header
*, struct rpc_message
*);
1578 int (*write_done
)(struct rpc_task
*, struct nfs_pgio_header
*);
1579 void (*commit_setup
) (struct nfs_commit_data
*, struct rpc_message
*);
1580 void (*commit_rpc_prepare
)(struct rpc_task
*, struct nfs_commit_data
*);
1581 int (*commit_done
) (struct rpc_task
*, struct nfs_commit_data
*);
1582 int (*lock
)(struct file
*, int, struct file_lock
*);
1583 int (*lock_check_bounds
)(const struct file_lock
*);
1584 void (*clear_acl_cache
)(struct inode
*);
1585 void (*close_context
)(struct nfs_open_context
*ctx
, int);
1586 struct inode
* (*open_context
) (struct inode
*dir
,
1587 struct nfs_open_context
*ctx
,
1589 struct iattr
*iattr
,
1591 int (*have_delegation
)(struct inode
*, fmode_t
);
1592 int (*return_delegation
)(struct inode
*);
1593 struct nfs_client
*(*alloc_client
) (const struct nfs_client_initdata
*);
1594 struct nfs_client
*(*init_client
) (struct nfs_client
*,
1595 const struct nfs_client_initdata
*);
1596 void (*free_client
) (struct nfs_client
*);
1597 struct nfs_server
*(*create_server
)(struct nfs_mount_info
*, struct nfs_subversion
*);
1598 struct nfs_server
*(*clone_server
)(struct nfs_server
*, struct nfs_fh
*,
1599 struct nfs_fattr
*, rpc_authflavor_t
);
1603 * NFS_CALL(getattr, inode, (fattr));
1605 * NFS_PROTO(inode)->getattr(fattr);
1607 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1610 * Function vectors etc. for the NFS client
1612 extern const struct nfs_rpc_ops nfs_v2_clientops
;
1613 extern const struct nfs_rpc_ops nfs_v3_clientops
;
1614 extern const struct nfs_rpc_ops nfs_v4_clientops
;
1615 extern const struct rpc_version nfs_version2
;
1616 extern const struct rpc_version nfs_version3
;
1617 extern const struct rpc_version nfs_version4
;
1619 extern const struct rpc_version nfsacl_version3
;
1620 extern const struct rpc_program nfsacl_program
;