xref: /openbmc/linux/fs/nfsd/xdr4.h (revision 026fec7e)
19a74af21SBoaz Harrosh /*
29a74af21SBoaz Harrosh  *  Server-side types for NFSv4.
39a74af21SBoaz Harrosh  *
49a74af21SBoaz Harrosh  *  Copyright (c) 2002 The Regents of the University of Michigan.
59a74af21SBoaz Harrosh  *  All rights reserved.
69a74af21SBoaz Harrosh  *
79a74af21SBoaz Harrosh  *  Kendrick Smith <kmsmith@umich.edu>
89a74af21SBoaz Harrosh  *  Andy Adamson   <andros@umich.edu>
99a74af21SBoaz Harrosh  *
109a74af21SBoaz Harrosh  *  Redistribution and use in source and binary forms, with or without
119a74af21SBoaz Harrosh  *  modification, are permitted provided that the following conditions
129a74af21SBoaz Harrosh  *  are met:
139a74af21SBoaz Harrosh  *
149a74af21SBoaz Harrosh  *  1. Redistributions of source code must retain the above copyright
159a74af21SBoaz Harrosh  *     notice, this list of conditions and the following disclaimer.
169a74af21SBoaz Harrosh  *  2. Redistributions in binary form must reproduce the above copyright
179a74af21SBoaz Harrosh  *     notice, this list of conditions and the following disclaimer in the
189a74af21SBoaz Harrosh  *     documentation and/or other materials provided with the distribution.
199a74af21SBoaz Harrosh  *  3. Neither the name of the University nor the names of its
209a74af21SBoaz Harrosh  *     contributors may be used to endorse or promote products derived
219a74af21SBoaz Harrosh  *     from this software without specific prior written permission.
229a74af21SBoaz Harrosh  *
239a74af21SBoaz Harrosh  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
249a74af21SBoaz Harrosh  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
259a74af21SBoaz Harrosh  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
269a74af21SBoaz Harrosh  *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
279a74af21SBoaz Harrosh  *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
289a74af21SBoaz Harrosh  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
299a74af21SBoaz Harrosh  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
309a74af21SBoaz Harrosh  *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
319a74af21SBoaz Harrosh  *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
329a74af21SBoaz Harrosh  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
339a74af21SBoaz Harrosh  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
349a74af21SBoaz Harrosh  *
359a74af21SBoaz Harrosh  */
369a74af21SBoaz Harrosh 
379a74af21SBoaz Harrosh #ifndef _LINUX_NFSD_XDR4_H
389a74af21SBoaz Harrosh #define _LINUX_NFSD_XDR4_H
399a74af21SBoaz Harrosh 
409a74af21SBoaz Harrosh #include "state.h"
419a74af21SBoaz Harrosh #include "nfsd.h"
429a74af21SBoaz Harrosh 
439a74af21SBoaz Harrosh #define NFSD4_MAX_TAGLEN	128
449a74af21SBoaz Harrosh #define XDR_LEN(n)                     (((n) + 3) & ~3)
459a74af21SBoaz Harrosh 
4637c593c5STigran Mkrtchyan #define CURRENT_STATE_ID_FLAG (1<<0)
4737c593c5STigran Mkrtchyan #define SAVED_STATE_ID_FLAG (1<<1)
4837c593c5STigran Mkrtchyan 
4937c593c5STigran Mkrtchyan #define SET_STATE_ID(c, f) ((c)->sid_flags |= (f))
5037c593c5STigran Mkrtchyan #define HAS_STATE_ID(c, f) ((c)->sid_flags & (f))
5137c593c5STigran Mkrtchyan #define CLEAR_STATE_ID(c, f) ((c)->sid_flags &= ~(f))
5237c593c5STigran Mkrtchyan 
539a74af21SBoaz Harrosh struct nfsd4_compound_state {
549a74af21SBoaz Harrosh 	struct svc_fh		current_fh;
559a74af21SBoaz Harrosh 	struct svc_fh		save_fh;
569a74af21SBoaz Harrosh 	struct nfs4_stateowner	*replay_owner;
574b24ca7dSJeff Layton 	struct nfs4_client	*clp;
589a74af21SBoaz Harrosh 	/* For sessions DRC */
599a74af21SBoaz Harrosh 	struct nfsd4_session	*session;
609a74af21SBoaz Harrosh 	struct nfsd4_slot	*slot;
61f5236013SJ. Bruce Fields 	int			data_offset;
62ed941643SAndrew Elble 	bool                    spo_must_allowed;
639a74af21SBoaz Harrosh 	size_t			iovlen;
649a74af21SBoaz Harrosh 	u32			minorversion;
6557b7b43bSJ. Bruce Fields 	__be32			status;
6637c593c5STigran Mkrtchyan 	stateid_t	current_stateid;
6737c593c5STigran Mkrtchyan 	stateid_t	save_stateid;
6837c593c5STigran Mkrtchyan 	/* to indicate current and saved state id presents */
6937c593c5STigran Mkrtchyan 	u32		sid_flags;
709a74af21SBoaz Harrosh };
719a74af21SBoaz Harrosh 
729a74af21SBoaz Harrosh static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
739a74af21SBoaz Harrosh {
749a74af21SBoaz Harrosh 	return cs->slot != NULL;
759a74af21SBoaz Harrosh }
769a74af21SBoaz Harrosh 
779a74af21SBoaz Harrosh struct nfsd4_change_info {
789a74af21SBoaz Harrosh 	u32		atomic;
799a74af21SBoaz Harrosh 	bool		change_supported;
809a74af21SBoaz Harrosh 	u32		before_ctime_sec;
819a74af21SBoaz Harrosh 	u32		before_ctime_nsec;
829a74af21SBoaz Harrosh 	u64		before_change;
839a74af21SBoaz Harrosh 	u32		after_ctime_sec;
849a74af21SBoaz Harrosh 	u32		after_ctime_nsec;
859a74af21SBoaz Harrosh 	u64		after_change;
869a74af21SBoaz Harrosh };
879a74af21SBoaz Harrosh 
889a74af21SBoaz Harrosh struct nfsd4_access {
899a74af21SBoaz Harrosh 	u32		ac_req_access;      /* request */
909a74af21SBoaz Harrosh 	u32		ac_supported;       /* response */
919a74af21SBoaz Harrosh 	u32		ac_resp_access;     /* response */
929a74af21SBoaz Harrosh };
939a74af21SBoaz Harrosh 
949a74af21SBoaz Harrosh struct nfsd4_close {
959a74af21SBoaz Harrosh 	u32		cl_seqid;           /* request */
969a74af21SBoaz Harrosh 	stateid_t	cl_stateid;         /* request+response */
979a74af21SBoaz Harrosh };
989a74af21SBoaz Harrosh 
999a74af21SBoaz Harrosh struct nfsd4_commit {
1009a74af21SBoaz Harrosh 	u64		co_offset;          /* request */
1019a74af21SBoaz Harrosh 	u32		co_count;           /* request */
1029a74af21SBoaz Harrosh 	nfs4_verifier	co_verf;            /* response */
1039a74af21SBoaz Harrosh };
1049a74af21SBoaz Harrosh 
1059a74af21SBoaz Harrosh struct nfsd4_create {
1069a74af21SBoaz Harrosh 	u32		cr_namelen;         /* request */
1079a74af21SBoaz Harrosh 	char *		cr_name;            /* request */
1089a74af21SBoaz Harrosh 	u32		cr_type;            /* request */
1099a74af21SBoaz Harrosh 	union {                             /* request */
1109a74af21SBoaz Harrosh 		struct {
1117fb84306SJ. Bruce Fields 			u32 datalen;
1127fb84306SJ. Bruce Fields 			char *data;
1139a74af21SBoaz Harrosh 		} link;   /* NF4LNK */
1149a74af21SBoaz Harrosh 		struct {
1159a74af21SBoaz Harrosh 			u32 specdata1;
1169a74af21SBoaz Harrosh 			u32 specdata2;
1179a74af21SBoaz Harrosh 		} dev;    /* NF4BLK, NF4CHR */
1189a74af21SBoaz Harrosh 	} u;
1199a74af21SBoaz Harrosh 	u32		cr_bmval[3];        /* request */
1209a74af21SBoaz Harrosh 	struct iattr	cr_iattr;           /* request */
1219a74af21SBoaz Harrosh 	struct nfsd4_change_info  cr_cinfo; /* response */
1229a74af21SBoaz Harrosh 	struct nfs4_acl *cr_acl;
12318032ca0SDavid Quigley 	struct xdr_netobj cr_label;
1249a74af21SBoaz Harrosh };
1257fb84306SJ. Bruce Fields #define cr_datalen	u.link.datalen
1267fb84306SJ. Bruce Fields #define cr_data		u.link.data
1279a74af21SBoaz Harrosh #define cr_specdata1	u.dev.specdata1
1289a74af21SBoaz Harrosh #define cr_specdata2	u.dev.specdata2
1299a74af21SBoaz Harrosh 
1309a74af21SBoaz Harrosh struct nfsd4_delegreturn {
1319a74af21SBoaz Harrosh 	stateid_t	dr_stateid;
1329a74af21SBoaz Harrosh };
1339a74af21SBoaz Harrosh 
1349a74af21SBoaz Harrosh struct nfsd4_getattr {
1359a74af21SBoaz Harrosh 	u32		ga_bmval[3];        /* request */
1369a74af21SBoaz Harrosh 	struct svc_fh	*ga_fhp;            /* response */
1379a74af21SBoaz Harrosh };
1389a74af21SBoaz Harrosh 
1399a74af21SBoaz Harrosh struct nfsd4_link {
1409a74af21SBoaz Harrosh 	u32		li_namelen;         /* request */
1419a74af21SBoaz Harrosh 	char *		li_name;            /* request */
1429a74af21SBoaz Harrosh 	struct nfsd4_change_info  li_cinfo; /* response */
1439a74af21SBoaz Harrosh };
1449a74af21SBoaz Harrosh 
1459a74af21SBoaz Harrosh struct nfsd4_lock_denied {
1469a74af21SBoaz Harrosh 	clientid_t	ld_clientid;
1477c13f344SJ. Bruce Fields 	struct xdr_netobj	ld_owner;
1489a74af21SBoaz Harrosh 	u64             ld_start;
1499a74af21SBoaz Harrosh 	u64             ld_length;
1509a74af21SBoaz Harrosh 	u32             ld_type;
1519a74af21SBoaz Harrosh };
1529a74af21SBoaz Harrosh 
1539a74af21SBoaz Harrosh struct nfsd4_lock {
1549a74af21SBoaz Harrosh 	/* request */
1559a74af21SBoaz Harrosh 	u32             lk_type;
1569a74af21SBoaz Harrosh 	u32             lk_reclaim;         /* boolean */
1579a74af21SBoaz Harrosh 	u64             lk_offset;
1589a74af21SBoaz Harrosh 	u64             lk_length;
1599a74af21SBoaz Harrosh 	u32             lk_is_new;
1609a74af21SBoaz Harrosh 	union {
1619a74af21SBoaz Harrosh 		struct {
1629a74af21SBoaz Harrosh 			u32             open_seqid;
1639a74af21SBoaz Harrosh 			stateid_t       open_stateid;
1649a74af21SBoaz Harrosh 			u32             lock_seqid;
1659a74af21SBoaz Harrosh 			clientid_t      clientid;
1669a74af21SBoaz Harrosh 			struct xdr_netobj owner;
1679a74af21SBoaz Harrosh 		} new;
1689a74af21SBoaz Harrosh 		struct {
1699a74af21SBoaz Harrosh 			stateid_t       lock_stateid;
1709a74af21SBoaz Harrosh 			u32             lock_seqid;
1719a74af21SBoaz Harrosh 		} old;
1729a74af21SBoaz Harrosh 	} v;
1739a74af21SBoaz Harrosh 
1749a74af21SBoaz Harrosh 	/* response */
1759a74af21SBoaz Harrosh 	union {
1769a74af21SBoaz Harrosh 		struct {
1779a74af21SBoaz Harrosh 			stateid_t               stateid;
1789a74af21SBoaz Harrosh 		} ok;
1799a74af21SBoaz Harrosh 		struct nfsd4_lock_denied        denied;
1809a74af21SBoaz Harrosh 	} u;
1819a74af21SBoaz Harrosh };
1829a74af21SBoaz Harrosh #define lk_new_open_seqid       v.new.open_seqid
1839a74af21SBoaz Harrosh #define lk_new_open_stateid     v.new.open_stateid
1849a74af21SBoaz Harrosh #define lk_new_lock_seqid       v.new.lock_seqid
1859a74af21SBoaz Harrosh #define lk_new_clientid         v.new.clientid
1869a74af21SBoaz Harrosh #define lk_new_owner            v.new.owner
1879a74af21SBoaz Harrosh #define lk_old_lock_stateid     v.old.lock_stateid
1889a74af21SBoaz Harrosh #define lk_old_lock_seqid       v.old.lock_seqid
1899a74af21SBoaz Harrosh 
1909a74af21SBoaz Harrosh #define lk_resp_stateid u.ok.stateid
1919a74af21SBoaz Harrosh #define lk_denied       u.denied
1929a74af21SBoaz Harrosh 
1939a74af21SBoaz Harrosh 
1949a74af21SBoaz Harrosh struct nfsd4_lockt {
1959a74af21SBoaz Harrosh 	u32				lt_type;
1969a74af21SBoaz Harrosh 	clientid_t			lt_clientid;
1979a74af21SBoaz Harrosh 	struct xdr_netobj		lt_owner;
1989a74af21SBoaz Harrosh 	u64				lt_offset;
1999a74af21SBoaz Harrosh 	u64				lt_length;
2009a74af21SBoaz Harrosh 	struct nfsd4_lock_denied  	lt_denied;
2019a74af21SBoaz Harrosh };
2029a74af21SBoaz Harrosh 
2039a74af21SBoaz Harrosh 
2049a74af21SBoaz Harrosh struct nfsd4_locku {
2059a74af21SBoaz Harrosh 	u32             lu_type;
2069a74af21SBoaz Harrosh 	u32             lu_seqid;
2079a74af21SBoaz Harrosh 	stateid_t       lu_stateid;
2089a74af21SBoaz Harrosh 	u64             lu_offset;
2099a74af21SBoaz Harrosh 	u64             lu_length;
2109a74af21SBoaz Harrosh };
2119a74af21SBoaz Harrosh 
2129a74af21SBoaz Harrosh 
2139a74af21SBoaz Harrosh struct nfsd4_lookup {
2149a74af21SBoaz Harrosh 	u32		lo_len;             /* request */
2159a74af21SBoaz Harrosh 	char *		lo_name;            /* request */
2169a74af21SBoaz Harrosh };
2179a74af21SBoaz Harrosh 
2189a74af21SBoaz Harrosh struct nfsd4_putfh {
2199a74af21SBoaz Harrosh 	u32		pf_fhlen;           /* request */
2209a74af21SBoaz Harrosh 	char		*pf_fhval;          /* request */
2219a74af21SBoaz Harrosh };
2229a74af21SBoaz Harrosh 
2239a74af21SBoaz Harrosh struct nfsd4_open {
2249a74af21SBoaz Harrosh 	u32		op_claim_type;      /* request */
2259a74af21SBoaz Harrosh 	struct xdr_netobj op_fname;	    /* request - everything but CLAIM_PREV */
2269a74af21SBoaz Harrosh 	u32		op_delegate_type;   /* request - CLAIM_PREV only */
2279a74af21SBoaz Harrosh 	stateid_t       op_delegate_stateid; /* request - response */
228d24433cdSBenny Halevy 	u32		op_why_no_deleg;    /* response - DELEG_NONE_EXT only */
2299a74af21SBoaz Harrosh 	u32		op_create;     	    /* request */
2309a74af21SBoaz Harrosh 	u32		op_createmode;      /* request */
2319a74af21SBoaz Harrosh 	u32		op_bmval[3];        /* request */
2323ff69309SKinglong Mee 	struct iattr	op_iattr;           /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */
233ab4684d1SChuck Lever 	nfs4_verifier	op_verf __attribute__((aligned(32)));
234ab4684d1SChuck Lever 					    /* EXCLUSIVE4 */
2359a74af21SBoaz Harrosh 	clientid_t	op_clientid;        /* request */
2369a74af21SBoaz Harrosh 	struct xdr_netobj op_owner;           /* request */
2379a74af21SBoaz Harrosh 	u32		op_seqid;           /* request */
2389a74af21SBoaz Harrosh 	u32		op_share_access;    /* request */
2399a74af21SBoaz Harrosh 	u32		op_share_deny;      /* request */
2402c8bd7e0SBenny Halevy 	u32		op_deleg_want;      /* request */
2419a74af21SBoaz Harrosh 	stateid_t	op_stateid;         /* response */
2429d313b17SJ. Bruce Fields 	__be32		op_xdr_error;       /* see nfsd4_open_omfg() */
2439a74af21SBoaz Harrosh 	u32		op_recall;          /* recall */
2449a74af21SBoaz Harrosh 	struct nfsd4_change_info  op_cinfo; /* response */
2459a74af21SBoaz Harrosh 	u32		op_rflags;          /* response */
246856121b2SJ. Bruce Fields 	bool		op_truncate;        /* used during processing */
247856121b2SJ. Bruce Fields 	bool		op_created;         /* used during processing */
248fe0750e5SJ. Bruce Fields 	struct nfs4_openowner *op_openowner; /* used during processing */
24932513b40SJ. Bruce Fields 	struct nfs4_file *op_file;          /* used during processing */
2504cdc951bSJ. Bruce Fields 	struct nfs4_ol_stateid *op_stp;	    /* used during processing */
2518287f009SSachin Bhamare 	struct nfs4_clnt_odstate *op_odstate; /* used during processing */
2529a74af21SBoaz Harrosh 	struct nfs4_acl *op_acl;
25318032ca0SDavid Quigley 	struct xdr_netobj op_label;
2549a74af21SBoaz Harrosh };
2559a74af21SBoaz Harrosh 
2569a74af21SBoaz Harrosh struct nfsd4_open_confirm {
2579a74af21SBoaz Harrosh 	stateid_t	oc_req_stateid		/* request */;
2589a74af21SBoaz Harrosh 	u32		oc_seqid    		/* request */;
2599a74af21SBoaz Harrosh 	stateid_t	oc_resp_stateid		/* response */;
2609a74af21SBoaz Harrosh };
2619a74af21SBoaz Harrosh 
2629a74af21SBoaz Harrosh struct nfsd4_open_downgrade {
2639a74af21SBoaz Harrosh 	stateid_t       od_stateid;
2649a74af21SBoaz Harrosh 	u32             od_seqid;
2652c8bd7e0SBenny Halevy 	u32             od_share_access;	/* request */
2662c8bd7e0SBenny Halevy 	u32		od_deleg_want;		/* request */
2672c8bd7e0SBenny Halevy 	u32             od_share_deny;		/* request */
2689a74af21SBoaz Harrosh };
2699a74af21SBoaz Harrosh 
2709a74af21SBoaz Harrosh 
2719a74af21SBoaz Harrosh struct nfsd4_read {
2729a74af21SBoaz Harrosh 	stateid_t	rd_stateid;         /* request */
2739a74af21SBoaz Harrosh 	u64		rd_offset;          /* request */
2749a74af21SBoaz Harrosh 	u32		rd_length;          /* request */
2759a74af21SBoaz Harrosh 	int		rd_vlen;
2769a74af21SBoaz Harrosh 	struct file     *rd_filp;
277af90f707SChristoph Hellwig 	bool		rd_tmp_file;
2789a74af21SBoaz Harrosh 
2799a74af21SBoaz Harrosh 	struct svc_rqst *rd_rqstp;          /* response */
2809a74af21SBoaz Harrosh 	struct svc_fh * rd_fhp;             /* response */
2819a74af21SBoaz Harrosh };
2829a74af21SBoaz Harrosh 
2839a74af21SBoaz Harrosh struct nfsd4_readdir {
2849a74af21SBoaz Harrosh 	u64		rd_cookie;          /* request */
2859a74af21SBoaz Harrosh 	nfs4_verifier	rd_verf;            /* request */
2869a74af21SBoaz Harrosh 	u32		rd_dircount;        /* request */
2879a74af21SBoaz Harrosh 	u32		rd_maxcount;        /* request */
2889a74af21SBoaz Harrosh 	u32		rd_bmval[3];        /* request */
2899a74af21SBoaz Harrosh 	struct svc_rqst *rd_rqstp;          /* response */
2909a74af21SBoaz Harrosh 	struct svc_fh * rd_fhp;             /* response */
2919a74af21SBoaz Harrosh 
2929a74af21SBoaz Harrosh 	struct readdir_cd	common;
293561f0ed4SJ. Bruce Fields 	struct xdr_stream	*xdr;
294561f0ed4SJ. Bruce Fields 	int			cookie_offset;
2959a74af21SBoaz Harrosh };
2969a74af21SBoaz Harrosh 
2979a74af21SBoaz Harrosh struct nfsd4_release_lockowner {
2989a74af21SBoaz Harrosh 	clientid_t        rl_clientid;
2999a74af21SBoaz Harrosh 	struct xdr_netobj rl_owner;
3009a74af21SBoaz Harrosh };
3019a74af21SBoaz Harrosh struct nfsd4_readlink {
3029a74af21SBoaz Harrosh 	struct svc_rqst *rl_rqstp;          /* request */
3039a74af21SBoaz Harrosh 	struct svc_fh *	rl_fhp;             /* request */
3049a74af21SBoaz Harrosh };
3059a74af21SBoaz Harrosh 
3069a74af21SBoaz Harrosh struct nfsd4_remove {
3079a74af21SBoaz Harrosh 	u32		rm_namelen;         /* request */
3089a74af21SBoaz Harrosh 	char *		rm_name;            /* request */
3099a74af21SBoaz Harrosh 	struct nfsd4_change_info  rm_cinfo; /* response */
3109a74af21SBoaz Harrosh };
3119a74af21SBoaz Harrosh 
3129a74af21SBoaz Harrosh struct nfsd4_rename {
3139a74af21SBoaz Harrosh 	u32		rn_snamelen;        /* request */
3149a74af21SBoaz Harrosh 	char *		rn_sname;           /* request */
3159a74af21SBoaz Harrosh 	u32		rn_tnamelen;        /* request */
3169a74af21SBoaz Harrosh 	char *		rn_tname;           /* request */
3179a74af21SBoaz Harrosh 	struct nfsd4_change_info  rn_sinfo; /* response */
3189a74af21SBoaz Harrosh 	struct nfsd4_change_info  rn_tinfo; /* response */
3199a74af21SBoaz Harrosh };
3209a74af21SBoaz Harrosh 
3219a74af21SBoaz Harrosh struct nfsd4_secinfo {
3229a74af21SBoaz Harrosh 	u32 si_namelen;					/* request */
3239a74af21SBoaz Harrosh 	char *si_name;					/* request */
3249a74af21SBoaz Harrosh 	struct svc_export *si_exp;			/* response */
3259a74af21SBoaz Harrosh };
3269a74af21SBoaz Harrosh 
32704f4ad16SJ. Bruce Fields struct nfsd4_secinfo_no_name {
32804f4ad16SJ. Bruce Fields 	u32 sin_style;					/* request */
32904f4ad16SJ. Bruce Fields 	struct svc_export *sin_exp;			/* response */
33004f4ad16SJ. Bruce Fields };
33104f4ad16SJ. Bruce Fields 
3329a74af21SBoaz Harrosh struct nfsd4_setattr {
3339a74af21SBoaz Harrosh 	stateid_t	sa_stateid;         /* request */
3349a74af21SBoaz Harrosh 	u32		sa_bmval[3];        /* request */
3359a74af21SBoaz Harrosh 	struct iattr	sa_iattr;           /* request */
3369a74af21SBoaz Harrosh 	struct nfs4_acl *sa_acl;
33718032ca0SDavid Quigley 	struct xdr_netobj sa_label;
3389a74af21SBoaz Harrosh };
3399a74af21SBoaz Harrosh 
3409a74af21SBoaz Harrosh struct nfsd4_setclientid {
3419a74af21SBoaz Harrosh 	nfs4_verifier	se_verf;            /* request */
342a084daf5SJ. Bruce Fields 	struct xdr_netobj se_name;
3439a74af21SBoaz Harrosh 	u32		se_callback_prog;   /* request */
3449a74af21SBoaz Harrosh 	u32		se_callback_netid_len;  /* request */
3459a74af21SBoaz Harrosh 	char *		se_callback_netid_val;  /* request */
3469a74af21SBoaz Harrosh 	u32		se_callback_addr_len;   /* request */
3479a74af21SBoaz Harrosh 	char *		se_callback_addr_val;   /* request */
3489a74af21SBoaz Harrosh 	u32		se_callback_ident;  /* request */
3499a74af21SBoaz Harrosh 	clientid_t	se_clientid;        /* response */
3509a74af21SBoaz Harrosh 	nfs4_verifier	se_confirm;         /* response */
3519a74af21SBoaz Harrosh };
3529a74af21SBoaz Harrosh 
3539a74af21SBoaz Harrosh struct nfsd4_setclientid_confirm {
3549a74af21SBoaz Harrosh 	clientid_t	sc_clientid;
3559a74af21SBoaz Harrosh 	nfs4_verifier	sc_confirm;
3569a74af21SBoaz Harrosh };
3579a74af21SBoaz Harrosh 
35817456804SBryan Schumaker struct nfsd4_saved_compoundargs {
35917456804SBryan Schumaker 	__be32 *p;
36017456804SBryan Schumaker 	__be32 *end;
36117456804SBryan Schumaker 	int pagelen;
36217456804SBryan Schumaker 	struct page **pagelist;
36317456804SBryan Schumaker };
36417456804SBryan Schumaker 
36503cfb420SBryan Schumaker struct nfsd4_test_stateid_id {
36603cfb420SBryan Schumaker 	__be32			ts_id_status;
36703cfb420SBryan Schumaker 	stateid_t		ts_id_stateid;
36803cfb420SBryan Schumaker 	struct list_head	ts_id_list;
36903cfb420SBryan Schumaker };
37003cfb420SBryan Schumaker 
37117456804SBryan Schumaker struct nfsd4_test_stateid {
37257b7b43bSJ. Bruce Fields 	u32		ts_num_ids;
37303cfb420SBryan Schumaker 	struct list_head ts_stateid_list;
37417456804SBryan Schumaker };
37517456804SBryan Schumaker 
376e1ca12dfSBryan Schumaker struct nfsd4_free_stateid {
377e1ca12dfSBryan Schumaker 	stateid_t	fr_stateid;         /* request */
378e1ca12dfSBryan Schumaker };
379e1ca12dfSBryan Schumaker 
3809a74af21SBoaz Harrosh /* also used for NVERIFY */
3819a74af21SBoaz Harrosh struct nfsd4_verify {
3829a74af21SBoaz Harrosh 	u32		ve_bmval[3];        /* request */
3839a74af21SBoaz Harrosh 	u32		ve_attrlen;         /* request */
3849a74af21SBoaz Harrosh 	char *		ve_attrval;         /* request */
3859a74af21SBoaz Harrosh };
3869a74af21SBoaz Harrosh 
3879a74af21SBoaz Harrosh struct nfsd4_write {
3889a74af21SBoaz Harrosh 	stateid_t	wr_stateid;         /* request */
3899a74af21SBoaz Harrosh 	u64		wr_offset;          /* request */
3909a74af21SBoaz Harrosh 	u32		wr_stable_how;      /* request */
3919a74af21SBoaz Harrosh 	u32		wr_buflen;          /* request */
39270cc7f75SJ. Bruce Fields 	struct kvec	wr_head;
39370cc7f75SJ. Bruce Fields 	struct page **	wr_pagelist;        /* request */
3949a74af21SBoaz Harrosh 
3959a74af21SBoaz Harrosh 	u32		wr_bytes_written;   /* response */
3969a74af21SBoaz Harrosh 	u32		wr_how_written;     /* response */
3979a74af21SBoaz Harrosh 	nfs4_verifier	wr_verifier;        /* response */
3989a74af21SBoaz Harrosh };
3999a74af21SBoaz Harrosh 
4009a74af21SBoaz Harrosh struct nfsd4_exchange_id {
4019a74af21SBoaz Harrosh 	nfs4_verifier	verifier;
4029a74af21SBoaz Harrosh 	struct xdr_netobj clname;
4039a74af21SBoaz Harrosh 	u32		flags;
4049a74af21SBoaz Harrosh 	clientid_t	clientid;
4059a74af21SBoaz Harrosh 	u32		seqid;
4069a74af21SBoaz Harrosh 	int		spa_how;
407ed941643SAndrew Elble 	u32             spo_must_enforce[3];
408ed941643SAndrew Elble 	u32             spo_must_allow[3];
4099a74af21SBoaz Harrosh };
4109a74af21SBoaz Harrosh 
4119a74af21SBoaz Harrosh struct nfsd4_sequence {
4129a74af21SBoaz Harrosh 	struct nfs4_sessionid	sessionid;		/* request/response */
4139a74af21SBoaz Harrosh 	u32			seqid;			/* request/response */
4149a74af21SBoaz Harrosh 	u32			slotid;			/* request/response */
4159a74af21SBoaz Harrosh 	u32			maxslots;		/* request/response */
4169a74af21SBoaz Harrosh 	u32			cachethis;		/* request */
4179a74af21SBoaz Harrosh #if 0
4189a74af21SBoaz Harrosh 	u32			target_maxslots;	/* response */
4199a74af21SBoaz Harrosh #endif /* not yet */
4200d7bb719SJ. Bruce Fields 	u32			status_flags;		/* response */
4219a74af21SBoaz Harrosh };
4229a74af21SBoaz Harrosh 
4239a74af21SBoaz Harrosh struct nfsd4_destroy_session {
4249a74af21SBoaz Harrosh 	struct nfs4_sessionid	sessionid;
4259a74af21SBoaz Harrosh };
4269a74af21SBoaz Harrosh 
427345c2842SMi Jinlong struct nfsd4_destroy_clientid {
428345c2842SMi Jinlong 	clientid_t clientid;
429345c2842SMi Jinlong };
430345c2842SMi Jinlong 
4314dc6ec00SJ. Bruce Fields struct nfsd4_reclaim_complete {
4324dc6ec00SJ. Bruce Fields 	u32 rca_one_fs;
4334dc6ec00SJ. Bruce Fields };
4344dc6ec00SJ. Bruce Fields 
4359cf514ccSChristoph Hellwig struct nfsd4_deviceid {
4369cf514ccSChristoph Hellwig 	u64			fsid_idx;
4379cf514ccSChristoph Hellwig 	u32			generation;
4389cf514ccSChristoph Hellwig 	u32			pad;
4399cf514ccSChristoph Hellwig };
4409cf514ccSChristoph Hellwig 
4419cf514ccSChristoph Hellwig struct nfsd4_layout_seg {
4429cf514ccSChristoph Hellwig 	u32			iomode;
4439cf514ccSChristoph Hellwig 	u64			offset;
4449cf514ccSChristoph Hellwig 	u64			length;
4459cf514ccSChristoph Hellwig };
4469cf514ccSChristoph Hellwig 
4479cf514ccSChristoph Hellwig struct nfsd4_getdeviceinfo {
4489cf514ccSChristoph Hellwig 	struct nfsd4_deviceid	gd_devid;	/* request */
4499cf514ccSChristoph Hellwig 	u32			gd_layout_type;	/* request */
4509cf514ccSChristoph Hellwig 	u32			gd_maxcount;	/* request */
4519cf514ccSChristoph Hellwig 	u32			gd_notify_types;/* request - response */
4529cf514ccSChristoph Hellwig 	void			*gd_device;	/* response */
4539cf514ccSChristoph Hellwig };
4549cf514ccSChristoph Hellwig 
4559cf514ccSChristoph Hellwig struct nfsd4_layoutget {
4569cf514ccSChristoph Hellwig 	u64			lg_minlength;	/* request */
4579cf514ccSChristoph Hellwig 	u32			lg_signal;	/* request */
4589cf514ccSChristoph Hellwig 	u32			lg_layout_type;	/* request */
4599cf514ccSChristoph Hellwig 	u32			lg_maxcount;	/* request */
4609cf514ccSChristoph Hellwig 	stateid_t		lg_sid;		/* request/response */
4619cf514ccSChristoph Hellwig 	struct nfsd4_layout_seg	lg_seg;		/* request/response */
4629cf514ccSChristoph Hellwig 	void			*lg_content;	/* response */
4639cf514ccSChristoph Hellwig };
4649cf514ccSChristoph Hellwig 
4659cf514ccSChristoph Hellwig struct nfsd4_layoutcommit {
4669cf514ccSChristoph Hellwig 	stateid_t		lc_sid;		/* request */
4679cf514ccSChristoph Hellwig 	struct nfsd4_layout_seg	lc_seg;		/* request */
4689cf514ccSChristoph Hellwig 	u32			lc_reclaim;	/* request */
4699cf514ccSChristoph Hellwig 	u32			lc_newoffset;	/* request */
4709cf514ccSChristoph Hellwig 	u64			lc_last_wr;	/* request */
4719cf514ccSChristoph Hellwig 	struct timespec		lc_mtime;	/* request */
4729cf514ccSChristoph Hellwig 	u32			lc_layout_type;	/* request */
4739cf514ccSChristoph Hellwig 	u32			lc_up_len;	/* layout length */
4749cf514ccSChristoph Hellwig 	void			*lc_up_layout;	/* decoded by callback */
4759cf514ccSChristoph Hellwig 	u32			lc_size_chg;	/* boolean for response */
4769cf514ccSChristoph Hellwig 	u64			lc_newsize;	/* response */
4779cf514ccSChristoph Hellwig };
4789cf514ccSChristoph Hellwig 
4799cf514ccSChristoph Hellwig struct nfsd4_layoutreturn {
4809cf514ccSChristoph Hellwig 	u32			lr_return_type;	/* request */
4819cf514ccSChristoph Hellwig 	u32			lr_layout_type;	/* request */
4829cf514ccSChristoph Hellwig 	struct nfsd4_layout_seg	lr_seg;		/* request */
4839cf514ccSChristoph Hellwig 	u32			lr_reclaim;	/* request */
4849cf514ccSChristoph Hellwig 	u32			lrf_body_len;	/* request */
4859cf514ccSChristoph Hellwig 	void			*lrf_body;	/* request */
4869cf514ccSChristoph Hellwig 	stateid_t		lr_sid;		/* request/response */
4879cf514ccSChristoph Hellwig 	u32			lrs_present;	/* response */
4889cf514ccSChristoph Hellwig };
4899cf514ccSChristoph Hellwig 
49095d871f0SAnna Schumaker struct nfsd4_fallocate {
49195d871f0SAnna Schumaker 	/* request */
49295d871f0SAnna Schumaker 	stateid_t	falloc_stateid;
49395d871f0SAnna Schumaker 	loff_t		falloc_offset;
49495d871f0SAnna Schumaker 	u64		falloc_length;
49595d871f0SAnna Schumaker };
49695d871f0SAnna Schumaker 
497ffa0160aSChristoph Hellwig struct nfsd4_clone {
498ffa0160aSChristoph Hellwig 	/* request */
499ffa0160aSChristoph Hellwig 	stateid_t	cl_src_stateid;
500ffa0160aSChristoph Hellwig 	stateid_t	cl_dst_stateid;
501ffa0160aSChristoph Hellwig 	u64		cl_src_pos;
502ffa0160aSChristoph Hellwig 	u64		cl_dst_pos;
503ffa0160aSChristoph Hellwig 	u64		cl_count;
504ffa0160aSChristoph Hellwig };
505ffa0160aSChristoph Hellwig 
50629ae7f9dSAnna Schumaker struct nfsd42_write_res {
50729ae7f9dSAnna Schumaker 	u64			wr_bytes_written;
50829ae7f9dSAnna Schumaker 	u32			wr_stable_how;
50929ae7f9dSAnna Schumaker 	nfs4_verifier		wr_verifier;
51029ae7f9dSAnna Schumaker };
51129ae7f9dSAnna Schumaker 
51229ae7f9dSAnna Schumaker struct nfsd4_copy {
51329ae7f9dSAnna Schumaker 	/* request */
51429ae7f9dSAnna Schumaker 	stateid_t	cp_src_stateid;
51529ae7f9dSAnna Schumaker 	stateid_t	cp_dst_stateid;
51629ae7f9dSAnna Schumaker 	u64		cp_src_pos;
51729ae7f9dSAnna Schumaker 	u64		cp_dst_pos;
51829ae7f9dSAnna Schumaker 	u64		cp_count;
51929ae7f9dSAnna Schumaker 
52029ae7f9dSAnna Schumaker 	/* both */
52129ae7f9dSAnna Schumaker 	bool		cp_consecutive;
52229ae7f9dSAnna Schumaker 	bool		cp_synchronous;
52329ae7f9dSAnna Schumaker 
52429ae7f9dSAnna Schumaker 	/* response */
52529ae7f9dSAnna Schumaker 	struct nfsd42_write_res	cp_res;
52629ae7f9dSAnna Schumaker };
52729ae7f9dSAnna Schumaker 
52824bab491SAnna Schumaker struct nfsd4_seek {
52924bab491SAnna Schumaker 	/* request */
53024bab491SAnna Schumaker 	stateid_t	seek_stateid;
53124bab491SAnna Schumaker 	loff_t		seek_offset;
53224bab491SAnna Schumaker 	u32		seek_whence;
53324bab491SAnna Schumaker 
53424bab491SAnna Schumaker 	/* response */
53524bab491SAnna Schumaker 	u32		seek_eof;
53624bab491SAnna Schumaker 	loff_t		seek_pos;
53724bab491SAnna Schumaker };
53824bab491SAnna Schumaker 
5399a74af21SBoaz Harrosh struct nfsd4_op {
5409a74af21SBoaz Harrosh 	int					opnum;
5419a74af21SBoaz Harrosh 	__be32					status;
5429a74af21SBoaz Harrosh 	union {
5439a74af21SBoaz Harrosh 		struct nfsd4_access		access;
5449a74af21SBoaz Harrosh 		struct nfsd4_close		close;
5459a74af21SBoaz Harrosh 		struct nfsd4_commit		commit;
5469a74af21SBoaz Harrosh 		struct nfsd4_create		create;
5479a74af21SBoaz Harrosh 		struct nfsd4_delegreturn	delegreturn;
5489a74af21SBoaz Harrosh 		struct nfsd4_getattr		getattr;
5499a74af21SBoaz Harrosh 		struct svc_fh *			getfh;
5509a74af21SBoaz Harrosh 		struct nfsd4_link		link;
5519a74af21SBoaz Harrosh 		struct nfsd4_lock		lock;
5529a74af21SBoaz Harrosh 		struct nfsd4_lockt		lockt;
5539a74af21SBoaz Harrosh 		struct nfsd4_locku		locku;
5549a74af21SBoaz Harrosh 		struct nfsd4_lookup		lookup;
5559a74af21SBoaz Harrosh 		struct nfsd4_verify		nverify;
5569a74af21SBoaz Harrosh 		struct nfsd4_open		open;
5579a74af21SBoaz Harrosh 		struct nfsd4_open_confirm	open_confirm;
5589a74af21SBoaz Harrosh 		struct nfsd4_open_downgrade	open_downgrade;
5599a74af21SBoaz Harrosh 		struct nfsd4_putfh		putfh;
5609a74af21SBoaz Harrosh 		struct nfsd4_read		read;
5619a74af21SBoaz Harrosh 		struct nfsd4_readdir		readdir;
5629a74af21SBoaz Harrosh 		struct nfsd4_readlink		readlink;
5639a74af21SBoaz Harrosh 		struct nfsd4_remove		remove;
5649a74af21SBoaz Harrosh 		struct nfsd4_rename		rename;
5659a74af21SBoaz Harrosh 		clientid_t			renew;
5669a74af21SBoaz Harrosh 		struct nfsd4_secinfo		secinfo;
5679a74af21SBoaz Harrosh 		struct nfsd4_setattr		setattr;
5689a74af21SBoaz Harrosh 		struct nfsd4_setclientid	setclientid;
5699a74af21SBoaz Harrosh 		struct nfsd4_setclientid_confirm setclientid_confirm;
5709a74af21SBoaz Harrosh 		struct nfsd4_verify		verify;
5719a74af21SBoaz Harrosh 		struct nfsd4_write		write;
5729a74af21SBoaz Harrosh 		struct nfsd4_release_lockowner	release_lockowner;
5739a74af21SBoaz Harrosh 
5749a74af21SBoaz Harrosh 		/* NFSv4.1 */
5759a74af21SBoaz Harrosh 		struct nfsd4_exchange_id	exchange_id;
576cb73a9f4SJ. Bruce Fields 		struct nfsd4_backchannel_ctl	backchannel_ctl;
5771d1bc8f2SJ. Bruce Fields 		struct nfsd4_bind_conn_to_session bind_conn_to_session;
5789a74af21SBoaz Harrosh 		struct nfsd4_create_session	create_session;
5799a74af21SBoaz Harrosh 		struct nfsd4_destroy_session	destroy_session;
5809a74af21SBoaz Harrosh 		struct nfsd4_sequence		sequence;
5814dc6ec00SJ. Bruce Fields 		struct nfsd4_reclaim_complete	reclaim_complete;
58217456804SBryan Schumaker 		struct nfsd4_test_stateid	test_stateid;
583e1ca12dfSBryan Schumaker 		struct nfsd4_free_stateid	free_stateid;
5849cf514ccSChristoph Hellwig 		struct nfsd4_getdeviceinfo	getdeviceinfo;
5859cf514ccSChristoph Hellwig 		struct nfsd4_layoutget		layoutget;
5869cf514ccSChristoph Hellwig 		struct nfsd4_layoutcommit	layoutcommit;
5879cf514ccSChristoph Hellwig 		struct nfsd4_layoutreturn	layoutreturn;
58824bab491SAnna Schumaker 
58924bab491SAnna Schumaker 		/* NFSv4.2 */
59095d871f0SAnna Schumaker 		struct nfsd4_fallocate		allocate;
591b0cb9085SAnna Schumaker 		struct nfsd4_fallocate		deallocate;
592ffa0160aSChristoph Hellwig 		struct nfsd4_clone		clone;
59329ae7f9dSAnna Schumaker 		struct nfsd4_copy		copy;
59424bab491SAnna Schumaker 		struct nfsd4_seek		seek;
5959a74af21SBoaz Harrosh 	} u;
5969a74af21SBoaz Harrosh 	struct nfs4_replay *			replay;
5979a74af21SBoaz Harrosh };
5989a74af21SBoaz Harrosh 
5991091006cSJ. Bruce Fields bool nfsd4_cache_this_op(struct nfsd4_op *);
6001091006cSJ. Bruce Fields 
601d5e23383SJ. Bruce Fields /*
602d5e23383SJ. Bruce Fields  * Memory needed just for the duration of processing one compound:
603d5e23383SJ. Bruce Fields  */
604d5e23383SJ. Bruce Fields struct svcxdr_tmpbuf {
605d5e23383SJ. Bruce Fields 	struct svcxdr_tmpbuf *next;
606d5e23383SJ. Bruce Fields 	char buf[];
607d5e23383SJ. Bruce Fields };
608d5e23383SJ. Bruce Fields 
6099a74af21SBoaz Harrosh struct nfsd4_compoundargs {
6109a74af21SBoaz Harrosh 	/* scratch variables for XDR decode */
6119a74af21SBoaz Harrosh 	__be32 *			p;
6129a74af21SBoaz Harrosh 	__be32 *			end;
6139a74af21SBoaz Harrosh 	struct page **			pagelist;
6149a74af21SBoaz Harrosh 	int				pagelen;
6159a74af21SBoaz Harrosh 	__be32				tmp[8];
6169a74af21SBoaz Harrosh 	__be32 *			tmpp;
617d5e23383SJ. Bruce Fields 	struct svcxdr_tmpbuf		*to_free;
6189a74af21SBoaz Harrosh 
6199a74af21SBoaz Harrosh 	struct svc_rqst			*rqstp;
6209a74af21SBoaz Harrosh 
6219a74af21SBoaz Harrosh 	u32				taglen;
6229a74af21SBoaz Harrosh 	char *				tag;
6239a74af21SBoaz Harrosh 	u32				minorversion;
6249a74af21SBoaz Harrosh 	u32				opcnt;
6259a74af21SBoaz Harrosh 	struct nfsd4_op			*ops;
6269a74af21SBoaz Harrosh 	struct nfsd4_op			iops[8];
6271091006cSJ. Bruce Fields 	int				cachetype;
6289a74af21SBoaz Harrosh };
6299a74af21SBoaz Harrosh 
6309a74af21SBoaz Harrosh struct nfsd4_compoundres {
6319a74af21SBoaz Harrosh 	/* scratch variables for XDR encode */
6324aea24b2SJ. Bruce Fields 	struct xdr_stream		xdr;
6339a74af21SBoaz Harrosh 	struct svc_rqst *		rqstp;
6349a74af21SBoaz Harrosh 
6359a74af21SBoaz Harrosh 	u32				taglen;
6369a74af21SBoaz Harrosh 	char *				tag;
6379a74af21SBoaz Harrosh 	u32				opcnt;
6389a74af21SBoaz Harrosh 	__be32 *			tagp; /* tag, opcount encode location */
6399a74af21SBoaz Harrosh 	struct nfsd4_compound_state	cstate;
6409a74af21SBoaz Harrosh };
6419a74af21SBoaz Harrosh 
6429a74af21SBoaz Harrosh static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
6439a74af21SBoaz Harrosh {
6449a74af21SBoaz Harrosh 	struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
6459a74af21SBoaz Harrosh 	return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
6469a74af21SBoaz Harrosh }
6479a74af21SBoaz Harrosh 
6489a74af21SBoaz Harrosh static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
6499a74af21SBoaz Harrosh {
65073e79482SJ. Bruce Fields 	return !(resp->cstate.slot->sl_flags & NFSD4_SLOT_CACHETHIS)
65173e79482SJ. Bruce Fields 		|| nfsd4_is_solo_sequence(resp);
6529a74af21SBoaz Harrosh }
6539a74af21SBoaz Harrosh 
6549b3234b9SJ. Bruce Fields static inline bool nfsd4_last_compound_op(struct svc_rqst *rqstp)
6559b3234b9SJ. Bruce Fields {
6569b3234b9SJ. Bruce Fields 	struct nfsd4_compoundres *resp = rqstp->rq_resp;
6579b3234b9SJ. Bruce Fields 	struct nfsd4_compoundargs *argp = rqstp->rq_argp;
6589b3234b9SJ. Bruce Fields 
6599b3234b9SJ. Bruce Fields 	return argp->opcnt == resp->opcnt;
6609b3234b9SJ. Bruce Fields }
6619b3234b9SJ. Bruce Fields 
6624f0cefbfSJ. Bruce Fields int nfsd4_max_reply(struct svc_rqst *rqstp, struct nfsd4_op *op);
66307d1f802SJ. Bruce Fields void warn_on_nonidempotent_op(struct nfsd4_op *op);
66407d1f802SJ. Bruce Fields 
6659a74af21SBoaz Harrosh #define NFS4_SVC_XDRSIZE		sizeof(struct nfsd4_compoundargs)
6669a74af21SBoaz Harrosh 
6679a74af21SBoaz Harrosh static inline void
6689a74af21SBoaz Harrosh set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
6699a74af21SBoaz Harrosh {
670c1ac3ffcSNeil Brown 	BUG_ON(!fhp->fh_pre_saved);
671aaf91ec1SJeff Layton 	cinfo->atomic = (u32)fhp->fh_post_saved;
6722b0143b5SDavid Howells 	cinfo->change_supported = IS_I_VERSION(d_inode(fhp->fh_dentry));
673c1ac3ffcSNeil Brown 
6749a74af21SBoaz Harrosh 	cinfo->before_change = fhp->fh_pre_change;
6759a74af21SBoaz Harrosh 	cinfo->after_change = fhp->fh_post_change;
6769a74af21SBoaz Harrosh 	cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
6779a74af21SBoaz Harrosh 	cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
6789a74af21SBoaz Harrosh 	cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec;
6799a74af21SBoaz Harrosh 	cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec;
680c1ac3ffcSNeil Brown 
6819a74af21SBoaz Harrosh }
6829a74af21SBoaz Harrosh 
683dedeb13fSAndrew Elble 
684dedeb13fSAndrew Elble bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp);
6859a74af21SBoaz Harrosh int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
686026fec7eSChristoph Hellwig int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *);
6879a74af21SBoaz Harrosh int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *,
6889a74af21SBoaz Harrosh 		struct nfsd4_compoundres *);
68957b7b43bSJ. Bruce Fields __be32 nfsd4_check_resp_size(struct nfsd4_compoundres *, u32);
6909a74af21SBoaz Harrosh void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
691d0a381ddSJ. Bruce Fields void nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op);
692d5184658SJ. Bruce Fields __be32 nfsd4_encode_fattr_to_buf(__be32 **p, int words,
693d5184658SJ. Bruce Fields 		struct svc_fh *fhp, struct svc_export *exp,
694d5184658SJ. Bruce Fields 		struct dentry *dentry,
6959a74af21SBoaz Harrosh 		u32 *bmval, struct svc_rqst *, int ignore_crossmnt);
6969a74af21SBoaz Harrosh extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
6979a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
6989a74af21SBoaz Harrosh 		struct nfsd4_setclientid *setclid);
6999a74af21SBoaz Harrosh extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
7009a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
7019a74af21SBoaz Harrosh 		struct nfsd4_setclientid_confirm *setclientid_confirm);
7029a74af21SBoaz Harrosh extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp,
7033c4ab2aaSJ. Bruce Fields 		struct nfsd4_compound_state *, struct nfsd4_exchange_id *);
704cb73a9f4SJ. Bruce Fields extern __be32 nfsd4_backchannel_ctl(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_backchannel_ctl *);
7051d1bc8f2SJ. Bruce Fields extern __be32 nfsd4_bind_conn_to_session(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_bind_conn_to_session *);
7069a74af21SBoaz Harrosh extern __be32 nfsd4_create_session(struct svc_rqst *,
7079a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
7089a74af21SBoaz Harrosh 		struct nfsd4_create_session *);
7099a74af21SBoaz Harrosh extern __be32 nfsd4_sequence(struct svc_rqst *,
7109a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
7119a74af21SBoaz Harrosh 		struct nfsd4_sequence *);
712b607664eSTrond Myklebust extern void nfsd4_sequence_done(struct nfsd4_compoundres *resp);
7139a74af21SBoaz Harrosh extern __be32 nfsd4_destroy_session(struct svc_rqst *,
7149a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
7159a74af21SBoaz Harrosh 		struct nfsd4_destroy_session *);
716345c2842SMi Jinlong extern __be32 nfsd4_destroy_clientid(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_destroy_clientid *);
7174dc6ec00SJ. Bruce Fields __be32 nfsd4_reclaim_complete(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_reclaim_complete *);
7189a74af21SBoaz Harrosh extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *,
7193320fef1SStanislav Kinsbursky 		struct nfsd4_open *open, struct nfsd_net *nn);
7209a74af21SBoaz Harrosh extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
7219a74af21SBoaz Harrosh 		struct svc_fh *current_fh, struct nfsd4_open *open);
72258fb12e6SJeff Layton extern void nfsd4_cstate_clear_replay(struct nfsd4_compound_state *cstate);
72358fb12e6SJeff Layton extern void nfsd4_cleanup_open_state(struct nfsd4_compound_state *cstate,
72442297899SJeff Layton 		struct nfsd4_open *open);
7259a74af21SBoaz Harrosh extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
7269a74af21SBoaz Harrosh 		struct nfsd4_compound_state *, struct nfsd4_open_confirm *oc);
7279a74af21SBoaz Harrosh extern __be32 nfsd4_close(struct svc_rqst *rqstp,
7289a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
7299a74af21SBoaz Harrosh 		struct nfsd4_close *close);
7309a74af21SBoaz Harrosh extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
7319a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
7329a74af21SBoaz Harrosh 		struct nfsd4_open_downgrade *od);
7339a74af21SBoaz Harrosh extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
7349a74af21SBoaz Harrosh 		struct nfsd4_lock *lock);
7359a74af21SBoaz Harrosh extern __be32 nfsd4_lockt(struct svc_rqst *rqstp,
7369a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
7379a74af21SBoaz Harrosh 		struct nfsd4_lockt *lockt);
7389a74af21SBoaz Harrosh extern __be32 nfsd4_locku(struct svc_rqst *rqstp,
7399a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
7409a74af21SBoaz Harrosh 		struct nfsd4_locku *locku);
7419a74af21SBoaz Harrosh extern __be32
7429a74af21SBoaz Harrosh nfsd4_release_lockowner(struct svc_rqst *rqstp,
7439a74af21SBoaz Harrosh 		struct nfsd4_compound_state *,
7449a74af21SBoaz Harrosh 		struct nfsd4_release_lockowner *rlockowner);
7458537488bSChristoph Hellwig extern void nfsd4_release_compoundargs(struct svc_rqst *rqstp);
7469a74af21SBoaz Harrosh extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp,
7479a74af21SBoaz Harrosh 		struct nfsd4_compound_state *, struct nfsd4_delegreturn *dr);
7489a74af21SBoaz Harrosh extern __be32 nfsd4_renew(struct svc_rqst *rqstp,
7499a74af21SBoaz Harrosh 			  struct nfsd4_compound_state *, clientid_t *clid);
75017456804SBryan Schumaker extern __be32 nfsd4_test_stateid(struct svc_rqst *rqstp,
75117456804SBryan Schumaker 		struct nfsd4_compound_state *, struct nfsd4_test_stateid *test_stateid);
752e1ca12dfSBryan Schumaker extern __be32 nfsd4_free_stateid(struct svc_rqst *rqstp,
753e1ca12dfSBryan Schumaker 		struct nfsd4_compound_state *, struct nfsd4_free_stateid *free_stateid);
7549411b1d4SJ. Bruce Fields extern void nfsd4_bump_seqid(struct nfsd4_compound_state *, __be32 nfserr);
75558fb12e6SJeff Layton 
7569a74af21SBoaz Harrosh #endif
7579a74af21SBoaz Harrosh 
7589a74af21SBoaz Harrosh /*
7599a74af21SBoaz Harrosh  * Local variables:
7609a74af21SBoaz Harrosh  *  c-basic-offset: 8
7619a74af21SBoaz Harrosh  * End:
7629a74af21SBoaz Harrosh  */
763