aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfsd/xdr4.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/nfsd/xdr4.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/nfsd/xdr4.h')
-rw-r--r--include/linux/nfsd/xdr4.h463
1 files changed, 463 insertions, 0 deletions
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
new file mode 100644
index 000000000000..a1f5ad0be1bf
--- /dev/null
+++ b/include/linux/nfsd/xdr4.h
@@ -0,0 +1,463 @@
1/*
2 * include/linux/nfsd/xdr4.h
3 *
4 * Server-side types for NFSv4.
5 *
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
8 *
9 * Kendrick Smith <kmsmith@umich.edu>
10 * Andy Adamson <andros@umich.edu>
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the University nor the names of its
22 * contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 */
38
39#ifndef _LINUX_NFSD_XDR4_H
40#define _LINUX_NFSD_XDR4_H
41
42#include <linux/nfs4.h>
43
44#define NFSD4_MAX_TAGLEN 128
45#define XDR_LEN(n) (((n) + 3) & ~3)
46
47struct nfsd4_change_info {
48 u32 atomic;
49 u32 before_ctime_sec;
50 u32 before_ctime_nsec;
51 u32 after_ctime_sec;
52 u32 after_ctime_nsec;
53};
54
55struct nfsd4_access {
56 u32 ac_req_access; /* request */
57 u32 ac_supported; /* response */
58 u32 ac_resp_access; /* response */
59};
60
61struct nfsd4_close {
62 u32 cl_seqid; /* request */
63 stateid_t cl_stateid; /* request+response */
64 struct nfs4_stateowner * cl_stateowner; /* response */
65};
66
67struct nfsd4_commit {
68 u64 co_offset; /* request */
69 u32 co_count; /* request */
70 nfs4_verifier co_verf; /* response */
71};
72
73struct nfsd4_create {
74 u32 cr_namelen; /* request */
75 char * cr_name; /* request */
76 u32 cr_type; /* request */
77 union { /* request */
78 struct {
79 u32 namelen;
80 char *name;
81 } link; /* NF4LNK */
82 struct {
83 u32 specdata1;
84 u32 specdata2;
85 } dev; /* NF4BLK, NF4CHR */
86 } u;
87 u32 cr_bmval[2]; /* request */
88 struct iattr cr_iattr; /* request */
89 struct nfsd4_change_info cr_cinfo; /* response */
90 struct nfs4_acl *cr_acl;
91};
92#define cr_linklen u.link.namelen
93#define cr_linkname u.link.name
94#define cr_specdata1 u.dev.specdata1
95#define cr_specdata2 u.dev.specdata2
96
97struct nfsd4_delegreturn {
98 stateid_t dr_stateid;
99};
100
101struct nfsd4_getattr {
102 u32 ga_bmval[2]; /* request */
103 struct svc_fh *ga_fhp; /* response */
104};
105
106struct nfsd4_link {
107 u32 li_namelen; /* request */
108 char * li_name; /* request */
109 struct nfsd4_change_info li_cinfo; /* response */
110};
111
112struct nfsd4_lock_denied {
113 clientid_t ld_clientid;
114 struct nfs4_stateowner *ld_sop;
115 u64 ld_start;
116 u64 ld_length;
117 u32 ld_type;
118};
119
120struct nfsd4_lock {
121 /* request */
122 u32 lk_type;
123 u32 lk_reclaim; /* boolean */
124 u64 lk_offset;
125 u64 lk_length;
126 u32 lk_is_new;
127 union {
128 struct {
129 u32 open_seqid;
130 stateid_t open_stateid;
131 u32 lock_seqid;
132 clientid_t clientid;
133 struct xdr_netobj owner;
134 } new;
135 struct {
136 stateid_t lock_stateid;
137 u32 lock_seqid;
138 } old;
139 } v;
140
141 /* response */
142 union {
143 struct {
144 stateid_t stateid;
145 } ok;
146 struct nfsd4_lock_denied denied;
147 } u;
148
149 struct nfs4_stateowner *lk_stateowner;
150};
151#define lk_new_open_seqid v.new.open_seqid
152#define lk_new_open_stateid v.new.open_stateid
153#define lk_new_lock_seqid v.new.lock_seqid
154#define lk_new_clientid v.new.clientid
155#define lk_new_owner v.new.owner
156#define lk_old_lock_stateid v.old.lock_stateid
157#define lk_old_lock_seqid v.old.lock_seqid
158
159#define lk_rflags u.ok.rflags
160#define lk_resp_stateid u.ok.stateid
161#define lk_denied u.denied
162
163
164struct nfsd4_lockt {
165 u32 lt_type;
166 clientid_t lt_clientid;
167 struct xdr_netobj lt_owner;
168 u64 lt_offset;
169 u64 lt_length;
170 struct nfs4_stateowner * lt_stateowner;
171 struct nfsd4_lock_denied lt_denied;
172};
173
174
175struct nfsd4_locku {
176 u32 lu_type;
177 u32 lu_seqid;
178 stateid_t lu_stateid;
179 u64 lu_offset;
180 u64 lu_length;
181 struct nfs4_stateowner *lu_stateowner;
182};
183
184
185struct nfsd4_lookup {
186 u32 lo_len; /* request */
187 char * lo_name; /* request */
188};
189
190struct nfsd4_putfh {
191 u32 pf_fhlen; /* request */
192 char *pf_fhval; /* request */
193};
194
195struct nfsd4_open {
196 u32 op_claim_type; /* request */
197 struct xdr_netobj op_fname; /* request - everything but CLAIM_PREV */
198 u32 op_delegate_type; /* request - CLAIM_PREV only */
199 stateid_t op_delegate_stateid; /* request - response */
200 u32 op_create; /* request */
201 u32 op_createmode; /* request */
202 u32 op_bmval[2]; /* request */
203 union { /* request */
204 struct iattr iattr; /* UNCHECKED4,GUARDED4 */
205 nfs4_verifier verf; /* EXCLUSIVE4 */
206 } u;
207 clientid_t op_clientid; /* request */
208 struct xdr_netobj op_owner; /* request */
209 u32 op_seqid; /* request */
210 u32 op_share_access; /* request */
211 u32 op_share_deny; /* request */
212 stateid_t op_stateid; /* response */
213 struct nfsd4_change_info op_cinfo; /* response */
214 u32 op_rflags; /* response */
215 int op_truncate; /* used during processing */
216 struct nfs4_stateowner *op_stateowner; /* used during processing */
217 struct nfs4_acl *op_acl;
218};
219#define op_iattr u.iattr
220#define op_verf u.verf
221
222struct nfsd4_open_confirm {
223 stateid_t oc_req_stateid /* request */;
224 u32 oc_seqid /* request */;
225 stateid_t oc_resp_stateid /* response */;
226 struct nfs4_stateowner * oc_stateowner; /* response */
227};
228
229struct nfsd4_open_downgrade {
230 stateid_t od_stateid;
231 u32 od_seqid;
232 u32 od_share_access;
233 u32 od_share_deny;
234 struct nfs4_stateowner *od_stateowner;
235};
236
237
238struct nfsd4_read {
239 stateid_t rd_stateid; /* request */
240 u64 rd_offset; /* request */
241 u32 rd_length; /* request */
242 struct kvec rd_iov[RPCSVC_MAXPAGES];
243 int rd_vlen;
244 struct file *rd_filp;
245
246 struct svc_rqst *rd_rqstp; /* response */
247 struct svc_fh * rd_fhp; /* response */
248};
249
250struct nfsd4_readdir {
251 u64 rd_cookie; /* request */
252 nfs4_verifier rd_verf; /* request */
253 u32 rd_dircount; /* request */
254 u32 rd_maxcount; /* request */
255 u32 rd_bmval[2]; /* request */
256 struct svc_rqst *rd_rqstp; /* response */
257 struct svc_fh * rd_fhp; /* response */
258
259 struct readdir_cd common;
260 u32 * buffer;
261 int buflen;
262 u32 * offset;
263};
264
265struct nfsd4_release_lockowner {
266 clientid_t rl_clientid;
267 struct xdr_netobj rl_owner;
268};
269struct nfsd4_readlink {
270 struct svc_rqst *rl_rqstp; /* request */
271 struct svc_fh * rl_fhp; /* request */
272};
273
274struct nfsd4_remove {
275 u32 rm_namelen; /* request */
276 char * rm_name; /* request */
277 struct nfsd4_change_info rm_cinfo; /* response */
278};
279
280struct nfsd4_rename {
281 u32 rn_snamelen; /* request */
282 char * rn_sname; /* request */
283 u32 rn_tnamelen; /* request */
284 char * rn_tname; /* request */
285 struct nfsd4_change_info rn_sinfo; /* response */
286 struct nfsd4_change_info rn_tinfo; /* response */
287};
288
289struct nfsd4_setattr {
290 stateid_t sa_stateid; /* request */
291 u32 sa_bmval[2]; /* request */
292 struct iattr sa_iattr; /* request */
293 struct nfs4_acl *sa_acl;
294};
295
296struct nfsd4_setclientid {
297 nfs4_verifier se_verf; /* request */
298 u32 se_namelen; /* request */
299 char * se_name; /* request */
300 u32 se_callback_prog; /* request */
301 u32 se_callback_netid_len; /* request */
302 char * se_callback_netid_val; /* request */
303 u32 se_callback_addr_len; /* request */
304 char * se_callback_addr_val; /* request */
305 u32 se_callback_ident; /* request */
306 clientid_t se_clientid; /* response */
307 nfs4_verifier se_confirm; /* response */
308};
309
310struct nfsd4_setclientid_confirm {
311 clientid_t sc_clientid;
312 nfs4_verifier sc_confirm;
313};
314
315/* also used for NVERIFY */
316struct nfsd4_verify {
317 u32 ve_bmval[2]; /* request */
318 u32 ve_attrlen; /* request */
319 char * ve_attrval; /* request */
320};
321
322struct nfsd4_write {
323 stateid_t wr_stateid; /* request */
324 u64 wr_offset; /* request */
325 u32 wr_stable_how; /* request */
326 u32 wr_buflen; /* request */
327 struct kvec wr_vec[RPCSVC_MAXPAGES]; /* request */
328 int wr_vlen;
329
330 u32 wr_bytes_written; /* response */
331 u32 wr_how_written; /* response */
332 nfs4_verifier wr_verifier; /* response */
333};
334
335struct nfsd4_op {
336 int opnum;
337 int status;
338 union {
339 struct nfsd4_access access;
340 struct nfsd4_close close;
341 struct nfsd4_commit commit;
342 struct nfsd4_create create;
343 struct nfsd4_delegreturn delegreturn;
344 struct nfsd4_getattr getattr;
345 struct svc_fh * getfh;
346 struct nfsd4_link link;
347 struct nfsd4_lock lock;
348 struct nfsd4_lockt lockt;
349 struct nfsd4_locku locku;
350 struct nfsd4_lookup lookup;
351 struct nfsd4_verify nverify;
352 struct nfsd4_open open;
353 struct nfsd4_open_confirm open_confirm;
354 struct nfsd4_open_downgrade open_downgrade;
355 struct nfsd4_putfh putfh;
356 struct nfsd4_read read;
357 struct nfsd4_readdir readdir;
358 struct nfsd4_readlink readlink;
359 struct nfsd4_remove remove;
360 struct nfsd4_rename rename;
361 clientid_t renew;
362 struct nfsd4_setattr setattr;
363 struct nfsd4_setclientid setclientid;
364 struct nfsd4_setclientid_confirm setclientid_confirm;
365 struct nfsd4_verify verify;
366 struct nfsd4_write write;
367 struct nfsd4_release_lockowner release_lockowner;
368 } u;
369 struct nfs4_replay * replay;
370};
371
372struct nfsd4_compoundargs {
373 /* scratch variables for XDR decode */
374 u32 * p;
375 u32 * end;
376 struct page ** pagelist;
377 int pagelen;
378 u32 tmp[8];
379 u32 * tmpp;
380 struct tmpbuf {
381 struct tmpbuf *next;
382 void (*release)(const void *);
383 void *buf;
384 } *to_free;
385
386 struct svc_rqst *rqstp;
387
388 u32 taglen;
389 char * tag;
390 u32 minorversion;
391 u32 opcnt;
392 struct nfsd4_op *ops;
393 struct nfsd4_op iops[8];
394};
395
396struct nfsd4_compoundres {
397 /* scratch variables for XDR encode */
398 u32 * p;
399 u32 * end;
400 struct xdr_buf * xbuf;
401 struct svc_rqst * rqstp;
402
403 u32 taglen;
404 char * tag;
405 u32 opcnt;
406 u32 * tagp; /* where to encode tag and opcount */
407};
408
409#define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
410
411static inline void
412set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
413{
414 BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved);
415 cinfo->atomic = 1;
416 cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
417 cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
418 cinfo->after_ctime_sec = fhp->fh_post_ctime.tv_sec;
419 cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec;
420}
421
422int nfs4svc_encode_voidres(struct svc_rqst *, u32 *, void *);
423int nfs4svc_decode_compoundargs(struct svc_rqst *, u32 *,
424 struct nfsd4_compoundargs *);
425int nfs4svc_encode_compoundres(struct svc_rqst *, u32 *,
426 struct nfsd4_compoundres *);
427void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
428void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
429int nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
430 struct dentry *dentry, u32 *buffer, int *countp,
431 u32 *bmval, struct svc_rqst *);
432extern int nfsd4_setclientid(struct svc_rqst *rqstp,
433 struct nfsd4_setclientid *setclid);
434extern int nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
435 struct nfsd4_setclientid_confirm *setclientid_confirm);
436extern int nfsd4_process_open1(struct nfsd4_open *open);
437extern int nfsd4_process_open2(struct svc_rqst *rqstp,
438 struct svc_fh *current_fh, struct nfsd4_open *open);
439extern int nfsd4_open_confirm(struct svc_rqst *rqstp,
440 struct svc_fh *current_fh, struct nfsd4_open_confirm *oc);
441extern int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh,
442 struct nfsd4_close *close);
443extern int nfsd4_open_downgrade(struct svc_rqst *rqstp,
444 struct svc_fh *current_fh, struct nfsd4_open_downgrade *od);
445extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh,
446 struct nfsd4_lock *lock);
447extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh,
448 struct nfsd4_lockt *lockt);
449extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh,
450 struct nfsd4_locku *locku);
451extern int
452nfsd4_release_lockowner(struct svc_rqst *rqstp,
453 struct nfsd4_release_lockowner *rlockowner);
454extern void nfsd4_release_compoundargs(struct nfsd4_compoundargs *);
455extern int nfsd4_delegreturn(struct svc_rqst *rqstp,
456 struct svc_fh *current_fh, struct nfsd4_delegreturn *dr);
457#endif
458
459/*
460 * Local variables:
461 * c-basic-offset: 8
462 * End:
463 */