Revalidate caches on lock
[deliverable/linux.git] / include / linux / nfs_xdr.h
CommitLineData
1da177e4
LT
1#ifndef _LINUX_NFS_XDR_H
2#define _LINUX_NFS_XDR_H
3
b7fa0554 4#include <linux/nfsacl.h>
d7031582 5#include <linux/nfs3.h>
1da177e4 6
40859d7e
CL
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.
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
8b4bdcf8
TM
17struct nfs_fsid {
18 uint64_t major;
19 uint64_t minor;
1da177e4
LT
20};
21
8b4bdcf8
TM
22/*
23 * Helper for checking equality between 2 fsids.
24 */
25static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
26{
27 return a->major == b->major && a->minor == b->minor;
28}
29
1da177e4 30struct nfs_fattr {
9e6e70f8 31 unsigned int valid; /* which fields are valid */
bca79478 32 umode_t mode;
1da177e4
LT
33 __u32 nlink;
34 __u32 uid;
35 __u32 gid;
9fa8d66f 36 dev_t rdev;
1da177e4
LT
37 __u64 size;
38 union {
39 struct {
40 __u32 blocksize;
41 __u32 blocks;
42 } nfs2;
43 struct {
44 __u64 used;
45 } nfs3;
46 } du;
8b4bdcf8 47 struct nfs_fsid fsid;
1da177e4
LT
48 __u64 fileid;
49 struct timespec atime;
50 struct timespec mtime;
51 struct timespec ctime;
1da177e4
LT
52 __u64 change_attr; /* NFSv4 change attribute */
53 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
1ca277d8
TM
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 */
33801147 57 unsigned long time_start;
4704f0e2 58 unsigned long gencount;
1da177e4
LT
59};
60
9e6e70f8
TM
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 */
81
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)
1da177e4
LT
101
102/*
103 * Info on the file system
104 */
105struct 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;
6b96724e 115 struct timespec time_delta; /* server time granularity */
1da177e4
LT
116 __u32 lease_time; /* in seconds */
117};
118
119struct 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 */
127};
128
129struct 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 */
135};
136
137struct 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 */
141};
142
143struct nfs4_change_info {
144 u32 atomic;
145 u64 before;
146 u64 after;
147};
148
cee54fc9 149struct nfs_seqid;
9ff71c3a 150
557134a3
AA
151/* nfs41 sessions channel attributes */
152struct 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;
159};
160
161/* nfs41 sessions slot seqid */
162struct nfs4_slot {
163 u32 seq_nr;
164};
165
9ff71c3a 166struct nfs4_sequence_args {
f3752975 167 struct nfs4_session *sa_session;
fbcd4abc
AA
168 u8 sa_slotid;
169 u8 sa_cache_this;
9ff71c3a
BH
170};
171
172struct nfs4_sequence_res {
f3752975 173 struct nfs4_session *sr_session;
dfb4f309 174 struct nfs4_slot *sr_slot; /* slot used to send request */
fbcd4abc 175 int sr_status; /* sequence operation status */
a01878aa 176 unsigned long sr_renewal_time;
0629e370 177 u32 sr_status_flags;
9ff71c3a
BH
178};
179
2050f0cc
AA
180struct nfs4_get_lease_time_args {
181 struct nfs4_sequence_args la_seq_args;
182};
183
184struct nfs4_get_lease_time_res {
185 struct nfs_fsinfo *lr_fsinfo;
186 struct nfs4_sequence_res lr_seq_res;
187};
188
1da177e4
LT
189/*
190 * Arguments to the open call.
191 */
192struct nfs_openargs {
193 const struct nfs_fh * fh;
cee54fc9 194 struct nfs_seqid * seqid;
1da177e4 195 int open_flags;
dc0b027d 196 fmode_t fmode;
1da177e4 197 __u64 clientid;
9f958ab8 198 __u64 id;
1da177e4 199 union {
d77d76ff
TM
200 struct {
201 struct iattr * attrs; /* UNCHECKED, GUARDED */
202 nfs4_verifier verifier; /* EXCLUSIVE */
203 };
1da177e4 204 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
bd7bf9d5 205 fmode_t delegation_type; /* CLAIM_PREVIOUS */
1da177e4
LT
206 } u;
207 const struct qstr * name;
208 const struct nfs_server *server; /* Needed for ID mapping */
209 const u32 * bitmask;
210 __u32 claim;
9ff71c3a 211 struct nfs4_sequence_args seq_args;
1da177e4
LT
212};
213
214struct 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;
56ae19f3 220 struct nfs_fattr * dir_attr;
c1d51931 221 struct nfs_seqid * seqid;
1da177e4 222 const struct nfs_server *server;
bd7bf9d5 223 fmode_t delegation_type;
1da177e4
LT
224 nfs4_stateid delegation;
225 __u32 do_recall;
226 __u64 maxsize;
aa53ed54 227 __u32 attrset[NFS4_BITMAP_SIZE];
9ff71c3a 228 struct nfs4_sequence_res seq_res;
1da177e4
LT
229};
230
231/*
232 * Arguments to the open_confirm call.
233 */
234struct nfs_open_confirmargs {
235 const struct nfs_fh * fh;
cdd4e68b 236 nfs4_stateid * stateid;
cee54fc9 237 struct nfs_seqid * seqid;
1da177e4
LT
238};
239
240struct nfs_open_confirmres {
241 nfs4_stateid stateid;
c1d51931 242 struct nfs_seqid * seqid;
1da177e4
LT
243};
244
245/*
246 * Arguments to the close call.
247 */
248struct nfs_closeargs {
249 struct nfs_fh * fh;
9512135d 250 nfs4_stateid * stateid;
cee54fc9 251 struct nfs_seqid * seqid;
dc0b027d 252 fmode_t fmode;
516a6af6 253 const u32 * bitmask;
9ff71c3a 254 struct nfs4_sequence_args seq_args;
1da177e4
LT
255};
256
257struct nfs_closeres {
258 nfs4_stateid stateid;
516a6af6 259 struct nfs_fattr * fattr;
c1d51931 260 struct nfs_seqid * seqid;
516a6af6 261 const struct nfs_server *server;
9ff71c3a 262 struct nfs4_sequence_res seq_res;
1da177e4
LT
263};
264/*
265 * * Arguments to the lock,lockt, and locku call.
266 * */
267struct nfs_lowner {
911d1aaf 268 __u64 clientid;
9f958ab8 269 __u64 id;
1da177e4
LT
270};
271
911d1aaf
TM
272struct nfs_lock_args {
273 struct nfs_fh * fh;
274 struct file_lock * fl;
cee54fc9 275 struct nfs_seqid * lock_seqid;
06735b34
TM
276 nfs4_stateid * lock_stateid;
277 struct nfs_seqid * open_seqid;
278 nfs4_stateid * open_stateid;
911d1aaf
TM
279 struct nfs_lowner lock_owner;
280 unsigned char block : 1;
281 unsigned char reclaim : 1;
282 unsigned char new_lock_owner : 1;
9ff71c3a 283 struct nfs4_sequence_args seq_args;
911d1aaf
TM
284};
285
286struct nfs_lock_res {
c1d51931
TM
287 nfs4_stateid stateid;
288 struct nfs_seqid * lock_seqid;
289 struct nfs_seqid * open_seqid;
9ff71c3a 290 struct nfs4_sequence_res seq_res;
1da177e4
LT
291};
292
911d1aaf
TM
293struct nfs_locku_args {
294 struct nfs_fh * fh;
295 struct file_lock * fl;
cee54fc9 296 struct nfs_seqid * seqid;
faf5f49c 297 nfs4_stateid * stateid;
9ff71c3a 298 struct nfs4_sequence_args seq_args;
1da177e4
LT
299};
300
911d1aaf 301struct nfs_locku_res {
c1d51931
TM
302 nfs4_stateid stateid;
303 struct nfs_seqid * seqid;
9ff71c3a 304 struct nfs4_sequence_res seq_res;
1da177e4
LT
305};
306
911d1aaf
TM
307struct nfs_lockt_args {
308 struct nfs_fh * fh;
309 struct file_lock * fl;
310 struct nfs_lowner lock_owner;
9ff71c3a 311 struct nfs4_sequence_args seq_args;
1da177e4
LT
312};
313
911d1aaf
TM
314struct nfs_lockt_res {
315 struct file_lock * denied; /* LOCK, LOCKT failed */
9ff71c3a 316 struct nfs4_sequence_res seq_res;
1da177e4
LT
317};
318
d3c7b7cc
TM
319struct nfs_release_lockowner_args {
320 struct nfs_lowner lock_owner;
321};
322
1da177e4
LT
323struct nfs4_delegreturnargs {
324 const struct nfs_fh *fhandle;
325 const nfs4_stateid *stateid;
fa178f29 326 const u32 * bitmask;
9ff71c3a 327 struct nfs4_sequence_args seq_args;
fa178f29
TM
328};
329
330struct nfs4_delegreturnres {
331 struct nfs_fattr * fattr;
332 const struct nfs_server *server;
9ff71c3a 333 struct nfs4_sequence_res seq_res;
1da177e4
LT
334};
335
336/*
337 * Arguments to the read call.
338 */
1da177e4
LT
339struct nfs_readargs {
340 struct nfs_fh * fh;
341 struct nfs_open_context *context;
f11ac8db 342 struct nfs_lock_context *lock_context;
1da177e4
LT
343 __u64 offset;
344 __u32 count;
345 unsigned int pgbase;
346 struct page ** pages;
9ff71c3a 347 struct nfs4_sequence_args seq_args;
1da177e4
LT
348};
349
350struct nfs_readres {
351 struct nfs_fattr * fattr;
352 __u32 count;
353 int eof;
9ff71c3a 354 struct nfs4_sequence_res seq_res;
1da177e4
LT
355};
356
357/*
358 * Arguments to the write call.
359 */
1da177e4
LT
360struct nfs_writeargs {
361 struct nfs_fh * fh;
362 struct nfs_open_context *context;
f11ac8db 363 struct nfs_lock_context *lock_context;
1da177e4
LT
364 __u64 offset;
365 __u32 count;
366 enum nfs3_stable_how stable;
367 unsigned int pgbase;
368 struct page ** pages;
4f9838c7 369 const u32 * bitmask;
9ff71c3a 370 struct nfs4_sequence_args seq_args;
1da177e4
LT
371};
372
373struct nfs_writeverf {
374 enum nfs3_stable_how committed;
bc4785cd 375 __be32 verifier[2];
1da177e4
LT
376};
377
378struct nfs_writeres {
379 struct nfs_fattr * fattr;
380 struct nfs_writeverf * verf;
381 __u32 count;
4f9838c7 382 const struct nfs_server *server;
9ff71c3a 383 struct nfs4_sequence_res seq_res;
1da177e4
LT
384};
385
4fdc17b2
TM
386/*
387 * Common arguments to the unlink call
388 */
389struct nfs_removeargs {
390 const struct nfs_fh *fh;
391 struct qstr name;
392 const u32 * bitmask;
9ff71c3a 393 struct nfs4_sequence_args seq_args;
4fdc17b2
TM
394};
395
396struct nfs_removeres {
397 const struct nfs_server *server;
d346890b 398 struct nfs_fattr *dir_attr;
4fdc17b2 399 struct nfs4_change_info cinfo;
9ff71c3a 400 struct nfs4_sequence_res seq_res;
4fdc17b2
TM
401};
402
920769f0
JL
403/*
404 * Common arguments to the rename call
405 */
406struct 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;
413};
414
e8582a8b
JL
415struct 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;
422};
423
1da177e4
LT
424/*
425 * Argument struct for decode_entry function
426 */
427struct 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;
436};
437
438/*
439 * The following types are for NFSv2 only.
440 */
441struct nfs_sattrargs {
442 struct nfs_fh * fh;
443 struct iattr * sattr;
444};
445
446struct nfs_diropargs {
447 struct nfs_fh * fh;
448 const char * name;
449 unsigned int len;
450};
451
452struct nfs_createargs {
453 struct nfs_fh * fh;
454 const char * name;
455 unsigned int len;
456 struct iattr * sattr;
457};
458
1da177e4
LT
459struct 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;
9ff71c3a 465 struct nfs4_sequence_args seq_args;
1da177e4
LT
466};
467
23ec6965
BF
468struct nfs_setaclargs {
469 struct nfs_fh * fh;
470 size_t acl_len;
471 unsigned int acl_pgbase;
472 struct page ** acl_pages;
9ff71c3a 473 struct nfs4_sequence_args seq_args;
23ec6965
BF
474};
475
73c403a9
BH
476struct nfs_setaclres {
477 struct nfs4_sequence_res seq_res;
478};
479
029d105e
BF
480struct nfs_getaclargs {
481 struct nfs_fh * fh;
482 size_t acl_len;
483 unsigned int acl_pgbase;
484 struct page ** acl_pages;
9ff71c3a 485 struct nfs4_sequence_args seq_args;
029d105e
BF
486};
487
663c79b3
BH
488struct nfs_getaclres {
489 size_t acl_len;
490 struct nfs4_sequence_res seq_res;
491};
492
1da177e4
LT
493struct nfs_setattrres {
494 struct nfs_fattr * fattr;
495 const struct nfs_server * server;
9ff71c3a 496 struct nfs4_sequence_res seq_res;
1da177e4
LT
497};
498
499struct nfs_linkargs {
500 struct nfs_fh * fromfh;
501 struct nfs_fh * tofh;
502 const char * toname;
503 unsigned int tolen;
504};
505
506struct nfs_symlinkargs {
507 struct nfs_fh * fromfh;
508 const char * fromname;
509 unsigned int fromlen;
94a6d753
CL
510 struct page ** pages;
511 unsigned int pathlen;
1da177e4
LT
512 struct iattr * sattr;
513};
514
515struct nfs_readdirargs {
516 struct nfs_fh * fh;
517 __u32 cookie;
518 unsigned int count;
519 struct page ** pages;
520};
521
b7fa0554
AG
522struct nfs3_getaclargs {
523 struct nfs_fh * fh;
524 int mask;
525 struct page ** pages;
526};
527
528struct nfs3_setaclargs {
529 struct inode * inode;
530 int mask;
531 struct posix_acl * acl_access;
532 struct posix_acl * acl_default;
ae46141f
TM
533 size_t len;
534 unsigned int npages;
b7fa0554
AG
535 struct page ** pages;
536};
537
1da177e4
LT
538struct nfs_diropok {
539 struct nfs_fh * fh;
540 struct nfs_fattr * fattr;
541};
542
543struct nfs_readlinkargs {
544 struct nfs_fh * fh;
545 unsigned int pgbase;
546 unsigned int pglen;
547 struct page ** pages;
548};
549
550struct nfs3_sattrargs {
551 struct nfs_fh * fh;
552 struct iattr * sattr;
553 unsigned int guard;
554 struct timespec guardtime;
555};
556
557struct nfs3_diropargs {
558 struct nfs_fh * fh;
559 const char * name;
560 unsigned int len;
561};
562
563struct nfs3_accessargs {
564 struct nfs_fh * fh;
565 __u32 access;
566};
567
568struct nfs3_createargs {
569 struct nfs_fh * fh;
570 const char * name;
571 unsigned int len;
572 struct iattr * sattr;
573 enum nfs3_createmode createmode;
bc4785cd 574 __be32 verifier[2];
1da177e4
LT
575};
576
577struct nfs3_mkdirargs {
578 struct nfs_fh * fh;
579 const char * name;
580 unsigned int len;
581 struct iattr * sattr;
582};
583
584struct nfs3_symlinkargs {
585 struct nfs_fh * fromfh;
586 const char * fromname;
587 unsigned int fromlen;
94a6d753
CL
588 struct page ** pages;
589 unsigned int pathlen;
1da177e4
LT
590 struct iattr * sattr;
591};
592
593struct 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;
600};
601
1da177e4
LT
602struct nfs3_linkargs {
603 struct nfs_fh * fromfh;
604 struct nfs_fh * tofh;
605 const char * toname;
606 unsigned int tolen;
607};
608
609struct nfs3_readdirargs {
610 struct nfs_fh * fh;
611 __u64 cookie;
bc4785cd 612 __be32 verf[2];
1da177e4
LT
613 int plus;
614 unsigned int count;
615 struct page ** pages;
616};
617
618struct nfs3_diropres {
619 struct nfs_fattr * dir_attr;
620 struct nfs_fh * fh;
621 struct nfs_fattr * fattr;
622};
623
624struct nfs3_accessres {
625 struct nfs_fattr * fattr;
626 __u32 access;
627};
628
629struct nfs3_readlinkargs {
630 struct nfs_fh * fh;
631 unsigned int pgbase;
632 unsigned int pglen;
633 struct page ** pages;
634};
635
1da177e4
LT
636struct nfs3_linkres {
637 struct nfs_fattr * dir_attr;
638 struct nfs_fattr * fattr;
639};
640
641struct nfs3_readdirres {
642 struct nfs_fattr * dir_attr;
bc4785cd 643 __be32 * verf;
1da177e4
LT
644 int plus;
645};
646
b7fa0554
AG
647struct 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;
654};
655
1da177e4
LT
656#ifdef CONFIG_NFS_V4
657
658typedef u64 clientid4;
659
660struct nfs4_accessargs {
661 const struct nfs_fh * fh;
76b32999 662 const u32 * bitmask;
1da177e4 663 u32 access;
9ff71c3a 664 struct nfs4_sequence_args seq_args;
1da177e4
LT
665};
666
667struct nfs4_accessres {
76b32999
TM
668 const struct nfs_server * server;
669 struct nfs_fattr * fattr;
1da177e4
LT
670 u32 supported;
671 u32 access;
9ff71c3a 672 struct nfs4_sequence_res seq_res;
1da177e4
LT
673};
674
675struct nfs4_create_arg {
676 u32 ftype;
677 union {
94a6d753
CL
678 struct {
679 struct page ** pages;
680 unsigned int len;
681 } symlink; /* NF4LNK */
1da177e4
LT
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;
9ff71c3a 692 struct nfs4_sequence_args seq_args;
1da177e4
LT
693};
694
695struct 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;
56ae19f3 700 struct nfs_fattr * dir_fattr;
9ff71c3a 701 struct nfs4_sequence_res seq_res;
1da177e4
LT
702};
703
704struct nfs4_fsinfo_arg {
705 const struct nfs_fh * fh;
706 const u32 * bitmask;
9ff71c3a 707 struct nfs4_sequence_args seq_args;
1da177e4
LT
708};
709
3dda5e43
BH
710struct nfs4_fsinfo_res {
711 struct nfs_fsinfo *fsinfo;
712 struct nfs4_sequence_res seq_res;
713};
714
1da177e4
LT
715struct nfs4_getattr_arg {
716 const struct nfs_fh * fh;
717 const u32 * bitmask;
9ff71c3a 718 struct nfs4_sequence_args seq_args;
1da177e4
LT
719};
720
721struct nfs4_getattr_res {
722 const struct nfs_server * server;
723 struct nfs_fattr * fattr;
9ff71c3a 724 struct nfs4_sequence_res seq_res;
1da177e4
LT
725};
726
727struct nfs4_link_arg {
728 const struct nfs_fh * fh;
729 const struct nfs_fh * dir_fh;
730 const struct qstr * name;
91ba2eee 731 const u32 * bitmask;
9ff71c3a 732 struct nfs4_sequence_args seq_args;
91ba2eee
TM
733};
734
735struct 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;
9ff71c3a 740 struct nfs4_sequence_res seq_res;
1da177e4
LT
741};
742
91ba2eee 743
1da177e4
LT
744struct nfs4_lookup_arg {
745 const struct nfs_fh * dir_fh;
746 const struct qstr * name;
747 const u32 * bitmask;
9ff71c3a 748 struct nfs4_sequence_args seq_args;
1da177e4
LT
749};
750
751struct nfs4_lookup_res {
752 const struct nfs_server * server;
753 struct nfs_fattr * fattr;
754 struct nfs_fh * fh;
9ff71c3a 755 struct nfs4_sequence_res seq_res;
1da177e4
LT
756};
757
758struct nfs4_lookup_root_arg {
759 const u32 * bitmask;
9ff71c3a 760 struct nfs4_sequence_args seq_args;
1da177e4
LT
761};
762
763struct nfs4_pathconf_arg {
764 const struct nfs_fh * fh;
765 const u32 * bitmask;
9ff71c3a 766 struct nfs4_sequence_args seq_args;
1da177e4
LT
767};
768
d45b2989
BH
769struct nfs4_pathconf_res {
770 struct nfs_pathconf *pathconf;
771 struct nfs4_sequence_res seq_res;
772};
773
1da177e4
LT
774struct 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;
82f2e547 782 int plus;
9ff71c3a 783 struct nfs4_sequence_args seq_args;
1da177e4
LT
784};
785
786struct nfs4_readdir_res {
787 nfs4_verifier verifier;
788 unsigned int pgbase;
9ff71c3a 789 struct nfs4_sequence_res seq_res;
1da177e4
LT
790};
791
792struct 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 */
9ff71c3a 797 struct nfs4_sequence_args seq_args;
1da177e4
LT
798};
799
f50c7000
BH
800struct nfs4_readlink_res {
801 struct nfs4_sequence_res seq_res;
802};
803
19d771f3 804#define NFS4_SETCLIENTID_NAMELEN (127)
1da177e4 805struct nfs4_setclientid {
cc38bac3 806 const nfs4_verifier * sc_verifier;
1da177e4 807 unsigned int sc_name_len;
d1ce02e1 808 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
cc38bac3 809 u32 sc_prog;
1da177e4 810 unsigned int sc_netid_len;
d1ce02e1 811 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
1da177e4 812 unsigned int sc_uaddr_len;
d1ce02e1 813 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
cc38bac3 814 u32 sc_cb_ident;
1da177e4
LT
815};
816
bb8b27e5
TM
817struct nfs4_setclientid_res {
818 u64 clientid;
819 nfs4_verifier confirm;
820};
821
1da177e4
LT
822struct nfs4_statfs_arg {
823 const struct nfs_fh * fh;
824 const u32 * bitmask;
9ff71c3a 825 struct nfs4_sequence_args seq_args;
1da177e4
LT
826};
827
24ad148a
BH
828struct nfs4_statfs_res {
829 struct nfs_fsstat *fsstat;
830 struct nfs4_sequence_res seq_res;
831};
832
43652ad5
BH
833struct nfs4_server_caps_arg {
834 struct nfs_fh *fhandle;
835 struct nfs4_sequence_args seq_args;
836};
837
1da177e4
LT
838struct nfs4_server_caps_res {
839 u32 attr_bitmask[2];
840 u32 acl_bitmask;
841 u32 has_links;
842 u32 has_symlinks;
9ff71c3a 843 struct nfs4_sequence_res seq_res;
1da177e4
LT
844};
845
7aaa0b3b
MN
846struct nfs4_string {
847 unsigned int len;
848 char *data;
683b57b4
TM
849};
850
7aaa0b3b
MN
851#define NFS4_PATHNAME_MAXCOMPONENTS 512
852struct nfs4_pathname {
853 unsigned int ncomponents;
854 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
855};
856
857#define NFS4_FS_LOCATION_MAXSERVERS 10
858struct nfs4_fs_location {
859 unsigned int nservers;
860 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
861 struct nfs4_pathname rootpath;
862};
863
864#define NFS4_FS_LOCATIONS_MAXENTRIES 10
865struct nfs4_fs_locations {
683b57b4
TM
866 struct nfs_fattr fattr;
867 const struct nfs_server *server;
7aaa0b3b 868 struct nfs4_pathname fs_path;
683b57b4 869 int nlocations;
7aaa0b3b 870 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
683b57b4
TM
871};
872
873struct nfs4_fs_locations_arg {
874 const struct nfs_fh *dir_fh;
875 const struct qstr *name;
876 struct page *page;
877 const u32 *bitmask;
9ff71c3a 878 struct nfs4_sequence_args seq_args;
683b57b4
TM
879};
880
22958463
BH
881struct nfs4_fs_locations_res {
882 struct nfs4_fs_locations *fs_locations;
883 struct nfs4_sequence_res seq_res;
884};
885
1da177e4
LT
886#endif /* CONFIG_NFS_V4 */
887
99fe60d0
BH
888struct nfstime4 {
889 u64 seconds;
890 u32 nseconds;
891};
892
893#ifdef CONFIG_NFS_V4_1
894struct nfs_impl_id4 {
895 u32 domain_len;
896 char *domain;
897 u32 name_len;
898 char *name;
899 struct nfstime4 date;
900};
901
902#define NFS4_EXCHANGE_ID_LEN (48)
903struct 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;
909};
910
911struct server_owner {
912 uint64_t minor_id;
913 uint32_t major_id_sz;
914 char major_id[NFS4_OPAQUE_LIMIT];
915};
916
917struct server_scope {
918 uint32_t server_scope_sz;
919 char server_scope[NFS4_OPAQUE_LIMIT];
920};
921
922struct nfs41_exchange_id_res {
923 struct nfs_client *client;
924 u32 flags;
925};
fc931582
AA
926
927struct 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 */
933};
934
935struct nfs41_create_session_res {
936 struct nfs_client *client;
937};
18019753
RL
938
939struct 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;
943};
944
945struct nfs41_reclaim_complete_res {
946 struct nfs4_sequence_res seq_res;
947};
99fe60d0
BH
948#endif /* CONFIG_NFS_V4_1 */
949
1da177e4
LT
950struct nfs_page;
951
40859d7e
CL
952#define NFS_PAGEVEC_SIZE (8U)
953
1da177e4
LT
954struct 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 */
40859d7e 962 struct page **pagevec;
e9f7bee1 963 unsigned int npages; /* Max length of pagevec */
1da177e4
LT
964 struct nfs_readargs args;
965 struct nfs_readres res;
966#ifdef CONFIG_NFS_V4
967 unsigned long timestamp; /* For lease renewal */
968#endif
0d0b5cb3 969 struct page *page_array[NFS_PAGEVEC_SIZE];
1da177e4
LT
970};
971
972struct 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 */
40859d7e 981 struct page **pagevec;
e9f7bee1 982 unsigned int npages; /* Max length of pagevec */
1da177e4
LT
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
0d0b5cb3 988 struct page *page_array[NFS_PAGEVEC_SIZE];
1da177e4
LT
989};
990
991struct nfs_access_entry;
992
993/*
994 * RPC procedure vector for NFSv2/NFSv3 demuxing
995 */
996struct nfs_rpc_ops {
c0e07cb6 997 u32 version; /* Protocol version */
f786aa90 998 const struct dentry_operations *dentry_ops;
c5ef1c42
AV
999 const struct inode_operations *dir_inode_ops;
1000 const struct inode_operations *file_inode_ops;
1da177e4
LT
1001
1002 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1003 struct nfs_fsinfo *);
2b3de441
DH
1004 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
1005 struct qstr *, struct nfs_fh *,
1006 struct nfs_fattr *);
1da177e4
LT
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);
1da177e4 1016 int (*create) (struct inode *, struct dentry *,
c0204fd2 1017 struct iattr *, int, struct nfs_open_context *);
1da177e4 1018 int (*remove) (struct inode *, struct qstr *);
e4eff1a6
TM
1019 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1020 int (*unlink_done) (struct rpc_task *, struct inode *);
1da177e4
LT
1021 int (*rename) (struct inode *, struct qstr *,
1022 struct inode *, struct qstr *);
d3d4152a
JL
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);
1da177e4 1025 int (*link) (struct inode *, struct inode *, struct qstr *);
94a6d753
CL
1026 int (*symlink) (struct inode *, struct dentry *, struct page *,
1027 unsigned int, struct iattr *);
1da177e4
LT
1028 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1029 int (*rmdir) (struct inode *, struct qstr *);
1030 int (*readdir) (struct dentry *, struct rpc_cred *,
56e4ebf8 1031 u64, struct page **, unsigned int, int);
1da177e4
LT
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 *);
e9326dca 1040 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
82f2e547 1041 __be32 *(*decode_dirent)(struct xdr_stream *, struct nfs_entry *, struct nfs_server *, int plus);
bdc7f021 1042 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
ec06c096 1043 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
bdc7f021 1044 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
788e7a89 1045 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
bdc7f021 1046 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
788e7a89 1047 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
1da177e4 1048 int (*lock)(struct file *, int, struct file_lock *);
2116271a 1049 int (*lock_check_bounds)(const struct file_lock *);
ada70d94 1050 void (*clear_acl_cache)(struct inode *);
7fe5c398 1051 void (*close_context)(struct nfs_open_context *ctx, int);
2b484297
TM
1052 struct inode * (*open_context) (struct inode *dir,
1053 struct nfs_open_context *ctx,
1054 int open_flags,
1055 struct iattr *iattr);
1da177e4
LT
1056};
1057
1058/*
1059 * NFS_CALL(getattr, inode, (fattr));
1060 * into
1061 * NFS_PROTO(inode)->getattr(fattr);
1062 */
1063#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1064
1065/*
1066 * Function vectors etc. for the NFS client
1067 */
509de811
DH
1068extern const struct nfs_rpc_ops nfs_v2_clientops;
1069extern const struct nfs_rpc_ops nfs_v3_clientops;
1070extern const struct nfs_rpc_ops nfs_v4_clientops;
1da177e4
LT
1071extern struct rpc_version nfs_version2;
1072extern struct rpc_version nfs_version3;
1073extern struct rpc_version nfs_version4;
1074
b7fa0554
AG
1075extern struct rpc_version nfsacl_version3;
1076extern struct rpc_program nfsacl_program;
1077
1da177e4 1078#endif
This page took 0.770725 seconds and 5 git commands to generate.