Merge branch 'wireless-next-2.6' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.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>
5a5ea0d4 6#include <linux/sunrpc/gss_api.h>
1da177e4 7
40859d7e
CL
8/*
9 * To change the maximum rsize and wsize supported by the NFS client, adjust
10 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
11 * support a megabyte or more. The default is left at 4096 bytes, which is
12 * reasonable for NFS over UDP.
13 */
14#define NFS_MAX_FILE_IO_SIZE (1048576U)
15#define NFS_DEF_FILE_IO_SIZE (4096U)
16#define NFS_MIN_FILE_IO_SIZE (1024U)
17
5a5ea0d4
BS
18/* Forward declaration for NFS v3 */
19struct nfs4_secinfo_flavors;
20
8b4bdcf8
TM
21struct nfs_fsid {
22 uint64_t major;
23 uint64_t minor;
1da177e4
LT
24};
25
8b4bdcf8
TM
26/*
27 * Helper for checking equality between 2 fsids.
28 */
29static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
30{
31 return a->major == b->major && a->minor == b->minor;
32}
33
1da177e4 34struct nfs_fattr {
9e6e70f8 35 unsigned int valid; /* which fields are valid */
bca79478 36 umode_t mode;
1da177e4
LT
37 __u32 nlink;
38 __u32 uid;
39 __u32 gid;
9fa8d66f 40 dev_t rdev;
1da177e4
LT
41 __u64 size;
42 union {
43 struct {
44 __u32 blocksize;
45 __u32 blocks;
46 } nfs2;
47 struct {
48 __u64 used;
49 } nfs3;
50 } du;
8b4bdcf8 51 struct nfs_fsid fsid;
1da177e4
LT
52 __u64 fileid;
53 struct timespec atime;
54 struct timespec mtime;
55 struct timespec ctime;
1da177e4
LT
56 __u64 change_attr; /* NFSv4 change attribute */
57 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
1ca277d8
TM
58 __u64 pre_size; /* pre_op_attr.size */
59 struct timespec pre_mtime; /* pre_op_attr.mtime */
60 struct timespec pre_ctime; /* pre_op_attr.ctime */
33801147 61 unsigned long time_start;
4704f0e2 62 unsigned long gencount;
1da177e4
LT
63};
64
9e6e70f8
TM
65#define NFS_ATTR_FATTR_TYPE (1U << 0)
66#define NFS_ATTR_FATTR_MODE (1U << 1)
67#define NFS_ATTR_FATTR_NLINK (1U << 2)
68#define NFS_ATTR_FATTR_OWNER (1U << 3)
69#define NFS_ATTR_FATTR_GROUP (1U << 4)
70#define NFS_ATTR_FATTR_RDEV (1U << 5)
71#define NFS_ATTR_FATTR_SIZE (1U << 6)
72#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
73#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
74#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
75#define NFS_ATTR_FATTR_FSID (1U << 10)
76#define NFS_ATTR_FATTR_FILEID (1U << 11)
77#define NFS_ATTR_FATTR_ATIME (1U << 12)
78#define NFS_ATTR_FATTR_MTIME (1U << 13)
79#define NFS_ATTR_FATTR_CTIME (1U << 14)
80#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
81#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
82#define NFS_ATTR_FATTR_CHANGE (1U << 17)
83#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
84#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
7ebb9315 85#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
9e6e70f8
TM
86
87#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
88 | NFS_ATTR_FATTR_MODE \
89 | NFS_ATTR_FATTR_NLINK \
90 | NFS_ATTR_FATTR_OWNER \
91 | NFS_ATTR_FATTR_GROUP \
92 | NFS_ATTR_FATTR_RDEV \
93 | NFS_ATTR_FATTR_SIZE \
94 | NFS_ATTR_FATTR_FSID \
95 | NFS_ATTR_FATTR_FILEID \
96 | NFS_ATTR_FATTR_ATIME \
97 | NFS_ATTR_FATTR_MTIME \
98 | NFS_ATTR_FATTR_CTIME)
99#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
100 | NFS_ATTR_FATTR_BLOCKS_USED)
101#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
102 | NFS_ATTR_FATTR_SPACE_USED)
103#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
104 | NFS_ATTR_FATTR_SPACE_USED \
105 | NFS_ATTR_FATTR_CHANGE)
1da177e4
LT
106
107/*
108 * Info on the file system
109 */
110struct nfs_fsinfo {
111 struct nfs_fattr *fattr; /* Post-op attributes */
112 __u32 rtmax; /* max. read transfer size */
113 __u32 rtpref; /* pref. read transfer size */
114 __u32 rtmult; /* reads should be multiple of this */
115 __u32 wtmax; /* max. write transfer size */
116 __u32 wtpref; /* pref. write transfer size */
117 __u32 wtmult; /* writes should be multiple of this */
118 __u32 dtpref; /* pref. readdir transfer size */
119 __u64 maxfilesize;
6b96724e 120 struct timespec time_delta; /* server time granularity */
1da177e4 121 __u32 lease_time; /* in seconds */
504913fb 122 __u32 layouttype; /* supported pnfs layout driver */
1da177e4
LT
123};
124
125struct nfs_fsstat {
126 struct nfs_fattr *fattr; /* Post-op attributes */
127 __u64 tbytes; /* total size in bytes */
128 __u64 fbytes; /* # of free bytes */
129 __u64 abytes; /* # of bytes available to user */
130 __u64 tfiles; /* # of files */
131 __u64 ffiles; /* # of free files */
132 __u64 afiles; /* # of files available to user */
133};
134
135struct nfs2_fsstat {
136 __u32 tsize; /* Server transfer size */
137 __u32 bsize; /* Filesystem block size */
138 __u32 blocks; /* No. of "bsize" blocks on filesystem */
139 __u32 bfree; /* No. of free "bsize" blocks */
140 __u32 bavail; /* No. of available "bsize" blocks */
141};
142
143struct nfs_pathconf {
144 struct nfs_fattr *fattr; /* Post-op attributes */
145 __u32 max_link; /* max # of hard links */
146 __u32 max_namelen; /* max name length */
147};
148
149struct nfs4_change_info {
150 u32 atomic;
151 u64 before;
152 u64 after;
153};
154
cee54fc9 155struct nfs_seqid;
9ff71c3a 156
557134a3
AA
157/* nfs41 sessions channel attributes */
158struct nfs4_channel_attrs {
159 u32 headerpadsz;
160 u32 max_rqst_sz;
161 u32 max_resp_sz;
162 u32 max_resp_sz_cached;
163 u32 max_ops;
164 u32 max_reqs;
165};
166
167/* nfs41 sessions slot seqid */
168struct nfs4_slot {
169 u32 seq_nr;
170};
171
9ff71c3a 172struct nfs4_sequence_args {
f3752975 173 struct nfs4_session *sa_session;
fbcd4abc
AA
174 u8 sa_slotid;
175 u8 sa_cache_this;
9ff71c3a
BH
176};
177
178struct nfs4_sequence_res {
f3752975 179 struct nfs4_session *sr_session;
dfb4f309 180 struct nfs4_slot *sr_slot; /* slot used to send request */
fbcd4abc 181 int sr_status; /* sequence operation status */
a01878aa 182 unsigned long sr_renewal_time;
0629e370 183 u32 sr_status_flags;
9ff71c3a
BH
184};
185
2050f0cc
AA
186struct nfs4_get_lease_time_args {
187 struct nfs4_sequence_args la_seq_args;
188};
189
190struct nfs4_get_lease_time_res {
191 struct nfs_fsinfo *lr_fsinfo;
192 struct nfs4_sequence_res lr_seq_res;
193};
194
b1f69b75
AA
195#define PNFS_LAYOUT_MAXSIZE 4096
196
197struct nfs4_layoutdriver_data {
35124a09
WAA
198 struct page **pages;
199 __u32 pglen;
b1f69b75 200 __u32 len;
b1f69b75
AA
201};
202
203struct pnfs_layout_range {
204 u32 iomode;
205 u64 offset;
206 u64 length;
207};
208
209struct nfs4_layoutget_args {
210 __u32 type;
211 struct pnfs_layout_range range;
212 __u64 minlength;
213 __u32 maxcount;
214 struct inode *inode;
215 struct nfs_open_context *ctx;
216 struct nfs4_sequence_args seq_args;
cf7d63f1 217 nfs4_stateid stateid;
35124a09 218 struct nfs4_layoutdriver_data layout;
b1f69b75
AA
219};
220
221struct nfs4_layoutget_res {
222 __u32 return_on_close;
223 struct pnfs_layout_range range;
224 __u32 type;
225 nfs4_stateid stateid;
b1f69b75 226 struct nfs4_sequence_res seq_res;
35124a09 227 struct nfs4_layoutdriver_data *layoutp;
b1f69b75
AA
228};
229
230struct nfs4_layoutget {
231 struct nfs4_layoutget_args args;
232 struct nfs4_layoutget_res res;
233 struct pnfs_layout_segment **lsegpp;
b1f69b75
AA
234};
235
236struct nfs4_getdeviceinfo_args {
237 struct pnfs_device *pdev;
238 struct nfs4_sequence_args seq_args;
239};
240
241struct nfs4_getdeviceinfo_res {
242 struct pnfs_device *pdev;
243 struct nfs4_sequence_res seq_res;
244};
245
863a3c6c
AA
246struct nfs4_layoutcommit_args {
247 nfs4_stateid stateid;
248 __u64 lastbytewritten;
249 struct inode *inode;
250 const u32 *bitmask;
251 struct nfs4_sequence_args seq_args;
252};
253
254struct nfs4_layoutcommit_res {
255 struct nfs_fattr *fattr;
256 const struct nfs_server *server;
257 struct nfs4_sequence_res seq_res;
258};
259
260struct nfs4_layoutcommit_data {
261 struct rpc_task task;
262 struct nfs_fattr fattr;
263 struct pnfs_layout_segment *lseg;
264 struct rpc_cred *cred;
265 struct nfs4_layoutcommit_args args;
266 struct nfs4_layoutcommit_res res;
267};
268
1da177e4
LT
269/*
270 * Arguments to the open call.
271 */
272struct nfs_openargs {
273 const struct nfs_fh * fh;
cee54fc9 274 struct nfs_seqid * seqid;
1da177e4 275 int open_flags;
dc0b027d 276 fmode_t fmode;
1da177e4 277 __u64 clientid;
9f958ab8 278 __u64 id;
1da177e4 279 union {
d77d76ff
TM
280 struct {
281 struct iattr * attrs; /* UNCHECKED, GUARDED */
282 nfs4_verifier verifier; /* EXCLUSIVE */
283 };
1da177e4 284 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
bd7bf9d5 285 fmode_t delegation_type; /* CLAIM_PREVIOUS */
1da177e4
LT
286 } u;
287 const struct qstr * name;
288 const struct nfs_server *server; /* Needed for ID mapping */
289 const u32 * bitmask;
290 __u32 claim;
9ff71c3a 291 struct nfs4_sequence_args seq_args;
1da177e4
LT
292};
293
294struct nfs_openres {
295 nfs4_stateid stateid;
296 struct nfs_fh fh;
297 struct nfs4_change_info cinfo;
298 __u32 rflags;
299 struct nfs_fattr * f_attr;
56ae19f3 300 struct nfs_fattr * dir_attr;
c1d51931 301 struct nfs_seqid * seqid;
1da177e4 302 const struct nfs_server *server;
bd7bf9d5 303 fmode_t delegation_type;
1da177e4
LT
304 nfs4_stateid delegation;
305 __u32 do_recall;
306 __u64 maxsize;
aa53ed54 307 __u32 attrset[NFS4_BITMAP_SIZE];
9ff71c3a 308 struct nfs4_sequence_res seq_res;
1da177e4
LT
309};
310
311/*
312 * Arguments to the open_confirm call.
313 */
314struct nfs_open_confirmargs {
315 const struct nfs_fh * fh;
cdd4e68b 316 nfs4_stateid * stateid;
cee54fc9 317 struct nfs_seqid * seqid;
1da177e4
LT
318};
319
320struct nfs_open_confirmres {
321 nfs4_stateid stateid;
c1d51931 322 struct nfs_seqid * seqid;
1da177e4
LT
323};
324
325/*
326 * Arguments to the close call.
327 */
328struct nfs_closeargs {
329 struct nfs_fh * fh;
9512135d 330 nfs4_stateid * stateid;
cee54fc9 331 struct nfs_seqid * seqid;
dc0b027d 332 fmode_t fmode;
516a6af6 333 const u32 * bitmask;
9ff71c3a 334 struct nfs4_sequence_args seq_args;
1da177e4
LT
335};
336
337struct nfs_closeres {
338 nfs4_stateid stateid;
516a6af6 339 struct nfs_fattr * fattr;
c1d51931 340 struct nfs_seqid * seqid;
516a6af6 341 const struct nfs_server *server;
9ff71c3a 342 struct nfs4_sequence_res seq_res;
1da177e4
LT
343};
344/*
345 * * Arguments to the lock,lockt, and locku call.
346 * */
347struct nfs_lowner {
911d1aaf 348 __u64 clientid;
9f958ab8 349 __u64 id;
d035c36c 350 dev_t s_dev;
1da177e4
LT
351};
352
911d1aaf
TM
353struct nfs_lock_args {
354 struct nfs_fh * fh;
355 struct file_lock * fl;
cee54fc9 356 struct nfs_seqid * lock_seqid;
06735b34
TM
357 nfs4_stateid * lock_stateid;
358 struct nfs_seqid * open_seqid;
359 nfs4_stateid * open_stateid;
911d1aaf
TM
360 struct nfs_lowner lock_owner;
361 unsigned char block : 1;
362 unsigned char reclaim : 1;
363 unsigned char new_lock_owner : 1;
9ff71c3a 364 struct nfs4_sequence_args seq_args;
911d1aaf
TM
365};
366
367struct nfs_lock_res {
c1d51931
TM
368 nfs4_stateid stateid;
369 struct nfs_seqid * lock_seqid;
370 struct nfs_seqid * open_seqid;
9ff71c3a 371 struct nfs4_sequence_res seq_res;
1da177e4
LT
372};
373
911d1aaf
TM
374struct nfs_locku_args {
375 struct nfs_fh * fh;
376 struct file_lock * fl;
cee54fc9 377 struct nfs_seqid * seqid;
faf5f49c 378 nfs4_stateid * stateid;
9ff71c3a 379 struct nfs4_sequence_args seq_args;
1da177e4
LT
380};
381
911d1aaf 382struct nfs_locku_res {
c1d51931
TM
383 nfs4_stateid stateid;
384 struct nfs_seqid * seqid;
9ff71c3a 385 struct nfs4_sequence_res seq_res;
1da177e4
LT
386};
387
911d1aaf
TM
388struct nfs_lockt_args {
389 struct nfs_fh * fh;
390 struct file_lock * fl;
391 struct nfs_lowner lock_owner;
9ff71c3a 392 struct nfs4_sequence_args seq_args;
1da177e4
LT
393};
394
911d1aaf
TM
395struct nfs_lockt_res {
396 struct file_lock * denied; /* LOCK, LOCKT failed */
9ff71c3a 397 struct nfs4_sequence_res seq_res;
1da177e4
LT
398};
399
d3c7b7cc
TM
400struct nfs_release_lockowner_args {
401 struct nfs_lowner lock_owner;
402};
403
1da177e4
LT
404struct nfs4_delegreturnargs {
405 const struct nfs_fh *fhandle;
406 const nfs4_stateid *stateid;
fa178f29 407 const u32 * bitmask;
9ff71c3a 408 struct nfs4_sequence_args seq_args;
fa178f29
TM
409};
410
411struct nfs4_delegreturnres {
412 struct nfs_fattr * fattr;
413 const struct nfs_server *server;
9ff71c3a 414 struct nfs4_sequence_res seq_res;
1da177e4
LT
415};
416
417/*
418 * Arguments to the read call.
419 */
1da177e4
LT
420struct nfs_readargs {
421 struct nfs_fh * fh;
422 struct nfs_open_context *context;
f11ac8db 423 struct nfs_lock_context *lock_context;
1da177e4
LT
424 __u64 offset;
425 __u32 count;
426 unsigned int pgbase;
427 struct page ** pages;
9ff71c3a 428 struct nfs4_sequence_args seq_args;
1da177e4
LT
429};
430
431struct nfs_readres {
432 struct nfs_fattr * fattr;
433 __u32 count;
434 int eof;
9ff71c3a 435 struct nfs4_sequence_res seq_res;
1da177e4
LT
436};
437
438/*
439 * Arguments to the write call.
440 */
1da177e4
LT
441struct nfs_writeargs {
442 struct nfs_fh * fh;
443 struct nfs_open_context *context;
f11ac8db 444 struct nfs_lock_context *lock_context;
1da177e4
LT
445 __u64 offset;
446 __u32 count;
447 enum nfs3_stable_how stable;
448 unsigned int pgbase;
449 struct page ** pages;
4f9838c7 450 const u32 * bitmask;
9ff71c3a 451 struct nfs4_sequence_args seq_args;
1da177e4
LT
452};
453
454struct nfs_writeverf {
455 enum nfs3_stable_how committed;
bc4785cd 456 __be32 verifier[2];
1da177e4
LT
457};
458
459struct nfs_writeres {
460 struct nfs_fattr * fattr;
461 struct nfs_writeverf * verf;
462 __u32 count;
4f9838c7 463 const struct nfs_server *server;
9ff71c3a 464 struct nfs4_sequence_res seq_res;
1da177e4
LT
465};
466
4fdc17b2
TM
467/*
468 * Common arguments to the unlink call
469 */
470struct nfs_removeargs {
471 const struct nfs_fh *fh;
472 struct qstr name;
473 const u32 * bitmask;
9ff71c3a 474 struct nfs4_sequence_args seq_args;
4fdc17b2
TM
475};
476
477struct nfs_removeres {
478 const struct nfs_server *server;
d346890b 479 struct nfs_fattr *dir_attr;
4fdc17b2 480 struct nfs4_change_info cinfo;
9ff71c3a 481 struct nfs4_sequence_res seq_res;
4fdc17b2
TM
482};
483
920769f0
JL
484/*
485 * Common arguments to the rename call
486 */
487struct nfs_renameargs {
488 const struct nfs_fh *old_dir;
489 const struct nfs_fh *new_dir;
490 const struct qstr *old_name;
491 const struct qstr *new_name;
492 const u32 *bitmask;
493 struct nfs4_sequence_args seq_args;
494};
495
e8582a8b
JL
496struct nfs_renameres {
497 const struct nfs_server *server;
498 struct nfs4_change_info old_cinfo;
499 struct nfs_fattr *old_fattr;
500 struct nfs4_change_info new_cinfo;
501 struct nfs_fattr *new_fattr;
502 struct nfs4_sequence_res seq_res;
503};
504
1da177e4
LT
505/*
506 * Argument struct for decode_entry function
507 */
508struct nfs_entry {
509 __u64 ino;
510 __u64 cookie,
511 prev_cookie;
512 const char * name;
513 unsigned int len;
514 int eof;
515 struct nfs_fh * fh;
516 struct nfs_fattr * fattr;
0b26a0bf 517 unsigned char d_type;
573c4e1e 518 struct nfs_server * server;
1da177e4
LT
519};
520
521/*
522 * The following types are for NFSv2 only.
523 */
524struct nfs_sattrargs {
525 struct nfs_fh * fh;
526 struct iattr * sattr;
527};
528
529struct nfs_diropargs {
530 struct nfs_fh * fh;
531 const char * name;
532 unsigned int len;
533};
534
535struct nfs_createargs {
536 struct nfs_fh * fh;
537 const char * name;
538 unsigned int len;
539 struct iattr * sattr;
540};
541
1da177e4
LT
542struct nfs_setattrargs {
543 struct nfs_fh * fh;
544 nfs4_stateid stateid;
545 struct iattr * iap;
546 const struct nfs_server * server; /* Needed for name mapping */
547 const u32 * bitmask;
9ff71c3a 548 struct nfs4_sequence_args seq_args;
1da177e4
LT
549};
550
23ec6965
BF
551struct nfs_setaclargs {
552 struct nfs_fh * fh;
553 size_t acl_len;
554 unsigned int acl_pgbase;
555 struct page ** acl_pages;
9ff71c3a 556 struct nfs4_sequence_args seq_args;
23ec6965
BF
557};
558
73c403a9
BH
559struct nfs_setaclres {
560 struct nfs4_sequence_res seq_res;
561};
562
029d105e
BF
563struct nfs_getaclargs {
564 struct nfs_fh * fh;
565 size_t acl_len;
566 unsigned int acl_pgbase;
567 struct page ** acl_pages;
9ff71c3a 568 struct nfs4_sequence_args seq_args;
029d105e
BF
569};
570
663c79b3
BH
571struct nfs_getaclres {
572 size_t acl_len;
573 struct nfs4_sequence_res seq_res;
574};
575
1da177e4
LT
576struct nfs_setattrres {
577 struct nfs_fattr * fattr;
578 const struct nfs_server * server;
9ff71c3a 579 struct nfs4_sequence_res seq_res;
1da177e4
LT
580};
581
582struct nfs_linkargs {
583 struct nfs_fh * fromfh;
584 struct nfs_fh * tofh;
585 const char * toname;
586 unsigned int tolen;
587};
588
589struct nfs_symlinkargs {
590 struct nfs_fh * fromfh;
591 const char * fromname;
592 unsigned int fromlen;
94a6d753
CL
593 struct page ** pages;
594 unsigned int pathlen;
1da177e4
LT
595 struct iattr * sattr;
596};
597
598struct nfs_readdirargs {
599 struct nfs_fh * fh;
600 __u32 cookie;
601 unsigned int count;
602 struct page ** pages;
603};
604
b7fa0554
AG
605struct nfs3_getaclargs {
606 struct nfs_fh * fh;
607 int mask;
608 struct page ** pages;
609};
610
611struct nfs3_setaclargs {
612 struct inode * inode;
613 int mask;
614 struct posix_acl * acl_access;
615 struct posix_acl * acl_default;
ae46141f
TM
616 size_t len;
617 unsigned int npages;
b7fa0554
AG
618 struct page ** pages;
619};
620
1da177e4
LT
621struct nfs_diropok {
622 struct nfs_fh * fh;
623 struct nfs_fattr * fattr;
624};
625
626struct nfs_readlinkargs {
627 struct nfs_fh * fh;
628 unsigned int pgbase;
629 unsigned int pglen;
630 struct page ** pages;
631};
632
633struct nfs3_sattrargs {
634 struct nfs_fh * fh;
635 struct iattr * sattr;
636 unsigned int guard;
637 struct timespec guardtime;
638};
639
640struct nfs3_diropargs {
641 struct nfs_fh * fh;
642 const char * name;
643 unsigned int len;
644};
645
646struct nfs3_accessargs {
647 struct nfs_fh * fh;
648 __u32 access;
649};
650
651struct nfs3_createargs {
652 struct nfs_fh * fh;
653 const char * name;
654 unsigned int len;
655 struct iattr * sattr;
656 enum nfs3_createmode createmode;
bc4785cd 657 __be32 verifier[2];
1da177e4
LT
658};
659
660struct nfs3_mkdirargs {
661 struct nfs_fh * fh;
662 const char * name;
663 unsigned int len;
664 struct iattr * sattr;
665};
666
667struct nfs3_symlinkargs {
668 struct nfs_fh * fromfh;
669 const char * fromname;
670 unsigned int fromlen;
94a6d753
CL
671 struct page ** pages;
672 unsigned int pathlen;
1da177e4
LT
673 struct iattr * sattr;
674};
675
676struct nfs3_mknodargs {
677 struct nfs_fh * fh;
678 const char * name;
679 unsigned int len;
680 enum nfs3_ftype type;
681 struct iattr * sattr;
682 dev_t rdev;
683};
684
1da177e4
LT
685struct nfs3_linkargs {
686 struct nfs_fh * fromfh;
687 struct nfs_fh * tofh;
688 const char * toname;
689 unsigned int tolen;
690};
691
692struct nfs3_readdirargs {
693 struct nfs_fh * fh;
694 __u64 cookie;
bc4785cd 695 __be32 verf[2];
1da177e4
LT
696 int plus;
697 unsigned int count;
698 struct page ** pages;
699};
700
701struct nfs3_diropres {
702 struct nfs_fattr * dir_attr;
703 struct nfs_fh * fh;
704 struct nfs_fattr * fattr;
705};
706
707struct nfs3_accessres {
708 struct nfs_fattr * fattr;
709 __u32 access;
710};
711
712struct nfs3_readlinkargs {
713 struct nfs_fh * fh;
714 unsigned int pgbase;
715 unsigned int pglen;
716 struct page ** pages;
717};
718
1da177e4
LT
719struct nfs3_linkres {
720 struct nfs_fattr * dir_attr;
721 struct nfs_fattr * fattr;
722};
723
724struct nfs3_readdirres {
725 struct nfs_fattr * dir_attr;
bc4785cd 726 __be32 * verf;
1da177e4
LT
727 int plus;
728};
729
b7fa0554
AG
730struct nfs3_getaclres {
731 struct nfs_fattr * fattr;
732 int mask;
733 unsigned int acl_access_count;
734 unsigned int acl_default_count;
735 struct posix_acl * acl_access;
736 struct posix_acl * acl_default;
737};
738
1da177e4
LT
739#ifdef CONFIG_NFS_V4
740
741typedef u64 clientid4;
742
743struct nfs4_accessargs {
744 const struct nfs_fh * fh;
76b32999 745 const u32 * bitmask;
1da177e4 746 u32 access;
9ff71c3a 747 struct nfs4_sequence_args seq_args;
1da177e4
LT
748};
749
750struct nfs4_accessres {
76b32999
TM
751 const struct nfs_server * server;
752 struct nfs_fattr * fattr;
1da177e4
LT
753 u32 supported;
754 u32 access;
9ff71c3a 755 struct nfs4_sequence_res seq_res;
1da177e4
LT
756};
757
758struct nfs4_create_arg {
759 u32 ftype;
760 union {
94a6d753
CL
761 struct {
762 struct page ** pages;
763 unsigned int len;
764 } symlink; /* NF4LNK */
1da177e4
LT
765 struct {
766 u32 specdata1;
767 u32 specdata2;
768 } device; /* NF4BLK, NF4CHR */
769 } u;
770 const struct qstr * name;
771 const struct nfs_server * server;
772 const struct iattr * attrs;
773 const struct nfs_fh * dir_fh;
774 const u32 * bitmask;
9ff71c3a 775 struct nfs4_sequence_args seq_args;
1da177e4
LT
776};
777
778struct nfs4_create_res {
779 const struct nfs_server * server;
780 struct nfs_fh * fh;
781 struct nfs_fattr * fattr;
782 struct nfs4_change_info dir_cinfo;
56ae19f3 783 struct nfs_fattr * dir_fattr;
9ff71c3a 784 struct nfs4_sequence_res seq_res;
1da177e4
LT
785};
786
787struct nfs4_fsinfo_arg {
788 const struct nfs_fh * fh;
789 const u32 * bitmask;
9ff71c3a 790 struct nfs4_sequence_args seq_args;
1da177e4
LT
791};
792
3dda5e43
BH
793struct nfs4_fsinfo_res {
794 struct nfs_fsinfo *fsinfo;
795 struct nfs4_sequence_res seq_res;
796};
797
1da177e4
LT
798struct nfs4_getattr_arg {
799 const struct nfs_fh * fh;
800 const u32 * bitmask;
9ff71c3a 801 struct nfs4_sequence_args seq_args;
1da177e4
LT
802};
803
804struct nfs4_getattr_res {
805 const struct nfs_server * server;
806 struct nfs_fattr * fattr;
9ff71c3a 807 struct nfs4_sequence_res seq_res;
1da177e4
LT
808};
809
810struct nfs4_link_arg {
811 const struct nfs_fh * fh;
812 const struct nfs_fh * dir_fh;
813 const struct qstr * name;
91ba2eee 814 const u32 * bitmask;
9ff71c3a 815 struct nfs4_sequence_args seq_args;
91ba2eee
TM
816};
817
818struct nfs4_link_res {
819 const struct nfs_server * server;
820 struct nfs_fattr * fattr;
821 struct nfs4_change_info cinfo;
822 struct nfs_fattr * dir_attr;
9ff71c3a 823 struct nfs4_sequence_res seq_res;
1da177e4
LT
824};
825
91ba2eee 826
1da177e4
LT
827struct nfs4_lookup_arg {
828 const struct nfs_fh * dir_fh;
829 const struct qstr * name;
830 const u32 * bitmask;
9ff71c3a 831 struct nfs4_sequence_args seq_args;
1da177e4
LT
832};
833
834struct nfs4_lookup_res {
835 const struct nfs_server * server;
836 struct nfs_fattr * fattr;
837 struct nfs_fh * fh;
9ff71c3a 838 struct nfs4_sequence_res seq_res;
1da177e4
LT
839};
840
841struct nfs4_lookup_root_arg {
842 const u32 * bitmask;
9ff71c3a 843 struct nfs4_sequence_args seq_args;
1da177e4
LT
844};
845
846struct nfs4_pathconf_arg {
847 const struct nfs_fh * fh;
848 const u32 * bitmask;
9ff71c3a 849 struct nfs4_sequence_args seq_args;
1da177e4
LT
850};
851
d45b2989
BH
852struct nfs4_pathconf_res {
853 struct nfs_pathconf *pathconf;
854 struct nfs4_sequence_res seq_res;
855};
856
1da177e4
LT
857struct nfs4_readdir_arg {
858 const struct nfs_fh * fh;
859 u64 cookie;
860 nfs4_verifier verifier;
861 u32 count;
862 struct page ** pages; /* zero-copy data */
863 unsigned int pgbase; /* zero-copy data */
864 const u32 * bitmask;
82f2e547 865 int plus;
9ff71c3a 866 struct nfs4_sequence_args seq_args;
1da177e4
LT
867};
868
869struct nfs4_readdir_res {
870 nfs4_verifier verifier;
871 unsigned int pgbase;
9ff71c3a 872 struct nfs4_sequence_res seq_res;
1da177e4
LT
873};
874
875struct nfs4_readlink {
876 const struct nfs_fh * fh;
877 unsigned int pgbase;
878 unsigned int pglen; /* zero-copy data */
879 struct page ** pages; /* zero-copy data */
9ff71c3a 880 struct nfs4_sequence_args seq_args;
1da177e4
LT
881};
882
f50c7000
BH
883struct nfs4_readlink_res {
884 struct nfs4_sequence_res seq_res;
885};
886
19d771f3 887#define NFS4_SETCLIENTID_NAMELEN (127)
1da177e4 888struct nfs4_setclientid {
cc38bac3 889 const nfs4_verifier * sc_verifier;
1da177e4 890 unsigned int sc_name_len;
d1ce02e1 891 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
cc38bac3 892 u32 sc_prog;
1da177e4 893 unsigned int sc_netid_len;
d1ce02e1 894 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
1da177e4 895 unsigned int sc_uaddr_len;
d1ce02e1 896 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
cc38bac3 897 u32 sc_cb_ident;
1da177e4
LT
898};
899
bb8b27e5
TM
900struct nfs4_setclientid_res {
901 u64 clientid;
902 nfs4_verifier confirm;
903};
904
1da177e4
LT
905struct nfs4_statfs_arg {
906 const struct nfs_fh * fh;
907 const u32 * bitmask;
9ff71c3a 908 struct nfs4_sequence_args seq_args;
1da177e4
LT
909};
910
24ad148a
BH
911struct nfs4_statfs_res {
912 struct nfs_fsstat *fsstat;
913 struct nfs4_sequence_res seq_res;
914};
915
43652ad5
BH
916struct nfs4_server_caps_arg {
917 struct nfs_fh *fhandle;
918 struct nfs4_sequence_args seq_args;
919};
920
1da177e4
LT
921struct nfs4_server_caps_res {
922 u32 attr_bitmask[2];
923 u32 acl_bitmask;
924 u32 has_links;
925 u32 has_symlinks;
9ff71c3a 926 struct nfs4_sequence_res seq_res;
1da177e4
LT
927};
928
7aaa0b3b
MN
929struct nfs4_string {
930 unsigned int len;
931 char *data;
683b57b4
TM
932};
933
7aaa0b3b
MN
934#define NFS4_PATHNAME_MAXCOMPONENTS 512
935struct nfs4_pathname {
936 unsigned int ncomponents;
937 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
938};
939
940#define NFS4_FS_LOCATION_MAXSERVERS 10
941struct nfs4_fs_location {
942 unsigned int nservers;
943 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
944 struct nfs4_pathname rootpath;
945};
946
947#define NFS4_FS_LOCATIONS_MAXENTRIES 10
948struct nfs4_fs_locations {
683b57b4
TM
949 struct nfs_fattr fattr;
950 const struct nfs_server *server;
7aaa0b3b 951 struct nfs4_pathname fs_path;
683b57b4 952 int nlocations;
7aaa0b3b 953 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
683b57b4
TM
954};
955
956struct nfs4_fs_locations_arg {
957 const struct nfs_fh *dir_fh;
958 const struct qstr *name;
959 struct page *page;
960 const u32 *bitmask;
9ff71c3a 961 struct nfs4_sequence_args seq_args;
683b57b4
TM
962};
963
22958463
BH
964struct nfs4_fs_locations_res {
965 struct nfs4_fs_locations *fs_locations;
966 struct nfs4_sequence_res seq_res;
967};
968
5a5ea0d4
BS
969struct nfs4_secinfo_oid {
970 unsigned int len;
971 char data[GSS_OID_MAX_LEN];
972};
973
974struct nfs4_secinfo_gss {
975 struct nfs4_secinfo_oid sec_oid4;
976 unsigned int qop4;
977 unsigned int service;
978};
979
980struct nfs4_secinfo_flavor {
981 unsigned int flavor;
982 struct nfs4_secinfo_gss gss;
983};
984
985struct nfs4_secinfo_flavors {
986 unsigned int num_flavors;
987 struct nfs4_secinfo_flavor flavors[0];
988};
989
990struct nfs4_secinfo_arg {
991 const struct nfs_fh *dir_fh;
992 const struct qstr *name;
993 struct nfs4_sequence_args seq_args;
994};
995
996struct nfs4_secinfo_res {
997 struct nfs4_secinfo_flavors *flavors;
998 struct nfs4_sequence_res seq_res;
999};
1000
1da177e4
LT
1001#endif /* CONFIG_NFS_V4 */
1002
99fe60d0
BH
1003struct nfstime4 {
1004 u64 seconds;
1005 u32 nseconds;
1006};
1007
1008#ifdef CONFIG_NFS_V4_1
1009struct nfs_impl_id4 {
1010 u32 domain_len;
1011 char *domain;
1012 u32 name_len;
1013 char *name;
1014 struct nfstime4 date;
1015};
1016
1017#define NFS4_EXCHANGE_ID_LEN (48)
1018struct nfs41_exchange_id_args {
1019 struct nfs_client *client;
1020 nfs4_verifier *verifier;
1021 unsigned int id_len;
1022 char id[NFS4_EXCHANGE_ID_LEN];
1023 u32 flags;
1024};
1025
1026struct server_owner {
1027 uint64_t minor_id;
1028 uint32_t major_id_sz;
1029 char major_id[NFS4_OPAQUE_LIMIT];
1030};
1031
1032struct server_scope {
1033 uint32_t server_scope_sz;
1034 char server_scope[NFS4_OPAQUE_LIMIT];
1035};
1036
1037struct nfs41_exchange_id_res {
1038 struct nfs_client *client;
1039 u32 flags;
1040};
fc931582
AA
1041
1042struct nfs41_create_session_args {
1043 struct nfs_client *client;
1044 uint32_t flags;
1045 uint32_t cb_program;
1046 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1047 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1048};
1049
1050struct nfs41_create_session_res {
1051 struct nfs_client *client;
1052};
18019753
RL
1053
1054struct nfs41_reclaim_complete_args {
1055 /* In the future extend to include curr_fh for use with migration */
1056 unsigned char one_fs:1;
1057 struct nfs4_sequence_args seq_args;
1058};
1059
1060struct nfs41_reclaim_complete_res {
1061 struct nfs4_sequence_res seq_res;
1062};
99fe60d0
BH
1063#endif /* CONFIG_NFS_V4_1 */
1064
1da177e4
LT
1065struct nfs_page;
1066
40859d7e
CL
1067#define NFS_PAGEVEC_SIZE (8U)
1068
1da177e4
LT
1069struct nfs_read_data {
1070 int flags;
1071 struct rpc_task task;
1072 struct inode *inode;
1073 struct rpc_cred *cred;
1074 struct nfs_fattr fattr; /* fattr storage */
1075 struct list_head pages; /* Coalesced read requests */
1076 struct nfs_page *req; /* multi ops per nfs_page */
40859d7e 1077 struct page **pagevec;
e9f7bee1 1078 unsigned int npages; /* Max length of pagevec */
1da177e4
LT
1079 struct nfs_readargs args;
1080 struct nfs_readres res;
1da177e4 1081 unsigned long timestamp; /* For lease renewal */
bae724ef 1082 struct pnfs_layout_segment *lseg;
d83217c1 1083 struct nfs_client *ds_clp; /* pNFS data server */
64419a9b 1084 const struct rpc_call_ops *mds_ops;
cbdabc7f 1085 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
dc70d7b3 1086 __u64 mds_offset;
0d0b5cb3 1087 struct page *page_array[NFS_PAGEVEC_SIZE];
1da177e4
LT
1088};
1089
1090struct nfs_write_data {
1091 int flags;
1092 struct rpc_task task;
1093 struct inode *inode;
1094 struct rpc_cred *cred;
1095 struct nfs_fattr fattr;
1096 struct nfs_writeverf verf;
1097 struct list_head pages; /* Coalesced requests we wish to flush */
1098 struct nfs_page *req; /* multi ops per nfs_page */
40859d7e 1099 struct page **pagevec;
e9f7bee1 1100 unsigned int npages; /* Max length of pagevec */
1da177e4
LT
1101 struct nfs_writeargs args; /* argument struct */
1102 struct nfs_writeres res; /* result struct */
5053aa56 1103 struct pnfs_layout_segment *lseg;
a69aef14 1104 struct nfs_client *ds_clp; /* pNFS data server */
e0c2b380 1105 int ds_commit_index;
0382b744 1106 const struct rpc_call_ops *mds_ops;
b029bc9b 1107 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
1da177e4
LT
1108#ifdef CONFIG_NFS_V4
1109 unsigned long timestamp; /* For lease renewal */
1110#endif
a69aef14 1111 __u64 mds_offset; /* Filelayout dense stripe */
0d0b5cb3 1112 struct page *page_array[NFS_PAGEVEC_SIZE];
1da177e4
LT
1113};
1114
1115struct nfs_access_entry;
45a52a02 1116struct nfs_client;
e0dca7a0 1117struct rpc_timeout;
1da177e4
LT
1118
1119/*
1120 * RPC procedure vector for NFSv2/NFSv3 demuxing
1121 */
1122struct nfs_rpc_ops {
c0e07cb6 1123 u32 version; /* Protocol version */
f786aa90 1124 const struct dentry_operations *dentry_ops;
c5ef1c42
AV
1125 const struct inode_operations *dir_inode_ops;
1126 const struct inode_operations *file_inode_ops;
1da177e4
LT
1127
1128 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1129 struct nfs_fsinfo *);
2b3de441
DH
1130 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
1131 struct qstr *, struct nfs_fh *,
1132 struct nfs_fattr *);
1da177e4
LT
1133 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1134 struct nfs_fattr *);
1135 int (*setattr) (struct dentry *, struct nfs_fattr *,
1136 struct iattr *);
7c513058 1137 int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *,
1da177e4
LT
1138 struct nfs_fh *, struct nfs_fattr *);
1139 int (*access) (struct inode *, struct nfs_access_entry *);
1140 int (*readlink)(struct inode *, struct page *, unsigned int,
1141 unsigned int);
1da177e4 1142 int (*create) (struct inode *, struct dentry *,
c0204fd2 1143 struct iattr *, int, struct nfs_open_context *);
1da177e4 1144 int (*remove) (struct inode *, struct qstr *);
e4eff1a6
TM
1145 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1146 int (*unlink_done) (struct rpc_task *, struct inode *);
1da177e4
LT
1147 int (*rename) (struct inode *, struct qstr *,
1148 struct inode *, struct qstr *);
d3d4152a
JL
1149 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1150 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1da177e4 1151 int (*link) (struct inode *, struct inode *, struct qstr *);
94a6d753
CL
1152 int (*symlink) (struct inode *, struct dentry *, struct page *,
1153 unsigned int, struct iattr *);
1da177e4
LT
1154 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1155 int (*rmdir) (struct inode *, struct qstr *);
1156 int (*readdir) (struct dentry *, struct rpc_cred *,
56e4ebf8 1157 u64, struct page **, unsigned int, int);
1da177e4
LT
1158 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1159 dev_t);
1160 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1161 struct nfs_fsstat *);
1162 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1163 struct nfs_fsinfo *);
1164 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1165 struct nfs_pathconf *);
e9326dca 1166 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
573c4e1e 1167 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
bdc7f021 1168 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
ec06c096 1169 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
bdc7f021 1170 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
788e7a89 1171 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
bdc7f021 1172 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
788e7a89 1173 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
1da177e4 1174 int (*lock)(struct file *, int, struct file_lock *);
2116271a 1175 int (*lock_check_bounds)(const struct file_lock *);
ada70d94 1176 void (*clear_acl_cache)(struct inode *);
7fe5c398 1177 void (*close_context)(struct nfs_open_context *ctx, int);
2b484297
TM
1178 struct inode * (*open_context) (struct inode *dir,
1179 struct nfs_open_context *ctx,
1180 int open_flags,
1181 struct iattr *iattr);
45a52a02
AA
1182 int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1183 const char *, rpc_authflavor_t, int);
5a5ea0d4 1184 int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
1da177e4
LT
1185};
1186
1187/*
1188 * NFS_CALL(getattr, inode, (fattr));
1189 * into
1190 * NFS_PROTO(inode)->getattr(fattr);
1191 */
1192#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1193
1194/*
1195 * Function vectors etc. for the NFS client
1196 */
509de811
DH
1197extern const struct nfs_rpc_ops nfs_v2_clientops;
1198extern const struct nfs_rpc_ops nfs_v3_clientops;
1199extern const struct nfs_rpc_ops nfs_v4_clientops;
1da177e4
LT
1200extern struct rpc_version nfs_version2;
1201extern struct rpc_version nfs_version3;
1202extern struct rpc_version nfs_version4;
1203
b7fa0554
AG
1204extern struct rpc_version nfsacl_version3;
1205extern struct rpc_program nfsacl_program;
1206
1da177e4 1207#endif