]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - include/linux/nfs_xdr.h
NFSv4: Support NFSv4 optional attributes in the struct nfs_fattr
[mirror_ubuntu-jammy-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>
1da177e4 5
40859d7e
CL
6/*
7 * To change the maximum rsize and wsize supported by the NFS client, adjust
8 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
9 * support a megabyte or more. The default is left at 4096 bytes, which is
10 * reasonable for NFS over UDP.
11 */
12#define NFS_MAX_FILE_IO_SIZE (1048576U)
13#define NFS_DEF_FILE_IO_SIZE (4096U)
14#define NFS_MIN_FILE_IO_SIZE (1024U)
15
8b4bdcf8
TM
16struct nfs_fsid {
17 uint64_t major;
18 uint64_t minor;
1da177e4
LT
19};
20
8b4bdcf8
TM
21/*
22 * Helper for checking equality between 2 fsids.
23 */
24static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
25{
26 return a->major == b->major && a->minor == b->minor;
27}
28
1da177e4 29struct nfs_fattr {
9e6e70f8 30 unsigned int valid; /* which fields are valid */
1da177e4
LT
31 __u64 pre_size; /* pre_op_attr.size */
32 struct timespec pre_mtime; /* pre_op_attr.mtime */
33 struct timespec pre_ctime; /* pre_op_attr.ctime */
34 enum nfs_ftype type; /* always use NFSv2 types */
35 __u32 mode;
36 __u32 nlink;
37 __u32 uid;
38 __u32 gid;
9fa8d66f 39 dev_t rdev;
1da177e4
LT
40 __u64 size;
41 union {
42 struct {
43 __u32 blocksize;
44 __u32 blocks;
45 } nfs2;
46 struct {
47 __u64 used;
48 } nfs3;
49 } du;
8b4bdcf8 50 struct nfs_fsid fsid;
1da177e4
LT
51 __u64 fileid;
52 struct timespec atime;
53 struct timespec mtime;
54 struct timespec ctime;
55 __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */
56 __u64 change_attr; /* NFSv4 change attribute */
57 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
33801147 58 unsigned long time_start;
4704f0e2 59 unsigned long gencount;
1da177e4
LT
60};
61
9e6e70f8
TM
62#define NFS_ATTR_FATTR_TYPE (1U << 0)
63#define NFS_ATTR_FATTR_MODE (1U << 1)
64#define NFS_ATTR_FATTR_NLINK (1U << 2)
65#define NFS_ATTR_FATTR_OWNER (1U << 3)
66#define NFS_ATTR_FATTR_GROUP (1U << 4)
67#define NFS_ATTR_FATTR_RDEV (1U << 5)
68#define NFS_ATTR_FATTR_SIZE (1U << 6)
69#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
70#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
71#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
72#define NFS_ATTR_FATTR_FSID (1U << 10)
73#define NFS_ATTR_FATTR_FILEID (1U << 11)
74#define NFS_ATTR_FATTR_ATIME (1U << 12)
75#define NFS_ATTR_FATTR_MTIME (1U << 13)
76#define NFS_ATTR_FATTR_CTIME (1U << 14)
77#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
78#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
79#define NFS_ATTR_FATTR_CHANGE (1U << 17)
80#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
81#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
82
83#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
84 | NFS_ATTR_FATTR_MODE \
85 | NFS_ATTR_FATTR_NLINK \
86 | NFS_ATTR_FATTR_OWNER \
87 | NFS_ATTR_FATTR_GROUP \
88 | NFS_ATTR_FATTR_RDEV \
89 | NFS_ATTR_FATTR_SIZE \
90 | NFS_ATTR_FATTR_FSID \
91 | NFS_ATTR_FATTR_FILEID \
92 | NFS_ATTR_FATTR_ATIME \
93 | NFS_ATTR_FATTR_MTIME \
94 | NFS_ATTR_FATTR_CTIME)
95#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
96 | NFS_ATTR_FATTR_BLOCKS_USED)
97#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
98 | NFS_ATTR_FATTR_SPACE_USED)
99#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
100 | NFS_ATTR_FATTR_SPACE_USED \
101 | NFS_ATTR_FATTR_CHANGE)
1da177e4
LT
102
103/*
104 * Info on the file system
105 */
106struct nfs_fsinfo {
107 struct nfs_fattr *fattr; /* Post-op attributes */
108 __u32 rtmax; /* max. read transfer size */
109 __u32 rtpref; /* pref. read transfer size */
110 __u32 rtmult; /* reads should be multiple of this */
111 __u32 wtmax; /* max. write transfer size */
112 __u32 wtpref; /* pref. write transfer size */
113 __u32 wtmult; /* writes should be multiple of this */
114 __u32 dtpref; /* pref. readdir transfer size */
115 __u64 maxfilesize;
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;
1da177e4
LT
150/*
151 * Arguments to the open call.
152 */
153struct nfs_openargs {
154 const struct nfs_fh * fh;
cee54fc9 155 struct nfs_seqid * seqid;
1da177e4 156 int open_flags;
dc0b027d 157 fmode_t fmode;
1da177e4 158 __u64 clientid;
9f958ab8 159 __u64 id;
1da177e4
LT
160 union {
161 struct iattr * attrs; /* UNCHECKED, GUARDED */
162 nfs4_verifier verifier; /* EXCLUSIVE */
163 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
bd7bf9d5 164 fmode_t delegation_type; /* CLAIM_PREVIOUS */
1da177e4
LT
165 } u;
166 const struct qstr * name;
167 const struct nfs_server *server; /* Needed for ID mapping */
168 const u32 * bitmask;
169 __u32 claim;
170};
171
172struct nfs_openres {
173 nfs4_stateid stateid;
174 struct nfs_fh fh;
175 struct nfs4_change_info cinfo;
176 __u32 rflags;
177 struct nfs_fattr * f_attr;
56ae19f3 178 struct nfs_fattr * dir_attr;
c1d51931 179 struct nfs_seqid * seqid;
1da177e4 180 const struct nfs_server *server;
bd7bf9d5 181 fmode_t delegation_type;
1da177e4
LT
182 nfs4_stateid delegation;
183 __u32 do_recall;
184 __u64 maxsize;
aa53ed54 185 __u32 attrset[NFS4_BITMAP_SIZE];
1da177e4
LT
186};
187
188/*
189 * Arguments to the open_confirm call.
190 */
191struct nfs_open_confirmargs {
192 const struct nfs_fh * fh;
cdd4e68b 193 nfs4_stateid * stateid;
cee54fc9 194 struct nfs_seqid * seqid;
1da177e4
LT
195};
196
197struct nfs_open_confirmres {
198 nfs4_stateid stateid;
c1d51931 199 struct nfs_seqid * seqid;
1da177e4
LT
200};
201
202/*
203 * Arguments to the close call.
204 */
205struct nfs_closeargs {
206 struct nfs_fh * fh;
9512135d 207 nfs4_stateid * stateid;
cee54fc9 208 struct nfs_seqid * seqid;
dc0b027d 209 fmode_t fmode;
516a6af6 210 const u32 * bitmask;
1da177e4
LT
211};
212
213struct nfs_closeres {
214 nfs4_stateid stateid;
516a6af6 215 struct nfs_fattr * fattr;
c1d51931 216 struct nfs_seqid * seqid;
516a6af6 217 const struct nfs_server *server;
1da177e4
LT
218};
219/*
220 * * Arguments to the lock,lockt, and locku call.
221 * */
222struct nfs_lowner {
911d1aaf 223 __u64 clientid;
9f958ab8 224 __u64 id;
1da177e4
LT
225};
226
911d1aaf
TM
227struct nfs_lock_args {
228 struct nfs_fh * fh;
229 struct file_lock * fl;
cee54fc9 230 struct nfs_seqid * lock_seqid;
06735b34
TM
231 nfs4_stateid * lock_stateid;
232 struct nfs_seqid * open_seqid;
233 nfs4_stateid * open_stateid;
911d1aaf
TM
234 struct nfs_lowner lock_owner;
235 unsigned char block : 1;
236 unsigned char reclaim : 1;
237 unsigned char new_lock_owner : 1;
238};
239
240struct nfs_lock_res {
c1d51931
TM
241 nfs4_stateid stateid;
242 struct nfs_seqid * lock_seqid;
243 struct nfs_seqid * open_seqid;
1da177e4
LT
244};
245
911d1aaf
TM
246struct nfs_locku_args {
247 struct nfs_fh * fh;
248 struct file_lock * fl;
cee54fc9 249 struct nfs_seqid * seqid;
faf5f49c 250 nfs4_stateid * stateid;
1da177e4
LT
251};
252
911d1aaf 253struct nfs_locku_res {
c1d51931
TM
254 nfs4_stateid stateid;
255 struct nfs_seqid * seqid;
1da177e4
LT
256};
257
911d1aaf
TM
258struct nfs_lockt_args {
259 struct nfs_fh * fh;
260 struct file_lock * fl;
261 struct nfs_lowner lock_owner;
1da177e4
LT
262};
263
911d1aaf
TM
264struct nfs_lockt_res {
265 struct file_lock * denied; /* LOCK, LOCKT failed */
1da177e4
LT
266};
267
268struct nfs4_delegreturnargs {
269 const struct nfs_fh *fhandle;
270 const nfs4_stateid *stateid;
fa178f29
TM
271 const u32 * bitmask;
272};
273
274struct nfs4_delegreturnres {
275 struct nfs_fattr * fattr;
276 const struct nfs_server *server;
1da177e4
LT
277};
278
279/*
280 * Arguments to the read call.
281 */
1da177e4
LT
282struct nfs_readargs {
283 struct nfs_fh * fh;
284 struct nfs_open_context *context;
285 __u64 offset;
286 __u32 count;
287 unsigned int pgbase;
288 struct page ** pages;
289};
290
291struct nfs_readres {
292 struct nfs_fattr * fattr;
293 __u32 count;
294 int eof;
295};
296
297/*
298 * Arguments to the write call.
299 */
1da177e4
LT
300struct nfs_writeargs {
301 struct nfs_fh * fh;
302 struct nfs_open_context *context;
303 __u64 offset;
304 __u32 count;
305 enum nfs3_stable_how stable;
306 unsigned int pgbase;
307 struct page ** pages;
4f9838c7 308 const u32 * bitmask;
1da177e4
LT
309};
310
311struct nfs_writeverf {
312 enum nfs3_stable_how committed;
bc4785cd 313 __be32 verifier[2];
1da177e4
LT
314};
315
316struct nfs_writeres {
317 struct nfs_fattr * fattr;
318 struct nfs_writeverf * verf;
319 __u32 count;
4f9838c7 320 const struct nfs_server *server;
1da177e4
LT
321};
322
4fdc17b2
TM
323/*
324 * Common arguments to the unlink call
325 */
326struct nfs_removeargs {
327 const struct nfs_fh *fh;
328 struct qstr name;
329 const u32 * bitmask;
330};
331
332struct nfs_removeres {
333 const struct nfs_server *server;
334 struct nfs4_change_info cinfo;
335 struct nfs_fattr dir_attr;
336};
337
1da177e4
LT
338/*
339 * Argument struct for decode_entry function
340 */
341struct nfs_entry {
342 __u64 ino;
343 __u64 cookie,
344 prev_cookie;
345 const char * name;
346 unsigned int len;
347 int eof;
348 struct nfs_fh * fh;
349 struct nfs_fattr * fattr;
350};
351
352/*
353 * The following types are for NFSv2 only.
354 */
355struct nfs_sattrargs {
356 struct nfs_fh * fh;
357 struct iattr * sattr;
358};
359
360struct nfs_diropargs {
361 struct nfs_fh * fh;
362 const char * name;
363 unsigned int len;
364};
365
366struct nfs_createargs {
367 struct nfs_fh * fh;
368 const char * name;
369 unsigned int len;
370 struct iattr * sattr;
371};
372
373struct nfs_renameargs {
374 struct nfs_fh * fromfh;
375 const char * fromname;
376 unsigned int fromlen;
377 struct nfs_fh * tofh;
378 const char * toname;
379 unsigned int tolen;
380};
381
382struct nfs_setattrargs {
383 struct nfs_fh * fh;
384 nfs4_stateid stateid;
385 struct iattr * iap;
386 const struct nfs_server * server; /* Needed for name mapping */
387 const u32 * bitmask;
388};
389
23ec6965
BF
390struct nfs_setaclargs {
391 struct nfs_fh * fh;
392 size_t acl_len;
393 unsigned int acl_pgbase;
394 struct page ** acl_pages;
395};
396
029d105e
BF
397struct nfs_getaclargs {
398 struct nfs_fh * fh;
399 size_t acl_len;
400 unsigned int acl_pgbase;
401 struct page ** acl_pages;
402};
403
1da177e4
LT
404struct nfs_setattrres {
405 struct nfs_fattr * fattr;
406 const struct nfs_server * server;
407};
408
409struct nfs_linkargs {
410 struct nfs_fh * fromfh;
411 struct nfs_fh * tofh;
412 const char * toname;
413 unsigned int tolen;
414};
415
416struct nfs_symlinkargs {
417 struct nfs_fh * fromfh;
418 const char * fromname;
419 unsigned int fromlen;
94a6d753
CL
420 struct page ** pages;
421 unsigned int pathlen;
1da177e4
LT
422 struct iattr * sattr;
423};
424
425struct nfs_readdirargs {
426 struct nfs_fh * fh;
427 __u32 cookie;
428 unsigned int count;
429 struct page ** pages;
430};
431
b7fa0554
AG
432struct nfs3_getaclargs {
433 struct nfs_fh * fh;
434 int mask;
435 struct page ** pages;
436};
437
438struct nfs3_setaclargs {
439 struct inode * inode;
440 int mask;
441 struct posix_acl * acl_access;
442 struct posix_acl * acl_default;
ae46141f
TM
443 size_t len;
444 unsigned int npages;
b7fa0554
AG
445 struct page ** pages;
446};
447
1da177e4
LT
448struct nfs_diropok {
449 struct nfs_fh * fh;
450 struct nfs_fattr * fattr;
451};
452
453struct nfs_readlinkargs {
454 struct nfs_fh * fh;
455 unsigned int pgbase;
456 unsigned int pglen;
457 struct page ** pages;
458};
459
460struct nfs3_sattrargs {
461 struct nfs_fh * fh;
462 struct iattr * sattr;
463 unsigned int guard;
464 struct timespec guardtime;
465};
466
467struct nfs3_diropargs {
468 struct nfs_fh * fh;
469 const char * name;
470 unsigned int len;
471};
472
473struct nfs3_accessargs {
474 struct nfs_fh * fh;
475 __u32 access;
476};
477
478struct nfs3_createargs {
479 struct nfs_fh * fh;
480 const char * name;
481 unsigned int len;
482 struct iattr * sattr;
483 enum nfs3_createmode createmode;
bc4785cd 484 __be32 verifier[2];
1da177e4
LT
485};
486
487struct nfs3_mkdirargs {
488 struct nfs_fh * fh;
489 const char * name;
490 unsigned int len;
491 struct iattr * sattr;
492};
493
494struct nfs3_symlinkargs {
495 struct nfs_fh * fromfh;
496 const char * fromname;
497 unsigned int fromlen;
94a6d753
CL
498 struct page ** pages;
499 unsigned int pathlen;
1da177e4
LT
500 struct iattr * sattr;
501};
502
503struct nfs3_mknodargs {
504 struct nfs_fh * fh;
505 const char * name;
506 unsigned int len;
507 enum nfs3_ftype type;
508 struct iattr * sattr;
509 dev_t rdev;
510};
511
512struct nfs3_renameargs {
513 struct nfs_fh * fromfh;
514 const char * fromname;
515 unsigned int fromlen;
516 struct nfs_fh * tofh;
517 const char * toname;
518 unsigned int tolen;
519};
520
521struct nfs3_linkargs {
522 struct nfs_fh * fromfh;
523 struct nfs_fh * tofh;
524 const char * toname;
525 unsigned int tolen;
526};
527
528struct nfs3_readdirargs {
529 struct nfs_fh * fh;
530 __u64 cookie;
bc4785cd 531 __be32 verf[2];
1da177e4
LT
532 int plus;
533 unsigned int count;
534 struct page ** pages;
535};
536
537struct nfs3_diropres {
538 struct nfs_fattr * dir_attr;
539 struct nfs_fh * fh;
540 struct nfs_fattr * fattr;
541};
542
543struct nfs3_accessres {
544 struct nfs_fattr * fattr;
545 __u32 access;
546};
547
548struct nfs3_readlinkargs {
549 struct nfs_fh * fh;
550 unsigned int pgbase;
551 unsigned int pglen;
552 struct page ** pages;
553};
554
555struct nfs3_renameres {
556 struct nfs_fattr * fromattr;
557 struct nfs_fattr * toattr;
558};
559
560struct nfs3_linkres {
561 struct nfs_fattr * dir_attr;
562 struct nfs_fattr * fattr;
563};
564
565struct nfs3_readdirres {
566 struct nfs_fattr * dir_attr;
bc4785cd 567 __be32 * verf;
1da177e4
LT
568 int plus;
569};
570
b7fa0554
AG
571struct nfs3_getaclres {
572 struct nfs_fattr * fattr;
573 int mask;
574 unsigned int acl_access_count;
575 unsigned int acl_default_count;
576 struct posix_acl * acl_access;
577 struct posix_acl * acl_default;
578};
579
1da177e4
LT
580#ifdef CONFIG_NFS_V4
581
582typedef u64 clientid4;
583
584struct nfs4_accessargs {
585 const struct nfs_fh * fh;
76b32999 586 const u32 * bitmask;
1da177e4
LT
587 u32 access;
588};
589
590struct nfs4_accessres {
76b32999
TM
591 const struct nfs_server * server;
592 struct nfs_fattr * fattr;
1da177e4
LT
593 u32 supported;
594 u32 access;
595};
596
597struct nfs4_create_arg {
598 u32 ftype;
599 union {
94a6d753
CL
600 struct {
601 struct page ** pages;
602 unsigned int len;
603 } symlink; /* NF4LNK */
1da177e4
LT
604 struct {
605 u32 specdata1;
606 u32 specdata2;
607 } device; /* NF4BLK, NF4CHR */
608 } u;
609 const struct qstr * name;
610 const struct nfs_server * server;
611 const struct iattr * attrs;
612 const struct nfs_fh * dir_fh;
613 const u32 * bitmask;
614};
615
616struct nfs4_create_res {
617 const struct nfs_server * server;
618 struct nfs_fh * fh;
619 struct nfs_fattr * fattr;
620 struct nfs4_change_info dir_cinfo;
56ae19f3 621 struct nfs_fattr * dir_fattr;
1da177e4
LT
622};
623
624struct nfs4_fsinfo_arg {
625 const struct nfs_fh * fh;
626 const u32 * bitmask;
627};
628
629struct nfs4_getattr_arg {
630 const struct nfs_fh * fh;
631 const u32 * bitmask;
632};
633
634struct nfs4_getattr_res {
635 const struct nfs_server * server;
636 struct nfs_fattr * fattr;
637};
638
639struct nfs4_link_arg {
640 const struct nfs_fh * fh;
641 const struct nfs_fh * dir_fh;
642 const struct qstr * name;
91ba2eee
TM
643 const u32 * bitmask;
644};
645
646struct nfs4_link_res {
647 const struct nfs_server * server;
648 struct nfs_fattr * fattr;
649 struct nfs4_change_info cinfo;
650 struct nfs_fattr * dir_attr;
1da177e4
LT
651};
652
91ba2eee 653
1da177e4
LT
654struct nfs4_lookup_arg {
655 const struct nfs_fh * dir_fh;
656 const struct qstr * name;
657 const u32 * bitmask;
658};
659
660struct nfs4_lookup_res {
661 const struct nfs_server * server;
662 struct nfs_fattr * fattr;
663 struct nfs_fh * fh;
664};
665
666struct nfs4_lookup_root_arg {
667 const u32 * bitmask;
668};
669
670struct nfs4_pathconf_arg {
671 const struct nfs_fh * fh;
672 const u32 * bitmask;
673};
674
675struct nfs4_readdir_arg {
676 const struct nfs_fh * fh;
677 u64 cookie;
678 nfs4_verifier verifier;
679 u32 count;
680 struct page ** pages; /* zero-copy data */
681 unsigned int pgbase; /* zero-copy data */
682 const u32 * bitmask;
683};
684
685struct nfs4_readdir_res {
686 nfs4_verifier verifier;
687 unsigned int pgbase;
688};
689
690struct nfs4_readlink {
691 const struct nfs_fh * fh;
692 unsigned int pgbase;
693 unsigned int pglen; /* zero-copy data */
694 struct page ** pages; /* zero-copy data */
695};
696
1da177e4
LT
697struct nfs4_rename_arg {
698 const struct nfs_fh * old_dir;
699 const struct nfs_fh * new_dir;
700 const struct qstr * old_name;
701 const struct qstr * new_name;
6caf2c82 702 const u32 * bitmask;
1da177e4
LT
703};
704
705struct nfs4_rename_res {
6caf2c82 706 const struct nfs_server * server;
1da177e4 707 struct nfs4_change_info old_cinfo;
6caf2c82 708 struct nfs_fattr * old_fattr;
1da177e4 709 struct nfs4_change_info new_cinfo;
6caf2c82 710 struct nfs_fattr * new_fattr;
1da177e4
LT
711};
712
19d771f3 713#define NFS4_SETCLIENTID_NAMELEN (127)
1da177e4 714struct nfs4_setclientid {
cc38bac3 715 const nfs4_verifier * sc_verifier;
1da177e4 716 unsigned int sc_name_len;
d1ce02e1 717 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
cc38bac3 718 u32 sc_prog;
1da177e4 719 unsigned int sc_netid_len;
d1ce02e1 720 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
1da177e4 721 unsigned int sc_uaddr_len;
d1ce02e1 722 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
cc38bac3 723 u32 sc_cb_ident;
1da177e4
LT
724};
725
726struct nfs4_statfs_arg {
727 const struct nfs_fh * fh;
728 const u32 * bitmask;
729};
730
731struct nfs4_server_caps_res {
732 u32 attr_bitmask[2];
733 u32 acl_bitmask;
734 u32 has_links;
735 u32 has_symlinks;
736};
737
7aaa0b3b
MN
738struct nfs4_string {
739 unsigned int len;
740 char *data;
683b57b4
TM
741};
742
7aaa0b3b
MN
743#define NFS4_PATHNAME_MAXCOMPONENTS 512
744struct nfs4_pathname {
745 unsigned int ncomponents;
746 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
747};
748
749#define NFS4_FS_LOCATION_MAXSERVERS 10
750struct nfs4_fs_location {
751 unsigned int nservers;
752 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
753 struct nfs4_pathname rootpath;
754};
755
756#define NFS4_FS_LOCATIONS_MAXENTRIES 10
757struct nfs4_fs_locations {
683b57b4
TM
758 struct nfs_fattr fattr;
759 const struct nfs_server *server;
7aaa0b3b 760 struct nfs4_pathname fs_path;
683b57b4 761 int nlocations;
7aaa0b3b 762 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
683b57b4
TM
763};
764
765struct nfs4_fs_locations_arg {
766 const struct nfs_fh *dir_fh;
767 const struct qstr *name;
768 struct page *page;
769 const u32 *bitmask;
770};
771
1da177e4
LT
772#endif /* CONFIG_NFS_V4 */
773
774struct nfs_page;
775
40859d7e
CL
776#define NFS_PAGEVEC_SIZE (8U)
777
1da177e4
LT
778struct nfs_read_data {
779 int flags;
780 struct rpc_task task;
781 struct inode *inode;
782 struct rpc_cred *cred;
783 struct nfs_fattr fattr; /* fattr storage */
784 struct list_head pages; /* Coalesced read requests */
785 struct nfs_page *req; /* multi ops per nfs_page */
40859d7e 786 struct page **pagevec;
e9f7bee1 787 unsigned int npages; /* Max length of pagevec */
1da177e4
LT
788 struct nfs_readargs args;
789 struct nfs_readres res;
790#ifdef CONFIG_NFS_V4
791 unsigned long timestamp; /* For lease renewal */
792#endif
0d0b5cb3 793 struct page *page_array[NFS_PAGEVEC_SIZE];
1da177e4
LT
794};
795
796struct nfs_write_data {
797 int flags;
798 struct rpc_task task;
799 struct inode *inode;
800 struct rpc_cred *cred;
801 struct nfs_fattr fattr;
802 struct nfs_writeverf verf;
803 struct list_head pages; /* Coalesced requests we wish to flush */
804 struct nfs_page *req; /* multi ops per nfs_page */
40859d7e 805 struct page **pagevec;
e9f7bee1 806 unsigned int npages; /* Max length of pagevec */
1da177e4
LT
807 struct nfs_writeargs args; /* argument struct */
808 struct nfs_writeres res; /* result struct */
809#ifdef CONFIG_NFS_V4
810 unsigned long timestamp; /* For lease renewal */
811#endif
0d0b5cb3 812 struct page *page_array[NFS_PAGEVEC_SIZE];
1da177e4
LT
813};
814
815struct nfs_access_entry;
816
817/*
818 * RPC procedure vector for NFSv2/NFSv3 demuxing
819 */
820struct nfs_rpc_ops {
c0e07cb6 821 u32 version; /* Protocol version */
1da177e4 822 struct dentry_operations *dentry_ops;
c5ef1c42
AV
823 const struct inode_operations *dir_inode_ops;
824 const struct inode_operations *file_inode_ops;
1da177e4
LT
825
826 int (*getroot) (struct nfs_server *, struct nfs_fh *,
827 struct nfs_fsinfo *);
2b3de441
DH
828 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
829 struct qstr *, struct nfs_fh *,
830 struct nfs_fattr *);
1da177e4
LT
831 int (*getattr) (struct nfs_server *, struct nfs_fh *,
832 struct nfs_fattr *);
833 int (*setattr) (struct dentry *, struct nfs_fattr *,
834 struct iattr *);
835 int (*lookup) (struct inode *, struct qstr *,
836 struct nfs_fh *, struct nfs_fattr *);
837 int (*access) (struct inode *, struct nfs_access_entry *);
838 int (*readlink)(struct inode *, struct page *, unsigned int,
839 unsigned int);
1da177e4 840 int (*create) (struct inode *, struct dentry *,
02a913a7 841 struct iattr *, int, struct nameidata *);
1da177e4 842 int (*remove) (struct inode *, struct qstr *);
e4eff1a6
TM
843 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
844 int (*unlink_done) (struct rpc_task *, struct inode *);
1da177e4
LT
845 int (*rename) (struct inode *, struct qstr *,
846 struct inode *, struct qstr *);
847 int (*link) (struct inode *, struct inode *, struct qstr *);
94a6d753
CL
848 int (*symlink) (struct inode *, struct dentry *, struct page *,
849 unsigned int, struct iattr *);
1da177e4
LT
850 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
851 int (*rmdir) (struct inode *, struct qstr *);
852 int (*readdir) (struct dentry *, struct rpc_cred *,
853 u64, struct page *, unsigned int, int);
854 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
855 dev_t);
856 int (*statfs) (struct nfs_server *, struct nfs_fh *,
857 struct nfs_fsstat *);
858 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
859 struct nfs_fsinfo *);
860 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
861 struct nfs_pathconf *);
e9326dca 862 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
0dbb4c67 863 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
bdc7f021 864 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
ec06c096 865 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
bdc7f021 866 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
788e7a89 867 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
bdc7f021 868 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
788e7a89 869 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
1da177e4 870 int (*lock)(struct file *, int, struct file_lock *);
2116271a 871 int (*lock_check_bounds)(const struct file_lock *);
ada70d94 872 void (*clear_acl_cache)(struct inode *);
1da177e4
LT
873};
874
875/*
876 * NFS_CALL(getattr, inode, (fattr));
877 * into
878 * NFS_PROTO(inode)->getattr(fattr);
879 */
880#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
881
882/*
883 * Function vectors etc. for the NFS client
884 */
509de811
DH
885extern const struct nfs_rpc_ops nfs_v2_clientops;
886extern const struct nfs_rpc_ops nfs_v3_clientops;
887extern const struct nfs_rpc_ops nfs_v4_clientops;
1da177e4
LT
888extern struct rpc_version nfs_version2;
889extern struct rpc_version nfs_version3;
890extern struct rpc_version nfs_version4;
891
b7fa0554
AG
892extern struct rpc_version nfsacl_version3;
893extern struct rpc_program nfsacl_program;
894
1da177e4 895#endif