1 /*
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 
14 struct nfsd3_sattrargs {
15 	struct svc_fh		fh;
16 	struct iattr		attrs;
17 	int			check_guard;
18 	time_t			guardtime;
19 };
20 
21 struct nfsd3_diropargs {
22 	struct svc_fh		fh;
23 	char *			name;
24 	int			len;
25 };
26 
27 struct nfsd3_accessargs {
28 	struct svc_fh		fh;
29 	unsigned int		access;
30 };
31 
32 struct nfsd3_readargs {
33 	struct svc_fh		fh;
34 	__u64			offset;
35 	__u32			count;
36 };
37 
38 struct nfsd3_writeargs {
39 	svc_fh			fh;
40 	__u64			offset;
41 	__u32			count;
42 	int			stable;
43 	__u8 *			data;
44 	__u32			len;
45 };
46 
47 struct nfsd3_createargs {
48 	struct svc_fh		fh;
49 	char *			name;
50 	int			len;
51 	int			createmode;
52 	struct iattr		attrs;
53 	__u32 *			verf;
54 };
55 
56 struct nfsd3_mknodargs {
57 	struct svc_fh		fh;
58 	char *			name;
59 	int			len;
60 	__u32			ftype;
61 	__u32			major, minor;
62 	struct iattr		attrs;
63 };
64 
65 struct nfsd3_renameargs {
66 	struct svc_fh		ffh;
67 	char *			fname;
68 	int			flen;
69 	struct svc_fh		tfh;
70 	char *			tname;
71 	int			tlen;
72 };
73 
74 struct nfsd3_linkargs {
75 	struct svc_fh		ffh;
76 	struct svc_fh		tfh;
77 	char *			tname;
78 	int			tlen;
79 };
80 
81 struct nfsd3_symlinkargs {
82 	struct svc_fh		ffh;
83 	char *			fname;
84 	int			flen;
85 	char *			tname;
86 	int			tlen;
87 	struct iattr		attrs;
88 };
89 
90 struct nfsd3_readdirargs {
91 	struct svc_fh		fh;
92 	__u64			cookie;
93 	__u32			dircount;
94 	__u32			count;
95 	__u32 *			verf;
96 };
97 
98 struct nfsd3_commitargs {
99 	struct svc_fh		fh;
100 	__u64			offset;
101 	__u32			count;
102 };
103 
104 struct nfsd3_attrstat {
105 	__u32			status;
106 	struct svc_fh		fh;
107 };
108 
109 /* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
110 struct nfsd3_diropres  {
111 	__u32			status;
112 	struct svc_fh		dirfh;
113 	struct svc_fh		fh;
114 };
115 
116 struct nfsd3_accessres {
117 	__u32			status;
118 	struct svc_fh		fh;
119 	__u32			access;
120 };
121 
122 struct nfsd3_readlinkres {
123 	__u32			status;
124 	struct svc_fh		fh;
125 	__u32			len;
126 };
127 
128 struct nfsd3_readres {
129 	__u32			status;
130 	struct svc_fh		fh;
131 	unsigned long		count;
132 	int			eof;
133 };
134 
135 struct nfsd3_writeres {
136 	__u32			status;
137 	struct svc_fh		fh;
138 	unsigned long		count;
139 	int			committed;
140 };
141 
142 struct nfsd3_renameres {
143 	__u32			status;
144 	struct svc_fh		ffh;
145 	struct svc_fh		tfh;
146 };
147 
148 struct nfsd3_linkres {
149 	__u32			status;
150 	struct svc_fh		tfh;
151 	struct svc_fh		fh;
152 };
153 
154 struct nfsd3_readdirres {
155 	__u32			status;
156 	struct svc_fh		fh;
157 	int			count;
158 	__u32			verf[2];
159 };
160 
161 struct nfsd3_fsstatres {
162 	__u32			status;
163 	struct statfs		stats;
164 	__u32			invarsec;
165 };
166 
167 struct nfsd3_fsinfores {
168 	__u32			status;
169 	__u32			f_rtmax;
170 	__u32			f_rtpref;
171 	__u32			f_rtmult;
172 	__u32			f_wtmax;
173 	__u32			f_wtpref;
174 	__u32			f_wtmult;
175 	__u32			f_dtpref;
176 	__u64			f_maxfilesize;
177 	__u32			f_properties;
178 };
179 
180 struct nfsd3_pathconfres {
181 	__u32			status;
182 	__u32			p_link_max;
183 	__u32			p_name_max;
184 	__u32			p_no_trunc;
185 	__u32			p_chown_restricted;
186 	__u32			p_case_insensitive;
187 	__u32			p_case_preserving;
188 };
189 
190 struct nfsd3_commitres {
191 	__u32			status;
192 	struct svc_fh		fh;
193 };
194 
195 /* dummy type for release */
196 struct nfsd3_fhandle_pair {
197 	__u32			dummy;
198 	struct svc_fh		fh1;
199 	struct svc_fh		fh2;
200 };
201 
202 /*
203  * Storage requirements for XDR arguments and results.
204  */
205 union nfsd3_xdrstore {
206 	struct nfsd3_sattrargs		sattrargs;
207 	struct nfsd3_diropargs		diropargs;
208 	struct nfsd3_readargs		readargs;
209 	struct nfsd3_writeargs		writeargs;
210 	struct nfsd3_createargs		createargs;
211 	struct nfsd3_renameargs		renameargs;
212 	struct nfsd3_linkargs		linkargs;
213 	struct nfsd3_symlinkargs	symlinkargs;
214 	struct nfsd3_readdirargs	readdirargs;
215 	struct nfsd3_diropres 		diropres;
216 	struct nfsd3_accessres		accessres;
217 	struct nfsd3_readlinkres	readlinkres;
218 	struct nfsd3_readres		readres;
219 	struct nfsd3_writeres		writeres;
220 	struct nfsd3_renameres		renameres;
221 	struct nfsd3_linkres		linkres;
222 	struct nfsd3_readdirres		readdirres;
223 	struct nfsd3_fsstatres		fsstatres;
224 	struct nfsd3_fsinfores		fsinfores;
225 	struct nfsd3_pathconfres	pathconfres;
226 	struct nfsd3_commitres		commitres;
227 };
228 
229 #define NFS3_SVC_XDRSIZE		sizeof(union nfsd3_xdrstore)
230 
231 int nfs3svc_decode_fhandle(struct svc_rqst *, u32 *, struct svc_fh *);
232 int nfs3svc_decode_sattrargs(struct svc_rqst *, u32 *,
233 				struct nfsd3_sattrargs *);
234 int nfs3svc_decode_diropargs(struct svc_rqst *, u32 *,
235 				struct nfsd3_diropargs *);
236 int nfs3svc_decode_accessargs(struct svc_rqst *, u32 *,
237 				struct nfsd3_accessargs *);
238 int nfs3svc_decode_readargs(struct svc_rqst *, u32 *,
239 				struct nfsd3_readargs *);
240 int nfs3svc_decode_writeargs(struct svc_rqst *, u32 *,
241 				struct nfsd3_writeargs *);
242 int nfs3svc_decode_createargs(struct svc_rqst *, u32 *,
243 				struct nfsd3_createargs *);
244 int nfs3svc_decode_mkdirargs(struct svc_rqst *, u32 *,
245 				struct nfsd3_createargs *);
246 int nfs3svc_decode_mknodargs(struct svc_rqst *, u32 *,
247 				struct nfsd3_mknodargs *);
248 int nfs3svc_decode_renameargs(struct svc_rqst *, u32 *,
249 				struct nfsd3_renameargs *);
250 int nfs3svc_decode_linkargs(struct svc_rqst *, u32 *,
251 				struct nfsd3_linkargs *);
252 int nfs3svc_decode_symlinkargs(struct svc_rqst *, u32 *,
253 				struct nfsd3_symlinkargs *);
254 int nfs3svc_decode_readdirargs(struct svc_rqst *, u32 *,
255 				struct nfsd3_readdirargs *);
256 int nfs3svc_decode_readdirplusargs(struct svc_rqst *, u32 *,
257 				struct nfsd3_readdirargs *);
258 int nfs3svc_decode_commitargs(struct svc_rqst *, u32 *,
259 				struct nfsd3_commitargs *);
260 int nfs3svc_encode_voidres(struct svc_rqst *, u32 *, void *);
261 int nfs3svc_encode_attrstat(struct svc_rqst *, u32 *,
262 				struct nfsd3_attrstat *);
263 int nfs3svc_encode_wccstat(struct svc_rqst *, u32 *,
264 				struct nfsd3_attrstat *);
265 int nfs3svc_encode_diropres(struct svc_rqst *, u32 *,
266 				struct nfsd3_diropres *);
267 int nfs3svc_encode_accessres(struct svc_rqst *, u32 *,
268 				struct nfsd3_accessres *);
269 int nfs3svc_encode_readlinkres(struct svc_rqst *, u32 *,
270 				struct nfsd3_readlinkres *);
271 int nfs3svc_encode_readres(struct svc_rqst *, u32 *, struct nfsd3_readres *);
272 int nfs3svc_encode_writeres(struct svc_rqst *, u32 *, struct nfsd3_writeres *);
273 int nfs3svc_encode_createres(struct svc_rqst *, u32 *,
274 				struct nfsd3_diropres *);
275 int nfs3svc_encode_renameres(struct svc_rqst *, u32 *,
276 				struct nfsd3_renameres *);
277 int nfs3svc_encode_linkres(struct svc_rqst *, u32 *,
278 				struct nfsd3_linkres *);
279 int nfs3svc_encode_readdirres(struct svc_rqst *, u32 *,
280 				struct nfsd3_readdirres *);
281 int nfs3svc_encode_fsstatres(struct svc_rqst *, u32 *,
282 				struct nfsd3_fsstatres *);
283 int nfs3svc_encode_fsinfores(struct svc_rqst *, u32 *,
284 				struct nfsd3_fsinfores *);
285 int nfs3svc_encode_pathconfres(struct svc_rqst *, u32 *,
286 				struct nfsd3_pathconfres *);
287 int nfs3svc_encode_commitres(struct svc_rqst *, u32 *,
288 				struct nfsd3_commitres *);
289 
290 int nfs3svc_release_fhandle(struct svc_rqst *, u32 *,
291 				struct nfsd3_attrstat *);
292 int nfs3svc_release_fhandle2(struct svc_rqst *, u32 *,
293 				struct nfsd3_fhandle_pair *);
294 int nfs3svc_encode_entry(struct readdir_cd *, const char *name,
295 				int namlen, loff_t offset, ino_t ino,
296 				unsigned int);
297 int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name,
298 				int namlen, loff_t offset, ino_t ino,
299 				unsigned int);
300 
301 
302 #endif /* _LINUX_NFSD_XDR3_H */
303