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