Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef _LINUX_NFS_XDR_H |
2 | #define _LINUX_NFS_XDR_H | |
3 | ||
b7fa0554 | 4 | #include <linux/nfsacl.h> |
1da177e4 | 5 | |
40859d7e CL |
6 | /* |
7 | * To change the maximum rsize and wsize supported by the NFS client, adjust | |
8 | * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can | |
9 | * support a megabyte or more. The default is left at 4096 bytes, which is | |
10 | * reasonable for NFS over UDP. | |
11 | */ | |
12 | #define NFS_MAX_FILE_IO_SIZE (1048576U) | |
13 | #define NFS_DEF_FILE_IO_SIZE (4096U) | |
14 | #define NFS_MIN_FILE_IO_SIZE (1024U) | |
15 | ||
8b4bdcf8 TM |
16 | struct nfs_fsid { |
17 | uint64_t major; | |
18 | uint64_t minor; | |
1da177e4 LT |
19 | }; |
20 | ||
8b4bdcf8 TM |
21 | /* |
22 | * Helper for checking equality between 2 fsids. | |
23 | */ | |
24 | static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b) | |
25 | { | |
26 | return a->major == b->major && a->minor == b->minor; | |
27 | } | |
28 | ||
1da177e4 LT |
29 | struct nfs_fattr { |
30 | unsigned short valid; /* which fields are valid */ | |
31 | __u64 pre_size; /* pre_op_attr.size */ | |
32 | struct timespec pre_mtime; /* pre_op_attr.mtime */ | |
33 | struct timespec pre_ctime; /* pre_op_attr.ctime */ | |
34 | enum nfs_ftype type; /* always use NFSv2 types */ | |
35 | __u32 mode; | |
36 | __u32 nlink; | |
37 | __u32 uid; | |
38 | __u32 gid; | |
39 | __u64 size; | |
40 | union { | |
41 | struct { | |
42 | __u32 blocksize; | |
43 | __u32 blocks; | |
44 | } nfs2; | |
45 | struct { | |
46 | __u64 used; | |
47 | } nfs3; | |
48 | } du; | |
49 | dev_t rdev; | |
8b4bdcf8 | 50 | struct nfs_fsid fsid; |
1da177e4 LT |
51 | __u64 fileid; |
52 | struct timespec atime; | |
53 | struct timespec mtime; | |
54 | struct timespec ctime; | |
55 | __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */ | |
56 | __u64 change_attr; /* NFSv4 change attribute */ | |
57 | __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ | |
33801147 | 58 | unsigned long time_start; |
1da177e4 LT |
59 | }; |
60 | ||
61 | #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ | |
62 | #define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ | |
63 | #define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ | |
73a3d07c | 64 | #define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */ |
6b97fd3d | 65 | #define NFS_ATTR_FATTR_V4_REFERRAL 0x0010 /* NFSv4 referral */ |
1da177e4 LT |
66 | |
67 | /* | |
68 | * Info on the file system | |
69 | */ | |
70 | struct nfs_fsinfo { | |
71 | struct nfs_fattr *fattr; /* Post-op attributes */ | |
72 | __u32 rtmax; /* max. read transfer size */ | |
73 | __u32 rtpref; /* pref. read transfer size */ | |
74 | __u32 rtmult; /* reads should be multiple of this */ | |
75 | __u32 wtmax; /* max. write transfer size */ | |
76 | __u32 wtpref; /* pref. write transfer size */ | |
77 | __u32 wtmult; /* writes should be multiple of this */ | |
78 | __u32 dtpref; /* pref. readdir transfer size */ | |
79 | __u64 maxfilesize; | |
80 | __u32 lease_time; /* in seconds */ | |
81 | }; | |
82 | ||
83 | struct nfs_fsstat { | |
84 | struct nfs_fattr *fattr; /* Post-op attributes */ | |
85 | __u64 tbytes; /* total size in bytes */ | |
86 | __u64 fbytes; /* # of free bytes */ | |
87 | __u64 abytes; /* # of bytes available to user */ | |
88 | __u64 tfiles; /* # of files */ | |
89 | __u64 ffiles; /* # of free files */ | |
90 | __u64 afiles; /* # of files available to user */ | |
91 | }; | |
92 | ||
93 | struct nfs2_fsstat { | |
94 | __u32 tsize; /* Server transfer size */ | |
95 | __u32 bsize; /* Filesystem block size */ | |
96 | __u32 blocks; /* No. of "bsize" blocks on filesystem */ | |
97 | __u32 bfree; /* No. of free "bsize" blocks */ | |
98 | __u32 bavail; /* No. of available "bsize" blocks */ | |
99 | }; | |
100 | ||
101 | struct nfs_pathconf { | |
102 | struct nfs_fattr *fattr; /* Post-op attributes */ | |
103 | __u32 max_link; /* max # of hard links */ | |
104 | __u32 max_namelen; /* max name length */ | |
105 | }; | |
106 | ||
107 | struct nfs4_change_info { | |
108 | u32 atomic; | |
109 | u64 before; | |
110 | u64 after; | |
111 | }; | |
112 | ||
cee54fc9 | 113 | struct nfs_seqid; |
1da177e4 LT |
114 | /* |
115 | * Arguments to the open call. | |
116 | */ | |
117 | struct nfs_openargs { | |
118 | const struct nfs_fh * fh; | |
cee54fc9 | 119 | struct nfs_seqid * seqid; |
1da177e4 LT |
120 | int open_flags; |
121 | __u64 clientid; | |
122 | __u32 id; | |
123 | union { | |
124 | struct iattr * attrs; /* UNCHECKED, GUARDED */ | |
125 | nfs4_verifier verifier; /* EXCLUSIVE */ | |
126 | nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */ | |
127 | int delegation_type; /* CLAIM_PREVIOUS */ | |
128 | } u; | |
129 | const struct qstr * name; | |
130 | const struct nfs_server *server; /* Needed for ID mapping */ | |
131 | const u32 * bitmask; | |
132 | __u32 claim; | |
133 | }; | |
134 | ||
135 | struct nfs_openres { | |
136 | nfs4_stateid stateid; | |
137 | struct nfs_fh fh; | |
138 | struct nfs4_change_info cinfo; | |
139 | __u32 rflags; | |
140 | struct nfs_fattr * f_attr; | |
56ae19f3 | 141 | struct nfs_fattr * dir_attr; |
1da177e4 LT |
142 | const struct nfs_server *server; |
143 | int delegation_type; | |
144 | nfs4_stateid delegation; | |
145 | __u32 do_recall; | |
146 | __u64 maxsize; | |
aa53ed54 | 147 | __u32 attrset[NFS4_BITMAP_SIZE]; |
1da177e4 LT |
148 | }; |
149 | ||
150 | /* | |
151 | * Arguments to the open_confirm call. | |
152 | */ | |
153 | struct nfs_open_confirmargs { | |
154 | const struct nfs_fh * fh; | |
cdd4e68b | 155 | nfs4_stateid * stateid; |
cee54fc9 | 156 | struct nfs_seqid * seqid; |
1da177e4 LT |
157 | }; |
158 | ||
159 | struct nfs_open_confirmres { | |
160 | nfs4_stateid stateid; | |
161 | }; | |
162 | ||
163 | /* | |
164 | * Arguments to the close call. | |
165 | */ | |
166 | struct nfs_closeargs { | |
167 | struct nfs_fh * fh; | |
9512135d | 168 | nfs4_stateid * stateid; |
cee54fc9 | 169 | struct nfs_seqid * seqid; |
1da177e4 | 170 | int open_flags; |
516a6af6 | 171 | const u32 * bitmask; |
1da177e4 LT |
172 | }; |
173 | ||
174 | struct nfs_closeres { | |
175 | nfs4_stateid stateid; | |
516a6af6 TM |
176 | struct nfs_fattr * fattr; |
177 | const struct nfs_server *server; | |
1da177e4 LT |
178 | }; |
179 | /* | |
180 | * * Arguments to the lock,lockt, and locku call. | |
181 | * */ | |
182 | struct nfs_lowner { | |
911d1aaf TM |
183 | __u64 clientid; |
184 | u32 id; | |
1da177e4 LT |
185 | }; |
186 | ||
911d1aaf TM |
187 | struct nfs_lock_args { |
188 | struct nfs_fh * fh; | |
189 | struct file_lock * fl; | |
cee54fc9 | 190 | struct nfs_seqid * lock_seqid; |
06735b34 TM |
191 | nfs4_stateid * lock_stateid; |
192 | struct nfs_seqid * open_seqid; | |
193 | nfs4_stateid * open_stateid; | |
911d1aaf TM |
194 | struct nfs_lowner lock_owner; |
195 | unsigned char block : 1; | |
196 | unsigned char reclaim : 1; | |
197 | unsigned char new_lock_owner : 1; | |
198 | }; | |
199 | ||
200 | struct nfs_lock_res { | |
201 | nfs4_stateid stateid; | |
1da177e4 LT |
202 | }; |
203 | ||
911d1aaf TM |
204 | struct nfs_locku_args { |
205 | struct nfs_fh * fh; | |
206 | struct file_lock * fl; | |
cee54fc9 | 207 | struct nfs_seqid * seqid; |
faf5f49c | 208 | nfs4_stateid * stateid; |
1da177e4 LT |
209 | }; |
210 | ||
911d1aaf TM |
211 | struct nfs_locku_res { |
212 | nfs4_stateid stateid; | |
1da177e4 LT |
213 | }; |
214 | ||
911d1aaf TM |
215 | struct nfs_lockt_args { |
216 | struct nfs_fh * fh; | |
217 | struct file_lock * fl; | |
218 | struct nfs_lowner lock_owner; | |
1da177e4 LT |
219 | }; |
220 | ||
911d1aaf TM |
221 | struct nfs_lockt_res { |
222 | struct file_lock * denied; /* LOCK, LOCKT failed */ | |
1da177e4 LT |
223 | }; |
224 | ||
225 | struct nfs4_delegreturnargs { | |
226 | const struct nfs_fh *fhandle; | |
227 | const nfs4_stateid *stateid; | |
fa178f29 TM |
228 | const u32 * bitmask; |
229 | }; | |
230 | ||
231 | struct nfs4_delegreturnres { | |
232 | struct nfs_fattr * fattr; | |
233 | const struct nfs_server *server; | |
1da177e4 LT |
234 | }; |
235 | ||
236 | /* | |
237 | * Arguments to the read call. | |
238 | */ | |
1da177e4 LT |
239 | struct nfs_readargs { |
240 | struct nfs_fh * fh; | |
241 | struct nfs_open_context *context; | |
242 | __u64 offset; | |
243 | __u32 count; | |
244 | unsigned int pgbase; | |
245 | struct page ** pages; | |
246 | }; | |
247 | ||
248 | struct nfs_readres { | |
249 | struct nfs_fattr * fattr; | |
250 | __u32 count; | |
251 | int eof; | |
252 | }; | |
253 | ||
254 | /* | |
255 | * Arguments to the write call. | |
256 | */ | |
1da177e4 LT |
257 | struct nfs_writeargs { |
258 | struct nfs_fh * fh; | |
259 | struct nfs_open_context *context; | |
260 | __u64 offset; | |
261 | __u32 count; | |
262 | enum nfs3_stable_how stable; | |
263 | unsigned int pgbase; | |
264 | struct page ** pages; | |
4f9838c7 | 265 | const u32 * bitmask; |
1da177e4 LT |
266 | }; |
267 | ||
268 | struct nfs_writeverf { | |
269 | enum nfs3_stable_how committed; | |
bc4785cd | 270 | __be32 verifier[2]; |
1da177e4 LT |
271 | }; |
272 | ||
273 | struct nfs_writeres { | |
274 | struct nfs_fattr * fattr; | |
275 | struct nfs_writeverf * verf; | |
276 | __u32 count; | |
4f9838c7 | 277 | const struct nfs_server *server; |
1da177e4 LT |
278 | }; |
279 | ||
280 | /* | |
281 | * Argument struct for decode_entry function | |
282 | */ | |
283 | struct nfs_entry { | |
284 | __u64 ino; | |
285 | __u64 cookie, | |
286 | prev_cookie; | |
287 | const char * name; | |
288 | unsigned int len; | |
289 | int eof; | |
290 | struct nfs_fh * fh; | |
291 | struct nfs_fattr * fattr; | |
292 | }; | |
293 | ||
294 | /* | |
295 | * The following types are for NFSv2 only. | |
296 | */ | |
297 | struct nfs_sattrargs { | |
298 | struct nfs_fh * fh; | |
299 | struct iattr * sattr; | |
300 | }; | |
301 | ||
302 | struct nfs_diropargs { | |
303 | struct nfs_fh * fh; | |
304 | const char * name; | |
305 | unsigned int len; | |
306 | }; | |
307 | ||
308 | struct nfs_createargs { | |
309 | struct nfs_fh * fh; | |
310 | const char * name; | |
311 | unsigned int len; | |
312 | struct iattr * sattr; | |
313 | }; | |
314 | ||
315 | struct nfs_renameargs { | |
316 | struct nfs_fh * fromfh; | |
317 | const char * fromname; | |
318 | unsigned int fromlen; | |
319 | struct nfs_fh * tofh; | |
320 | const char * toname; | |
321 | unsigned int tolen; | |
322 | }; | |
323 | ||
324 | struct nfs_setattrargs { | |
325 | struct nfs_fh * fh; | |
326 | nfs4_stateid stateid; | |
327 | struct iattr * iap; | |
328 | const struct nfs_server * server; /* Needed for name mapping */ | |
329 | const u32 * bitmask; | |
330 | }; | |
331 | ||
23ec6965 BF |
332 | struct nfs_setaclargs { |
333 | struct nfs_fh * fh; | |
334 | size_t acl_len; | |
335 | unsigned int acl_pgbase; | |
336 | struct page ** acl_pages; | |
337 | }; | |
338 | ||
029d105e BF |
339 | struct nfs_getaclargs { |
340 | struct nfs_fh * fh; | |
341 | size_t acl_len; | |
342 | unsigned int acl_pgbase; | |
343 | struct page ** acl_pages; | |
344 | }; | |
345 | ||
1da177e4 LT |
346 | struct nfs_setattrres { |
347 | struct nfs_fattr * fattr; | |
348 | const struct nfs_server * server; | |
349 | }; | |
350 | ||
351 | struct nfs_linkargs { | |
352 | struct nfs_fh * fromfh; | |
353 | struct nfs_fh * tofh; | |
354 | const char * toname; | |
355 | unsigned int tolen; | |
356 | }; | |
357 | ||
358 | struct nfs_symlinkargs { | |
359 | struct nfs_fh * fromfh; | |
360 | const char * fromname; | |
361 | unsigned int fromlen; | |
94a6d753 CL |
362 | struct page ** pages; |
363 | unsigned int pathlen; | |
1da177e4 LT |
364 | struct iattr * sattr; |
365 | }; | |
366 | ||
367 | struct nfs_readdirargs { | |
368 | struct nfs_fh * fh; | |
369 | __u32 cookie; | |
370 | unsigned int count; | |
371 | struct page ** pages; | |
372 | }; | |
373 | ||
b7fa0554 AG |
374 | struct nfs3_getaclargs { |
375 | struct nfs_fh * fh; | |
376 | int mask; | |
377 | struct page ** pages; | |
378 | }; | |
379 | ||
380 | struct nfs3_setaclargs { | |
381 | struct inode * inode; | |
382 | int mask; | |
383 | struct posix_acl * acl_access; | |
384 | struct posix_acl * acl_default; | |
385 | struct page ** pages; | |
386 | }; | |
387 | ||
1da177e4 LT |
388 | struct nfs_diropok { |
389 | struct nfs_fh * fh; | |
390 | struct nfs_fattr * fattr; | |
391 | }; | |
392 | ||
393 | struct nfs_readlinkargs { | |
394 | struct nfs_fh * fh; | |
395 | unsigned int pgbase; | |
396 | unsigned int pglen; | |
397 | struct page ** pages; | |
398 | }; | |
399 | ||
400 | struct nfs3_sattrargs { | |
401 | struct nfs_fh * fh; | |
402 | struct iattr * sattr; | |
403 | unsigned int guard; | |
404 | struct timespec guardtime; | |
405 | }; | |
406 | ||
407 | struct nfs3_diropargs { | |
408 | struct nfs_fh * fh; | |
409 | const char * name; | |
410 | unsigned int len; | |
411 | }; | |
412 | ||
413 | struct nfs3_accessargs { | |
414 | struct nfs_fh * fh; | |
415 | __u32 access; | |
416 | }; | |
417 | ||
418 | struct nfs3_createargs { | |
419 | struct nfs_fh * fh; | |
420 | const char * name; | |
421 | unsigned int len; | |
422 | struct iattr * sattr; | |
423 | enum nfs3_createmode createmode; | |
bc4785cd | 424 | __be32 verifier[2]; |
1da177e4 LT |
425 | }; |
426 | ||
427 | struct nfs3_mkdirargs { | |
428 | struct nfs_fh * fh; | |
429 | const char * name; | |
430 | unsigned int len; | |
431 | struct iattr * sattr; | |
432 | }; | |
433 | ||
434 | struct nfs3_symlinkargs { | |
435 | struct nfs_fh * fromfh; | |
436 | const char * fromname; | |
437 | unsigned int fromlen; | |
94a6d753 CL |
438 | struct page ** pages; |
439 | unsigned int pathlen; | |
1da177e4 LT |
440 | struct iattr * sattr; |
441 | }; | |
442 | ||
443 | struct nfs3_mknodargs { | |
444 | struct nfs_fh * fh; | |
445 | const char * name; | |
446 | unsigned int len; | |
447 | enum nfs3_ftype type; | |
448 | struct iattr * sattr; | |
449 | dev_t rdev; | |
450 | }; | |
451 | ||
452 | struct nfs3_renameargs { | |
453 | struct nfs_fh * fromfh; | |
454 | const char * fromname; | |
455 | unsigned int fromlen; | |
456 | struct nfs_fh * tofh; | |
457 | const char * toname; | |
458 | unsigned int tolen; | |
459 | }; | |
460 | ||
461 | struct nfs3_linkargs { | |
462 | struct nfs_fh * fromfh; | |
463 | struct nfs_fh * tofh; | |
464 | const char * toname; | |
465 | unsigned int tolen; | |
466 | }; | |
467 | ||
468 | struct nfs3_readdirargs { | |
469 | struct nfs_fh * fh; | |
470 | __u64 cookie; | |
bc4785cd | 471 | __be32 verf[2]; |
1da177e4 LT |
472 | int plus; |
473 | unsigned int count; | |
474 | struct page ** pages; | |
475 | }; | |
476 | ||
477 | struct nfs3_diropres { | |
478 | struct nfs_fattr * dir_attr; | |
479 | struct nfs_fh * fh; | |
480 | struct nfs_fattr * fattr; | |
481 | }; | |
482 | ||
483 | struct nfs3_accessres { | |
484 | struct nfs_fattr * fattr; | |
485 | __u32 access; | |
486 | }; | |
487 | ||
488 | struct nfs3_readlinkargs { | |
489 | struct nfs_fh * fh; | |
490 | unsigned int pgbase; | |
491 | unsigned int pglen; | |
492 | struct page ** pages; | |
493 | }; | |
494 | ||
495 | struct nfs3_renameres { | |
496 | struct nfs_fattr * fromattr; | |
497 | struct nfs_fattr * toattr; | |
498 | }; | |
499 | ||
500 | struct nfs3_linkres { | |
501 | struct nfs_fattr * dir_attr; | |
502 | struct nfs_fattr * fattr; | |
503 | }; | |
504 | ||
505 | struct nfs3_readdirres { | |
506 | struct nfs_fattr * dir_attr; | |
bc4785cd | 507 | __be32 * verf; |
1da177e4 LT |
508 | int plus; |
509 | }; | |
510 | ||
b7fa0554 AG |
511 | struct nfs3_getaclres { |
512 | struct nfs_fattr * fattr; | |
513 | int mask; | |
514 | unsigned int acl_access_count; | |
515 | unsigned int acl_default_count; | |
516 | struct posix_acl * acl_access; | |
517 | struct posix_acl * acl_default; | |
518 | }; | |
519 | ||
1da177e4 LT |
520 | #ifdef CONFIG_NFS_V4 |
521 | ||
522 | typedef u64 clientid4; | |
523 | ||
524 | struct nfs4_accessargs { | |
525 | const struct nfs_fh * fh; | |
526 | u32 access; | |
527 | }; | |
528 | ||
529 | struct nfs4_accessres { | |
530 | u32 supported; | |
531 | u32 access; | |
532 | }; | |
533 | ||
534 | struct nfs4_create_arg { | |
535 | u32 ftype; | |
536 | union { | |
94a6d753 CL |
537 | struct { |
538 | struct page ** pages; | |
539 | unsigned int len; | |
540 | } symlink; /* NF4LNK */ | |
1da177e4 LT |
541 | struct { |
542 | u32 specdata1; | |
543 | u32 specdata2; | |
544 | } device; /* NF4BLK, NF4CHR */ | |
545 | } u; | |
546 | const struct qstr * name; | |
547 | const struct nfs_server * server; | |
548 | const struct iattr * attrs; | |
549 | const struct nfs_fh * dir_fh; | |
550 | const u32 * bitmask; | |
551 | }; | |
552 | ||
553 | struct nfs4_create_res { | |
554 | const struct nfs_server * server; | |
555 | struct nfs_fh * fh; | |
556 | struct nfs_fattr * fattr; | |
557 | struct nfs4_change_info dir_cinfo; | |
56ae19f3 | 558 | struct nfs_fattr * dir_fattr; |
1da177e4 LT |
559 | }; |
560 | ||
561 | struct nfs4_fsinfo_arg { | |
562 | const struct nfs_fh * fh; | |
563 | const u32 * bitmask; | |
564 | }; | |
565 | ||
566 | struct nfs4_getattr_arg { | |
567 | const struct nfs_fh * fh; | |
568 | const u32 * bitmask; | |
569 | }; | |
570 | ||
571 | struct nfs4_getattr_res { | |
572 | const struct nfs_server * server; | |
573 | struct nfs_fattr * fattr; | |
574 | }; | |
575 | ||
576 | struct nfs4_link_arg { | |
577 | const struct nfs_fh * fh; | |
578 | const struct nfs_fh * dir_fh; | |
579 | const struct qstr * name; | |
91ba2eee TM |
580 | const u32 * bitmask; |
581 | }; | |
582 | ||
583 | struct nfs4_link_res { | |
584 | const struct nfs_server * server; | |
585 | struct nfs_fattr * fattr; | |
586 | struct nfs4_change_info cinfo; | |
587 | struct nfs_fattr * dir_attr; | |
1da177e4 LT |
588 | }; |
589 | ||
91ba2eee | 590 | |
1da177e4 LT |
591 | struct nfs4_lookup_arg { |
592 | const struct nfs_fh * dir_fh; | |
593 | const struct qstr * name; | |
594 | const u32 * bitmask; | |
595 | }; | |
596 | ||
597 | struct nfs4_lookup_res { | |
598 | const struct nfs_server * server; | |
599 | struct nfs_fattr * fattr; | |
600 | struct nfs_fh * fh; | |
601 | }; | |
602 | ||
603 | struct nfs4_lookup_root_arg { | |
604 | const u32 * bitmask; | |
605 | }; | |
606 | ||
607 | struct nfs4_pathconf_arg { | |
608 | const struct nfs_fh * fh; | |
609 | const u32 * bitmask; | |
610 | }; | |
611 | ||
612 | struct nfs4_readdir_arg { | |
613 | const struct nfs_fh * fh; | |
614 | u64 cookie; | |
615 | nfs4_verifier verifier; | |
616 | u32 count; | |
617 | struct page ** pages; /* zero-copy data */ | |
618 | unsigned int pgbase; /* zero-copy data */ | |
619 | const u32 * bitmask; | |
620 | }; | |
621 | ||
622 | struct nfs4_readdir_res { | |
623 | nfs4_verifier verifier; | |
624 | unsigned int pgbase; | |
625 | }; | |
626 | ||
627 | struct nfs4_readlink { | |
628 | const struct nfs_fh * fh; | |
629 | unsigned int pgbase; | |
630 | unsigned int pglen; /* zero-copy data */ | |
631 | struct page ** pages; /* zero-copy data */ | |
632 | }; | |
633 | ||
634 | struct nfs4_remove_arg { | |
635 | const struct nfs_fh * fh; | |
636 | const struct qstr * name; | |
16e42959 TM |
637 | const u32 * bitmask; |
638 | }; | |
639 | ||
640 | struct nfs4_remove_res { | |
641 | const struct nfs_server * server; | |
642 | struct nfs4_change_info cinfo; | |
643 | struct nfs_fattr * dir_attr; | |
1da177e4 LT |
644 | }; |
645 | ||
646 | struct nfs4_rename_arg { | |
647 | const struct nfs_fh * old_dir; | |
648 | const struct nfs_fh * new_dir; | |
649 | const struct qstr * old_name; | |
650 | const struct qstr * new_name; | |
6caf2c82 | 651 | const u32 * bitmask; |
1da177e4 LT |
652 | }; |
653 | ||
654 | struct nfs4_rename_res { | |
6caf2c82 | 655 | const struct nfs_server * server; |
1da177e4 | 656 | struct nfs4_change_info old_cinfo; |
6caf2c82 | 657 | struct nfs_fattr * old_fattr; |
1da177e4 | 658 | struct nfs4_change_info new_cinfo; |
6caf2c82 | 659 | struct nfs_fattr * new_fattr; |
1da177e4 LT |
660 | }; |
661 | ||
662 | struct nfs4_setclientid { | |
663 | const nfs4_verifier * sc_verifier; /* request */ | |
664 | unsigned int sc_name_len; | |
3cedf13a | 665 | char sc_name[48]; /* request */ |
1da177e4 LT |
666 | u32 sc_prog; /* request */ |
667 | unsigned int sc_netid_len; | |
668 | char sc_netid[4]; /* request */ | |
669 | unsigned int sc_uaddr_len; | |
670 | char sc_uaddr[24]; /* request */ | |
671 | u32 sc_cb_ident; /* request */ | |
672 | }; | |
673 | ||
674 | struct nfs4_statfs_arg { | |
675 | const struct nfs_fh * fh; | |
676 | const u32 * bitmask; | |
677 | }; | |
678 | ||
679 | struct nfs4_server_caps_res { | |
680 | u32 attr_bitmask[2]; | |
681 | u32 acl_bitmask; | |
682 | u32 has_links; | |
683 | u32 has_symlinks; | |
684 | }; | |
685 | ||
7aaa0b3b MN |
686 | struct nfs4_string { |
687 | unsigned int len; | |
688 | char *data; | |
683b57b4 TM |
689 | }; |
690 | ||
7aaa0b3b MN |
691 | #define NFS4_PATHNAME_MAXCOMPONENTS 512 |
692 | struct nfs4_pathname { | |
693 | unsigned int ncomponents; | |
694 | struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS]; | |
695 | }; | |
696 | ||
697 | #define NFS4_FS_LOCATION_MAXSERVERS 10 | |
698 | struct nfs4_fs_location { | |
699 | unsigned int nservers; | |
700 | struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS]; | |
701 | struct nfs4_pathname rootpath; | |
702 | }; | |
703 | ||
704 | #define NFS4_FS_LOCATIONS_MAXENTRIES 10 | |
705 | struct nfs4_fs_locations { | |
683b57b4 TM |
706 | struct nfs_fattr fattr; |
707 | const struct nfs_server *server; | |
7aaa0b3b | 708 | struct nfs4_pathname fs_path; |
683b57b4 | 709 | int nlocations; |
7aaa0b3b | 710 | struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES]; |
683b57b4 TM |
711 | }; |
712 | ||
713 | struct nfs4_fs_locations_arg { | |
714 | const struct nfs_fh *dir_fh; | |
715 | const struct qstr *name; | |
716 | struct page *page; | |
717 | const u32 *bitmask; | |
718 | }; | |
719 | ||
1da177e4 LT |
720 | #endif /* CONFIG_NFS_V4 */ |
721 | ||
722 | struct nfs_page; | |
723 | ||
40859d7e CL |
724 | #define NFS_PAGEVEC_SIZE (8U) |
725 | ||
1da177e4 LT |
726 | struct nfs_read_data { |
727 | int flags; | |
728 | struct rpc_task task; | |
729 | struct inode *inode; | |
730 | struct rpc_cred *cred; | |
731 | struct nfs_fattr fattr; /* fattr storage */ | |
732 | struct list_head pages; /* Coalesced read requests */ | |
733 | struct nfs_page *req; /* multi ops per nfs_page */ | |
40859d7e | 734 | struct page **pagevec; |
e9f7bee1 | 735 | unsigned int npages; /* Max length of pagevec */ |
1da177e4 LT |
736 | struct nfs_readargs args; |
737 | struct nfs_readres res; | |
738 | #ifdef CONFIG_NFS_V4 | |
739 | unsigned long timestamp; /* For lease renewal */ | |
740 | #endif | |
0d0b5cb3 | 741 | struct page *page_array[NFS_PAGEVEC_SIZE]; |
1da177e4 LT |
742 | }; |
743 | ||
744 | struct nfs_write_data { | |
745 | int flags; | |
746 | struct rpc_task task; | |
747 | struct inode *inode; | |
748 | struct rpc_cred *cred; | |
749 | struct nfs_fattr fattr; | |
750 | struct nfs_writeverf verf; | |
751 | struct list_head pages; /* Coalesced requests we wish to flush */ | |
752 | struct nfs_page *req; /* multi ops per nfs_page */ | |
40859d7e | 753 | struct page **pagevec; |
e9f7bee1 | 754 | unsigned int npages; /* Max length of pagevec */ |
1da177e4 LT |
755 | struct nfs_writeargs args; /* argument struct */ |
756 | struct nfs_writeres res; /* result struct */ | |
757 | #ifdef CONFIG_NFS_V4 | |
758 | unsigned long timestamp; /* For lease renewal */ | |
759 | #endif | |
0d0b5cb3 | 760 | struct page *page_array[NFS_PAGEVEC_SIZE]; |
1da177e4 LT |
761 | }; |
762 | ||
763 | struct nfs_access_entry; | |
764 | ||
765 | /* | |
766 | * RPC procedure vector for NFSv2/NFSv3 demuxing | |
767 | */ | |
768 | struct nfs_rpc_ops { | |
769 | int version; /* Protocol version */ | |
770 | struct dentry_operations *dentry_ops; | |
c5ef1c42 AV |
771 | const struct inode_operations *dir_inode_ops; |
772 | const struct inode_operations *file_inode_ops; | |
1da177e4 LT |
773 | |
774 | int (*getroot) (struct nfs_server *, struct nfs_fh *, | |
775 | struct nfs_fsinfo *); | |
2b3de441 DH |
776 | int (*lookupfh)(struct nfs_server *, struct nfs_fh *, |
777 | struct qstr *, struct nfs_fh *, | |
778 | struct nfs_fattr *); | |
1da177e4 LT |
779 | int (*getattr) (struct nfs_server *, struct nfs_fh *, |
780 | struct nfs_fattr *); | |
781 | int (*setattr) (struct dentry *, struct nfs_fattr *, | |
782 | struct iattr *); | |
783 | int (*lookup) (struct inode *, struct qstr *, | |
784 | struct nfs_fh *, struct nfs_fattr *); | |
785 | int (*access) (struct inode *, struct nfs_access_entry *); | |
786 | int (*readlink)(struct inode *, struct page *, unsigned int, | |
787 | unsigned int); | |
1da177e4 | 788 | int (*create) (struct inode *, struct dentry *, |
02a913a7 | 789 | struct iattr *, int, struct nameidata *); |
1da177e4 LT |
790 | int (*remove) (struct inode *, struct qstr *); |
791 | int (*unlink_setup) (struct rpc_message *, | |
792 | struct dentry *, struct qstr *); | |
793 | int (*unlink_done) (struct dentry *, struct rpc_task *); | |
794 | int (*rename) (struct inode *, struct qstr *, | |
795 | struct inode *, struct qstr *); | |
796 | int (*link) (struct inode *, struct inode *, struct qstr *); | |
94a6d753 CL |
797 | int (*symlink) (struct inode *, struct dentry *, struct page *, |
798 | unsigned int, struct iattr *); | |
1da177e4 LT |
799 | int (*mkdir) (struct inode *, struct dentry *, struct iattr *); |
800 | int (*rmdir) (struct inode *, struct qstr *); | |
801 | int (*readdir) (struct dentry *, struct rpc_cred *, | |
802 | u64, struct page *, unsigned int, int); | |
803 | int (*mknod) (struct inode *, struct dentry *, struct iattr *, | |
804 | dev_t); | |
805 | int (*statfs) (struct nfs_server *, struct nfs_fh *, | |
806 | struct nfs_fsstat *); | |
807 | int (*fsinfo) (struct nfs_server *, struct nfs_fh *, | |
808 | struct nfs_fsinfo *); | |
809 | int (*pathconf) (struct nfs_server *, struct nfs_fh *, | |
810 | struct nfs_pathconf *); | |
e9326dca | 811 | int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); |
0dbb4c67 | 812 | __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus); |
1da177e4 | 813 | void (*read_setup) (struct nfs_read_data *); |
ec06c096 | 814 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); |
1da177e4 | 815 | void (*write_setup) (struct nfs_write_data *, int how); |
788e7a89 | 816 | int (*write_done) (struct rpc_task *, struct nfs_write_data *); |
1da177e4 | 817 | void (*commit_setup) (struct nfs_write_data *, int how); |
788e7a89 | 818 | int (*commit_done) (struct rpc_task *, struct nfs_write_data *); |
1da177e4 LT |
819 | int (*file_open) (struct inode *, struct file *); |
820 | int (*file_release) (struct inode *, struct file *); | |
821 | int (*lock)(struct file *, int, struct file_lock *); | |
ada70d94 | 822 | void (*clear_acl_cache)(struct inode *); |
1da177e4 LT |
823 | }; |
824 | ||
825 | /* | |
826 | * NFS_CALL(getattr, inode, (fattr)); | |
827 | * into | |
828 | * NFS_PROTO(inode)->getattr(fattr); | |
829 | */ | |
830 | #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args | |
831 | ||
832 | /* | |
833 | * Function vectors etc. for the NFS client | |
834 | */ | |
509de811 DH |
835 | extern const struct nfs_rpc_ops nfs_v2_clientops; |
836 | extern const struct nfs_rpc_ops nfs_v3_clientops; | |
837 | extern const struct nfs_rpc_ops nfs_v4_clientops; | |
1da177e4 LT |
838 | extern struct rpc_version nfs_version2; |
839 | extern struct rpc_version nfs_version3; | |
840 | extern struct rpc_version nfs_version4; | |
841 | ||
b7fa0554 AG |
842 | extern struct rpc_version nfsacl_version3; |
843 | extern struct rpc_program nfsacl_program; | |
844 | ||
1da177e4 | 845 | #endif |