Revalidate caches on lock
[linux-2.6.git] / include / linux / nfs_xdr.h
blobda7a1300dc60bb01423cafd64cb8028b7de5dcb2
1 #ifndef _LINUX_NFS_XDR_H
2 #define _LINUX_NFS_XDR_H
4 #include <linux/nfsacl.h>
5 #include <linux/nfs3.h>
7 /*
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.
13 #define NFS_MAX_FILE_IO_SIZE (1048576U)
14 #define NFS_DEF_FILE_IO_SIZE (4096U)
15 #define NFS_MIN_FILE_IO_SIZE (1024U)
17 struct nfs_fsid {
18 uint64_t major;
19 uint64_t minor;
23 * Helper for checking equality between 2 fsids.
25 static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
27 return a->major == b->major && a->minor == b->minor;
30 struct nfs_fattr {
31 unsigned int valid; /* which fields are valid */
32 umode_t mode;
33 __u32 nlink;
34 __u32 uid;
35 __u32 gid;
36 dev_t rdev;
37 __u64 size;
38 union {
39 struct {
40 __u32 blocksize;
41 __u32 blocks;
42 } nfs2;
43 struct {
44 __u64 used;
45 } nfs3;
46 } du;
47 struct nfs_fsid fsid;
48 __u64 fileid;
49 struct timespec atime;
50 struct timespec mtime;
51 struct timespec ctime;
52 __u64 change_attr; /* NFSv4 change attribute */
53 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
54 __u64 pre_size; /* pre_op_attr.size */
55 struct timespec pre_mtime; /* pre_op_attr.mtime */
56 struct timespec pre_ctime; /* pre_op_attr.ctime */
57 unsigned long time_start;
58 unsigned long gencount;
61 #define NFS_ATTR_FATTR_TYPE (1U << 0)
62 #define NFS_ATTR_FATTR_MODE (1U << 1)
63 #define NFS_ATTR_FATTR_NLINK (1U << 2)
64 #define NFS_ATTR_FATTR_OWNER (1U << 3)
65 #define NFS_ATTR_FATTR_GROUP (1U << 4)
66 #define NFS_ATTR_FATTR_RDEV (1U << 5)
67 #define NFS_ATTR_FATTR_SIZE (1U << 6)
68 #define NFS_ATTR_FATTR_PRESIZE (1U << 7)
69 #define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
70 #define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
71 #define NFS_ATTR_FATTR_FSID (1U << 10)
72 #define NFS_ATTR_FATTR_FILEID (1U << 11)
73 #define NFS_ATTR_FATTR_ATIME (1U << 12)
74 #define NFS_ATTR_FATTR_MTIME (1U << 13)
75 #define NFS_ATTR_FATTR_CTIME (1U << 14)
76 #define NFS_ATTR_FATTR_PREMTIME (1U << 15)
77 #define NFS_ATTR_FATTR_PRECTIME (1U << 16)
78 #define NFS_ATTR_FATTR_CHANGE (1U << 17)
79 #define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
80 #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
82 #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
83 | NFS_ATTR_FATTR_MODE \
84 | NFS_ATTR_FATTR_NLINK \
85 | NFS_ATTR_FATTR_OWNER \
86 | NFS_ATTR_FATTR_GROUP \
87 | NFS_ATTR_FATTR_RDEV \
88 | NFS_ATTR_FATTR_SIZE \
89 | NFS_ATTR_FATTR_FSID \
90 | NFS_ATTR_FATTR_FILEID \
91 | NFS_ATTR_FATTR_ATIME \
92 | NFS_ATTR_FATTR_MTIME \
93 | NFS_ATTR_FATTR_CTIME)
94 #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
95 | NFS_ATTR_FATTR_BLOCKS_USED)
96 #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
97 | NFS_ATTR_FATTR_SPACE_USED)
98 #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
99 | NFS_ATTR_FATTR_SPACE_USED \
100 | NFS_ATTR_FATTR_CHANGE)
103 * Info on the file system
105 struct nfs_fsinfo {
106 struct nfs_fattr *fattr; /* Post-op attributes */
107 __u32 rtmax; /* max. read transfer size */
108 __u32 rtpref; /* pref. read transfer size */
109 __u32 rtmult; /* reads should be multiple of this */
110 __u32 wtmax; /* max. write transfer size */
111 __u32 wtpref; /* pref. write transfer size */
112 __u32 wtmult; /* writes should be multiple of this */
113 __u32 dtpref; /* pref. readdir transfer size */
114 __u64 maxfilesize;
115 struct timespec time_delta; /* server time granularity */
116 __u32 lease_time; /* in seconds */
119 struct nfs_fsstat {
120 struct nfs_fattr *fattr; /* Post-op attributes */
121 __u64 tbytes; /* total size in bytes */
122 __u64 fbytes; /* # of free bytes */
123 __u64 abytes; /* # of bytes available to user */
124 __u64 tfiles; /* # of files */
125 __u64 ffiles; /* # of free files */
126 __u64 afiles; /* # of files available to user */
129 struct nfs2_fsstat {
130 __u32 tsize; /* Server transfer size */
131 __u32 bsize; /* Filesystem block size */
132 __u32 blocks; /* No. of "bsize" blocks on filesystem */
133 __u32 bfree; /* No. of free "bsize" blocks */
134 __u32 bavail; /* No. of available "bsize" blocks */
137 struct nfs_pathconf {
138 struct nfs_fattr *fattr; /* Post-op attributes */
139 __u32 max_link; /* max # of hard links */
140 __u32 max_namelen; /* max name length */
143 struct nfs4_change_info {
144 u32 atomic;
145 u64 before;
146 u64 after;
149 struct nfs_seqid;
151 /* nfs41 sessions channel attributes */
152 struct nfs4_channel_attrs {
153 u32 headerpadsz;
154 u32 max_rqst_sz;
155 u32 max_resp_sz;
156 u32 max_resp_sz_cached;
157 u32 max_ops;
158 u32 max_reqs;
161 /* nfs41 sessions slot seqid */
162 struct nfs4_slot {
163 u32 seq_nr;
166 struct nfs4_sequence_args {
167 struct nfs4_session *sa_session;
168 u8 sa_slotid;
169 u8 sa_cache_this;
172 struct nfs4_sequence_res {
173 struct nfs4_session *sr_session;
174 struct nfs4_slot *sr_slot; /* slot used to send request */
175 int sr_status; /* sequence operation status */
176 unsigned long sr_renewal_time;
177 u32 sr_status_flags;
180 struct nfs4_get_lease_time_args {
181 struct nfs4_sequence_args la_seq_args;
184 struct nfs4_get_lease_time_res {
185 struct nfs_fsinfo *lr_fsinfo;
186 struct nfs4_sequence_res lr_seq_res;
190 * Arguments to the open call.
192 struct nfs_openargs {
193 const struct nfs_fh * fh;
194 struct nfs_seqid * seqid;
195 int open_flags;
196 fmode_t fmode;
197 __u64 clientid;
198 __u64 id;
199 union {
200 struct {
201 struct iattr * attrs; /* UNCHECKED, GUARDED */
202 nfs4_verifier verifier; /* EXCLUSIVE */
204 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
205 fmode_t delegation_type; /* CLAIM_PREVIOUS */
206 } u;
207 const struct qstr * name;
208 const struct nfs_server *server; /* Needed for ID mapping */
209 const u32 * bitmask;
210 __u32 claim;
211 struct nfs4_sequence_args seq_args;
214 struct nfs_openres {
215 nfs4_stateid stateid;
216 struct nfs_fh fh;
217 struct nfs4_change_info cinfo;
218 __u32 rflags;
219 struct nfs_fattr * f_attr;
220 struct nfs_fattr * dir_attr;
221 struct nfs_seqid * seqid;
222 const struct nfs_server *server;
223 fmode_t delegation_type;
224 nfs4_stateid delegation;
225 __u32 do_recall;
226 __u64 maxsize;
227 __u32 attrset[NFS4_BITMAP_SIZE];
228 struct nfs4_sequence_res seq_res;
232 * Arguments to the open_confirm call.
234 struct nfs_open_confirmargs {
235 const struct nfs_fh * fh;
236 nfs4_stateid * stateid;
237 struct nfs_seqid * seqid;
240 struct nfs_open_confirmres {
241 nfs4_stateid stateid;
242 struct nfs_seqid * seqid;
246 * Arguments to the close call.
248 struct nfs_closeargs {
249 struct nfs_fh * fh;
250 nfs4_stateid * stateid;
251 struct nfs_seqid * seqid;
252 fmode_t fmode;
253 const u32 * bitmask;
254 struct nfs4_sequence_args seq_args;
257 struct nfs_closeres {
258 nfs4_stateid stateid;
259 struct nfs_fattr * fattr;
260 struct nfs_seqid * seqid;
261 const struct nfs_server *server;
262 struct nfs4_sequence_res seq_res;
265 * * Arguments to the lock,lockt, and locku call.
266 * */
267 struct nfs_lowner {
268 __u64 clientid;
269 __u64 id;
272 struct nfs_lock_args {
273 struct nfs_fh * fh;
274 struct file_lock * fl;
275 struct nfs_seqid * lock_seqid;
276 nfs4_stateid * lock_stateid;
277 struct nfs_seqid * open_seqid;
278 nfs4_stateid * open_stateid;
279 struct nfs_lowner lock_owner;
280 unsigned char block : 1;
281 unsigned char reclaim : 1;
282 unsigned char new_lock_owner : 1;
283 struct nfs4_sequence_args seq_args;
286 struct nfs_lock_res {
287 nfs4_stateid stateid;
288 struct nfs_seqid * lock_seqid;
289 struct nfs_seqid * open_seqid;
290 struct nfs4_sequence_res seq_res;
293 struct nfs_locku_args {
294 struct nfs_fh * fh;
295 struct file_lock * fl;
296 struct nfs_seqid * seqid;
297 nfs4_stateid * stateid;
298 struct nfs4_sequence_args seq_args;
301 struct nfs_locku_res {
302 nfs4_stateid stateid;
303 struct nfs_seqid * seqid;
304 struct nfs4_sequence_res seq_res;
307 struct nfs_lockt_args {
308 struct nfs_fh * fh;
309 struct file_lock * fl;
310 struct nfs_lowner lock_owner;
311 struct nfs4_sequence_args seq_args;
314 struct nfs_lockt_res {
315 struct file_lock * denied; /* LOCK, LOCKT failed */
316 struct nfs4_sequence_res seq_res;
319 struct nfs_release_lockowner_args {
320 struct nfs_lowner lock_owner;
323 struct nfs4_delegreturnargs {
324 const struct nfs_fh *fhandle;
325 const nfs4_stateid *stateid;
326 const u32 * bitmask;
327 struct nfs4_sequence_args seq_args;
330 struct nfs4_delegreturnres {
331 struct nfs_fattr * fattr;
332 const struct nfs_server *server;
333 struct nfs4_sequence_res seq_res;
337 * Arguments to the read call.
339 struct nfs_readargs {
340 struct nfs_fh * fh;
341 struct nfs_open_context *context;
342 struct nfs_lock_context *lock_context;
343 __u64 offset;
344 __u32 count;
345 unsigned int pgbase;
346 struct page ** pages;
347 struct nfs4_sequence_args seq_args;
350 struct nfs_readres {
351 struct nfs_fattr * fattr;
352 __u32 count;
353 int eof;
354 struct nfs4_sequence_res seq_res;
358 * Arguments to the write call.
360 struct nfs_writeargs {
361 struct nfs_fh * fh;
362 struct nfs_open_context *context;
363 struct nfs_lock_context *lock_context;
364 __u64 offset;
365 __u32 count;
366 enum nfs3_stable_how stable;
367 unsigned int pgbase;
368 struct page ** pages;
369 const u32 * bitmask;
370 struct nfs4_sequence_args seq_args;
373 struct nfs_writeverf {
374 enum nfs3_stable_how committed;
375 __be32 verifier[2];
378 struct nfs_writeres {
379 struct nfs_fattr * fattr;
380 struct nfs_writeverf * verf;
381 __u32 count;
382 const struct nfs_server *server;
383 struct nfs4_sequence_res seq_res;
387 * Common arguments to the unlink call
389 struct nfs_removeargs {
390 const struct nfs_fh *fh;
391 struct qstr name;
392 const u32 * bitmask;
393 struct nfs4_sequence_args seq_args;
396 struct nfs_removeres {
397 const struct nfs_server *server;
398 struct nfs_fattr *dir_attr;
399 struct nfs4_change_info cinfo;
400 struct nfs4_sequence_res seq_res;
404 * Common arguments to the rename call
406 struct nfs_renameargs {
407 const struct nfs_fh *old_dir;
408 const struct nfs_fh *new_dir;
409 const struct qstr *old_name;
410 const struct qstr *new_name;
411 const u32 *bitmask;
412 struct nfs4_sequence_args seq_args;
415 struct nfs_renameres {
416 const struct nfs_server *server;
417 struct nfs4_change_info old_cinfo;
418 struct nfs_fattr *old_fattr;
419 struct nfs4_change_info new_cinfo;
420 struct nfs_fattr *new_fattr;
421 struct nfs4_sequence_res seq_res;
425 * Argument struct for decode_entry function
427 struct nfs_entry {
428 __u64 ino;
429 __u64 cookie,
430 prev_cookie;
431 const char * name;
432 unsigned int len;
433 int eof;
434 struct nfs_fh * fh;
435 struct nfs_fattr * fattr;
439 * The following types are for NFSv2 only.
441 struct nfs_sattrargs {
442 struct nfs_fh * fh;
443 struct iattr * sattr;
446 struct nfs_diropargs {
447 struct nfs_fh * fh;
448 const char * name;
449 unsigned int len;
452 struct nfs_createargs {
453 struct nfs_fh * fh;
454 const char * name;
455 unsigned int len;
456 struct iattr * sattr;
459 struct nfs_setattrargs {
460 struct nfs_fh * fh;
461 nfs4_stateid stateid;
462 struct iattr * iap;
463 const struct nfs_server * server; /* Needed for name mapping */
464 const u32 * bitmask;
465 struct nfs4_sequence_args seq_args;
468 struct nfs_setaclargs {
469 struct nfs_fh * fh;
470 size_t acl_len;
471 unsigned int acl_pgbase;
472 struct page ** acl_pages;
473 struct nfs4_sequence_args seq_args;
476 struct nfs_setaclres {
477 struct nfs4_sequence_res seq_res;
480 struct nfs_getaclargs {
481 struct nfs_fh * fh;
482 size_t acl_len;
483 unsigned int acl_pgbase;
484 struct page ** acl_pages;
485 struct nfs4_sequence_args seq_args;
488 struct nfs_getaclres {
489 size_t acl_len;
490 struct nfs4_sequence_res seq_res;
493 struct nfs_setattrres {
494 struct nfs_fattr * fattr;
495 const struct nfs_server * server;
496 struct nfs4_sequence_res seq_res;
499 struct nfs_linkargs {
500 struct nfs_fh * fromfh;
501 struct nfs_fh * tofh;
502 const char * toname;
503 unsigned int tolen;
506 struct nfs_symlinkargs {
507 struct nfs_fh * fromfh;
508 const char * fromname;
509 unsigned int fromlen;
510 struct page ** pages;
511 unsigned int pathlen;
512 struct iattr * sattr;
515 struct nfs_readdirargs {
516 struct nfs_fh * fh;
517 __u32 cookie;
518 unsigned int count;
519 struct page ** pages;
522 struct nfs3_getaclargs {
523 struct nfs_fh * fh;
524 int mask;
525 struct page ** pages;
528 struct nfs3_setaclargs {
529 struct inode * inode;
530 int mask;
531 struct posix_acl * acl_access;
532 struct posix_acl * acl_default;
533 size_t len;
534 unsigned int npages;
535 struct page ** pages;
538 struct nfs_diropok {
539 struct nfs_fh * fh;
540 struct nfs_fattr * fattr;
543 struct nfs_readlinkargs {
544 struct nfs_fh * fh;
545 unsigned int pgbase;
546 unsigned int pglen;
547 struct page ** pages;
550 struct nfs3_sattrargs {
551 struct nfs_fh * fh;
552 struct iattr * sattr;
553 unsigned int guard;
554 struct timespec guardtime;
557 struct nfs3_diropargs {
558 struct nfs_fh * fh;
559 const char * name;
560 unsigned int len;
563 struct nfs3_accessargs {
564 struct nfs_fh * fh;
565 __u32 access;
568 struct nfs3_createargs {
569 struct nfs_fh * fh;
570 const char * name;
571 unsigned int len;
572 struct iattr * sattr;
573 enum nfs3_createmode createmode;
574 __be32 verifier[2];
577 struct nfs3_mkdirargs {
578 struct nfs_fh * fh;
579 const char * name;
580 unsigned int len;
581 struct iattr * sattr;
584 struct nfs3_symlinkargs {
585 struct nfs_fh * fromfh;
586 const char * fromname;
587 unsigned int fromlen;
588 struct page ** pages;
589 unsigned int pathlen;
590 struct iattr * sattr;
593 struct nfs3_mknodargs {
594 struct nfs_fh * fh;
595 const char * name;
596 unsigned int len;
597 enum nfs3_ftype type;
598 struct iattr * sattr;
599 dev_t rdev;
602 struct nfs3_linkargs {
603 struct nfs_fh * fromfh;
604 struct nfs_fh * tofh;
605 const char * toname;
606 unsigned int tolen;
609 struct nfs3_readdirargs {
610 struct nfs_fh * fh;
611 __u64 cookie;
612 __be32 verf[2];
613 int plus;
614 unsigned int count;
615 struct page ** pages;
618 struct nfs3_diropres {
619 struct nfs_fattr * dir_attr;
620 struct nfs_fh * fh;
621 struct nfs_fattr * fattr;
624 struct nfs3_accessres {
625 struct nfs_fattr * fattr;
626 __u32 access;
629 struct nfs3_readlinkargs {
630 struct nfs_fh * fh;
631 unsigned int pgbase;
632 unsigned int pglen;
633 struct page ** pages;
636 struct nfs3_linkres {
637 struct nfs_fattr * dir_attr;
638 struct nfs_fattr * fattr;
641 struct nfs3_readdirres {
642 struct nfs_fattr * dir_attr;
643 __be32 * verf;
644 int plus;
647 struct nfs3_getaclres {
648 struct nfs_fattr * fattr;
649 int mask;
650 unsigned int acl_access_count;
651 unsigned int acl_default_count;
652 struct posix_acl * acl_access;
653 struct posix_acl * acl_default;
656 #ifdef CONFIG_NFS_V4
658 typedef u64 clientid4;
660 struct nfs4_accessargs {
661 const struct nfs_fh * fh;
662 const u32 * bitmask;
663 u32 access;
664 struct nfs4_sequence_args seq_args;
667 struct nfs4_accessres {
668 const struct nfs_server * server;
669 struct nfs_fattr * fattr;
670 u32 supported;
671 u32 access;
672 struct nfs4_sequence_res seq_res;
675 struct nfs4_create_arg {
676 u32 ftype;
677 union {
678 struct {
679 struct page ** pages;
680 unsigned int len;
681 } symlink; /* NF4LNK */
682 struct {
683 u32 specdata1;
684 u32 specdata2;
685 } device; /* NF4BLK, NF4CHR */
686 } u;
687 const struct qstr * name;
688 const struct nfs_server * server;
689 const struct iattr * attrs;
690 const struct nfs_fh * dir_fh;
691 const u32 * bitmask;
692 struct nfs4_sequence_args seq_args;
695 struct nfs4_create_res {
696 const struct nfs_server * server;
697 struct nfs_fh * fh;
698 struct nfs_fattr * fattr;
699 struct nfs4_change_info dir_cinfo;
700 struct nfs_fattr * dir_fattr;
701 struct nfs4_sequence_res seq_res;
704 struct nfs4_fsinfo_arg {
705 const struct nfs_fh * fh;
706 const u32 * bitmask;
707 struct nfs4_sequence_args seq_args;
710 struct nfs4_fsinfo_res {
711 struct nfs_fsinfo *fsinfo;
712 struct nfs4_sequence_res seq_res;
715 struct nfs4_getattr_arg {
716 const struct nfs_fh * fh;
717 const u32 * bitmask;
718 struct nfs4_sequence_args seq_args;
721 struct nfs4_getattr_res {
722 const struct nfs_server * server;
723 struct nfs_fattr * fattr;
724 struct nfs4_sequence_res seq_res;
727 struct nfs4_link_arg {
728 const struct nfs_fh * fh;
729 const struct nfs_fh * dir_fh;
730 const struct qstr * name;
731 const u32 * bitmask;
732 struct nfs4_sequence_args seq_args;
735 struct nfs4_link_res {
736 const struct nfs_server * server;
737 struct nfs_fattr * fattr;
738 struct nfs4_change_info cinfo;
739 struct nfs_fattr * dir_attr;
740 struct nfs4_sequence_res seq_res;
744 struct nfs4_lookup_arg {
745 const struct nfs_fh * dir_fh;
746 const struct qstr * name;
747 const u32 * bitmask;
748 struct nfs4_sequence_args seq_args;
751 struct nfs4_lookup_res {
752 const struct nfs_server * server;
753 struct nfs_fattr * fattr;
754 struct nfs_fh * fh;
755 struct nfs4_sequence_res seq_res;
758 struct nfs4_lookup_root_arg {
759 const u32 * bitmask;
760 struct nfs4_sequence_args seq_args;
763 struct nfs4_pathconf_arg {
764 const struct nfs_fh * fh;
765 const u32 * bitmask;
766 struct nfs4_sequence_args seq_args;
769 struct nfs4_pathconf_res {
770 struct nfs_pathconf *pathconf;
771 struct nfs4_sequence_res seq_res;
774 struct nfs4_readdir_arg {
775 const struct nfs_fh * fh;
776 u64 cookie;
777 nfs4_verifier verifier;
778 u32 count;
779 struct page ** pages; /* zero-copy data */
780 unsigned int pgbase; /* zero-copy data */
781 const u32 * bitmask;
782 int plus;
783 struct nfs4_sequence_args seq_args;
786 struct nfs4_readdir_res {
787 nfs4_verifier verifier;
788 unsigned int pgbase;
789 struct nfs4_sequence_res seq_res;
792 struct nfs4_readlink {
793 const struct nfs_fh * fh;
794 unsigned int pgbase;
795 unsigned int pglen; /* zero-copy data */
796 struct page ** pages; /* zero-copy data */
797 struct nfs4_sequence_args seq_args;
800 struct nfs4_readlink_res {
801 struct nfs4_sequence_res seq_res;
804 #define NFS4_SETCLIENTID_NAMELEN (127)
805 struct nfs4_setclientid {
806 const nfs4_verifier * sc_verifier;
807 unsigned int sc_name_len;
808 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
809 u32 sc_prog;
810 unsigned int sc_netid_len;
811 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
812 unsigned int sc_uaddr_len;
813 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
814 u32 sc_cb_ident;
817 struct nfs4_setclientid_res {
818 u64 clientid;
819 nfs4_verifier confirm;
822 struct nfs4_statfs_arg {
823 const struct nfs_fh * fh;
824 const u32 * bitmask;
825 struct nfs4_sequence_args seq_args;
828 struct nfs4_statfs_res {
829 struct nfs_fsstat *fsstat;
830 struct nfs4_sequence_res seq_res;
833 struct nfs4_server_caps_arg {
834 struct nfs_fh *fhandle;
835 struct nfs4_sequence_args seq_args;
838 struct nfs4_server_caps_res {
839 u32 attr_bitmask[2];
840 u32 acl_bitmask;
841 u32 has_links;
842 u32 has_symlinks;
843 struct nfs4_sequence_res seq_res;
846 struct nfs4_string {
847 unsigned int len;
848 char *data;
851 #define NFS4_PATHNAME_MAXCOMPONENTS 512
852 struct nfs4_pathname {
853 unsigned int ncomponents;
854 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
857 #define NFS4_FS_LOCATION_MAXSERVERS 10
858 struct nfs4_fs_location {
859 unsigned int nservers;
860 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
861 struct nfs4_pathname rootpath;
864 #define NFS4_FS_LOCATIONS_MAXENTRIES 10
865 struct nfs4_fs_locations {
866 struct nfs_fattr fattr;
867 const struct nfs_server *server;
868 struct nfs4_pathname fs_path;
869 int nlocations;
870 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
873 struct nfs4_fs_locations_arg {
874 const struct nfs_fh *dir_fh;
875 const struct qstr *name;
876 struct page *page;
877 const u32 *bitmask;
878 struct nfs4_sequence_args seq_args;
881 struct nfs4_fs_locations_res {
882 struct nfs4_fs_locations *fs_locations;
883 struct nfs4_sequence_res seq_res;
886 #endif /* CONFIG_NFS_V4 */
888 struct nfstime4 {
889 u64 seconds;
890 u32 nseconds;
893 #ifdef CONFIG_NFS_V4_1
894 struct nfs_impl_id4 {
895 u32 domain_len;
896 char *domain;
897 u32 name_len;
898 char *name;
899 struct nfstime4 date;
902 #define NFS4_EXCHANGE_ID_LEN (48)
903 struct nfs41_exchange_id_args {
904 struct nfs_client *client;
905 nfs4_verifier *verifier;
906 unsigned int id_len;
907 char id[NFS4_EXCHANGE_ID_LEN];
908 u32 flags;
911 struct server_owner {
912 uint64_t minor_id;
913 uint32_t major_id_sz;
914 char major_id[NFS4_OPAQUE_LIMIT];
917 struct server_scope {
918 uint32_t server_scope_sz;
919 char server_scope[NFS4_OPAQUE_LIMIT];
922 struct nfs41_exchange_id_res {
923 struct nfs_client *client;
924 u32 flags;
927 struct nfs41_create_session_args {
928 struct nfs_client *client;
929 uint32_t flags;
930 uint32_t cb_program;
931 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
932 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
935 struct nfs41_create_session_res {
936 struct nfs_client *client;
939 struct nfs41_reclaim_complete_args {
940 /* In the future extend to include curr_fh for use with migration */
941 unsigned char one_fs:1;
942 struct nfs4_sequence_args seq_args;
945 struct nfs41_reclaim_complete_res {
946 struct nfs4_sequence_res seq_res;
948 #endif /* CONFIG_NFS_V4_1 */
950 struct nfs_page;
952 #define NFS_PAGEVEC_SIZE (8U)
954 struct nfs_read_data {
955 int flags;
956 struct rpc_task task;
957 struct inode *inode;
958 struct rpc_cred *cred;
959 struct nfs_fattr fattr; /* fattr storage */
960 struct list_head pages; /* Coalesced read requests */
961 struct nfs_page *req; /* multi ops per nfs_page */
962 struct page **pagevec;
963 unsigned int npages; /* Max length of pagevec */
964 struct nfs_readargs args;
965 struct nfs_readres res;
966 #ifdef CONFIG_NFS_V4
967 unsigned long timestamp; /* For lease renewal */
968 #endif
969 struct page *page_array[NFS_PAGEVEC_SIZE];
972 struct nfs_write_data {
973 int flags;
974 struct rpc_task task;
975 struct inode *inode;
976 struct rpc_cred *cred;
977 struct nfs_fattr fattr;
978 struct nfs_writeverf verf;
979 struct list_head pages; /* Coalesced requests we wish to flush */
980 struct nfs_page *req; /* multi ops per nfs_page */
981 struct page **pagevec;
982 unsigned int npages; /* Max length of pagevec */
983 struct nfs_writeargs args; /* argument struct */
984 struct nfs_writeres res; /* result struct */
985 #ifdef CONFIG_NFS_V4
986 unsigned long timestamp; /* For lease renewal */
987 #endif
988 struct page *page_array[NFS_PAGEVEC_SIZE];
991 struct nfs_access_entry;
994 * RPC procedure vector for NFSv2/NFSv3 demuxing
996 struct nfs_rpc_ops {
997 u32 version; /* Protocol version */
998 const struct dentry_operations *dentry_ops;
999 const struct inode_operations *dir_inode_ops;
1000 const struct inode_operations *file_inode_ops;
1002 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1003 struct nfs_fsinfo *);
1004 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
1005 struct qstr *, struct nfs_fh *,
1006 struct nfs_fattr *);
1007 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1008 struct nfs_fattr *);
1009 int (*setattr) (struct dentry *, struct nfs_fattr *,
1010 struct iattr *);
1011 int (*lookup) (struct inode *, struct qstr *,
1012 struct nfs_fh *, struct nfs_fattr *);
1013 int (*access) (struct inode *, struct nfs_access_entry *);
1014 int (*readlink)(struct inode *, struct page *, unsigned int,
1015 unsigned int);
1016 int (*create) (struct inode *, struct dentry *,
1017 struct iattr *, int, struct nfs_open_context *);
1018 int (*remove) (struct inode *, struct qstr *);
1019 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1020 int (*unlink_done) (struct rpc_task *, struct inode *);
1021 int (*rename) (struct inode *, struct qstr *,
1022 struct inode *, struct qstr *);
1023 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1024 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1025 int (*link) (struct inode *, struct inode *, struct qstr *);
1026 int (*symlink) (struct inode *, struct dentry *, struct page *,
1027 unsigned int, struct iattr *);
1028 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1029 int (*rmdir) (struct inode *, struct qstr *);
1030 int (*readdir) (struct dentry *, struct rpc_cred *,
1031 u64, struct page **, unsigned int, int);
1032 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1033 dev_t);
1034 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1035 struct nfs_fsstat *);
1036 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1037 struct nfs_fsinfo *);
1038 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1039 struct nfs_pathconf *);
1040 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1041 __be32 *(*decode_dirent)(struct xdr_stream *, struct nfs_entry *, struct nfs_server *, int plus);
1042 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
1043 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
1044 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1045 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1046 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
1047 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
1048 int (*lock)(struct file *, int, struct file_lock *);
1049 int (*lock_check_bounds)(const struct file_lock *);
1050 void (*clear_acl_cache)(struct inode *);
1051 void (*close_context)(struct nfs_open_context *ctx, int);
1052 struct inode * (*open_context) (struct inode *dir,
1053 struct nfs_open_context *ctx,
1054 int open_flags,
1055 struct iattr *iattr);
1059 * NFS_CALL(getattr, inode, (fattr));
1060 * into
1061 * NFS_PROTO(inode)->getattr(fattr);
1063 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1066 * Function vectors etc. for the NFS client
1068 extern const struct nfs_rpc_ops nfs_v2_clientops;
1069 extern const struct nfs_rpc_ops nfs_v3_clientops;
1070 extern const struct nfs_rpc_ops nfs_v4_clientops;
1071 extern struct rpc_version nfs_version2;
1072 extern struct rpc_version nfs_version3;
1073 extern struct rpc_version nfs_version4;
1075 extern struct rpc_version nfsacl_version3;
1076 extern struct rpc_program nfsacl_program;
1078 #endif