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