Blame view

fs/nfsd/xdr4.h 25.8 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
   *  Server-side types for NFSv4.
   *
   *  Copyright (c) 2002 The Regents of the University of Michigan.
   *  All rights reserved.
   *
   *  Kendrick Smith <kmsmith@umich.edu>
   *  Andy Adamson   <andros@umich.edu>
   *
   *  Redistribution and use in source and binary forms, with or without
   *  modification, are permitted provided that the following conditions
   *  are met:
   *
   *  1. Redistributions of source code must retain the above copyright
   *     notice, this list of conditions and the following disclaimer.
   *  2. Redistributions in binary form must reproduce the above copyright
   *     notice, this list of conditions and the following disclaimer in the
   *     documentation and/or other materials provided with the distribution.
   *  3. Neither the name of the University nor the names of its
   *     contributors may be used to endorse or promote products derived
   *     from this software without specific prior written permission.
   *
   *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
   *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
   *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
   *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   */
  
  #ifndef _LINUX_NFSD_XDR4_H
  #define _LINUX_NFSD_XDR4_H
9a74af213   Boaz Harrosh   nfsd: Move privat...
39
40
  #include "state.h"
  #include "nfsd.h"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
42
43
  
  #define NFSD4_MAX_TAGLEN	128
  #define XDR_LEN(n)                     (((n) + 3) & ~3)
37c593c57   Tigran Mkrtchyan   nfsd41: use curre...
44
45
  #define CURRENT_STATE_ID_FLAG (1<<0)
  #define SAVED_STATE_ID_FLAG (1<<1)
51100d2b8   Olga Kornievskaia   NFSD generalize n...
46
47
48
  #define SET_CSTATE_FLAG(c, f) ((c)->sid_flags |= (f))
  #define HAS_CSTATE_FLAG(c, f) ((c)->sid_flags & (f))
  #define CLEAR_CSTATE_FLAG(c, f) ((c)->sid_flags &= ~(f))
37c593c57   Tigran Mkrtchyan   nfsd41: use curre...
49

ca3643171   J.Bruce Fields   [PATCH] knfsd: nf...
50
  struct nfsd4_compound_state {
e354d571b   Andy Adamson   nfsd: embed nfsd4...
51
52
53
  	struct svc_fh		current_fh;
  	struct svc_fh		save_fh;
  	struct nfs4_stateowner	*replay_owner;
4b24ca7d3   Jeff Layton   nfsd: Allow struc...
54
  	struct nfs4_client	*clp;
b85d4c01b   Benny Halevy   nfsd41: sequence ...
55
56
57
  	/* For sessions DRC */
  	struct nfsd4_session	*session;
  	struct nfsd4_slot	*slot;
f5236013a   J. Bruce Fields   nfsd4: convert 4....
58
  	int			data_offset;
ed9416439   Andrew Elble   nfsd: implement m...
59
  	bool                    spo_must_allowed;
da3846a28   Andy Adamson   nfsd41: nfsd DRC ...
60
  	size_t			iovlen;
d87a8ade9   Andy Adamson   nfsd41: access_valid
61
  	u32			minorversion;
57b7b43b4   J. Bruce Fields   nfsd4: int/__be32...
62
  	__be32			status;
37c593c57   Tigran Mkrtchyan   nfsd41: use curre...
63
64
65
66
  	stateid_t	current_stateid;
  	stateid_t	save_stateid;
  	/* to indicate current and saved state id presents */
  	u32		sid_flags;
ca3643171   J.Bruce Fields   [PATCH] knfsd: nf...
67
  };
