blob: 7fafc4c546b7fb735a8d0ce6725fbe07d31df049 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_NFS_XDR_H
2#define _LINUX_NFS_XDR_H
3
4#include <linux/sunrpc/xprt.h>
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +00005#include <linux/nfsacl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
Chuck Lever40859d72005-11-30 18:09:02 -05007/*
8 * To change the maximum rsize and wsize supported by the NFS client, adjust
9 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
10 * support a megabyte or more. The default is left at 4096 bytes, which is
11 * reasonable for NFS over UDP.
12 */
13#define NFS_MAX_FILE_IO_SIZE (1048576U)
14#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U)
16
Linus Torvalds1da177e2005-04-16 15:20:36 -070017struct nfs4_fsid {
18 __u64 major;
19 __u64 minor;
20};
21
22struct nfs_fattr {
23 unsigned short valid; /* which fields are valid */
24 __u64 pre_size; /* pre_op_attr.size */
25 struct timespec pre_mtime; /* pre_op_attr.mtime */
26 struct timespec pre_ctime; /* pre_op_attr.ctime */
27 enum nfs_ftype type; /* always use NFSv2 types */
28 __u32 mode;
29 __u32 nlink;
30 __u32 uid;
31 __u32 gid;
32 __u64 size;
33 union {
34 struct {
35 __u32 blocksize;
36 __u32 blocks;
37 } nfs2;
38 struct {
39 __u64 used;
40 } nfs3;
41 } du;
42 dev_t rdev;
43 union {
44 __u64 nfs3; /* also nfs2 */
45 struct nfs4_fsid nfs4;
46 } fsid_u;
47 __u64 fileid;
48 struct timespec atime;
49 struct timespec mtime;
50 struct timespec ctime;
51 __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */
52 __u64 change_attr; /* NFSv4 change attribute */
53 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
Trond Myklebust33801142005-10-27 22:12:39 -040054 unsigned long time_start;
Linus Torvalds1da177e2005-04-16 15:20:36 -070055};
56
57#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
58#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
59#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
60#define NFS_ATTR_FATTR_V4 0x0008
61#define NFS_ATTR_PRE_CHANGE 0x0010
62
63/*
64 * Info on the file system
65 */
66struct nfs_fsinfo {
67 struct nfs_fattr *fattr; /* Post-op attributes */
68 __u32 rtmax; /* max. read transfer size */
69 __u32 rtpref; /* pref. read transfer size */
70 __u32 rtmult; /* reads should be multiple of this */
71 __u32 wtmax; /* max. write transfer size */
72 __u32 wtpref; /* pref. write transfer size */
73 __u32 wtmult; /* writes should be multiple of this */
74 __u32 dtpref; /* pref. readdir transfer size */
75 __u64 maxfilesize;
76 __u32 lease_time; /* in seconds */
77};
78
79struct nfs_fsstat {
80 struct nfs_fattr *fattr; /* Post-op attributes */
81 __u64 tbytes; /* total size in bytes */
82 __u64 fbytes; /* # of free bytes */
83 __u64 abytes; /* # of bytes available to user */
84 __u64 tfiles; /* # of files */
85 __u64 ffiles; /* # of free files */
86 __u64 afiles; /* # of files available to user */
87};
88
89struct nfs2_fsstat {
90 __u32 tsize; /* Server transfer size */
91 __u32 bsize; /* Filesystem block size */
92 __u32 blocks; /* No. of "bsize" blocks on filesystem */
93 __u32 bfree; /* No. of free "bsize" blocks */
94 __u32 bavail; /* No. of available "bsize" blocks */
95};
96
97struct nfs_pathconf {
98 struct nfs_fattr *fattr; /* Post-op attributes */
99 __u32 max_link; /* max # of hard links */
100 __u32 max_namelen; /* max name length */
101};
102
103struct nfs4_change_info {
104 u32 atomic;
105 u64 before;
106 u64 after;
107};
108
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700109struct nfs_seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110/*
111 * Arguments to the open call.
112 */
113struct nfs_openargs {
114 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700115 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 int open_flags;
117 __u64 clientid;
118 __u32 id;
119 union {
120 struct iattr * attrs; /* UNCHECKED, GUARDED */
121 nfs4_verifier verifier; /* EXCLUSIVE */
122 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
123 int delegation_type; /* CLAIM_PREVIOUS */
124 } u;
125 const struct qstr * name;
126 const struct nfs_server *server; /* Needed for ID mapping */
127 const u32 * bitmask;
128 __u32 claim;
129};
130
131struct nfs_openres {
132 nfs4_stateid stateid;
133 struct nfs_fh fh;
134 struct nfs4_change_info cinfo;
135 __u32 rflags;
136 struct nfs_fattr * f_attr;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400137 struct nfs_fattr * dir_attr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 const struct nfs_server *server;
139 int delegation_type;
140 nfs4_stateid delegation;
141 __u32 do_recall;
142 __u64 maxsize;
143};
144
145/*
146 * Arguments to the open_confirm call.
147 */
148struct nfs_open_confirmargs {
149 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100150 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700151 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152};
153
154struct nfs_open_confirmres {
155 nfs4_stateid stateid;
156};
157
158/*
159 * Arguments to the close call.
160 */
161struct nfs_closeargs {
162 struct nfs_fh * fh;
Trond Myklebust95121352005-10-18 14:20:12 -0700163 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700164 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 int open_flags;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400166 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167};
168
169struct nfs_closeres {
170 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400171 struct nfs_fattr * fattr;
172 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173};
174/*
175 * * Arguments to the lock,lockt, and locku call.
176 * */
177struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100178 __u64 clientid;
179 u32 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180};
181
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100182struct nfs_lock_args {
183 struct nfs_fh * fh;
184 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700185 struct nfs_seqid * lock_seqid;
186 nfs4_stateid * lock_stateid;
187 struct nfs_seqid * open_seqid;
188 nfs4_stateid * open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100189 struct nfs_lowner lock_owner;
190 unsigned char block : 1;
191 unsigned char reclaim : 1;
192 unsigned char new_lock_owner : 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193};
194
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100195struct nfs_lock_res {
196 nfs4_stateid stateid;
197};
198
199struct nfs_locku_args {
200 struct nfs_fh * fh;
201 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700202 struct nfs_seqid * seqid;
Trond Myklebustfaf5f492005-10-18 14:20:15 -0700203 nfs4_stateid * stateid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204};
205
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100206struct nfs_locku_res {
207 nfs4_stateid stateid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208};
209
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100210struct nfs_lockt_args {
211 struct nfs_fh * fh;
212 struct file_lock * fl;
213 struct nfs_lowner lock_owner;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214};
215
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100216struct nfs_lockt_res {
217 struct file_lock * denied; /* LOCK, LOCKT failed */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218};
219
220struct nfs4_delegreturnargs {
221 const struct nfs_fh *fhandle;
222 const nfs4_stateid *stateid;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100223 const u32 * bitmask;
224};
225
226struct nfs4_delegreturnres {
227 struct nfs_fattr * fattr;
228 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229};
230
231/*
232 * Arguments to the read call.
233 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234struct nfs_readargs {
235 struct nfs_fh * fh;
236 struct nfs_open_context *context;
237 __u64 offset;
238 __u32 count;
239 unsigned int pgbase;
240 struct page ** pages;
241};
242
243struct nfs_readres {
244 struct nfs_fattr * fattr;
245 __u32 count;
246 int eof;
247};
248
249/*
250 * Arguments to the write call.
251 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252struct nfs_writeargs {
253 struct nfs_fh * fh;
254 struct nfs_open_context *context;
255 __u64 offset;
256 __u32 count;
257 enum nfs3_stable_how stable;
258 unsigned int pgbase;
259 struct page ** pages;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400260 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261};
262
263struct nfs_writeverf {
264 enum nfs3_stable_how committed;
265 __u32 verifier[2];
266};
267
268struct nfs_writeres {
269 struct nfs_fattr * fattr;
270 struct nfs_writeverf * verf;
271 __u32 count;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400272 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273};
274
275/*
276 * Argument struct for decode_entry function
277 */
278struct nfs_entry {
279 __u64 ino;
280 __u64 cookie,
281 prev_cookie;
282 const char * name;
283 unsigned int len;
284 int eof;
285 struct nfs_fh * fh;
286 struct nfs_fattr * fattr;
287};
288
289/*
290 * The following types are for NFSv2 only.
291 */
292struct nfs_sattrargs {
293 struct nfs_fh * fh;
294 struct iattr * sattr;
295};
296
297struct nfs_diropargs {
298 struct nfs_fh * fh;
299 const char * name;
300 unsigned int len;
301};
302
303struct nfs_createargs {
304 struct nfs_fh * fh;
305 const char * name;
306 unsigned int len;
307 struct iattr * sattr;
308};
309
310struct nfs_renameargs {
311 struct nfs_fh * fromfh;
312 const char * fromname;
313 unsigned int fromlen;
314 struct nfs_fh * tofh;
315 const char * toname;
316 unsigned int tolen;
317};
318
319struct nfs_setattrargs {
320 struct nfs_fh * fh;
321 nfs4_stateid stateid;
322 struct iattr * iap;
323 const struct nfs_server * server; /* Needed for name mapping */
324 const u32 * bitmask;
325};
326
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000327struct nfs_setaclargs {
328 struct nfs_fh * fh;
329 size_t acl_len;
330 unsigned int acl_pgbase;
331 struct page ** acl_pages;
332};
333
J. Bruce Fields029d1052005-06-22 17:16:22 +0000334struct nfs_getaclargs {
335 struct nfs_fh * fh;
336 size_t acl_len;
337 unsigned int acl_pgbase;
338 struct page ** acl_pages;
339};
340
Linus Torvalds1da177e2005-04-16 15:20:36 -0700341struct nfs_setattrres {
342 struct nfs_fattr * fattr;
343 const struct nfs_server * server;
344};
345
346struct nfs_linkargs {
347 struct nfs_fh * fromfh;
348 struct nfs_fh * tofh;
349 const char * toname;
350 unsigned int tolen;
351};
352
353struct nfs_symlinkargs {
354 struct nfs_fh * fromfh;
355 const char * fromname;
356 unsigned int fromlen;
357 const char * topath;
358 unsigned int tolen;
359 struct iattr * sattr;
360};
361
362struct nfs_readdirargs {
363 struct nfs_fh * fh;
364 __u32 cookie;
365 unsigned int count;
366 struct page ** pages;
367};
368
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000369struct nfs3_getaclargs {
370 struct nfs_fh * fh;
371 int mask;
372 struct page ** pages;
373};
374
375struct nfs3_setaclargs {
376 struct inode * inode;
377 int mask;
378 struct posix_acl * acl_access;
379 struct posix_acl * acl_default;
380 struct page ** pages;
381};
382
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383struct nfs_diropok {
384 struct nfs_fh * fh;
385 struct nfs_fattr * fattr;
386};
387
388struct nfs_readlinkargs {
389 struct nfs_fh * fh;
390 unsigned int pgbase;
391 unsigned int pglen;
392 struct page ** pages;
393};
394
395struct nfs3_sattrargs {
396 struct nfs_fh * fh;
397 struct iattr * sattr;
398 unsigned int guard;
399 struct timespec guardtime;
400};
401
402struct nfs3_diropargs {
403 struct nfs_fh * fh;
404 const char * name;
405 unsigned int len;
406};
407
408struct nfs3_accessargs {
409 struct nfs_fh * fh;
410 __u32 access;
411};
412
413struct nfs3_createargs {
414 struct nfs_fh * fh;
415 const char * name;
416 unsigned int len;
417 struct iattr * sattr;
418 enum nfs3_createmode createmode;
419 __u32 verifier[2];
420};
421
422struct nfs3_mkdirargs {
423 struct nfs_fh * fh;
424 const char * name;
425 unsigned int len;
426 struct iattr * sattr;
427};
428
429struct nfs3_symlinkargs {
430 struct nfs_fh * fromfh;
431 const char * fromname;
432 unsigned int fromlen;
433 const char * topath;
434 unsigned int tolen;
435 struct iattr * sattr;
436};
437
438struct nfs3_mknodargs {
439 struct nfs_fh * fh;
440 const char * name;
441 unsigned int len;
442 enum nfs3_ftype type;
443 struct iattr * sattr;
444 dev_t rdev;
445};
446
447struct nfs3_renameargs {
448 struct nfs_fh * fromfh;
449 const char * fromname;
450 unsigned int fromlen;
451 struct nfs_fh * tofh;
452 const char * toname;
453 unsigned int tolen;
454};
455
456struct nfs3_linkargs {
457 struct nfs_fh * fromfh;
458 struct nfs_fh * tofh;
459 const char * toname;
460 unsigned int tolen;
461};
462
463struct nfs3_readdirargs {
464 struct nfs_fh * fh;
465 __u64 cookie;
466 __u32 verf[2];
467 int plus;
468 unsigned int count;
469 struct page ** pages;
470};
471
472struct nfs3_diropres {
473 struct nfs_fattr * dir_attr;
474 struct nfs_fh * fh;
475 struct nfs_fattr * fattr;
476};
477
478struct nfs3_accessres {
479 struct nfs_fattr * fattr;
480 __u32 access;
481};
482
483struct nfs3_readlinkargs {
484 struct nfs_fh * fh;
485 unsigned int pgbase;
486 unsigned int pglen;
487 struct page ** pages;
488};
489
490struct nfs3_renameres {
491 struct nfs_fattr * fromattr;
492 struct nfs_fattr * toattr;
493};
494
495struct nfs3_linkres {
496 struct nfs_fattr * dir_attr;
497 struct nfs_fattr * fattr;
498};
499
500struct nfs3_readdirres {
501 struct nfs_fattr * dir_attr;
502 __u32 * verf;
503 int plus;
504};
505
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000506struct nfs3_getaclres {
507 struct nfs_fattr * fattr;
508 int mask;
509 unsigned int acl_access_count;
510 unsigned int acl_default_count;
511 struct posix_acl * acl_access;
512 struct posix_acl * acl_default;
513};
514
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515#ifdef CONFIG_NFS_V4
516
517typedef u64 clientid4;
518
519struct nfs4_accessargs {
520 const struct nfs_fh * fh;
521 u32 access;
522};
523
524struct nfs4_accessres {
525 u32 supported;
526 u32 access;
527};
528
529struct nfs4_create_arg {
530 u32 ftype;
531 union {
532 struct qstr * symlink; /* NF4LNK */
533 struct {
534 u32 specdata1;
535 u32 specdata2;
536 } device; /* NF4BLK, NF4CHR */
537 } u;
538 const struct qstr * name;
539 const struct nfs_server * server;
540 const struct iattr * attrs;
541 const struct nfs_fh * dir_fh;
542 const u32 * bitmask;
543};
544
545struct nfs4_create_res {
546 const struct nfs_server * server;
547 struct nfs_fh * fh;
548 struct nfs_fattr * fattr;
549 struct nfs4_change_info dir_cinfo;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400550 struct nfs_fattr * dir_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551};
552
553struct nfs4_fsinfo_arg {
554 const struct nfs_fh * fh;
555 const u32 * bitmask;
556};
557
558struct nfs4_getattr_arg {
559 const struct nfs_fh * fh;
560 const u32 * bitmask;
561};
562
563struct nfs4_getattr_res {
564 const struct nfs_server * server;
565 struct nfs_fattr * fattr;
566};
567
568struct nfs4_link_arg {
569 const struct nfs_fh * fh;
570 const struct nfs_fh * dir_fh;
571 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400572 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700573};
574
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400575struct nfs4_link_res {
576 const struct nfs_server * server;
577 struct nfs_fattr * fattr;
578 struct nfs4_change_info cinfo;
579 struct nfs_fattr * dir_attr;
580};
581
582
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583struct nfs4_lookup_arg {
584 const struct nfs_fh * dir_fh;
585 const struct qstr * name;
586 const u32 * bitmask;
587};
588
589struct nfs4_lookup_res {
590 const struct nfs_server * server;
591 struct nfs_fattr * fattr;
592 struct nfs_fh * fh;
593};
594
595struct nfs4_lookup_root_arg {
596 const u32 * bitmask;
597};
598
599struct nfs4_pathconf_arg {
600 const struct nfs_fh * fh;
601 const u32 * bitmask;
602};
603
604struct nfs4_readdir_arg {
605 const struct nfs_fh * fh;
606 u64 cookie;
607 nfs4_verifier verifier;
608 u32 count;
609 struct page ** pages; /* zero-copy data */
610 unsigned int pgbase; /* zero-copy data */
611 const u32 * bitmask;
612};
613
614struct nfs4_readdir_res {
615 nfs4_verifier verifier;
616 unsigned int pgbase;
617};
618
619struct nfs4_readlink {
620 const struct nfs_fh * fh;
621 unsigned int pgbase;
622 unsigned int pglen; /* zero-copy data */
623 struct page ** pages; /* zero-copy data */
624};
625
626struct nfs4_remove_arg {
627 const struct nfs_fh * fh;
628 const struct qstr * name;
Trond Myklebust16e42952005-10-27 22:12:44 -0400629 const u32 * bitmask;
630};
631
632struct nfs4_remove_res {
633 const struct nfs_server * server;
634 struct nfs4_change_info cinfo;
635 struct nfs_fattr * dir_attr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636};
637
638struct nfs4_rename_arg {
639 const struct nfs_fh * old_dir;
640 const struct nfs_fh * new_dir;
641 const struct qstr * old_name;
642 const struct qstr * new_name;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400643 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700644};
645
646struct nfs4_rename_res {
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400647 const struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 struct nfs4_change_info old_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400649 struct nfs_fattr * old_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700650 struct nfs4_change_info new_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400651 struct nfs_fattr * new_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652};
653
654struct nfs4_setclientid {
655 const nfs4_verifier * sc_verifier; /* request */
656 unsigned int sc_name_len;
657 char sc_name[32]; /* request */
658 u32 sc_prog; /* request */
659 unsigned int sc_netid_len;
660 char sc_netid[4]; /* request */
661 unsigned int sc_uaddr_len;
662 char sc_uaddr[24]; /* request */
663 u32 sc_cb_ident; /* request */
664};
665
666struct nfs4_statfs_arg {
667 const struct nfs_fh * fh;
668 const u32 * bitmask;
669};
670
671struct nfs4_server_caps_res {
672 u32 attr_bitmask[2];
673 u32 acl_bitmask;
674 u32 has_links;
675 u32 has_symlinks;
676};
677
678#endif /* CONFIG_NFS_V4 */
679
680struct nfs_page;
681
Chuck Lever40859d72005-11-30 18:09:02 -0500682#define NFS_PAGEVEC_SIZE (8U)
683
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684struct nfs_read_data {
685 int flags;
686 struct rpc_task task;
687 struct inode *inode;
688 struct rpc_cred *cred;
689 struct nfs_fattr fattr; /* fattr storage */
690 struct list_head pages; /* Coalesced read requests */
691 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500692 struct page **pagevec;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 struct nfs_readargs args;
694 struct nfs_readres res;
695#ifdef CONFIG_NFS_V4
696 unsigned long timestamp; /* For lease renewal */
697#endif
Chuck Lever40859d72005-11-30 18:09:02 -0500698 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699};
700
701struct nfs_write_data {
702 int flags;
703 struct rpc_task task;
704 struct inode *inode;
705 struct rpc_cred *cred;
706 struct nfs_fattr fattr;
707 struct nfs_writeverf verf;
708 struct list_head pages; /* Coalesced requests we wish to flush */
709 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500710 struct page **pagevec;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 struct nfs_writeargs args; /* argument struct */
712 struct nfs_writeres res; /* result struct */
713#ifdef CONFIG_NFS_V4
714 unsigned long timestamp; /* For lease renewal */
715#endif
Chuck Lever40859d72005-11-30 18:09:02 -0500716 struct page *page_array[NFS_PAGEVEC_SIZE + 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700717};
718
719struct nfs_access_entry;
720
721/*
722 * RPC procedure vector for NFSv2/NFSv3 demuxing
723 */
724struct nfs_rpc_ops {
725 int version; /* Protocol version */
726 struct dentry_operations *dentry_ops;
727 struct inode_operations *dir_inode_ops;
J. Bruce Fields92cfc622005-06-22 17:16:22 +0000728 struct inode_operations *file_inode_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700729
730 int (*getroot) (struct nfs_server *, struct nfs_fh *,
731 struct nfs_fsinfo *);
732 int (*getattr) (struct nfs_server *, struct nfs_fh *,
733 struct nfs_fattr *);
734 int (*setattr) (struct dentry *, struct nfs_fattr *,
735 struct iattr *);
736 int (*lookup) (struct inode *, struct qstr *,
737 struct nfs_fh *, struct nfs_fattr *);
738 int (*access) (struct inode *, struct nfs_access_entry *);
739 int (*readlink)(struct inode *, struct page *, unsigned int,
740 unsigned int);
741 int (*read) (struct nfs_read_data *);
742 int (*write) (struct nfs_write_data *);
743 int (*commit) (struct nfs_write_data *);
744 int (*create) (struct inode *, struct dentry *,
Trond Myklebust02a913a2005-10-18 14:20:17 -0700745 struct iattr *, int, struct nameidata *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700746 int (*remove) (struct inode *, struct qstr *);
747 int (*unlink_setup) (struct rpc_message *,
748 struct dentry *, struct qstr *);
749 int (*unlink_done) (struct dentry *, struct rpc_task *);
750 int (*rename) (struct inode *, struct qstr *,
751 struct inode *, struct qstr *);
752 int (*link) (struct inode *, struct inode *, struct qstr *);
753 int (*symlink) (struct inode *, struct qstr *, struct qstr *,
754 struct iattr *, struct nfs_fh *,
755 struct nfs_fattr *);
756 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
757 int (*rmdir) (struct inode *, struct qstr *);
758 int (*readdir) (struct dentry *, struct rpc_cred *,
759 u64, struct page *, unsigned int, int);
760 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
761 dev_t);
762 int (*statfs) (struct nfs_server *, struct nfs_fh *,
763 struct nfs_fsstat *);
764 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
765 struct nfs_fsinfo *);
766 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
767 struct nfs_pathconf *);
768 u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
769 void (*read_setup) (struct nfs_read_data *);
Trond Myklebustec06c092006-03-20 13:44:27 -0500770 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771 void (*write_setup) (struct nfs_write_data *, int how);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500772 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773 void (*commit_setup) (struct nfs_write_data *, int how);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500774 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775 int (*file_open) (struct inode *, struct file *);
776 int (*file_release) (struct inode *, struct file *);
777 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +0000778 void (*clear_acl_cache)(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779};
780
781/*
782 * NFS_CALL(getattr, inode, (fattr));
783 * into
784 * NFS_PROTO(inode)->getattr(fattr);
785 */
786#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
787
788/*
789 * Function vectors etc. for the NFS client
790 */
791extern struct nfs_rpc_ops nfs_v2_clientops;
792extern struct nfs_rpc_ops nfs_v3_clientops;
793extern struct nfs_rpc_ops nfs_v4_clientops;
794extern struct rpc_version nfs_version2;
795extern struct rpc_version nfs_version3;
796extern struct rpc_version nfs_version4;
797
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000798extern struct rpc_version nfsacl_version3;
799extern struct rpc_program nfsacl_program;
800
Linus Torvalds1da177e2005-04-16 15:20:36 -0700801#endif