Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
1da177e4 | 2 | /* |
1da177e4 LT |
3 | * Process version 3 NFS requests. |
4 | * | |
5 | * Copyright (C) 1996, 1997, 1998 Olaf Kirch <okir@monad.swb.de> | |
6 | */ | |
7 | ||
1da177e4 LT |
8 | #include <linux/fs.h> |
9 | #include <linux/ext2_fs.h> | |
12214cb7 | 10 | #include <linux/magic.h> |
1da177e4 | 11 | |
9a74af21 BH |
12 | #include "cache.h" |
13 | #include "xdr3.h" | |
0a3adade | 14 | #include "vfs.h" |
1da177e4 LT |
15 | |
16 | #define NFSDDBG_FACILITY NFSDDBG_PROC | |
17 | ||
18 | #define RETURN_STATUS(st) { resp->status = (st); return (st); } | |
19 | ||
20 | static int nfs3_ftypes[] = { | |
21 | 0, /* NF3NON */ | |
22 | S_IFREG, /* NF3REG */ | |
23 | S_IFDIR, /* NF3DIR */ | |
24 | S_IFBLK, /* NF3BLK */ | |
25 | S_IFCHR, /* NF3CHR */ | |
26 | S_IFLNK, /* NF3LNK */ | |
27 | S_IFSOCK, /* NF3SOCK */ | |
28 | S_IFIFO, /* NF3FIFO */ | |
29 | }; | |
30 | ||
31 | /* | |
32 | * NULL call. | |
33 | */ | |
7111c66e | 34 | static __be32 |
a6beb732 | 35 | nfsd3_proc_null(struct svc_rqst *rqstp) |
1da177e4 LT |
36 | { |
37 | return nfs_ok; | |
38 | } | |
39 | ||
40 | /* | |
41 | * Get a file's attributes | |
42 | */ | |
7111c66e | 43 | static __be32 |
a6beb732 | 44 | nfsd3_proc_getattr(struct svc_rqst *rqstp) |
1da177e4 | 45 | { |
a6beb732 CH |
46 | struct nfsd_fhandle *argp = rqstp->rq_argp; |
47 | struct nfsd3_attrstat *resp = rqstp->rq_resp; | |
c4d987ba | 48 | __be32 nfserr; |
1da177e4 LT |
49 | |
50 | dprintk("nfsd: GETATTR(3) %s\n", | |
a334de28 | 51 | SVCFH_fmt(&argp->fh)); |
1da177e4 LT |
52 | |
53 | fh_copy(&resp->fh, &argp->fh); | |
04716e66 BF |
54 | nfserr = fh_verify(rqstp, &resp->fh, 0, |
55 | NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT); | |
a334de28 DS |
56 | if (nfserr) |
57 | RETURN_STATUS(nfserr); | |
58 | ||
3dadecce | 59 | nfserr = fh_getattr(&resp->fh, &resp->stat); |
a334de28 | 60 | |
1da177e4 LT |
61 | RETURN_STATUS(nfserr); |
62 | } | |
63 | ||
64 | /* | |
65 | * Set a file's attributes | |
66 | */ | |
7111c66e | 67 | static __be32 |
a6beb732 | 68 | nfsd3_proc_setattr(struct svc_rqst *rqstp) |
1da177e4 | 69 | { |
a6beb732 CH |
70 | struct nfsd3_sattrargs *argp = rqstp->rq_argp; |
71 | struct nfsd3_attrstat *resp = rqstp->rq_resp; | |
c4d987ba | 72 | __be32 nfserr; |
1da177e4 LT |
73 | |
74 | dprintk("nfsd: SETATTR(3) %s\n", | |
75 | SVCFH_fmt(&argp->fh)); | |
76 | ||
77 | fh_copy(&resp->fh, &argp->fh); | |
78 | nfserr = nfsd_setattr(rqstp, &resp->fh, &argp->attrs, | |
79 | argp->check_guard, argp->guardtime); | |
80 | RETURN_STATUS(nfserr); | |
81 | } | |
82 | ||
83 | /* | |
84 | * Look up a path name component | |
85 | */ | |
7111c66e | 86 | static __be32 |
a6beb732 | 87 | nfsd3_proc_lookup(struct svc_rqst *rqstp) |
1da177e4 | 88 | { |
a6beb732 CH |
89 | struct nfsd3_diropargs *argp = rqstp->rq_argp; |
90 | struct nfsd3_diropres *resp = rqstp->rq_resp; | |
c4d987ba | 91 | __be32 nfserr; |
1da177e4 LT |
92 | |
93 | dprintk("nfsd: LOOKUP(3) %s %.*s\n", | |
94 | SVCFH_fmt(&argp->fh), | |
95 | argp->len, | |
96 | argp->name); | |
97 | ||
98 | fh_copy(&resp->dirfh, &argp->fh); | |
99 | fh_init(&resp->fh, NFS3_FHSIZE); | |
100 | ||
101 | nfserr = nfsd_lookup(rqstp, &resp->dirfh, | |
102 | argp->name, | |
103 | argp->len, | |
104 | &resp->fh); | |
105 | RETURN_STATUS(nfserr); | |
106 | } | |
107 | ||
108 | /* | |
109 | * Check file access | |
110 | */ | |
7111c66e | 111 | static __be32 |
a6beb732 | 112 | nfsd3_proc_access(struct svc_rqst *rqstp) |
1da177e4 | 113 | { |
a6beb732 CH |
114 | struct nfsd3_accessargs *argp = rqstp->rq_argp; |
115 | struct nfsd3_accessres *resp = rqstp->rq_resp; | |
c4d987ba | 116 | __be32 nfserr; |
1da177e4 LT |
117 | |
118 | dprintk("nfsd: ACCESS(3) %s 0x%x\n", | |
119 | SVCFH_fmt(&argp->fh), | |
120 | argp->access); | |
121 | ||
122 | fh_copy(&resp->fh, &argp->fh); | |
123 | resp->access = argp->access; | |
124 | nfserr = nfsd_access(rqstp, &resp->fh, &resp->access, NULL); | |
125 | RETURN_STATUS(nfserr); | |
126 | } | |
127 | ||
128 | /* | |
129 | * Read a symlink. | |
130 | */ | |
7111c66e | 131 | static __be32 |
a6beb732 | 132 | nfsd3_proc_readlink(struct svc_rqst *rqstp) |
1da177e4 | 133 | { |
a6beb732 CH |
134 | struct nfsd3_readlinkargs *argp = rqstp->rq_argp; |
135 | struct nfsd3_readlinkres *resp = rqstp->rq_resp; | |
c4d987ba | 136 | __be32 nfserr; |
1da177e4 LT |
137 | |
138 | dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh)); | |
139 | ||
140 | /* Read the symlink. */ | |
141 | fh_copy(&resp->fh, &argp->fh); | |
142 | resp->len = NFS3_MAXPATHLEN; | |
143 | nfserr = nfsd_readlink(rqstp, &resp->fh, argp->buffer, &resp->len); | |
144 | RETURN_STATUS(nfserr); | |
145 | } | |
146 | ||
147 | /* | |
148 | * Read a portion of a file. | |
149 | */ | |
7111c66e | 150 | static __be32 |
a6beb732 | 151 | nfsd3_proc_read(struct svc_rqst *rqstp) |
1da177e4 | 152 | { |
a6beb732 CH |
153 | struct nfsd3_readargs *argp = rqstp->rq_argp; |
154 | struct nfsd3_readres *resp = rqstp->rq_resp; | |
c4d987ba | 155 | __be32 nfserr; |
7adae489 | 156 | u32 max_blocksize = svc_max_payload(rqstp); |
ac503e4a | 157 | unsigned long cnt = min(argp->count, max_blocksize); |
1da177e4 | 158 | |
18b631f8 | 159 | dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n", |
1da177e4 LT |
160 | SVCFH_fmt(&argp->fh), |
161 | (unsigned long) argp->count, | |
18b631f8 | 162 | (unsigned long long) argp->offset); |
1da177e4 LT |
163 | |
164 | /* Obtain buffer pointer for payload. | |
165 | * 1 (status) + 22 (post_op_attr) + 1 (count) + 1 (eof) | |
166 | * + 1 (xdr opaque byte count) = 26 | |
167 | */ | |
ac503e4a | 168 | resp->count = cnt; |
cd123012 | 169 | svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4); |
1da177e4 LT |
170 | |
171 | fh_copy(&resp->fh, &argp->fh); | |
039a87ca | 172 | nfserr = nfsd_read(rqstp, &resp->fh, |
1da177e4 | 173 | argp->offset, |
3cc03b16 | 174 | rqstp->rq_vec, argp->vlen, |
1da177e4 LT |
175 | &resp->count); |
176 | if (nfserr == 0) { | |
2b0143b5 | 177 | struct inode *inode = d_inode(resp->fh.fh_dentry); |
ac503e4a BC |
178 | resp->eof = nfsd_eof_on_read(cnt, resp->count, argp->offset, |
179 | inode->i_size); | |
1da177e4 LT |
180 | } |
181 | ||
182 | RETURN_STATUS(nfserr); | |
183 | } | |
184 | ||
185 | /* | |
186 | * Write data to a file | |
187 | */ | |
7111c66e | 188 | static __be32 |
a6beb732 | 189 | nfsd3_proc_write(struct svc_rqst *rqstp) |
1da177e4 | 190 | { |
a6beb732 CH |
191 | struct nfsd3_writeargs *argp = rqstp->rq_argp; |
192 | struct nfsd3_writeres *resp = rqstp->rq_resp; | |
c4d987ba | 193 | __be32 nfserr; |
31dec253 | 194 | unsigned long cnt = argp->len; |
8154ef27 | 195 | unsigned int nvecs; |
1da177e4 | 196 | |
18b631f8 | 197 | dprintk("nfsd: WRITE(3) %s %d bytes at %Lu%s\n", |
1da177e4 LT |
198 | SVCFH_fmt(&argp->fh), |
199 | argp->len, | |
18b631f8 | 200 | (unsigned long long) argp->offset, |
1da177e4 LT |
201 | argp->stable? " stable" : ""); |
202 | ||
203 | fh_copy(&resp->fh, &argp->fh); | |
204 | resp->committed = argp->stable; | |
3fd9557a CL |
205 | nvecs = svc_fill_write_vector(rqstp, rqstp->rq_arg.pages, |
206 | &argp->first, cnt); | |
8154ef27 CL |
207 | if (!nvecs) |
208 | RETURN_STATUS(nfserr_io); | |
52e380e0 | 209 | nfserr = nfsd_write(rqstp, &resp->fh, argp->offset, |
8154ef27 CL |
210 | rqstp->rq_vec, nvecs, &cnt, |
211 | resp->committed); | |
31dec253 | 212 | resp->count = cnt; |
1da177e4 LT |
213 | RETURN_STATUS(nfserr); |
214 | } | |
215 | ||
216 | /* | |
217 | * With NFSv3, CREATE processing is a lot easier than with NFSv2. | |
218 | * At least in theory; we'll see how it fares in practice when the | |
219 | * first reports about SunOS compatibility problems start to pour in... | |
220 | */ | |
7111c66e | 221 | static __be32 |
a6beb732 | 222 | nfsd3_proc_create(struct svc_rqst *rqstp) |
1da177e4 | 223 | { |
a6beb732 CH |
224 | struct nfsd3_createargs *argp = rqstp->rq_argp; |
225 | struct nfsd3_diropres *resp = rqstp->rq_resp; | |
1da177e4 LT |
226 | svc_fh *dirfhp, *newfhp = NULL; |
227 | struct iattr *attr; | |
c4d987ba | 228 | __be32 nfserr; |
1da177e4 LT |
229 | |
230 | dprintk("nfsd: CREATE(3) %s %.*s\n", | |
231 | SVCFH_fmt(&argp->fh), | |
232 | argp->len, | |
233 | argp->name); | |
234 | ||
235 | dirfhp = fh_copy(&resp->dirfh, &argp->fh); | |
236 | newfhp = fh_init(&resp->fh, NFS3_FHSIZE); | |
237 | attr = &argp->attrs; | |
238 | ||
1da177e4 LT |
239 | /* Unfudge the mode bits */ |
240 | attr->ia_mode &= ~S_IFMT; | |
241 | if (!(attr->ia_valid & ATTR_MODE)) { | |
242 | attr->ia_valid |= ATTR_MODE; | |
243 | attr->ia_mode = S_IFREG; | |
244 | } else { | |
245 | attr->ia_mode = (attr->ia_mode & ~S_IFMT) | S_IFREG; | |
246 | } | |
247 | ||
248 | /* Now create the file and set attributes */ | |
ac6721a1 | 249 | nfserr = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len, |
1da177e4 | 250 | attr, newfhp, |
95c7a20a | 251 | argp->createmode, (u32 *)argp->verf, NULL, NULL); |
1da177e4 LT |
252 | |
253 | RETURN_STATUS(nfserr); | |
254 | } | |
255 | ||
256 | /* | |
257 | * Make directory. This operation is not idempotent. | |
258 | */ | |
7111c66e | 259 | static __be32 |
a6beb732 | 260 | nfsd3_proc_mkdir(struct svc_rqst *rqstp) |
1da177e4 | 261 | { |
a6beb732 CH |
262 | struct nfsd3_createargs *argp = rqstp->rq_argp; |
263 | struct nfsd3_diropres *resp = rqstp->rq_resp; | |
c4d987ba | 264 | __be32 nfserr; |
1da177e4 LT |
265 | |
266 | dprintk("nfsd: MKDIR(3) %s %.*s\n", | |
267 | SVCFH_fmt(&argp->fh), | |
268 | argp->len, | |
269 | argp->name); | |
270 | ||
271 | argp->attrs.ia_valid &= ~ATTR_SIZE; | |
272 | fh_copy(&resp->dirfh, &argp->fh); | |
273 | fh_init(&resp->fh, NFS3_FHSIZE); | |
274 | nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, | |
275 | &argp->attrs, S_IFDIR, 0, &resp->fh); | |
43a9aa64 | 276 | fh_unlock(&resp->dirfh); |
1da177e4 LT |
277 | RETURN_STATUS(nfserr); |
278 | } | |
279 | ||
7111c66e | 280 | static __be32 |
a6beb732 | 281 | nfsd3_proc_symlink(struct svc_rqst *rqstp) |
1da177e4 | 282 | { |
a6beb732 CH |
283 | struct nfsd3_symlinkargs *argp = rqstp->rq_argp; |
284 | struct nfsd3_diropres *resp = rqstp->rq_resp; | |
c4d987ba | 285 | __be32 nfserr; |
1da177e4 | 286 | |
38a70315 CL |
287 | if (argp->tlen == 0) |
288 | RETURN_STATUS(nfserr_inval); | |
289 | if (argp->tlen > NFS3_MAXPATHLEN) | |
290 | RETURN_STATUS(nfserr_nametoolong); | |
291 | ||
292 | argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first, | |
293 | argp->tlen); | |
294 | if (IS_ERR(argp->tname)) | |
295 | RETURN_STATUS(nfserrno(PTR_ERR(argp->tname))); | |
296 | ||
1da177e4 LT |
297 | dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n", |
298 | SVCFH_fmt(&argp->ffh), | |
299 | argp->flen, argp->fname, | |
300 | argp->tlen, argp->tname); | |
301 | ||
302 | fh_copy(&resp->dirfh, &argp->ffh); | |
303 | fh_init(&resp->fh, NFS3_FHSIZE); | |
304 | nfserr = nfsd_symlink(rqstp, &resp->dirfh, argp->fname, argp->flen, | |
1e444f5b | 305 | argp->tname, &resp->fh); |
1da177e4 LT |
306 | RETURN_STATUS(nfserr); |
307 | } | |
308 | ||
309 | /* | |
310 | * Make socket/fifo/device. | |
311 | */ | |
7111c66e | 312 | static __be32 |
a6beb732 | 313 | nfsd3_proc_mknod(struct svc_rqst *rqstp) |
1da177e4 | 314 | { |
a6beb732 CH |
315 | struct nfsd3_mknodargs *argp = rqstp->rq_argp; |
316 | struct nfsd3_diropres *resp = rqstp->rq_resp; | |
c4d987ba AV |
317 | __be32 nfserr; |
318 | int type; | |
1da177e4 LT |
319 | dev_t rdev = 0; |
320 | ||
321 | dprintk("nfsd: MKNOD(3) %s %.*s\n", | |
322 | SVCFH_fmt(&argp->fh), | |
323 | argp->len, | |
324 | argp->name); | |
325 | ||
326 | fh_copy(&resp->dirfh, &argp->fh); | |
327 | fh_init(&resp->fh, NFS3_FHSIZE); | |
328 | ||
329 | if (argp->ftype == 0 || argp->ftype >= NF3BAD) | |
330 | RETURN_STATUS(nfserr_inval); | |
331 | if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) { | |
332 | rdev = MKDEV(argp->major, argp->minor); | |
333 | if (MAJOR(rdev) != argp->major || | |
334 | MINOR(rdev) != argp->minor) | |
335 | RETURN_STATUS(nfserr_inval); | |
336 | } else | |
337 | if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) | |
338 | RETURN_STATUS(nfserr_inval); | |
339 | ||
340 | type = nfs3_ftypes[argp->ftype]; | |
341 | nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, | |
342 | &argp->attrs, type, rdev, &resp->fh); | |
43a9aa64 | 343 | fh_unlock(&resp->dirfh); |
1da177e4 LT |
344 | RETURN_STATUS(nfserr); |
345 | } | |
346 | ||
347 | /* | |
348 | * Remove file/fifo/socket etc. | |
349 | */ | |
7111c66e | 350 | static __be32 |
a6beb732 | 351 | nfsd3_proc_remove(struct svc_rqst *rqstp) |
1da177e4 | 352 | { |
a6beb732 CH |
353 | struct nfsd3_diropargs *argp = rqstp->rq_argp; |
354 | struct nfsd3_attrstat *resp = rqstp->rq_resp; | |
c4d987ba | 355 | __be32 nfserr; |
1da177e4 LT |
356 | |
357 | dprintk("nfsd: REMOVE(3) %s %.*s\n", | |
358 | SVCFH_fmt(&argp->fh), | |
359 | argp->len, | |
360 | argp->name); | |
361 | ||
362 | /* Unlink. -S_IFDIR means file must not be a directory */ | |
363 | fh_copy(&resp->fh, &argp->fh); | |
364 | nfserr = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR, argp->name, argp->len); | |
43a9aa64 | 365 | fh_unlock(&resp->fh); |
1da177e4 LT |
366 | RETURN_STATUS(nfserr); |
367 | } | |
368 | ||
369 | /* | |
370 | * Remove a directory | |
371 | */ | |
7111c66e | 372 | static __be32 |
a6beb732 | 373 | nfsd3_proc_rmdir(struct svc_rqst *rqstp) |
1da177e4 | 374 | { |
a6beb732 CH |
375 | struct nfsd3_diropargs *argp = rqstp->rq_argp; |
376 | struct nfsd3_attrstat *resp = rqstp->rq_resp; | |
c4d987ba | 377 | __be32 nfserr; |
1da177e4 LT |
378 | |
379 | dprintk("nfsd: RMDIR(3) %s %.*s\n", | |
380 | SVCFH_fmt(&argp->fh), | |
381 | argp->len, | |
382 | argp->name); | |
383 | ||
384 | fh_copy(&resp->fh, &argp->fh); | |
385 | nfserr = nfsd_unlink(rqstp, &resp->fh, S_IFDIR, argp->name, argp->len); | |
43a9aa64 | 386 | fh_unlock(&resp->fh); |
1da177e4 LT |
387 | RETURN_STATUS(nfserr); |
388 | } | |
389 | ||
7111c66e | 390 | static __be32 |
a6beb732 | 391 | nfsd3_proc_rename(struct svc_rqst *rqstp) |
1da177e4 | 392 | { |
a6beb732 CH |
393 | struct nfsd3_renameargs *argp = rqstp->rq_argp; |
394 | struct nfsd3_renameres *resp = rqstp->rq_resp; | |
c4d987ba | 395 | __be32 nfserr; |
1da177e4 LT |
396 | |
397 | dprintk("nfsd: RENAME(3) %s %.*s ->\n", | |
398 | SVCFH_fmt(&argp->ffh), | |
399 | argp->flen, | |
400 | argp->fname); | |
401 | dprintk("nfsd: -> %s %.*s\n", | |
402 | SVCFH_fmt(&argp->tfh), | |
403 | argp->tlen, | |
404 | argp->tname); | |
405 | ||
406 | fh_copy(&resp->ffh, &argp->ffh); | |
407 | fh_copy(&resp->tfh, &argp->tfh); | |
408 | nfserr = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen, | |
409 | &resp->tfh, argp->tname, argp->tlen); | |
410 | RETURN_STATUS(nfserr); | |
411 | } | |
412 | ||
7111c66e | 413 | static __be32 |
a6beb732 | 414 | nfsd3_proc_link(struct svc_rqst *rqstp) |
1da177e4 | 415 | { |
a6beb732 CH |
416 | struct nfsd3_linkargs *argp = rqstp->rq_argp; |
417 | struct nfsd3_linkres *resp = rqstp->rq_resp; | |
c4d987ba | 418 | __be32 nfserr; |
1da177e4 LT |
419 | |
420 | dprintk("nfsd: LINK(3) %s ->\n", | |
421 | SVCFH_fmt(&argp->ffh)); | |
422 | dprintk("nfsd: -> %s %.*s\n", | |
423 | SVCFH_fmt(&argp->tfh), | |
424 | argp->tlen, | |
425 | argp->tname); | |
426 | ||
427 | fh_copy(&resp->fh, &argp->ffh); | |
428 | fh_copy(&resp->tfh, &argp->tfh); | |
429 | nfserr = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen, | |
430 | &resp->fh); | |
431 | RETURN_STATUS(nfserr); | |
432 | } | |
433 | ||
434 | /* | |
435 | * Read a portion of a directory. | |
436 | */ | |
7111c66e | 437 | static __be32 |
a6beb732 | 438 | nfsd3_proc_readdir(struct svc_rqst *rqstp) |
1da177e4 | 439 | { |
a6beb732 CH |
440 | struct nfsd3_readdirargs *argp = rqstp->rq_argp; |
441 | struct nfsd3_readdirres *resp = rqstp->rq_resp; | |
c4d987ba AV |
442 | __be32 nfserr; |
443 | int count; | |
1da177e4 LT |
444 | |
445 | dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", | |
446 | SVCFH_fmt(&argp->fh), | |
447 | argp->count, (u32) argp->cookie); | |
448 | ||
449 | /* Make sure we've room for the NULL ptr & eof flag, and shrink to | |
450 | * client read size */ | |
451 | count = (argp->count >> 2) - 2; | |
452 | ||
453 | /* Read directory and encode entries on the fly */ | |
454 | fh_copy(&resp->fh, &argp->fh); | |
455 | ||
456 | resp->buflen = count; | |
457 | resp->common.err = nfs_ok; | |
458 | resp->buffer = argp->buffer; | |
459 | resp->rqstp = rqstp; | |
460 | nfserr = nfsd_readdir(rqstp, &resp->fh, (loff_t*) &argp->cookie, | |
461 | &resp->common, nfs3svc_encode_entry); | |
462 | memcpy(resp->verf, argp->verf, 8); | |
463 | resp->count = resp->buffer - argp->buffer; | |
464 | if (resp->offset) | |
465 | xdr_encode_hyper(resp->offset, argp->cookie); | |
466 | ||
467 | RETURN_STATUS(nfserr); | |
468 | } | |
469 | ||
470 | /* | |
471 | * Read a portion of a directory, including file handles and attrs. | |
472 | * For now, we choose to ignore the dircount parameter. | |
473 | */ | |
7111c66e | 474 | static __be32 |
a6beb732 | 475 | nfsd3_proc_readdirplus(struct svc_rqst *rqstp) |
1da177e4 | 476 | { |
a6beb732 CH |
477 | struct nfsd3_readdirargs *argp = rqstp->rq_argp; |
478 | struct nfsd3_readdirres *resp = rqstp->rq_resp; | |
c4d987ba AV |
479 | __be32 nfserr; |
480 | int count = 0; | |
1da177e4 | 481 | loff_t offset; |
afc59400 | 482 | struct page **p; |
1da177e4 LT |
483 | caddr_t page_addr = NULL; |
484 | ||
485 | dprintk("nfsd: READDIR+(3) %s %d bytes at %d\n", | |
486 | SVCFH_fmt(&argp->fh), | |
487 | argp->count, (u32) argp->cookie); | |
488 | ||
489 | /* Convert byte count to number of words (i.e. >> 2), | |
490 | * and reserve room for the NULL ptr & eof flag (-2 words) */ | |
491 | resp->count = (argp->count >> 2) - 2; | |
492 | ||
493 | /* Read directory and encode entries on the fly */ | |
494 | fh_copy(&resp->fh, &argp->fh); | |
495 | ||
496 | resp->common.err = nfs_ok; | |
497 | resp->buffer = argp->buffer; | |
498 | resp->buflen = resp->count; | |
499 | resp->rqstp = rqstp; | |
500 | offset = argp->cookie; | |
18c01ab3 RG |
501 | |
502 | nfserr = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP); | |
503 | if (nfserr) | |
504 | RETURN_STATUS(nfserr); | |
505 | ||
506 | if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) | |
507 | RETURN_STATUS(nfserr_notsupp); | |
508 | ||
1da177e4 LT |
509 | nfserr = nfsd_readdir(rqstp, &resp->fh, |
510 | &offset, | |
511 | &resp->common, | |
512 | nfs3svc_encode_entry_plus); | |
513 | memcpy(resp->verf, argp->verf, 8); | |
afc59400 BF |
514 | for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) { |
515 | page_addr = page_address(*p); | |
1da177e4 LT |
516 | |
517 | if (((caddr_t)resp->buffer >= page_addr) && | |
518 | ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) { | |
519 | count += (caddr_t)resp->buffer - page_addr; | |
520 | break; | |
521 | } | |
522 | count += PAGE_SIZE; | |
523 | } | |
524 | resp->count = count >> 2; | |
525 | if (resp->offset) { | |
526 | if (unlikely(resp->offset1)) { | |
527 | /* we ended up with offset on a page boundary */ | |
528 | *resp->offset = htonl(offset >> 32); | |
529 | *resp->offset1 = htonl(offset & 0xffffffff); | |
530 | resp->offset1 = NULL; | |
531 | } else { | |
532 | xdr_encode_hyper(resp->offset, offset); | |
533 | } | |
534 | } | |
535 | ||
536 | RETURN_STATUS(nfserr); | |
537 | } | |
538 | ||
539 | /* | |
540 | * Get file system stats | |
541 | */ | |
7111c66e | 542 | static __be32 |
a6beb732 | 543 | nfsd3_proc_fsstat(struct svc_rqst *rqstp) |
1da177e4 | 544 | { |
a6beb732 CH |
545 | struct nfsd_fhandle *argp = rqstp->rq_argp; |
546 | struct nfsd3_fsstatres *resp = rqstp->rq_resp; | |
c4d987ba | 547 | __be32 nfserr; |
1da177e4 LT |
548 | |
549 | dprintk("nfsd: FSSTAT(3) %s\n", | |
550 | SVCFH_fmt(&argp->fh)); | |
551 | ||
04716e66 | 552 | nfserr = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0); |
1da177e4 LT |
553 | fh_put(&argp->fh); |
554 | RETURN_STATUS(nfserr); | |
555 | } | |
556 | ||
557 | /* | |
558 | * Get file system info | |
559 | */ | |
7111c66e | 560 | static __be32 |
a6beb732 | 561 | nfsd3_proc_fsinfo(struct svc_rqst *rqstp) |
1da177e4 | 562 | { |
a6beb732 CH |
563 | struct nfsd_fhandle *argp = rqstp->rq_argp; |
564 | struct nfsd3_fsinfores *resp = rqstp->rq_resp; | |
c4d987ba | 565 | __be32 nfserr; |
7adae489 | 566 | u32 max_blocksize = svc_max_payload(rqstp); |
1da177e4 LT |
567 | |
568 | dprintk("nfsd: FSINFO(3) %s\n", | |
569 | SVCFH_fmt(&argp->fh)); | |
570 | ||
7adae489 GB |
571 | resp->f_rtmax = max_blocksize; |
572 | resp->f_rtpref = max_blocksize; | |
1da177e4 | 573 | resp->f_rtmult = PAGE_SIZE; |
7adae489 GB |
574 | resp->f_wtmax = max_blocksize; |
575 | resp->f_wtpref = max_blocksize; | |
1da177e4 LT |
576 | resp->f_wtmult = PAGE_SIZE; |
577 | resp->f_dtpref = PAGE_SIZE; | |
578 | resp->f_maxfilesize = ~(u32) 0; | |
579 | resp->f_properties = NFS3_FSF_DEFAULT; | |
580 | ||
04716e66 BF |
581 | nfserr = fh_verify(rqstp, &argp->fh, 0, |
582 | NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT); | |
1da177e4 LT |
583 | |
584 | /* Check special features of the file system. May request | |
585 | * different read/write sizes for file systems known to have | |
586 | * problems with large blocks */ | |
587 | if (nfserr == 0) { | |
fc64005c | 588 | struct super_block *sb = argp->fh.fh_dentry->d_sb; |
1da177e4 LT |
589 | |
590 | /* Note that we don't care for remote fs's here */ | |
12214cb7 | 591 | if (sb->s_magic == MSDOS_SUPER_MAGIC) { |
1da177e4 LT |
592 | resp->f_properties = NFS3_FSF_BILLYBOY; |
593 | } | |
594 | resp->f_maxfilesize = sb->s_maxbytes; | |
595 | } | |
596 | ||
597 | fh_put(&argp->fh); | |
598 | RETURN_STATUS(nfserr); | |
599 | } | |
600 | ||
601 | /* | |
602 | * Get pathconf info for the specified file | |
603 | */ | |
7111c66e | 604 | static __be32 |
a6beb732 | 605 | nfsd3_proc_pathconf(struct svc_rqst *rqstp) |
1da177e4 | 606 | { |
a6beb732 CH |
607 | struct nfsd_fhandle *argp = rqstp->rq_argp; |
608 | struct nfsd3_pathconfres *resp = rqstp->rq_resp; | |
c4d987ba | 609 | __be32 nfserr; |
1da177e4 LT |
610 | |
611 | dprintk("nfsd: PATHCONF(3) %s\n", | |
612 | SVCFH_fmt(&argp->fh)); | |
613 | ||
614 | /* Set default pathconf */ | |
615 | resp->p_link_max = 255; /* at least */ | |
616 | resp->p_name_max = 255; /* at least */ | |
617 | resp->p_no_trunc = 0; | |
618 | resp->p_chown_restricted = 1; | |
619 | resp->p_case_insensitive = 0; | |
620 | resp->p_case_preserving = 1; | |
621 | ||
8837abca | 622 | nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); |
1da177e4 LT |
623 | |
624 | if (nfserr == 0) { | |
fc64005c | 625 | struct super_block *sb = argp->fh.fh_dentry->d_sb; |
1da177e4 LT |
626 | |
627 | /* Note that we don't care for remote fs's here */ | |
628 | switch (sb->s_magic) { | |
629 | case EXT2_SUPER_MAGIC: | |
630 | resp->p_link_max = EXT2_LINK_MAX; | |
631 | resp->p_name_max = EXT2_NAME_LEN; | |
632 | break; | |
12214cb7 | 633 | case MSDOS_SUPER_MAGIC: |
1da177e4 LT |
634 | resp->p_case_insensitive = 1; |
635 | resp->p_case_preserving = 0; | |
636 | break; | |
637 | } | |
638 | } | |
639 | ||
640 | fh_put(&argp->fh); | |
641 | RETURN_STATUS(nfserr); | |
642 | } | |
643 | ||
644 | ||
645 | /* | |
646 | * Commit a file (range) to stable storage. | |
647 | */ | |
7111c66e | 648 | static __be32 |
a6beb732 | 649 | nfsd3_proc_commit(struct svc_rqst *rqstp) |
1da177e4 | 650 | { |
a6beb732 CH |
651 | struct nfsd3_commitargs *argp = rqstp->rq_argp; |
652 | struct nfsd3_commitres *resp = rqstp->rq_resp; | |
c4d987ba | 653 | __be32 nfserr; |
1da177e4 LT |
654 | |
655 | dprintk("nfsd: COMMIT(3) %s %u@%Lu\n", | |
656 | SVCFH_fmt(&argp->fh), | |
657 | argp->count, | |
658 | (unsigned long long) argp->offset); | |
659 | ||
660 | if (argp->offset > NFS_OFFSET_MAX) | |
661 | RETURN_STATUS(nfserr_inval); | |
662 | ||
663 | fh_copy(&resp->fh, &argp->fh); | |
664 | nfserr = nfsd_commit(rqstp, &resp->fh, argp->offset, argp->count); | |
665 | ||
666 | RETURN_STATUS(nfserr); | |
667 | } | |
668 | ||
669 | ||
670 | /* | |
671 | * NFSv3 Server procedures. | |
672 | * Only the results of non-idempotent operations are cached. | |
673 | */ | |
1da177e4 LT |
674 | #define nfs3svc_decode_fhandleargs nfs3svc_decode_fhandle |
675 | #define nfs3svc_encode_attrstatres nfs3svc_encode_attrstat | |
676 | #define nfs3svc_encode_wccstatres nfs3svc_encode_wccstat | |
677 | #define nfsd3_mkdirargs nfsd3_createargs | |
678 | #define nfsd3_readdirplusargs nfsd3_readdirargs | |
679 | #define nfsd3_fhandleargs nfsd_fhandle | |
680 | #define nfsd3_fhandleres nfsd3_attrstat | |
681 | #define nfsd3_attrstatres nfsd3_attrstat | |
682 | #define nfsd3_wccstatres nfsd3_attrstat | |
683 | #define nfsd3_createres nfsd3_diropres | |
684 | #define nfsd3_voidres nfsd3_voidargs | |
685 | struct nfsd3_voidargs { int dummy; }; | |
686 | ||
1da177e4 LT |
687 | #define ST 1 /* status*/ |
688 | #define FH 17 /* filehandle with length */ | |
689 | #define AT 21 /* attributes */ | |
690 | #define pAT (1+AT) /* post attributes - conditional */ | |
691 | #define WC (7+pAT) /* WCC attributes */ | |
692 | ||
860bda29 | 693 | static const struct svc_procedure nfsd_procedures3[22] = { |
b9081d90 | 694 | [NFS3PROC_NULL] = { |
a6beb732 | 695 | .pc_func = nfsd3_proc_null, |
63f8de37 | 696 | .pc_encode = nfs3svc_encode_voidres, |
b9081d90 YZ |
697 | .pc_argsize = sizeof(struct nfsd3_voidargs), |
698 | .pc_ressize = sizeof(struct nfsd3_voidres), | |
699 | .pc_cachetype = RC_NOCACHE, | |
700 | .pc_xdrressize = ST, | |
701 | }, | |
702 | [NFS3PROC_GETATTR] = { | |
a6beb732 | 703 | .pc_func = nfsd3_proc_getattr, |
026fec7e | 704 | .pc_decode = nfs3svc_decode_fhandleargs, |
63f8de37 | 705 | .pc_encode = nfs3svc_encode_attrstatres, |
8537488b | 706 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
707 | .pc_argsize = sizeof(struct nfsd3_fhandleargs), |
708 | .pc_ressize = sizeof(struct nfsd3_attrstatres), | |
709 | .pc_cachetype = RC_NOCACHE, | |
710 | .pc_xdrressize = ST+AT, | |
711 | }, | |
712 | [NFS3PROC_SETATTR] = { | |
a6beb732 | 713 | .pc_func = nfsd3_proc_setattr, |
026fec7e | 714 | .pc_decode = nfs3svc_decode_sattrargs, |
63f8de37 | 715 | .pc_encode = nfs3svc_encode_wccstatres, |
8537488b | 716 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
717 | .pc_argsize = sizeof(struct nfsd3_sattrargs), |
718 | .pc_ressize = sizeof(struct nfsd3_wccstatres), | |
719 | .pc_cachetype = RC_REPLBUFF, | |
720 | .pc_xdrressize = ST+WC, | |
721 | }, | |
722 | [NFS3PROC_LOOKUP] = { | |
a6beb732 | 723 | .pc_func = nfsd3_proc_lookup, |
026fec7e | 724 | .pc_decode = nfs3svc_decode_diropargs, |
63f8de37 | 725 | .pc_encode = nfs3svc_encode_diropres, |
8537488b | 726 | .pc_release = nfs3svc_release_fhandle2, |
b9081d90 YZ |
727 | .pc_argsize = sizeof(struct nfsd3_diropargs), |
728 | .pc_ressize = sizeof(struct nfsd3_diropres), | |
729 | .pc_cachetype = RC_NOCACHE, | |
730 | .pc_xdrressize = ST+FH+pAT+pAT, | |
731 | }, | |
732 | [NFS3PROC_ACCESS] = { | |
a6beb732 | 733 | .pc_func = nfsd3_proc_access, |
026fec7e | 734 | .pc_decode = nfs3svc_decode_accessargs, |
63f8de37 | 735 | .pc_encode = nfs3svc_encode_accessres, |
8537488b | 736 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
737 | .pc_argsize = sizeof(struct nfsd3_accessargs), |
738 | .pc_ressize = sizeof(struct nfsd3_accessres), | |
739 | .pc_cachetype = RC_NOCACHE, | |
740 | .pc_xdrressize = ST+pAT+1, | |
741 | }, | |
742 | [NFS3PROC_READLINK] = { | |
a6beb732 | 743 | .pc_func = nfsd3_proc_readlink, |
026fec7e | 744 | .pc_decode = nfs3svc_decode_readlinkargs, |
63f8de37 | 745 | .pc_encode = nfs3svc_encode_readlinkres, |
8537488b | 746 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
747 | .pc_argsize = sizeof(struct nfsd3_readlinkargs), |
748 | .pc_ressize = sizeof(struct nfsd3_readlinkres), | |
749 | .pc_cachetype = RC_NOCACHE, | |
750 | .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4, | |
751 | }, | |
752 | [NFS3PROC_READ] = { | |
a6beb732 | 753 | .pc_func = nfsd3_proc_read, |
026fec7e | 754 | .pc_decode = nfs3svc_decode_readargs, |
63f8de37 | 755 | .pc_encode = nfs3svc_encode_readres, |
8537488b | 756 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
757 | .pc_argsize = sizeof(struct nfsd3_readargs), |
758 | .pc_ressize = sizeof(struct nfsd3_readres), | |
759 | .pc_cachetype = RC_NOCACHE, | |
760 | .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4, | |
761 | }, | |
762 | [NFS3PROC_WRITE] = { | |
a6beb732 | 763 | .pc_func = nfsd3_proc_write, |
026fec7e | 764 | .pc_decode = nfs3svc_decode_writeargs, |
63f8de37 | 765 | .pc_encode = nfs3svc_encode_writeres, |
8537488b | 766 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
767 | .pc_argsize = sizeof(struct nfsd3_writeargs), |
768 | .pc_ressize = sizeof(struct nfsd3_writeres), | |
769 | .pc_cachetype = RC_REPLBUFF, | |
770 | .pc_xdrressize = ST+WC+4, | |
771 | }, | |
772 | [NFS3PROC_CREATE] = { | |
a6beb732 | 773 | .pc_func = nfsd3_proc_create, |
026fec7e | 774 | .pc_decode = nfs3svc_decode_createargs, |
63f8de37 | 775 | .pc_encode = nfs3svc_encode_createres, |
8537488b | 776 | .pc_release = nfs3svc_release_fhandle2, |
b9081d90 YZ |
777 | .pc_argsize = sizeof(struct nfsd3_createargs), |
778 | .pc_ressize = sizeof(struct nfsd3_createres), | |
779 | .pc_cachetype = RC_REPLBUFF, | |
780 | .pc_xdrressize = ST+(1+FH+pAT)+WC, | |
781 | }, | |
782 | [NFS3PROC_MKDIR] = { | |
a6beb732 | 783 | .pc_func = nfsd3_proc_mkdir, |
026fec7e | 784 | .pc_decode = nfs3svc_decode_mkdirargs, |
63f8de37 | 785 | .pc_encode = nfs3svc_encode_createres, |
8537488b | 786 | .pc_release = nfs3svc_release_fhandle2, |
b9081d90 YZ |
787 | .pc_argsize = sizeof(struct nfsd3_mkdirargs), |
788 | .pc_ressize = sizeof(struct nfsd3_createres), | |
789 | .pc_cachetype = RC_REPLBUFF, | |
790 | .pc_xdrressize = ST+(1+FH+pAT)+WC, | |
791 | }, | |
792 | [NFS3PROC_SYMLINK] = { | |
a6beb732 | 793 | .pc_func = nfsd3_proc_symlink, |
026fec7e | 794 | .pc_decode = nfs3svc_decode_symlinkargs, |
63f8de37 | 795 | .pc_encode = nfs3svc_encode_createres, |
8537488b | 796 | .pc_release = nfs3svc_release_fhandle2, |
b9081d90 YZ |
797 | .pc_argsize = sizeof(struct nfsd3_symlinkargs), |
798 | .pc_ressize = sizeof(struct nfsd3_createres), | |
799 | .pc_cachetype = RC_REPLBUFF, | |
800 | .pc_xdrressize = ST+(1+FH+pAT)+WC, | |
801 | }, | |
802 | [NFS3PROC_MKNOD] = { | |
a6beb732 | 803 | .pc_func = nfsd3_proc_mknod, |
026fec7e | 804 | .pc_decode = nfs3svc_decode_mknodargs, |
63f8de37 | 805 | .pc_encode = nfs3svc_encode_createres, |
8537488b | 806 | .pc_release = nfs3svc_release_fhandle2, |
b9081d90 YZ |
807 | .pc_argsize = sizeof(struct nfsd3_mknodargs), |
808 | .pc_ressize = sizeof(struct nfsd3_createres), | |
809 | .pc_cachetype = RC_REPLBUFF, | |
810 | .pc_xdrressize = ST+(1+FH+pAT)+WC, | |
811 | }, | |
812 | [NFS3PROC_REMOVE] = { | |
a6beb732 | 813 | .pc_func = nfsd3_proc_remove, |
026fec7e | 814 | .pc_decode = nfs3svc_decode_diropargs, |
63f8de37 | 815 | .pc_encode = nfs3svc_encode_wccstatres, |
8537488b | 816 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
817 | .pc_argsize = sizeof(struct nfsd3_diropargs), |
818 | .pc_ressize = sizeof(struct nfsd3_wccstatres), | |
819 | .pc_cachetype = RC_REPLBUFF, | |
820 | .pc_xdrressize = ST+WC, | |
821 | }, | |
822 | [NFS3PROC_RMDIR] = { | |
a6beb732 | 823 | .pc_func = nfsd3_proc_rmdir, |
026fec7e | 824 | .pc_decode = nfs3svc_decode_diropargs, |
63f8de37 | 825 | .pc_encode = nfs3svc_encode_wccstatres, |
8537488b | 826 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
827 | .pc_argsize = sizeof(struct nfsd3_diropargs), |
828 | .pc_ressize = sizeof(struct nfsd3_wccstatres), | |
829 | .pc_cachetype = RC_REPLBUFF, | |
830 | .pc_xdrressize = ST+WC, | |
831 | }, | |
832 | [NFS3PROC_RENAME] = { | |
a6beb732 | 833 | .pc_func = nfsd3_proc_rename, |
026fec7e | 834 | .pc_decode = nfs3svc_decode_renameargs, |
63f8de37 | 835 | .pc_encode = nfs3svc_encode_renameres, |
8537488b | 836 | .pc_release = nfs3svc_release_fhandle2, |
b9081d90 YZ |
837 | .pc_argsize = sizeof(struct nfsd3_renameargs), |
838 | .pc_ressize = sizeof(struct nfsd3_renameres), | |
839 | .pc_cachetype = RC_REPLBUFF, | |
840 | .pc_xdrressize = ST+WC+WC, | |
841 | }, | |
842 | [NFS3PROC_LINK] = { | |
a6beb732 | 843 | .pc_func = nfsd3_proc_link, |
026fec7e | 844 | .pc_decode = nfs3svc_decode_linkargs, |
63f8de37 | 845 | .pc_encode = nfs3svc_encode_linkres, |
8537488b | 846 | .pc_release = nfs3svc_release_fhandle2, |
b9081d90 YZ |
847 | .pc_argsize = sizeof(struct nfsd3_linkargs), |
848 | .pc_ressize = sizeof(struct nfsd3_linkres), | |
849 | .pc_cachetype = RC_REPLBUFF, | |
850 | .pc_xdrressize = ST+pAT+WC, | |
851 | }, | |
852 | [NFS3PROC_READDIR] = { | |
a6beb732 | 853 | .pc_func = nfsd3_proc_readdir, |
026fec7e | 854 | .pc_decode = nfs3svc_decode_readdirargs, |
63f8de37 | 855 | .pc_encode = nfs3svc_encode_readdirres, |
8537488b | 856 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
857 | .pc_argsize = sizeof(struct nfsd3_readdirargs), |
858 | .pc_ressize = sizeof(struct nfsd3_readdirres), | |
859 | .pc_cachetype = RC_NOCACHE, | |
860 | }, | |
861 | [NFS3PROC_READDIRPLUS] = { | |
a6beb732 | 862 | .pc_func = nfsd3_proc_readdirplus, |
026fec7e | 863 | .pc_decode = nfs3svc_decode_readdirplusargs, |
63f8de37 | 864 | .pc_encode = nfs3svc_encode_readdirres, |
8537488b | 865 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
866 | .pc_argsize = sizeof(struct nfsd3_readdirplusargs), |
867 | .pc_ressize = sizeof(struct nfsd3_readdirres), | |
868 | .pc_cachetype = RC_NOCACHE, | |
869 | }, | |
870 | [NFS3PROC_FSSTAT] = { | |
a6beb732 | 871 | .pc_func = nfsd3_proc_fsstat, |
026fec7e | 872 | .pc_decode = nfs3svc_decode_fhandleargs, |
63f8de37 | 873 | .pc_encode = nfs3svc_encode_fsstatres, |
b9081d90 YZ |
874 | .pc_argsize = sizeof(struct nfsd3_fhandleargs), |
875 | .pc_ressize = sizeof(struct nfsd3_fsstatres), | |
876 | .pc_cachetype = RC_NOCACHE, | |
877 | .pc_xdrressize = ST+pAT+2*6+1, | |
878 | }, | |
879 | [NFS3PROC_FSINFO] = { | |
a6beb732 | 880 | .pc_func = nfsd3_proc_fsinfo, |
026fec7e | 881 | .pc_decode = nfs3svc_decode_fhandleargs, |
63f8de37 | 882 | .pc_encode = nfs3svc_encode_fsinfores, |
b9081d90 YZ |
883 | .pc_argsize = sizeof(struct nfsd3_fhandleargs), |
884 | .pc_ressize = sizeof(struct nfsd3_fsinfores), | |
885 | .pc_cachetype = RC_NOCACHE, | |
886 | .pc_xdrressize = ST+pAT+12, | |
887 | }, | |
888 | [NFS3PROC_PATHCONF] = { | |
a6beb732 | 889 | .pc_func = nfsd3_proc_pathconf, |
026fec7e | 890 | .pc_decode = nfs3svc_decode_fhandleargs, |
63f8de37 | 891 | .pc_encode = nfs3svc_encode_pathconfres, |
b9081d90 YZ |
892 | .pc_argsize = sizeof(struct nfsd3_fhandleargs), |
893 | .pc_ressize = sizeof(struct nfsd3_pathconfres), | |
894 | .pc_cachetype = RC_NOCACHE, | |
895 | .pc_xdrressize = ST+pAT+6, | |
896 | }, | |
897 | [NFS3PROC_COMMIT] = { | |
a6beb732 | 898 | .pc_func = nfsd3_proc_commit, |
026fec7e | 899 | .pc_decode = nfs3svc_decode_commitargs, |
63f8de37 | 900 | .pc_encode = nfs3svc_encode_commitres, |
8537488b | 901 | .pc_release = nfs3svc_release_fhandle, |
b9081d90 YZ |
902 | .pc_argsize = sizeof(struct nfsd3_commitargs), |
903 | .pc_ressize = sizeof(struct nfsd3_commitres), | |
904 | .pc_cachetype = RC_NOCACHE, | |
905 | .pc_xdrressize = ST+WC+2, | |
906 | }, | |
1da177e4 LT |
907 | }; |
908 | ||
7fd38af9 | 909 | static unsigned int nfsd_count3[ARRAY_SIZE(nfsd_procedures3)]; |
e9679189 CH |
910 | const struct svc_version nfsd_version3 = { |
911 | .vs_vers = 3, | |
912 | .vs_nproc = 22, | |
913 | .vs_proc = nfsd_procedures3, | |
914 | .vs_dispatch = nfsd_dispatch, | |
915 | .vs_count = nfsd_count3, | |
916 | .vs_xdrsize = NFS3_SVC_XDRSIZE, | |
1da177e4 | 917 | }; |