6668958fa   Andy Adamson   nfsd41: stateid h...
68
69
70
71
  static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
  {
  	return cs->slot != NULL;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72
73
  struct nfsd4_change_info {
  	u32		atomic;
c654b8a9c   J. Bruce Fields   nfsd: support ext...
74
  	bool		change_supported;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
76
  	u32		before_ctime_sec;
  	u32		before_ctime_nsec;
c654b8a9c   J. Bruce Fields   nfsd: support ext...
77
  	u64		before_change;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
79
  	u32		after_ctime_sec;
  	u32		after_ctime_nsec;
c654b8a9c   J. Bruce Fields   nfsd: support ext...
80
  	u64		after_change;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
81
82
83
84
85
86
87
88
89
90
91
  };
  
  struct nfsd4_access {
  	u32		ac_req_access;      /* request */
  	u32		ac_supported;       /* response */
  	u32		ac_resp_access;     /* response */
  };
  
  struct nfsd4_close {
  	u32		cl_seqid;           /* request */
  	stateid_t	cl_stateid;         /* request+response */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
92
93
94
95
96
97
98
99
100
101
102
103
104
105
  };
  
  struct nfsd4_commit {
  	u64		co_offset;          /* request */
  	u32		co_count;           /* request */
  	nfs4_verifier	co_verf;            /* response */
  };
  
  struct nfsd4_create {
  	u32		cr_namelen;         /* request */
  	char *		cr_name;            /* request */
  	u32		cr_type;            /* request */
  	union {                             /* request */
  		struct {
7fb84306f   J. Bruce Fields   nfsd4: rename cr_...
106
107
  			u32 datalen;
  			char *data;
38a703155   Chuck Lever   NFSD: Clean up le...
108
  			struct kvec first;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
109
110
111
112
113
114
  		} link;   /* NF4LNK */
  		struct {
  			u32 specdata1;
  			u32 specdata2;
  		} dev;    /* NF4BLK, NF4CHR */
  	} u;
7e7057064   Andy Adamson   nfsd41: support f...
115
  	u32		cr_bmval[3];        /* request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
116
  	struct iattr	cr_iattr;           /* request */
880a3a532   J. Bruce Fields   nfsd: fix incorre...
117
  	int		cr_umask;           /* request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
118
119
  	struct nfsd4_change_info  cr_cinfo; /* response */
  	struct nfs4_acl *cr_acl;
18032ca06   David Quigley   NFSD: Server impl...
120
  	struct xdr_netobj cr_label;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
121
  };
7fb84306f   J. Bruce Fields   nfsd4: rename cr_...
122
123
  #define cr_datalen	u.link.datalen
  #define cr_data		u.link.data
38a703155   Chuck Lever   NFSD: Clean up le...
124
  #define cr_first	u.link.first
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
125
126
127
128
129
130
131
132
  #define cr_specdata1	u.dev.specdata1
  #define cr_specdata2	u.dev.specdata2
  
  struct nfsd4_delegreturn {
  	stateid_t	dr_stateid;
  };
  
  struct nfsd4_getattr {
7e7057064   Andy Adamson   nfsd41: support f...
133
  	u32		ga_bmval[3];        /* request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
134
135
136
137
138
139
140
141
142
143
144
  	struct svc_fh	*ga_fhp;            /* response */
  };
  
  struct nfsd4_link {
  	u32		li_namelen;         /* request */
  	char *		li_name;            /* request */
  	struct nfsd4_change_info  li_cinfo; /* response */
  };
  
  struct nfsd4_lock_denied {
  	clientid_t	ld_clientid;
7c13f344c   J. Bruce Fields   nfsd4: drop most ...
145
  	struct xdr_netobj	ld_owner;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
  	u64             ld_start;
  	u64             ld_length;
  	u32             ld_type;
  };
  
  struct nfsd4_lock {
  	/* request */
  	u32             lk_type;
  	u32             lk_reclaim;         /* boolean */
  	u64             lk_offset;
  	u64             lk_length;
  	u32             lk_is_new;
  	union {
  		struct {
  			u32             open_seqid;
  			stateid_t       open_stateid;
  			u32             lock_seqid;
  			clientid_t      clientid;
  			struct xdr_netobj owner;
  		} new;
  		struct {
  			stateid_t       lock_stateid;
  			u32             lock_seqid;
  		} old;
  	} v;
  
  	/* response */
  	union {
  		struct {
  			stateid_t               stateid;
  		} ok;
  		struct nfsd4_lock_denied        denied;
  	} u;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
179
180
181
182
183
184
185
186
  };
  #define lk_new_open_seqid       v.new.open_seqid
  #define lk_new_open_stateid     v.new.open_stateid
  #define lk_new_lock_seqid       v.new.lock_seqid
  #define lk_new_clientid         v.new.clientid
  #define lk_new_owner            v.new.owner
  #define lk_old_lock_stateid     v.old.lock_stateid
  #define lk_old_lock_seqid       v.old.lock_seqid
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
187
188
189
190
191
192
193
194
195
196
  #define lk_resp_stateid u.ok.stateid
  #define lk_denied       u.denied
  
  
  struct nfsd4_lockt {
  	u32				lt_type;
  	clientid_t			lt_clientid;
  	struct xdr_netobj		lt_owner;
  	u64				lt_offset;
  	u64				lt_length;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
197
198
199
200
201
202
203
204
205
206
  	struct nfsd4_lock_denied  	lt_denied;
  };
  
   
  struct nfsd4_locku {
  	u32             lu_type;
  	u32             lu_seqid;
  	stateid_t       lu_stateid;
  	u64             lu_offset;
  	u64             lu_length;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
207
208
209
210
211
212
213
214
215
216
217
  };
  
  
  struct nfsd4_lookup {
  	u32		lo_len;             /* request */
  	char *		lo_name;            /* request */
  };
  
  struct nfsd4_putfh {
  	u32		pf_fhlen;           /* request */
  	char		*pf_fhval;          /* request */
b9e8638e3   Olga Kornievskaia   NFSD: allow inter...
218
  	bool		no_verify;	    /* represents foreigh fh */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
219
  };
6178713bd   Frank van der Linden   nfsd: add structu...
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
  struct nfsd4_getxattr {
  	char		*getxa_name;		/* request */
  	u32		getxa_len;		/* request */
  	void		*getxa_buf;
  };
  
  struct nfsd4_setxattr {
  	u32		setxa_flags;		/* request */
  	char		*setxa_name;		/* request */
  	char		*setxa_buf;		/* request */
  	u32		setxa_len;		/* request */
  	struct nfsd4_change_info  setxa_cinfo;	/* response */
  };
  
  struct nfsd4_removexattr {
  	char		*rmxa_name;		/* request */
  	struct nfsd4_change_info  rmxa_cinfo;	/* response */
  };
  
  struct nfsd4_listxattrs {
  	u64		lsxa_cookie;		/* request */
  	u32		lsxa_maxcount;		/* request */
  	char		*lsxa_buf;		/* unfiltered buffer (reply) */
  	u32		lsxa_len;		/* unfiltered len (reply) */
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
245
246
247
248
249
  struct nfsd4_open {
  	u32		op_claim_type;      /* request */
  	struct xdr_netobj op_fname;	    /* request - everything but CLAIM_PREV */
  	u32		op_delegate_type;   /* request - CLAIM_PREV only */
  	stateid_t       op_delegate_stateid; /* request - response */
d24433cdc   Benny Halevy   nfsd41: implement...
250
  	u32		op_why_no_deleg;    /* response - DELEG_NONE_EXT only */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
251
252
  	u32		op_create;     	    /* request */
  	u32		op_createmode;      /* request */
880a3a532   J. Bruce Fields   nfsd: fix incorre...
253
  	int		op_umask;           /* request */
7e7057064   Andy Adamson   nfsd41: support f...
254
  	u32		op_bmval[3];        /* request */
3ff69309f   Kinglong Mee   Define op_iattr f...
255
  	struct iattr	op_iattr;           /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */
ab4684d15   Chuck Lever   NFSD: Fix nfs4_ve...
256
257
  	nfs4_verifier	op_verf __attribute__((aligned(32)));
  					    /* EXCLUSIVE4 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
258
259
260
261
262
  	clientid_t	op_clientid;        /* request */
  	struct xdr_netobj op_owner;           /* request */
  	u32		op_seqid;           /* request */
  	u32		op_share_access;    /* request */
  	u32		op_share_deny;      /* request */
2c8bd7e0d   Benny Halevy   nfsd41: split out...
263
  	u32		op_deleg_want;      /* request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
264
  	stateid_t	op_stateid;         /* response */
9d313b17d   J. Bruce Fields   nfsd4: handle seq...
265
  	__be32		op_xdr_error;       /* see nfsd4_open_omfg() */
7b190fecf   NeilBrown   [PATCH] knfsd: nf...
266
  	u32		op_recall;          /* recall */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
267
268
  	struct nfsd4_change_info  op_cinfo; /* response */
  	u32		op_rflags;          /* response */
856121b2e   J. Bruce Fields   nfsd4: warn on op...
269
270
  	bool		op_truncate;        /* used during processing */
  	bool		op_created;         /* used during processing */
fe0750e5c   J. Bruce Fields   nfsd4: split stat...
271
  	struct nfs4_openowner *op_openowner; /* used during processing */
32513b40e   J. Bruce Fields   nfsd4: preallocat...
272
  	struct nfs4_file *op_file;          /* used during processing */
4cdc951b8   J. Bruce Fields   nfsd4: preallocat...
273
  	struct nfs4_ol_stateid *op_stp;	    /* used during processing */
8287f009b   Sachin Bhamare   nfsd: fix pNFS re...
274
  	struct nfs4_clnt_odstate *op_odstate; /* used during processing */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
275
  	struct nfs4_acl *op_acl;
18032ca06   David Quigley   NFSD: Server impl...
276
  	struct xdr_netobj op_label;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
277
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
278
279
280
281
282
  
  struct nfsd4_open_confirm {
  	stateid_t	oc_req_stateid		/* request */;
  	u32		oc_seqid    		/* request */;
  	stateid_t	oc_resp_stateid		/* response */;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
283
284
285
286
287
  };
  
  struct nfsd4_open_downgrade {
  	stateid_t       od_stateid;
  	u32             od_seqid;
2c8bd7e0d   Benny Halevy   nfsd41: split out...
288
289
290
  	u32             od_share_access;	/* request */
  	u32		od_deleg_want;		/* request */
  	u32             od_share_deny;		/* request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
291
292
293
294
  };
  
  
  struct nfsd4_read {
5c4583b2b   Jeff Layton   nfsd: hook up nfs...
295
296
297
298
299
  	stateid_t		rd_stateid;         /* request */
  	u64			rd_offset;          /* request */
  	u32			rd_length;          /* request */
  	int			rd_vlen;
  	struct nfsd_file	*rd_nf;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
300
  	
5c4583b2b   Jeff Layton   nfsd: hook up nfs...
301
302
  	struct svc_rqst		*rd_rqstp;          /* response */
  	struct svc_fh		*rd_fhp;             /* response */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
303
304
305
306
307
308
309
  };
  
  struct nfsd4_readdir {
  	u64		rd_cookie;          /* request */
  	nfs4_verifier	rd_verf;            /* request */
  	u32		rd_dircount;        /* request */
  	u32		rd_maxcount;        /* request */
7e7057064   Andy Adamson   nfsd41: support f...
310
  	u32		rd_bmval[3];        /* request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
311
312
313
314
  	struct svc_rqst *rd_rqstp;          /* response */
  	struct svc_fh * rd_fhp;             /* response */
  
  	struct readdir_cd	common;
561f0ed49   J. Bruce Fields   nfsd4: allow larg...
315
316
  	struct xdr_stream	*xdr;
  	int			cookie_offset;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
  };
  
  struct nfsd4_release_lockowner {
  	clientid_t        rl_clientid;
  	struct xdr_netobj rl_owner;
  };
  struct nfsd4_readlink {
  	struct svc_rqst *rl_rqstp;          /* request */
  	struct svc_fh *	rl_fhp;             /* request */
  };
  
  struct nfsd4_remove {
  	u32		rm_namelen;         /* request */
  	char *		rm_name;            /* request */
  	struct nfsd4_change_info  rm_cinfo; /* response */
  };
  
  struct nfsd4_rename {
  	u32		rn_snamelen;        /* request */
  	char *		rn_sname;           /* request */
  	u32		rn_tnamelen;        /* request */
  	char *		rn_tname;           /* request */
  	struct nfsd4_change_info  rn_sinfo; /* response */
  	struct nfsd4_change_info  rn_tinfo; /* response */
  };
dcb488a3b   Andy Adamson   knfsd: nfsd4: imp...
342
343
344
345
346
  struct nfsd4_secinfo {
  	u32 si_namelen;					/* request */
  	char *si_name;					/* request */
  	struct svc_export *si_exp;			/* response */
  };
04f4ad16b   J. Bruce Fields   nfsd4: implement ...
347
348
349
350
  struct nfsd4_secinfo_no_name {
  	u32 sin_style;					/* request */
  	struct svc_export *sin_exp;			/* response */
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
351
352
  struct nfsd4_setattr {
  	stateid_t	sa_stateid;         /* request */
7e7057064   Andy Adamson   nfsd41: support f...
353
  	u32		sa_bmval[3];        /* request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
354
355
  	struct iattr	sa_iattr;           /* request */
  	struct nfs4_acl *sa_acl;
18032ca06   David Quigley   NFSD: Server impl...
356
  	struct xdr_netobj sa_label;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
357
358
359
360
  };
  
  struct nfsd4_setclientid {
  	nfs4_verifier	se_verf;            /* request */
a084daf51   J. Bruce Fields   nfsd4: move name-...
361
  	struct xdr_netobj se_name;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
362
363
364
365
366
367
368
369
370
371
372
373
374
375
  	u32		se_callback_prog;   /* request */
  	u32		se_callback_netid_len;  /* request */
  	char *		se_callback_netid_val;  /* request */
  	u32		se_callback_addr_len;   /* request */
  	char *		se_callback_addr_val;   /* request */
  	u32		se_callback_ident;  /* request */
  	clientid_t	se_clientid;        /* response */
  	nfs4_verifier	se_confirm;         /* response */
  };
  
  struct nfsd4_setclientid_confirm {
  	clientid_t	sc_clientid;
  	nfs4_verifier	sc_confirm;
  };
174568045   Bryan Schumaker   NFSD: Added TEST_...
376
377
378
379
380
381
  struct nfsd4_saved_compoundargs {
  	__be32 *p;
  	__be32 *end;
  	int pagelen;
  	struct page **pagelist;
  };
03cfb4202   Bryan Schumaker   NFSD: Clean up th...
382
383
384
385
386
  struct nfsd4_test_stateid_id {
  	__be32			ts_id_status;
  	stateid_t		ts_id_stateid;
  	struct list_head	ts_id_list;
  };
174568045   Bryan Schumaker   NFSD: Added TEST_...
387
  struct nfsd4_test_stateid {
57b7b43b4   J. Bruce Fields   nfsd4: int/__be32...
388
  	u32		ts_num_ids;
03cfb4202   Bryan Schumaker   NFSD: Clean up th...
389
  	struct list_head ts_stateid_list;
174568045   Bryan Schumaker   NFSD: Added TEST_...
390
  };
e1ca12dfb   Bryan Schumaker   NFSD: added FREE_...
391
392
  struct nfsd4_free_stateid {
  	stateid_t	fr_stateid;         /* request */
e1ca12dfb   Bryan Schumaker   NFSD: added FREE_...
393
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
394
395
  /* also used for NVERIFY */
  struct nfsd4_verify {
7e7057064   Andy Adamson   nfsd41: support f...
396
  	u32		ve_bmval[3];        /* request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
397
398
399
400
401
402
403
404
405
  	u32		ve_attrlen;         /* request */
  	char *		ve_attrval;         /* request */
  };
  
  struct nfsd4_write {
  	stateid_t	wr_stateid;         /* request */
  	u64		wr_offset;          /* request */
  	u32		wr_stable_how;      /* request */
  	u32		wr_buflen;          /* request */
70cc7f75b   J. Bruce Fields   nfsd4: move more ...
406
407
  	struct kvec	wr_head;
  	struct page **	wr_pagelist;        /* request */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
408
409
410
411
412
  
  	u32		wr_bytes_written;   /* response */
  	u32		wr_how_written;     /* response */
  	nfs4_verifier	wr_verifier;        /* response */
  };
2db134eb3   Andy Adamson   nfsd41: xdr infra...
413
  struct nfsd4_exchange_id {
0733d2133   Andy Adamson   nfsd41: exchange_...
414
415
416
417
418
419
  	nfs4_verifier	verifier;
  	struct xdr_netobj clname;
  	u32		flags;
  	clientid_t	clientid;
  	u32		seqid;
  	int		spa_how;
ed9416439   Andrew Elble   nfsd: implement m...
420
421
  	u32             spo_must_enforce[3];
  	u32             spo_must_allow[3];
791234448   J. Bruce Fields   nfsd: decode impl...
422
423
424
  	struct xdr_netobj nii_domain;
  	struct xdr_netobj nii_name;
  	struct timespec64 nii_time;
2db134eb3   Andy Adamson   nfsd41: xdr infra...
425
  };
2db134eb3   Andy Adamson   nfsd41: xdr infra...
426
  struct nfsd4_sequence {
b85d4c01b   Benny Halevy   nfsd41: sequence ...
427
428
429
430
431
432
433
  	struct nfs4_sessionid	sessionid;		/* request/response */
  	u32			seqid;			/* request/response */
  	u32			slotid;			/* request/response */
  	u32			maxslots;		/* request/response */
  	u32			cachethis;		/* request */
  #if 0
  	u32			target_maxslots;	/* response */
b85d4c01b   Benny Halevy   nfsd41: sequence ...
434
  #endif /* not yet */
0d7bb7190   J. Bruce Fields   nfsd4: set sequen...
435
  	u32			status_flags;		/* response */
2db134eb3   Andy Adamson   nfsd41: xdr infra...
436
437
438
  };
  
  struct nfsd4_destroy_session {
e10e0cfc2   Benny Halevy   nfsd41: destroy_s...
439
  	struct nfs4_sessionid	sessionid;
2db134eb3   Andy Adamson   nfsd41: xdr infra...
440
  };
345c28429   Mi Jinlong   nfs41: implement ...
441
442
443
  struct nfsd4_destroy_clientid {
  	clientid_t clientid;
  };
4dc6ec00f   J. Bruce Fields   nfsd4: implement ...
444
445
446
  struct nfsd4_reclaim_complete {
  	u32 rca_one_fs;
  };
9cf514ccf   Christoph Hellwig   nfsd: implement p...
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
  struct nfsd4_deviceid {
  	u64			fsid_idx;
  	u32			generation;
  	u32			pad;
  };
  
  struct nfsd4_layout_seg {
  	u32			iomode;
  	u64			offset;
  	u64			length;
  };
  
  struct nfsd4_getdeviceinfo {
  	struct nfsd4_deviceid	gd_devid;	/* request */
  	u32			gd_layout_type;	/* request */
  	u32			gd_maxcount;	/* request */
  	u32			gd_notify_types;/* request - response */
  	void			*gd_device;	/* response */
  };
  
  struct nfsd4_layoutget {
  	u64			lg_minlength;	/* request */
  	u32			lg_signal;	/* request */
  	u32			lg_layout_type;	/* request */
  	u32			lg_maxcount;	/* request */
  	stateid_t		lg_sid;		/* request/response */
  	struct nfsd4_layout_seg	lg_seg;		/* request/response */
  	void			*lg_content;	/* response */
  };
  
  struct nfsd4_layoutcommit {
  	stateid_t		lc_sid;		/* request */
  	struct nfsd4_layout_seg	lc_seg;		/* request */
  	u32			lc_reclaim;	/* request */
  	u32			lc_newoffset;	/* request */
  	u64			lc_last_wr;	/* request */
bdba53687   J. Bruce Fields   nfsd: use 64-bit ...
483
  	struct timespec64	lc_mtime;	/* request */
9cf514ccf   Christoph Hellwig   nfsd: implement p...
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
  	u32			lc_layout_type;	/* request */
  	u32			lc_up_len;	/* layout length */
  	void			*lc_up_layout;	/* decoded by callback */
  	u32			lc_size_chg;	/* boolean for response */
  	u64			lc_newsize;	/* response */
  };
  
  struct nfsd4_layoutreturn {
  	u32			lr_return_type;	/* request */
  	u32			lr_layout_type;	/* request */
  	struct nfsd4_layout_seg	lr_seg;		/* request */
  	u32			lr_reclaim;	/* request */
  	u32			lrf_body_len;	/* request */
  	void			*lrf_body;	/* request */
  	stateid_t		lr_sid;		/* request/response */
  	u32			lrs_present;	/* response */
  };
95d871f03   Anna Schumaker   nfsd: Add ALLOCAT...
501
502
503
504
505
506
  struct nfsd4_fallocate {
  	/* request */
  	stateid_t	falloc_stateid;
  	loff_t		falloc_offset;
  	u64		falloc_length;
  };
ffa0160a1   Christoph Hellwig   nfsd: implement t...
507
508
509
510
511
512
513
514
  struct nfsd4_clone {
  	/* request */
  	stateid_t	cl_src_stateid;
  	stateid_t	cl_dst_stateid;
  	u64		cl_src_pos;
  	u64		cl_dst_pos;
  	u64		cl_count;
  };
29ae7f9dc   Anna Schumaker   NFSD: Implement t...
515
516
517
518
  struct nfsd42_write_res {
  	u64			wr_bytes_written;
  	u32			wr_stable_how;
  	nfs4_verifier		wr_verifier;
9eb190fca   Olga Kornievskaia   NFSD CB_OFFLOAD xdr
519
  	stateid_t		cb_stateid;
29ae7f9dc   Anna Schumaker   NFSD: Implement t...
520
521
522
523
  };
  
  struct nfsd4_copy {
  	/* request */
84e1b21d5   Olga Kornievskaia   NFSD add ca_sourc...
524
525
526
527
528
529
530
  	stateid_t		cp_src_stateid;
  	stateid_t		cp_dst_stateid;
  	u64			cp_src_pos;
  	u64			cp_dst_pos;
  	u64			cp_count;
  	struct nl4_server	cp_src;
  	bool			cp_intra;
29ae7f9dc   Anna Schumaker   NFSD: Implement t...
531
532
  
  	/* both */
29ae7f9dc   Anna Schumaker   NFSD: Implement t...
533
534
535
536
  	bool		cp_synchronous;
  
  	/* response */
  	struct nfsd42_write_res	cp_res;
9eb190fca   Olga Kornievskaia   NFSD CB_OFFLOAD xdr
537
538
539
540
541
  
  	/* for cb_offload */
  	struct nfsd4_callback	cp_cb;
  	__be32			nfserr;
  	struct knfsd_fh		fh;
e0639dc58   Olga Kornievskaia   NFSD introduce as...
542
543
  
  	struct nfs4_client      *cp_clp;
5c4583b2b   Jeff Layton   nfsd: hook up nfs...
544
545
  	struct nfsd_file        *nf_src;
  	struct nfsd_file        *nf_dst;
e0639dc58   Olga Kornievskaia   NFSD introduce as...
546

624322f1a   Olga Kornievskaia   NFSD add COPY_NOT...
547
  	copy_stateid_t		cp_stateid;
e0639dc58   Olga Kornievskaia   NFSD introduce as...
548
549
550
551
552
  
  	struct list_head	copies;
  	struct task_struct	*copy_task;
  	refcount_t		refcount;
  	bool			stopped;
ce0887ac9   Olga Kornievskaia   NFSD add nfs4 int...
553
554
555
556
  
  	struct vfsmount		*ss_mnt;
  	struct nfs_fh		c_fh;
  	nfs4_stateid		stateid;
29ae7f9dc   Anna Schumaker   NFSD: Implement t...
557
  };
ce0887ac9   Olga Kornievskaia   NFSD add nfs4 int...
558
  extern bool inter_copy_offload_enable;
29ae7f9dc   Anna Schumaker   NFSD: Implement t...
559

24bab4912   Anna Schumaker   NFSD: Implement SEEK
560
561
562
563
564
565
566
567
568
569
  struct nfsd4_seek {
  	/* request */
  	stateid_t	seek_stateid;
  	loff_t		seek_offset;
  	u32		seek_whence;
  
  	/* response */
  	u32		seek_eof;
  	loff_t		seek_pos;
  };
6308bc98e   Olga Kornievskaia   NFSD OFFLOAD_STAT...
570
571
572
573
574
575
576
577
  struct nfsd4_offload_status {
  	/* request */
  	stateid_t	stateid;
  
  	/* response */
  	u64		count;
  	u32		status;
  };
51911868f   Olga Kornievskaia   NFSD COPY_NOTIFY xdr
578
579
580
581
582
583
584
585
586
587
588
  struct nfsd4_copy_notify {
  	/* request */
  	stateid_t		cpn_src_stateid;
  	struct nl4_server	cpn_dst;
  
  	/* response */
  	stateid_t		cpn_cnr_stateid;
  	u64			cpn_sec;
  	u32			cpn_nsec;
  	struct nl4_server	cpn_src;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
589
590
  struct nfsd4_op {
  	int					opnum;
f4f9ef4a1   J. Bruce Fields   nfsd4: opdesc wil...
591
  	const struct nfsd4_operation *		opdesc;
b37ad28bc   Al Viro   [PATCH] nfsd: nfs...
592
  	__be32					status;
b60e98598   Christoph Hellwig   nfsd4: properly t...
593
  	union nfsd4_op_u {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
  		struct nfsd4_access		access;
  		struct nfsd4_close		close;
  		struct nfsd4_commit		commit;
  		struct nfsd4_create		create;
  		struct nfsd4_delegreturn	delegreturn;
  		struct nfsd4_getattr		getattr;
  		struct svc_fh *			getfh;
  		struct nfsd4_link		link;
  		struct nfsd4_lock		lock;
  		struct nfsd4_lockt		lockt;
  		struct nfsd4_locku		locku;
  		struct nfsd4_lookup		lookup;
  		struct nfsd4_verify		nverify;
  		struct nfsd4_open		open;
  		struct nfsd4_open_confirm	open_confirm;
  		struct nfsd4_open_downgrade	open_downgrade;
  		struct nfsd4_putfh		putfh;
  		struct nfsd4_read		read;
  		struct nfsd4_readdir		readdir;
  		struct nfsd4_readlink		readlink;
  		struct nfsd4_remove		remove;
  		struct nfsd4_rename		rename;
  		clientid_t			renew;
dcb488a3b   Andy Adamson   knfsd: nfsd4: imp...
617
  		struct nfsd4_secinfo		secinfo;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
618
619
620
621
622
623
  		struct nfsd4_setattr		setattr;
  		struct nfsd4_setclientid	setclientid;
  		struct nfsd4_setclientid_confirm setclientid_confirm;
  		struct nfsd4_verify		verify;
  		struct nfsd4_write		write;
  		struct nfsd4_release_lockowner	release_lockowner;
2db134eb3   Andy Adamson   nfsd41: xdr infra...
624
625
626
  
  		/* NFSv4.1 */
  		struct nfsd4_exchange_id	exchange_id;
cb73a9f46   J. Bruce Fields   nfsd4: implement ...
627
  		struct nfsd4_backchannel_ctl	backchannel_ctl;
1d1bc8f20   J. Bruce Fields   nfsd4: support BI...
628
  		struct nfsd4_bind_conn_to_session bind_conn_to_session;
2db134eb3   Andy Adamson   nfsd41: xdr infra...
629
630
  		struct nfsd4_create_session	create_session;
  		struct nfsd4_destroy_session	destroy_session;
eb69853da   Christoph Hellwig   nfsd4: properly t...
631
  		struct nfsd4_destroy_clientid	destroy_clientid;
2db134eb3   Andy Adamson   nfsd41: xdr infra...
632
  		struct nfsd4_sequence		sequence;
4dc6ec00f   J. Bruce Fields   nfsd4: implement ...
633
  		struct nfsd4_reclaim_complete	reclaim_complete;
174568045   Bryan Schumaker   NFSD: Added TEST_...
634
  		struct nfsd4_test_stateid	test_stateid;
e1ca12dfb   Bryan Schumaker   NFSD: added FREE_...
635
  		struct nfsd4_free_stateid	free_stateid;
9cf514ccf   Christoph Hellwig   nfsd: implement p...
636
637
638
639
  		struct nfsd4_getdeviceinfo	getdeviceinfo;
  		struct nfsd4_layoutget		layoutget;
  		struct nfsd4_layoutcommit	layoutcommit;
  		struct nfsd4_layoutreturn	layoutreturn;
eb69853da   Christoph Hellwig   nfsd4: properly t...
640
  		struct nfsd4_secinfo_no_name	secinfo_no_name;
24bab4912   Anna Schumaker   NFSD: Implement SEEK
641
642
  
  		/* NFSv4.2 */
95d871f03   Anna Schumaker   nfsd: Add ALLOCAT...
643
  		struct nfsd4_fallocate		allocate;
b0cb90852   Anna Schumaker   nfsd: Add DEALLOC...
644
  		struct nfsd4_fallocate		deallocate;
ffa0160a1   Christoph Hellwig   nfsd: implement t...
645
  		struct nfsd4_clone		clone;
29ae7f9dc   Anna Schumaker   NFSD: Implement t...
646
  		struct nfsd4_copy		copy;
6308bc98e   Olga Kornievskaia   NFSD OFFLOAD_STAT...
647
  		struct nfsd4_offload_status	offload_status;
51911868f   Olga Kornievskaia   NFSD COPY_NOTIFY xdr
648
  		struct nfsd4_copy_notify	copy_notify;
24bab4912   Anna Schumaker   NFSD: Implement SEEK
649
  		struct nfsd4_seek		seek;
6178713bd   Frank van der Linden   nfsd: add structu...
650
651
652
653
654
  
  		struct nfsd4_getxattr		getxattr;
  		struct nfsd4_setxattr		setxattr;
  		struct nfsd4_listxattrs		listxattrs;
  		struct nfsd4_removexattr	removexattr;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
655
656
657
  	} u;
  	struct nfs4_replay *			replay;
  };
1091006c5   J. Bruce Fields   nfsd: turn on rep...
658
  bool nfsd4_cache_this_op(struct nfsd4_op *);
d5e233832   J. Bruce Fields   nfsd4: replace de...
659
660
661
662
663
664
665
  /*
   * Memory needed just for the duration of processing one compound:
   */
  struct svcxdr_tmpbuf {
  	struct svcxdr_tmpbuf *next;
  	char buf[];
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
666
667
  struct nfsd4_compoundargs {
  	/* scratch variables for XDR decode */
2ebbc012a   Al Viro   [PATCH] xdr annot...
668
669
  	__be32 *			p;
  	__be32 *			end;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
670
671
  	struct page **			pagelist;
  	int				pagelen;
eae03e2ac   Chuck Lever   nfsd: Incoming xd...
672
  	bool				tail;
2ebbc012a   Al Viro   [PATCH] xdr annot...
673
674
  	__be32				tmp[8];
  	__be32 *			tmpp;
d5e233832   J. Bruce Fields   nfsd4: replace de...
675
  	struct svcxdr_tmpbuf		*to_free;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
676
677
678
679
680
681
682
683
684
  
  	struct svc_rqst			*rqstp;
  
  	u32				taglen;
  	char *				tag;
  	u32				minorversion;
  	u32				opcnt;
  	struct nfsd4_op			*ops;
  	struct nfsd4_op			iops[8];
1091006c5   J. Bruce Fields   nfsd: turn on rep...
685
  	int				cachetype;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
686
687
688
689
  };
  
  struct nfsd4_compoundres {
  	/* scratch variables for XDR encode */
4aea24b2f   J. Bruce Fields   nfsd4: embed xdr_...
690
  	struct xdr_stream		xdr;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
691
692
693
694
695
  	struct svc_rqst *		rqstp;
  
  	u32				taglen;
  	char *				tag;
  	u32				opcnt;
e354d571b   Andy Adamson   nfsd: embed nfsd4...
696
697
  	__be32 *			tagp; /* tag, opcount encode location */
  	struct nfsd4_compound_state	cstate;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
698
  };
bf864a31d   Andy Adamson   nfsd41: non-page ...
699
700
701
  static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
  {
  	struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
468de9e54   Andy Adamson   nfsd41: expand so...
702
  	return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
bf864a31d   Andy Adamson   nfsd41: non-page ...
703
  }
085def3ad   J. Bruce Fields   nfsd4: fix cached...
704
705
706
707
708
709
710
711
712
713
  /*
   * The session reply cache only needs to cache replies that the client
   * actually asked us to.  But it's almost free for us to cache compounds
   * consisting of only a SEQUENCE op, so we may as well cache those too.
   * Also, the protocol doesn't give us a convenient response in the case
   * of a replay of a solo SEQUENCE op that wasn't cached
   * (RETRY_UNCACHED_REP can only be returned in the second op of a
   * compound).
   */
  static inline bool nfsd4_cache_this(struct nfsd4_compoundres *resp)
bf864a31d   Andy Adamson   nfsd41: non-page ...
714
  {
085def3ad   J. Bruce Fields   nfsd4: fix cached...
715
  	return (resp->cstate.slot->sl_flags & NFSD4_SLOT_CACHETHIS)
73e79482b   J. Bruce Fields   nfsd4: rearrange ...
716
  		|| nfsd4_is_solo_sequence(resp);
bf864a31d   Andy Adamson   nfsd41: non-page ...
717
  }
9b3234b92   J. Bruce Fields   nfsd4: disable ze...
718
719
720
721
722
723
724
  static inline bool nfsd4_last_compound_op(struct svc_rqst *rqstp)
  {
  	struct nfsd4_compoundres *resp = rqstp->rq_resp;
  	struct nfsd4_compoundargs *argp = rqstp->rq_argp;
  
  	return argp->opcnt == resp->opcnt;
  }
f4f9ef4a1   J. Bruce Fields   nfsd4: opdesc wil...
725
  const struct nfsd4_operation *OPDESC(struct nfsd4_op *op);
4f0cefbf3   J. Bruce Fields   nfsd4: more preci...
726
  int nfsd4_max_reply(struct svc_rqst *rqstp, struct nfsd4_op *op);
07d1f8020   J. Bruce Fields   nfsd4: fix encodi...
727
  void warn_on_nonidempotent_op(struct nfsd4_op *op);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
728
729
730
731
732
  #define NFS4_SVC_XDRSIZE		sizeof(struct nfsd4_compoundargs)
  
  static inline void
  set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
  {
c1ac3ffcd   Neil Brown   nfsd: Fix possibl...
733
  	BUG_ON(!fhp->fh_pre_saved);
aaf91ec14   Jeff Layton   nfsd: switch unsi...
734
  	cinfo->atomic = (u32)fhp->fh_post_saved;
2b0143b5c   David Howells   VFS: normal files...
735
  	cinfo->change_supported = IS_I_VERSION(d_inode(fhp->fh_dentry));
c1ac3ffcd   Neil Brown   nfsd: Fix possibl...
736
737
738
739
740
741
742
  
  	cinfo->before_change = fhp->fh_pre_change;
  	cinfo->after_change = fhp->fh_post_change;
  	cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
  	cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
  	cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec;
  	cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
743
  }
dedeb13f9   Andrew Elble   nfsd: allow mach_...
744
745
  
  bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp);
dcc46991d   Chuck Lever   NFSD: Encoder and...
746
  int nfs4svc_decode_voidarg(struct svc_rqst *, __be32 *);
63f8de379   Christoph Hellwig   sunrpc: properly ...
747
  int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *);
026fec7e7   Christoph Hellwig   sunrpc: properly ...
748
  int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *);
63f8de379   Christoph Hellwig   sunrpc: properly ...
749
  int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *);
57b7b43b4   J. Bruce Fields   nfsd4: int/__be32...
750
  __be32 nfsd4_check_resp_size(struct nfsd4_compoundres *, u32);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
751
  void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
d0a381dd0   J. Bruce Fields   nfsd4: teach enco...
752
  void nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op);
d51846586   J. Bruce Fields   nfsd4: tweak nfsd...
753
754
755
756
  __be32 nfsd4_encode_fattr_to_buf(__be32 **p, int words,
  		struct svc_fh *fhp, struct svc_export *exp,
  		struct dentry *dentry,
  		u32 *bmval, struct svc_rqst *, int ignore_crossmnt);
b37ad28bc   Al Viro   [PATCH] nfsd: nfs...
757
  extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
eb69853da   Christoph Hellwig   nfsd4: properly t...
758
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
b37ad28bc   Al Viro   [PATCH] nfsd: nfs...
759
  extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
eb69853da   Christoph Hellwig   nfsd4: properly t...
760
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
069b6ad4b   Andy Adamson   nfsd41: proc stubs
761
  extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp,
eb69853da   Christoph Hellwig   nfsd4: properly t...
762
763
764
765
766
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
  extern __be32 nfsd4_backchannel_ctl(struct svc_rqst *,
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
  extern __be32 nfsd4_bind_conn_to_session(struct svc_rqst *,
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
3c4ab2aaa   J. Bruce Fields   nfsd4: indentatio...
767
  extern __be32 nfsd4_create_session(struct svc_rqst *,
eb69853da   Christoph Hellwig   nfsd4: properly t...
768
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
069b6ad4b   Andy Adamson   nfsd41: proc stubs
769
  extern __be32 nfsd4_sequence(struct svc_rqst *,
eb69853da   Christoph Hellwig   nfsd4: properly t...
770
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
b607664ee   Trond Myklebust   nfsd: Cleanup nfs...
771
  extern void nfsd4_sequence_done(struct nfsd4_compoundres *resp);
069b6ad4b   Andy Adamson   nfsd41: proc stubs
772
  extern __be32 nfsd4_destroy_session(struct svc_rqst *,
eb69853da   Christoph Hellwig   nfsd4: properly t...
773
774
775
776
777
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
  extern __be32 nfsd4_destroy_clientid(struct svc_rqst *, struct nfsd4_compound_state *,
  		union nfsd4_op_u *u);
  __be32 nfsd4_reclaim_complete(struct svc_rqst *, struct nfsd4_compound_state *,
  		union nfsd4_op_u *u);
6668958fa   Andy Adamson   nfsd41: stateid h...
778
  extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *,
3320fef19   Stanislav Kinsbursky   nfsd: use service...
779
  		struct nfsd4_open *open, struct nfsd_net *nn);
b37ad28bc   Al Viro   [PATCH] nfsd: nfs...
780
  extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
781
  		struct svc_fh *current_fh, struct nfsd4_open *open);
58fb12e6a   Jeff Layton   nfsd: Add a mutex...
782
783
  extern void nfsd4_cstate_clear_replay(struct nfsd4_compound_state *cstate);
  extern void nfsd4_cleanup_open_state(struct nfsd4_compound_state *cstate,
422978999   Jeff Layton   nfsd: remove unus...
784
  		struct nfsd4_open *open);
b37ad28bc   Al Viro   [PATCH] nfsd: nfs...
785
  extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
eb69853da   Christoph Hellwig   nfsd4: properly t...
786
787
788
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
  extern __be32 nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
  		union nfsd4_op_u *u);
b37ad28bc   Al Viro   [PATCH] nfsd: nfs...
789
  extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
eb69853da   Christoph Hellwig   nfsd4: properly t...
790
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
ca3643171   J.Bruce Fields   [PATCH] knfsd: nf...
791
  extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
eb69853da   Christoph Hellwig   nfsd4: properly t...
792
793
794
795
796
  		union nfsd4_op_u *u);
  extern __be32 nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
  		union nfsd4_op_u *u);
  extern __be32 nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
  		union nfsd4_op_u *u);
b37ad28bc   Al Viro   [PATCH] nfsd: nfs...
797
  extern __be32
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
798
  nfsd4_release_lockowner(struct svc_rqst *rqstp,
eb69853da   Christoph Hellwig   nfsd4: properly t...
799
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
8537488b5   Christoph Hellwig   sunrpc: properly ...
800
  extern void nfsd4_release_compoundargs(struct svc_rqst *rqstp);
b37ad28bc   Al Viro   [PATCH] nfsd: nfs...
801
  extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp,
eb69853da   Christoph Hellwig   nfsd4: properly t...
802
803
804
  		struct nfsd4_compound_state *, union nfsd4_op_u *u);
  extern __be32 nfsd4_renew(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
  		union nfsd4_op_u *u);
174568045   Bryan Schumaker   NFSD: Added TEST_...
805
  extern __be32 nfsd4_test_stateid(struct svc_rqst *rqstp,
eb69853da   Christoph Hellwig   nfsd4: properly t...
806
  		struct nfsd4_compound_state *, union nfsd4_op_u *);
e1ca12dfb   Bryan Schumaker   NFSD: added FREE_...
807
  extern __be32 nfsd4_free_stateid(struct svc_rqst *rqstp,
eb69853da   Christoph Hellwig   nfsd4: properly t...
808
  		struct nfsd4_compound_state *, union nfsd4_op_u *);
9411b1d4c   J. Bruce Fields   nfsd4: cleanup ha...
809
  extern void nfsd4_bump_seqid(struct nfsd4_compound_state *, __be32 nfserr);
58fb12e6a   Jeff Layton   nfsd: Add a mutex...
810

0020939f2   J. Bruce Fields   nfsd4: move some ...
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
  enum nfsd4_op_flags {
  	ALLOWED_WITHOUT_FH = 1 << 0,    /* No current filehandle required */
  	ALLOWED_ON_ABSENT_FS = 1 << 1,  /* ops processed on absent fs */
  	ALLOWED_AS_FIRST_OP = 1 << 2,   /* ops reqired first in compound */
  	/* For rfc 5661 section 2.6.3.1.1: */
  	OP_HANDLES_WRONGSEC = 1 << 3,
  	OP_IS_PUTFH_LIKE = 1 << 4,
  	/*
  	 * These are the ops whose result size we estimate before
  	 * encoding, to avoid performing an op then not being able to
  	 * respond or cache a response.  This includes writes and setattrs
  	 * as well as the operations usually called "nonidempotent":
  	 */
  	OP_MODIFIES_SOMETHING = 1 << 5,
  	/*
  	 * Cache compounds containing these ops in the xid-based drc:
  	 * We use the DRC for compounds containing non-idempotent
  	 * operations, *except* those that are 4.1-specific (since
  	 * sessions provide their own EOS), and except for stateful
  	 * operations other than setclientid and setclientid_confirm
  	 * (since sequence numbers provide EOS for open, lock, etc in
  	 * the v4.0 case).
  	 */
  	OP_CACHEME = 1 << 6,
  	/*
  	 * These are ops which clear current state id.
  	 */
  	OP_CLEAR_STATEID = 1 << 7,
b7571e4cd   J. Bruce Fields   nfsd4: skip encod...
839
840
  	/* Most ops return only an error on failure; some may do more: */
  	OP_NONTRIVIAL_ERROR_ENCODE = 1 << 8,
0020939f2   J. Bruce Fields   nfsd4: move some ...
841
842
843
844
845
  };
  
  struct nfsd4_operation {
  	__be32 (*op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
  			union nfsd4_op_u *);
34b1744c9   J. Bruce Fields   nfsd4: define ->o...
846
  	void (*op_release)(union nfsd4_op_u *);
0020939f2   J. Bruce Fields   nfsd4: move some ...
847
848
849
850
851
852
853
854
855
  	u32 op_flags;
  	char *op_name;
  	/* Try to get response size before operation */
  	u32 (*op_rsize_bop)(struct svc_rqst *, struct nfsd4_op *);
  	void (*op_get_currentstateid)(struct nfsd4_compound_state *,
  			union nfsd4_op_u *);
  	void (*op_set_currentstateid)(struct nfsd4_compound_state *,
  			union nfsd4_op_u *);
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
856
857
858
859
860
861
862
  #endif
  
  /*
   * Local variables:
   *  c-basic-offset: 8
   * End:
   */