1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_NFS_XDR_H
3 #define _LINUX_NFS_XDR_H
5 #include <linux/nfsacl.h>
6 #include <linux/sunrpc/gss_api.h>
9 * To change the maximum rsize and wsize supported by the NFS client, adjust
10 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
11 * support a megabyte or more. The default is left at 4096 bytes, which is
12 * reasonable for NFS over UDP.
14 #define NFS_MAX_FILE_IO_SIZE (1048576U)
15 #define NFS_DEF_FILE_IO_SIZE (4096U)
16 #define NFS_MIN_FILE_IO_SIZE (1024U)
29 * Helper for checking equality between 2 fsids.
31 static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
33 return a->major == b->major && a->minor == b->minor;
36 struct nfs4_threshold {
46 unsigned int valid; /* which fields are valid */
64 __u64 mounted_on_fileid;
65 struct timespec64 atime;
66 struct timespec64 mtime;
67 struct timespec64 ctime;
68 __u64 change_attr; /* NFSv4 change attribute */
69 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
70 __u64 pre_size; /* pre_op_attr.size */
71 struct timespec64 pre_mtime; /* pre_op_attr.mtime */
72 struct timespec64 pre_ctime; /* pre_op_attr.ctime */
73 unsigned long time_start;
74 unsigned long gencount;
75 struct nfs4_string *owner_name;
76 struct nfs4_string *group_name;
77 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
78 struct nfs4_label *label;
81 #define NFS_ATTR_FATTR_TYPE (1U << 0)
82 #define NFS_ATTR_FATTR_MODE (1U << 1)
83 #define NFS_ATTR_FATTR_NLINK (1U << 2)
84 #define NFS_ATTR_FATTR_OWNER (1U << 3)
85 #define NFS_ATTR_FATTR_GROUP (1U << 4)
86 #define NFS_ATTR_FATTR_RDEV (1U << 5)
87 #define NFS_ATTR_FATTR_SIZE (1U << 6)
88 #define NFS_ATTR_FATTR_PRESIZE (1U << 7)
89 #define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
90 #define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
91 #define NFS_ATTR_FATTR_FSID (1U << 10)
92 #define NFS_ATTR_FATTR_FILEID (1U << 11)
93 #define NFS_ATTR_FATTR_ATIME (1U << 12)
94 #define NFS_ATTR_FATTR_MTIME (1U << 13)
95 #define NFS_ATTR_FATTR_CTIME (1U << 14)
96 #define NFS_ATTR_FATTR_PREMTIME (1U << 15)
97 #define NFS_ATTR_FATTR_PRECTIME (1U << 16)
98 #define NFS_ATTR_FATTR_CHANGE (1U << 17)
99 #define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
100 #define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
101 #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
102 #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
103 #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
104 #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
105 #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
106 #define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
108 #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
109 | NFS_ATTR_FATTR_MODE \
110 | NFS_ATTR_FATTR_NLINK \
111 | NFS_ATTR_FATTR_OWNER \
112 | NFS_ATTR_FATTR_GROUP \
113 | NFS_ATTR_FATTR_RDEV \
114 | NFS_ATTR_FATTR_SIZE \
115 | NFS_ATTR_FATTR_FSID \
116 | NFS_ATTR_FATTR_FILEID \
117 | NFS_ATTR_FATTR_ATIME \
118 | NFS_ATTR_FATTR_MTIME \
119 | NFS_ATTR_FATTR_CTIME \
120 | NFS_ATTR_FATTR_CHANGE)
121 #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
122 | NFS_ATTR_FATTR_BLOCKS_USED)
123 #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
124 | NFS_ATTR_FATTR_SPACE_USED)
125 #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
126 | NFS_ATTR_FATTR_SPACE_USED \
127 | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
130 * Maximal number of supported layout drivers.
132 #define NFS_MAX_LAYOUT_TYPES 8
135 * Info on the file system
138 struct nfs_fattr *fattr; /* Post-op attributes */
139 __u32 rtmax; /* max. read transfer size */
140 __u32 rtpref; /* pref. read transfer size */
141 __u32 rtmult; /* reads should be multiple of this */
142 __u32 wtmax; /* max. write transfer size */
143 __u32 wtpref; /* pref. write transfer size */
144 __u32 wtmult; /* writes should be multiple of this */
145 __u32 dtpref; /* pref. readdir transfer size */
147 struct timespec64 time_delta; /* server time granularity */
148 __u32 lease_time; /* in seconds */
149 __u32 nlayouttypes; /* number of layouttypes */
150 __u32 layouttype[NFS_MAX_LAYOUT_TYPES]; /* supported pnfs layout driver */
151 __u32 blksize; /* preferred pnfs io block size */
152 __u32 clone_blksize; /* granularity of a CLONE operation */
153 __u32 xattr_support; /* User xattrs supported */
157 struct nfs_fattr *fattr; /* Post-op attributes */
158 __u64 tbytes; /* total size in bytes */
159 __u64 fbytes; /* # of free bytes */
160 __u64 abytes; /* # of bytes available to user */
161 __u64 tfiles; /* # of files */
162 __u64 ffiles; /* # of free files */
163 __u64 afiles; /* # of files available to user */
167 __u32 tsize; /* Server transfer size */
168 __u32 bsize; /* Filesystem block size */
169 __u32 blocks; /* No. of "bsize" blocks on filesystem */
170 __u32 bfree; /* No. of free "bsize" blocks */
171 __u32 bavail; /* No. of available "bsize" blocks */
174 struct nfs_pathconf {
175 struct nfs_fattr *fattr; /* Post-op attributes */
176 __u32 max_link; /* max # of hard links */
177 __u32 max_namelen; /* max name length */
180 struct nfs4_change_info {
188 /* nfs41 sessions channel attributes */
189 struct nfs4_channel_attrs {
192 u32 max_resp_sz_cached;
198 struct nfs4_sequence_args {
199 struct nfs4_slot *sa_slot;
200 u8 sa_cache_this : 1,
204 struct nfs4_sequence_res {
205 struct nfs4_slot *sr_slot; /* slot used to send request */
206 unsigned long sr_timestamp;
207 int sr_status; /* sequence operation status */
209 u32 sr_highest_slotid;
210 u32 sr_target_highest_slotid;
213 struct nfs4_get_lease_time_args {
214 struct nfs4_sequence_args la_seq_args;
217 struct nfs4_get_lease_time_res {
218 struct nfs4_sequence_res lr_seq_res;
219 struct nfs_fsinfo *lr_fsinfo;
223 struct nfs4_xdr_opaque_data;
225 struct nfs4_xdr_opaque_ops {
226 void (*encode)(struct xdr_stream *, const void *args,
227 const struct nfs4_xdr_opaque_data *);
228 void (*free)(struct nfs4_xdr_opaque_data *);
231 struct nfs4_xdr_opaque_data {
232 const struct nfs4_xdr_opaque_ops *ops;
236 #define PNFS_LAYOUT_MAXSIZE 4096
238 struct nfs4_layoutdriver_data {
244 struct pnfs_layout_range {
250 struct nfs4_layoutget_args {
251 struct nfs4_sequence_args seq_args;
253 struct pnfs_layout_range range;
257 struct nfs_open_context *ctx;
258 nfs4_stateid stateid;
259 struct nfs4_layoutdriver_data layout;
262 struct nfs4_layoutget_res {
263 struct nfs4_sequence_res seq_res;
265 __u32 return_on_close;
266 struct pnfs_layout_range range;
268 nfs4_stateid stateid;
269 struct nfs4_layoutdriver_data *layoutp;
272 struct nfs4_layoutget {
273 struct nfs4_layoutget_args args;
274 struct nfs4_layoutget_res res;
275 const struct cred *cred;
279 struct nfs4_getdeviceinfo_args {
280 struct nfs4_sequence_args seq_args;
281 struct pnfs_device *pdev;
285 struct nfs4_getdeviceinfo_res {
286 struct nfs4_sequence_res seq_res;
287 struct pnfs_device *pdev;
291 struct nfs4_layoutcommit_args {
292 struct nfs4_sequence_args seq_args;
293 nfs4_stateid stateid;
294 __u64 lastbytewritten;
297 size_t layoutupdate_len;
298 struct page *layoutupdate_page;
299 struct page **layoutupdate_pages;
303 struct nfs4_layoutcommit_res {
304 struct nfs4_sequence_res seq_res;
305 struct nfs_fattr *fattr;
306 const struct nfs_server *server;
310 struct nfs4_layoutcommit_data {
311 struct rpc_task task;
312 struct nfs_fattr fattr;
313 struct list_head lseg_list;
314 const struct cred *cred;
316 struct nfs4_layoutcommit_args args;
317 struct nfs4_layoutcommit_res res;
320 struct nfs4_layoutreturn_args {
321 struct nfs4_sequence_args seq_args;
322 struct pnfs_layout_hdr *layout;
324 struct pnfs_layout_range range;
325 nfs4_stateid stateid;
327 struct nfs4_xdr_opaque_data *ld_private;
330 struct nfs4_layoutreturn_res {
331 struct nfs4_sequence_res seq_res;
333 nfs4_stateid stateid;
336 struct nfs4_layoutreturn {
337 struct nfs4_layoutreturn_args args;
338 struct nfs4_layoutreturn_res res;
339 const struct cred *cred;
340 struct nfs_client *clp;
343 struct nfs4_xdr_opaque_data ld_private;
346 #define PNFS_LAYOUTSTATS_MAXSIZE 256
348 struct nfs42_layoutstat_args;
349 struct nfs42_layoutstat_devinfo;
350 typedef void (*layoutstats_encode_t)(struct xdr_stream *,
351 struct nfs42_layoutstat_args *,
352 struct nfs42_layoutstat_devinfo *);
354 /* Per file per deviceid layoutstats */
355 struct nfs42_layoutstat_devinfo {
356 struct nfs4_deviceid dev_id;
364 struct nfs4_xdr_opaque_data ld_private;
367 struct nfs42_layoutstat_args {
368 struct nfs4_sequence_args seq_args;
371 nfs4_stateid stateid;
373 struct nfs42_layoutstat_devinfo *devinfo;
376 struct nfs42_layoutstat_res {
377 struct nfs4_sequence_res seq_res;
382 struct nfs42_layoutstat_data {
384 struct nfs42_layoutstat_args args;
385 struct nfs42_layoutstat_res res;
388 struct nfs42_device_error {
389 struct nfs4_deviceid dev_id;
391 enum nfs_opnum4 opnum;
394 struct nfs42_layout_error {
397 nfs4_stateid stateid;
398 struct nfs42_device_error errors[1];
401 #define NFS42_LAYOUTERROR_MAX 5
403 struct nfs42_layouterror_args {
404 struct nfs4_sequence_args seq_args;
406 unsigned int num_errors;
407 struct nfs42_layout_error errors[NFS42_LAYOUTERROR_MAX];
410 struct nfs42_layouterror_res {
411 struct nfs4_sequence_res seq_res;
412 unsigned int num_errors;
416 struct nfs42_layouterror_data {
417 struct nfs42_layouterror_args args;
418 struct nfs42_layouterror_res res;
420 struct pnfs_layout_segment *lseg;
423 struct nfs42_clone_args {
424 struct nfs4_sequence_args seq_args;
425 struct nfs_fh *src_fh;
426 struct nfs_fh *dst_fh;
427 nfs4_stateid src_stateid;
428 nfs4_stateid dst_stateid;
432 const u32 *dst_bitmask;
435 struct nfs42_clone_res {
436 struct nfs4_sequence_res seq_res;
437 unsigned int rpc_status;
438 struct nfs_fattr *dst_fattr;
439 const struct nfs_server *server;
442 struct stateowner_id {
448 * Arguments to the open call.
450 struct nfs_openargs {
451 struct nfs4_sequence_args seq_args;
452 const struct nfs_fh * fh;
453 struct nfs_seqid * seqid;
459 struct stateowner_id id;
462 struct iattr * attrs; /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */
463 nfs4_verifier verifier; /* EXCLUSIVE */
465 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
466 fmode_t delegation_type; /* CLAIM_PREVIOUS */
468 const struct qstr * name;
469 const struct nfs_server *server; /* Needed for ID mapping */
471 const u32 * open_bitmap;
472 enum open_claim_type4 claim;
473 enum createmode4 createmode;
474 const struct nfs4_label *label;
476 struct nfs4_layoutget_args *lg_args;
480 struct nfs4_sequence_res seq_res;
481 nfs4_stateid stateid;
483 struct nfs4_change_info cinfo;
485 struct nfs_fattr * f_attr;
486 struct nfs4_label *f_label;
487 struct nfs_seqid * seqid;
488 const struct nfs_server *server;
489 fmode_t delegation_type;
490 nfs4_stateid delegation;
491 unsigned long pagemod_limit;
493 __u32 attrset[NFS4_BITMAP_SIZE];
494 struct nfs4_string *owner;
495 struct nfs4_string *group_owner;
496 __u32 access_request;
497 __u32 access_supported;
499 struct nfs4_layoutget_res *lg_res;
503 * Arguments to the open_confirm call.
505 struct nfs_open_confirmargs {
506 struct nfs4_sequence_args seq_args;
507 const struct nfs_fh * fh;
508 nfs4_stateid * stateid;
509 struct nfs_seqid * seqid;
512 struct nfs_open_confirmres {
513 struct nfs4_sequence_res seq_res;
514 nfs4_stateid stateid;
515 struct nfs_seqid * seqid;
519 * Arguments to the close call.
521 struct nfs_closeargs {
522 struct nfs4_sequence_args seq_args;
524 nfs4_stateid stateid;
525 struct nfs_seqid * seqid;
529 struct nfs4_layoutreturn_args *lr_args;
532 struct nfs_closeres {
533 struct nfs4_sequence_res seq_res;
534 nfs4_stateid stateid;
535 struct nfs_fattr * fattr;
536 struct nfs_seqid * seqid;
537 const struct nfs_server *server;
538 struct nfs4_layoutreturn_res *lr_res;
542 * * Arguments to the lock,lockt, and locku call.
550 struct nfs_lock_args {
551 struct nfs4_sequence_args seq_args;
553 struct file_lock * fl;
554 struct nfs_seqid * lock_seqid;
555 nfs4_stateid lock_stateid;
556 struct nfs_seqid * open_seqid;
557 nfs4_stateid open_stateid;
558 struct nfs_lowner lock_owner;
559 unsigned char block : 1;
560 unsigned char reclaim : 1;
561 unsigned char new_lock : 1;
562 unsigned char new_lock_owner : 1;
565 struct nfs_lock_res {
566 struct nfs4_sequence_res seq_res;
567 nfs4_stateid stateid;
568 struct nfs_seqid * lock_seqid;
569 struct nfs_seqid * open_seqid;
572 struct nfs_locku_args {
573 struct nfs4_sequence_args seq_args;
575 struct file_lock * fl;
576 struct nfs_seqid * seqid;
577 nfs4_stateid stateid;
580 struct nfs_locku_res {
581 struct nfs4_sequence_res seq_res;
582 nfs4_stateid stateid;
583 struct nfs_seqid * seqid;
586 struct nfs_lockt_args {
587 struct nfs4_sequence_args seq_args;
589 struct file_lock * fl;
590 struct nfs_lowner lock_owner;
593 struct nfs_lockt_res {
594 struct nfs4_sequence_res seq_res;
595 struct file_lock * denied; /* LOCK, LOCKT failed */
598 struct nfs_release_lockowner_args {
599 struct nfs4_sequence_args seq_args;
600 struct nfs_lowner lock_owner;
603 struct nfs_release_lockowner_res {
604 struct nfs4_sequence_res seq_res;
607 struct nfs4_delegreturnargs {
608 struct nfs4_sequence_args seq_args;
609 const struct nfs_fh *fhandle;
610 const nfs4_stateid *stateid;
612 struct nfs4_layoutreturn_args *lr_args;
615 struct nfs4_delegreturnres {
616 struct nfs4_sequence_res seq_res;
617 struct nfs_fattr * fattr;
618 struct nfs_server *server;
619 struct nfs4_layoutreturn_res *lr_res;
624 * Arguments to the write call.
626 struct nfs_write_verifier {
630 struct nfs_writeverf {
631 struct nfs_write_verifier verifier;
632 enum nfs3_stable_how committed;
636 * Arguments shared by the read and write call.
638 struct nfs_pgio_args {
639 struct nfs4_sequence_args seq_args;
641 struct nfs_open_context *context;
642 struct nfs_lock_context *lock_context;
643 nfs4_stateid stateid;
647 struct page ** pages;
649 unsigned int replen; /* used by read */
651 u32 * bitmask; /* used by write */
652 enum nfs3_stable_how stable; /* used by write */
657 struct nfs_pgio_res {
658 struct nfs4_sequence_res seq_res;
659 struct nfs_fattr * fattr;
664 unsigned int replen; /* used by read */
665 int eof; /* used by read */
668 struct nfs_writeverf * verf; /* used by write */
669 const struct nfs_server *server; /* used by write */
675 * Arguments to the commit call.
677 struct nfs_commitargs {
678 struct nfs4_sequence_args seq_args;
685 struct nfs_commitres {
686 struct nfs4_sequence_res seq_res;
688 struct nfs_fattr *fattr;
689 struct nfs_writeverf *verf;
690 const struct nfs_server *server;
694 * Common arguments to the unlink call
696 struct nfs_removeargs {
697 struct nfs4_sequence_args seq_args;
698 const struct nfs_fh *fh;
702 struct nfs_removeres {
703 struct nfs4_sequence_res seq_res;
704 struct nfs_server *server;
705 struct nfs_fattr *dir_attr;
706 struct nfs4_change_info cinfo;
710 * Common arguments to the rename call
712 struct nfs_renameargs {
713 struct nfs4_sequence_args seq_args;
714 const struct nfs_fh *old_dir;
715 const struct nfs_fh *new_dir;
716 const struct qstr *old_name;
717 const struct qstr *new_name;
720 struct nfs_renameres {
721 struct nfs4_sequence_res seq_res;
722 struct nfs_server *server;
723 struct nfs4_change_info old_cinfo;
724 struct nfs_fattr *old_fattr;
725 struct nfs4_change_info new_cinfo;
726 struct nfs_fattr *new_fattr;
729 /* parsed sec= options */
730 #define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
731 struct nfs_auth_info {
732 unsigned int flavor_len;
733 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS];
737 * Argument struct for decode_entry function
747 struct nfs_fattr * fattr;
748 struct nfs4_label *label;
749 unsigned char d_type;
750 struct nfs_server * server;
753 struct nfs_readdir_arg {
754 struct dentry *dentry;
755 const struct cred *cred;
759 unsigned int page_len;
763 struct nfs_readdir_res {
768 * The following types are for NFSv2 only.
770 struct nfs_sattrargs {
772 struct iattr * sattr;
775 struct nfs_diropargs {
781 struct nfs_createargs {
785 struct iattr * sattr;
788 struct nfs_setattrargs {
789 struct nfs4_sequence_args seq_args;
791 nfs4_stateid stateid;
793 const struct nfs_server * server; /* Needed for name mapping */
795 const struct nfs4_label *label;
798 struct nfs_setaclargs {
799 struct nfs4_sequence_args seq_args;
802 struct page ** acl_pages;
805 struct nfs_setaclres {
806 struct nfs4_sequence_res seq_res;
809 struct nfs_getaclargs {
810 struct nfs4_sequence_args seq_args;
813 struct page ** acl_pages;
816 /* getxattr ACL interface flags */
817 #define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
818 struct nfs_getaclres {
819 struct nfs4_sequence_res seq_res;
821 size_t acl_data_offset;
823 struct page * acl_scratch;
826 struct nfs_setattrres {
827 struct nfs4_sequence_res seq_res;
828 struct nfs_fattr * fattr;
829 struct nfs4_label *label;
830 const struct nfs_server * server;
833 struct nfs_linkargs {
834 struct nfs_fh * fromfh;
835 struct nfs_fh * tofh;
840 struct nfs_symlinkargs {
841 struct nfs_fh * fromfh;
842 const char * fromname;
843 unsigned int fromlen;
844 struct page ** pages;
845 unsigned int pathlen;
846 struct iattr * sattr;
849 struct nfs_readdirargs {
853 struct page ** pages;
856 struct nfs3_getaclargs {
859 struct page ** pages;
862 struct nfs3_setaclargs {
863 struct inode * inode;
865 struct posix_acl * acl_access;
866 struct posix_acl * acl_default;
869 struct page ** pages;
874 struct nfs_fattr * fattr;
877 struct nfs_readlinkargs {
881 struct page ** pages;
884 struct nfs3_sattrargs {
886 struct iattr * sattr;
888 struct timespec64 guardtime;
891 struct nfs3_diropargs {
897 struct nfs3_accessargs {
902 struct nfs3_createargs {
906 struct iattr * sattr;
907 enum nfs3_createmode createmode;
911 struct nfs3_mkdirargs {
915 struct iattr * sattr;
918 struct nfs3_symlinkargs {
919 struct nfs_fh * fromfh;
920 const char * fromname;
921 unsigned int fromlen;
922 struct page ** pages;
923 unsigned int pathlen;
924 struct iattr * sattr;
927 struct nfs3_mknodargs {
931 enum nfs3_ftype type;
932 struct iattr * sattr;
936 struct nfs3_linkargs {
937 struct nfs_fh * fromfh;
938 struct nfs_fh * tofh;
943 struct nfs3_readdirargs {
949 struct page ** pages;
952 struct nfs3_diropres {
953 struct nfs_fattr * dir_attr;
955 struct nfs_fattr * fattr;
958 struct nfs3_accessres {
959 struct nfs_fattr * fattr;
963 struct nfs3_readlinkargs {
967 struct page ** pages;
970 struct nfs3_linkres {
971 struct nfs_fattr * dir_attr;
972 struct nfs_fattr * fattr;
975 struct nfs3_readdirres {
976 struct nfs_fattr * dir_attr;
981 struct nfs3_getaclres {
982 struct nfs_fattr * fattr;
984 unsigned int acl_access_count;
985 unsigned int acl_default_count;
986 struct posix_acl * acl_access;
987 struct posix_acl * acl_default;
990 #if IS_ENABLED(CONFIG_NFS_V4)
992 typedef u64 clientid4;
994 struct nfs4_accessargs {
995 struct nfs4_sequence_args seq_args;
996 const struct nfs_fh * fh;
1001 struct nfs4_accessres {
1002 struct nfs4_sequence_res seq_res;
1003 const struct nfs_server * server;
1004 struct nfs_fattr * fattr;
1009 struct nfs4_create_arg {
1010 struct nfs4_sequence_args seq_args;
1014 struct page ** pages;
1016 } symlink; /* NF4LNK */
1020 } device; /* NF4BLK, NF4CHR */
1022 const struct qstr * name;
1023 const struct nfs_server * server;
1024 const struct iattr * attrs;
1025 const struct nfs_fh * dir_fh;
1026 const u32 * bitmask;
1027 const struct nfs4_label *label;
1031 struct nfs4_create_res {
1032 struct nfs4_sequence_res seq_res;
1033 const struct nfs_server * server;
1035 struct nfs_fattr * fattr;
1036 struct nfs4_label *label;
1037 struct nfs4_change_info dir_cinfo;
1040 struct nfs4_fsinfo_arg {
1041 struct nfs4_sequence_args seq_args;
1042 const struct nfs_fh * fh;
1043 const u32 * bitmask;
1046 struct nfs4_fsinfo_res {
1047 struct nfs4_sequence_res seq_res;
1048 struct nfs_fsinfo *fsinfo;
1051 struct nfs4_getattr_arg {
1052 struct nfs4_sequence_args seq_args;
1053 const struct nfs_fh * fh;
1054 const u32 * bitmask;
1057 struct nfs4_getattr_res {
1058 struct nfs4_sequence_res seq_res;
1059 const struct nfs_server * server;
1060 struct nfs_fattr * fattr;
1061 struct nfs4_label *label;
1064 struct nfs4_link_arg {
1065 struct nfs4_sequence_args seq_args;
1066 const struct nfs_fh * fh;
1067 const struct nfs_fh * dir_fh;
1068 const struct qstr * name;
1069 const u32 * bitmask;
1072 struct nfs4_link_res {
1073 struct nfs4_sequence_res seq_res;
1074 const struct nfs_server * server;
1075 struct nfs_fattr * fattr;
1076 struct nfs4_label *label;
1077 struct nfs4_change_info cinfo;
1078 struct nfs_fattr * dir_attr;
1081 struct nfs4_lookup_arg {
1082 struct nfs4_sequence_args seq_args;
1083 const struct nfs_fh * dir_fh;
1084 const struct qstr * name;
1085 const u32 * bitmask;
1088 struct nfs4_lookup_res {
1089 struct nfs4_sequence_res seq_res;
1090 const struct nfs_server * server;
1091 struct nfs_fattr * fattr;
1093 struct nfs4_label *label;
1096 struct nfs4_lookupp_arg {
1097 struct nfs4_sequence_args seq_args;
1098 const struct nfs_fh *fh;
1102 struct nfs4_lookupp_res {
1103 struct nfs4_sequence_res seq_res;
1104 const struct nfs_server *server;
1105 struct nfs_fattr *fattr;
1107 struct nfs4_label *label;
1110 struct nfs4_lookup_root_arg {
1111 struct nfs4_sequence_args seq_args;
1112 const u32 * bitmask;
1115 struct nfs4_pathconf_arg {
1116 struct nfs4_sequence_args seq_args;
1117 const struct nfs_fh * fh;
1118 const u32 * bitmask;
1121 struct nfs4_pathconf_res {
1122 struct nfs4_sequence_res seq_res;
1123 struct nfs_pathconf *pathconf;
1126 struct nfs4_readdir_arg {
1127 struct nfs4_sequence_args seq_args;
1128 const struct nfs_fh * fh;
1130 nfs4_verifier verifier;
1132 struct page ** pages; /* zero-copy data */
1133 unsigned int pgbase; /* zero-copy data */
1134 const u32 * bitmask;
1138 struct nfs4_readdir_res {
1139 struct nfs4_sequence_res seq_res;
1140 nfs4_verifier verifier;
1141 unsigned int pgbase;
1144 struct nfs4_readlink {
1145 struct nfs4_sequence_args seq_args;
1146 const struct nfs_fh * fh;
1147 unsigned int pgbase;
1148 unsigned int pglen; /* zero-copy data */
1149 struct page ** pages; /* zero-copy data */
1152 struct nfs4_readlink_res {
1153 struct nfs4_sequence_res seq_res;
1156 struct nfs4_setclientid {
1157 const nfs4_verifier * sc_verifier;
1159 unsigned int sc_netid_len;
1160 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
1161 unsigned int sc_uaddr_len;
1162 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
1163 struct nfs_client *sc_clnt;
1164 struct rpc_cred *sc_cred;
1167 struct nfs4_setclientid_res {
1169 nfs4_verifier confirm;
1172 struct nfs4_statfs_arg {
1173 struct nfs4_sequence_args seq_args;
1174 const struct nfs_fh * fh;
1175 const u32 * bitmask;
1178 struct nfs4_statfs_res {
1179 struct nfs4_sequence_res seq_res;
1180 struct nfs_fsstat *fsstat;
1183 struct nfs4_server_caps_arg {
1184 struct nfs4_sequence_args seq_args;
1185 struct nfs_fh *fhandle;
1186 const u32 * bitmask;
1189 struct nfs4_server_caps_res {
1190 struct nfs4_sequence_res seq_res;
1191 u32 attr_bitmask[3];
1192 u32 exclcreat_bitmask[3];
1199 #define NFS4_PATHNAME_MAXCOMPONENTS 512
1200 struct nfs4_pathname {
1201 unsigned int ncomponents;
1202 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
1205 #define NFS4_FS_LOCATION_MAXSERVERS 10
1206 struct nfs4_fs_location {
1207 unsigned int nservers;
1208 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
1209 struct nfs4_pathname rootpath;
1212 #define NFS4_FS_LOCATIONS_MAXENTRIES 10
1213 struct nfs4_fs_locations {
1214 struct nfs_fattr fattr;
1215 const struct nfs_server *server;
1216 struct nfs4_pathname fs_path;
1218 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
1221 struct nfs4_fs_locations_arg {
1222 struct nfs4_sequence_args seq_args;
1223 const struct nfs_fh *dir_fh;
1224 const struct nfs_fh *fh;
1225 const struct qstr *name;
1229 unsigned char migration:1, renew:1;
1232 struct nfs4_fs_locations_res {
1233 struct nfs4_sequence_res seq_res;
1234 struct nfs4_fs_locations *fs_locations;
1235 unsigned char migration:1, renew:1;
1238 struct nfs4_secinfo4 {
1240 struct rpcsec_gss_info flavor_info;
1243 struct nfs4_secinfo_flavors {
1244 unsigned int num_flavors;
1245 struct nfs4_secinfo4 flavors[];
1248 struct nfs4_secinfo_arg {
1249 struct nfs4_sequence_args seq_args;
1250 const struct nfs_fh *dir_fh;
1251 const struct qstr *name;
1254 struct nfs4_secinfo_res {
1255 struct nfs4_sequence_res seq_res;
1256 struct nfs4_secinfo_flavors *flavors;
1259 struct nfs4_fsid_present_arg {
1260 struct nfs4_sequence_args seq_args;
1261 const struct nfs_fh *fh;
1263 unsigned char renew:1;
1266 struct nfs4_fsid_present_res {
1267 struct nfs4_sequence_res seq_res;
1269 unsigned char renew:1;
1272 #endif /* CONFIG_NFS_V4 */
1279 #ifdef CONFIG_NFS_V4_1
1281 struct pnfs_commit_bucket {
1282 struct list_head written;
1283 struct list_head committing;
1284 struct pnfs_layout_segment *lseg;
1285 struct nfs_writeverf direct_verf;
1288 struct pnfs_commit_array {
1289 struct list_head cinfo_list;
1290 struct list_head lseg_list;
1291 struct pnfs_layout_segment *lseg;
1292 struct rcu_head rcu;
1293 refcount_t refcount;
1294 unsigned int nbuckets;
1295 struct pnfs_commit_bucket buckets[];
1298 struct pnfs_ds_commit_info {
1299 struct list_head commits;
1300 unsigned int nwritten;
1301 unsigned int ncommitting;
1302 const struct pnfs_commit_ops *ops;
1305 struct nfs41_state_protection {
1307 struct nfs4_op_map enforce;
1308 struct nfs4_op_map allow;
1311 struct nfs41_exchange_id_args {
1312 struct nfs_client *client;
1313 nfs4_verifier verifier;
1315 struct nfs41_state_protection state_protect;
1318 struct nfs41_server_owner {
1320 uint32_t major_id_sz;
1321 char major_id[NFS4_OPAQUE_LIMIT];
1324 struct nfs41_server_scope {
1325 uint32_t server_scope_sz;
1326 char server_scope[NFS4_OPAQUE_LIMIT];
1329 struct nfs41_impl_id {
1330 char domain[NFS4_OPAQUE_LIMIT + 1];
1331 char name[NFS4_OPAQUE_LIMIT + 1];
1332 struct nfstime4 date;
1335 #define MAX_BIND_CONN_TO_SESSION_RETRIES 3
1336 struct nfs41_bind_conn_to_session_args {
1337 struct nfs_client *client;
1338 struct nfs4_sessionid sessionid;
1340 bool use_conn_in_rdma_mode;
1344 struct nfs41_bind_conn_to_session_res {
1345 struct nfs4_sessionid sessionid;
1347 bool use_conn_in_rdma_mode;
1350 struct nfs41_exchange_id_res {
1354 struct nfs41_server_owner *server_owner;
1355 struct nfs41_server_scope *server_scope;
1356 struct nfs41_impl_id *impl_id;
1357 struct nfs41_state_protection state_protect;
1360 struct nfs41_create_session_args {
1361 struct nfs_client *client;
1365 uint32_t cb_program;
1366 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1367 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1370 struct nfs41_create_session_res {
1371 struct nfs4_sessionid sessionid;
1374 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1375 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1378 struct nfs41_reclaim_complete_args {
1379 struct nfs4_sequence_args seq_args;
1380 /* In the future extend to include curr_fh for use with migration */
1381 unsigned char one_fs:1;
1384 struct nfs41_reclaim_complete_res {
1385 struct nfs4_sequence_res seq_res;
1388 #define SECINFO_STYLE_CURRENT_FH 0
1389 #define SECINFO_STYLE_PARENT 1
1390 struct nfs41_secinfo_no_name_args {
1391 struct nfs4_sequence_args seq_args;
1395 struct nfs41_test_stateid_args {
1396 struct nfs4_sequence_args seq_args;
1397 nfs4_stateid *stateid;
1400 struct nfs41_test_stateid_res {
1401 struct nfs4_sequence_res seq_res;
1402 unsigned int status;
1405 struct nfs41_free_stateid_args {
1406 struct nfs4_sequence_args seq_args;
1407 nfs4_stateid stateid;
1410 struct nfs41_free_stateid_res {
1411 struct nfs4_sequence_res seq_res;
1412 unsigned int status;
1417 struct pnfs_ds_commit_info {
1420 #endif /* CONFIG_NFS_V4_1 */
1422 #ifdef CONFIG_NFS_V4_2
1423 struct nfs42_falloc_args {
1424 struct nfs4_sequence_args seq_args;
1426 struct nfs_fh *falloc_fh;
1427 nfs4_stateid falloc_stateid;
1430 const u32 *falloc_bitmask;
1433 struct nfs42_falloc_res {
1434 struct nfs4_sequence_res seq_res;
1435 unsigned int status;
1437 struct nfs_fattr *falloc_fattr;
1438 const struct nfs_server *falloc_server;
1441 struct nfs42_copy_args {
1442 struct nfs4_sequence_args seq_args;
1444 struct nfs_fh *src_fh;
1445 nfs4_stateid src_stateid;
1448 struct nfs_fh *dst_fh;
1449 nfs4_stateid dst_stateid;
1454 struct nl4_server *cp_src;
1457 struct nfs42_write_res {
1458 nfs4_stateid stateid;
1460 struct nfs_writeverf verifier;
1463 struct nfs42_copy_res {
1464 struct nfs4_sequence_res seq_res;
1465 struct nfs42_write_res write_res;
1468 struct nfs_commitres commit_res;
1471 struct nfs42_offload_status_args {
1472 struct nfs4_sequence_args osa_seq_args;
1473 struct nfs_fh *osa_src_fh;
1474 nfs4_stateid osa_stateid;
1477 struct nfs42_offload_status_res {
1478 struct nfs4_sequence_res osr_seq_res;
1483 struct nfs42_copy_notify_args {
1484 struct nfs4_sequence_args cna_seq_args;
1486 struct nfs_fh *cna_src_fh;
1487 nfs4_stateid cna_src_stateid;
1488 struct nl4_server cna_dst;
1491 struct nfs42_copy_notify_res {
1492 struct nfs4_sequence_res cnr_seq_res;
1494 struct nfstime4 cnr_lease_time;
1495 nfs4_stateid cnr_stateid;
1496 struct nl4_server cnr_src;
1499 struct nfs42_seek_args {
1500 struct nfs4_sequence_args seq_args;
1502 struct nfs_fh *sa_fh;
1503 nfs4_stateid sa_stateid;
1508 struct nfs42_seek_res {
1509 struct nfs4_sequence_res seq_res;
1510 unsigned int status;
1516 struct nfs42_setxattrargs {
1517 struct nfs4_sequence_args seq_args;
1519 const char *xattr_name;
1522 struct page **xattr_pages;
1525 struct nfs42_setxattrres {
1526 struct nfs4_sequence_res seq_res;
1527 struct nfs4_change_info cinfo;
1530 struct nfs42_getxattrargs {
1531 struct nfs4_sequence_args seq_args;
1533 const char *xattr_name;
1535 struct page **xattr_pages;
1538 struct nfs42_getxattrres {
1539 struct nfs4_sequence_res seq_res;
1543 struct nfs42_listxattrsargs {
1544 struct nfs4_sequence_args seq_args;
1548 struct page **xattr_pages;
1551 struct nfs42_listxattrsres {
1552 struct nfs4_sequence_res seq_res;
1553 struct page *scratch;
1561 struct nfs42_removexattrargs {
1562 struct nfs4_sequence_args seq_args;
1564 const char *xattr_name;
1567 struct nfs42_removexattrres {
1568 struct nfs4_sequence_res seq_res;
1569 struct nfs4_change_info cinfo;
1572 #endif /* CONFIG_NFS_V4_2 */
1576 #define NFS_PAGEVEC_SIZE (8U)
1578 struct nfs_page_array {
1579 struct page **pagevec;
1580 unsigned int npages; /* Max length of pagevec */
1581 struct page *page_array[NFS_PAGEVEC_SIZE];
1584 /* used as flag bits in nfs_pgio_header */
1586 NFS_IOHDR_ERROR = 0,
1590 NFS_IOHDR_RESEND_PNFS,
1591 NFS_IOHDR_RESEND_MDS,
1594 struct nfs_io_completion;
1595 struct nfs_pgio_header {
1596 struct inode *inode;
1597 const struct cred *cred;
1598 struct list_head pages;
1599 struct nfs_page *req;
1600 struct nfs_writeverf verf; /* Used for writes */
1602 struct pnfs_layout_segment *lseg;
1604 const struct rpc_call_ops *mds_ops;
1605 void (*release) (struct nfs_pgio_header *hdr);
1606 const struct nfs_pgio_completion_ops *completion_ops;
1607 const struct nfs_rw_ops *rw_ops;
1608 struct nfs_io_completion *io_completion;
1609 struct nfs_direct_req *dreq;
1612 int error; /* merge with pnfs_error */
1613 unsigned int good_bytes; /* boundary of good data */
1614 unsigned long flags;
1619 struct rpc_task task;
1620 struct nfs_fattr fattr;
1621 struct nfs_pgio_args args; /* argument struct */
1622 struct nfs_pgio_res res; /* result struct */
1623 unsigned long timestamp; /* For lease renewal */
1624 int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
1625 __u64 mds_offset; /* Filelayout dense stripe */
1626 struct nfs_page_array page_array;
1627 struct nfs_client *ds_clp; /* pNFS data server */
1628 u32 ds_commit_idx; /* ds index if ds_clp is set */
1629 u32 pgio_mirror_idx;/* mirror index in pgio layer */
1632 struct nfs_mds_commit_info {
1634 atomic_long_t ncommit;
1635 struct list_head list;
1638 struct nfs_commit_info;
1639 struct nfs_commit_data;
1641 struct nfs_commit_completion_ops {
1642 void (*completion) (struct nfs_commit_data *data);
1643 void (*resched_write) (struct nfs_commit_info *, struct nfs_page *);
1646 struct nfs_commit_info {
1647 struct inode *inode; /* Needed for inode->i_lock */
1648 struct nfs_mds_commit_info *mds;
1649 struct pnfs_ds_commit_info *ds;
1650 struct nfs_direct_req *dreq; /* O_DIRECT request */
1651 const struct nfs_commit_completion_ops *completion_ops;
1654 struct nfs_commit_data {
1655 struct rpc_task task;
1656 struct inode *inode;
1657 const struct cred *cred;
1658 struct nfs_fattr fattr;
1659 struct nfs_writeverf verf;
1660 struct list_head pages; /* Coalesced requests we wish to flush */
1661 struct list_head list; /* lists of struct nfs_write_data */
1662 struct nfs_direct_req *dreq; /* O_DIRECT request */
1663 struct nfs_commitargs args; /* argument struct */
1664 struct nfs_commitres res; /* result struct */
1665 struct nfs_open_context *context;
1666 struct pnfs_layout_segment *lseg;
1667 struct nfs_client *ds_clp; /* pNFS data server */
1668 int ds_commit_index;
1670 const struct rpc_call_ops *mds_ops;
1671 const struct nfs_commit_completion_ops *completion_ops;
1672 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
1673 unsigned long flags;
1676 struct nfs_pgio_completion_ops {
1677 void (*error_cleanup)(struct list_head *head, int);
1678 void (*init_hdr)(struct nfs_pgio_header *hdr);
1679 void (*completion)(struct nfs_pgio_header *hdr);
1680 void (*reschedule_io)(struct nfs_pgio_header *hdr);
1683 struct nfs_unlinkdata {
1684 struct nfs_removeargs args;
1685 struct nfs_removeres res;
1686 struct dentry *dentry;
1687 wait_queue_head_t wq;
1688 const struct cred *cred;
1689 struct nfs_fattr dir_attr;
1693 struct nfs_renamedata {
1694 struct nfs_renameargs args;
1695 struct nfs_renameres res;
1696 const struct cred *cred;
1697 struct inode *old_dir;
1698 struct dentry *old_dentry;
1699 struct nfs_fattr old_fattr;
1700 struct inode *new_dir;
1701 struct dentry *new_dentry;
1702 struct nfs_fattr new_fattr;
1703 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
1708 struct nfs_access_entry;
1711 struct nfs_subversion;
1712 struct nfs_mount_info;
1713 struct nfs_client_initdata;
1714 struct nfs_pageio_descriptor;
1718 * RPC procedure vector for NFSv2/NFSv3 demuxing
1720 struct nfs_rpc_ops {
1721 u32 version; /* Protocol version */
1722 const struct dentry_operations *dentry_ops;
1723 const struct inode_operations *dir_inode_ops;
1724 const struct inode_operations *file_inode_ops;
1725 const struct file_operations *file_ops;
1726 const struct nlmclnt_operations *nlmclnt_ops;
1728 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1729 struct nfs_fsinfo *);
1730 int (*submount) (struct fs_context *, struct nfs_server *);
1731 int (*try_get_tree) (struct fs_context *);
1732 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1733 struct nfs_fattr *, struct nfs4_label *,
1735 int (*setattr) (struct dentry *, struct nfs_fattr *,
1737 int (*lookup) (struct inode *, struct dentry *,
1738 struct nfs_fh *, struct nfs_fattr *,
1739 struct nfs4_label *);
1740 int (*lookupp) (struct inode *, struct nfs_fh *,
1741 struct nfs_fattr *, struct nfs4_label *);
1742 int (*access) (struct inode *, struct nfs_access_entry *);
1743 int (*readlink)(struct inode *, struct page *, unsigned int,
1745 int (*create) (struct inode *, struct dentry *,
1746 struct iattr *, int);
1747 int (*remove) (struct inode *, struct dentry *);
1748 void (*unlink_setup) (struct rpc_message *, struct dentry *, struct inode *);
1749 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1750 int (*unlink_done) (struct rpc_task *, struct inode *);
1751 void (*rename_setup) (struct rpc_message *msg,
1752 struct dentry *old_dentry,
1753 struct dentry *new_dentry);
1754 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
1755 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1756 int (*link) (struct inode *, struct inode *, const struct qstr *);
1757 int (*symlink) (struct inode *, struct dentry *, struct page *,
1758 unsigned int, struct iattr *);
1759 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1760 int (*rmdir) (struct inode *, const struct qstr *);
1761 int (*readdir) (struct nfs_readdir_arg *, struct nfs_readdir_res *);
1762 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1764 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1765 struct nfs_fsstat *);
1766 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1767 struct nfs_fsinfo *);
1768 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1769 struct nfs_pathconf *);
1770 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1771 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, bool);
1772 int (*pgio_rpc_prepare)(struct rpc_task *,
1773 struct nfs_pgio_header *);
1774 void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
1775 int (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
1776 void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *,
1777 struct rpc_clnt **);
1778 int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
1779 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *,
1780 struct rpc_clnt **);
1781 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1782 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
1783 int (*lock)(struct file *, int, struct file_lock *);
1784 int (*lock_check_bounds)(const struct file_lock *);
1785 void (*clear_acl_cache)(struct inode *);
1786 void (*close_context)(struct nfs_open_context *ctx, int);
1787 struct inode * (*open_context) (struct inode *dir,
1788 struct nfs_open_context *ctx,
1790 struct iattr *iattr,
1792 int (*have_delegation)(struct inode *, fmode_t);
1793 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
1794 struct nfs_client *(*init_client) (struct nfs_client *,
1795 const struct nfs_client_initdata *);
1796 void (*free_client) (struct nfs_client *);
1797 struct nfs_server *(*create_server)(struct fs_context *);
1798 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
1799 struct nfs_fattr *, rpc_authflavor_t);
1803 * NFS_CALL(getattr, inode, (fattr));
1805 * NFS_PROTO(inode)->getattr(fattr);
1807 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1810 * Function vectors etc. for the NFS client
1812 extern const struct nfs_rpc_ops nfs_v2_clientops;
1813 extern const struct nfs_rpc_ops nfs_v3_clientops;
1814 extern const struct nfs_rpc_ops nfs_v4_clientops;
1815 extern const struct rpc_version nfs_version2;
1816 extern const struct rpc_version nfs_version3;
1817 extern const struct rpc_version nfs_version4;
1819 extern const struct rpc_version nfsacl_version3;
1820 extern const struct rpc_program nfsacl_program;