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