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 timespec atime;
66 struct timespec mtime;
67 struct timespec 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 timespec pre_mtime; /* pre_op_attr.mtime */
72 struct timespec 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 */
80 #define NFS_ATTR_FATTR_TYPE (1U << 0)
81 #define NFS_ATTR_FATTR_MODE (1U << 1)
82 #define NFS_ATTR_FATTR_NLINK (1U << 2)
83 #define NFS_ATTR_FATTR_OWNER (1U << 3)
84 #define NFS_ATTR_FATTR_GROUP (1U << 4)
85 #define NFS_ATTR_FATTR_RDEV (1U << 5)
86 #define NFS_ATTR_FATTR_SIZE (1U << 6)
87 #define NFS_ATTR_FATTR_PRESIZE (1U << 7)
88 #define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
89 #define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
90 #define NFS_ATTR_FATTR_FSID (1U << 10)
91 #define NFS_ATTR_FATTR_FILEID (1U << 11)
92 #define NFS_ATTR_FATTR_ATIME (1U << 12)
93 #define NFS_ATTR_FATTR_MTIME (1U << 13)
94 #define NFS_ATTR_FATTR_CTIME (1U << 14)
95 #define NFS_ATTR_FATTR_PREMTIME (1U << 15)
96 #define NFS_ATTR_FATTR_PRECTIME (1U << 16)
97 #define NFS_ATTR_FATTR_CHANGE (1U << 17)
98 #define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
99 #define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
100 #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
101 #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
102 #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
103 #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
104 #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
105 #define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
107 #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
108 | NFS_ATTR_FATTR_MODE \
109 | NFS_ATTR_FATTR_NLINK \
110 | NFS_ATTR_FATTR_OWNER \
111 | NFS_ATTR_FATTR_GROUP \
112 | NFS_ATTR_FATTR_RDEV \
113 | NFS_ATTR_FATTR_SIZE \
114 | NFS_ATTR_FATTR_FSID \
115 | NFS_ATTR_FATTR_FILEID \
116 | NFS_ATTR_FATTR_ATIME \
117 | NFS_ATTR_FATTR_MTIME \
118 | NFS_ATTR_FATTR_CTIME \
119 | NFS_ATTR_FATTR_CHANGE)
120 #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
121 | NFS_ATTR_FATTR_BLOCKS_USED)
122 #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
123 | NFS_ATTR_FATTR_SPACE_USED)
124 #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
125 | NFS_ATTR_FATTR_SPACE_USED \
126 | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
129 * Maximal number of supported layout drivers.
131 #define NFS_MAX_LAYOUT_TYPES 8
134 * Info on the file system
137 struct nfs_fattr *fattr; /* Post-op attributes */
138 __u32 rtmax; /* max. read transfer size */
139 __u32 rtpref; /* pref. read transfer size */
140 __u32 rtmult; /* reads should be multiple of this */
141 __u32 wtmax; /* max. write transfer size */
142 __u32 wtpref; /* pref. write transfer size */
143 __u32 wtmult; /* writes should be multiple of this */
144 __u32 dtpref; /* pref. readdir transfer size */
146 struct timespec time_delta; /* server time granularity */
147 __u32 lease_time; /* in seconds */
148 __u32 nlayouttypes; /* number of layouttypes */
149 __u32 layouttype[NFS_MAX_LAYOUT_TYPES]; /* supported pnfs layout driver */
150 __u32 blksize; /* preferred pnfs io block size */
151 __u32 clone_blksize; /* granularity of a CLONE operation */
155 struct nfs_fattr *fattr; /* Post-op attributes */
156 __u64 tbytes; /* total size in bytes */
157 __u64 fbytes; /* # of free bytes */
158 __u64 abytes; /* # of bytes available to user */
159 __u64 tfiles; /* # of files */
160 __u64 ffiles; /* # of free files */
161 __u64 afiles; /* # of files available to user */
165 __u32 tsize; /* Server transfer size */
166 __u32 bsize; /* Filesystem block size */
167 __u32 blocks; /* No. of "bsize" blocks on filesystem */
168 __u32 bfree; /* No. of free "bsize" blocks */
169 __u32 bavail; /* No. of available "bsize" blocks */
172 struct nfs_pathconf {
173 struct nfs_fattr *fattr; /* Post-op attributes */
174 __u32 max_link; /* max # of hard links */
175 __u32 max_namelen; /* max name length */
178 struct nfs4_change_info {
186 /* nfs41 sessions channel attributes */
187 struct nfs4_channel_attrs {
190 u32 max_resp_sz_cached;
196 struct nfs4_sequence_args {
197 struct nfs4_slot *sa_slot;
198 u8 sa_cache_this : 1,
202 struct nfs4_sequence_res {
203 struct nfs4_slot *sr_slot; /* slot used to send request */
204 unsigned long sr_timestamp;
205 int sr_status; /* sequence operation status */
207 u32 sr_highest_slotid;
208 u32 sr_target_highest_slotid;
211 struct nfs4_get_lease_time_args {
212 struct nfs4_sequence_args la_seq_args;
215 struct nfs4_get_lease_time_res {
216 struct nfs4_sequence_res lr_seq_res;
217 struct nfs_fsinfo *lr_fsinfo;
221 struct nfs4_xdr_opaque_data;
223 struct nfs4_xdr_opaque_ops {
224 void (*encode)(struct xdr_stream *, const void *args,
225 const struct nfs4_xdr_opaque_data *);
226 void (*free)(struct nfs4_xdr_opaque_data *);
229 struct nfs4_xdr_opaque_data {
230 const struct nfs4_xdr_opaque_ops *ops;
234 #define PNFS_LAYOUT_MAXSIZE 4096
236 struct nfs4_layoutdriver_data {
242 struct pnfs_layout_range {
248 struct nfs4_layoutget_args {
249 struct nfs4_sequence_args seq_args;
251 struct pnfs_layout_range range;
255 struct nfs_open_context *ctx;
256 nfs4_stateid stateid;
257 struct nfs4_layoutdriver_data layout;
260 struct nfs4_layoutget_res {
261 struct nfs4_sequence_res seq_res;
263 __u32 return_on_close;
264 struct pnfs_layout_range range;
266 nfs4_stateid stateid;
267 struct nfs4_layoutdriver_data *layoutp;
270 struct nfs4_layoutget {
271 struct nfs4_layoutget_args args;
272 struct nfs4_layoutget_res res;
273 struct rpc_cred *cred;
274 unsigned callback_count;
278 struct nfs4_getdeviceinfo_args {
279 struct nfs4_sequence_args seq_args;
280 struct pnfs_device *pdev;
284 struct nfs4_getdeviceinfo_res {
285 struct nfs4_sequence_res seq_res;
286 struct pnfs_device *pdev;
290 struct nfs4_layoutcommit_args {
291 struct nfs4_sequence_args seq_args;
292 nfs4_stateid stateid;
293 __u64 lastbytewritten;
296 size_t layoutupdate_len;
297 struct page *layoutupdate_page;
298 struct page **layoutupdate_pages;
302 struct nfs4_layoutcommit_res {
303 struct nfs4_sequence_res seq_res;
304 struct nfs_fattr *fattr;
305 const struct nfs_server *server;
309 struct nfs4_layoutcommit_data {
310 struct rpc_task task;
311 struct nfs_fattr fattr;
312 struct list_head lseg_list;
313 struct rpc_cred *cred;
315 struct nfs4_layoutcommit_args args;
316 struct nfs4_layoutcommit_res res;
319 struct nfs4_layoutreturn_args {
320 struct nfs4_sequence_args seq_args;
321 struct pnfs_layout_hdr *layout;
323 struct pnfs_layout_range range;
324 nfs4_stateid stateid;
326 struct nfs4_xdr_opaque_data *ld_private;
329 struct nfs4_layoutreturn_res {
330 struct nfs4_sequence_res seq_res;
332 nfs4_stateid stateid;
335 struct nfs4_layoutreturn {
336 struct nfs4_layoutreturn_args args;
337 struct nfs4_layoutreturn_res res;
338 struct rpc_cred *cred;
339 struct nfs_client *clp;
342 struct nfs4_xdr_opaque_data ld_private;
345 #define PNFS_LAYOUTSTATS_MAXSIZE 256
347 struct nfs42_layoutstat_args;
348 struct nfs42_layoutstat_devinfo;
349 typedef void (*layoutstats_encode_t)(struct xdr_stream *,
350 struct nfs42_layoutstat_args *,
351 struct nfs42_layoutstat_devinfo *);
353 /* Per file per deviceid layoutstats */
354 struct nfs42_layoutstat_devinfo {
355 struct nfs4_deviceid dev_id;
363 struct nfs4_xdr_opaque_data ld_private;
366 struct nfs42_layoutstat_args {
367 struct nfs4_sequence_args seq_args;
370 nfs4_stateid stateid;
372 struct nfs42_layoutstat_devinfo *devinfo;
375 struct nfs42_layoutstat_res {
376 struct nfs4_sequence_res seq_res;
381 struct nfs42_layoutstat_data {
383 struct nfs42_layoutstat_args args;
384 struct nfs42_layoutstat_res res;
387 struct nfs42_clone_args {
388 struct nfs4_sequence_args seq_args;
389 struct nfs_fh *src_fh;
390 struct nfs_fh *dst_fh;
391 nfs4_stateid src_stateid;
392 nfs4_stateid dst_stateid;
396 const u32 *dst_bitmask;
399 struct nfs42_clone_res {
400 struct nfs4_sequence_res seq_res;
401 unsigned int rpc_status;
402 struct nfs_fattr *dst_fattr;
403 const struct nfs_server *server;
406 struct stateowner_id {
412 * Arguments to the open call.
414 struct nfs_openargs {
415 struct nfs4_sequence_args seq_args;
416 const struct nfs_fh * fh;
417 struct nfs_seqid * seqid;
423 struct stateowner_id id;
426 struct iattr * attrs; /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */
427 nfs4_verifier verifier; /* EXCLUSIVE */
429 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
430 fmode_t delegation_type; /* CLAIM_PREVIOUS */
432 const struct qstr * name;
433 const struct nfs_server *server; /* Needed for ID mapping */
435 const u32 * open_bitmap;
436 enum open_claim_type4 claim;
437 enum createmode4 createmode;
438 const struct nfs4_label *label;
440 struct nfs4_layoutget_args *lg_args;
444 struct nfs4_sequence_res seq_res;
445 nfs4_stateid stateid;
447 struct nfs4_change_info cinfo;
449 struct nfs_fattr * f_attr;
450 struct nfs4_label *f_label;
451 struct nfs_seqid * seqid;
452 const struct nfs_server *server;
453 fmode_t delegation_type;
454 nfs4_stateid delegation;
455 unsigned long pagemod_limit;
457 __u32 attrset[NFS4_BITMAP_SIZE];
458 struct nfs4_string *owner;
459 struct nfs4_string *group_owner;
460 __u32 access_request;
461 __u32 access_supported;
463 struct nfs4_layoutget_res *lg_res;
467 * Arguments to the open_confirm call.
469 struct nfs_open_confirmargs {
470 struct nfs4_sequence_args seq_args;
471 const struct nfs_fh * fh;
472 nfs4_stateid * stateid;
473 struct nfs_seqid * seqid;
476 struct nfs_open_confirmres {
477 struct nfs4_sequence_res seq_res;
478 nfs4_stateid stateid;
479 struct nfs_seqid * seqid;
483 * Arguments to the close call.
485 struct nfs_closeargs {
486 struct nfs4_sequence_args seq_args;
488 nfs4_stateid stateid;
489 struct nfs_seqid * seqid;
493 struct nfs4_layoutreturn_args *lr_args;
496 struct nfs_closeres {
497 struct nfs4_sequence_res seq_res;
498 nfs4_stateid stateid;
499 struct nfs_fattr * fattr;
500 struct nfs_seqid * seqid;
501 const struct nfs_server *server;
502 struct nfs4_layoutreturn_res *lr_res;
506 * * Arguments to the lock,lockt, and locku call.
514 struct nfs_lock_args {
515 struct nfs4_sequence_args seq_args;
517 struct file_lock * fl;
518 struct nfs_seqid * lock_seqid;
519 nfs4_stateid lock_stateid;
520 struct nfs_seqid * open_seqid;
521 nfs4_stateid open_stateid;
522 struct nfs_lowner lock_owner;
523 unsigned char block : 1;
524 unsigned char reclaim : 1;
525 unsigned char new_lock : 1;
526 unsigned char new_lock_owner : 1;
529 struct nfs_lock_res {
530 struct nfs4_sequence_res seq_res;
531 nfs4_stateid stateid;
532 struct nfs_seqid * lock_seqid;
533 struct nfs_seqid * open_seqid;
536 struct nfs_locku_args {
537 struct nfs4_sequence_args seq_args;
539 struct file_lock * fl;
540 struct nfs_seqid * seqid;
541 nfs4_stateid stateid;
544 struct nfs_locku_res {
545 struct nfs4_sequence_res seq_res;
546 nfs4_stateid stateid;
547 struct nfs_seqid * seqid;
550 struct nfs_lockt_args {
551 struct nfs4_sequence_args seq_args;
553 struct file_lock * fl;
554 struct nfs_lowner lock_owner;
557 struct nfs_lockt_res {
558 struct nfs4_sequence_res seq_res;
559 struct file_lock * denied; /* LOCK, LOCKT failed */
562 struct nfs_release_lockowner_args {
563 struct nfs4_sequence_args seq_args;
564 struct nfs_lowner lock_owner;
567 struct nfs_release_lockowner_res {
568 struct nfs4_sequence_res seq_res;
571 struct nfs4_delegreturnargs {
572 struct nfs4_sequence_args seq_args;
573 const struct nfs_fh *fhandle;
574 const nfs4_stateid *stateid;
576 struct nfs4_layoutreturn_args *lr_args;
579 struct nfs4_delegreturnres {
580 struct nfs4_sequence_res seq_res;
581 struct nfs_fattr * fattr;
582 struct nfs_server *server;
583 struct nfs4_layoutreturn_res *lr_res;
588 * Arguments to the write call.
590 struct nfs_write_verifier {
594 struct nfs_writeverf {
595 struct nfs_write_verifier verifier;
596 enum nfs3_stable_how committed;
600 * Arguments shared by the read and write call.
602 struct nfs_pgio_args {
603 struct nfs4_sequence_args seq_args;
605 struct nfs_open_context *context;
606 struct nfs_lock_context *lock_context;
607 nfs4_stateid stateid;
611 struct page ** pages;
612 const u32 * bitmask; /* used by write */
613 enum nfs3_stable_how stable; /* used by write */
616 struct nfs_pgio_res {
617 struct nfs4_sequence_res seq_res;
618 struct nfs_fattr * fattr;
621 int eof; /* used by read */
622 struct nfs_writeverf * verf; /* used by write */
623 const struct nfs_server *server; /* used by write */
628 * Arguments to the commit call.
630 struct nfs_commitargs {
631 struct nfs4_sequence_args seq_args;
638 struct nfs_commitres {
639 struct nfs4_sequence_res seq_res;
641 struct nfs_fattr *fattr;
642 struct nfs_writeverf *verf;
643 const struct nfs_server *server;
647 * Common arguments to the unlink call
649 struct nfs_removeargs {
650 struct nfs4_sequence_args seq_args;
651 const struct nfs_fh *fh;
655 struct nfs_removeres {
656 struct nfs4_sequence_res seq_res;
657 struct nfs_server *server;
658 struct nfs_fattr *dir_attr;
659 struct nfs4_change_info cinfo;
663 * Common arguments to the rename call
665 struct nfs_renameargs {
666 struct nfs4_sequence_args seq_args;
667 const struct nfs_fh *old_dir;
668 const struct nfs_fh *new_dir;
669 const struct qstr *old_name;
670 const struct qstr *new_name;
673 struct nfs_renameres {
674 struct nfs4_sequence_res seq_res;
675 struct nfs_server *server;
676 struct nfs4_change_info old_cinfo;
677 struct nfs_fattr *old_fattr;
678 struct nfs4_change_info new_cinfo;
679 struct nfs_fattr *new_fattr;
682 /* parsed sec= options */
683 #define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
684 struct nfs_auth_info {
685 unsigned int flavor_len;
686 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS];
690 * Argument struct for decode_entry function
700 struct nfs_fattr * fattr;
701 struct nfs4_label *label;
702 unsigned char d_type;
703 struct nfs_server * server;
707 * The following types are for NFSv2 only.
709 struct nfs_sattrargs {
711 struct iattr * sattr;
714 struct nfs_diropargs {
720 struct nfs_createargs {
724 struct iattr * sattr;
727 struct nfs_setattrargs {
728 struct nfs4_sequence_args seq_args;
730 nfs4_stateid stateid;
732 const struct nfs_server * server; /* Needed for name mapping */
734 const struct nfs4_label *label;
737 struct nfs_setaclargs {
738 struct nfs4_sequence_args seq_args;
741 struct page ** acl_pages;
744 struct nfs_setaclres {
745 struct nfs4_sequence_res seq_res;
748 struct nfs_getaclargs {
749 struct nfs4_sequence_args seq_args;
752 struct page ** acl_pages;
755 /* getxattr ACL interface flags */
756 #define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
757 struct nfs_getaclres {
758 struct nfs4_sequence_res seq_res;
760 size_t acl_data_offset;
762 struct page * acl_scratch;
765 struct nfs_setattrres {
766 struct nfs4_sequence_res seq_res;
767 struct nfs_fattr * fattr;
768 struct nfs4_label *label;
769 const struct nfs_server * server;
772 struct nfs_linkargs {
773 struct nfs_fh * fromfh;
774 struct nfs_fh * tofh;
779 struct nfs_symlinkargs {
780 struct nfs_fh * fromfh;
781 const char * fromname;
782 unsigned int fromlen;
783 struct page ** pages;
784 unsigned int pathlen;
785 struct iattr * sattr;
788 struct nfs_readdirargs {
792 struct page ** pages;
795 struct nfs3_getaclargs {
798 struct page ** pages;
801 struct nfs3_setaclargs {
802 struct inode * inode;
804 struct posix_acl * acl_access;
805 struct posix_acl * acl_default;
808 struct page ** pages;
813 struct nfs_fattr * fattr;
816 struct nfs_readlinkargs {
820 struct page ** pages;
823 struct nfs3_sattrargs {
825 struct iattr * sattr;
827 struct timespec guardtime;
830 struct nfs3_diropargs {
836 struct nfs3_accessargs {
841 struct nfs3_createargs {
845 struct iattr * sattr;
846 enum nfs3_createmode createmode;
850 struct nfs3_mkdirargs {
854 struct iattr * sattr;
857 struct nfs3_symlinkargs {
858 struct nfs_fh * fromfh;
859 const char * fromname;
860 unsigned int fromlen;
861 struct page ** pages;
862 unsigned int pathlen;
863 struct iattr * sattr;
866 struct nfs3_mknodargs {
870 enum nfs3_ftype type;
871 struct iattr * sattr;
875 struct nfs3_linkargs {
876 struct nfs_fh * fromfh;
877 struct nfs_fh * tofh;
882 struct nfs3_readdirargs {
888 struct page ** pages;
891 struct nfs3_diropres {
892 struct nfs_fattr * dir_attr;
894 struct nfs_fattr * fattr;
897 struct nfs3_accessres {
898 struct nfs_fattr * fattr;
902 struct nfs3_readlinkargs {
906 struct page ** pages;
909 struct nfs3_linkres {
910 struct nfs_fattr * dir_attr;
911 struct nfs_fattr * fattr;
914 struct nfs3_readdirres {
915 struct nfs_fattr * dir_attr;
920 struct nfs3_getaclres {
921 struct nfs_fattr * fattr;
923 unsigned int acl_access_count;
924 unsigned int acl_default_count;
925 struct posix_acl * acl_access;
926 struct posix_acl * acl_default;
929 #if IS_ENABLED(CONFIG_NFS_V4)
931 typedef u64 clientid4;
933 struct nfs4_accessargs {
934 struct nfs4_sequence_args seq_args;
935 const struct nfs_fh * fh;
940 struct nfs4_accessres {
941 struct nfs4_sequence_res seq_res;
942 const struct nfs_server * server;
943 struct nfs_fattr * fattr;
948 struct nfs4_create_arg {
949 struct nfs4_sequence_args seq_args;
953 struct page ** pages;
955 } symlink; /* NF4LNK */
959 } device; /* NF4BLK, NF4CHR */
961 const struct qstr * name;
962 const struct nfs_server * server;
963 const struct iattr * attrs;
964 const struct nfs_fh * dir_fh;
966 const struct nfs4_label *label;
970 struct nfs4_create_res {
971 struct nfs4_sequence_res seq_res;
972 const struct nfs_server * server;
974 struct nfs_fattr * fattr;
975 struct nfs4_label *label;
976 struct nfs4_change_info dir_cinfo;
979 struct nfs4_fsinfo_arg {
980 struct nfs4_sequence_args seq_args;
981 const struct nfs_fh * fh;
985 struct nfs4_fsinfo_res {
986 struct nfs4_sequence_res seq_res;
987 struct nfs_fsinfo *fsinfo;
990 struct nfs4_getattr_arg {
991 struct nfs4_sequence_args seq_args;
992 const struct nfs_fh * fh;
996 struct nfs4_getattr_res {
997 struct nfs4_sequence_res seq_res;
998 const struct nfs_server * server;
999 struct nfs_fattr * fattr;
1000 struct nfs4_label *label;
1003 struct nfs4_link_arg {
1004 struct nfs4_sequence_args seq_args;
1005 const struct nfs_fh * fh;
1006 const struct nfs_fh * dir_fh;
1007 const struct qstr * name;
1008 const u32 * bitmask;
1011 struct nfs4_link_res {
1012 struct nfs4_sequence_res seq_res;
1013 const struct nfs_server * server;
1014 struct nfs_fattr * fattr;
1015 struct nfs4_label *label;
1016 struct nfs4_change_info cinfo;
1017 struct nfs_fattr * dir_attr;
1020 struct nfs4_lookup_arg {
1021 struct nfs4_sequence_args seq_args;
1022 const struct nfs_fh * dir_fh;
1023 const struct qstr * name;
1024 const u32 * bitmask;
1027 struct nfs4_lookup_res {
1028 struct nfs4_sequence_res seq_res;
1029 const struct nfs_server * server;
1030 struct nfs_fattr * fattr;
1032 struct nfs4_label *label;
1035 struct nfs4_lookupp_arg {
1036 struct nfs4_sequence_args seq_args;
1037 const struct nfs_fh *fh;
1041 struct nfs4_lookupp_res {
1042 struct nfs4_sequence_res seq_res;
1043 const struct nfs_server *server;
1044 struct nfs_fattr *fattr;
1046 struct nfs4_label *label;
1049 struct nfs4_lookup_root_arg {
1050 struct nfs4_sequence_args seq_args;
1051 const u32 * bitmask;
1054 struct nfs4_pathconf_arg {
1055 struct nfs4_sequence_args seq_args;
1056 const struct nfs_fh * fh;
1057 const u32 * bitmask;
1060 struct nfs4_pathconf_res {
1061 struct nfs4_sequence_res seq_res;
1062 struct nfs_pathconf *pathconf;
1065 struct nfs4_readdir_arg {
1066 struct nfs4_sequence_args seq_args;
1067 const struct nfs_fh * fh;
1069 nfs4_verifier verifier;
1071 struct page ** pages; /* zero-copy data */
1072 unsigned int pgbase; /* zero-copy data */
1073 const u32 * bitmask;
1077 struct nfs4_readdir_res {
1078 struct nfs4_sequence_res seq_res;
1079 nfs4_verifier verifier;
1080 unsigned int pgbase;
1083 struct nfs4_readlink {
1084 struct nfs4_sequence_args seq_args;
1085 const struct nfs_fh * fh;
1086 unsigned int pgbase;
1087 unsigned int pglen; /* zero-copy data */
1088 struct page ** pages; /* zero-copy data */
1091 struct nfs4_readlink_res {
1092 struct nfs4_sequence_res seq_res;
1095 struct nfs4_setclientid {
1096 const nfs4_verifier * sc_verifier;
1098 unsigned int sc_netid_len;
1099 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
1100 unsigned int sc_uaddr_len;
1101 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
1102 struct nfs_client *sc_clnt;
1103 struct rpc_cred *sc_cred;
1106 struct nfs4_setclientid_res {
1108 nfs4_verifier confirm;
1111 struct nfs4_statfs_arg {
1112 struct nfs4_sequence_args seq_args;
1113 const struct nfs_fh * fh;
1114 const u32 * bitmask;
1117 struct nfs4_statfs_res {
1118 struct nfs4_sequence_res seq_res;
1119 struct nfs_fsstat *fsstat;
1122 struct nfs4_server_caps_arg {
1123 struct nfs4_sequence_args seq_args;
1124 struct nfs_fh *fhandle;
1125 const u32 * bitmask;
1128 struct nfs4_server_caps_res {
1129 struct nfs4_sequence_res seq_res;
1130 u32 attr_bitmask[3];
1131 u32 exclcreat_bitmask[3];
1138 #define NFS4_PATHNAME_MAXCOMPONENTS 512
1139 struct nfs4_pathname {
1140 unsigned int ncomponents;
1141 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
1144 #define NFS4_FS_LOCATION_MAXSERVERS 10
1145 struct nfs4_fs_location {
1146 unsigned int nservers;
1147 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
1148 struct nfs4_pathname rootpath;
1151 #define NFS4_FS_LOCATIONS_MAXENTRIES 10
1152 struct nfs4_fs_locations {
1153 struct nfs_fattr fattr;
1154 const struct nfs_server *server;
1155 struct nfs4_pathname fs_path;
1157 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
1160 struct nfs4_fs_locations_arg {
1161 struct nfs4_sequence_args seq_args;
1162 const struct nfs_fh *dir_fh;
1163 const struct nfs_fh *fh;
1164 const struct qstr *name;
1168 unsigned char migration:1, renew:1;
1171 struct nfs4_fs_locations_res {
1172 struct nfs4_sequence_res seq_res;
1173 struct nfs4_fs_locations *fs_locations;
1174 unsigned char migration:1, renew:1;
1177 struct nfs4_secinfo4 {
1179 struct rpcsec_gss_info flavor_info;
1182 struct nfs4_secinfo_flavors {
1183 unsigned int num_flavors;
1184 struct nfs4_secinfo4 flavors[0];
1187 struct nfs4_secinfo_arg {
1188 struct nfs4_sequence_args seq_args;
1189 const struct nfs_fh *dir_fh;
1190 const struct qstr *name;
1193 struct nfs4_secinfo_res {
1194 struct nfs4_sequence_res seq_res;
1195 struct nfs4_secinfo_flavors *flavors;
1198 struct nfs4_fsid_present_arg {
1199 struct nfs4_sequence_args seq_args;
1200 const struct nfs_fh *fh;
1202 unsigned char renew:1;
1205 struct nfs4_fsid_present_res {
1206 struct nfs4_sequence_res seq_res;
1208 unsigned char renew:1;
1211 #endif /* CONFIG_NFS_V4 */
1218 #ifdef CONFIG_NFS_V4_1
1220 struct pnfs_commit_bucket {
1221 struct list_head written;
1222 struct list_head committing;
1223 struct pnfs_layout_segment *wlseg;
1224 struct pnfs_layout_segment *clseg;
1225 struct nfs_writeverf direct_verf;
1228 struct pnfs_ds_commit_info {
1232 struct pnfs_commit_bucket *buckets;
1235 struct nfs41_state_protection {
1237 struct nfs4_op_map enforce;
1238 struct nfs4_op_map allow;
1241 struct nfs41_exchange_id_args {
1242 struct nfs_client *client;
1243 nfs4_verifier verifier;
1245 struct nfs41_state_protection state_protect;
1248 struct nfs41_server_owner {
1250 uint32_t major_id_sz;
1251 char major_id[NFS4_OPAQUE_LIMIT];
1254 struct nfs41_server_scope {
1255 uint32_t server_scope_sz;
1256 char server_scope[NFS4_OPAQUE_LIMIT];
1259 struct nfs41_impl_id {
1260 char domain[NFS4_OPAQUE_LIMIT + 1];
1261 char name[NFS4_OPAQUE_LIMIT + 1];
1262 struct nfstime4 date;
1265 struct nfs41_bind_conn_to_session_args {
1266 struct nfs_client *client;
1267 struct nfs4_sessionid sessionid;
1269 bool use_conn_in_rdma_mode;
1272 struct nfs41_bind_conn_to_session_res {
1273 struct nfs4_sessionid sessionid;
1275 bool use_conn_in_rdma_mode;
1278 struct nfs41_exchange_id_res {
1282 struct nfs41_server_owner *server_owner;
1283 struct nfs41_server_scope *server_scope;
1284 struct nfs41_impl_id *impl_id;
1285 struct nfs41_state_protection state_protect;
1288 struct nfs41_create_session_args {
1289 struct nfs_client *client;
1293 uint32_t cb_program;
1294 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1295 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1298 struct nfs41_create_session_res {
1299 struct nfs4_sessionid sessionid;
1302 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1303 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1306 struct nfs41_reclaim_complete_args {
1307 struct nfs4_sequence_args seq_args;
1308 /* In the future extend to include curr_fh for use with migration */
1309 unsigned char one_fs:1;
1312 struct nfs41_reclaim_complete_res {
1313 struct nfs4_sequence_res seq_res;
1316 #define SECINFO_STYLE_CURRENT_FH 0
1317 #define SECINFO_STYLE_PARENT 1
1318 struct nfs41_secinfo_no_name_args {
1319 struct nfs4_sequence_args seq_args;
1323 struct nfs41_test_stateid_args {
1324 struct nfs4_sequence_args seq_args;
1325 nfs4_stateid *stateid;
1328 struct nfs41_test_stateid_res {
1329 struct nfs4_sequence_res seq_res;
1330 unsigned int status;
1333 struct nfs41_free_stateid_args {
1334 struct nfs4_sequence_args seq_args;
1335 nfs4_stateid stateid;
1338 struct nfs41_free_stateid_res {
1339 struct nfs4_sequence_res seq_res;
1340 unsigned int status;
1344 nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1346 kfree(cinfo->buckets);
1351 struct pnfs_ds_commit_info {
1355 nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1359 #endif /* CONFIG_NFS_V4_1 */
1361 #ifdef CONFIG_NFS_V4_2
1362 struct nfs42_falloc_args {
1363 struct nfs4_sequence_args seq_args;
1365 struct nfs_fh *falloc_fh;
1366 nfs4_stateid falloc_stateid;
1369 const u32 *falloc_bitmask;
1372 struct nfs42_falloc_res {
1373 struct nfs4_sequence_res seq_res;
1374 unsigned int status;
1376 struct nfs_fattr *falloc_fattr;
1377 const struct nfs_server *falloc_server;
1380 struct nfs42_copy_args {
1381 struct nfs4_sequence_args seq_args;
1383 struct nfs_fh *src_fh;
1384 nfs4_stateid src_stateid;
1387 struct nfs_fh *dst_fh;
1388 nfs4_stateid dst_stateid;
1394 struct nfs42_write_res {
1396 struct nfs_writeverf verifier;
1399 struct nfs42_copy_res {
1400 struct nfs4_sequence_res seq_res;
1401 struct nfs42_write_res write_res;
1404 struct nfs_commitres commit_res;
1407 struct nfs42_seek_args {
1408 struct nfs4_sequence_args seq_args;
1410 struct nfs_fh *sa_fh;
1411 nfs4_stateid sa_stateid;
1416 struct nfs42_seek_res {
1417 struct nfs4_sequence_res seq_res;
1418 unsigned int status;
1427 #define NFS_PAGEVEC_SIZE (8U)
1429 struct nfs_page_array {
1430 struct page **pagevec;
1431 unsigned int npages; /* Max length of pagevec */
1432 struct page *page_array[NFS_PAGEVEC_SIZE];
1435 /* used as flag bits in nfs_pgio_header */
1437 NFS_IOHDR_ERROR = 0,
1443 struct nfs_io_completion;
1444 struct nfs_pgio_header {
1445 struct inode *inode;
1446 struct rpc_cred *cred;
1447 struct list_head pages;
1448 struct nfs_page *req;
1449 struct nfs_writeverf verf; /* Used for writes */
1451 struct pnfs_layout_segment *lseg;
1453 const struct rpc_call_ops *mds_ops;
1454 void (*release) (struct nfs_pgio_header *hdr);
1455 const struct nfs_pgio_completion_ops *completion_ops;
1456 const struct nfs_rw_ops *rw_ops;
1457 struct nfs_io_completion *io_completion;
1458 struct nfs_direct_req *dreq;
1460 /* fields protected by lock */
1462 int error; /* merge with pnfs_error */
1463 unsigned long good_bytes; /* boundary of good data */
1464 unsigned long flags;
1469 struct rpc_task task;
1470 struct nfs_fattr fattr;
1471 struct nfs_pgio_args args; /* argument struct */
1472 struct nfs_pgio_res res; /* result struct */
1473 unsigned long timestamp; /* For lease renewal */
1474 int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
1475 __u64 mds_offset; /* Filelayout dense stripe */
1476 struct nfs_page_array page_array;
1477 struct nfs_client *ds_clp; /* pNFS data server */
1478 int ds_commit_idx; /* ds index if ds_clp is set */
1479 int pgio_mirror_idx;/* mirror index in pgio layer */
1482 struct nfs_mds_commit_info {
1484 atomic_long_t ncommit;
1485 struct list_head list;
1488 struct nfs_commit_info;
1489 struct nfs_commit_data;
1491 struct nfs_commit_completion_ops {
1492 void (*completion) (struct nfs_commit_data *data);
1493 void (*resched_write) (struct nfs_commit_info *, struct nfs_page *);
1496 struct nfs_commit_info {
1497 struct inode *inode; /* Needed for inode->i_lock */
1498 struct nfs_mds_commit_info *mds;
1499 struct pnfs_ds_commit_info *ds;
1500 struct nfs_direct_req *dreq; /* O_DIRECT request */
1501 const struct nfs_commit_completion_ops *completion_ops;
1504 struct nfs_commit_data {
1505 struct rpc_task task;
1506 struct inode *inode;
1507 struct rpc_cred *cred;
1508 struct nfs_fattr fattr;
1509 struct nfs_writeverf verf;
1510 struct list_head pages; /* Coalesced requests we wish to flush */
1511 struct list_head list; /* lists of struct nfs_write_data */
1512 struct nfs_direct_req *dreq; /* O_DIRECT request */
1513 struct nfs_commitargs args; /* argument struct */
1514 struct nfs_commitres res; /* result struct */
1515 struct nfs_open_context *context;
1516 struct pnfs_layout_segment *lseg;
1517 struct nfs_client *ds_clp; /* pNFS data server */
1518 int ds_commit_index;
1520 const struct rpc_call_ops *mds_ops;
1521 const struct nfs_commit_completion_ops *completion_ops;
1522 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
1523 unsigned long flags;
1526 struct nfs_pgio_completion_ops {
1527 void (*error_cleanup)(struct list_head *head);
1528 void (*init_hdr)(struct nfs_pgio_header *hdr);
1529 void (*completion)(struct nfs_pgio_header *hdr);
1530 void (*reschedule_io)(struct nfs_pgio_header *hdr);
1533 struct nfs_unlinkdata {
1534 struct nfs_removeargs args;
1535 struct nfs_removeres res;
1536 struct dentry *dentry;
1537 wait_queue_head_t wq;
1538 struct rpc_cred *cred;
1539 struct nfs_fattr dir_attr;
1543 struct nfs_renamedata {
1544 struct nfs_renameargs args;
1545 struct nfs_renameres res;
1546 struct rpc_cred *cred;
1547 struct inode *old_dir;
1548 struct dentry *old_dentry;
1549 struct nfs_fattr old_fattr;
1550 struct inode *new_dir;
1551 struct dentry *new_dentry;
1552 struct nfs_fattr new_fattr;
1553 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
1558 struct nfs_access_entry;
1561 struct nfs_subversion;
1562 struct nfs_mount_info;
1563 struct nfs_client_initdata;
1564 struct nfs_pageio_descriptor;
1567 * RPC procedure vector for NFSv2/NFSv3 demuxing
1569 struct nfs_rpc_ops {
1570 u32 version; /* Protocol version */
1571 const struct dentry_operations *dentry_ops;
1572 const struct inode_operations *dir_inode_ops;
1573 const struct inode_operations *file_inode_ops;
1574 const struct file_operations *file_ops;
1575 const struct nlmclnt_operations *nlmclnt_ops;
1577 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1578 struct nfs_fsinfo *);
1579 struct vfsmount *(*submount) (struct nfs_server *, struct dentry *,
1580 struct nfs_fh *, struct nfs_fattr *);
1581 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
1582 struct nfs_subversion *);
1583 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1584 struct nfs_fattr *, struct nfs4_label *,
1586 int (*setattr) (struct dentry *, struct nfs_fattr *,
1588 int (*lookup) (struct inode *, const struct qstr *,
1589 struct nfs_fh *, struct nfs_fattr *,
1590 struct nfs4_label *);
1591 int (*lookupp) (struct inode *, struct nfs_fh *,
1592 struct nfs_fattr *, struct nfs4_label *);
1593 int (*access) (struct inode *, struct nfs_access_entry *);
1594 int (*readlink)(struct inode *, struct page *, unsigned int,
1596 int (*create) (struct inode *, struct dentry *,
1597 struct iattr *, int);
1598 int (*remove) (struct inode *, struct dentry *);
1599 void (*unlink_setup) (struct rpc_message *, struct dentry *, struct inode *);
1600 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1601 int (*unlink_done) (struct rpc_task *, struct inode *);
1602 void (*rename_setup) (struct rpc_message *msg,
1603 struct dentry *old_dentry,
1604 struct dentry *new_dentry);
1605 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
1606 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1607 int (*link) (struct inode *, struct inode *, const struct qstr *);
1608 int (*symlink) (struct inode *, struct dentry *, struct page *,
1609 unsigned int, struct iattr *);
1610 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1611 int (*rmdir) (struct inode *, const struct qstr *);
1612 int (*readdir) (struct dentry *, struct rpc_cred *,
1613 u64, struct page **, unsigned int, bool);
1614 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1616 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1617 struct nfs_fsstat *);
1618 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1619 struct nfs_fsinfo *);
1620 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1621 struct nfs_pathconf *);
1622 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1623 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, bool);
1624 int (*pgio_rpc_prepare)(struct rpc_task *,
1625 struct nfs_pgio_header *);
1626 void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
1627 int (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
1628 void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *,
1629 struct rpc_clnt **);
1630 int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
1631 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *,
1632 struct rpc_clnt **);
1633 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1634 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
1635 int (*lock)(struct file *, int, struct file_lock *);
1636 int (*lock_check_bounds)(const struct file_lock *);
1637 void (*clear_acl_cache)(struct inode *);
1638 void (*close_context)(struct nfs_open_context *ctx, int);
1639 struct inode * (*open_context) (struct inode *dir,
1640 struct nfs_open_context *ctx,
1642 struct iattr *iattr,
1644 int (*have_delegation)(struct inode *, fmode_t);
1645 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
1646 struct nfs_client *(*init_client) (struct nfs_client *,
1647 const struct nfs_client_initdata *);
1648 void (*free_client) (struct nfs_client *);
1649 struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *);
1650 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
1651 struct nfs_fattr *, rpc_authflavor_t);
1655 * NFS_CALL(getattr, inode, (fattr));
1657 * NFS_PROTO(inode)->getattr(fattr);
1659 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1662 * Function vectors etc. for the NFS client
1664 extern const struct nfs_rpc_ops nfs_v2_clientops;
1665 extern const struct nfs_rpc_ops nfs_v3_clientops;
1666 extern const struct nfs_rpc_ops nfs_v4_clientops;
1667 extern const struct rpc_version nfs_version2;
1668 extern const struct rpc_version nfs_version3;
1669 extern const struct rpc_version nfs_version4;
1671 extern const struct rpc_version nfsacl_version3;
1672 extern const struct rpc_program nfsacl_program;