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;
262 __u32 return_on_close;
263 struct pnfs_layout_range range;
265 nfs4_stateid stateid;
266 struct nfs4_layoutdriver_data *layoutp;
269 struct nfs4_layoutget {
270 struct nfs4_layoutget_args args;
271 struct nfs4_layoutget_res res;
272 struct rpc_cred *cred;
276 struct nfs4_getdeviceinfo_args {
277 struct nfs4_sequence_args seq_args;
278 struct pnfs_device *pdev;
282 struct nfs4_getdeviceinfo_res {
283 struct nfs4_sequence_res seq_res;
284 struct pnfs_device *pdev;
288 struct nfs4_layoutcommit_args {
289 struct nfs4_sequence_args seq_args;
290 nfs4_stateid stateid;
291 __u64 lastbytewritten;
294 size_t layoutupdate_len;
295 struct page *layoutupdate_page;
296 struct page **layoutupdate_pages;
300 struct nfs4_layoutcommit_res {
301 struct nfs4_sequence_res seq_res;
302 struct nfs_fattr *fattr;
303 const struct nfs_server *server;
307 struct nfs4_layoutcommit_data {
308 struct rpc_task task;
309 struct nfs_fattr fattr;
310 struct list_head lseg_list;
311 struct rpc_cred *cred;
313 struct nfs4_layoutcommit_args args;
314 struct nfs4_layoutcommit_res res;
317 struct nfs4_layoutreturn_args {
318 struct nfs4_sequence_args seq_args;
319 struct pnfs_layout_hdr *layout;
321 struct pnfs_layout_range range;
322 nfs4_stateid stateid;
324 struct nfs4_xdr_opaque_data *ld_private;
327 struct nfs4_layoutreturn_res {
328 struct nfs4_sequence_res seq_res;
330 nfs4_stateid stateid;
333 struct nfs4_layoutreturn {
334 struct nfs4_layoutreturn_args args;
335 struct nfs4_layoutreturn_res res;
336 struct rpc_cred *cred;
337 struct nfs_client *clp;
340 struct nfs4_xdr_opaque_data ld_private;
343 #define PNFS_LAYOUTSTATS_MAXSIZE 256
345 struct nfs42_layoutstat_args;
346 struct nfs42_layoutstat_devinfo;
347 typedef void (*layoutstats_encode_t)(struct xdr_stream *,
348 struct nfs42_layoutstat_args *,
349 struct nfs42_layoutstat_devinfo *);
351 /* Per file per deviceid layoutstats */
352 struct nfs42_layoutstat_devinfo {
353 struct nfs4_deviceid dev_id;
361 struct nfs4_xdr_opaque_data ld_private;
364 struct nfs42_layoutstat_args {
365 struct nfs4_sequence_args seq_args;
368 nfs4_stateid stateid;
370 struct nfs42_layoutstat_devinfo *devinfo;
373 struct nfs42_layoutstat_res {
374 struct nfs4_sequence_res seq_res;
379 struct nfs42_layoutstat_data {
381 struct nfs42_layoutstat_args args;
382 struct nfs42_layoutstat_res res;
385 struct nfs42_clone_args {
386 struct nfs4_sequence_args seq_args;
387 struct nfs_fh *src_fh;
388 struct nfs_fh *dst_fh;
389 nfs4_stateid src_stateid;
390 nfs4_stateid dst_stateid;
394 const u32 *dst_bitmask;
397 struct nfs42_clone_res {
398 struct nfs4_sequence_res seq_res;
399 unsigned int rpc_status;
400 struct nfs_fattr *dst_fattr;
401 const struct nfs_server *server;
404 struct stateowner_id {
410 * Arguments to the open call.
412 struct nfs_openargs {
413 struct nfs4_sequence_args seq_args;
414 const struct nfs_fh * fh;
415 struct nfs_seqid * seqid;
421 struct stateowner_id id;
424 struct iattr * attrs; /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */
425 nfs4_verifier verifier; /* EXCLUSIVE */
427 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
428 fmode_t delegation_type; /* CLAIM_PREVIOUS */
430 const struct qstr * name;
431 const struct nfs_server *server; /* Needed for ID mapping */
433 const u32 * open_bitmap;
434 enum open_claim_type4 claim;
435 enum createmode4 createmode;
436 const struct nfs4_label *label;
441 struct nfs4_sequence_res seq_res;
442 nfs4_stateid stateid;
444 struct nfs4_change_info cinfo;
446 struct nfs_fattr * f_attr;
447 struct nfs4_label *f_label;
448 struct nfs_seqid * seqid;
449 const struct nfs_server *server;
450 fmode_t delegation_type;
451 nfs4_stateid delegation;
452 unsigned long pagemod_limit;
454 __u32 attrset[NFS4_BITMAP_SIZE];
455 struct nfs4_string *owner;
456 struct nfs4_string *group_owner;
457 __u32 access_request;
458 __u32 access_supported;
463 * Arguments to the open_confirm call.
465 struct nfs_open_confirmargs {
466 struct nfs4_sequence_args seq_args;
467 const struct nfs_fh * fh;
468 nfs4_stateid * stateid;
469 struct nfs_seqid * seqid;
472 struct nfs_open_confirmres {
473 struct nfs4_sequence_res seq_res;
474 nfs4_stateid stateid;
475 struct nfs_seqid * seqid;
479 * Arguments to the close call.
481 struct nfs_closeargs {
482 struct nfs4_sequence_args seq_args;
484 nfs4_stateid stateid;
485 struct nfs_seqid * seqid;
489 struct nfs4_layoutreturn_args *lr_args;
492 struct nfs_closeres {
493 struct nfs4_sequence_res seq_res;
494 nfs4_stateid stateid;
495 struct nfs_fattr * fattr;
496 struct nfs_seqid * seqid;
497 const struct nfs_server *server;
498 struct nfs4_layoutreturn_res *lr_res;
502 * * Arguments to the lock,lockt, and locku call.
510 struct nfs_lock_args {
511 struct nfs4_sequence_args seq_args;
513 struct file_lock * fl;
514 struct nfs_seqid * lock_seqid;
515 nfs4_stateid lock_stateid;
516 struct nfs_seqid * open_seqid;
517 nfs4_stateid open_stateid;
518 struct nfs_lowner lock_owner;
519 unsigned char block : 1;
520 unsigned char reclaim : 1;
521 unsigned char new_lock : 1;
522 unsigned char new_lock_owner : 1;
525 struct nfs_lock_res {
526 struct nfs4_sequence_res seq_res;
527 nfs4_stateid stateid;
528 struct nfs_seqid * lock_seqid;
529 struct nfs_seqid * open_seqid;
532 struct nfs_locku_args {
533 struct nfs4_sequence_args seq_args;
535 struct file_lock * fl;
536 struct nfs_seqid * seqid;
537 nfs4_stateid stateid;
540 struct nfs_locku_res {
541 struct nfs4_sequence_res seq_res;
542 nfs4_stateid stateid;
543 struct nfs_seqid * seqid;
546 struct nfs_lockt_args {
547 struct nfs4_sequence_args seq_args;
549 struct file_lock * fl;
550 struct nfs_lowner lock_owner;
553 struct nfs_lockt_res {
554 struct nfs4_sequence_res seq_res;
555 struct file_lock * denied; /* LOCK, LOCKT failed */
558 struct nfs_release_lockowner_args {
559 struct nfs4_sequence_args seq_args;
560 struct nfs_lowner lock_owner;
563 struct nfs_release_lockowner_res {
564 struct nfs4_sequence_res seq_res;
567 struct nfs4_delegreturnargs {
568 struct nfs4_sequence_args seq_args;
569 const struct nfs_fh *fhandle;
570 const nfs4_stateid *stateid;
572 struct nfs4_layoutreturn_args *lr_args;
575 struct nfs4_delegreturnres {
576 struct nfs4_sequence_res seq_res;
577 struct nfs_fattr * fattr;
578 struct nfs_server *server;
579 struct nfs4_layoutreturn_res *lr_res;
584 * Arguments to the write call.
586 struct nfs_write_verifier {
590 struct nfs_writeverf {
591 struct nfs_write_verifier verifier;
592 enum nfs3_stable_how committed;
596 * Arguments shared by the read and write call.
598 struct nfs_pgio_args {
599 struct nfs4_sequence_args seq_args;
601 struct nfs_open_context *context;
602 struct nfs_lock_context *lock_context;
603 nfs4_stateid stateid;
607 struct page ** pages;
608 const u32 * bitmask; /* used by write */
609 enum nfs3_stable_how stable; /* used by write */
612 struct nfs_pgio_res {
613 struct nfs4_sequence_res seq_res;
614 struct nfs_fattr * fattr;
617 int eof; /* used by read */
618 struct nfs_writeverf * verf; /* used by write */
619 const struct nfs_server *server; /* used by write */
624 * Arguments to the commit call.
626 struct nfs_commitargs {
627 struct nfs4_sequence_args seq_args;
634 struct nfs_commitres {
635 struct nfs4_sequence_res seq_res;
637 struct nfs_fattr *fattr;
638 struct nfs_writeverf *verf;
639 const struct nfs_server *server;
643 * Common arguments to the unlink call
645 struct nfs_removeargs {
646 struct nfs4_sequence_args seq_args;
647 const struct nfs_fh *fh;
651 struct nfs_removeres {
652 struct nfs4_sequence_res seq_res;
653 struct nfs_server *server;
654 struct nfs_fattr *dir_attr;
655 struct nfs4_change_info cinfo;
659 * Common arguments to the rename call
661 struct nfs_renameargs {
662 struct nfs4_sequence_args seq_args;
663 const struct nfs_fh *old_dir;
664 const struct nfs_fh *new_dir;
665 const struct qstr *old_name;
666 const struct qstr *new_name;
669 struct nfs_renameres {
670 struct nfs4_sequence_res seq_res;
671 struct nfs_server *server;
672 struct nfs4_change_info old_cinfo;
673 struct nfs_fattr *old_fattr;
674 struct nfs4_change_info new_cinfo;
675 struct nfs_fattr *new_fattr;
678 /* parsed sec= options */
679 #define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
680 struct nfs_auth_info {
681 unsigned int flavor_len;
682 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS];
686 * Argument struct for decode_entry function
696 struct nfs_fattr * fattr;
697 struct nfs4_label *label;
698 unsigned char d_type;
699 struct nfs_server * server;
703 * The following types are for NFSv2 only.
705 struct nfs_sattrargs {
707 struct iattr * sattr;
710 struct nfs_diropargs {
716 struct nfs_createargs {
720 struct iattr * sattr;
723 struct nfs_setattrargs {
724 struct nfs4_sequence_args seq_args;
726 nfs4_stateid stateid;
728 const struct nfs_server * server; /* Needed for name mapping */
730 const struct nfs4_label *label;
733 struct nfs_setaclargs {
734 struct nfs4_sequence_args seq_args;
737 struct page ** acl_pages;
740 struct nfs_setaclres {
741 struct nfs4_sequence_res seq_res;
744 struct nfs_getaclargs {
745 struct nfs4_sequence_args seq_args;
748 struct page ** acl_pages;
751 /* getxattr ACL interface flags */
752 #define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
753 struct nfs_getaclres {
754 struct nfs4_sequence_res seq_res;
756 size_t acl_data_offset;
758 struct page * acl_scratch;
761 struct nfs_setattrres {
762 struct nfs4_sequence_res seq_res;
763 struct nfs_fattr * fattr;
764 struct nfs4_label *label;
765 const struct nfs_server * server;
768 struct nfs_linkargs {
769 struct nfs_fh * fromfh;
770 struct nfs_fh * tofh;
775 struct nfs_symlinkargs {
776 struct nfs_fh * fromfh;
777 const char * fromname;
778 unsigned int fromlen;
779 struct page ** pages;
780 unsigned int pathlen;
781 struct iattr * sattr;
784 struct nfs_readdirargs {
788 struct page ** pages;
791 struct nfs3_getaclargs {
794 struct page ** pages;
797 struct nfs3_setaclargs {
798 struct inode * inode;
800 struct posix_acl * acl_access;
801 struct posix_acl * acl_default;
804 struct page ** pages;
809 struct nfs_fattr * fattr;
812 struct nfs_readlinkargs {
816 struct page ** pages;
819 struct nfs3_sattrargs {
821 struct iattr * sattr;
823 struct timespec guardtime;
826 struct nfs3_diropargs {
832 struct nfs3_accessargs {
837 struct nfs3_createargs {
841 struct iattr * sattr;
842 enum nfs3_createmode createmode;
846 struct nfs3_mkdirargs {
850 struct iattr * sattr;
853 struct nfs3_symlinkargs {
854 struct nfs_fh * fromfh;
855 const char * fromname;
856 unsigned int fromlen;
857 struct page ** pages;
858 unsigned int pathlen;
859 struct iattr * sattr;
862 struct nfs3_mknodargs {
866 enum nfs3_ftype type;
867 struct iattr * sattr;
871 struct nfs3_linkargs {
872 struct nfs_fh * fromfh;
873 struct nfs_fh * tofh;
878 struct nfs3_readdirargs {
884 struct page ** pages;
887 struct nfs3_diropres {
888 struct nfs_fattr * dir_attr;
890 struct nfs_fattr * fattr;
893 struct nfs3_accessres {
894 struct nfs_fattr * fattr;
898 struct nfs3_readlinkargs {
902 struct page ** pages;
905 struct nfs3_linkres {
906 struct nfs_fattr * dir_attr;
907 struct nfs_fattr * fattr;
910 struct nfs3_readdirres {
911 struct nfs_fattr * dir_attr;
916 struct nfs3_getaclres {
917 struct nfs_fattr * fattr;
919 unsigned int acl_access_count;
920 unsigned int acl_default_count;
921 struct posix_acl * acl_access;
922 struct posix_acl * acl_default;
925 #if IS_ENABLED(CONFIG_NFS_V4)
927 typedef u64 clientid4;
929 struct nfs4_accessargs {
930 struct nfs4_sequence_args seq_args;
931 const struct nfs_fh * fh;
936 struct nfs4_accessres {
937 struct nfs4_sequence_res seq_res;
938 const struct nfs_server * server;
939 struct nfs_fattr * fattr;
944 struct nfs4_create_arg {
945 struct nfs4_sequence_args seq_args;
949 struct page ** pages;
951 } symlink; /* NF4LNK */
955 } device; /* NF4BLK, NF4CHR */
957 const struct qstr * name;
958 const struct nfs_server * server;
959 const struct iattr * attrs;
960 const struct nfs_fh * dir_fh;
962 const struct nfs4_label *label;
966 struct nfs4_create_res {
967 struct nfs4_sequence_res seq_res;
968 const struct nfs_server * server;
970 struct nfs_fattr * fattr;
971 struct nfs4_label *label;
972 struct nfs4_change_info dir_cinfo;
975 struct nfs4_fsinfo_arg {
976 struct nfs4_sequence_args seq_args;
977 const struct nfs_fh * fh;
981 struct nfs4_fsinfo_res {
982 struct nfs4_sequence_res seq_res;
983 struct nfs_fsinfo *fsinfo;
986 struct nfs4_getattr_arg {
987 struct nfs4_sequence_args seq_args;
988 const struct nfs_fh * fh;
992 struct nfs4_getattr_res {
993 struct nfs4_sequence_res seq_res;
994 const struct nfs_server * server;
995 struct nfs_fattr * fattr;
996 struct nfs4_label *label;
999 struct nfs4_link_arg {
1000 struct nfs4_sequence_args seq_args;
1001 const struct nfs_fh * fh;
1002 const struct nfs_fh * dir_fh;
1003 const struct qstr * name;
1004 const u32 * bitmask;
1007 struct nfs4_link_res {
1008 struct nfs4_sequence_res seq_res;
1009 const struct nfs_server * server;
1010 struct nfs_fattr * fattr;
1011 struct nfs4_label *label;
1012 struct nfs4_change_info cinfo;
1013 struct nfs_fattr * dir_attr;
1016 struct nfs4_lookup_arg {
1017 struct nfs4_sequence_args seq_args;
1018 const struct nfs_fh * dir_fh;
1019 const struct qstr * name;
1020 const u32 * bitmask;
1023 struct nfs4_lookup_res {
1024 struct nfs4_sequence_res seq_res;
1025 const struct nfs_server * server;
1026 struct nfs_fattr * fattr;
1028 struct nfs4_label *label;
1031 struct nfs4_lookupp_arg {
1032 struct nfs4_sequence_args seq_args;
1033 const struct nfs_fh *fh;
1037 struct nfs4_lookupp_res {
1038 struct nfs4_sequence_res seq_res;
1039 const struct nfs_server *server;
1040 struct nfs_fattr *fattr;
1042 struct nfs4_label *label;
1045 struct nfs4_lookup_root_arg {
1046 struct nfs4_sequence_args seq_args;
1047 const u32 * bitmask;
1050 struct nfs4_pathconf_arg {
1051 struct nfs4_sequence_args seq_args;
1052 const struct nfs_fh * fh;
1053 const u32 * bitmask;
1056 struct nfs4_pathconf_res {
1057 struct nfs4_sequence_res seq_res;
1058 struct nfs_pathconf *pathconf;
1061 struct nfs4_readdir_arg {
1062 struct nfs4_sequence_args seq_args;
1063 const struct nfs_fh * fh;
1065 nfs4_verifier verifier;
1067 struct page ** pages; /* zero-copy data */
1068 unsigned int pgbase; /* zero-copy data */
1069 const u32 * bitmask;
1073 struct nfs4_readdir_res {
1074 struct nfs4_sequence_res seq_res;
1075 nfs4_verifier verifier;
1076 unsigned int pgbase;
1079 struct nfs4_readlink {
1080 struct nfs4_sequence_args seq_args;
1081 const struct nfs_fh * fh;
1082 unsigned int pgbase;
1083 unsigned int pglen; /* zero-copy data */
1084 struct page ** pages; /* zero-copy data */
1087 struct nfs4_readlink_res {
1088 struct nfs4_sequence_res seq_res;
1091 struct nfs4_setclientid {
1092 const nfs4_verifier * sc_verifier;
1094 unsigned int sc_netid_len;
1095 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
1096 unsigned int sc_uaddr_len;
1097 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
1098 struct nfs_client *sc_clnt;
1099 struct rpc_cred *sc_cred;
1102 struct nfs4_setclientid_res {
1104 nfs4_verifier confirm;
1107 struct nfs4_statfs_arg {
1108 struct nfs4_sequence_args seq_args;
1109 const struct nfs_fh * fh;
1110 const u32 * bitmask;
1113 struct nfs4_statfs_res {
1114 struct nfs4_sequence_res seq_res;
1115 struct nfs_fsstat *fsstat;
1118 struct nfs4_server_caps_arg {
1119 struct nfs4_sequence_args seq_args;
1120 struct nfs_fh *fhandle;
1121 const u32 * bitmask;
1124 struct nfs4_server_caps_res {
1125 struct nfs4_sequence_res seq_res;
1126 u32 attr_bitmask[3];
1127 u32 exclcreat_bitmask[3];
1134 #define NFS4_PATHNAME_MAXCOMPONENTS 512
1135 struct nfs4_pathname {
1136 unsigned int ncomponents;
1137 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
1140 #define NFS4_FS_LOCATION_MAXSERVERS 10
1141 struct nfs4_fs_location {
1142 unsigned int nservers;
1143 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
1144 struct nfs4_pathname rootpath;
1147 #define NFS4_FS_LOCATIONS_MAXENTRIES 10
1148 struct nfs4_fs_locations {
1149 struct nfs_fattr fattr;
1150 const struct nfs_server *server;
1151 struct nfs4_pathname fs_path;
1153 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
1156 struct nfs4_fs_locations_arg {
1157 struct nfs4_sequence_args seq_args;
1158 const struct nfs_fh *dir_fh;
1159 const struct nfs_fh *fh;
1160 const struct qstr *name;
1164 unsigned char migration:1, renew:1;
1167 struct nfs4_fs_locations_res {
1168 struct nfs4_sequence_res seq_res;
1169 struct nfs4_fs_locations *fs_locations;
1170 unsigned char migration:1, renew:1;
1173 struct nfs4_secinfo4 {
1175 struct rpcsec_gss_info flavor_info;
1178 struct nfs4_secinfo_flavors {
1179 unsigned int num_flavors;
1180 struct nfs4_secinfo4 flavors[0];
1183 struct nfs4_secinfo_arg {
1184 struct nfs4_sequence_args seq_args;
1185 const struct nfs_fh *dir_fh;
1186 const struct qstr *name;
1189 struct nfs4_secinfo_res {
1190 struct nfs4_sequence_res seq_res;
1191 struct nfs4_secinfo_flavors *flavors;
1194 struct nfs4_fsid_present_arg {
1195 struct nfs4_sequence_args seq_args;
1196 const struct nfs_fh *fh;
1198 unsigned char renew:1;
1201 struct nfs4_fsid_present_res {
1202 struct nfs4_sequence_res seq_res;
1204 unsigned char renew:1;
1207 #endif /* CONFIG_NFS_V4 */
1214 #ifdef CONFIG_NFS_V4_1
1216 struct pnfs_commit_bucket {
1217 struct list_head written;
1218 struct list_head committing;
1219 struct pnfs_layout_segment *wlseg;
1220 struct pnfs_layout_segment *clseg;
1221 struct nfs_writeverf direct_verf;
1224 struct pnfs_ds_commit_info {
1228 struct pnfs_commit_bucket *buckets;
1231 struct nfs41_state_protection {
1233 struct nfs4_op_map enforce;
1234 struct nfs4_op_map allow;
1237 struct nfs41_exchange_id_args {
1238 struct nfs_client *client;
1239 nfs4_verifier verifier;
1241 struct nfs41_state_protection state_protect;
1244 struct nfs41_server_owner {
1246 uint32_t major_id_sz;
1247 char major_id[NFS4_OPAQUE_LIMIT];
1250 struct nfs41_server_scope {
1251 uint32_t server_scope_sz;
1252 char server_scope[NFS4_OPAQUE_LIMIT];
1255 struct nfs41_impl_id {
1256 char domain[NFS4_OPAQUE_LIMIT + 1];
1257 char name[NFS4_OPAQUE_LIMIT + 1];
1258 struct nfstime4 date;
1261 struct nfs41_bind_conn_to_session_args {
1262 struct nfs_client *client;
1263 struct nfs4_sessionid sessionid;
1265 bool use_conn_in_rdma_mode;
1268 struct nfs41_bind_conn_to_session_res {
1269 struct nfs4_sessionid sessionid;
1271 bool use_conn_in_rdma_mode;
1274 struct nfs41_exchange_id_res {
1278 struct nfs41_server_owner *server_owner;
1279 struct nfs41_server_scope *server_scope;
1280 struct nfs41_impl_id *impl_id;
1281 struct nfs41_state_protection state_protect;
1284 struct nfs41_create_session_args {
1285 struct nfs_client *client;
1289 uint32_t cb_program;
1290 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1291 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1294 struct nfs41_create_session_res {
1295 struct nfs4_sessionid sessionid;
1298 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1299 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1302 struct nfs41_reclaim_complete_args {
1303 struct nfs4_sequence_args seq_args;
1304 /* In the future extend to include curr_fh for use with migration */
1305 unsigned char one_fs:1;
1308 struct nfs41_reclaim_complete_res {
1309 struct nfs4_sequence_res seq_res;
1312 #define SECINFO_STYLE_CURRENT_FH 0
1313 #define SECINFO_STYLE_PARENT 1
1314 struct nfs41_secinfo_no_name_args {
1315 struct nfs4_sequence_args seq_args;
1319 struct nfs41_test_stateid_args {
1320 struct nfs4_sequence_args seq_args;
1321 nfs4_stateid *stateid;
1324 struct nfs41_test_stateid_res {
1325 struct nfs4_sequence_res seq_res;
1326 unsigned int status;
1329 struct nfs41_free_stateid_args {
1330 struct nfs4_sequence_args seq_args;
1331 nfs4_stateid stateid;
1334 struct nfs41_free_stateid_res {
1335 struct nfs4_sequence_res seq_res;
1336 unsigned int status;
1340 nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1342 kfree(cinfo->buckets);
1347 struct pnfs_ds_commit_info {
1351 nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1355 #endif /* CONFIG_NFS_V4_1 */
1357 #ifdef CONFIG_NFS_V4_2
1358 struct nfs42_falloc_args {
1359 struct nfs4_sequence_args seq_args;
1361 struct nfs_fh *falloc_fh;
1362 nfs4_stateid falloc_stateid;
1365 const u32 *falloc_bitmask;
1368 struct nfs42_falloc_res {
1369 struct nfs4_sequence_res seq_res;
1370 unsigned int status;
1372 struct nfs_fattr *falloc_fattr;
1373 const struct nfs_server *falloc_server;
1376 struct nfs42_copy_args {
1377 struct nfs4_sequence_args seq_args;
1379 struct nfs_fh *src_fh;
1380 nfs4_stateid src_stateid;
1383 struct nfs_fh *dst_fh;
1384 nfs4_stateid dst_stateid;
1390 struct nfs42_write_res {
1392 struct nfs_writeverf verifier;
1395 struct nfs42_copy_res {
1396 struct nfs4_sequence_res seq_res;
1397 struct nfs42_write_res write_res;
1400 struct nfs_commitres commit_res;
1403 struct nfs42_seek_args {
1404 struct nfs4_sequence_args seq_args;
1406 struct nfs_fh *sa_fh;
1407 nfs4_stateid sa_stateid;
1412 struct nfs42_seek_res {
1413 struct nfs4_sequence_res seq_res;
1414 unsigned int status;
1423 #define NFS_PAGEVEC_SIZE (8U)
1425 struct nfs_page_array {
1426 struct page **pagevec;
1427 unsigned int npages; /* Max length of pagevec */
1428 struct page *page_array[NFS_PAGEVEC_SIZE];
1431 /* used as flag bits in nfs_pgio_header */
1433 NFS_IOHDR_ERROR = 0,
1439 struct nfs_io_completion;
1440 struct nfs_pgio_header {
1441 struct inode *inode;
1442 struct rpc_cred *cred;
1443 struct list_head pages;
1444 struct nfs_page *req;
1445 struct nfs_writeverf verf; /* Used for writes */
1447 struct pnfs_layout_segment *lseg;
1449 const struct rpc_call_ops *mds_ops;
1450 void (*release) (struct nfs_pgio_header *hdr);
1451 const struct nfs_pgio_completion_ops *completion_ops;
1452 const struct nfs_rw_ops *rw_ops;
1453 struct nfs_io_completion *io_completion;
1454 struct nfs_direct_req *dreq;
1456 /* fields protected by lock */
1458 int error; /* merge with pnfs_error */
1459 unsigned long good_bytes; /* boundary of good data */
1460 unsigned long flags;
1465 struct rpc_task task;
1466 struct nfs_fattr fattr;
1467 struct nfs_pgio_args args; /* argument struct */
1468 struct nfs_pgio_res res; /* result struct */
1469 unsigned long timestamp; /* For lease renewal */
1470 int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
1471 __u64 mds_offset; /* Filelayout dense stripe */
1472 struct nfs_page_array page_array;
1473 struct nfs_client *ds_clp; /* pNFS data server */
1474 int ds_commit_idx; /* ds index if ds_clp is set */
1475 int pgio_mirror_idx;/* mirror index in pgio layer */
1478 struct nfs_mds_commit_info {
1480 atomic_long_t ncommit;
1481 struct list_head list;
1484 struct nfs_commit_info;
1485 struct nfs_commit_data;
1487 struct nfs_commit_completion_ops {
1488 void (*completion) (struct nfs_commit_data *data);
1489 void (*resched_write) (struct nfs_commit_info *, struct nfs_page *);
1492 struct nfs_commit_info {
1493 struct inode *inode; /* Needed for inode->i_lock */
1494 struct nfs_mds_commit_info *mds;
1495 struct pnfs_ds_commit_info *ds;
1496 struct nfs_direct_req *dreq; /* O_DIRECT request */
1497 const struct nfs_commit_completion_ops *completion_ops;
1500 struct nfs_commit_data {
1501 struct rpc_task task;
1502 struct inode *inode;
1503 struct rpc_cred *cred;
1504 struct nfs_fattr fattr;
1505 struct nfs_writeverf verf;
1506 struct list_head pages; /* Coalesced requests we wish to flush */
1507 struct list_head list; /* lists of struct nfs_write_data */
1508 struct nfs_direct_req *dreq; /* O_DIRECT request */
1509 struct nfs_commitargs args; /* argument struct */
1510 struct nfs_commitres res; /* result struct */
1511 struct nfs_open_context *context;
1512 struct pnfs_layout_segment *lseg;
1513 struct nfs_client *ds_clp; /* pNFS data server */
1514 int ds_commit_index;
1516 const struct rpc_call_ops *mds_ops;
1517 const struct nfs_commit_completion_ops *completion_ops;
1518 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
1519 unsigned long flags;
1522 struct nfs_pgio_completion_ops {
1523 void (*error_cleanup)(struct list_head *head);
1524 void (*init_hdr)(struct nfs_pgio_header *hdr);
1525 void (*completion)(struct nfs_pgio_header *hdr);
1526 void (*reschedule_io)(struct nfs_pgio_header *hdr);
1529 struct nfs_unlinkdata {
1530 struct nfs_removeargs args;
1531 struct nfs_removeres res;
1532 struct dentry *dentry;
1533 wait_queue_head_t wq;
1534 struct rpc_cred *cred;
1535 struct nfs_fattr dir_attr;
1539 struct nfs_renamedata {
1540 struct nfs_renameargs args;
1541 struct nfs_renameres res;
1542 struct rpc_cred *cred;
1543 struct inode *old_dir;
1544 struct dentry *old_dentry;
1545 struct nfs_fattr old_fattr;
1546 struct inode *new_dir;
1547 struct dentry *new_dentry;
1548 struct nfs_fattr new_fattr;
1549 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
1554 struct nfs_access_entry;
1557 struct nfs_subversion;
1558 struct nfs_mount_info;
1559 struct nfs_client_initdata;
1560 struct nfs_pageio_descriptor;
1563 * RPC procedure vector for NFSv2/NFSv3 demuxing
1565 struct nfs_rpc_ops {
1566 u32 version; /* Protocol version */
1567 const struct dentry_operations *dentry_ops;
1568 const struct inode_operations *dir_inode_ops;
1569 const struct inode_operations *file_inode_ops;
1570 const struct file_operations *file_ops;
1571 const struct nlmclnt_operations *nlmclnt_ops;
1573 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1574 struct nfs_fsinfo *);
1575 struct vfsmount *(*submount) (struct nfs_server *, struct dentry *,
1576 struct nfs_fh *, struct nfs_fattr *);
1577 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
1578 struct nfs_subversion *);
1579 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1580 struct nfs_fattr *, struct nfs4_label *);
1581 int (*setattr) (struct dentry *, struct nfs_fattr *,
1583 int (*lookup) (struct inode *, const struct qstr *,
1584 struct nfs_fh *, struct nfs_fattr *,
1585 struct nfs4_label *);
1586 int (*lookupp) (struct inode *, struct nfs_fh *,
1587 struct nfs_fattr *, struct nfs4_label *);
1588 int (*access) (struct inode *, struct nfs_access_entry *);
1589 int (*readlink)(struct inode *, struct page *, unsigned int,
1591 int (*create) (struct inode *, struct dentry *,
1592 struct iattr *, int);
1593 int (*remove) (struct inode *, const struct qstr *);
1594 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1595 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1596 int (*unlink_done) (struct rpc_task *, struct inode *);
1597 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1598 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
1599 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1600 int (*link) (struct inode *, struct inode *, const struct qstr *);
1601 int (*symlink) (struct inode *, struct dentry *, struct page *,
1602 unsigned int, struct iattr *);
1603 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1604 int (*rmdir) (struct inode *, const struct qstr *);
1605 int (*readdir) (struct dentry *, struct rpc_cred *,
1606 u64, struct page **, unsigned int, bool);
1607 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1609 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1610 struct nfs_fsstat *);
1611 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1612 struct nfs_fsinfo *);
1613 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1614 struct nfs_pathconf *);
1615 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1616 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, bool);
1617 int (*pgio_rpc_prepare)(struct rpc_task *,
1618 struct nfs_pgio_header *);
1619 void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
1620 int (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
1621 void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *);
1622 int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
1623 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1624 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1625 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
1626 int (*lock)(struct file *, int, struct file_lock *);
1627 int (*lock_check_bounds)(const struct file_lock *);
1628 void (*clear_acl_cache)(struct inode *);
1629 void (*close_context)(struct nfs_open_context *ctx, int);
1630 struct inode * (*open_context) (struct inode *dir,
1631 struct nfs_open_context *ctx,
1633 struct iattr *iattr,
1635 int (*have_delegation)(struct inode *, fmode_t);
1636 int (*return_delegation)(struct inode *);
1637 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
1638 struct nfs_client *(*init_client) (struct nfs_client *,
1639 const struct nfs_client_initdata *);
1640 void (*free_client) (struct nfs_client *);
1641 struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *);
1642 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
1643 struct nfs_fattr *, rpc_authflavor_t);
1647 * NFS_CALL(getattr, inode, (fattr));
1649 * NFS_PROTO(inode)->getattr(fattr);
1651 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1654 * Function vectors etc. for the NFS client
1656 extern const struct nfs_rpc_ops nfs_v2_clientops;
1657 extern const struct nfs_rpc_ops nfs_v3_clientops;
1658 extern const struct nfs_rpc_ops nfs_v4_clientops;
1659 extern const struct rpc_version nfs_version2;
1660 extern const struct rpc_version nfs_version3;
1661 extern const struct rpc_version nfs_version4;
1663 extern const struct rpc_version nfsacl_version3;
1664 extern const struct rpc_program nfsacl_program;