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