blob: 5491ad5f48a94e4ef44922155b8f57f898dd0de0 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef _LINUX_NFS_XDR_H
3#define _LINUX_NFS_XDR_H
4
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +00005#include <linux/nfsacl.h>
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00006#include <linux/sunrpc/gss_api.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
Chuck Lever40859d72005-11-30 18:09:02 -05008/*
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.
13 */
14#define NFS_MAX_FILE_IO_SIZE (1048576U)
15#define NFS_DEF_FILE_IO_SIZE (4096U)
16#define NFS_MIN_FILE_IO_SIZE (1024U)
17
Trond Myklebustce2b4702021-03-25 18:15:36 -040018#define NFS_BITMASK_SZ 3
19
Trond Myklebust6926afd12012-01-07 13:22:46 -050020struct nfs4_string {
21 unsigned int len;
22 char *data;
23};
24
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040025struct nfs_fsid {
26 uint64_t major;
27 uint64_t minor;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028};
29
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040030/*
31 * Helper for checking equality between 2 fsids.
32 */
33static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
34{
35 return a->major == b->major && a->minor == b->minor;
36}
37
Andy Adamson88034c32012-05-23 05:02:34 -040038struct nfs4_threshold {
39 __u32 bm;
40 __u32 l_type;
41 __u64 rd_sz;
42 __u64 wr_sz;
43 __u64 rd_io_sz;
44 __u64 wr_io_sz;
45};
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047struct nfs_fattr {
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040048 unsigned int valid; /* which fields are valid */
Trond Myklebustbca79472009-03-11 14:10:26 -040049 umode_t mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 __u32 nlink;
Eric W. Biederman54f834c2013-02-01 14:16:29 -080051 kuid_t uid;
52 kgid_t gid;
Richard Kennedy9fa8d662008-08-26 16:23:20 +010053 dev_t rdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 __u64 size;
55 union {
56 struct {
57 __u32 blocksize;
58 __u32 blocks;
59 } nfs2;
60 struct {
61 __u64 used;
62 } nfs3;
63 } du;
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040064 struct nfs_fsid fsid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 __u64 fileid;
Trond Myklebust28331a42011-04-27 13:47:52 -040066 __u64 mounted_on_fileid;
Trond Myklebuste86d5a02019-10-04 16:38:56 -040067 struct timespec64 atime;
68 struct timespec64 mtime;
69 struct timespec64 ctime;
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 __u64 change_attr; /* NFSv4 change attribute */
71 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
Trond Myklebust1ca277d2009-03-11 14:10:25 -040072 __u64 pre_size; /* pre_op_attr.size */
Trond Myklebuste86d5a02019-10-04 16:38:56 -040073 struct timespec64 pre_mtime; /* pre_op_attr.mtime */
74 struct timespec64 pre_ctime; /* pre_op_attr.ctime */
Trond Myklebust33801142005-10-27 22:12:39 -040075 unsigned long time_start;
Trond Myklebust4704f0e2008-10-14 19:16:07 -040076 unsigned long gencount;
Trond Myklebust6926afd12012-01-07 13:22:46 -050077 struct nfs4_string *owner_name;
78 struct nfs4_string *group_name;
Andy Adamson88034c32012-05-23 05:02:34 -040079 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
Scott Mayhew779df6a2020-03-03 17:58:37 -050080 struct nfs4_label *label;
Linus Torvalds1da177e2005-04-16 15:20:36 -070081};
82
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040083#define NFS_ATTR_FATTR_TYPE (1U << 0)
84#define NFS_ATTR_FATTR_MODE (1U << 1)
85#define NFS_ATTR_FATTR_NLINK (1U << 2)
86#define NFS_ATTR_FATTR_OWNER (1U << 3)
87#define NFS_ATTR_FATTR_GROUP (1U << 4)
88#define NFS_ATTR_FATTR_RDEV (1U << 5)
89#define NFS_ATTR_FATTR_SIZE (1U << 6)
90#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
91#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
92#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
93#define NFS_ATTR_FATTR_FSID (1U << 10)
94#define NFS_ATTR_FATTR_FILEID (1U << 11)
95#define NFS_ATTR_FATTR_ATIME (1U << 12)
96#define NFS_ATTR_FATTR_MTIME (1U << 13)
97#define NFS_ATTR_FATTR_CTIME (1U << 14)
98#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
99#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
100#define NFS_ATTR_FATTR_CHANGE (1U << 17)
101#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
Chuck Lever81934dd2012-03-01 17:01:57 -0500102#define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
103#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
104#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
105#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
106#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
107#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
David Quigleye64a4212013-05-22 12:50:39 -0400108#define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
Trond Myklebust9e6e70f2009-03-11 14:10:24 -0400109
110#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
111 | NFS_ATTR_FATTR_MODE \
112 | NFS_ATTR_FATTR_NLINK \
113 | NFS_ATTR_FATTR_OWNER \
114 | NFS_ATTR_FATTR_GROUP \
115 | NFS_ATTR_FATTR_RDEV \
116 | NFS_ATTR_FATTR_SIZE \
117 | NFS_ATTR_FATTR_FSID \
118 | NFS_ATTR_FATTR_FILEID \
119 | NFS_ATTR_FATTR_ATIME \
120 | NFS_ATTR_FATTR_MTIME \
Trond Myklebust3a1556e2012-04-27 13:48:18 -0400121 | NFS_ATTR_FATTR_CTIME \
122 | NFS_ATTR_FATTR_CHANGE)
Trond Myklebust9e6e70f2009-03-11 14:10:24 -0400123#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
124 | NFS_ATTR_FATTR_BLOCKS_USED)
125#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
126 | NFS_ATTR_FATTR_SPACE_USED)
127#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
David Quigleye64a4212013-05-22 12:50:39 -0400128 | NFS_ATTR_FATTR_SPACE_USED \
129 | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130
131/*
Jeff Layton3132e492016-08-10 15:58:24 -0400132 * Maximal number of supported layout drivers.
133 */
134#define NFS_MAX_LAYOUT_TYPES 8
135
136/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 * Info on the file system
138 */
139struct nfs_fsinfo {
140 struct nfs_fattr *fattr; /* Post-op attributes */
141 __u32 rtmax; /* max. read transfer size */
142 __u32 rtpref; /* pref. read transfer size */
143 __u32 rtmult; /* reads should be multiple of this */
144 __u32 wtmax; /* max. write transfer size */
145 __u32 wtpref; /* pref. write transfer size */
146 __u32 wtmult; /* writes should be multiple of this */
147 __u32 dtpref; /* pref. readdir transfer size */
148 __u64 maxfilesize;
Trond Myklebuste86d5a02019-10-04 16:38:56 -0400149 struct timespec64 time_delta; /* server time granularity */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 __u32 lease_time; /* in seconds */
Jeff Laytonca440c32016-09-15 14:40:49 -0400151 __u32 nlayouttypes; /* number of layouttypes */
Jeff Layton3132e492016-08-10 15:58:24 -0400152 __u32 layouttype[NFS_MAX_LAYOUT_TYPES]; /* supported pnfs layout driver */
Fred Isamandae100c2011-07-30 20:52:37 -0400153 __u32 blksize; /* preferred pnfs io block size */
Peng Tao2a92ee92015-09-26 02:24:37 +0800154 __u32 clone_blksize; /* granularity of a CLONE operation */
Frank van der Lindenb78ef842020-06-23 22:38:55 +0000155 __u32 xattr_support; /* User xattrs supported */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156};
157
158struct nfs_fsstat {
159 struct nfs_fattr *fattr; /* Post-op attributes */
160 __u64 tbytes; /* total size in bytes */
161 __u64 fbytes; /* # of free bytes */
162 __u64 abytes; /* # of bytes available to user */
163 __u64 tfiles; /* # of files */
164 __u64 ffiles; /* # of free files */
165 __u64 afiles; /* # of files available to user */
166};
167
168struct nfs2_fsstat {
169 __u32 tsize; /* Server transfer size */
170 __u32 bsize; /* Filesystem block size */
171 __u32 blocks; /* No. of "bsize" blocks on filesystem */
172 __u32 bfree; /* No. of free "bsize" blocks */
173 __u32 bavail; /* No. of available "bsize" blocks */
174};
175
176struct nfs_pathconf {
177 struct nfs_fattr *fattr; /* Post-op attributes */
178 __u32 max_link; /* max # of hard links */
179 __u32 max_namelen; /* max name length */
180};
181
182struct nfs4_change_info {
183 u32 atomic;
184 u64 before;
185 u64 after;
186};
187
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700188struct nfs_seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400189
Andy Adamson557134a2009-04-01 09:21:53 -0400190/* nfs41 sessions channel attributes */
191struct nfs4_channel_attrs {
Andy Adamson557134a2009-04-01 09:21:53 -0400192 u32 max_rqst_sz;
193 u32 max_resp_sz;
194 u32 max_resp_sz_cached;
195 u32 max_ops;
196 u32 max_reqs;
197};
198
Trond Myklebust76e697b2012-11-26 14:20:49 -0500199struct nfs4_slot;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400200struct nfs4_sequence_args {
Trond Myklebust2b2fa712012-11-16 12:58:36 -0500201 struct nfs4_slot *sa_slot;
Trond Myklebust8fe72ba2012-10-29 19:02:20 -0400202 u8 sa_cache_this : 1,
203 sa_privileged : 1;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400204};
205
206struct nfs4_sequence_res {
Benny Halevydfb4f3092010-09-24 09:17:01 -0400207 struct nfs4_slot *sr_slot; /* slot used to send request */
Trond Myklebust8e63b6a2012-12-15 15:21:52 -0500208 unsigned long sr_timestamp;
Andy Adamsonfbcd4ab2009-04-01 09:22:15 -0400209 int sr_status; /* sequence operation status */
Alexandros Batsakis0629e372009-12-05 13:46:14 -0500210 u32 sr_status_flags;
Trond Myklebustda0507b2012-11-20 18:10:30 -0500211 u32 sr_highest_slotid;
Trond Myklebust464ee9f2012-11-20 12:49:27 -0500212 u32 sr_target_highest_slotid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400213};
214
Andy Adamson2050f0c2009-04-01 09:22:30 -0400215struct nfs4_get_lease_time_args {
216 struct nfs4_sequence_args la_seq_args;
217};
218
219struct nfs4_get_lease_time_res {
Andy Adamson2050f0c2009-04-01 09:22:30 -0400220 struct nfs4_sequence_res lr_seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -0500221 struct nfs_fsinfo *lr_fsinfo;
Andy Adamson2050f0c2009-04-01 09:22:30 -0400222};
223
Trond Myklebustf8c3cf92016-10-20 10:12:45 -0400224struct xdr_stream;
225struct nfs4_xdr_opaque_data;
226
227struct nfs4_xdr_opaque_ops {
228 void (*encode)(struct xdr_stream *, const void *args,
229 const struct nfs4_xdr_opaque_data *);
230 void (*free)(struct nfs4_xdr_opaque_data *);
231};
232
233struct nfs4_xdr_opaque_data {
234 const struct nfs4_xdr_opaque_ops *ops;
235 void *data;
236};
237
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400238#define PNFS_LAYOUT_MAXSIZE 4096
239
240struct nfs4_layoutdriver_data {
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400241 struct page **pages;
242 __u32 pglen;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400243 __u32 len;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400244};
245
246struct pnfs_layout_range {
247 u32 iomode;
248 u64 offset;
249 u64 length;
250};
251
252struct nfs4_layoutget_args {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500253 struct nfs4_sequence_args seq_args;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400254 __u32 type;
255 struct pnfs_layout_range range;
256 __u64 minlength;
257 __u32 maxcount;
258 struct inode *inode;
259 struct nfs_open_context *ctx;
Fred Isamancf7d63f2011-01-06 11:36:25 +0000260 nfs4_stateid stateid;
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400261 struct nfs4_layoutdriver_data layout;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400262};
263
264struct nfs4_layoutget_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500265 struct nfs4_sequence_res seq_res;
Fred Isaman808ba322016-10-04 15:02:21 -0400266 int status;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400267 __u32 return_on_close;
268 struct pnfs_layout_range range;
269 __u32 type;
270 nfs4_stateid stateid;
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400271 struct nfs4_layoutdriver_data *layoutp;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400272};
273
274struct nfs4_layoutget {
275 struct nfs4_layoutget_args args;
276 struct nfs4_layoutget_res res;
NeilBrowna52458b2018-12-03 11:30:31 +1100277 const struct cred *cred;
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400278 gfp_t gfp_flags;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400279};
280
281struct nfs4_getdeviceinfo_args {
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400282 struct nfs4_sequence_args seq_args;
Trond Myklebust62ae0822012-11-29 17:10:01 -0500283 struct pnfs_device *pdev;
Trond Myklebust4e590802015-03-09 14:01:25 -0400284 __u32 notify_types;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400285};
286
287struct nfs4_getdeviceinfo_res {
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400288 struct nfs4_sequence_res seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -0500289 struct pnfs_device *pdev;
Trond Myklebust4e590802015-03-09 14:01:25 -0400290 __u32 notification;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400291};
292
Andy Adamson863a3c62011-03-23 13:27:54 +0000293struct nfs4_layoutcommit_args {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500294 struct nfs4_sequence_args seq_args;
Andy Adamson863a3c62011-03-23 13:27:54 +0000295 nfs4_stateid stateid;
296 __u64 lastbytewritten;
297 struct inode *inode;
298 const u32 *bitmask;
Christoph Hellwig5f919c92014-08-21 11:09:25 -0500299 size_t layoutupdate_len;
300 struct page *layoutupdate_page;
301 struct page **layoutupdate_pages;
Kinglong Meec8975702016-02-01 09:39:29 +0800302 __be32 *start_p;
Andy Adamson863a3c62011-03-23 13:27:54 +0000303};
304
305struct nfs4_layoutcommit_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500306 struct nfs4_sequence_res seq_res;
Andy Adamson863a3c62011-03-23 13:27:54 +0000307 struct nfs_fattr *fattr;
308 const struct nfs_server *server;
Andy Adamsondb29c082011-07-30 20:52:38 -0400309 int status;
Andy Adamson863a3c62011-03-23 13:27:54 +0000310};
311
312struct nfs4_layoutcommit_data {
313 struct rpc_task task;
314 struct nfs_fattr fattr;
Peng Taoa9bae562011-07-30 20:52:33 -0400315 struct list_head lseg_list;
NeilBrowna52458b2018-12-03 11:30:31 +1100316 const struct cred *cred;
Trond Myklebust472e2592015-02-05 16:50:30 -0500317 struct inode *inode;
Andy Adamson863a3c62011-03-23 13:27:54 +0000318 struct nfs4_layoutcommit_args args;
319 struct nfs4_layoutcommit_res res;
320};
321
Benny Halevycbe82602011-05-22 19:52:37 +0300322struct nfs4_layoutreturn_args {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500323 struct nfs4_sequence_args seq_args;
Trond Myklebusta56aaa02011-06-15 11:59:10 -0400324 struct pnfs_layout_hdr *layout;
Benny Halevycbe82602011-05-22 19:52:37 +0300325 struct inode *inode;
Peng Tao15eb67c2014-11-17 09:30:36 +0800326 struct pnfs_layout_range range;
Benny Halevycbe82602011-05-22 19:52:37 +0300327 nfs4_stateid stateid;
Trond Myklebusta56aaa02011-06-15 11:59:10 -0400328 __u32 layout_type;
Trond Myklebust4d796d72016-09-23 11:38:08 -0400329 struct nfs4_xdr_opaque_data *ld_private;
Benny Halevycbe82602011-05-22 19:52:37 +0300330};
331
332struct nfs4_layoutreturn_res {
333 struct nfs4_sequence_res seq_res;
334 u32 lrs_present;
335 nfs4_stateid stateid;
336};
337
338struct nfs4_layoutreturn {
339 struct nfs4_layoutreturn_args args;
340 struct nfs4_layoutreturn_res res;
NeilBrowna52458b2018-12-03 11:30:31 +1100341 const struct cred *cred;
Benny Halevycbe82602011-05-22 19:52:37 +0300342 struct nfs_client *clp;
Trond Myklebust5a0ec8ac2015-02-05 16:35:16 -0500343 struct inode *inode;
Benny Halevycbe82602011-05-22 19:52:37 +0300344 int rpc_status;
Trond Myklebust4d796d72016-09-23 11:38:08 -0400345 struct nfs4_xdr_opaque_data ld_private;
Benny Halevycbe82602011-05-22 19:52:37 +0300346};
347
Trond Myklebustbe3a5d22015-06-23 19:51:55 +0800348#define PNFS_LAYOUTSTATS_MAXSIZE 256
349
350struct nfs42_layoutstat_args;
351struct nfs42_layoutstat_devinfo;
352typedef void (*layoutstats_encode_t)(struct xdr_stream *,
353 struct nfs42_layoutstat_args *,
354 struct nfs42_layoutstat_devinfo *);
355
356/* Per file per deviceid layoutstats */
357struct nfs42_layoutstat_devinfo {
358 struct nfs4_deviceid dev_id;
359 __u64 offset;
360 __u64 length;
361 __u64 read_count;
362 __u64 read_bytes;
363 __u64 write_count;
364 __u64 write_bytes;
365 __u32 layout_type;
Trond Myklebust422c93c2016-10-06 17:53:20 -0400366 struct nfs4_xdr_opaque_data ld_private;
Trond Myklebustbe3a5d22015-06-23 19:51:55 +0800367};
368
369struct nfs42_layoutstat_args {
370 struct nfs4_sequence_args seq_args;
371 struct nfs_fh *fh;
372 struct inode *inode;
373 nfs4_stateid stateid;
374 int num_dev;
375 struct nfs42_layoutstat_devinfo *devinfo;
376};
377
378struct nfs42_layoutstat_res {
379 struct nfs4_sequence_res seq_res;
380 int num_dev;
381 int rpc_status;
382};
383
384struct nfs42_layoutstat_data {
385 struct inode *inode;
386 struct nfs42_layoutstat_args args;
387 struct nfs42_layoutstat_res res;
388};
389
Trond Myklebust3eb86092019-02-08 10:31:05 -0500390struct nfs42_device_error {
391 struct nfs4_deviceid dev_id;
392 int status;
393 enum nfs_opnum4 opnum;
394};
395
396struct nfs42_layout_error {
397 __u64 offset;
398 __u64 length;
399 nfs4_stateid stateid;
400 struct nfs42_device_error errors[1];
401};
402
403#define NFS42_LAYOUTERROR_MAX 5
404
405struct nfs42_layouterror_args {
406 struct nfs4_sequence_args seq_args;
407 struct inode *inode;
408 unsigned int num_errors;
409 struct nfs42_layout_error errors[NFS42_LAYOUTERROR_MAX];
410};
411
412struct nfs42_layouterror_res {
413 struct nfs4_sequence_res seq_res;
414 unsigned int num_errors;
415 int rpc_status;
416};
417
418struct nfs42_layouterror_data {
419 struct nfs42_layouterror_args args;
420 struct nfs42_layouterror_res res;
421 struct inode *inode;
422 struct pnfs_layout_segment *lseg;
423};
424
Peng Tao36022772015-09-26 02:24:34 +0800425struct nfs42_clone_args {
426 struct nfs4_sequence_args seq_args;
427 struct nfs_fh *src_fh;
428 struct nfs_fh *dst_fh;
429 nfs4_stateid src_stateid;
430 nfs4_stateid dst_stateid;
431 __u64 src_offset;
432 __u64 dst_offset;
433 __u64 count;
434 const u32 *dst_bitmask;
435};
436
437struct nfs42_clone_res {
438 struct nfs4_sequence_res seq_res;
439 unsigned int rpc_status;
440 struct nfs_fattr *dst_fattr;
441 const struct nfs_server *server;
442};
443
Trond Myklebust95b72eb2012-04-20 19:24:51 -0400444struct stateowner_id {
445 __u64 create_time;
446 __u32 uniquifier;
447};
448
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449/*
450 * Arguments to the open call.
451 */
452struct nfs_openargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500453 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700455 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 int open_flags;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500457 fmode_t fmode;
Trond Myklebust6ae37332015-01-30 14:21:14 -0500458 u32 share_access;
Weston Andros Adamson6168f622012-09-10 14:00:46 -0400459 u32 access;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460 __u64 clientid;
Trond Myklebust95b72eb2012-04-20 19:24:51 -0400461 struct stateowner_id id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 union {
Trond Myklebustd77d76f2010-06-16 09:52:27 -0400463 struct {
Kinglong Mee5334c5b2015-08-26 21:13:37 +0800464 struct iattr * attrs; /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */
Trond Myklebustd77d76f2010-06-16 09:52:27 -0400465 nfs4_verifier verifier; /* EXCLUSIVE */
466 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500468 fmode_t delegation_type; /* CLAIM_PREVIOUS */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700469 } u;
470 const struct qstr * name;
471 const struct nfs_server *server; /* Needed for ID mapping */
472 const u32 * bitmask;
Trond Myklebust1549210f2012-06-05 09:16:47 -0400473 const u32 * open_bitmap;
Trond Myklebust2a606182015-08-19 22:30:00 -0500474 enum open_claim_type4 claim;
Trond Myklebust549b19c2013-04-16 18:42:34 -0400475 enum createmode4 createmode;
Steve Dicksone058f702013-05-22 12:50:40 -0400476 const struct nfs4_label *label;
Andreas Gruenbacherdff25dd2016-12-02 22:53:30 -0500477 umode_t umask;
Fred Isaman56f487f2016-09-21 11:43:41 -0400478 struct nfs4_layoutget_args *lg_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479};
480
481struct nfs_openres {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500482 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700483 nfs4_stateid stateid;
484 struct nfs_fh fh;
485 struct nfs4_change_info cinfo;
486 __u32 rflags;
487 struct nfs_fattr * f_attr;
Steve Dicksone058f702013-05-22 12:50:40 -0400488 struct nfs4_label *f_label;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400489 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700490 const struct nfs_server *server;
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500491 fmode_t delegation_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492 nfs4_stateid delegation;
Trond Myklebust7d160a62015-09-05 19:06:57 -0400493 unsigned long pagemod_limit;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 __u32 do_recall;
Jeff Laytonaa53ed52007-06-05 14:49:03 -0400495 __u32 attrset[NFS4_BITMAP_SIZE];
Trond Myklebust6926afd12012-01-07 13:22:46 -0500496 struct nfs4_string *owner;
497 struct nfs4_string *group_owner;
Weston Andros Adamsonae2bb032012-10-02 14:49:52 -0700498 __u32 access_request;
Weston Andros Adamson6168f622012-09-10 14:00:46 -0400499 __u32 access_supported;
500 __u32 access_result;
Fred Isaman56f487f2016-09-21 11:43:41 -0400501 struct nfs4_layoutget_res *lg_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502};
503
504/*
505 * Arguments to the open_confirm call.
506 */
507struct nfs_open_confirmargs {
Trond Myklebust17ead6c2014-02-01 14:53:23 -0500508 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100510 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700511 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512};
513
514struct nfs_open_confirmres {
Trond Myklebust17ead6c2014-02-01 14:53:23 -0500515 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 nfs4_stateid stateid;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400517 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518};
519
520/*
521 * Arguments to the close call.
522 */
523struct nfs_closeargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500524 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700525 struct nfs_fh * fh;
Trond Myklebust566fcec2015-01-23 15:32:46 -0500526 nfs4_stateid stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700527 struct nfs_seqid * seqid;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500528 fmode_t fmode;
Trond Myklebust6ae37332015-01-30 14:21:14 -0500529 u32 share_access;
Trond Myklebustce2b4702021-03-25 18:15:36 -0400530 const u32 * bitmask;
531 u32 bitmask_store[NFS_BITMASK_SZ];
Trond Myklebustcf805162016-11-15 14:56:07 -0500532 struct nfs4_layoutreturn_args *lr_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533};
534
535struct nfs_closeres {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500536 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400538 struct nfs_fattr * fattr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400539 struct nfs_seqid * seqid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400540 const struct nfs_server *server;
Trond Myklebustcf805162016-11-15 14:56:07 -0500541 struct nfs4_layoutreturn_res *lr_res;
542 int lr_ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543};
544/*
545 * * Arguments to the lock,lockt, and locku call.
546 * */
547struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100548 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400549 __u64 id;
Trond Myklebustd035c362010-12-21 10:45:27 -0500550 dev_t s_dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551};
552
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100553struct nfs_lock_args {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500554 struct nfs4_sequence_args seq_args;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100555 struct nfs_fh * fh;
556 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700557 struct nfs_seqid * lock_seqid;
Trond Myklebust425c1d42015-01-24 14:57:53 -0500558 nfs4_stateid lock_stateid;
Trond Myklebust06735b32005-10-18 14:20:15 -0700559 struct nfs_seqid * open_seqid;
Trond Myklebust425c1d42015-01-24 14:57:53 -0500560 nfs4_stateid open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100561 struct nfs_lowner lock_owner;
562 unsigned char block : 1;
563 unsigned char reclaim : 1;
Trond Myklebustc69899a2015-01-24 16:03:52 -0500564 unsigned char new_lock : 1;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100565 unsigned char new_lock_owner : 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566};
567
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100568struct nfs_lock_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500569 struct nfs4_sequence_res seq_res;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400570 nfs4_stateid stateid;
571 struct nfs_seqid * lock_seqid;
572 struct nfs_seqid * open_seqid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100573};
574
575struct nfs_locku_args {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500576 struct nfs4_sequence_args seq_args;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100577 struct nfs_fh * fh;
578 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700579 struct nfs_seqid * seqid;
Trond Myklebust425c1d42015-01-24 14:57:53 -0500580 nfs4_stateid stateid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581};
582
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100583struct nfs_locku_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500584 struct nfs4_sequence_res seq_res;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400585 nfs4_stateid stateid;
586 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700587};
588
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100589struct nfs_lockt_args {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500590 struct nfs4_sequence_args seq_args;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100591 struct nfs_fh * fh;
592 struct file_lock * fl;
593 struct nfs_lowner lock_owner;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700594};
595
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100596struct nfs_lockt_res {
Benny Halevy9ff71c32009-04-01 09:21:52 -0400597 struct nfs4_sequence_res seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -0500598 struct file_lock * denied; /* LOCK, LOCKT failed */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599};
600
Trond Myklebustd3c7b7c2010-07-01 12:49:01 -0400601struct nfs_release_lockowner_args {
Trond Myklebustb7e63a12014-02-26 11:19:14 -0800602 struct nfs4_sequence_args seq_args;
Trond Myklebustd3c7b7c2010-07-01 12:49:01 -0400603 struct nfs_lowner lock_owner;
604};
605
Trond Myklebustb7e63a12014-02-26 11:19:14 -0800606struct nfs_release_lockowner_res {
607 struct nfs4_sequence_res seq_res;
608};
609
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610struct nfs4_delegreturnargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500611 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700612 const struct nfs_fh *fhandle;
613 const nfs4_stateid *stateid;
Trond Myklebustce2b4702021-03-25 18:15:36 -0400614 const u32 *bitmask;
615 u32 bitmask_store[NFS_BITMASK_SZ];
Trond Myklebust586f1c32016-11-15 15:03:33 -0500616 struct nfs4_layoutreturn_args *lr_args;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100617};
618
619struct nfs4_delegreturnres {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500620 struct nfs4_sequence_res seq_res;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100621 struct nfs_fattr * fattr;
Trond Myklebust516285eb2015-09-20 16:15:24 -0400622 struct nfs_server *server;
Trond Myklebust586f1c32016-11-15 15:03:33 -0500623 struct nfs4_layoutreturn_res *lr_res;
624 int lr_ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700625};
626
627/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628 * Arguments to the write call.
629 */
Trond Myklebust2f2c63b2012-06-08 11:56:09 -0400630struct nfs_write_verifier {
631 char data[8];
632};
633
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634struct nfs_writeverf {
Trond Myklebust2f2c63b2012-06-08 11:56:09 -0400635 struct nfs_write_verifier verifier;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636 enum nfs3_stable_how committed;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637};
638
Linus Torvalds1da177e2005-04-16 15:20:36 -0700639/*
Anna Schumaker3c6b8992014-05-06 09:12:24 -0400640 * Arguments shared by the read and write call.
641 */
642struct nfs_pgio_args {
643 struct nfs4_sequence_args seq_args;
644 struct nfs_fh * fh;
645 struct nfs_open_context *context;
646 struct nfs_lock_context *lock_context;
647 nfs4_stateid stateid;
648 __u64 offset;
649 __u32 count;
650 unsigned int pgbase;
651 struct page ** pages;
Trond Myklebust28d52232018-09-24 13:15:37 -0400652 union {
653 unsigned int replen; /* used by read */
654 struct {
Trond Myklebustce2b4702021-03-25 18:15:36 -0400655 const u32 * bitmask; /* used by write */
656 u32 bitmask_store[NFS_BITMASK_SZ]; /* used by write */
Trond Myklebust28d52232018-09-24 13:15:37 -0400657 enum nfs3_stable_how stable; /* used by write */
658 };
659 };
Anna Schumaker3c6b8992014-05-06 09:12:24 -0400660};
661
Anna Schumaker9137bdf2014-05-06 09:12:25 -0400662struct nfs_pgio_res {
663 struct nfs4_sequence_res seq_res;
664 struct nfs_fattr * fattr;
Anna Schumakerc5675522014-05-28 13:41:22 -0400665 __u64 count;
Peng Taoaabff4d2014-08-27 10:47:14 +0800666 __u32 op_status;
Trond Myklebust28d52232018-09-24 13:15:37 -0400667 union {
668 struct {
669 unsigned int replen; /* used by read */
670 int eof; /* used by read */
671 };
672 struct {
673 struct nfs_writeverf * verf; /* used by write */
674 const struct nfs_server *server; /* used by write */
675 };
676 };
Anna Schumaker9137bdf2014-05-06 09:12:25 -0400677};
678
Anna Schumaker3c6b8992014-05-06 09:12:24 -0400679/*
Fred Isaman0b7c0152012-04-20 14:47:39 -0400680 * Arguments to the commit call.
681 */
682struct nfs_commitargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500683 struct nfs4_sequence_args seq_args;
Fred Isaman0b7c0152012-04-20 14:47:39 -0400684 struct nfs_fh *fh;
685 __u64 offset;
686 __u32 count;
687 const u32 *bitmask;
Fred Isaman0b7c0152012-04-20 14:47:39 -0400688};
689
690struct nfs_commitres {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500691 struct nfs4_sequence_res seq_res;
Peng Taoaabff4d2014-08-27 10:47:14 +0800692 __u32 op_status;
Fred Isaman0b7c0152012-04-20 14:47:39 -0400693 struct nfs_fattr *fattr;
694 struct nfs_writeverf *verf;
695 const struct nfs_server *server;
Fred Isaman0b7c0152012-04-20 14:47:39 -0400696};
697
698/*
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400699 * Common arguments to the unlink call
700 */
701struct nfs_removeargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500702 struct nfs4_sequence_args seq_args;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400703 const struct nfs_fh *fh;
704 struct qstr name;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400705};
706
707struct nfs_removeres {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500708 struct nfs4_sequence_res seq_res;
Trond Myklebust516285eb2015-09-20 16:15:24 -0400709 struct nfs_server *server;
Trond Myklebustd3468902010-04-16 16:22:50 -0400710 struct nfs_fattr *dir_attr;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400711 struct nfs4_change_info cinfo;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400712};
713
714/*
Jeff Layton920769f2010-09-17 17:30:25 -0400715 * Common arguments to the rename call
716 */
717struct nfs_renameargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500718 struct nfs4_sequence_args seq_args;
Jeff Layton920769f2010-09-17 17:30:25 -0400719 const struct nfs_fh *old_dir;
720 const struct nfs_fh *new_dir;
721 const struct qstr *old_name;
722 const struct qstr *new_name;
Jeff Layton920769f2010-09-17 17:30:25 -0400723};
724
Jeff Laytone8582a82010-09-17 17:31:06 -0400725struct nfs_renameres {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500726 struct nfs4_sequence_res seq_res;
Trond Myklebust516285eb2015-09-20 16:15:24 -0400727 struct nfs_server *server;
Jeff Laytone8582a82010-09-17 17:31:06 -0400728 struct nfs4_change_info old_cinfo;
729 struct nfs_fattr *old_fattr;
730 struct nfs4_change_info new_cinfo;
731 struct nfs_fattr *new_fattr;
Jeff Laytone8582a82010-09-17 17:31:06 -0400732};
733
Weston Andros Adamsona3f73c22013-10-18 15:15:16 -0400734/* parsed sec= options */
Weston Andros Adamson4d4b69d2013-10-18 15:15:19 -0400735#define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
Weston Andros Adamsona3f73c22013-10-18 15:15:16 -0400736struct nfs_auth_info {
737 unsigned int flavor_len;
Weston Andros Adamson4d4b69d2013-10-18 15:15:19 -0400738 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS];
Weston Andros Adamsona3f73c22013-10-18 15:15:16 -0400739};
740
Jeff Layton920769f2010-09-17 17:30:25 -0400741/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742 * Argument struct for decode_entry function
743 */
744struct nfs_entry {
745 __u64 ino;
746 __u64 cookie,
747 prev_cookie;
748 const char * name;
749 unsigned int len;
750 int eof;
751 struct nfs_fh * fh;
752 struct nfs_fattr * fattr;
Steve Dicksone058f702013-05-22 12:50:40 -0400753 struct nfs4_label *label;
Trond Myklebust0b26a0b2010-11-20 14:26:44 -0500754 unsigned char d_type;
Chuck Lever573c4e12010-12-14 14:58:11 +0000755 struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756};
757
758/*
759 * The following types are for NFSv2 only.
760 */
761struct nfs_sattrargs {
762 struct nfs_fh * fh;
763 struct iattr * sattr;
764};
765
766struct nfs_diropargs {
767 struct nfs_fh * fh;
768 const char * name;
769 unsigned int len;
770};
771
772struct nfs_createargs {
773 struct nfs_fh * fh;
774 const char * name;
775 unsigned int len;
776 struct iattr * sattr;
777};
778
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779struct nfs_setattrargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500780 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781 struct nfs_fh * fh;
782 nfs4_stateid stateid;
783 struct iattr * iap;
784 const struct nfs_server * server; /* Needed for name mapping */
785 const u32 * bitmask;
Steve Dicksone058f702013-05-22 12:50:40 -0400786 const struct nfs4_label *label;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787};
788
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000789struct nfs_setaclargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500790 struct nfs4_sequence_args seq_args;
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000791 struct nfs_fh * fh;
792 size_t acl_len;
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000793 struct page ** acl_pages;
794};
795
Benny Halevy73c403a2009-04-01 09:22:01 -0400796struct nfs_setaclres {
797 struct nfs4_sequence_res seq_res;
798};
799
J. Bruce Fields029d1052005-06-22 17:16:22 +0000800struct nfs_getaclargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500801 struct nfs4_sequence_args seq_args;
J. Bruce Fields029d1052005-06-22 17:16:22 +0000802 struct nfs_fh * fh;
803 size_t acl_len;
J. Bruce Fields029d1052005-06-22 17:16:22 +0000804 struct page ** acl_pages;
805};
806
Andy Adamsonbf118a32011-12-07 11:55:27 -0500807/* getxattr ACL interface flags */
Trond Myklebust1f1ea6c2012-08-26 11:44:43 -0700808#define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
Benny Halevy663c79b2009-04-01 09:21:59 -0400809struct nfs_getaclres {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500810 struct nfs4_sequence_res seq_res;
Benny Halevy663c79b2009-04-01 09:21:59 -0400811 size_t acl_len;
Andy Adamsonbf118a32011-12-07 11:55:27 -0500812 size_t acl_data_offset;
813 int acl_flags;
Trond Myklebust331818f2012-02-03 18:30:53 -0500814 struct page * acl_scratch;
Benny Halevy663c79b2009-04-01 09:21:59 -0400815};
816
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817struct nfs_setattrres {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500818 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819 struct nfs_fattr * fattr;
Steve Dicksone058f702013-05-22 12:50:40 -0400820 struct nfs4_label *label;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821 const struct nfs_server * server;
822};
823
824struct nfs_linkargs {
825 struct nfs_fh * fromfh;
826 struct nfs_fh * tofh;
827 const char * toname;
828 unsigned int tolen;
829};
830
831struct nfs_symlinkargs {
832 struct nfs_fh * fromfh;
833 const char * fromname;
834 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400835 struct page ** pages;
836 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837 struct iattr * sattr;
838};
839
840struct nfs_readdirargs {
841 struct nfs_fh * fh;
842 __u32 cookie;
843 unsigned int count;
844 struct page ** pages;
845};
846
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000847struct nfs3_getaclargs {
848 struct nfs_fh * fh;
849 int mask;
850 struct page ** pages;
851};
852
853struct nfs3_setaclargs {
854 struct inode * inode;
855 int mask;
856 struct posix_acl * acl_access;
857 struct posix_acl * acl_default;
Trond Myklebustae46141f2009-03-10 20:33:18 -0400858 size_t len;
859 unsigned int npages;
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000860 struct page ** pages;
861};
862
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863struct nfs_diropok {
864 struct nfs_fh * fh;
865 struct nfs_fattr * fattr;
866};
867
868struct nfs_readlinkargs {
869 struct nfs_fh * fh;
870 unsigned int pgbase;
871 unsigned int pglen;
872 struct page ** pages;
873};
874
875struct nfs3_sattrargs {
876 struct nfs_fh * fh;
877 struct iattr * sattr;
878 unsigned int guard;
Trond Myklebust6430b322019-10-04 17:00:02 -0400879 struct timespec64 guardtime;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880};
881
882struct nfs3_diropargs {
883 struct nfs_fh * fh;
884 const char * name;
885 unsigned int len;
886};
887
888struct nfs3_accessargs {
889 struct nfs_fh * fh;
890 __u32 access;
891};
892
893struct nfs3_createargs {
894 struct nfs_fh * fh;
895 const char * name;
896 unsigned int len;
897 struct iattr * sattr;
898 enum nfs3_createmode createmode;
Al Virobc4785c2006-10-19 23:28:51 -0700899 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700900};
901
902struct nfs3_mkdirargs {
903 struct nfs_fh * fh;
904 const char * name;
905 unsigned int len;
906 struct iattr * sattr;
907};
908
909struct nfs3_symlinkargs {
910 struct nfs_fh * fromfh;
911 const char * fromname;
912 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400913 struct page ** pages;
914 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700915 struct iattr * sattr;
916};
917
918struct nfs3_mknodargs {
919 struct nfs_fh * fh;
920 const char * name;
921 unsigned int len;
922 enum nfs3_ftype type;
923 struct iattr * sattr;
924 dev_t rdev;
925};
926
Linus Torvalds1da177e2005-04-16 15:20:36 -0700927struct nfs3_linkargs {
928 struct nfs_fh * fromfh;
929 struct nfs_fh * tofh;
930 const char * toname;
931 unsigned int tolen;
932};
933
934struct nfs3_readdirargs {
935 struct nfs_fh * fh;
936 __u64 cookie;
Al Virobc4785c2006-10-19 23:28:51 -0700937 __be32 verf[2];
Benjamin Coddingtona7a3b1e2017-06-20 08:33:44 -0400938 bool plus;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700939 unsigned int count;
940 struct page ** pages;
941};
942
943struct nfs3_diropres {
944 struct nfs_fattr * dir_attr;
945 struct nfs_fh * fh;
946 struct nfs_fattr * fattr;
947};
948
949struct nfs3_accessres {
950 struct nfs_fattr * fattr;
951 __u32 access;
952};
953
954struct nfs3_readlinkargs {
955 struct nfs_fh * fh;
956 unsigned int pgbase;
957 unsigned int pglen;
958 struct page ** pages;
959};
960
Linus Torvalds1da177e2005-04-16 15:20:36 -0700961struct nfs3_linkres {
962 struct nfs_fattr * dir_attr;
963 struct nfs_fattr * fattr;
964};
965
966struct nfs3_readdirres {
967 struct nfs_fattr * dir_attr;
Al Virobc4785c2006-10-19 23:28:51 -0700968 __be32 * verf;
Benjamin Coddingtona7a3b1e2017-06-20 08:33:44 -0400969 bool plus;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700970};
971
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000972struct nfs3_getaclres {
973 struct nfs_fattr * fattr;
974 int mask;
975 unsigned int acl_access_count;
976 unsigned int acl_default_count;
977 struct posix_acl * acl_access;
978 struct posix_acl * acl_default;
979};
980
Bryan Schumaker89d77c82012-07-30 16:05:25 -0400981#if IS_ENABLED(CONFIG_NFS_V4)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700982
983typedef u64 clientid4;
984
985struct nfs4_accessargs {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500986 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700987 const struct nfs_fh * fh;
Trond Myklebust76b32992007-08-10 17:45:11 -0400988 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700989 u32 access;
990};
991
992struct nfs4_accessres {
Trond Myklebust62ae0822012-11-29 17:10:01 -0500993 struct nfs4_sequence_res seq_res;
Trond Myklebust76b32992007-08-10 17:45:11 -0400994 const struct nfs_server * server;
995 struct nfs_fattr * fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700996 u32 supported;
997 u32 access;
998};
999
1000struct nfs4_create_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001001 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001002 u32 ftype;
1003 union {
Chuck Lever94a6d752006-08-22 20:06:23 -04001004 struct {
1005 struct page ** pages;
1006 unsigned int len;
1007 } symlink; /* NF4LNK */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001008 struct {
1009 u32 specdata1;
1010 u32 specdata2;
1011 } device; /* NF4BLK, NF4CHR */
1012 } u;
1013 const struct qstr * name;
1014 const struct nfs_server * server;
1015 const struct iattr * attrs;
1016 const struct nfs_fh * dir_fh;
1017 const u32 * bitmask;
Steve Dicksone058f702013-05-22 12:50:40 -04001018 const struct nfs4_label *label;
Andreas Gruenbacherdff25dd2016-12-02 22:53:30 -05001019 umode_t umask;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001020};
1021
1022struct nfs4_create_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001023 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001024 const struct nfs_server * server;
1025 struct nfs_fh * fh;
1026 struct nfs_fattr * fattr;
Steve Dicksone058f702013-05-22 12:50:40 -04001027 struct nfs4_label *label;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001028 struct nfs4_change_info dir_cinfo;
1029};
1030
1031struct nfs4_fsinfo_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001032 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001033 const struct nfs_fh * fh;
1034 const u32 * bitmask;
1035};
1036
Benny Halevy3dda5e42009-04-01 09:21:57 -04001037struct nfs4_fsinfo_res {
Benny Halevy3dda5e42009-04-01 09:21:57 -04001038 struct nfs4_sequence_res seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001039 struct nfs_fsinfo *fsinfo;
Benny Halevy3dda5e42009-04-01 09:21:57 -04001040};
1041
Linus Torvalds1da177e2005-04-16 15:20:36 -07001042struct nfs4_getattr_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001043 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001044 const struct nfs_fh * fh;
1045 const u32 * bitmask;
1046};
1047
1048struct nfs4_getattr_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001049 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001050 const struct nfs_server * server;
1051 struct nfs_fattr * fattr;
Steve Dicksone058f702013-05-22 12:50:40 -04001052 struct nfs4_label *label;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001053};
1054
1055struct nfs4_link_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001056 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001057 const struct nfs_fh * fh;
1058 const struct nfs_fh * dir_fh;
1059 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -04001060 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001061};
1062
Trond Myklebust91ba2ee2005-10-27 22:12:42 -04001063struct nfs4_link_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001064 struct nfs4_sequence_res seq_res;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -04001065 const struct nfs_server * server;
1066 struct nfs_fattr * fattr;
Steve Dicksone058f702013-05-22 12:50:40 -04001067 struct nfs4_label *label;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -04001068 struct nfs4_change_info cinfo;
1069 struct nfs_fattr * dir_attr;
1070};
1071
Linus Torvalds1da177e2005-04-16 15:20:36 -07001072struct nfs4_lookup_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001073 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001074 const struct nfs_fh * dir_fh;
1075 const struct qstr * name;
1076 const u32 * bitmask;
1077};
1078
1079struct nfs4_lookup_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001080 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001081 const struct nfs_server * server;
1082 struct nfs_fattr * fattr;
1083 struct nfs_fh * fh;
Steve Dicksone058f702013-05-22 12:50:40 -04001084 struct nfs4_label *label;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001085};
1086
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001087struct nfs4_lookupp_arg {
1088 struct nfs4_sequence_args seq_args;
1089 const struct nfs_fh *fh;
1090 const u32 *bitmask;
1091};
1092
1093struct nfs4_lookupp_res {
1094 struct nfs4_sequence_res seq_res;
1095 const struct nfs_server *server;
1096 struct nfs_fattr *fattr;
1097 struct nfs_fh *fh;
1098 struct nfs4_label *label;
1099};
1100
Linus Torvalds1da177e2005-04-16 15:20:36 -07001101struct nfs4_lookup_root_arg {
Benny Halevy9ff71c32009-04-01 09:21:52 -04001102 struct nfs4_sequence_args seq_args;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001103 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001104};
1105
1106struct nfs4_pathconf_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001107 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001108 const struct nfs_fh * fh;
1109 const u32 * bitmask;
1110};
1111
Benny Halevyd45b2982009-04-01 09:21:58 -04001112struct nfs4_pathconf_res {
Benny Halevyd45b2982009-04-01 09:21:58 -04001113 struct nfs4_sequence_res seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001114 struct nfs_pathconf *pathconf;
Benny Halevyd45b2982009-04-01 09:21:58 -04001115};
1116
Linus Torvalds1da177e2005-04-16 15:20:36 -07001117struct nfs4_readdir_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001118 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001119 const struct nfs_fh * fh;
1120 u64 cookie;
1121 nfs4_verifier verifier;
1122 u32 count;
1123 struct page ** pages; /* zero-copy data */
1124 unsigned int pgbase; /* zero-copy data */
1125 const u32 * bitmask;
Benjamin Coddingtona7a3b1e2017-06-20 08:33:44 -04001126 bool plus;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001127};
1128
1129struct nfs4_readdir_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001130 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001131 nfs4_verifier verifier;
1132 unsigned int pgbase;
1133};
1134
1135struct nfs4_readlink {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001136 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001137 const struct nfs_fh * fh;
1138 unsigned int pgbase;
1139 unsigned int pglen; /* zero-copy data */
1140 struct page ** pages; /* zero-copy data */
1141};
1142
Benny Halevyf50c7002009-04-01 09:21:55 -04001143struct nfs4_readlink_res {
1144 struct nfs4_sequence_res seq_res;
1145};
1146
Linus Torvalds1da177e2005-04-16 15:20:36 -07001147struct nfs4_setclientid {
Chuck Levercc38bac2007-12-10 14:56:54 -05001148 const nfs4_verifier * sc_verifier;
Chuck Levercc38bac2007-12-10 14:56:54 -05001149 u32 sc_prog;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001150 unsigned int sc_netid_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -04001151 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001152 unsigned int sc_uaddr_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -04001153 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
Jeff Layton3a6bb732015-06-09 19:43:57 -04001154 struct nfs_client *sc_clnt;
Jeff Laytonf11b2a12014-06-21 20:52:17 -04001155 struct rpc_cred *sc_cred;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001156};
1157
Trond Myklebustbb8b27e2010-04-16 16:43:06 -04001158struct nfs4_setclientid_res {
1159 u64 clientid;
1160 nfs4_verifier confirm;
1161};
1162
Linus Torvalds1da177e2005-04-16 15:20:36 -07001163struct nfs4_statfs_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001164 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001165 const struct nfs_fh * fh;
1166 const u32 * bitmask;
1167};
1168
Benny Halevy24ad1482009-04-01 09:21:56 -04001169struct nfs4_statfs_res {
Benny Halevy24ad1482009-04-01 09:21:56 -04001170 struct nfs4_sequence_res seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001171 struct nfs_fsstat *fsstat;
Benny Halevy24ad1482009-04-01 09:21:56 -04001172};
1173
Benny Halevy43652ad2009-04-01 09:21:54 -04001174struct nfs4_server_caps_arg {
Benny Halevy43652ad2009-04-01 09:21:54 -04001175 struct nfs4_sequence_args seq_args;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001176 struct nfs_fh *fhandle;
Kinglong Mee8c612822015-08-26 21:12:58 +08001177 const u32 * bitmask;
Benny Halevy43652ad2009-04-01 09:21:54 -04001178};
1179
Linus Torvalds1da177e2005-04-16 15:20:36 -07001180struct nfs4_server_caps_res {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001181 struct nfs4_sequence_res seq_res;
Fred Isamandae100c2011-07-30 20:52:37 -04001182 u32 attr_bitmask[3];
Kinglong Mee8c612822015-08-26 21:12:58 +08001183 u32 exclcreat_bitmask[3];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001184 u32 acl_bitmask;
1185 u32 has_links;
1186 u32 has_symlinks;
Chuck Lever264e6352012-03-01 17:02:05 -05001187 u32 fh_expire_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001188};
1189
Manoj Naik7aaa0b32006-06-09 09:34:23 -04001190#define NFS4_PATHNAME_MAXCOMPONENTS 512
1191struct nfs4_pathname {
1192 unsigned int ncomponents;
1193 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
1194};
1195
1196#define NFS4_FS_LOCATION_MAXSERVERS 10
1197struct nfs4_fs_location {
1198 unsigned int nservers;
1199 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
1200 struct nfs4_pathname rootpath;
1201};
1202
1203#define NFS4_FS_LOCATIONS_MAXENTRIES 10
1204struct nfs4_fs_locations {
Trond Myklebust683b57b2006-06-09 09:34:22 -04001205 struct nfs_fattr fattr;
1206 const struct nfs_server *server;
Manoj Naik7aaa0b32006-06-09 09:34:23 -04001207 struct nfs4_pathname fs_path;
Trond Myklebust683b57b2006-06-09 09:34:22 -04001208 int nlocations;
Manoj Naik7aaa0b32006-06-09 09:34:23 -04001209 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
Trond Myklebust683b57b2006-06-09 09:34:22 -04001210};
1211
1212struct nfs4_fs_locations_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001213 struct nfs4_sequence_args seq_args;
Trond Myklebust683b57b2006-06-09 09:34:22 -04001214 const struct nfs_fh *dir_fh;
Chuck Leverb03d7352013-10-17 14:12:50 -04001215 const struct nfs_fh *fh;
Trond Myklebust683b57b2006-06-09 09:34:22 -04001216 const struct qstr *name;
1217 struct page *page;
1218 const u32 *bitmask;
Chuck Leverb03d7352013-10-17 14:12:50 -04001219 clientid4 clientid;
1220 unsigned char migration:1, renew:1;
Trond Myklebust683b57b2006-06-09 09:34:22 -04001221};
1222
Benny Halevy22958462009-04-01 09:22:02 -04001223struct nfs4_fs_locations_res {
Benny Halevy22958462009-04-01 09:22:02 -04001224 struct nfs4_sequence_res seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001225 struct nfs4_fs_locations *fs_locations;
Chuck Leverb03d7352013-10-17 14:12:50 -04001226 unsigned char migration:1, renew:1;
Benny Halevy22958462009-04-01 09:22:02 -04001227};
1228
Chuck Leverfb15b262013-03-16 15:54:34 -04001229struct nfs4_secinfo4 {
1230 u32 flavor;
1231 struct rpcsec_gss_info flavor_info;
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001232};
1233
1234struct nfs4_secinfo_flavors {
Chuck Leverfb15b262013-03-16 15:54:34 -04001235 unsigned int num_flavors;
Gustavo A. R. Silva1ad8dd92020-05-07 14:02:23 -05001236 struct nfs4_secinfo4 flavors[];
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001237};
1238
1239struct nfs4_secinfo_arg {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001240 struct nfs4_sequence_args seq_args;
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001241 const struct nfs_fh *dir_fh;
1242 const struct qstr *name;
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001243};
1244
1245struct nfs4_secinfo_res {
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001246 struct nfs4_sequence_res seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001247 struct nfs4_secinfo_flavors *flavors;
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001248};
1249
Chuck Lever44c99932013-10-17 14:13:30 -04001250struct nfs4_fsid_present_arg {
1251 struct nfs4_sequence_args seq_args;
1252 const struct nfs_fh *fh;
1253 clientid4 clientid;
1254 unsigned char renew:1;
1255};
1256
1257struct nfs4_fsid_present_res {
1258 struct nfs4_sequence_res seq_res;
1259 struct nfs_fh *fh;
1260 unsigned char renew:1;
1261};
1262
Linus Torvalds1da177e2005-04-16 15:20:36 -07001263#endif /* CONFIG_NFS_V4 */
1264
Benny Halevy99fe60d2009-04-01 09:22:29 -04001265struct nfstime4 {
1266 u64 seconds;
1267 u32 nseconds;
1268};
1269
1270#ifdef CONFIG_NFS_V4_1
Fred Isamanea2cf222012-04-20 14:47:53 -04001271
1272struct pnfs_commit_bucket {
1273 struct list_head written;
1274 struct list_head committing;
Trond Myklebustc84bea52020-03-22 14:47:38 -04001275 struct pnfs_layout_segment *lseg;
Weston Andros Adamson5002c582014-05-15 11:56:54 -04001276 struct nfs_writeverf direct_verf;
Fred Isamanea2cf222012-04-20 14:47:53 -04001277};
1278
Trond Myklebustd7242c42020-03-18 17:22:47 -04001279struct pnfs_commit_array {
1280 struct list_head cinfo_list;
1281 struct list_head lseg_list;
1282 struct pnfs_layout_segment *lseg;
1283 struct rcu_head rcu;
Trond Myklebusta9901892020-03-20 16:04:06 -04001284 refcount_t refcount;
Trond Myklebustd7242c42020-03-18 17:22:47 -04001285 unsigned int nbuckets;
1286 struct pnfs_commit_bucket buckets[];
1287};
1288
Fred Isamanea2cf222012-04-20 14:47:53 -04001289struct pnfs_ds_commit_info {
Trond Myklebustc21e7162020-03-19 13:36:36 -04001290 struct list_head commits;
Trond Myklebustd7242c42020-03-18 17:22:47 -04001291 unsigned int nwritten;
1292 unsigned int ncommitting;
Trond Myklebust9c455a82020-03-21 11:13:05 -04001293 const struct pnfs_commit_ops *ops;
Fred Isamanea2cf222012-04-20 14:47:53 -04001294};
1295
Weston Andros Adamson2031cd12013-08-13 16:37:32 -04001296struct nfs41_state_protection {
1297 u32 how;
1298 struct nfs4_op_map enforce;
1299 struct nfs4_op_map allow;
1300};
1301
Benny Halevy99fe60d2009-04-01 09:22:29 -04001302struct nfs41_exchange_id_args {
1303 struct nfs_client *client;
Trond Myklebustfd405592017-08-01 16:02:47 -04001304 nfs4_verifier verifier;
Benny Halevy99fe60d2009-04-01 09:22:29 -04001305 u32 flags;
Weston Andros Adamson2031cd12013-08-13 16:37:32 -04001306 struct nfs41_state_protection state_protect;
Benny Halevy99fe60d2009-04-01 09:22:29 -04001307};
1308
Chuck Leveracdeb692012-05-21 22:46:16 -04001309struct nfs41_server_owner {
Benny Halevy99fe60d2009-04-01 09:22:29 -04001310 uint64_t minor_id;
1311 uint32_t major_id_sz;
1312 char major_id[NFS4_OPAQUE_LIMIT];
1313};
1314
Chuck Lever79d4e1f2012-05-21 22:44:31 -04001315struct nfs41_server_scope {
Benny Halevy99fe60d2009-04-01 09:22:29 -04001316 uint32_t server_scope_sz;
1317 char server_scope[NFS4_OPAQUE_LIMIT];
1318};
1319
Weston Andros Adamson7d2ed9a2012-02-17 15:20:26 -05001320struct nfs41_impl_id {
1321 char domain[NFS4_OPAQUE_LIMIT + 1];
1322 char name[NFS4_OPAQUE_LIMIT + 1];
1323 struct nfstime4 date;
1324};
1325
Olga Kornievskaiadff58532020-04-24 17:45:50 -04001326#define MAX_BIND_CONN_TO_SESSION_RETRIES 3
Trond Myklebust71a097c2015-02-18 09:27:18 -08001327struct nfs41_bind_conn_to_session_args {
1328 struct nfs_client *client;
1329 struct nfs4_sessionid sessionid;
1330 u32 dir;
1331 bool use_conn_in_rdma_mode;
Olga Kornievskaiadff58532020-04-24 17:45:50 -04001332 int retries;
Trond Myklebust71a097c2015-02-18 09:27:18 -08001333};
1334
Weston Andros Adamson7c44f1ae2012-05-24 13:22:50 -04001335struct nfs41_bind_conn_to_session_res {
Trond Myklebust71a097c2015-02-18 09:27:18 -08001336 struct nfs4_sessionid sessionid;
Weston Andros Adamson7c44f1ae2012-05-24 13:22:50 -04001337 u32 dir;
1338 bool use_conn_in_rdma_mode;
1339};
1340
Benny Halevy99fe60d2009-04-01 09:22:29 -04001341struct nfs41_exchange_id_res {
Trond Myklebust32b01312012-05-26 13:41:04 -04001342 u64 clientid;
1343 u32 seqid;
Benny Halevy99fe60d2009-04-01 09:22:29 -04001344 u32 flags;
Chuck Leveracdeb692012-05-21 22:46:16 -04001345 struct nfs41_server_owner *server_owner;
Chuck Lever79d4e1f2012-05-21 22:44:31 -04001346 struct nfs41_server_scope *server_scope;
Weston Andros Adamson7d2ed9a2012-02-17 15:20:26 -05001347 struct nfs41_impl_id *impl_id;
Weston Andros Adamson2031cd12013-08-13 16:37:32 -04001348 struct nfs41_state_protection state_protect;
Benny Halevy99fe60d2009-04-01 09:22:29 -04001349};
Andy Adamsonfc931582009-04-01 09:22:31 -04001350
1351struct nfs41_create_session_args {
1352 struct nfs_client *client;
Trond Myklebust79969dd12015-02-18 11:30:18 -08001353 u64 clientid;
1354 uint32_t seqid;
Andy Adamsonfc931582009-04-01 09:22:31 -04001355 uint32_t flags;
1356 uint32_t cb_program;
1357 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1358 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1359};
1360
1361struct nfs41_create_session_res {
Trond Myklebust79969dd12015-02-18 11:30:18 -08001362 struct nfs4_sessionid sessionid;
1363 uint32_t seqid;
1364 uint32_t flags;
1365 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1366 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
Andy Adamsonfc931582009-04-01 09:22:31 -04001367};
Ricardo Labiaga180197532009-12-05 16:08:40 -05001368
1369struct nfs41_reclaim_complete_args {
Trond Myklebust62ae0822012-11-29 17:10:01 -05001370 struct nfs4_sequence_args seq_args;
Ricardo Labiaga180197532009-12-05 16:08:40 -05001371 /* In the future extend to include curr_fh for use with migration */
1372 unsigned char one_fs:1;
Ricardo Labiaga180197532009-12-05 16:08:40 -05001373};
1374
1375struct nfs41_reclaim_complete_res {
1376 struct nfs4_sequence_res seq_res;
1377};
Bryan Schumakerfca78d62011-06-02 14:59:07 -04001378
1379#define SECINFO_STYLE_CURRENT_FH 0
1380#define SECINFO_STYLE_PARENT 1
1381struct nfs41_secinfo_no_name_args {
Bryan Schumakerfca78d62011-06-02 14:59:07 -04001382 struct nfs4_sequence_args seq_args;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001383 int style;
Bryan Schumakerfca78d62011-06-02 14:59:07 -04001384};
1385
Bryan Schumaker7d974792011-06-02 14:59:08 -04001386struct nfs41_test_stateid_args {
Bryan Schumaker7d974792011-06-02 14:59:08 -04001387 struct nfs4_sequence_args seq_args;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001388 nfs4_stateid *stateid;
Bryan Schumaker7d974792011-06-02 14:59:08 -04001389};
1390
1391struct nfs41_test_stateid_res {
Bryan Schumaker7d974792011-06-02 14:59:08 -04001392 struct nfs4_sequence_res seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001393 unsigned int status;
Bryan Schumaker7d974792011-06-02 14:59:08 -04001394};
1395
Bryan Schumaker9aeda352011-06-02 14:59:09 -04001396struct nfs41_free_stateid_args {
Bryan Schumaker9aeda352011-06-02 14:59:09 -04001397 struct nfs4_sequence_args seq_args;
Trond Myklebust7c1d5fa2013-05-03 14:40:01 -04001398 nfs4_stateid stateid;
Bryan Schumaker9aeda352011-06-02 14:59:09 -04001399};
1400
1401struct nfs41_free_stateid_res {
Bryan Schumaker9aeda352011-06-02 14:59:09 -04001402 struct nfs4_sequence_res seq_res;
Trond Myklebust62ae0822012-11-29 17:10:01 -05001403 unsigned int status;
Bryan Schumaker9aeda352011-06-02 14:59:09 -04001404};
1405
Trond Myklebust4f976152012-04-30 18:39:20 -04001406#else
1407
1408struct pnfs_ds_commit_info {
1409};
1410
Benny Halevy99fe60d2009-04-01 09:22:29 -04001411#endif /* CONFIG_NFS_V4_1 */
1412
Anna Schumaker1c6dcbe2014-09-26 13:58:48 -04001413#ifdef CONFIG_NFS_V4_2
Anna Schumakerf4ac1672014-11-25 13:18:15 -05001414struct nfs42_falloc_args {
1415 struct nfs4_sequence_args seq_args;
1416
1417 struct nfs_fh *falloc_fh;
1418 nfs4_stateid falloc_stateid;
1419 u64 falloc_offset;
1420 u64 falloc_length;
Anna Schumaker9a519402015-03-16 14:06:23 -04001421 const u32 *falloc_bitmask;
Anna Schumakerf4ac1672014-11-25 13:18:15 -05001422};
1423
1424struct nfs42_falloc_res {
1425 struct nfs4_sequence_res seq_res;
1426 unsigned int status;
Anna Schumaker9a519402015-03-16 14:06:23 -04001427
1428 struct nfs_fattr *falloc_fattr;
1429 const struct nfs_server *falloc_server;
Anna Schumakerf4ac1672014-11-25 13:18:15 -05001430};
1431
Anna Schumaker2e724482013-05-21 16:53:03 -04001432struct nfs42_copy_args {
1433 struct nfs4_sequence_args seq_args;
1434
1435 struct nfs_fh *src_fh;
1436 nfs4_stateid src_stateid;
1437 u64 src_pos;
1438
1439 struct nfs_fh *dst_fh;
1440 nfs4_stateid dst_stateid;
1441 u64 dst_pos;
1442
1443 u64 count;
Olga Kornievskaia62164f32018-07-09 15:13:31 -04001444 bool sync;
Olga Kornievskaia1d38f3f2019-06-04 11:54:18 -04001445 struct nl4_server *cp_src;
Anna Schumaker2e724482013-05-21 16:53:03 -04001446};
1447
1448struct nfs42_write_res {
Olga Kornievskaia67aa7442018-07-09 15:13:30 -04001449 nfs4_stateid stateid;
Anna Schumaker2e724482013-05-21 16:53:03 -04001450 u64 count;
1451 struct nfs_writeverf verifier;
1452};
1453
1454struct nfs42_copy_res {
1455 struct nfs4_sequence_res seq_res;
1456 struct nfs42_write_res write_res;
1457 bool consecutive;
1458 bool synchronous;
Olga Kornievskaiae0926932017-05-08 18:02:24 -04001459 struct nfs_commitres commit_res;
Anna Schumaker2e724482013-05-21 16:53:03 -04001460};
1461
Olga Kornievskaiacb95dee2018-07-09 15:13:29 -04001462struct nfs42_offload_status_args {
1463 struct nfs4_sequence_args osa_seq_args;
1464 struct nfs_fh *osa_src_fh;
1465 nfs4_stateid osa_stateid;
1466};
1467
1468struct nfs42_offload_status_res {
1469 struct nfs4_sequence_res osr_seq_res;
1470 uint64_t osr_count;
1471 int osr_status;
1472};
1473
Olga Kornievskaia04915672019-06-04 16:14:30 -04001474struct nfs42_copy_notify_args {
1475 struct nfs4_sequence_args cna_seq_args;
1476
1477 struct nfs_fh *cna_src_fh;
1478 nfs4_stateid cna_src_stateid;
1479 struct nl4_server cna_dst;
1480};
1481
1482struct nfs42_copy_notify_res {
1483 struct nfs4_sequence_res cnr_seq_res;
1484
1485 struct nfstime4 cnr_lease_time;
1486 nfs4_stateid cnr_stateid;
1487 struct nl4_server cnr_src;
1488};
1489
Anna Schumaker1c6dcbe2014-09-26 13:58:48 -04001490struct nfs42_seek_args {
1491 struct nfs4_sequence_args seq_args;
1492
1493 struct nfs_fh *sa_fh;
1494 nfs4_stateid sa_stateid;
1495 u64 sa_offset;
1496 u32 sa_what;
1497};
1498
1499struct nfs42_seek_res {
1500 struct nfs4_sequence_res seq_res;
1501 unsigned int status;
1502
1503 u32 sr_eof;
1504 u64 sr_offset;
1505};
Frank van der Linden3e1f0212020-06-23 22:38:56 +00001506
1507struct nfs42_setxattrargs {
1508 struct nfs4_sequence_args seq_args;
1509 struct nfs_fh *fh;
1510 const char *xattr_name;
1511 u32 xattr_flags;
1512 size_t xattr_len;
1513 struct page **xattr_pages;
1514};
1515
1516struct nfs42_setxattrres {
1517 struct nfs4_sequence_res seq_res;
1518 struct nfs4_change_info cinfo;
1519};
1520
1521struct nfs42_getxattrargs {
1522 struct nfs4_sequence_args seq_args;
1523 struct nfs_fh *fh;
1524 const char *xattr_name;
1525 size_t xattr_len;
1526 struct page **xattr_pages;
1527};
1528
1529struct nfs42_getxattrres {
1530 struct nfs4_sequence_res seq_res;
1531 size_t xattr_len;
1532};
1533
1534struct nfs42_listxattrsargs {
1535 struct nfs4_sequence_args seq_args;
1536 struct nfs_fh *fh;
1537 u32 count;
1538 u64 cookie;
1539 struct page **xattr_pages;
1540};
1541
1542struct nfs42_listxattrsres {
1543 struct nfs4_sequence_res seq_res;
1544 struct page *scratch;
1545 void *xattr_buf;
1546 size_t xattr_len;
1547 u64 cookie;
1548 bool eof;
1549 size_t copied;
1550};
1551
1552struct nfs42_removexattrargs {
1553 struct nfs4_sequence_args seq_args;
1554 struct nfs_fh *fh;
1555 const char *xattr_name;
1556};
1557
1558struct nfs42_removexattrres {
1559 struct nfs4_sequence_res seq_res;
1560 struct nfs4_change_info cinfo;
1561};
1562
1563#endif /* CONFIG_NFS_V4_2 */
Anna Schumaker1c6dcbe2014-09-26 13:58:48 -04001564
Linus Torvalds1da177e2005-04-16 15:20:36 -07001565struct nfs_page;
1566
Chuck Lever40859d72005-11-30 18:09:02 -05001567#define NFS_PAGEVEC_SIZE (8U)
1568
Fred Isaman30dd3742012-04-20 14:47:45 -04001569struct nfs_page_array {
1570 struct page **pagevec;
1571 unsigned int npages; /* Max length of pagevec */
1572 struct page *page_array[NFS_PAGEVEC_SIZE];
1573};
1574
Fred Isaman4db6e0b2012-04-20 14:47:46 -04001575/* used as flag bits in nfs_pgio_header */
1576enum {
1577 NFS_IOHDR_ERROR = 0,
1578 NFS_IOHDR_EOF,
1579 NFS_IOHDR_REDO,
Trond Myklebust37e9ed22015-12-22 12:30:24 -05001580 NFS_IOHDR_STAT,
Trond Myklebust42f86b42018-06-18 19:07:24 -04001581 NFS_IOHDR_RESEND_PNFS,
1582 NFS_IOHDR_RESEND_MDS,
Fred Isaman4db6e0b2012-04-20 14:47:46 -04001583};
1584
Trond Myklebust919e3bd2017-06-20 19:35:37 -04001585struct nfs_io_completion;
Fred Isamancd841602012-04-20 14:47:44 -04001586struct nfs_pgio_header {
1587 struct inode *inode;
NeilBrowna52458b2018-12-03 11:30:31 +11001588 const struct cred *cred;
Fred Isamancd841602012-04-20 14:47:44 -04001589 struct list_head pages;
1590 struct nfs_page *req;
Anna Schumakerf79d06f2014-05-06 09:12:28 -04001591 struct nfs_writeverf verf; /* Used for writes */
Benjamin Coddingtonfbe77c32017-04-19 10:11:35 -04001592 fmode_t rw_mode;
Fred Isamancd841602012-04-20 14:47:44 -04001593 struct pnfs_layout_segment *lseg;
Fred Isaman4db6e0b2012-04-20 14:47:46 -04001594 loff_t io_start;
Fred Isamancd841602012-04-20 14:47:44 -04001595 const struct rpc_call_ops *mds_ops;
Fred Isaman4db6e0b2012-04-20 14:47:46 -04001596 void (*release) (struct nfs_pgio_header *hdr);
Fred Isaman061ae2e2012-04-20 14:47:48 -04001597 const struct nfs_pgio_completion_ops *completion_ops;
Anna Schumaker4a0de552014-05-06 09:12:30 -04001598 const struct nfs_rw_ops *rw_ops;
Trond Myklebust919e3bd2017-06-20 19:35:37 -04001599 struct nfs_io_completion *io_completion;
Fred Isaman584aa812012-04-20 14:47:51 -04001600 struct nfs_direct_req *dreq;
Trond Myklebust1c6c4b72018-09-25 12:34:43 -04001601
Fred Isamancd841602012-04-20 14:47:44 -04001602 int pnfs_error;
Fred Isaman4db6e0b2012-04-20 14:47:46 -04001603 int error; /* merge with pnfs_error */
Trond Myklebust1c6c4b72018-09-25 12:34:43 -04001604 unsigned int good_bytes; /* boundary of good data */
Fred Isaman4db6e0b2012-04-20 14:47:46 -04001605 unsigned long flags;
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001606
1607 /*
1608 * rpc data
1609 */
1610 struct rpc_task task;
1611 struct nfs_fattr fattr;
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001612 struct nfs_pgio_args args; /* argument struct */
1613 struct nfs_pgio_res res; /* result struct */
1614 unsigned long timestamp; /* For lease renewal */
1615 int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
1616 __u64 mds_offset; /* Filelayout dense stripe */
1617 struct nfs_page_array page_array;
1618 struct nfs_client *ds_clp; /* pNFS data server */
Trond Myklebustc754e132020-09-18 15:29:59 -04001619 u32 ds_commit_idx; /* ds index if ds_clp is set */
1620 u32 pgio_mirror_idx;/* mirror index in pgio layer */
Fred Isamancd841602012-04-20 14:47:44 -04001621};
1622
Fred Isamanea2cf222012-04-20 14:47:53 -04001623struct nfs_mds_commit_info {
1624 atomic_t rpcs_out;
Trond Myklebust5cb953d2017-08-01 17:04:12 -04001625 atomic_long_t ncommit;
Fred Isamanea2cf222012-04-20 14:47:53 -04001626 struct list_head list;
1627};
1628
Trond Myklebustb20135d2015-12-31 09:28:06 -05001629struct nfs_commit_info;
Fred Isamanf453a542012-04-20 14:47:54 -04001630struct nfs_commit_data;
1631struct nfs_inode;
1632struct nfs_commit_completion_ops {
Fred Isamanf453a542012-04-20 14:47:54 -04001633 void (*completion) (struct nfs_commit_data *data);
Trond Myklebustb20135d2015-12-31 09:28:06 -05001634 void (*resched_write) (struct nfs_commit_info *, struct nfs_page *);
Fred Isamanf453a542012-04-20 14:47:54 -04001635};
1636
Fred Isamanea2cf222012-04-20 14:47:53 -04001637struct nfs_commit_info {
Dave Wysochanskife238e62016-04-01 13:45:09 -04001638 struct inode *inode; /* Needed for inode->i_lock */
Fred Isamanea2cf222012-04-20 14:47:53 -04001639 struct nfs_mds_commit_info *mds;
1640 struct pnfs_ds_commit_info *ds;
Fred Isamanb359f9d2012-04-20 14:47:55 -04001641 struct nfs_direct_req *dreq; /* O_DIRECT request */
Fred Isamanf453a542012-04-20 14:47:54 -04001642 const struct nfs_commit_completion_ops *completion_ops;
Fred Isamanea2cf222012-04-20 14:47:53 -04001643};
1644
Fred Isaman0b7c0152012-04-20 14:47:39 -04001645struct nfs_commit_data {
1646 struct rpc_task task;
1647 struct inode *inode;
NeilBrowna52458b2018-12-03 11:30:31 +11001648 const struct cred *cred;
Fred Isaman0b7c0152012-04-20 14:47:39 -04001649 struct nfs_fattr fattr;
1650 struct nfs_writeverf verf;
1651 struct list_head pages; /* Coalesced requests we wish to flush */
1652 struct list_head list; /* lists of struct nfs_write_data */
1653 struct nfs_direct_req *dreq; /* O_DIRECT request */
1654 struct nfs_commitargs args; /* argument struct */
1655 struct nfs_commitres res; /* result struct */
1656 struct nfs_open_context *context;
1657 struct pnfs_layout_segment *lseg;
1658 struct nfs_client *ds_clp; /* pNFS data server */
1659 int ds_commit_index;
Peng Tao378520b2014-08-07 10:15:02 +08001660 loff_t lwb;
Fred Isaman0b7c0152012-04-20 14:47:39 -04001661 const struct rpc_call_ops *mds_ops;
Fred Isamanf453a542012-04-20 14:47:54 -04001662 const struct nfs_commit_completion_ops *completion_ops;
Fred Isaman0b7c0152012-04-20 14:47:39 -04001663 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
Trond Myklebust37e9ed22015-12-22 12:30:24 -05001664 unsigned long flags;
Fred Isaman0b7c0152012-04-20 14:47:39 -04001665};
1666
Fred Isaman061ae2e2012-04-20 14:47:48 -04001667struct nfs_pgio_completion_ops {
Trond Myklebustdf3accb2019-02-13 10:39:39 -05001668 void (*error_cleanup)(struct list_head *head, int);
Fred Isaman584aa812012-04-20 14:47:51 -04001669 void (*init_hdr)(struct nfs_pgio_header *hdr);
Fred Isaman061ae2e2012-04-20 14:47:48 -04001670 void (*completion)(struct nfs_pgio_header *hdr);
Trond Myklebustdc602dd2015-12-31 11:44:06 -05001671 void (*reschedule_io)(struct nfs_pgio_header *hdr);
Fred Isaman061ae2e2012-04-20 14:47:48 -04001672};
1673
Bryan Schumaker34e137c2012-03-19 14:54:41 -04001674struct nfs_unlinkdata {
Bryan Schumaker34e137c2012-03-19 14:54:41 -04001675 struct nfs_removeargs args;
1676 struct nfs_removeres res;
Al Viro884be172016-04-28 23:56:31 -04001677 struct dentry *dentry;
1678 wait_queue_head_t wq;
NeilBrowna52458b2018-12-03 11:30:31 +11001679 const struct cred *cred;
Bryan Schumaker34e137c2012-03-19 14:54:41 -04001680 struct nfs_fattr dir_attr;
NeilBrown8478eaa2014-09-18 16:09:27 +10001681 long timeout;
Bryan Schumaker34e137c2012-03-19 14:54:41 -04001682};
1683
Bryan Schumakerc6bfa1a2012-03-19 14:54:42 -04001684struct nfs_renamedata {
1685 struct nfs_renameargs args;
1686 struct nfs_renameres res;
NeilBrowna52458b2018-12-03 11:30:31 +11001687 const struct cred *cred;
Bryan Schumakerc6bfa1a2012-03-19 14:54:42 -04001688 struct inode *old_dir;
1689 struct dentry *old_dentry;
1690 struct nfs_fattr old_fattr;
1691 struct inode *new_dir;
1692 struct dentry *new_dentry;
1693 struct nfs_fattr new_fattr;
Jeff Layton96f9d8c2014-03-17 07:06:54 -04001694 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
NeilBrown8478eaa2014-09-18 16:09:27 +10001695 long timeout;
Benjamin Coddington818a8db2017-06-16 11:13:00 -04001696 bool cancelled;
Bryan Schumakerc6bfa1a2012-03-19 14:54:42 -04001697};
1698
Linus Torvalds1da177e2005-04-16 15:20:36 -07001699struct nfs_access_entry;
Andy Adamson45a52a02011-03-01 01:34:08 +00001700struct nfs_client;
Trond Myklebuste0dca7a2011-03-14 18:20:01 -04001701struct rpc_timeout;
Bryan Schumakerff9099f22012-07-30 16:05:18 -04001702struct nfs_subversion;
1703struct nfs_mount_info;
Bryan Schumaker6663ee72012-06-20 15:53:46 -04001704struct nfs_client_initdata;
Bryan Schumaker1abb50882012-06-20 15:53:47 -04001705struct nfs_pageio_descriptor;
David Howellsf2aedb72019-12-10 07:31:13 -05001706struct fs_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001707
1708/*
1709 * RPC procedure vector for NFSv2/NFSv3 demuxing
1710 */
1711struct nfs_rpc_ops {
Chuck Leverc0e07cb2008-01-14 12:32:05 -05001712 u32 version; /* Protocol version */
Al Virof786aa92009-02-20 05:51:22 +00001713 const struct dentry_operations *dentry_ops;
Arjan van de Venc5ef1c42007-02-12 00:55:40 -08001714 const struct inode_operations *dir_inode_ops;
1715 const struct inode_operations *file_inode_ops;
Jeff Layton1788ea62011-11-04 13:31:21 -04001716 const struct file_operations *file_ops;
Benjamin Coddingtonb1ece732017-04-11 12:50:11 -04001717 const struct nlmclnt_operations *nlmclnt_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001718
1719 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1720 struct nfs_fsinfo *);
David Howellsf2aedb72019-12-10 07:31:13 -05001721 int (*submount) (struct fs_context *, struct nfs_server *);
1722 int (*try_get_tree) (struct fs_context *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001723 int (*getattr) (struct nfs_server *, struct nfs_fh *,
Trond Myklebusta841b542018-04-07 13:50:59 -04001724 struct nfs_fattr *, struct nfs4_label *,
1725 struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001726 int (*setattr) (struct dentry *, struct nfs_fattr *,
1727 struct iattr *);
Trond Myklebustf7b37b82020-01-14 12:06:34 -05001728 int (*lookup) (struct inode *, struct dentry *,
David Quigley1775fd32013-05-22 12:50:42 -04001729 struct nfs_fh *, struct nfs_fattr *,
1730 struct nfs4_label *);
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001731 int (*lookupp) (struct inode *, struct nfs_fh *,
1732 struct nfs_fattr *, struct nfs4_label *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001733 int (*access) (struct inode *, struct nfs_access_entry *);
1734 int (*readlink)(struct inode *, struct page *, unsigned int,
1735 unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001736 int (*create) (struct inode *, struct dentry *,
Miklos Szeredi8867fe52012-06-05 15:10:19 +02001737 struct iattr *, int);
Trond Myklebust912678d2018-03-20 16:43:15 -04001738 int (*remove) (struct inode *, struct dentry *);
Trond Myklebusted7e9ad2018-05-30 16:11:52 -04001739 void (*unlink_setup) (struct rpc_message *, struct dentry *, struct inode *);
Bryan Schumaker34e137c2012-03-19 14:54:41 -04001740 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
Trond Myklebuste4eff1a2007-07-14 15:39:58 -04001741 int (*unlink_done) (struct rpc_task *, struct inode *);
Trond Myklebustf2c2c552018-03-20 16:43:16 -04001742 void (*rename_setup) (struct rpc_message *msg,
1743 struct dentry *old_dentry,
1744 struct dentry *new_dentry);
Bryan Schumakerc6bfa1a2012-03-19 14:54:42 -04001745 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
Jeff Laytond3d41522010-09-17 17:31:57 -04001746 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
Al Virobeffb8f2016-07-20 16:34:42 -04001747 int (*link) (struct inode *, struct inode *, const struct qstr *);
Chuck Lever94a6d752006-08-22 20:06:23 -04001748 int (*symlink) (struct inode *, struct dentry *, struct page *,
1749 unsigned int, struct iattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001750 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
Al Virobeffb8f2016-07-20 16:34:42 -04001751 int (*rmdir) (struct inode *, const struct qstr *);
NeilBrown684f39b2018-12-03 11:30:30 +11001752 int (*readdir) (struct dentry *, const struct cred *,
Benjamin Coddingtona7a3b1e2017-06-20 08:33:44 -04001753 u64, struct page **, unsigned int, bool);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001754 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1755 dev_t);
1756 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1757 struct nfs_fsstat *);
1758 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1759 struct nfs_fsinfo *);
1760 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1761 struct nfs_pathconf *);
David Howellse9326dc2006-08-22 20:06:10 -04001762 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
Benjamin Coddingtona7a3b1e2017-06-20 08:33:44 -04001763 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, bool);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001764 int (*pgio_rpc_prepare)(struct rpc_task *,
1765 struct nfs_pgio_header *);
1766 void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
1767 int (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
Anna Schumakerfb91fb02018-05-04 16:22:48 -04001768 void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *,
1769 struct rpc_clnt **);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001770 int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
Anna Schumakere9ae1ee2018-05-04 16:22:49 -04001771 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *,
1772 struct rpc_clnt **);
Fred Isaman0b7c0152012-04-20 14:47:39 -04001773 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1774 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001775 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebust21162712008-05-20 19:34:39 -04001776 int (*lock_check_bounds)(const struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +00001777 void (*clear_acl_cache)(struct inode *);
Trond Myklebust7fe5c392009-03-19 15:35:50 -04001778 void (*close_context)(struct nfs_open_context *ctx, int);
Trond Myklebust2b484292010-09-17 10:56:51 -04001779 struct inode * (*open_context) (struct inode *dir,
1780 struct nfs_open_context *ctx,
1781 int open_flags,
Trond Myklebust5bc2afc2013-09-23 18:01:28 -04001782 struct iattr *iattr,
1783 int *);
Bryan Schumaker011e2a72012-06-20 15:53:43 -04001784 int (*have_delegation)(struct inode *, fmode_t);
Bryan Schumaker6663ee72012-06-20 15:53:46 -04001785 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
Trond Myklebust5c6e5b62016-06-22 14:13:12 -04001786 struct nfs_client *(*init_client) (struct nfs_client *,
1787 const struct nfs_client_initdata *);
Bryan Schumakercdb7eced2012-06-20 15:53:45 -04001788 void (*free_client) (struct nfs_client *);
Scott Mayhew62a55d02019-12-10 07:31:14 -05001789 struct nfs_server *(*create_server)(struct fs_context *);
Bryan Schumaker1179acc2012-07-30 16:05:19 -04001790 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
1791 struct nfs_fattr *, rpc_authflavor_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001792};
1793
1794/*
1795 * NFS_CALL(getattr, inode, (fattr));
1796 * into
1797 * NFS_PROTO(inode)->getattr(fattr);
1798 */
1799#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1800
1801/*
1802 * Function vectors etc. for the NFS client
1803 */
David Howells509de812006-08-22 20:06:11 -04001804extern const struct nfs_rpc_ops nfs_v2_clientops;
1805extern const struct nfs_rpc_ops nfs_v3_clientops;
1806extern const struct nfs_rpc_ops nfs_v4_clientops;
Trond Myklebusta613fa12012-01-20 13:53:56 -05001807extern const struct rpc_version nfs_version2;
1808extern const struct rpc_version nfs_version3;
1809extern const struct rpc_version nfs_version4;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001810
Trond Myklebusta613fa12012-01-20 13:53:56 -05001811extern const struct rpc_version nfsacl_version3;
1812extern const struct rpc_program nfsacl_program;
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +00001813
Linus Torvalds1da177e2005-04-16 15:20:36 -07001814#endif