Linux Audio

Check our new training course

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