1 #ifndef _LINUX_NFS_XDR_H
2 #define _LINUX_NFS_XDR_H
4 #include <linux/nfsacl.h>
5 #include <linux/sunrpc/gss_api.h>
8 * To change the maximum rsize and wsize supported by the NFS client, adjust
9 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
10 * support a megabyte or more. The default is left at 4096 bytes, which is
11 * reasonable for NFS over UDP.
13 #define NFS_MAX_FILE_IO_SIZE (1048576U)
14 #define NFS_DEF_FILE_IO_SIZE (4096U)
15 #define NFS_MIN_FILE_IO_SIZE (1024U)
17 /* Forward declaration for NFS v3 */
18 struct nfs4_secinfo_flavors;
31 * Helper for checking equality between 2 fsids.
33 static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
35 return a->major == b->major && a->minor == b->minor;
38 struct nfs4_threshold {
48 unsigned int valid; /* which fields are valid */
66 __u64 mounted_on_fileid;
67 struct timespec atime;
68 struct timespec mtime;
69 struct timespec ctime;
70 __u64 change_attr; /* NFSv4 change attribute */
71 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
72 __u64 pre_size; /* pre_op_attr.size */
73 struct timespec pre_mtime; /* pre_op_attr.mtime */
74 struct timespec pre_ctime; /* pre_op_attr.ctime */
75 unsigned long time_start;
76 unsigned long gencount;
77 struct nfs4_string *owner_name;
78 struct nfs4_string *group_name;
79 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
82 #define NFS_ATTR_FATTR_TYPE (1U << 0)
83 #define NFS_ATTR_FATTR_MODE (1U << 1)
84 #define NFS_ATTR_FATTR_NLINK (1U << 2)
85 #define NFS_ATTR_FATTR_OWNER (1U << 3)
86 #define NFS_ATTR_FATTR_GROUP (1U << 4)
87 #define NFS_ATTR_FATTR_RDEV (1U << 5)
88 #define NFS_ATTR_FATTR_SIZE (1U << 6)
89 #define NFS_ATTR_FATTR_PRESIZE (1U << 7)
90 #define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
91 #define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
92 #define NFS_ATTR_FATTR_FSID (1U << 10)
93 #define NFS_ATTR_FATTR_FILEID (1U << 11)
94 #define NFS_ATTR_FATTR_ATIME (1U << 12)
95 #define NFS_ATTR_FATTR_MTIME (1U << 13)
96 #define NFS_ATTR_FATTR_CTIME (1U << 14)
97 #define NFS_ATTR_FATTR_PREMTIME (1U << 15)
98 #define NFS_ATTR_FATTR_PRECTIME (1U << 16)
99 #define NFS_ATTR_FATTR_CHANGE (1U << 17)
100 #define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
101 #define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
102 #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
103 #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
104 #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
105 #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
106 #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
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)
129 * Info on the file system
132 struct nfs_fattr *fattr; /* Post-op attributes */
133 __u32 rtmax; /* max. read transfer size */
134 __u32 rtpref; /* pref. read transfer size */
135 __u32 rtmult; /* reads should be multiple of this */
136 __u32 wtmax; /* max. write transfer size */
137 __u32 wtpref; /* pref. write transfer size */
138 __u32 wtmult; /* writes should be multiple of this */
139 __u32 dtpref; /* pref. readdir transfer size */
141 struct timespec time_delta; /* server time granularity */
142 __u32 lease_time; /* in seconds */
143 __u32 layouttype; /* supported pnfs layout driver */
144 __u32 blksize; /* preferred pnfs io block size */
148 struct nfs_fattr *fattr; /* Post-op attributes */
149 __u64 tbytes; /* total size in bytes */
150 __u64 fbytes; /* # of free bytes */
151 __u64 abytes; /* # of bytes available to user */
152 __u64 tfiles; /* # of files */
153 __u64 ffiles; /* # of free files */
154 __u64 afiles; /* # of files available to user */
158 __u32 tsize; /* Server transfer size */
159 __u32 bsize; /* Filesystem block size */
160 __u32 blocks; /* No. of "bsize" blocks on filesystem */
161 __u32 bfree; /* No. of free "bsize" blocks */
162 __u32 bavail; /* No. of available "bsize" blocks */
165 struct nfs_pathconf {
166 struct nfs_fattr *fattr; /* Post-op attributes */
167 __u32 max_link; /* max # of hard links */
168 __u32 max_namelen; /* max name length */
171 struct nfs4_change_info {
179 /* nfs41 sessions channel attributes */
180 struct nfs4_channel_attrs {
183 u32 max_resp_sz_cached;
188 /* nfs41 sessions slot seqid */
190 struct nfs4_slot_table *table;
191 struct nfs4_slot *next;
192 unsigned long generation;
193 unsigned long renewal_time;
198 struct nfs4_sequence_args {
199 struct nfs4_slot *sa_slot;
203 struct nfs4_sequence_res {
204 struct nfs4_slot *sr_slot; /* slot used to send request */
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 nfs_fsinfo *lr_fsinfo;
217 struct nfs4_sequence_res lr_seq_res;
220 #define PNFS_LAYOUT_MAXSIZE 4096
222 struct nfs4_layoutdriver_data {
228 struct pnfs_layout_range {
234 struct nfs4_layoutget_args {
236 struct pnfs_layout_range range;
240 struct nfs_open_context *ctx;
241 struct nfs4_sequence_args seq_args;
242 nfs4_stateid stateid;
243 struct nfs4_layoutdriver_data layout;
246 struct nfs4_layoutget_res {
247 __u32 return_on_close;
248 struct pnfs_layout_range range;
250 nfs4_stateid stateid;
251 struct nfs4_sequence_res seq_res;
252 struct nfs4_layoutdriver_data *layoutp;
255 struct nfs4_layoutget {
256 struct nfs4_layoutget_args args;
257 struct nfs4_layoutget_res res;
261 struct nfs4_getdevicelist_args {
262 const struct nfs_fh *fh;
264 struct nfs4_sequence_args seq_args;
267 struct nfs4_getdevicelist_res {
268 struct pnfs_devicelist *devlist;
269 struct nfs4_sequence_res seq_res;
272 struct nfs4_getdeviceinfo_args {
273 struct pnfs_device *pdev;
274 struct nfs4_sequence_args seq_args;
277 struct nfs4_getdeviceinfo_res {
278 struct pnfs_device *pdev;
279 struct nfs4_sequence_res seq_res;
282 struct nfs4_layoutcommit_args {
283 nfs4_stateid stateid;
284 __u64 lastbytewritten;
287 struct nfs4_sequence_args seq_args;
290 struct nfs4_layoutcommit_res {
291 struct nfs_fattr *fattr;
292 const struct nfs_server *server;
293 struct nfs4_sequence_res seq_res;
297 struct nfs4_layoutcommit_data {
298 struct rpc_task task;
299 struct nfs_fattr fattr;
300 struct list_head lseg_list;
301 struct rpc_cred *cred;
302 struct nfs4_layoutcommit_args args;
303 struct nfs4_layoutcommit_res res;
306 struct nfs4_layoutreturn_args {
307 struct pnfs_layout_hdr *layout;
309 nfs4_stateid stateid;
311 struct nfs4_sequence_args seq_args;
314 struct nfs4_layoutreturn_res {
315 struct nfs4_sequence_res seq_res;
317 nfs4_stateid stateid;
320 struct nfs4_layoutreturn {
321 struct nfs4_layoutreturn_args args;
322 struct nfs4_layoutreturn_res res;
323 struct rpc_cred *cred;
324 struct nfs_client *clp;
328 struct stateowner_id {
334 * Arguments to the open call.
336 struct nfs_openargs {
337 const struct nfs_fh * fh;
338 struct nfs_seqid * seqid;
343 struct stateowner_id id;
346 struct iattr * attrs; /* UNCHECKED, GUARDED */
347 nfs4_verifier verifier; /* EXCLUSIVE */
349 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
350 fmode_t delegation_type; /* CLAIM_PREVIOUS */
352 const struct qstr * name;
353 const struct nfs_server *server; /* Needed for ID mapping */
355 const u32 * open_bitmap;
357 struct nfs4_sequence_args seq_args;
361 nfs4_stateid stateid;
363 struct nfs4_change_info cinfo;
365 struct nfs_fattr * f_attr;
366 struct nfs_seqid * seqid;
367 const struct nfs_server *server;
368 fmode_t delegation_type;
369 nfs4_stateid delegation;
372 __u32 attrset[NFS4_BITMAP_SIZE];
373 struct nfs4_string *owner;
374 struct nfs4_string *group_owner;
375 struct nfs4_sequence_res seq_res;
376 __u32 access_request;
377 __u32 access_supported;
382 * Arguments to the open_confirm call.
384 struct nfs_open_confirmargs {
385 const struct nfs_fh * fh;
386 nfs4_stateid * stateid;
387 struct nfs_seqid * seqid;
390 struct nfs_open_confirmres {
391 nfs4_stateid stateid;
392 struct nfs_seqid * seqid;
396 * Arguments to the close call.
398 struct nfs_closeargs {
400 nfs4_stateid * stateid;
401 struct nfs_seqid * seqid;
404 struct nfs4_sequence_args seq_args;
407 struct nfs_closeres {
408 nfs4_stateid stateid;
409 struct nfs_fattr * fattr;
410 struct nfs_seqid * seqid;
411 const struct nfs_server *server;
412 struct nfs4_sequence_res seq_res;
415 * * Arguments to the lock,lockt, and locku call.
423 struct nfs_lock_args {
425 struct file_lock * fl;
426 struct nfs_seqid * lock_seqid;
427 nfs4_stateid * lock_stateid;
428 struct nfs_seqid * open_seqid;
429 nfs4_stateid * open_stateid;
430 struct nfs_lowner lock_owner;
431 unsigned char block : 1;
432 unsigned char reclaim : 1;
433 unsigned char new_lock_owner : 1;
434 struct nfs4_sequence_args seq_args;
437 struct nfs_lock_res {
438 nfs4_stateid stateid;
439 struct nfs_seqid * lock_seqid;
440 struct nfs_seqid * open_seqid;
441 struct nfs4_sequence_res seq_res;
444 struct nfs_locku_args {
446 struct file_lock * fl;
447 struct nfs_seqid * seqid;
448 nfs4_stateid * stateid;
449 struct nfs4_sequence_args seq_args;
452 struct nfs_locku_res {
453 nfs4_stateid stateid;
454 struct nfs_seqid * seqid;
455 struct nfs4_sequence_res seq_res;
458 struct nfs_lockt_args {
460 struct file_lock * fl;
461 struct nfs_lowner lock_owner;
462 struct nfs4_sequence_args seq_args;
465 struct nfs_lockt_res {
466 struct file_lock * denied; /* LOCK, LOCKT failed */
467 struct nfs4_sequence_res seq_res;
470 struct nfs_release_lockowner_args {
471 struct nfs_lowner lock_owner;
474 struct nfs4_delegreturnargs {
475 const struct nfs_fh *fhandle;
476 const nfs4_stateid *stateid;
478 struct nfs4_sequence_args seq_args;
481 struct nfs4_delegreturnres {
482 struct nfs_fattr * fattr;
483 const struct nfs_server *server;
484 struct nfs4_sequence_res seq_res;
488 * Arguments to the read call.
490 struct nfs_readargs {
492 struct nfs_open_context *context;
493 struct nfs_lock_context *lock_context;
497 struct page ** pages;
498 struct nfs4_sequence_args seq_args;
502 struct nfs_fattr * fattr;
505 struct nfs4_sequence_res seq_res;
509 * Arguments to the write call.
511 struct nfs_writeargs {
513 struct nfs_open_context *context;
514 struct nfs_lock_context *lock_context;
517 enum nfs3_stable_how stable;
519 struct page ** pages;
521 struct nfs4_sequence_args seq_args;
524 struct nfs_write_verifier {
528 struct nfs_writeverf {
529 struct nfs_write_verifier verifier;
530 enum nfs3_stable_how committed;
533 struct nfs_writeres {
534 struct nfs_fattr * fattr;
535 struct nfs_writeverf * verf;
537 const struct nfs_server *server;
538 struct nfs4_sequence_res seq_res;
542 * Arguments to the commit call.
544 struct nfs_commitargs {
549 struct nfs4_sequence_args seq_args;
552 struct nfs_commitres {
553 struct nfs_fattr *fattr;
554 struct nfs_writeverf *verf;
555 const struct nfs_server *server;
556 struct nfs4_sequence_res seq_res;
560 * Common arguments to the unlink call
562 struct nfs_removeargs {
563 const struct nfs_fh *fh;
565 struct nfs4_sequence_args seq_args;
568 struct nfs_removeres {
569 const struct nfs_server *server;
570 struct nfs_fattr *dir_attr;
571 struct nfs4_change_info cinfo;
572 struct nfs4_sequence_res seq_res;
576 * Common arguments to the rename call
578 struct nfs_renameargs {
579 const struct nfs_fh *old_dir;
580 const struct nfs_fh *new_dir;
581 const struct qstr *old_name;
582 const struct qstr *new_name;
583 struct nfs4_sequence_args seq_args;
586 struct nfs_renameres {
587 const struct nfs_server *server;
588 struct nfs4_change_info old_cinfo;
589 struct nfs_fattr *old_fattr;
590 struct nfs4_change_info new_cinfo;
591 struct nfs_fattr *new_fattr;
592 struct nfs4_sequence_res seq_res;
596 * Argument struct for decode_entry function
606 struct nfs_fattr * fattr;
607 unsigned char d_type;
608 struct nfs_server * server;
612 * The following types are for NFSv2 only.
614 struct nfs_sattrargs {
616 struct iattr * sattr;
619 struct nfs_diropargs {
625 struct nfs_createargs {
629 struct iattr * sattr;
632 struct nfs_setattrargs {
634 nfs4_stateid stateid;
636 const struct nfs_server * server; /* Needed for name mapping */
638 struct nfs4_sequence_args seq_args;
641 struct nfs_setaclargs {
644 unsigned int acl_pgbase;
645 struct page ** acl_pages;
646 struct nfs4_sequence_args seq_args;
649 struct nfs_setaclres {
650 struct nfs4_sequence_res seq_res;
653 struct nfs_getaclargs {
656 unsigned int acl_pgbase;
657 struct page ** acl_pages;
658 struct nfs4_sequence_args seq_args;
661 /* getxattr ACL interface flags */
662 #define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
663 struct nfs_getaclres {
665 size_t acl_data_offset;
667 struct page * acl_scratch;
668 struct nfs4_sequence_res seq_res;
671 struct nfs_setattrres {
672 struct nfs_fattr * fattr;
673 const struct nfs_server * server;
674 struct nfs4_sequence_res seq_res;
677 struct nfs_linkargs {
678 struct nfs_fh * fromfh;
679 struct nfs_fh * tofh;
684 struct nfs_symlinkargs {
685 struct nfs_fh * fromfh;
686 const char * fromname;
687 unsigned int fromlen;
688 struct page ** pages;
689 unsigned int pathlen;
690 struct iattr * sattr;
693 struct nfs_readdirargs {
697 struct page ** pages;
700 struct nfs3_getaclargs {
703 struct page ** pages;
706 struct nfs3_setaclargs {
707 struct inode * inode;
709 struct posix_acl * acl_access;
710 struct posix_acl * acl_default;
713 struct page ** pages;
718 struct nfs_fattr * fattr;
721 struct nfs_readlinkargs {
725 struct page ** pages;
728 struct nfs3_sattrargs {
730 struct iattr * sattr;
732 struct timespec guardtime;
735 struct nfs3_diropargs {
741 struct nfs3_accessargs {
746 struct nfs3_createargs {
750 struct iattr * sattr;
751 enum nfs3_createmode createmode;
755 struct nfs3_mkdirargs {
759 struct iattr * sattr;
762 struct nfs3_symlinkargs {
763 struct nfs_fh * fromfh;
764 const char * fromname;
765 unsigned int fromlen;
766 struct page ** pages;
767 unsigned int pathlen;
768 struct iattr * sattr;
771 struct nfs3_mknodargs {
775 enum nfs3_ftype type;
776 struct iattr * sattr;
780 struct nfs3_linkargs {
781 struct nfs_fh * fromfh;
782 struct nfs_fh * tofh;
787 struct nfs3_readdirargs {
793 struct page ** pages;
796 struct nfs3_diropres {
797 struct nfs_fattr * dir_attr;
799 struct nfs_fattr * fattr;
802 struct nfs3_accessres {
803 struct nfs_fattr * fattr;
807 struct nfs3_readlinkargs {
811 struct page ** pages;
814 struct nfs3_linkres {
815 struct nfs_fattr * dir_attr;
816 struct nfs_fattr * fattr;
819 struct nfs3_readdirres {
820 struct nfs_fattr * dir_attr;
825 struct nfs3_getaclres {
826 struct nfs_fattr * fattr;
828 unsigned int acl_access_count;
829 unsigned int acl_default_count;
830 struct posix_acl * acl_access;
831 struct posix_acl * acl_default;
834 #if IS_ENABLED(CONFIG_NFS_V4)
836 typedef u64 clientid4;
838 struct nfs4_accessargs {
839 const struct nfs_fh * fh;
842 struct nfs4_sequence_args seq_args;
845 struct nfs4_accessres {
846 const struct nfs_server * server;
847 struct nfs_fattr * fattr;
850 struct nfs4_sequence_res seq_res;
853 struct nfs4_create_arg {
857 struct page ** pages;
859 } symlink; /* NF4LNK */
863 } device; /* NF4BLK, NF4CHR */
865 const struct qstr * name;
866 const struct nfs_server * server;
867 const struct iattr * attrs;
868 const struct nfs_fh * dir_fh;
870 struct nfs4_sequence_args seq_args;
873 struct nfs4_create_res {
874 const struct nfs_server * server;
876 struct nfs_fattr * fattr;
877 struct nfs4_change_info dir_cinfo;
878 struct nfs4_sequence_res seq_res;
881 struct nfs4_fsinfo_arg {
882 const struct nfs_fh * fh;
884 struct nfs4_sequence_args seq_args;
887 struct nfs4_fsinfo_res {
888 struct nfs_fsinfo *fsinfo;
889 struct nfs4_sequence_res seq_res;
892 struct nfs4_getattr_arg {
893 const struct nfs_fh * fh;
895 struct nfs4_sequence_args seq_args;
898 struct nfs4_getattr_res {
899 const struct nfs_server * server;
900 struct nfs_fattr * fattr;
901 struct nfs4_sequence_res seq_res;
904 struct nfs4_link_arg {
905 const struct nfs_fh * fh;
906 const struct nfs_fh * dir_fh;
907 const struct qstr * name;
909 struct nfs4_sequence_args seq_args;
912 struct nfs4_link_res {
913 const struct nfs_server * server;
914 struct nfs_fattr * fattr;
915 struct nfs4_change_info cinfo;
916 struct nfs_fattr * dir_attr;
917 struct nfs4_sequence_res seq_res;
921 struct nfs4_lookup_arg {
922 const struct nfs_fh * dir_fh;
923 const struct qstr * name;
925 struct nfs4_sequence_args seq_args;
928 struct nfs4_lookup_res {
929 const struct nfs_server * server;
930 struct nfs_fattr * fattr;
932 struct nfs4_sequence_res seq_res;
935 struct nfs4_lookup_root_arg {
937 struct nfs4_sequence_args seq_args;
940 struct nfs4_pathconf_arg {
941 const struct nfs_fh * fh;
943 struct nfs4_sequence_args seq_args;
946 struct nfs4_pathconf_res {
947 struct nfs_pathconf *pathconf;
948 struct nfs4_sequence_res seq_res;
951 struct nfs4_readdir_arg {
952 const struct nfs_fh * fh;
954 nfs4_verifier verifier;
956 struct page ** pages; /* zero-copy data */
957 unsigned int pgbase; /* zero-copy data */
960 struct nfs4_sequence_args seq_args;
963 struct nfs4_readdir_res {
964 nfs4_verifier verifier;
966 struct nfs4_sequence_res seq_res;
969 struct nfs4_readlink {
970 const struct nfs_fh * fh;
972 unsigned int pglen; /* zero-copy data */
973 struct page ** pages; /* zero-copy data */
974 struct nfs4_sequence_args seq_args;
977 struct nfs4_readlink_res {
978 struct nfs4_sequence_res seq_res;
981 #define NFS4_SETCLIENTID_NAMELEN (127)
982 struct nfs4_setclientid {
983 const nfs4_verifier * sc_verifier;
984 unsigned int sc_name_len;
985 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
987 unsigned int sc_netid_len;
988 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
989 unsigned int sc_uaddr_len;
990 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
994 struct nfs4_setclientid_res {
996 nfs4_verifier confirm;
999 struct nfs4_statfs_arg {
1000 const struct nfs_fh * fh;
1001 const u32 * bitmask;
1002 struct nfs4_sequence_args seq_args;
1005 struct nfs4_statfs_res {
1006 struct nfs_fsstat *fsstat;
1007 struct nfs4_sequence_res seq_res;
1010 struct nfs4_server_caps_arg {
1011 struct nfs_fh *fhandle;
1012 struct nfs4_sequence_args seq_args;
1015 struct nfs4_server_caps_res {
1016 u32 attr_bitmask[3];
1021 struct nfs4_sequence_res seq_res;
1024 #define NFS4_PATHNAME_MAXCOMPONENTS 512
1025 struct nfs4_pathname {
1026 unsigned int ncomponents;
1027 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
1030 #define NFS4_FS_LOCATION_MAXSERVERS 10
1031 struct nfs4_fs_location {
1032 unsigned int nservers;
1033 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
1034 struct nfs4_pathname rootpath;
1037 #define NFS4_FS_LOCATIONS_MAXENTRIES 10
1038 struct nfs4_fs_locations {
1039 struct nfs_fattr fattr;
1040 const struct nfs_server *server;
1041 struct nfs4_pathname fs_path;
1043 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
1046 struct nfs4_fs_locations_arg {
1047 const struct nfs_fh *dir_fh;
1048 const struct qstr *name;
1051 struct nfs4_sequence_args seq_args;
1054 struct nfs4_fs_locations_res {
1055 struct nfs4_fs_locations *fs_locations;
1056 struct nfs4_sequence_res seq_res;
1059 struct nfs4_secinfo_oid {
1061 char data[GSS_OID_MAX_LEN];
1064 struct nfs4_secinfo_gss {
1065 struct nfs4_secinfo_oid sec_oid4;
1067 unsigned int service;
1070 struct nfs4_secinfo_flavor {
1071 unsigned int flavor;
1072 struct nfs4_secinfo_gss gss;
1075 struct nfs4_secinfo_flavors {
1076 unsigned int num_flavors;
1077 struct nfs4_secinfo_flavor flavors[0];
1080 struct nfs4_secinfo_arg {
1081 const struct nfs_fh *dir_fh;
1082 const struct qstr *name;
1083 struct nfs4_sequence_args seq_args;
1086 struct nfs4_secinfo_res {
1087 struct nfs4_secinfo_flavors *flavors;
1088 struct nfs4_sequence_res seq_res;
1091 #endif /* CONFIG_NFS_V4 */
1098 #ifdef CONFIG_NFS_V4_1
1100 struct pnfs_commit_bucket {
1101 struct list_head written;
1102 struct list_head committing;
1103 struct pnfs_layout_segment *wlseg;
1104 struct pnfs_layout_segment *clseg;
1107 struct pnfs_ds_commit_info {
1111 struct pnfs_commit_bucket *buckets;
1114 #define NFS4_EXCHANGE_ID_LEN (48)
1115 struct nfs41_exchange_id_args {
1116 struct nfs_client *client;
1117 nfs4_verifier *verifier;
1118 unsigned int id_len;
1119 char id[NFS4_EXCHANGE_ID_LEN];
1123 struct nfs41_server_owner {
1125 uint32_t major_id_sz;
1126 char major_id[NFS4_OPAQUE_LIMIT];
1129 struct nfs41_server_scope {
1130 uint32_t server_scope_sz;
1131 char server_scope[NFS4_OPAQUE_LIMIT];
1134 struct nfs41_impl_id {
1135 char domain[NFS4_OPAQUE_LIMIT + 1];
1136 char name[NFS4_OPAQUE_LIMIT + 1];
1137 struct nfstime4 date;
1140 struct nfs41_bind_conn_to_session_res {
1141 struct nfs4_session *session;
1143 bool use_conn_in_rdma_mode;
1146 struct nfs41_exchange_id_res {
1150 struct nfs41_server_owner *server_owner;
1151 struct nfs41_server_scope *server_scope;
1152 struct nfs41_impl_id *impl_id;
1155 struct nfs41_create_session_args {
1156 struct nfs_client *client;
1158 uint32_t cb_program;
1159 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1160 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1163 struct nfs41_create_session_res {
1164 struct nfs_client *client;
1167 struct nfs41_reclaim_complete_args {
1168 /* In the future extend to include curr_fh for use with migration */
1169 unsigned char one_fs:1;
1170 struct nfs4_sequence_args seq_args;
1173 struct nfs41_reclaim_complete_res {
1174 struct nfs4_sequence_res seq_res;
1177 #define SECINFO_STYLE_CURRENT_FH 0
1178 #define SECINFO_STYLE_PARENT 1
1179 struct nfs41_secinfo_no_name_args {
1181 struct nfs4_sequence_args seq_args;
1184 struct nfs41_test_stateid_args {
1185 nfs4_stateid *stateid;
1186 struct nfs4_sequence_args seq_args;
1189 struct nfs41_test_stateid_res {
1190 unsigned int status;
1191 struct nfs4_sequence_res seq_res;
1194 struct nfs41_free_stateid_args {
1195 nfs4_stateid *stateid;
1196 struct nfs4_sequence_args seq_args;
1199 struct nfs41_free_stateid_res {
1200 unsigned int status;
1201 struct nfs4_sequence_res seq_res;
1206 struct pnfs_ds_commit_info {
1209 #endif /* CONFIG_NFS_V4_1 */
1213 #define NFS_PAGEVEC_SIZE (8U)
1215 struct nfs_page_array {
1216 struct page **pagevec;
1217 unsigned int npages; /* Max length of pagevec */
1218 struct page *page_array[NFS_PAGEVEC_SIZE];
1221 struct nfs_read_data {
1222 struct nfs_pgio_header *header;
1223 struct list_head list;
1224 struct rpc_task task;
1225 struct nfs_fattr fattr; /* fattr storage */
1226 struct nfs_readargs args;
1227 struct nfs_readres res;
1228 unsigned long timestamp; /* For lease renewal */
1229 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
1231 struct nfs_page_array pages;
1232 struct nfs_client *ds_clp; /* pNFS data server */
1235 /* used as flag bits in nfs_pgio_header */
1237 NFS_IOHDR_ERROR = 0,
1240 NFS_IOHDR_NEED_COMMIT,
1241 NFS_IOHDR_NEED_RESCHED,
1244 struct nfs_pgio_header {
1245 struct inode *inode;
1246 struct rpc_cred *cred;
1247 struct list_head pages;
1248 struct list_head rpc_list;
1250 struct nfs_page *req;
1251 struct nfs_writeverf *verf;
1252 struct pnfs_layout_segment *lseg;
1254 const struct rpc_call_ops *mds_ops;
1255 void (*release) (struct nfs_pgio_header *hdr);
1256 const struct nfs_pgio_completion_ops *completion_ops;
1257 struct nfs_direct_req *dreq;
1258 void *layout_private;
1260 /* fields protected by lock */
1262 int error; /* merge with pnfs_error */
1263 unsigned long good_bytes; /* boundary of good data */
1264 unsigned long flags;
1267 struct nfs_read_header {
1268 struct nfs_pgio_header header;
1269 struct nfs_read_data rpc_data;
1272 struct nfs_write_data {
1273 struct nfs_pgio_header *header;
1274 struct list_head list;
1275 struct rpc_task task;
1276 struct nfs_fattr fattr;
1277 struct nfs_writeverf verf;
1278 struct nfs_writeargs args; /* argument struct */
1279 struct nfs_writeres res; /* result struct */
1280 unsigned long timestamp; /* For lease renewal */
1281 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
1282 __u64 mds_offset; /* Filelayout dense stripe */
1283 struct nfs_page_array pages;
1284 struct nfs_client *ds_clp; /* pNFS data server */
1287 struct nfs_write_header {
1288 struct nfs_pgio_header header;
1289 struct nfs_write_data rpc_data;
1290 struct nfs_writeverf verf;
1293 struct nfs_mds_commit_info {
1295 unsigned long ncommit;
1296 struct list_head list;
1299 struct nfs_commit_data;
1301 struct nfs_commit_completion_ops {
1302 void (*error_cleanup) (struct nfs_inode *nfsi);
1303 void (*completion) (struct nfs_commit_data *data);
1306 struct nfs_commit_info {
1308 struct nfs_mds_commit_info *mds;
1309 struct pnfs_ds_commit_info *ds;
1310 struct nfs_direct_req *dreq; /* O_DIRECT request */
1311 const struct nfs_commit_completion_ops *completion_ops;
1314 struct nfs_commit_data {
1315 struct rpc_task task;
1316 struct inode *inode;
1317 struct rpc_cred *cred;
1318 struct nfs_fattr fattr;
1319 struct nfs_writeverf verf;
1320 struct list_head pages; /* Coalesced requests we wish to flush */
1321 struct list_head list; /* lists of struct nfs_write_data */
1322 struct nfs_direct_req *dreq; /* O_DIRECT request */
1323 struct nfs_commitargs args; /* argument struct */
1324 struct nfs_commitres res; /* result struct */
1325 struct nfs_open_context *context;
1326 struct pnfs_layout_segment *lseg;
1327 struct nfs_client *ds_clp; /* pNFS data server */
1328 int ds_commit_index;
1329 const struct rpc_call_ops *mds_ops;
1330 const struct nfs_commit_completion_ops *completion_ops;
1331 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
1334 struct nfs_pgio_completion_ops {
1335 void (*error_cleanup)(struct list_head *head);
1336 void (*init_hdr)(struct nfs_pgio_header *hdr);
1337 void (*completion)(struct nfs_pgio_header *hdr);
1340 struct nfs_unlinkdata {
1341 struct hlist_node list;
1342 struct nfs_removeargs args;
1343 struct nfs_removeres res;
1345 struct rpc_cred *cred;
1346 struct nfs_fattr dir_attr;
1349 struct nfs_renamedata {
1350 struct nfs_renameargs args;
1351 struct nfs_renameres res;
1352 struct rpc_cred *cred;
1353 struct inode *old_dir;
1354 struct dentry *old_dentry;
1355 struct nfs_fattr old_fattr;
1356 struct inode *new_dir;
1357 struct dentry *new_dentry;
1358 struct nfs_fattr new_fattr;
1361 struct nfs_access_entry;
1364 struct nfs_subversion;
1365 struct nfs_mount_info;
1366 struct nfs_client_initdata;
1367 struct nfs_pageio_descriptor;
1370 * RPC procedure vector for NFSv2/NFSv3 demuxing
1372 struct nfs_rpc_ops {
1373 u32 version; /* Protocol version */
1374 const struct dentry_operations *dentry_ops;
1375 const struct inode_operations *dir_inode_ops;
1376 const struct inode_operations *file_inode_ops;
1377 const struct file_operations *file_ops;
1379 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1380 struct nfs_fsinfo *);
1381 struct vfsmount *(*submount) (struct nfs_server *, struct dentry *,
1382 struct nfs_fh *, struct nfs_fattr *);
1383 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
1384 struct nfs_subversion *);
1385 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1386 struct nfs_fattr *);
1387 int (*setattr) (struct dentry *, struct nfs_fattr *,
1389 int (*lookup) (struct inode *, struct qstr *,
1390 struct nfs_fh *, struct nfs_fattr *);
1391 int (*access) (struct inode *, struct nfs_access_entry *);
1392 int (*readlink)(struct inode *, struct page *, unsigned int,
1394 int (*create) (struct inode *, struct dentry *,
1395 struct iattr *, int);
1396 int (*remove) (struct inode *, struct qstr *);
1397 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1398 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1399 int (*unlink_done) (struct rpc_task *, struct inode *);
1400 int (*rename) (struct inode *, struct qstr *,
1401 struct inode *, struct qstr *);
1402 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1403 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
1404 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1405 int (*link) (struct inode *, struct inode *, struct qstr *);
1406 int (*symlink) (struct inode *, struct dentry *, struct page *,
1407 unsigned int, struct iattr *);
1408 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1409 int (*rmdir) (struct inode *, struct qstr *);
1410 int (*readdir) (struct dentry *, struct rpc_cred *,
1411 u64, struct page **, unsigned int, int);
1412 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1414 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1415 struct nfs_fsstat *);
1416 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1417 struct nfs_fsinfo *);
1418 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1419 struct nfs_pathconf *);
1420 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1421 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
1422 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
1423 void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *,
1424 const struct nfs_pgio_completion_ops *);
1425 void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
1426 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
1427 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1428 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int,
1429 const struct nfs_pgio_completion_ops *);
1430 void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1431 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1432 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1433 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1434 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
1435 int (*lock)(struct file *, int, struct file_lock *);
1436 int (*lock_check_bounds)(const struct file_lock *);
1437 void (*clear_acl_cache)(struct inode *);
1438 void (*close_context)(struct nfs_open_context *ctx, int);
1439 struct inode * (*open_context) (struct inode *dir,
1440 struct nfs_open_context *ctx,
1442 struct iattr *iattr);
1443 int (*have_delegation)(struct inode *, fmode_t);
1444 int (*return_delegation)(struct inode *);
1445 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
1447 (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1448 const char *, rpc_authflavor_t);
1449 void (*free_client) (struct nfs_client *);
1450 struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *);
1451 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
1452 struct nfs_fattr *, rpc_authflavor_t);
1456 * NFS_CALL(getattr, inode, (fattr));
1458 * NFS_PROTO(inode)->getattr(fattr);
1460 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1463 * Function vectors etc. for the NFS client
1465 extern const struct nfs_rpc_ops nfs_v2_clientops;
1466 extern const struct nfs_rpc_ops nfs_v3_clientops;
1467 extern const struct nfs_rpc_ops nfs_v4_clientops;
1468 extern const struct rpc_version nfs_version2;
1469 extern const struct rpc_version nfs_version3;
1470 extern const struct rpc_version nfs_version4;
1472 extern const struct rpc_version nfsacl_version3;
1473 extern const struct rpc_program nfsacl_program;