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