]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - include/linux/nfs_xdr.h
NFS: Fix fscache invalidation in nfs_set_cache_invalid()
[mirror_ubuntu-jammy-kernel.git] / include / linux / nfs_xdr.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef _LINUX_NFS_XDR_H
3#define _LINUX_NFS_XDR_H
4
b7fa0554 5#include <linux/nfsacl.h>
5a5ea0d4 6#include <linux/sunrpc/gss_api.h>
1da177e4 7
40859d7e
CL
8/*
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
6926afd1
TM
18struct nfs4_string {
19 unsigned int len;
20 char *data;
21};
22
8b4bdcf8
TM
23struct nfs_fsid {
24 uint64_t major;
25 uint64_t minor;
1da177e4
LT
26};
27
8b4bdcf8
TM
28/*
29 * Helper for checking equality between 2 fsids.
30 */
31static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
32{
33 return a->major == b->major && a->minor == b->minor;
34}
35
88034c3d
AA
36struct nfs4_threshold {
37 __u32 bm;
38 __u32 l_type;
39 __u64 rd_sz;
40 __u64 wr_sz;
41 __u64 rd_io_sz;
42 __u64 wr_io_sz;
43};
44
1da177e4 45struct nfs_fattr {
9e6e70f8 46 unsigned int valid; /* which fields are valid */
bca79478 47 umode_t mode;
1da177e4 48 __u32 nlink;
54f834cd
EB
49 kuid_t uid;
50 kgid_t gid;
9fa8d66f 51 dev_t rdev;
1da177e4
LT
52 __u64 size;
53 union {
54 struct {
55 __u32 blocksize;
56 __u32 blocks;
57 } nfs2;
58 struct {
59 __u64 used;
60 } nfs3;
61 } du;
8b4bdcf8 62 struct nfs_fsid fsid;
1da177e4 63 __u64 fileid;
28331a46 64 __u64 mounted_on_fileid;
e86d5a02
TM
65 struct timespec64 atime;
66 struct timespec64 mtime;
67 struct timespec64 ctime;
1da177e4
LT
68 __u64 change_attr; /* NFSv4 change attribute */
69 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
1ca277d8 70 __u64 pre_size; /* pre_op_attr.size */
e86d5a02
TM
71 struct timespec64 pre_mtime; /* pre_op_attr.mtime */
72 struct timespec64 pre_ctime; /* pre_op_attr.ctime */
33801147 73 unsigned long time_start;
4704f0e2 74 unsigned long gencount;
6926afd1
TM
75 struct nfs4_string *owner_name;
76 struct nfs4_string *group_name;
88034c3d 77 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
779df6a5 78 struct nfs4_label *label;
1da177e4
LT
79};
80
9e6e70f8
TM
81#define NFS_ATTR_FATTR_TYPE (1U << 0)
82#define NFS_ATTR_FATTR_MODE (1U << 1)
83#define NFS_ATTR_FATTR_NLINK (1U << 2)
84#define NFS_ATTR_FATTR_OWNER (1U << 3)
85#define NFS_ATTR_FATTR_GROUP (1U << 4)
86#define NFS_ATTR_FATTR_RDEV (1U << 5)
87#define NFS_ATTR_FATTR_SIZE (1U << 6)
88#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
89#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
90#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
91#define NFS_ATTR_FATTR_FSID (1U << 10)
92#define NFS_ATTR_FATTR_FILEID (1U << 11)
93#define NFS_ATTR_FATTR_ATIME (1U << 12)
94#define NFS_ATTR_FATTR_MTIME (1U << 13)
95#define NFS_ATTR_FATTR_CTIME (1U << 14)
96#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
97#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
98#define NFS_ATTR_FATTR_CHANGE (1U << 17)
99#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
81934ddb
CL
100#define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
101#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
102#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
103#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
104#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
105#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
e64a4210 106#define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
9e6e70f8
TM
107
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 \
3a1556e8
TM
119 | NFS_ATTR_FATTR_CTIME \
120 | NFS_ATTR_FATTR_CHANGE)
9e6e70f8
TM
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 \
e64a4210
DQ
126 | NFS_ATTR_FATTR_SPACE_USED \
127 | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
1da177e4 128
3132e49e
JL
129/*
130 * Maximal number of supported layout drivers.
131 */
132#define NFS_MAX_LAYOUT_TYPES 8
133
1da177e4
LT
134/*
135 * Info on the file system
136 */
137struct nfs_fsinfo {
138 struct nfs_fattr *fattr; /* Post-op attributes */
139 __u32 rtmax; /* max. read transfer size */
140 __u32 rtpref; /* pref. read transfer size */
141 __u32 rtmult; /* reads should be multiple of this */
142 __u32 wtmax; /* max. write transfer size */
143 __u32 wtpref; /* pref. write transfer size */
144 __u32 wtmult; /* writes should be multiple of this */
145 __u32 dtpref; /* pref. readdir transfer size */
146 __u64 maxfilesize;
e86d5a02 147 struct timespec64 time_delta; /* server time granularity */
1da177e4 148 __u32 lease_time; /* in seconds */
ca440c38 149 __u32 nlayouttypes; /* number of layouttypes */
3132e49e 150 __u32 layouttype[NFS_MAX_LAYOUT_TYPES]; /* supported pnfs layout driver */
dae100c2 151 __u32 blksize; /* preferred pnfs io block size */
2a92ee92 152 __u32 clone_blksize; /* granularity of a CLONE operation */
b78ef845 153 __u32 xattr_support; /* User xattrs supported */
1da177e4
LT
154};
155
156struct nfs_fsstat {
157 struct nfs_fattr *fattr; /* Post-op attributes */
158 __u64 tbytes; /* total size in bytes */
159 __u64 fbytes; /* # of free bytes */
160 __u64 abytes; /* # of bytes available to user */
161 __u64 tfiles; /* # of files */
162 __u64 ffiles; /* # of free files */
163 __u64 afiles; /* # of files available to user */
164};
165
166struct nfs2_fsstat {
167 __u32 tsize; /* Server transfer size */
168 __u32 bsize; /* Filesystem block size */
169 __u32 blocks; /* No. of "bsize" blocks on filesystem */
170 __u32 bfree; /* No. of free "bsize" blocks */
171 __u32 bavail; /* No. of available "bsize" blocks */
172};
173
174struct nfs_pathconf {
175 struct nfs_fattr *fattr; /* Post-op attributes */
176 __u32 max_link; /* max # of hard links */
177 __u32 max_namelen; /* max name length */
178};
179
180struct nfs4_change_info {
181 u32 atomic;
182 u64 before;
183 u64 after;
184};
185
cee54fc9 186struct nfs_seqid;
9ff71c3a 187
557134a3
AA
188/* nfs41 sessions channel attributes */
189struct nfs4_channel_attrs {
557134a3
AA
190 u32 max_rqst_sz;
191 u32 max_resp_sz;
192 u32 max_resp_sz_cached;
193 u32 max_ops;
194 u32 max_reqs;
195};
196
76e697ba 197struct nfs4_slot;
9ff71c3a 198struct nfs4_sequence_args {
2b2fa717 199 struct nfs4_slot *sa_slot;
8fe72bac
TM
200 u8 sa_cache_this : 1,
201 sa_privileged : 1;
9ff71c3a
BH
202};
203
204struct nfs4_sequence_res {
dfb4f309 205 struct nfs4_slot *sr_slot; /* slot used to send request */
8e63b6a8 206 unsigned long sr_timestamp;
fbcd4abc 207 int sr_status; /* sequence operation status */
0629e370 208 u32 sr_status_flags;
da0507b7 209 u32 sr_highest_slotid;
464ee9f9 210 u32 sr_target_highest_slotid;
9ff71c3a
BH
211};
212
2050f0cc
AA
213struct nfs4_get_lease_time_args {
214 struct nfs4_sequence_args la_seq_args;
215};
216
217struct nfs4_get_lease_time_res {
2050f0cc 218 struct nfs4_sequence_res lr_seq_res;
62ae082d 219 struct nfs_fsinfo *lr_fsinfo;
2050f0cc
AA
220};
221
f8c3cf9d
TM
222struct xdr_stream;
223struct nfs4_xdr_opaque_data;
224
225struct nfs4_xdr_opaque_ops {
226 void (*encode)(struct xdr_stream *, const void *args,
227 const struct nfs4_xdr_opaque_data *);
228 void (*free)(struct nfs4_xdr_opaque_data *);
229};
230
231struct nfs4_xdr_opaque_data {
232 const struct nfs4_xdr_opaque_ops *ops;
233 void *data;
234};
235
b1f69b75
AA
236#define PNFS_LAYOUT_MAXSIZE 4096
237
238struct nfs4_layoutdriver_data {
35124a09
WAA
239 struct page **pages;
240 __u32 pglen;
b1f69b75 241 __u32 len;
b1f69b75
AA
242};
243
244struct pnfs_layout_range {
245 u32 iomode;
246 u64 offset;
247 u64 length;
248};
249
250struct nfs4_layoutget_args {
62ae082d 251 struct nfs4_sequence_args seq_args;
b1f69b75
AA
252 __u32 type;
253 struct pnfs_layout_range range;
254 __u64 minlength;
255 __u32 maxcount;
256 struct inode *inode;
257 struct nfs_open_context *ctx;
cf7d63f1 258 nfs4_stateid stateid;
35124a09 259 struct nfs4_layoutdriver_data layout;
b1f69b75
AA
260};
261
262struct nfs4_layoutget_res {
62ae082d 263 struct nfs4_sequence_res seq_res;
808ba32a 264 int status;
b1f69b75
AA
265 __u32 return_on_close;
266 struct pnfs_layout_range range;
267 __u32 type;
268 nfs4_stateid stateid;
35124a09 269 struct nfs4_layoutdriver_data *layoutp;
b1f69b75
AA
270};
271
272struct nfs4_layoutget {
273 struct nfs4_layoutget_args args;
274 struct nfs4_layoutget_res res;
a52458b4 275 const struct cred *cred;
a75b9df9 276 gfp_t gfp_flags;
b1f69b75
AA
277};
278
279struct nfs4_getdeviceinfo_args {
b1f69b75 280 struct nfs4_sequence_args seq_args;
62ae082d 281 struct pnfs_device *pdev;
4e590803 282 __u32 notify_types;
b1f69b75
AA
283};
284
285struct nfs4_getdeviceinfo_res {
b1f69b75 286 struct nfs4_sequence_res seq_res;
62ae082d 287 struct pnfs_device *pdev;
4e590803 288 __u32 notification;
b1f69b75
AA
289};
290
863a3c6c 291struct nfs4_layoutcommit_args {
62ae082d 292 struct nfs4_sequence_args seq_args;
863a3c6c
AA
293 nfs4_stateid stateid;
294 __u64 lastbytewritten;
295 struct inode *inode;
296 const u32 *bitmask;
5f919c9f
CH
297 size_t layoutupdate_len;
298 struct page *layoutupdate_page;
299 struct page **layoutupdate_pages;
c8975706 300 __be32 *start_p;
863a3c6c
AA
301};
302
303struct nfs4_layoutcommit_res {
62ae082d 304 struct nfs4_sequence_res seq_res;
863a3c6c
AA
305 struct nfs_fattr *fattr;
306 const struct nfs_server *server;
db29c089 307 int status;
863a3c6c
AA
308};
309
310struct nfs4_layoutcommit_data {
311 struct rpc_task task;
312 struct nfs_fattr fattr;
a9bae566 313 struct list_head lseg_list;
a52458b4 314 const struct cred *cred;
472e2594 315 struct inode *inode;
863a3c6c
AA
316 struct nfs4_layoutcommit_args args;
317 struct nfs4_layoutcommit_res res;
318};
319
cbe82603 320struct nfs4_layoutreturn_args {
62ae082d 321 struct nfs4_sequence_args seq_args;
a56aaa02 322 struct pnfs_layout_hdr *layout;
cbe82603 323 struct inode *inode;
15eb67c1 324 struct pnfs_layout_range range;
cbe82603 325 nfs4_stateid stateid;
a56aaa02 326 __u32 layout_type;
4d796d75 327 struct nfs4_xdr_opaque_data *ld_private;
cbe82603
BH
328};
329
330struct nfs4_layoutreturn_res {
331 struct nfs4_sequence_res seq_res;
332 u32 lrs_present;
333 nfs4_stateid stateid;
334};
335
336struct nfs4_layoutreturn {
337 struct nfs4_layoutreturn_args args;
338 struct nfs4_layoutreturn_res res;
a52458b4 339 const struct cred *cred;
cbe82603 340 struct nfs_client *clp;
5a0ec8ac 341 struct inode *inode;
cbe82603 342 int rpc_status;
4d796d75 343 struct nfs4_xdr_opaque_data ld_private;
cbe82603
BH
344};
345
be3a5d23
TM
346#define PNFS_LAYOUTSTATS_MAXSIZE 256
347
348struct nfs42_layoutstat_args;
349struct nfs42_layoutstat_devinfo;
350typedef void (*layoutstats_encode_t)(struct xdr_stream *,
351 struct nfs42_layoutstat_args *,
352 struct nfs42_layoutstat_devinfo *);
353
354/* Per file per deviceid layoutstats */
355struct nfs42_layoutstat_devinfo {
356 struct nfs4_deviceid dev_id;
357 __u64 offset;
358 __u64 length;
359 __u64 read_count;
360 __u64 read_bytes;
361 __u64 write_count;
362 __u64 write_bytes;
363 __u32 layout_type;
422c93c8 364 struct nfs4_xdr_opaque_data ld_private;
be3a5d23
TM
365};
366
367struct nfs42_layoutstat_args {
368 struct nfs4_sequence_args seq_args;
369 struct nfs_fh *fh;
370 struct inode *inode;
371 nfs4_stateid stateid;
372 int num_dev;
373 struct nfs42_layoutstat_devinfo *devinfo;
374};
375
376struct nfs42_layoutstat_res {
377 struct nfs4_sequence_res seq_res;
378 int num_dev;
379 int rpc_status;
380};
381
382struct nfs42_layoutstat_data {
383 struct inode *inode;
384 struct nfs42_layoutstat_args args;
385 struct nfs42_layoutstat_res res;
3eb86093
TM
386};
387
388struct nfs42_device_error {
389 struct nfs4_deviceid dev_id;
390 int status;
391 enum nfs_opnum4 opnum;
392};
393
394struct nfs42_layout_error {
395 __u64 offset;
396 __u64 length;
397 nfs4_stateid stateid;
398 struct nfs42_device_error errors[1];
399};
400
401#define NFS42_LAYOUTERROR_MAX 5
402
403struct nfs42_layouterror_args {
404 struct nfs4_sequence_args seq_args;
405 struct inode *inode;
406 unsigned int num_errors;
407 struct nfs42_layout_error errors[NFS42_LAYOUTERROR_MAX];
408};
409
410struct nfs42_layouterror_res {
411 struct nfs4_sequence_res seq_res;
412 unsigned int num_errors;
413 int rpc_status;
414};
415
416struct nfs42_layouterror_data {
417 struct nfs42_layouterror_args args;
418 struct nfs42_layouterror_res res;
419 struct inode *inode;
420 struct pnfs_layout_segment *lseg;
be3a5d23
TM
421};
422
36022770
PT
423struct nfs42_clone_args {
424 struct nfs4_sequence_args seq_args;
425 struct nfs_fh *src_fh;
426 struct nfs_fh *dst_fh;
427 nfs4_stateid src_stateid;
428 nfs4_stateid dst_stateid;
429 __u64 src_offset;
430 __u64 dst_offset;
431 __u64 count;
432 const u32 *dst_bitmask;
433};
434
435struct nfs42_clone_res {
436 struct nfs4_sequence_res seq_res;
437 unsigned int rpc_status;
438 struct nfs_fattr *dst_fattr;
439 const struct nfs_server *server;
440};
441
95b72eb0
TM
442struct stateowner_id {
443 __u64 create_time;
444 __u32 uniquifier;
445};
446
1da177e4
LT
447/*
448 * Arguments to the open call.
449 */
450struct nfs_openargs {
62ae082d 451 struct nfs4_sequence_args seq_args;
1da177e4 452 const struct nfs_fh * fh;
cee54fc9 453 struct nfs_seqid * seqid;
1da177e4 454 int open_flags;
dc0b027d 455 fmode_t fmode;
6ae37339 456 u32 share_access;
6168f62c 457 u32 access;
1da177e4 458 __u64 clientid;
95b72eb0 459 struct stateowner_id id;
1da177e4 460 union {
d77d76ff 461 struct {
5334c5bd 462 struct iattr * attrs; /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */
d77d76ff
TM
463 nfs4_verifier verifier; /* EXCLUSIVE */
464 };
1da177e4 465 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
bd7bf9d5 466 fmode_t delegation_type; /* CLAIM_PREVIOUS */
1da177e4
LT
467 } u;
468 const struct qstr * name;
469 const struct nfs_server *server; /* Needed for ID mapping */
470 const u32 * bitmask;
1549210f 471 const u32 * open_bitmap;
2a606188 472 enum open_claim_type4 claim;
549b19cc 473 enum createmode4 createmode;
e058f70b 474 const struct nfs4_label *label;
dff25ddb 475 umode_t umask;
56f487f8 476 struct nfs4_layoutget_args *lg_args;
1da177e4
LT
477};
478
479struct nfs_openres {
62ae082d 480 struct nfs4_sequence_res seq_res;
1da177e4
LT
481 nfs4_stateid stateid;
482 struct nfs_fh fh;
483 struct nfs4_change_info cinfo;
484 __u32 rflags;
485 struct nfs_fattr * f_attr;
e058f70b 486 struct nfs4_label *f_label;
c1d51931 487 struct nfs_seqid * seqid;
1da177e4 488 const struct nfs_server *server;
bd7bf9d5 489 fmode_t delegation_type;
1da177e4 490 nfs4_stateid delegation;
7d160a6c 491 unsigned long pagemod_limit;
1da177e4 492 __u32 do_recall;
aa53ed54 493 __u32 attrset[NFS4_BITMAP_SIZE];
6926afd1
TM
494 struct nfs4_string *owner;
495 struct nfs4_string *group_owner;
ae2bb032 496 __u32 access_request;
6168f62c
WAA
497 __u32 access_supported;
498 __u32 access_result;
56f487f8 499 struct nfs4_layoutget_res *lg_res;
1da177e4
LT
500};
501
502/*
503 * Arguments to the open_confirm call.
504 */
505struct nfs_open_confirmargs {
17ead6c8 506 struct nfs4_sequence_args seq_args;
1da177e4 507 const struct nfs_fh * fh;
cdd4e68b 508 nfs4_stateid * stateid;
cee54fc9 509 struct nfs_seqid * seqid;
1da177e4
LT
510};
511
512struct nfs_open_confirmres {
17ead6c8 513 struct nfs4_sequence_res seq_res;
1da177e4 514 nfs4_stateid stateid;
c1d51931 515 struct nfs_seqid * seqid;
1da177e4
LT
516};
517
518/*
519 * Arguments to the close call.
520 */
521struct nfs_closeargs {
62ae082d 522 struct nfs4_sequence_args seq_args;
1da177e4 523 struct nfs_fh * fh;
566fcec6 524 nfs4_stateid stateid;
cee54fc9 525 struct nfs_seqid * seqid;
dc0b027d 526 fmode_t fmode;
6ae37339 527 u32 share_access;
76bd5c01 528 u32 * bitmask;
cf805165 529 struct nfs4_layoutreturn_args *lr_args;
1da177e4
LT
530};
531
532struct nfs_closeres {
62ae082d 533 struct nfs4_sequence_res seq_res;
1da177e4 534 nfs4_stateid stateid;
516a6af6 535 struct nfs_fattr * fattr;
c1d51931 536 struct nfs_seqid * seqid;
516a6af6 537 const struct nfs_server *server;
cf805165
TM
538 struct nfs4_layoutreturn_res *lr_res;
539 int lr_ret;
1da177e4
LT
540};
541/*
542 * * Arguments to the lock,lockt, and locku call.
543 * */
544struct nfs_lowner {
911d1aaf 545 __u64 clientid;
9f958ab8 546 __u64 id;
d035c36c 547 dev_t s_dev;
1da177e4
LT
548};
549
911d1aaf 550struct nfs_lock_args {
62ae082d 551 struct nfs4_sequence_args seq_args;
911d1aaf
TM
552 struct nfs_fh * fh;
553 struct file_lock * fl;
cee54fc9 554 struct nfs_seqid * lock_seqid;
425c1d4e 555 nfs4_stateid lock_stateid;
06735b34 556 struct nfs_seqid * open_seqid;
425c1d4e 557 nfs4_stateid open_stateid;
911d1aaf
TM
558 struct nfs_lowner lock_owner;
559 unsigned char block : 1;
560 unsigned char reclaim : 1;
c69899a1 561 unsigned char new_lock : 1;
911d1aaf
TM
562 unsigned char new_lock_owner : 1;
563};
564
565struct nfs_lock_res {
62ae082d 566 struct nfs4_sequence_res seq_res;
c1d51931
TM
567 nfs4_stateid stateid;
568 struct nfs_seqid * lock_seqid;
569 struct nfs_seqid * open_seqid;
1da177e4
LT
570};
571
911d1aaf 572struct nfs_locku_args {
62ae082d 573 struct nfs4_sequence_args seq_args;
911d1aaf
TM
574 struct nfs_fh * fh;
575 struct file_lock * fl;
cee54fc9 576 struct nfs_seqid * seqid;
425c1d4e 577 nfs4_stateid stateid;
1da177e4
LT
578};
579
911d1aaf 580struct nfs_locku_res {
62ae082d 581 struct nfs4_sequence_res seq_res;
c1d51931
TM
582 nfs4_stateid stateid;
583 struct nfs_seqid * seqid;
1da177e4
LT
584};
585
911d1aaf 586struct nfs_lockt_args {
62ae082d 587 struct nfs4_sequence_args seq_args;
911d1aaf
TM
588 struct nfs_fh * fh;
589 struct file_lock * fl;
590 struct nfs_lowner lock_owner;
1da177e4
LT
591};
592
911d1aaf 593struct nfs_lockt_res {
9ff71c3a 594 struct nfs4_sequence_res seq_res;
62ae082d 595 struct file_lock * denied; /* LOCK, LOCKT failed */
1da177e4
LT
596};
597
d3c7b7cc 598struct nfs_release_lockowner_args {
b7e63a10 599 struct nfs4_sequence_args seq_args;
d3c7b7cc
TM
600 struct nfs_lowner lock_owner;
601};
602
b7e63a10
TM
603struct nfs_release_lockowner_res {
604 struct nfs4_sequence_res seq_res;
605};
606
1da177e4 607struct nfs4_delegreturnargs {
62ae082d 608 struct nfs4_sequence_args seq_args;
1da177e4
LT
609 const struct nfs_fh *fhandle;
610 const nfs4_stateid *stateid;
76bd5c01 611 u32 * bitmask;
586f1c39 612 struct nfs4_layoutreturn_args *lr_args;
fa178f29
TM
613};
614
615struct nfs4_delegreturnres {
62ae082d 616 struct nfs4_sequence_res seq_res;
fa178f29 617 struct nfs_fattr * fattr;
516285eb 618 struct nfs_server *server;
586f1c39
TM
619 struct nfs4_layoutreturn_res *lr_res;
620 int lr_ret;
1da177e4
LT
621};
622
1da177e4
LT
623/*
624 * Arguments to the write call.
625 */
2f2c63bc
TM
626struct nfs_write_verifier {
627 char data[8];
628};
629
1da177e4 630struct nfs_writeverf {
2f2c63bc 631 struct nfs_write_verifier verifier;
1da177e4 632 enum nfs3_stable_how committed;
1da177e4
LT
633};
634
3c6b899c
AS
635/*
636 * Arguments shared by the read and write call.
637 */
638struct nfs_pgio_args {
639 struct nfs4_sequence_args seq_args;
640 struct nfs_fh * fh;
641 struct nfs_open_context *context;
642 struct nfs_lock_context *lock_context;
643 nfs4_stateid stateid;
644 __u64 offset;
645 __u32 count;
646 unsigned int pgbase;
647 struct page ** pages;
28d52235
TM
648 union {
649 unsigned int replen; /* used by read */
650 struct {
76bd5c01 651 u32 * bitmask; /* used by write */
28d52235
TM
652 enum nfs3_stable_how stable; /* used by write */
653 };
654 };
3c6b899c
AS
655};
656
9137bdf3
AS
657struct nfs_pgio_res {
658 struct nfs4_sequence_res seq_res;
659 struct nfs_fattr * fattr;
c5675526 660 __u64 count;
aabff4dd 661 __u32 op_status;
28d52235
TM
662 union {
663 struct {
664 unsigned int replen; /* used by read */
665 int eof; /* used by read */
666 };
667 struct {
668 struct nfs_writeverf * verf; /* used by write */
669 const struct nfs_server *server; /* used by write */
670 };
671 };
9137bdf3
AS
672};
673
0b7c0153
FI
674/*
675 * Arguments to the commit call.
676 */
677struct nfs_commitargs {
62ae082d 678 struct nfs4_sequence_args seq_args;
0b7c0153
FI
679 struct nfs_fh *fh;
680 __u64 offset;
681 __u32 count;
682 const u32 *bitmask;
0b7c0153
FI
683};
684
685struct nfs_commitres {
62ae082d 686 struct nfs4_sequence_res seq_res;
aabff4dd 687 __u32 op_status;
0b7c0153
FI
688 struct nfs_fattr *fattr;
689 struct nfs_writeverf *verf;
690 const struct nfs_server *server;
0b7c0153
FI
691};
692
4fdc17b2
TM
693/*
694 * Common arguments to the unlink call
695 */
696struct nfs_removeargs {
62ae082d 697 struct nfs4_sequence_args seq_args;
4fdc17b2
TM
698 const struct nfs_fh *fh;
699 struct qstr name;
4fdc17b2
TM
700};
701
702struct nfs_removeres {
62ae082d 703 struct nfs4_sequence_res seq_res;
516285eb 704 struct nfs_server *server;
d346890b 705 struct nfs_fattr *dir_attr;
4fdc17b2 706 struct nfs4_change_info cinfo;
4fdc17b2
TM
707};
708
920769f0
JL
709/*
710 * Common arguments to the rename call
711 */
712struct nfs_renameargs {
62ae082d 713 struct nfs4_sequence_args seq_args;
920769f0
JL
714 const struct nfs_fh *old_dir;
715 const struct nfs_fh *new_dir;
716 const struct qstr *old_name;
717 const struct qstr *new_name;
920769f0
JL
718};
719
e8582a8b 720struct nfs_renameres {
62ae082d 721 struct nfs4_sequence_res seq_res;
516285eb 722 struct nfs_server *server;
e8582a8b
JL
723 struct nfs4_change_info old_cinfo;
724 struct nfs_fattr *old_fattr;
725 struct nfs4_change_info new_cinfo;
726 struct nfs_fattr *new_fattr;
e8582a8b
JL
727};
728
a3f73c27 729/* parsed sec= options */
4d4b69dd 730#define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
a3f73c27
WAA
731struct nfs_auth_info {
732 unsigned int flavor_len;
4d4b69dd 733 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS];
a3f73c27
WAA
734};
735
1da177e4
LT
736/*
737 * Argument struct for decode_entry function
738 */
739struct nfs_entry {
740 __u64 ino;
741 __u64 cookie,
742 prev_cookie;
743 const char * name;
744 unsigned int len;
745 int eof;
746 struct nfs_fh * fh;
747 struct nfs_fattr * fattr;
e058f70b 748 struct nfs4_label *label;
0b26a0bf 749 unsigned char d_type;
573c4e1e 750 struct nfs_server * server;
1da177e4
LT
751};
752
82e22a5e
TM
753struct nfs_readdir_arg {
754 struct dentry *dentry;
755 const struct cred *cred;
756 __be32 *verf;
757 u64 cookie;
758 struct page **pages;
759 unsigned int page_len;
760 bool plus;
761};
762
763struct nfs_readdir_res {
764 __be32 *verf;
765};
766
1da177e4
LT
767/*
768 * The following types are for NFSv2 only.
769 */
770struct nfs_sattrargs {
771 struct nfs_fh * fh;
772 struct iattr * sattr;
773};
774
775struct nfs_diropargs {
776 struct nfs_fh * fh;
777 const char * name;
778 unsigned int len;
779};
780
781struct nfs_createargs {
782 struct nfs_fh * fh;
783 const char * name;
784 unsigned int len;
785 struct iattr * sattr;
786};
787
1da177e4 788struct nfs_setattrargs {
62ae082d 789 struct nfs4_sequence_args seq_args;
1da177e4
LT
790 struct nfs_fh * fh;
791 nfs4_stateid stateid;
792 struct iattr * iap;
793 const struct nfs_server * server; /* Needed for name mapping */
794 const u32 * bitmask;
e058f70b 795 const struct nfs4_label *label;
1da177e4
LT
796};
797
23ec6965 798struct nfs_setaclargs {
62ae082d 799 struct nfs4_sequence_args seq_args;
23ec6965
BF
800 struct nfs_fh * fh;
801 size_t acl_len;
23ec6965
BF
802 struct page ** acl_pages;
803};
804
73c403a9
BH
805struct nfs_setaclres {
806 struct nfs4_sequence_res seq_res;
807};
808
029d105e 809struct nfs_getaclargs {
62ae082d 810 struct nfs4_sequence_args seq_args;
029d105e
BF
811 struct nfs_fh * fh;
812 size_t acl_len;
029d105e
BF
813 struct page ** acl_pages;
814};
815
bf118a34 816/* getxattr ACL interface flags */
1f1ea6c2 817#define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
663c79b3 818struct nfs_getaclres {
62ae082d 819 struct nfs4_sequence_res seq_res;
663c79b3 820 size_t acl_len;
bf118a34
AA
821 size_t acl_data_offset;
822 int acl_flags;
331818f1 823 struct page * acl_scratch;
663c79b3
BH
824};
825
1da177e4 826struct nfs_setattrres {
62ae082d 827 struct nfs4_sequence_res seq_res;
1da177e4 828 struct nfs_fattr * fattr;
e058f70b 829 struct nfs4_label *label;
1da177e4
LT
830 const struct nfs_server * server;
831};
832
833struct nfs_linkargs {
834 struct nfs_fh * fromfh;
835 struct nfs_fh * tofh;
836 const char * toname;
837 unsigned int tolen;
838};
839
840struct nfs_symlinkargs {
841 struct nfs_fh * fromfh;
842 const char * fromname;
843 unsigned int fromlen;
94a6d753
CL
844 struct page ** pages;
845 unsigned int pathlen;
1da177e4
LT
846 struct iattr * sattr;
847};
848
849struct nfs_readdirargs {
850 struct nfs_fh * fh;
851 __u32 cookie;
852 unsigned int count;
853 struct page ** pages;
854};
855
b7fa0554
AG
856struct nfs3_getaclargs {
857 struct nfs_fh * fh;
858 int mask;
859 struct page ** pages;
860};
861
862struct nfs3_setaclargs {
863 struct inode * inode;
864 int mask;
865 struct posix_acl * acl_access;
866 struct posix_acl * acl_default;
ae46141f
TM
867 size_t len;
868 unsigned int npages;
b7fa0554
AG
869 struct page ** pages;
870};
871
1da177e4
LT
872struct nfs_diropok {
873 struct nfs_fh * fh;
874 struct nfs_fattr * fattr;
875};
876
877struct nfs_readlinkargs {
878 struct nfs_fh * fh;
879 unsigned int pgbase;
880 unsigned int pglen;
881 struct page ** pages;
882};
883
884struct nfs3_sattrargs {
885 struct nfs_fh * fh;
886 struct iattr * sattr;
887 unsigned int guard;
6430b323 888 struct timespec64 guardtime;
1da177e4
LT
889};
890
891struct nfs3_diropargs {
892 struct nfs_fh * fh;
893 const char * name;
894 unsigned int len;
895};
896
897struct nfs3_accessargs {
898 struct nfs_fh * fh;
899 __u32 access;
900};
901
902struct nfs3_createargs {
903 struct nfs_fh * fh;
904 const char * name;
905 unsigned int len;
906 struct iattr * sattr;
907 enum nfs3_createmode createmode;
bc4785cd 908 __be32 verifier[2];
1da177e4
LT
909};
910
911struct nfs3_mkdirargs {
912 struct nfs_fh * fh;
913 const char * name;
914 unsigned int len;
915 struct iattr * sattr;
916};
917
918struct nfs3_symlinkargs {
919 struct nfs_fh * fromfh;
920 const char * fromname;
921 unsigned int fromlen;
94a6d753
CL
922 struct page ** pages;
923 unsigned int pathlen;
1da177e4
LT
924 struct iattr * sattr;
925};
926
927struct nfs3_mknodargs {
928 struct nfs_fh * fh;
929 const char * name;
930 unsigned int len;
931 enum nfs3_ftype type;
932 struct iattr * sattr;
933 dev_t rdev;
934};
935
1da177e4
LT
936struct nfs3_linkargs {
937 struct nfs_fh * fromfh;
938 struct nfs_fh * tofh;
939 const char * toname;
940 unsigned int tolen;
941};
942
943struct nfs3_readdirargs {
944 struct nfs_fh * fh;
945 __u64 cookie;
bc4785cd 946 __be32 verf[2];
a7a3b1e9 947 bool plus;
1da177e4
LT
948 unsigned int count;
949 struct page ** pages;
950};
951
952struct nfs3_diropres {
953 struct nfs_fattr * dir_attr;
954 struct nfs_fh * fh;
955 struct nfs_fattr * fattr;
956};
957
958struct nfs3_accessres {
959 struct nfs_fattr * fattr;
960 __u32 access;
961};
962
963struct nfs3_readlinkargs {
964 struct nfs_fh * fh;
965 unsigned int pgbase;
966 unsigned int pglen;
967 struct page ** pages;
968};
969
1da177e4
LT
970struct nfs3_linkres {
971 struct nfs_fattr * dir_attr;
972 struct nfs_fattr * fattr;
973};
974
975struct nfs3_readdirres {
976 struct nfs_fattr * dir_attr;
bc4785cd 977 __be32 * verf;
a7a3b1e9 978 bool plus;
1da177e4
LT
979};
980
b7fa0554
AG
981struct nfs3_getaclres {
982 struct nfs_fattr * fattr;
983 int mask;
984 unsigned int acl_access_count;
985 unsigned int acl_default_count;
986 struct posix_acl * acl_access;
987 struct posix_acl * acl_default;
988};
989
89d77c8f 990#if IS_ENABLED(CONFIG_NFS_V4)
1da177e4
LT
991
992typedef u64 clientid4;
993
994struct nfs4_accessargs {
62ae082d 995 struct nfs4_sequence_args seq_args;
1da177e4 996 const struct nfs_fh * fh;
76b32999 997 const u32 * bitmask;
1da177e4
LT
998 u32 access;
999};
1000
1001struct nfs4_accessres {
62ae082d 1002 struct nfs4_sequence_res seq_res;
76b32999
TM
1003 const struct nfs_server * server;
1004 struct nfs_fattr * fattr;
1da177e4
LT
1005 u32 supported;
1006 u32 access;
1007};
1008
1009struct nfs4_create_arg {
62ae082d 1010 struct nfs4_sequence_args seq_args;
1da177e4
LT
1011 u32 ftype;
1012 union {
94a6d753
CL
1013 struct {
1014 struct page ** pages;
1015 unsigned int len;
1016 } symlink; /* NF4LNK */
1da177e4
LT
1017 struct {
1018 u32 specdata1;
1019 u32 specdata2;
1020 } device; /* NF4BLK, NF4CHR */
1021 } u;
1022 const struct qstr * name;
1023 const struct nfs_server * server;
1024 const struct iattr * attrs;
1025 const struct nfs_fh * dir_fh;
1026 const u32 * bitmask;
e058f70b 1027 const struct nfs4_label *label;
dff25ddb 1028 umode_t umask;
1da177e4
LT
1029};
1030
1031struct nfs4_create_res {
62ae082d 1032 struct nfs4_sequence_res seq_res;
1da177e4
LT
1033 const struct nfs_server * server;
1034 struct nfs_fh * fh;
1035 struct nfs_fattr * fattr;
e058f70b 1036 struct nfs4_label *label;
1da177e4
LT
1037 struct nfs4_change_info dir_cinfo;
1038};
1039
1040struct nfs4_fsinfo_arg {
62ae082d 1041 struct nfs4_sequence_args seq_args;
1da177e4
LT
1042 const struct nfs_fh * fh;
1043 const u32 * bitmask;
1044};
1045
3dda5e43 1046struct nfs4_fsinfo_res {
3dda5e43 1047 struct nfs4_sequence_res seq_res;
62ae082d 1048 struct nfs_fsinfo *fsinfo;
3dda5e43
BH
1049};
1050
1da177e4 1051struct nfs4_getattr_arg {
62ae082d 1052 struct nfs4_sequence_args seq_args;
1da177e4
LT
1053 const struct nfs_fh * fh;
1054 const u32 * bitmask;
1055};
1056
1057struct nfs4_getattr_res {
62ae082d 1058 struct nfs4_sequence_res seq_res;
1da177e4
LT
1059 const struct nfs_server * server;
1060 struct nfs_fattr * fattr;
e058f70b 1061 struct nfs4_label *label;
1da177e4
LT
1062};
1063
1064struct nfs4_link_arg {
62ae082d 1065 struct nfs4_sequence_args seq_args;
1da177e4
LT
1066 const struct nfs_fh * fh;
1067 const struct nfs_fh * dir_fh;
1068 const struct qstr * name;
91ba2eee
TM
1069 const u32 * bitmask;
1070};
1071
1072struct nfs4_link_res {
62ae082d 1073 struct nfs4_sequence_res seq_res;
91ba2eee
TM
1074 const struct nfs_server * server;
1075 struct nfs_fattr * fattr;
e058f70b 1076 struct nfs4_label *label;
91ba2eee
TM
1077 struct nfs4_change_info cinfo;
1078 struct nfs_fattr * dir_attr;
1da177e4
LT
1079};
1080
1081struct nfs4_lookup_arg {
62ae082d 1082 struct nfs4_sequence_args seq_args;
1da177e4
LT
1083 const struct nfs_fh * dir_fh;
1084 const struct qstr * name;
1085 const u32 * bitmask;
1086};
1087
1088struct nfs4_lookup_res {
62ae082d 1089 struct nfs4_sequence_res seq_res;
1da177e4
LT
1090 const struct nfs_server * server;
1091 struct nfs_fattr * fattr;
1092 struct nfs_fh * fh;
e058f70b 1093 struct nfs4_label *label;
1da177e4
LT
1094};
1095
5b5faaf6
JL
1096struct nfs4_lookupp_arg {
1097 struct nfs4_sequence_args seq_args;
1098 const struct nfs_fh *fh;
1099 const u32 *bitmask;
1100};
1101
1102struct nfs4_lookupp_res {
1103 struct nfs4_sequence_res seq_res;
1104 const struct nfs_server *server;
1105 struct nfs_fattr *fattr;
1106 struct nfs_fh *fh;
1107 struct nfs4_label *label;
1108};
1109
1da177e4 1110struct nfs4_lookup_root_arg {
9ff71c3a 1111 struct nfs4_sequence_args seq_args;
62ae082d 1112 const u32 * bitmask;
1da177e4
LT
1113};
1114
1115struct nfs4_pathconf_arg {
62ae082d 1116 struct nfs4_sequence_args seq_args;
1da177e4
LT
1117 const struct nfs_fh * fh;
1118 const u32 * bitmask;
1119};
1120
d45b2989 1121struct nfs4_pathconf_res {
d45b2989 1122 struct nfs4_sequence_res seq_res;
62ae082d 1123 struct nfs_pathconf *pathconf;
d45b2989
BH
1124};
1125
1da177e4 1126struct nfs4_readdir_arg {
62ae082d 1127 struct nfs4_sequence_args seq_args;
1da177e4
LT
1128 const struct nfs_fh * fh;
1129 u64 cookie;
1130 nfs4_verifier verifier;
1131 u32 count;
1132 struct page ** pages; /* zero-copy data */
1133 unsigned int pgbase; /* zero-copy data */
1134 const u32 * bitmask;
a7a3b1e9 1135 bool plus;
1da177e4
LT
1136};
1137
1138struct nfs4_readdir_res {
62ae082d 1139 struct nfs4_sequence_res seq_res;
1da177e4
LT
1140 nfs4_verifier verifier;
1141 unsigned int pgbase;
1142};
1143
1144struct nfs4_readlink {
62ae082d 1145 struct nfs4_sequence_args seq_args;
1da177e4
LT
1146 const struct nfs_fh * fh;
1147 unsigned int pgbase;
1148 unsigned int pglen; /* zero-copy data */
1149 struct page ** pages; /* zero-copy data */
1150};
1151
f50c7000
BH
1152struct nfs4_readlink_res {
1153 struct nfs4_sequence_res seq_res;
1154};
1155
1da177e4 1156struct nfs4_setclientid {
cc38bac3 1157 const nfs4_verifier * sc_verifier;
cc38bac3 1158 u32 sc_prog;
1da177e4 1159 unsigned int sc_netid_len;
d1ce02e1 1160 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
1da177e4 1161 unsigned int sc_uaddr_len;
d1ce02e1 1162 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
3a6bb738 1163 struct nfs_client *sc_clnt;
f11b2a1c 1164 struct rpc_cred *sc_cred;
1da177e4
LT
1165};
1166
bb8b27e5
TM
1167struct nfs4_setclientid_res {
1168 u64 clientid;
1169 nfs4_verifier confirm;
1170};
1171
1da177e4 1172struct nfs4_statfs_arg {
62ae082d 1173 struct nfs4_sequence_args seq_args;
1da177e4
LT
1174 const struct nfs_fh * fh;
1175 const u32 * bitmask;
1176};
1177
24ad148a 1178struct nfs4_statfs_res {
24ad148a 1179 struct nfs4_sequence_res seq_res;
62ae082d 1180 struct nfs_fsstat *fsstat;
24ad148a
BH
1181};
1182
43652ad5 1183struct nfs4_server_caps_arg {
43652ad5 1184 struct nfs4_sequence_args seq_args;
62ae082d 1185 struct nfs_fh *fhandle;
8c61282f 1186 const u32 * bitmask;
43652ad5
BH
1187};
1188
1da177e4 1189struct nfs4_server_caps_res {
62ae082d 1190 struct nfs4_sequence_res seq_res;
dae100c2 1191 u32 attr_bitmask[3];
8c61282f 1192 u32 exclcreat_bitmask[3];
1da177e4
LT
1193 u32 acl_bitmask;
1194 u32 has_links;
1195 u32 has_symlinks;
264e6351 1196 u32 fh_expire_type;
1da177e4
LT
1197};
1198
7aaa0b3b
MN
1199#define NFS4_PATHNAME_MAXCOMPONENTS 512
1200struct nfs4_pathname {
1201 unsigned int ncomponents;
1202 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
1203};
1204
1205#define NFS4_FS_LOCATION_MAXSERVERS 10
1206struct nfs4_fs_location {
1207 unsigned int nservers;
1208 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
1209 struct nfs4_pathname rootpath;
1210};
1211
1212#define NFS4_FS_LOCATIONS_MAXENTRIES 10
1213struct nfs4_fs_locations {
683b57b4
TM
1214 struct nfs_fattr fattr;
1215 const struct nfs_server *server;
7aaa0b3b 1216 struct nfs4_pathname fs_path;
683b57b4 1217 int nlocations;
7aaa0b3b 1218 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
683b57b4
TM
1219};
1220
1221struct nfs4_fs_locations_arg {
62ae082d 1222 struct nfs4_sequence_args seq_args;
683b57b4 1223 const struct nfs_fh *dir_fh;
b03d735b 1224 const struct nfs_fh *fh;
683b57b4
TM
1225 const struct qstr *name;
1226 struct page *page;
1227 const u32 *bitmask;
b03d735b
CL
1228 clientid4 clientid;
1229 unsigned char migration:1, renew:1;
683b57b4
TM
1230};
1231
22958463 1232struct nfs4_fs_locations_res {
22958463 1233 struct nfs4_sequence_res seq_res;
62ae082d 1234 struct nfs4_fs_locations *fs_locations;
b03d735b 1235 unsigned char migration:1, renew:1;
22958463
BH
1236};
1237
fb15b26f
CL
1238struct nfs4_secinfo4 {
1239 u32 flavor;
1240 struct rpcsec_gss_info flavor_info;
5a5ea0d4
BS
1241};
1242
1243struct nfs4_secinfo_flavors {
fb15b26f 1244 unsigned int num_flavors;
1ad8dd93 1245 struct nfs4_secinfo4 flavors[];
5a5ea0d4
BS
1246};
1247
1248struct nfs4_secinfo_arg {
62ae082d 1249 struct nfs4_sequence_args seq_args;
5a5ea0d4
BS
1250 const struct nfs_fh *dir_fh;
1251 const struct qstr *name;
5a5ea0d4
BS
1252};
1253
1254struct nfs4_secinfo_res {
5a5ea0d4 1255 struct nfs4_sequence_res seq_res;
62ae082d 1256 struct nfs4_secinfo_flavors *flavors;
5a5ea0d4
BS
1257};
1258
44c99933
CL
1259struct nfs4_fsid_present_arg {
1260 struct nfs4_sequence_args seq_args;
1261 const struct nfs_fh *fh;
1262 clientid4 clientid;
1263 unsigned char renew:1;
1264};
1265
1266struct nfs4_fsid_present_res {
1267 struct nfs4_sequence_res seq_res;
1268 struct nfs_fh *fh;
1269 unsigned char renew:1;
1270};
1271
1da177e4
LT
1272#endif /* CONFIG_NFS_V4 */
1273
99fe60d0
BH
1274struct nfstime4 {
1275 u64 seconds;
1276 u32 nseconds;
1277};
1278
1279#ifdef CONFIG_NFS_V4_1
ea2cf228
FI
1280
1281struct pnfs_commit_bucket {
1282 struct list_head written;
1283 struct list_head committing;
c84bea59 1284 struct pnfs_layout_segment *lseg;
5002c586 1285 struct nfs_writeverf direct_verf;
ea2cf228
FI
1286};
1287
d7242c46
TM
1288struct pnfs_commit_array {
1289 struct list_head cinfo_list;
1290 struct list_head lseg_list;
1291 struct pnfs_layout_segment *lseg;
1292 struct rcu_head rcu;
a9901899 1293 refcount_t refcount;
d7242c46
TM
1294 unsigned int nbuckets;
1295 struct pnfs_commit_bucket buckets[];
1296};
1297
ea2cf228 1298struct pnfs_ds_commit_info {
c21e7168 1299 struct list_head commits;
d7242c46
TM
1300 unsigned int nwritten;
1301 unsigned int ncommitting;
9c455a8c 1302 const struct pnfs_commit_ops *ops;
ea2cf228
FI
1303};
1304
2031cd1a
WAA
1305struct nfs41_state_protection {
1306 u32 how;
1307 struct nfs4_op_map enforce;
1308 struct nfs4_op_map allow;
1309};
1310
99fe60d0
BH
1311struct nfs41_exchange_id_args {
1312 struct nfs_client *client;
fd40559c 1313 nfs4_verifier verifier;
99fe60d0 1314 u32 flags;
2031cd1a 1315 struct nfs41_state_protection state_protect;
99fe60d0
BH
1316};
1317
acdeb69d 1318struct nfs41_server_owner {
99fe60d0
BH
1319 uint64_t minor_id;
1320 uint32_t major_id_sz;
1321 char major_id[NFS4_OPAQUE_LIMIT];
1322};
1323
79d4e1f0 1324struct nfs41_server_scope {
99fe60d0
BH
1325 uint32_t server_scope_sz;
1326 char server_scope[NFS4_OPAQUE_LIMIT];
1327};
1328
7d2ed9ac
WAA
1329struct nfs41_impl_id {
1330 char domain[NFS4_OPAQUE_LIMIT + 1];
1331 char name[NFS4_OPAQUE_LIMIT + 1];
1332 struct nfstime4 date;
1333};
1334
dff58530 1335#define MAX_BIND_CONN_TO_SESSION_RETRIES 3
71a097c6
TM
1336struct nfs41_bind_conn_to_session_args {
1337 struct nfs_client *client;
1338 struct nfs4_sessionid sessionid;
1339 u32 dir;
1340 bool use_conn_in_rdma_mode;
dff58530 1341 int retries;
71a097c6
TM
1342};
1343
7c44f1ae 1344struct nfs41_bind_conn_to_session_res {
71a097c6 1345 struct nfs4_sessionid sessionid;
7c44f1ae
WAA
1346 u32 dir;
1347 bool use_conn_in_rdma_mode;
1348};
1349
99fe60d0 1350struct nfs41_exchange_id_res {
32b01310
TM
1351 u64 clientid;
1352 u32 seqid;
99fe60d0 1353 u32 flags;
acdeb69d 1354 struct nfs41_server_owner *server_owner;
79d4e1f0 1355 struct nfs41_server_scope *server_scope;
7d2ed9ac 1356 struct nfs41_impl_id *impl_id;
2031cd1a 1357 struct nfs41_state_protection state_protect;
99fe60d0 1358};
fc931582
AA
1359
1360struct nfs41_create_session_args {
1361 struct nfs_client *client;
79969dd1
TM
1362 u64 clientid;
1363 uint32_t seqid;
fc931582
AA
1364 uint32_t flags;
1365 uint32_t cb_program;
1366 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1367 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1368};
1369
1370struct nfs41_create_session_res {
79969dd1
TM
1371 struct nfs4_sessionid sessionid;
1372 uint32_t seqid;
1373 uint32_t flags;
1374 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1375 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
fc931582 1376};
18019753
RL
1377
1378struct nfs41_reclaim_complete_args {
62ae082d 1379 struct nfs4_sequence_args seq_args;
18019753
RL
1380 /* In the future extend to include curr_fh for use with migration */
1381 unsigned char one_fs:1;
18019753
RL
1382};
1383
1384struct nfs41_reclaim_complete_res {
1385 struct nfs4_sequence_res seq_res;
1386};
fca78d6d
BS
1387
1388#define SECINFO_STYLE_CURRENT_FH 0
1389#define SECINFO_STYLE_PARENT 1
1390struct nfs41_secinfo_no_name_args {
fca78d6d 1391 struct nfs4_sequence_args seq_args;
62ae082d 1392 int style;
fca78d6d
BS
1393};
1394
7d974794 1395struct nfs41_test_stateid_args {
7d974794 1396 struct nfs4_sequence_args seq_args;
62ae082d 1397 nfs4_stateid *stateid;
7d974794
BS
1398};
1399
1400struct nfs41_test_stateid_res {
7d974794 1401 struct nfs4_sequence_res seq_res;
62ae082d 1402 unsigned int status;
7d974794
BS
1403};
1404
9aeda35f 1405struct nfs41_free_stateid_args {
9aeda35f 1406 struct nfs4_sequence_args seq_args;
7c1d5fae 1407 nfs4_stateid stateid;
9aeda35f
BS
1408};
1409
1410struct nfs41_free_stateid_res {
9aeda35f 1411 struct nfs4_sequence_res seq_res;
62ae082d 1412 unsigned int status;
9aeda35f
BS
1413};
1414
4f97615d
TM
1415#else
1416
1417struct pnfs_ds_commit_info {
1418};
1419
99fe60d0
BH
1420#endif /* CONFIG_NFS_V4_1 */
1421
1c6dcbe5 1422#ifdef CONFIG_NFS_V4_2
f4ac1674
AS
1423struct nfs42_falloc_args {
1424 struct nfs4_sequence_args seq_args;
1425
1426 struct nfs_fh *falloc_fh;
1427 nfs4_stateid falloc_stateid;
1428 u64 falloc_offset;
1429 u64 falloc_length;
9a51940b 1430 const u32 *falloc_bitmask;
f4ac1674
AS
1431};
1432
1433struct nfs42_falloc_res {
1434 struct nfs4_sequence_res seq_res;
1435 unsigned int status;
9a51940b
AS
1436
1437 struct nfs_fattr *falloc_fattr;
1438 const struct nfs_server *falloc_server;
f4ac1674
AS
1439};
1440
2e72448b
AS
1441struct nfs42_copy_args {
1442 struct nfs4_sequence_args seq_args;
1443
1444 struct nfs_fh *src_fh;
1445 nfs4_stateid src_stateid;
1446 u64 src_pos;
1447
1448 struct nfs_fh *dst_fh;
1449 nfs4_stateid dst_stateid;
1450 u64 dst_pos;
1451
1452 u64 count;
62164f31 1453 bool sync;
1d38f3f0 1454 struct nl4_server *cp_src;
2e72448b
AS
1455};
1456
1457struct nfs42_write_res {
67aa7444 1458 nfs4_stateid stateid;
2e72448b
AS
1459 u64 count;
1460 struct nfs_writeverf verifier;
1461};
1462
1463struct nfs42_copy_res {
1464 struct nfs4_sequence_res seq_res;
1465 struct nfs42_write_res write_res;
1466 bool consecutive;
1467 bool synchronous;
e0926934 1468 struct nfs_commitres commit_res;
2e72448b
AS
1469};
1470
cb95deea
OK
1471struct nfs42_offload_status_args {
1472 struct nfs4_sequence_args osa_seq_args;
1473 struct nfs_fh *osa_src_fh;
1474 nfs4_stateid osa_stateid;
1475};
1476
1477struct nfs42_offload_status_res {
1478 struct nfs4_sequence_res osr_seq_res;
1479 uint64_t osr_count;
1480 int osr_status;
1481};
1482
0491567b
OK
1483struct nfs42_copy_notify_args {
1484 struct nfs4_sequence_args cna_seq_args;
1485
1486 struct nfs_fh *cna_src_fh;
1487 nfs4_stateid cna_src_stateid;
1488 struct nl4_server cna_dst;
1489};
1490
1491struct nfs42_copy_notify_res {
1492 struct nfs4_sequence_res cnr_seq_res;
1493
1494 struct nfstime4 cnr_lease_time;
1495 nfs4_stateid cnr_stateid;
1496 struct nl4_server cnr_src;
1497};
1498
1c6dcbe5
AS
1499struct nfs42_seek_args {
1500 struct nfs4_sequence_args seq_args;
1501
1502 struct nfs_fh *sa_fh;
1503 nfs4_stateid sa_stateid;
1504 u64 sa_offset;
1505 u32 sa_what;
1506};
1507
1508struct nfs42_seek_res {
1509 struct nfs4_sequence_res seq_res;
1510 unsigned int status;
1511
1512 u32 sr_eof;
1513 u64 sr_offset;
1514};
3e1f0212
FL
1515
1516struct nfs42_setxattrargs {
1517 struct nfs4_sequence_args seq_args;
1518 struct nfs_fh *fh;
1519 const char *xattr_name;
1520 u32 xattr_flags;
1521 size_t xattr_len;
1522 struct page **xattr_pages;
1523};
1524
1525struct nfs42_setxattrres {
1526 struct nfs4_sequence_res seq_res;
1527 struct nfs4_change_info cinfo;
1528};
1529
1530struct nfs42_getxattrargs {
1531 struct nfs4_sequence_args seq_args;
1532 struct nfs_fh *fh;
1533 const char *xattr_name;
1534 size_t xattr_len;
1535 struct page **xattr_pages;
1536};
1537
1538struct nfs42_getxattrres {
1539 struct nfs4_sequence_res seq_res;
1540 size_t xattr_len;
1541};
1542
1543struct nfs42_listxattrsargs {
1544 struct nfs4_sequence_args seq_args;
1545 struct nfs_fh *fh;
1546 u32 count;
1547 u64 cookie;
1548 struct page **xattr_pages;
1549};
1550
1551struct nfs42_listxattrsres {
1552 struct nfs4_sequence_res seq_res;
1553 struct page *scratch;
1554 void *xattr_buf;
1555 size_t xattr_len;
1556 u64 cookie;
1557 bool eof;
1558 size_t copied;
1559};
1560
1561struct nfs42_removexattrargs {
1562 struct nfs4_sequence_args seq_args;
1563 struct nfs_fh *fh;
1564 const char *xattr_name;
1565};
1566
1567struct nfs42_removexattrres {
1568 struct nfs4_sequence_res seq_res;
1569 struct nfs4_change_info cinfo;
1570};
1571
1572#endif /* CONFIG_NFS_V4_2 */
1c6dcbe5 1573
1da177e4
LT
1574struct nfs_page;
1575
40859d7e
CL
1576#define NFS_PAGEVEC_SIZE (8U)
1577
30dd374f
FI
1578struct nfs_page_array {
1579 struct page **pagevec;
1580 unsigned int npages; /* Max length of pagevec */
1581 struct page *page_array[NFS_PAGEVEC_SIZE];
1582};
1583
4db6e0b7
FI
1584/* used as flag bits in nfs_pgio_header */
1585enum {
1586 NFS_IOHDR_ERROR = 0,
1587 NFS_IOHDR_EOF,
1588 NFS_IOHDR_REDO,
37e9ed22 1589 NFS_IOHDR_STAT,
42f86b44
TM
1590 NFS_IOHDR_RESEND_PNFS,
1591 NFS_IOHDR_RESEND_MDS,
4db6e0b7
FI
1592};
1593
919e3bd9 1594struct nfs_io_completion;
cd841605
FI
1595struct nfs_pgio_header {
1596 struct inode *inode;
a52458b4 1597 const struct cred *cred;
cd841605
FI
1598 struct list_head pages;
1599 struct nfs_page *req;
f79d06f5 1600 struct nfs_writeverf verf; /* Used for writes */
fbe77c30 1601 fmode_t rw_mode;
cd841605 1602 struct pnfs_layout_segment *lseg;
4db6e0b7 1603 loff_t io_start;
cd841605 1604 const struct rpc_call_ops *mds_ops;
4db6e0b7 1605 void (*release) (struct nfs_pgio_header *hdr);
061ae2ed 1606 const struct nfs_pgio_completion_ops *completion_ops;
4a0de55c 1607 const struct nfs_rw_ops *rw_ops;
919e3bd9 1608 struct nfs_io_completion *io_completion;
584aa810 1609 struct nfs_direct_req *dreq;
1c6c4b74 1610
cd841605 1611 int pnfs_error;
4db6e0b7 1612 int error; /* merge with pnfs_error */
1c6c4b74 1613 unsigned int good_bytes; /* boundary of good data */
4db6e0b7 1614 unsigned long flags;
d45f60c6
WAA
1615
1616 /*
1617 * rpc data
1618 */
1619 struct rpc_task task;
1620 struct nfs_fattr fattr;
d45f60c6
WAA
1621 struct nfs_pgio_args args; /* argument struct */
1622 struct nfs_pgio_res res; /* result struct */
1623 unsigned long timestamp; /* For lease renewal */
1624 int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
1625 __u64 mds_offset; /* Filelayout dense stripe */
1626 struct nfs_page_array page_array;
1627 struct nfs_client *ds_clp; /* pNFS data server */
c754e137
TM
1628 u32 ds_commit_idx; /* ds index if ds_clp is set */
1629 u32 pgio_mirror_idx;/* mirror index in pgio layer */
cd841605
FI
1630};
1631
ea2cf228
FI
1632struct nfs_mds_commit_info {
1633 atomic_t rpcs_out;
5cb953d4 1634 atomic_long_t ncommit;
ea2cf228
FI
1635 struct list_head list;
1636};
1637
b20135d0 1638struct nfs_commit_info;
f453a54a
FI
1639struct nfs_commit_data;
1640struct nfs_inode;
1641struct nfs_commit_completion_ops {
f453a54a 1642 void (*completion) (struct nfs_commit_data *data);
b20135d0 1643 void (*resched_write) (struct nfs_commit_info *, struct nfs_page *);
f453a54a
FI
1644};
1645
ea2cf228 1646struct nfs_commit_info {
fe238e60 1647 struct inode *inode; /* Needed for inode->i_lock */
ea2cf228
FI
1648 struct nfs_mds_commit_info *mds;
1649 struct pnfs_ds_commit_info *ds;
b359f9d0 1650 struct nfs_direct_req *dreq; /* O_DIRECT request */
f453a54a 1651 const struct nfs_commit_completion_ops *completion_ops;
ea2cf228
FI
1652};
1653
0b7c0153
FI
1654struct nfs_commit_data {
1655 struct rpc_task task;
1656 struct inode *inode;
a52458b4 1657 const struct cred *cred;
0b7c0153
FI
1658 struct nfs_fattr fattr;
1659 struct nfs_writeverf verf;
1660 struct list_head pages; /* Coalesced requests we wish to flush */
1661 struct list_head list; /* lists of struct nfs_write_data */
1662 struct nfs_direct_req *dreq; /* O_DIRECT request */
1663 struct nfs_commitargs args; /* argument struct */
1664 struct nfs_commitres res; /* result struct */
1665 struct nfs_open_context *context;
1666 struct pnfs_layout_segment *lseg;
1667 struct nfs_client *ds_clp; /* pNFS data server */
1668 int ds_commit_index;
378520b8 1669 loff_t lwb;
0b7c0153 1670 const struct rpc_call_ops *mds_ops;
f453a54a 1671 const struct nfs_commit_completion_ops *completion_ops;
0b7c0153 1672 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
37e9ed22 1673 unsigned long flags;
0b7c0153
FI
1674};
1675
061ae2ed 1676struct nfs_pgio_completion_ops {
df3accb8 1677 void (*error_cleanup)(struct list_head *head, int);
584aa810 1678 void (*init_hdr)(struct nfs_pgio_header *hdr);
061ae2ed 1679 void (*completion)(struct nfs_pgio_header *hdr);
dc602dd7 1680 void (*reschedule_io)(struct nfs_pgio_header *hdr);
061ae2ed
FI
1681};
1682
34e137cc 1683struct nfs_unlinkdata {
34e137cc
BS
1684 struct nfs_removeargs args;
1685 struct nfs_removeres res;
884be175
AV
1686 struct dentry *dentry;
1687 wait_queue_head_t wq;
a52458b4 1688 const struct cred *cred;
34e137cc 1689 struct nfs_fattr dir_attr;
8478eaa1 1690 long timeout;
34e137cc
BS
1691};
1692
c6bfa1a1
BS
1693struct nfs_renamedata {
1694 struct nfs_renameargs args;
1695 struct nfs_renameres res;
a52458b4 1696 const struct cred *cred;
c6bfa1a1
BS
1697 struct inode *old_dir;
1698 struct dentry *old_dentry;
1699 struct nfs_fattr old_fattr;
1700 struct inode *new_dir;
1701 struct dentry *new_dentry;
1702 struct nfs_fattr new_fattr;
96f9d8c0 1703 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
8478eaa1 1704 long timeout;
818a8dbe 1705 bool cancelled;
c6bfa1a1
BS
1706};
1707
1da177e4 1708struct nfs_access_entry;
45a52a02 1709struct nfs_client;
e0dca7a0 1710struct rpc_timeout;
ff9099f2
BS
1711struct nfs_subversion;
1712struct nfs_mount_info;
6663ee7f 1713struct nfs_client_initdata;
1abb5088 1714struct nfs_pageio_descriptor;
f2aedb71 1715struct fs_context;
1da177e4
LT
1716
1717/*
1718 * RPC procedure vector for NFSv2/NFSv3 demuxing
1719 */
1720struct nfs_rpc_ops {
c0e07cb6 1721 u32 version; /* Protocol version */
f786aa90 1722 const struct dentry_operations *dentry_ops;
c5ef1c42
AV
1723 const struct inode_operations *dir_inode_ops;
1724 const struct inode_operations *file_inode_ops;
1788ea6e 1725 const struct file_operations *file_ops;
b1ece737 1726 const struct nlmclnt_operations *nlmclnt_ops;
1da177e4
LT
1727
1728 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1729 struct nfs_fsinfo *);
f2aedb71
DH
1730 int (*submount) (struct fs_context *, struct nfs_server *);
1731 int (*try_get_tree) (struct fs_context *);
1da177e4 1732 int (*getattr) (struct nfs_server *, struct nfs_fh *,
a841b54d
TM
1733 struct nfs_fattr *, struct nfs4_label *,
1734 struct inode *);
1da177e4
LT
1735 int (*setattr) (struct dentry *, struct nfs_fattr *,
1736 struct iattr *);
f7b37b8b 1737 int (*lookup) (struct inode *, struct dentry *,
1775fd3e
DQ
1738 struct nfs_fh *, struct nfs_fattr *,
1739 struct nfs4_label *);
5b5faaf6
JL
1740 int (*lookupp) (struct inode *, struct nfs_fh *,
1741 struct nfs_fattr *, struct nfs4_label *);
1da177e4
LT
1742 int (*access) (struct inode *, struct nfs_access_entry *);
1743 int (*readlink)(struct inode *, struct page *, unsigned int,
1744 unsigned int);
1da177e4 1745 int (*create) (struct inode *, struct dentry *,
8867fe58 1746 struct iattr *, int);
912678db 1747 int (*remove) (struct inode *, struct dentry *);
ed7e9ad0 1748 void (*unlink_setup) (struct rpc_message *, struct dentry *, struct inode *);
34e137cc 1749 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
e4eff1a6 1750 int (*unlink_done) (struct rpc_task *, struct inode *);
f2c2c552
TM
1751 void (*rename_setup) (struct rpc_message *msg,
1752 struct dentry *old_dentry,
1753 struct dentry *new_dentry);
c6bfa1a1 1754 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
d3d4152a 1755 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
beffb8fe 1756 int (*link) (struct inode *, struct inode *, const struct qstr *);
94a6d753
CL
1757 int (*symlink) (struct inode *, struct dentry *, struct page *,
1758 unsigned int, struct iattr *);
1da177e4 1759 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
beffb8fe 1760 int (*rmdir) (struct inode *, const struct qstr *);
82e22a5e 1761 int (*readdir) (struct nfs_readdir_arg *, struct nfs_readdir_res *);
1da177e4
LT
1762 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1763 dev_t);
1764 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1765 struct nfs_fsstat *);
1766 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1767 struct nfs_fsinfo *);
1768 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1769 struct nfs_pathconf *);
e9326dca 1770 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
a7a3b1e9 1771 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, bool);
d45f60c6
WAA
1772 int (*pgio_rpc_prepare)(struct rpc_task *,
1773 struct nfs_pgio_header *);
1774 void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
1775 int (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
fb91fb0e
AS
1776 void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *,
1777 struct rpc_clnt **);
d45f60c6 1778 int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
e9ae1ee2
AS
1779 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *,
1780 struct rpc_clnt **);
0b7c0153
FI
1781 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1782 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
1da177e4 1783 int (*lock)(struct file *, int, struct file_lock *);
2116271a 1784 int (*lock_check_bounds)(const struct file_lock *);
ada70d94 1785 void (*clear_acl_cache)(struct inode *);
7fe5c398 1786 void (*close_context)(struct nfs_open_context *ctx, int);
2b484297
TM
1787 struct inode * (*open_context) (struct inode *dir,
1788 struct nfs_open_context *ctx,
1789 int open_flags,
5bc2afc2
TM
1790 struct iattr *iattr,
1791 int *);
011e2a7f 1792 int (*have_delegation)(struct inode *, fmode_t);
6663ee7f 1793 struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
5c6e5b60
TM
1794 struct nfs_client *(*init_client) (struct nfs_client *,
1795 const struct nfs_client_initdata *);
cdb7eced 1796 void (*free_client) (struct nfs_client *);
62a55d08 1797 struct nfs_server *(*create_server)(struct fs_context *);
1179acc6
BS
1798 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
1799 struct nfs_fattr *, rpc_authflavor_t);
1da177e4
LT
1800};
1801
1802/*
1803 * NFS_CALL(getattr, inode, (fattr));
1804 * into
1805 * NFS_PROTO(inode)->getattr(fattr);
1806 */
1807#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1808
1809/*
1810 * Function vectors etc. for the NFS client
1811 */
509de811
DH
1812extern const struct nfs_rpc_ops nfs_v2_clientops;
1813extern const struct nfs_rpc_ops nfs_v3_clientops;
1814extern const struct nfs_rpc_ops nfs_v4_clientops;
a613fa16
TM
1815extern const struct rpc_version nfs_version2;
1816extern const struct rpc_version nfs_version3;
1817extern const struct rpc_version nfs_version4;
1da177e4 1818
a613fa16
TM
1819extern const struct rpc_version nfsacl_version3;
1820extern const struct rpc_program nfsacl_program;
b7fa0554 1821
1da177e4 1822#endif