blob: 8c77c11224d1e0b009d6250b8789287d5a628b35 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_NFS_XDR_H
2#define _LINUX_NFS_XDR_H
3
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +00004#include <linux/nfsacl.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
Chuck Lever40859d72005-11-30 18:09:02 -05006/*
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
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040016struct nfs_fsid {
17 uint64_t major;
18 uint64_t minor;
Linus Torvalds1da177e2005-04-16 15:20:36 -070019};
20
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040021/*
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070029struct nfs_fattr {
30 unsigned short valid; /* which fields are valid */
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;
39 __u64 size;
40 union {
41 struct {
42 __u32 blocksize;
43 __u32 blocks;
44 } nfs2;
45 struct {
46 __u64 used;
47 } nfs3;
48 } du;
49 dev_t rdev;
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040050 struct nfs_fsid fsid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 __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 */
Trond Myklebust33801142005-10-27 22:12:39 -040058 unsigned long time_start;
Linus Torvalds1da177e2005-04-16 15:20:36 -070059};
60
61#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
62#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
63#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
Trond Myklebust73a3d072006-05-25 01:40:47 -040064#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */
Trond Myklebust70ca8852007-09-30 15:21:24 -040065#define NFS_ATTR_WCC_V4 0x0010 /* pre-op change attribute */
66#define NFS_ATTR_FATTR_V4_REFERRAL 0x0020 /* NFSv4 referral */
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
68/*
69 * Info on the file system
70 */
71struct nfs_fsinfo {
72 struct nfs_fattr *fattr; /* Post-op attributes */
73 __u32 rtmax; /* max. read transfer size */
74 __u32 rtpref; /* pref. read transfer size */
75 __u32 rtmult; /* reads should be multiple of this */
76 __u32 wtmax; /* max. write transfer size */
77 __u32 wtpref; /* pref. write transfer size */
78 __u32 wtmult; /* writes should be multiple of this */
79 __u32 dtpref; /* pref. readdir transfer size */
80 __u64 maxfilesize;
81 __u32 lease_time; /* in seconds */
82};
83
84struct nfs_fsstat {
85 struct nfs_fattr *fattr; /* Post-op attributes */
86 __u64 tbytes; /* total size in bytes */
87 __u64 fbytes; /* # of free bytes */
88 __u64 abytes; /* # of bytes available to user */
89 __u64 tfiles; /* # of files */
90 __u64 ffiles; /* # of free files */
91 __u64 afiles; /* # of files available to user */
92};
93
94struct nfs2_fsstat {
95 __u32 tsize; /* Server transfer size */
96 __u32 bsize; /* Filesystem block size */
97 __u32 blocks; /* No. of "bsize" blocks on filesystem */
98 __u32 bfree; /* No. of free "bsize" blocks */
99 __u32 bavail; /* No. of available "bsize" blocks */
100};
101
102struct nfs_pathconf {
103 struct nfs_fattr *fattr; /* Post-op attributes */
104 __u32 max_link; /* max # of hard links */
105 __u32 max_namelen; /* max name length */
106};
107
108struct nfs4_change_info {
109 u32 atomic;
110 u64 before;
111 u64 after;
112};
113
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700114struct nfs_seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115/*
116 * Arguments to the open call.
117 */
118struct nfs_openargs {
119 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700120 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 int open_flags;
122 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400123 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 union {
125 struct iattr * attrs; /* UNCHECKED, GUARDED */
126 nfs4_verifier verifier; /* EXCLUSIVE */
127 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
128 int delegation_type; /* CLAIM_PREVIOUS */
129 } u;
130 const struct qstr * name;
131 const struct nfs_server *server; /* Needed for ID mapping */
132 const u32 * bitmask;
133 __u32 claim;
134};
135
136struct nfs_openres {
137 nfs4_stateid stateid;
138 struct nfs_fh fh;
139 struct nfs4_change_info cinfo;
140 __u32 rflags;
141 struct nfs_fattr * f_attr;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400142 struct nfs_fattr * dir_attr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400143 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 const struct nfs_server *server;
145 int delegation_type;
146 nfs4_stateid delegation;
147 __u32 do_recall;
148 __u64 maxsize;
Jeff Laytonaa53ed52007-06-05 14:49:03 -0400149 __u32 attrset[NFS4_BITMAP_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150};
151
152/*
153 * Arguments to the open_confirm call.
154 */
155struct nfs_open_confirmargs {
156 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100157 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700158 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159};
160
161struct nfs_open_confirmres {
162 nfs4_stateid stateid;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400163 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164};
165
166/*
167 * Arguments to the close call.
168 */
169struct nfs_closeargs {
170 struct nfs_fh * fh;
Trond Myklebust95121352005-10-18 14:20:12 -0700171 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700172 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 int open_flags;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400174 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175};
176
177struct nfs_closeres {
178 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400179 struct nfs_fattr * fattr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400180 struct nfs_seqid * seqid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400181 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182};
183/*
184 * * Arguments to the lock,lockt, and locku call.
185 * */
186struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100187 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400188 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189};
190
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100191struct nfs_lock_args {
192 struct nfs_fh * fh;
193 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700194 struct nfs_seqid * lock_seqid;
195 nfs4_stateid * lock_stateid;
196 struct nfs_seqid * open_seqid;
197 nfs4_stateid * open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100198 struct nfs_lowner lock_owner;
199 unsigned char block : 1;
200 unsigned char reclaim : 1;
201 unsigned char new_lock_owner : 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202};
203
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100204struct nfs_lock_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400205 nfs4_stateid stateid;
206 struct nfs_seqid * lock_seqid;
207 struct nfs_seqid * open_seqid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100208};
209
210struct nfs_locku_args {
211 struct nfs_fh * fh;
212 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700213 struct nfs_seqid * seqid;
Trond Myklebustfaf5f492005-10-18 14:20:15 -0700214 nfs4_stateid * stateid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215};
216
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100217struct nfs_locku_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400218 nfs4_stateid stateid;
219 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220};
221
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100222struct nfs_lockt_args {
223 struct nfs_fh * fh;
224 struct file_lock * fl;
225 struct nfs_lowner lock_owner;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226};
227
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100228struct nfs_lockt_res {
229 struct file_lock * denied; /* LOCK, LOCKT failed */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230};
231
232struct nfs4_delegreturnargs {
233 const struct nfs_fh *fhandle;
234 const nfs4_stateid *stateid;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100235 const u32 * bitmask;
236};
237
238struct nfs4_delegreturnres {
239 struct nfs_fattr * fattr;
240 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241};
242
243/*
244 * Arguments to the read call.
245 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246struct nfs_readargs {
247 struct nfs_fh * fh;
248 struct nfs_open_context *context;
249 __u64 offset;
250 __u32 count;
251 unsigned int pgbase;
252 struct page ** pages;
253};
254
255struct nfs_readres {
256 struct nfs_fattr * fattr;
257 __u32 count;
258 int eof;
259};
260
261/*
262 * Arguments to the write call.
263 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264struct nfs_writeargs {
265 struct nfs_fh * fh;
266 struct nfs_open_context *context;
267 __u64 offset;
268 __u32 count;
269 enum nfs3_stable_how stable;
270 unsigned int pgbase;
271 struct page ** pages;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400272 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273};
274
275struct nfs_writeverf {
276 enum nfs3_stable_how committed;
Al Virobc4785c2006-10-19 23:28:51 -0700277 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278};
279
280struct nfs_writeres {
281 struct nfs_fattr * fattr;
282 struct nfs_writeverf * verf;
283 __u32 count;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400284 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285};
286
287/*
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400288 * Common arguments to the unlink call
289 */
290struct nfs_removeargs {
291 const struct nfs_fh *fh;
292 struct qstr name;
293 const u32 * bitmask;
294};
295
296struct nfs_removeres {
297 const struct nfs_server *server;
298 struct nfs4_change_info cinfo;
299 struct nfs_fattr dir_attr;
300};
301
302/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303 * Argument struct for decode_entry function
304 */
305struct nfs_entry {
306 __u64 ino;
307 __u64 cookie,
308 prev_cookie;
309 const char * name;
310 unsigned int len;
311 int eof;
312 struct nfs_fh * fh;
313 struct nfs_fattr * fattr;
314};
315
316/*
317 * The following types are for NFSv2 only.
318 */
319struct nfs_sattrargs {
320 struct nfs_fh * fh;
321 struct iattr * sattr;
322};
323
324struct nfs_diropargs {
325 struct nfs_fh * fh;
326 const char * name;
327 unsigned int len;
328};
329
330struct nfs_createargs {
331 struct nfs_fh * fh;
332 const char * name;
333 unsigned int len;
334 struct iattr * sattr;
335};
336
337struct nfs_renameargs {
338 struct nfs_fh * fromfh;
339 const char * fromname;
340 unsigned int fromlen;
341 struct nfs_fh * tofh;
342 const char * toname;
343 unsigned int tolen;
344};
345
346struct nfs_setattrargs {
347 struct nfs_fh * fh;
348 nfs4_stateid stateid;
349 struct iattr * iap;
350 const struct nfs_server * server; /* Needed for name mapping */
351 const u32 * bitmask;
352};
353
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000354struct nfs_setaclargs {
355 struct nfs_fh * fh;
356 size_t acl_len;
357 unsigned int acl_pgbase;
358 struct page ** acl_pages;
359};
360
J. Bruce Fields029d1052005-06-22 17:16:22 +0000361struct nfs_getaclargs {
362 struct nfs_fh * fh;
363 size_t acl_len;
364 unsigned int acl_pgbase;
365 struct page ** acl_pages;
366};
367
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368struct nfs_setattrres {
369 struct nfs_fattr * fattr;
370 const struct nfs_server * server;
371};
372
373struct nfs_linkargs {
374 struct nfs_fh * fromfh;
375 struct nfs_fh * tofh;
376 const char * toname;
377 unsigned int tolen;
378};
379
380struct nfs_symlinkargs {
381 struct nfs_fh * fromfh;
382 const char * fromname;
383 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400384 struct page ** pages;
385 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 struct iattr * sattr;
387};
388
389struct nfs_readdirargs {
390 struct nfs_fh * fh;
391 __u32 cookie;
392 unsigned int count;
393 struct page ** pages;
394};
395
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000396struct nfs3_getaclargs {
397 struct nfs_fh * fh;
398 int mask;
399 struct page ** pages;
400};
401
402struct nfs3_setaclargs {
403 struct inode * inode;
404 int mask;
405 struct posix_acl * acl_access;
406 struct posix_acl * acl_default;
407 struct page ** pages;
408};
409
Linus Torvalds1da177e2005-04-16 15:20:36 -0700410struct nfs_diropok {
411 struct nfs_fh * fh;
412 struct nfs_fattr * fattr;
413};
414
415struct nfs_readlinkargs {
416 struct nfs_fh * fh;
417 unsigned int pgbase;
418 unsigned int pglen;
419 struct page ** pages;
420};
421
422struct nfs3_sattrargs {
423 struct nfs_fh * fh;
424 struct iattr * sattr;
425 unsigned int guard;
426 struct timespec guardtime;
427};
428
429struct nfs3_diropargs {
430 struct nfs_fh * fh;
431 const char * name;
432 unsigned int len;
433};
434
435struct nfs3_accessargs {
436 struct nfs_fh * fh;
437 __u32 access;
438};
439
440struct nfs3_createargs {
441 struct nfs_fh * fh;
442 const char * name;
443 unsigned int len;
444 struct iattr * sattr;
445 enum nfs3_createmode createmode;
Al Virobc4785c2006-10-19 23:28:51 -0700446 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447};
448
449struct nfs3_mkdirargs {
450 struct nfs_fh * fh;
451 const char * name;
452 unsigned int len;
453 struct iattr * sattr;
454};
455
456struct nfs3_symlinkargs {
457 struct nfs_fh * fromfh;
458 const char * fromname;
459 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400460 struct page ** pages;
461 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700462 struct iattr * sattr;
463};
464
465struct nfs3_mknodargs {
466 struct nfs_fh * fh;
467 const char * name;
468 unsigned int len;
469 enum nfs3_ftype type;
470 struct iattr * sattr;
471 dev_t rdev;
472};
473
474struct nfs3_renameargs {
475 struct nfs_fh * fromfh;
476 const char * fromname;
477 unsigned int fromlen;
478 struct nfs_fh * tofh;
479 const char * toname;
480 unsigned int tolen;
481};
482
483struct nfs3_linkargs {
484 struct nfs_fh * fromfh;
485 struct nfs_fh * tofh;
486 const char * toname;
487 unsigned int tolen;
488};
489
490struct nfs3_readdirargs {
491 struct nfs_fh * fh;
492 __u64 cookie;
Al Virobc4785c2006-10-19 23:28:51 -0700493 __be32 verf[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494 int plus;
495 unsigned int count;
496 struct page ** pages;
497};
498
499struct nfs3_diropres {
500 struct nfs_fattr * dir_attr;
501 struct nfs_fh * fh;
502 struct nfs_fattr * fattr;
503};
504
505struct nfs3_accessres {
506 struct nfs_fattr * fattr;
507 __u32 access;
508};
509
510struct nfs3_readlinkargs {
511 struct nfs_fh * fh;
512 unsigned int pgbase;
513 unsigned int pglen;
514 struct page ** pages;
515};
516
517struct nfs3_renameres {
518 struct nfs_fattr * fromattr;
519 struct nfs_fattr * toattr;
520};
521
522struct nfs3_linkres {
523 struct nfs_fattr * dir_attr;
524 struct nfs_fattr * fattr;
525};
526
527struct nfs3_readdirres {
528 struct nfs_fattr * dir_attr;
Al Virobc4785c2006-10-19 23:28:51 -0700529 __be32 * verf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530 int plus;
531};
532
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000533struct nfs3_getaclres {
534 struct nfs_fattr * fattr;
535 int mask;
536 unsigned int acl_access_count;
537 unsigned int acl_default_count;
538 struct posix_acl * acl_access;
539 struct posix_acl * acl_default;
540};
541
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542#ifdef CONFIG_NFS_V4
543
544typedef u64 clientid4;
545
546struct nfs4_accessargs {
547 const struct nfs_fh * fh;
Trond Myklebust76b32992007-08-10 17:45:11 -0400548 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 u32 access;
550};
551
552struct nfs4_accessres {
Trond Myklebust76b32992007-08-10 17:45:11 -0400553 const struct nfs_server * server;
554 struct nfs_fattr * fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555 u32 supported;
556 u32 access;
557};
558
559struct nfs4_create_arg {
560 u32 ftype;
561 union {
Chuck Lever94a6d752006-08-22 20:06:23 -0400562 struct {
563 struct page ** pages;
564 unsigned int len;
565 } symlink; /* NF4LNK */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700566 struct {
567 u32 specdata1;
568 u32 specdata2;
569 } device; /* NF4BLK, NF4CHR */
570 } u;
571 const struct qstr * name;
572 const struct nfs_server * server;
573 const struct iattr * attrs;
574 const struct nfs_fh * dir_fh;
575 const u32 * bitmask;
576};
577
578struct nfs4_create_res {
579 const struct nfs_server * server;
580 struct nfs_fh * fh;
581 struct nfs_fattr * fattr;
582 struct nfs4_change_info dir_cinfo;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400583 struct nfs_fattr * dir_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584};
585
586struct nfs4_fsinfo_arg {
587 const struct nfs_fh * fh;
588 const u32 * bitmask;
589};
590
591struct nfs4_getattr_arg {
592 const struct nfs_fh * fh;
593 const u32 * bitmask;
594};
595
596struct nfs4_getattr_res {
597 const struct nfs_server * server;
598 struct nfs_fattr * fattr;
599};
600
601struct nfs4_link_arg {
602 const struct nfs_fh * fh;
603 const struct nfs_fh * dir_fh;
604 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400605 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606};
607
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400608struct nfs4_link_res {
609 const struct nfs_server * server;
610 struct nfs_fattr * fattr;
611 struct nfs4_change_info cinfo;
612 struct nfs_fattr * dir_attr;
613};
614
615
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616struct nfs4_lookup_arg {
617 const struct nfs_fh * dir_fh;
618 const struct qstr * name;
619 const u32 * bitmask;
620};
621
622struct nfs4_lookup_res {
623 const struct nfs_server * server;
624 struct nfs_fattr * fattr;
625 struct nfs_fh * fh;
626};
627
628struct nfs4_lookup_root_arg {
629 const u32 * bitmask;
630};
631
632struct nfs4_pathconf_arg {
633 const struct nfs_fh * fh;
634 const u32 * bitmask;
635};
636
637struct nfs4_readdir_arg {
638 const struct nfs_fh * fh;
639 u64 cookie;
640 nfs4_verifier verifier;
641 u32 count;
642 struct page ** pages; /* zero-copy data */
643 unsigned int pgbase; /* zero-copy data */
644 const u32 * bitmask;
645};
646
647struct nfs4_readdir_res {
648 nfs4_verifier verifier;
649 unsigned int pgbase;
650};
651
652struct nfs4_readlink {
653 const struct nfs_fh * fh;
654 unsigned int pgbase;
655 unsigned int pglen; /* zero-copy data */
656 struct page ** pages; /* zero-copy data */
657};
658
Linus Torvalds1da177e2005-04-16 15:20:36 -0700659struct nfs4_rename_arg {
660 const struct nfs_fh * old_dir;
661 const struct nfs_fh * new_dir;
662 const struct qstr * old_name;
663 const struct qstr * new_name;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400664 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665};
666
667struct nfs4_rename_res {
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400668 const struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700669 struct nfs4_change_info old_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400670 struct nfs_fattr * old_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 struct nfs4_change_info new_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400672 struct nfs_fattr * new_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673};
674
Trond Myklebust69dd7162007-12-14 14:56:07 -0500675#define NFS4_SETCLIENTID_NAMELEN (56)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700676struct nfs4_setclientid {
Chuck Levercc38bac2007-12-10 14:56:54 -0500677 const nfs4_verifier * sc_verifier;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 unsigned int sc_name_len;
Chuck Levercc38bac2007-12-10 14:56:54 -0500679 char sc_name[NFS4_SETCLIENTID_NAMELEN];
680 u32 sc_prog;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681 unsigned int sc_netid_len;
Chuck Levercc38bac2007-12-10 14:56:54 -0500682 char sc_netid[RPCBIND_MAXNETIDLEN];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 unsigned int sc_uaddr_len;
Chuck Levercc38bac2007-12-10 14:56:54 -0500684 char sc_uaddr[RPCBIND_MAXUADDRLEN];
685 u32 sc_cb_ident;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686};
687
688struct nfs4_statfs_arg {
689 const struct nfs_fh * fh;
690 const u32 * bitmask;
691};
692
693struct nfs4_server_caps_res {
694 u32 attr_bitmask[2];
695 u32 acl_bitmask;
696 u32 has_links;
697 u32 has_symlinks;
698};
699
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400700struct nfs4_string {
701 unsigned int len;
702 char *data;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400703};
704
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400705#define NFS4_PATHNAME_MAXCOMPONENTS 512
706struct nfs4_pathname {
707 unsigned int ncomponents;
708 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
709};
710
711#define NFS4_FS_LOCATION_MAXSERVERS 10
712struct nfs4_fs_location {
713 unsigned int nservers;
714 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
715 struct nfs4_pathname rootpath;
716};
717
718#define NFS4_FS_LOCATIONS_MAXENTRIES 10
719struct nfs4_fs_locations {
Trond Myklebust683b57b2006-06-09 09:34:22 -0400720 struct nfs_fattr fattr;
721 const struct nfs_server *server;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400722 struct nfs4_pathname fs_path;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400723 int nlocations;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400724 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
Trond Myklebust683b57b2006-06-09 09:34:22 -0400725};
726
727struct nfs4_fs_locations_arg {
728 const struct nfs_fh *dir_fh;
729 const struct qstr *name;
730 struct page *page;
731 const u32 *bitmask;
732};
733
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734#endif /* CONFIG_NFS_V4 */
735
736struct nfs_page;
737
Chuck Lever40859d72005-11-30 18:09:02 -0500738#define NFS_PAGEVEC_SIZE (8U)
739
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740struct nfs_read_data {
741 int flags;
742 struct rpc_task task;
743 struct inode *inode;
744 struct rpc_cred *cred;
745 struct nfs_fattr fattr; /* fattr storage */
746 struct list_head pages; /* Coalesced read requests */
747 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500748 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -0700749 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700750 struct nfs_readargs args;
751 struct nfs_readres res;
752#ifdef CONFIG_NFS_V4
753 unsigned long timestamp; /* For lease renewal */
754#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -0400755 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756};
757
758struct nfs_write_data {
759 int flags;
760 struct rpc_task task;
761 struct inode *inode;
762 struct rpc_cred *cred;
763 struct nfs_fattr fattr;
764 struct nfs_writeverf verf;
765 struct list_head pages; /* Coalesced requests we wish to flush */
766 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500767 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -0700768 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700769 struct nfs_writeargs args; /* argument struct */
770 struct nfs_writeres res; /* result struct */
771#ifdef CONFIG_NFS_V4
772 unsigned long timestamp; /* For lease renewal */
773#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -0400774 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775};
776
777struct nfs_access_entry;
778
779/*
780 * RPC procedure vector for NFSv2/NFSv3 demuxing
781 */
782struct nfs_rpc_ops {
Chuck Leverc0e07cb2008-01-14 12:32:05 -0500783 u32 version; /* Protocol version */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700784 struct dentry_operations *dentry_ops;
Arjan van de Venc5ef1c42007-02-12 00:55:40 -0800785 const struct inode_operations *dir_inode_ops;
786 const struct inode_operations *file_inode_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787
788 int (*getroot) (struct nfs_server *, struct nfs_fh *,
789 struct nfs_fsinfo *);
David Howells2b3de442006-08-22 20:06:09 -0400790 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
791 struct qstr *, struct nfs_fh *,
792 struct nfs_fattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700793 int (*getattr) (struct nfs_server *, struct nfs_fh *,
794 struct nfs_fattr *);
795 int (*setattr) (struct dentry *, struct nfs_fattr *,
796 struct iattr *);
797 int (*lookup) (struct inode *, struct qstr *,
798 struct nfs_fh *, struct nfs_fattr *);
799 int (*access) (struct inode *, struct nfs_access_entry *);
800 int (*readlink)(struct inode *, struct page *, unsigned int,
801 unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802 int (*create) (struct inode *, struct dentry *,
Trond Myklebust02a913a2005-10-18 14:20:17 -0700803 struct iattr *, int, struct nameidata *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 int (*remove) (struct inode *, struct qstr *);
Trond Myklebuste4eff1a2007-07-14 15:39:58 -0400805 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
806 int (*unlink_done) (struct rpc_task *, struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807 int (*rename) (struct inode *, struct qstr *,
808 struct inode *, struct qstr *);
809 int (*link) (struct inode *, struct inode *, struct qstr *);
Chuck Lever94a6d752006-08-22 20:06:23 -0400810 int (*symlink) (struct inode *, struct dentry *, struct page *,
811 unsigned int, struct iattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
813 int (*rmdir) (struct inode *, struct qstr *);
814 int (*readdir) (struct dentry *, struct rpc_cred *,
815 u64, struct page *, unsigned int, int);
816 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
817 dev_t);
818 int (*statfs) (struct nfs_server *, struct nfs_fh *,
819 struct nfs_fsstat *);
820 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
821 struct nfs_fsinfo *);
822 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
823 struct nfs_pathconf *);
David Howellse9326dc2006-08-22 20:06:10 -0400824 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
Al Viro0dbb4c62006-10-19 23:28:49 -0700825 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
Trond Myklebustbdc7f022007-07-14 15:40:00 -0400826 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
Trond Myklebustec06c092006-03-20 13:44:27 -0500827 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -0400828 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500829 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -0400830 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500831 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebust21162712008-05-20 19:34:39 -0400833 int (*lock_check_bounds)(const struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +0000834 void (*clear_acl_cache)(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700835};
836
837/*
838 * NFS_CALL(getattr, inode, (fattr));
839 * into
840 * NFS_PROTO(inode)->getattr(fattr);
841 */
842#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
843
844/*
845 * Function vectors etc. for the NFS client
846 */
David Howells509de812006-08-22 20:06:11 -0400847extern const struct nfs_rpc_ops nfs_v2_clientops;
848extern const struct nfs_rpc_ops nfs_v3_clientops;
849extern const struct nfs_rpc_ops nfs_v4_clientops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850extern struct rpc_version nfs_version2;
851extern struct rpc_version nfs_version3;
852extern struct rpc_version nfs_version4;
853
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000854extern struct rpc_version nfsacl_version3;
855extern struct rpc_program nfsacl_program;
856
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857#endif