blob: a4322741f8b9d4ec85a80d8bbc69a04d401ba796 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/include/linux/nfsd/xdr3.h
3 *
4 * XDR types for NFSv3 in nfsd.
5 *
6 * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef _LINUX_NFSD_XDR3_H
10#define _LINUX_NFSD_XDR3_H
11
12#include <linux/nfsd/xdr.h>
13
14struct nfsd3_sattrargs {
15 struct svc_fh fh;
16 struct iattr attrs;
17 int check_guard;
18 time_t guardtime;
19};
20
21struct nfsd3_diropargs {
22 struct svc_fh fh;
23 char * name;
24 int len;
25};
26
27struct nfsd3_accessargs {
28 struct svc_fh fh;
29 unsigned int access;
30};
31
32struct nfsd3_readargs {
33 struct svc_fh fh;
34 __u64 offset;
35 __u32 count;
36 struct kvec vec[RPCSVC_MAXPAGES];
37 int vlen;
38};
39
40struct nfsd3_writeargs {
41 svc_fh fh;
42 __u64 offset;
43 __u32 count;
44 int stable;
NeilBrown0ba75362005-11-07 01:00:26 -080045 __u32 len;
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 struct kvec vec[RPCSVC_MAXPAGES];
47 int vlen;
48};
49
50struct nfsd3_createargs {
51 struct svc_fh fh;
52 char * name;
53 int len;
54 int createmode;
55 struct iattr attrs;
56 __u32 * verf;
57};
58
59struct nfsd3_mknodargs {
60 struct svc_fh fh;
61 char * name;
62 int len;
63 __u32 ftype;
64 __u32 major, minor;
65 struct iattr attrs;
66};
67
68struct nfsd3_renameargs {
69 struct svc_fh ffh;
70 char * fname;
71 int flen;
72 struct svc_fh tfh;
73 char * tname;
74 int tlen;
75};
76
77struct nfsd3_readlinkargs {
78 struct svc_fh fh;
79 char * buffer;
80};
81
82struct nfsd3_linkargs {
83 struct svc_fh ffh;
84 struct svc_fh tfh;
85 char * tname;
86 int tlen;
87};
88
89struct nfsd3_symlinkargs {
90 struct svc_fh ffh;
91 char * fname;
92 int flen;
93 char * tname;
94 int tlen;
95 struct iattr attrs;
96};
97
98struct nfsd3_readdirargs {
99 struct svc_fh fh;
100 __u64 cookie;
101 __u32 dircount;
102 __u32 count;
103 __u32 * verf;
104 u32 * buffer;
105};
106
107struct nfsd3_commitargs {
108 struct svc_fh fh;
109 __u64 offset;
110 __u32 count;
111};
112
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000113struct nfsd3_getaclargs {
114 struct svc_fh fh;
115 int mask;
116};
117
118struct posix_acl;
119struct nfsd3_setaclargs {
120 struct svc_fh fh;
121 int mask;
122 struct posix_acl *acl_access;
123 struct posix_acl *acl_default;
124};
125
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126struct nfsd3_attrstat {
127 __u32 status;
128 struct svc_fh fh;
David Shawa334de22006-01-06 00:19:58 -0800129 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130};
131
132/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
133struct nfsd3_diropres {
134 __u32 status;
135 struct svc_fh dirfh;
136 struct svc_fh fh;
137};
138
139struct nfsd3_accessres {
140 __u32 status;
141 struct svc_fh fh;
142 __u32 access;
143};
144
145struct nfsd3_readlinkres {
146 __u32 status;
147 struct svc_fh fh;
148 __u32 len;
149};
150
151struct nfsd3_readres {
152 __u32 status;
153 struct svc_fh fh;
154 unsigned long count;
155 int eof;
156};
157
158struct nfsd3_writeres {
159 __u32 status;
160 struct svc_fh fh;
161 unsigned long count;
162 int committed;
163};
164
165struct nfsd3_renameres {
166 __u32 status;
167 struct svc_fh ffh;
168 struct svc_fh tfh;
169};
170
171struct nfsd3_linkres {
172 __u32 status;
173 struct svc_fh tfh;
174 struct svc_fh fh;
175};
176
177struct nfsd3_readdirres {
178 __u32 status;
179 struct svc_fh fh;
180 int count;
181 __u32 verf[2];
182
183 struct readdir_cd common;
184 u32 * buffer;
185 int buflen;
186 u32 * offset;
187 u32 * offset1;
188 struct svc_rqst * rqstp;
189
190};
191
192struct nfsd3_fsstatres {
193 __u32 status;
194 struct kstatfs stats;
195 __u32 invarsec;
196};
197
198struct nfsd3_fsinfores {
199 __u32 status;
200 __u32 f_rtmax;
201 __u32 f_rtpref;
202 __u32 f_rtmult;
203 __u32 f_wtmax;
204 __u32 f_wtpref;
205 __u32 f_wtmult;
206 __u32 f_dtpref;
207 __u64 f_maxfilesize;
208 __u32 f_properties;
209};
210
211struct nfsd3_pathconfres {
212 __u32 status;
213 __u32 p_link_max;
214 __u32 p_name_max;
215 __u32 p_no_trunc;
216 __u32 p_chown_restricted;
217 __u32 p_case_insensitive;
218 __u32 p_case_preserving;
219};
220
221struct nfsd3_commitres {
222 __u32 status;
223 struct svc_fh fh;
224};
225
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000226struct nfsd3_getaclres {
227 __u32 status;
228 struct svc_fh fh;
229 int mask;
230 struct posix_acl *acl_access;
231 struct posix_acl *acl_default;
232};
233
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234/* dummy type for release */
235struct nfsd3_fhandle_pair {
236 __u32 dummy;
237 struct svc_fh fh1;
238 struct svc_fh fh2;
239};
240
241/*
242 * Storage requirements for XDR arguments and results.
243 */
244union nfsd3_xdrstore {
245 struct nfsd3_sattrargs sattrargs;
246 struct nfsd3_diropargs diropargs;
247 struct nfsd3_readargs readargs;
248 struct nfsd3_writeargs writeargs;
249 struct nfsd3_createargs createargs;
250 struct nfsd3_renameargs renameargs;
251 struct nfsd3_linkargs linkargs;
252 struct nfsd3_symlinkargs symlinkargs;
253 struct nfsd3_readdirargs readdirargs;
254 struct nfsd3_diropres diropres;
255 struct nfsd3_accessres accessres;
256 struct nfsd3_readlinkres readlinkres;
257 struct nfsd3_readres readres;
258 struct nfsd3_writeres writeres;
259 struct nfsd3_renameres renameres;
260 struct nfsd3_linkres linkres;
261 struct nfsd3_readdirres readdirres;
262 struct nfsd3_fsstatres fsstatres;
263 struct nfsd3_fsinfores fsinfores;
264 struct nfsd3_pathconfres pathconfres;
265 struct nfsd3_commitres commitres;
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000266 struct nfsd3_getaclres getaclres;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267};
268
269#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
270
271int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct nfsd_fhandle *);
272int nfs3svc_decode_sattrargs(struct svc_rqst *, u32 *,
273 struct nfsd3_sattrargs *);
274int nfs3svc_decode_diropargs(struct svc_rqst *, u32 *,
275 struct nfsd3_diropargs *);
276int nfs3svc_decode_accessargs(struct svc_rqst *, u32 *,
277 struct nfsd3_accessargs *);
278int nfs3svc_decode_readargs(struct svc_rqst *, u32 *,
279 struct nfsd3_readargs *);
280int nfs3svc_decode_writeargs(struct svc_rqst *, u32 *,
281 struct nfsd3_writeargs *);
282int nfs3svc_decode_createargs(struct svc_rqst *, u32 *,
283 struct nfsd3_createargs *);
284int nfs3svc_decode_mkdirargs(struct svc_rqst *, u32 *,
285 struct nfsd3_createargs *);
286int nfs3svc_decode_mknodargs(struct svc_rqst *, u32 *,
287 struct nfsd3_mknodargs *);
288int nfs3svc_decode_renameargs(struct svc_rqst *, u32 *,
289 struct nfsd3_renameargs *);
290int nfs3svc_decode_readlinkargs(struct svc_rqst *, u32 *,
291 struct nfsd3_readlinkargs *);
292int nfs3svc_decode_linkargs(struct svc_rqst *, u32 *,
293 struct nfsd3_linkargs *);
294int nfs3svc_decode_symlinkargs(struct svc_rqst *, u32 *,
295 struct nfsd3_symlinkargs *);
296int nfs3svc_decode_readdirargs(struct svc_rqst *, u32 *,
297 struct nfsd3_readdirargs *);
298int nfs3svc_decode_readdirplusargs(struct svc_rqst *, u32 *,
299 struct nfsd3_readdirargs *);
300int nfs3svc_decode_commitargs(struct svc_rqst *, u32 *,
301 struct nfsd3_commitargs *);
302int nfs3svc_encode_voidres(struct svc_rqst *, u32 *, void *);
303int nfs3svc_encode_attrstat(struct svc_rqst *, u32 *,
304 struct nfsd3_attrstat *);
305int nfs3svc_encode_wccstat(struct svc_rqst *, u32 *,
306 struct nfsd3_attrstat *);
307int nfs3svc_encode_diropres(struct svc_rqst *, u32 *,
308 struct nfsd3_diropres *);
309int nfs3svc_encode_accessres(struct svc_rqst *, u32 *,
310 struct nfsd3_accessres *);
311int nfs3svc_encode_readlinkres(struct svc_rqst *, u32 *,
312 struct nfsd3_readlinkres *);
313int nfs3svc_encode_readres(struct svc_rqst *, u32 *, struct nfsd3_readres *);
314int nfs3svc_encode_writeres(struct svc_rqst *, u32 *, struct nfsd3_writeres *);
315int nfs3svc_encode_createres(struct svc_rqst *, u32 *,
316 struct nfsd3_diropres *);
317int nfs3svc_encode_renameres(struct svc_rqst *, u32 *,
318 struct nfsd3_renameres *);
319int nfs3svc_encode_linkres(struct svc_rqst *, u32 *,
320 struct nfsd3_linkres *);
321int nfs3svc_encode_readdirres(struct svc_rqst *, u32 *,
322 struct nfsd3_readdirres *);
323int nfs3svc_encode_fsstatres(struct svc_rqst *, u32 *,
324 struct nfsd3_fsstatres *);
325int nfs3svc_encode_fsinfores(struct svc_rqst *, u32 *,
326 struct nfsd3_fsinfores *);
327int nfs3svc_encode_pathconfres(struct svc_rqst *, u32 *,
328 struct nfsd3_pathconfres *);
329int nfs3svc_encode_commitres(struct svc_rqst *, u32 *,
330 struct nfsd3_commitres *);
331
332int nfs3svc_release_fhandle(struct svc_rqst *, u32 *,
333 struct nfsd3_attrstat *);
334int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *,
335 struct nfsd3_fhandle_pair *);
336int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
337 int namlen, loff_t offset, ino_t ino,
338 unsigned int);
339int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
340 int namlen, loff_t offset, ino_t ino,
341 unsigned int);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000342/* Helper functions for NFSv3 ACL code */
343u32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p,
344 struct svc_fh *fhp);
345u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346
347
348#endif /* _LINUX_NFSD_XDR3_H */