blob: 03032017ffaa9979691e996b60fe21eeccbcad95 [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 */
Manoj Naik6b97fd32006-06-09 09:34:29 -040065#define NFS_ATTR_FATTR_V4_REFERRAL 0x0010 /* NFSv4 referral */
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
67/*
68 * Info on the file system
69 */
70struct nfs_fsinfo {
71 struct nfs_fattr *fattr; /* Post-op attributes */
72 __u32 rtmax; /* max. read transfer size */
73 __u32 rtpref; /* pref. read transfer size */
74 __u32 rtmult; /* reads should be multiple of this */
75 __u32 wtmax; /* max. write transfer size */
76 __u32 wtpref; /* pref. write transfer size */
77 __u32 wtmult; /* writes should be multiple of this */
78 __u32 dtpref; /* pref. readdir transfer size */
79 __u64 maxfilesize;
80 __u32 lease_time; /* in seconds */
81};
82
83struct nfs_fsstat {
84 struct nfs_fattr *fattr; /* Post-op attributes */
85 __u64 tbytes; /* total size in bytes */
86 __u64 fbytes; /* # of free bytes */
87 __u64 abytes; /* # of bytes available to user */
88 __u64 tfiles; /* # of files */
89 __u64 ffiles; /* # of free files */
90 __u64 afiles; /* # of files available to user */
91};
92
93struct nfs2_fsstat {
94 __u32 tsize; /* Server transfer size */
95 __u32 bsize; /* Filesystem block size */
96 __u32 blocks; /* No. of "bsize" blocks on filesystem */
97 __u32 bfree; /* No. of free "bsize" blocks */
98 __u32 bavail; /* No. of available "bsize" blocks */
99};
100
101struct nfs_pathconf {
102 struct nfs_fattr *fattr; /* Post-op attributes */
103 __u32 max_link; /* max # of hard links */
104 __u32 max_namelen; /* max name length */
105};
106
107struct nfs4_change_info {
108 u32 atomic;
109 u64 before;
110 u64 after;
111};
112
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700113struct nfs_seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114/*
115 * Arguments to the open call.
116 */
117struct nfs_openargs {
118 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700119 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 int open_flags;
121 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400122 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 union {
124 struct iattr * attrs; /* UNCHECKED, GUARDED */
125 nfs4_verifier verifier; /* EXCLUSIVE */
126 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
127 int delegation_type; /* CLAIM_PREVIOUS */
128 } u;
129 const struct qstr * name;
130 const struct nfs_server *server; /* Needed for ID mapping */
131 const u32 * bitmask;
132 __u32 claim;
133};
134
135struct nfs_openres {
136 nfs4_stateid stateid;
137 struct nfs_fh fh;
138 struct nfs4_change_info cinfo;
139 __u32 rflags;
140 struct nfs_fattr * f_attr;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400141 struct nfs_fattr * dir_attr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 const struct nfs_server *server;
143 int delegation_type;
144 nfs4_stateid delegation;
145 __u32 do_recall;
146 __u64 maxsize;
Jeff Laytonaa53ed52007-06-05 14:49:03 -0400147 __u32 attrset[NFS4_BITMAP_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148};
149
150/*
151 * Arguments to the open_confirm call.
152 */
153struct nfs_open_confirmargs {
154 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100155 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700156 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157};
158
159struct nfs_open_confirmres {
160 nfs4_stateid stateid;
161};
162
163/*
164 * Arguments to the close call.
165 */
166struct nfs_closeargs {
167 struct nfs_fh * fh;
Trond Myklebust95121352005-10-18 14:20:12 -0700168 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700169 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170 int open_flags;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400171 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172};
173
174struct nfs_closeres {
175 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400176 struct nfs_fattr * fattr;
177 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178};
179/*
180 * * Arguments to the lock,lockt, and locku call.
181 * */
182struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100183 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400184 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185};
186
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100187struct nfs_lock_args {
188 struct nfs_fh * fh;
189 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700190 struct nfs_seqid * lock_seqid;
191 nfs4_stateid * lock_stateid;
192 struct nfs_seqid * open_seqid;
193 nfs4_stateid * open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100194 struct nfs_lowner lock_owner;
195 unsigned char block : 1;
196 unsigned char reclaim : 1;
197 unsigned char new_lock_owner : 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198};
199
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100200struct nfs_lock_res {
201 nfs4_stateid stateid;
202};
203
204struct nfs_locku_args {
205 struct nfs_fh * fh;
206 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700207 struct nfs_seqid * seqid;
Trond Myklebustfaf5f492005-10-18 14:20:15 -0700208 nfs4_stateid * stateid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209};
210
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100211struct nfs_locku_res {
212 nfs4_stateid stateid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213};
214
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100215struct nfs_lockt_args {
216 struct nfs_fh * fh;
217 struct file_lock * fl;
218 struct nfs_lowner lock_owner;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219};
220
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100221struct nfs_lockt_res {
222 struct file_lock * denied; /* LOCK, LOCKT failed */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223};
224
225struct nfs4_delegreturnargs {
226 const struct nfs_fh *fhandle;
227 const nfs4_stateid *stateid;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100228 const u32 * bitmask;
229};
230
231struct nfs4_delegreturnres {
232 struct nfs_fattr * fattr;
233 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234};
235
236/*
237 * Arguments to the read call.
238 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239struct nfs_readargs {
240 struct nfs_fh * fh;
241 struct nfs_open_context *context;
242 __u64 offset;
243 __u32 count;
244 unsigned int pgbase;
245 struct page ** pages;
246};
247
248struct nfs_readres {
249 struct nfs_fattr * fattr;
250 __u32 count;
251 int eof;
252};
253
254/*
255 * Arguments to the write call.
256 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257struct nfs_writeargs {
258 struct nfs_fh * fh;
259 struct nfs_open_context *context;
260 __u64 offset;
261 __u32 count;
262 enum nfs3_stable_how stable;
263 unsigned int pgbase;
264 struct page ** pages;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400265 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266};
267
268struct nfs_writeverf {
269 enum nfs3_stable_how committed;
Al Virobc4785c2006-10-19 23:28:51 -0700270 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271};
272
273struct nfs_writeres {
274 struct nfs_fattr * fattr;
275 struct nfs_writeverf * verf;
276 __u32 count;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400277 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700278};
279
280/*
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400281 * Common arguments to the unlink call
282 */
283struct nfs_removeargs {
284 const struct nfs_fh *fh;
285 struct qstr name;
286 const u32 * bitmask;
287};
288
289struct nfs_removeres {
290 const struct nfs_server *server;
291 struct nfs4_change_info cinfo;
292 struct nfs_fattr dir_attr;
293};
294
295/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700296 * Argument struct for decode_entry function
297 */
298struct nfs_entry {
299 __u64 ino;
300 __u64 cookie,
301 prev_cookie;
302 const char * name;
303 unsigned int len;
304 int eof;
305 struct nfs_fh * fh;
306 struct nfs_fattr * fattr;
307};
308
309/*
310 * The following types are for NFSv2 only.
311 */
312struct nfs_sattrargs {
313 struct nfs_fh * fh;
314 struct iattr * sattr;
315};
316
317struct nfs_diropargs {
318 struct nfs_fh * fh;
319 const char * name;
320 unsigned int len;
321};
322
323struct nfs_createargs {
324 struct nfs_fh * fh;
325 const char * name;
326 unsigned int len;
327 struct iattr * sattr;
328};
329
330struct nfs_renameargs {
331 struct nfs_fh * fromfh;
332 const char * fromname;
333 unsigned int fromlen;
334 struct nfs_fh * tofh;
335 const char * toname;
336 unsigned int tolen;
337};
338
339struct nfs_setattrargs {
340 struct nfs_fh * fh;
341 nfs4_stateid stateid;
342 struct iattr * iap;
343 const struct nfs_server * server; /* Needed for name mapping */
344 const u32 * bitmask;
345};
346
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000347struct nfs_setaclargs {
348 struct nfs_fh * fh;
349 size_t acl_len;
350 unsigned int acl_pgbase;
351 struct page ** acl_pages;
352};
353
J. Bruce Fields029d1052005-06-22 17:16:22 +0000354struct nfs_getaclargs {
355 struct nfs_fh * fh;
356 size_t acl_len;
357 unsigned int acl_pgbase;
358 struct page ** acl_pages;
359};
360
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361struct nfs_setattrres {
362 struct nfs_fattr * fattr;
363 const struct nfs_server * server;
364};
365
366struct nfs_linkargs {
367 struct nfs_fh * fromfh;
368 struct nfs_fh * tofh;
369 const char * toname;
370 unsigned int tolen;
371};
372
373struct nfs_symlinkargs {
374 struct nfs_fh * fromfh;
375 const char * fromname;
376 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400377 struct page ** pages;
378 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 struct iattr * sattr;
380};
381
382struct nfs_readdirargs {
383 struct nfs_fh * fh;
384 __u32 cookie;
385 unsigned int count;
386 struct page ** pages;
387};
388
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000389struct nfs3_getaclargs {
390 struct nfs_fh * fh;
391 int mask;
392 struct page ** pages;
393};
394
395struct nfs3_setaclargs {
396 struct inode * inode;
397 int mask;
398 struct posix_acl * acl_access;
399 struct posix_acl * acl_default;
400 struct page ** pages;
401};
402
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403struct nfs_diropok {
404 struct nfs_fh * fh;
405 struct nfs_fattr * fattr;
406};
407
408struct nfs_readlinkargs {
409 struct nfs_fh * fh;
410 unsigned int pgbase;
411 unsigned int pglen;
412 struct page ** pages;
413};
414
415struct nfs3_sattrargs {
416 struct nfs_fh * fh;
417 struct iattr * sattr;
418 unsigned int guard;
419 struct timespec guardtime;
420};
421
422struct nfs3_diropargs {
423 struct nfs_fh * fh;
424 const char * name;
425 unsigned int len;
426};
427
428struct nfs3_accessargs {
429 struct nfs_fh * fh;
430 __u32 access;
431};
432
433struct nfs3_createargs {
434 struct nfs_fh * fh;
435 const char * name;
436 unsigned int len;
437 struct iattr * sattr;
438 enum nfs3_createmode createmode;
Al Virobc4785c2006-10-19 23:28:51 -0700439 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440};
441
442struct nfs3_mkdirargs {
443 struct nfs_fh * fh;
444 const char * name;
445 unsigned int len;
446 struct iattr * sattr;
447};
448
449struct nfs3_symlinkargs {
450 struct nfs_fh * fromfh;
451 const char * fromname;
452 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400453 struct page ** pages;
454 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455 struct iattr * sattr;
456};
457
458struct nfs3_mknodargs {
459 struct nfs_fh * fh;
460 const char * name;
461 unsigned int len;
462 enum nfs3_ftype type;
463 struct iattr * sattr;
464 dev_t rdev;
465};
466
467struct nfs3_renameargs {
468 struct nfs_fh * fromfh;
469 const char * fromname;
470 unsigned int fromlen;
471 struct nfs_fh * tofh;
472 const char * toname;
473 unsigned int tolen;
474};
475
476struct nfs3_linkargs {
477 struct nfs_fh * fromfh;
478 struct nfs_fh * tofh;
479 const char * toname;
480 unsigned int tolen;
481};
482
483struct nfs3_readdirargs {
484 struct nfs_fh * fh;
485 __u64 cookie;
Al Virobc4785c2006-10-19 23:28:51 -0700486 __be32 verf[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700487 int plus;
488 unsigned int count;
489 struct page ** pages;
490};
491
492struct nfs3_diropres {
493 struct nfs_fattr * dir_attr;
494 struct nfs_fh * fh;
495 struct nfs_fattr * fattr;
496};
497
498struct nfs3_accessres {
499 struct nfs_fattr * fattr;
500 __u32 access;
501};
502
503struct nfs3_readlinkargs {
504 struct nfs_fh * fh;
505 unsigned int pgbase;
506 unsigned int pglen;
507 struct page ** pages;
508};
509
510struct nfs3_renameres {
511 struct nfs_fattr * fromattr;
512 struct nfs_fattr * toattr;
513};
514
515struct nfs3_linkres {
516 struct nfs_fattr * dir_attr;
517 struct nfs_fattr * fattr;
518};
519
520struct nfs3_readdirres {
521 struct nfs_fattr * dir_attr;
Al Virobc4785c2006-10-19 23:28:51 -0700522 __be32 * verf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523 int plus;
524};
525
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000526struct nfs3_getaclres {
527 struct nfs_fattr * fattr;
528 int mask;
529 unsigned int acl_access_count;
530 unsigned int acl_default_count;
531 struct posix_acl * acl_access;
532 struct posix_acl * acl_default;
533};
534
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535#ifdef CONFIG_NFS_V4
536
537typedef u64 clientid4;
538
539struct nfs4_accessargs {
540 const struct nfs_fh * fh;
Trond Myklebust76b32992007-08-10 17:45:11 -0400541 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 u32 access;
543};
544
545struct nfs4_accessres {
Trond Myklebust76b32992007-08-10 17:45:11 -0400546 const struct nfs_server * server;
547 struct nfs_fattr * fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548 u32 supported;
549 u32 access;
550};
551
552struct nfs4_create_arg {
553 u32 ftype;
554 union {
Chuck Lever94a6d752006-08-22 20:06:23 -0400555 struct {
556 struct page ** pages;
557 unsigned int len;
558 } symlink; /* NF4LNK */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 struct {
560 u32 specdata1;
561 u32 specdata2;
562 } device; /* NF4BLK, NF4CHR */
563 } u;
564 const struct qstr * name;
565 const struct nfs_server * server;
566 const struct iattr * attrs;
567 const struct nfs_fh * dir_fh;
568 const u32 * bitmask;
569};
570
571struct nfs4_create_res {
572 const struct nfs_server * server;
573 struct nfs_fh * fh;
574 struct nfs_fattr * fattr;
575 struct nfs4_change_info dir_cinfo;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400576 struct nfs_fattr * dir_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700577};
578
579struct nfs4_fsinfo_arg {
580 const struct nfs_fh * fh;
581 const u32 * bitmask;
582};
583
584struct nfs4_getattr_arg {
585 const struct nfs_fh * fh;
586 const u32 * bitmask;
587};
588
589struct nfs4_getattr_res {
590 const struct nfs_server * server;
591 struct nfs_fattr * fattr;
592};
593
594struct nfs4_link_arg {
595 const struct nfs_fh * fh;
596 const struct nfs_fh * dir_fh;
597 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400598 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599};
600
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400601struct nfs4_link_res {
602 const struct nfs_server * server;
603 struct nfs_fattr * fattr;
604 struct nfs4_change_info cinfo;
605 struct nfs_fattr * dir_attr;
606};
607
608
Linus Torvalds1da177e2005-04-16 15:20:36 -0700609struct nfs4_lookup_arg {
610 const struct nfs_fh * dir_fh;
611 const struct qstr * name;
612 const u32 * bitmask;
613};
614
615struct nfs4_lookup_res {
616 const struct nfs_server * server;
617 struct nfs_fattr * fattr;
618 struct nfs_fh * fh;
619};
620
621struct nfs4_lookup_root_arg {
622 const u32 * bitmask;
623};
624
625struct nfs4_pathconf_arg {
626 const struct nfs_fh * fh;
627 const u32 * bitmask;
628};
629
630struct nfs4_readdir_arg {
631 const struct nfs_fh * fh;
632 u64 cookie;
633 nfs4_verifier verifier;
634 u32 count;
635 struct page ** pages; /* zero-copy data */
636 unsigned int pgbase; /* zero-copy data */
637 const u32 * bitmask;
638};
639
640struct nfs4_readdir_res {
641 nfs4_verifier verifier;
642 unsigned int pgbase;
643};
644
645struct nfs4_readlink {
646 const struct nfs_fh * fh;
647 unsigned int pgbase;
648 unsigned int pglen; /* zero-copy data */
649 struct page ** pages; /* zero-copy data */
650};
651
Linus Torvalds1da177e2005-04-16 15:20:36 -0700652struct nfs4_rename_arg {
653 const struct nfs_fh * old_dir;
654 const struct nfs_fh * new_dir;
655 const struct qstr * old_name;
656 const struct qstr * new_name;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400657 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658};
659
660struct nfs4_rename_res {
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400661 const struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700662 struct nfs4_change_info old_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400663 struct nfs_fattr * old_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 struct nfs4_change_info new_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400665 struct nfs_fattr * new_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666};
667
668struct nfs4_setclientid {
669 const nfs4_verifier * sc_verifier; /* request */
670 unsigned int sc_name_len;
J. Bruce Fields3cedf132006-08-24 15:44:12 -0400671 char sc_name[48]; /* request */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700672 u32 sc_prog; /* request */
673 unsigned int sc_netid_len;
674 char sc_netid[4]; /* request */
675 unsigned int sc_uaddr_len;
676 char sc_uaddr[24]; /* request */
677 u32 sc_cb_ident; /* request */
678};
679
680struct nfs4_statfs_arg {
681 const struct nfs_fh * fh;
682 const u32 * bitmask;
683};
684
685struct nfs4_server_caps_res {
686 u32 attr_bitmask[2];
687 u32 acl_bitmask;
688 u32 has_links;
689 u32 has_symlinks;
690};
691
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400692struct nfs4_string {
693 unsigned int len;
694 char *data;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400695};
696
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400697#define NFS4_PATHNAME_MAXCOMPONENTS 512
698struct nfs4_pathname {
699 unsigned int ncomponents;
700 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
701};
702
703#define NFS4_FS_LOCATION_MAXSERVERS 10
704struct nfs4_fs_location {
705 unsigned int nservers;
706 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
707 struct nfs4_pathname rootpath;
708};
709
710#define NFS4_FS_LOCATIONS_MAXENTRIES 10
711struct nfs4_fs_locations {
Trond Myklebust683b57b2006-06-09 09:34:22 -0400712 struct nfs_fattr fattr;
713 const struct nfs_server *server;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400714 struct nfs4_pathname fs_path;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400715 int nlocations;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400716 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
Trond Myklebust683b57b2006-06-09 09:34:22 -0400717};
718
719struct nfs4_fs_locations_arg {
720 const struct nfs_fh *dir_fh;
721 const struct qstr *name;
722 struct page *page;
723 const u32 *bitmask;
724};
725
Linus Torvalds1da177e2005-04-16 15:20:36 -0700726#endif /* CONFIG_NFS_V4 */
727
728struct nfs_page;
729
Chuck Lever40859d72005-11-30 18:09:02 -0500730#define NFS_PAGEVEC_SIZE (8U)
731
Linus Torvalds1da177e2005-04-16 15:20:36 -0700732struct nfs_read_data {
733 int flags;
734 struct rpc_task task;
735 struct inode *inode;
736 struct rpc_cred *cred;
737 struct nfs_fattr fattr; /* fattr storage */
738 struct list_head pages; /* Coalesced read requests */
739 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500740 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -0700741 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742 struct nfs_readargs args;
743 struct nfs_readres res;
744#ifdef CONFIG_NFS_V4
745 unsigned long timestamp; /* For lease renewal */
746#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -0400747 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748};
749
750struct nfs_write_data {
751 int flags;
752 struct rpc_task task;
753 struct inode *inode;
754 struct rpc_cred *cred;
755 struct nfs_fattr fattr;
756 struct nfs_writeverf verf;
757 struct list_head pages; /* Coalesced requests we wish to flush */
758 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500759 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -0700760 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700761 struct nfs_writeargs args; /* argument struct */
762 struct nfs_writeres res; /* result struct */
763#ifdef CONFIG_NFS_V4
764 unsigned long timestamp; /* For lease renewal */
765#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -0400766 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767};
768
769struct nfs_access_entry;
770
771/*
772 * RPC procedure vector for NFSv2/NFSv3 demuxing
773 */
774struct nfs_rpc_ops {
775 int version; /* Protocol version */
776 struct dentry_operations *dentry_ops;
Arjan van de Venc5ef1c42007-02-12 00:55:40 -0800777 const struct inode_operations *dir_inode_ops;
778 const struct inode_operations *file_inode_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779
780 int (*getroot) (struct nfs_server *, struct nfs_fh *,
781 struct nfs_fsinfo *);
David Howells2b3de442006-08-22 20:06:09 -0400782 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
783 struct qstr *, struct nfs_fh *,
784 struct nfs_fattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785 int (*getattr) (struct nfs_server *, struct nfs_fh *,
786 struct nfs_fattr *);
787 int (*setattr) (struct dentry *, struct nfs_fattr *,
788 struct iattr *);
789 int (*lookup) (struct inode *, struct qstr *,
790 struct nfs_fh *, struct nfs_fattr *);
791 int (*access) (struct inode *, struct nfs_access_entry *);
792 int (*readlink)(struct inode *, struct page *, unsigned int,
793 unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700794 int (*create) (struct inode *, struct dentry *,
Trond Myklebust02a913a2005-10-18 14:20:17 -0700795 struct iattr *, int, struct nameidata *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796 int (*remove) (struct inode *, struct qstr *);
Trond Myklebuste4eff1a2007-07-14 15:39:58 -0400797 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
798 int (*unlink_done) (struct rpc_task *, struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799 int (*rename) (struct inode *, struct qstr *,
800 struct inode *, struct qstr *);
801 int (*link) (struct inode *, struct inode *, struct qstr *);
Chuck Lever94a6d752006-08-22 20:06:23 -0400802 int (*symlink) (struct inode *, struct dentry *, struct page *,
803 unsigned int, struct iattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
805 int (*rmdir) (struct inode *, struct qstr *);
806 int (*readdir) (struct dentry *, struct rpc_cred *,
807 u64, struct page *, unsigned int, int);
808 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
809 dev_t);
810 int (*statfs) (struct nfs_server *, struct nfs_fh *,
811 struct nfs_fsstat *);
812 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
813 struct nfs_fsinfo *);
814 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
815 struct nfs_pathconf *);
David Howellse9326dc2006-08-22 20:06:10 -0400816 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
Al Viro0dbb4c62006-10-19 23:28:49 -0700817 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700818 void (*read_setup) (struct nfs_read_data *);
Trond Myklebustec06c092006-03-20 13:44:27 -0500819 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820 void (*write_setup) (struct nfs_write_data *, int how);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500821 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700822 void (*commit_setup) (struct nfs_write_data *, int how);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500823 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824 int (*file_open) (struct inode *, struct file *);
825 int (*file_release) (struct inode *, struct file *);
826 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +0000827 void (*clear_acl_cache)(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700828};
829
830/*
831 * NFS_CALL(getattr, inode, (fattr));
832 * into
833 * NFS_PROTO(inode)->getattr(fattr);
834 */
835#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
836
837/*
838 * Function vectors etc. for the NFS client
839 */
David Howells509de812006-08-22 20:06:11 -0400840extern const struct nfs_rpc_ops nfs_v2_clientops;
841extern const struct nfs_rpc_ops nfs_v3_clientops;
842extern const struct nfs_rpc_ops nfs_v4_clientops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700843extern struct rpc_version nfs_version2;
844extern struct rpc_version nfs_version3;
845extern struct rpc_version nfs_version4;
846
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000847extern struct rpc_version nfsacl_version3;
848extern struct rpc_program nfsacl_program;
849
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850#endif