blob: a550b528319f9db55eff12b3d84dcee03da4cc0e [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;
Richard Kennedy9fa8d662008-08-26 16:23:20 +010039 dev_t rdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 __u64 size;
41 union {
42 struct {
43 __u32 blocksize;
44 __u32 blocks;
45 } nfs2;
46 struct {
47 __u64 used;
48 } nfs3;
49 } du;
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;
Trond Myklebust4704f0e2008-10-14 19:16:07 -040059 unsigned long gencount;
Linus Torvalds1da177e2005-04-16 15:20:36 -070060};
61
62#define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
63#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
64#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
Trond Myklebust73a3d072006-05-25 01:40:47 -040065#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */
Trond Myklebust70ca8852007-09-30 15:21:24 -040066#define NFS_ATTR_WCC_V4 0x0010 /* pre-op change attribute */
67#define NFS_ATTR_FATTR_V4_REFERRAL 0x0020 /* NFSv4 referral */
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
69/*
70 * Info on the file system
71 */
72struct nfs_fsinfo {
73 struct nfs_fattr *fattr; /* Post-op attributes */
74 __u32 rtmax; /* max. read transfer size */
75 __u32 rtpref; /* pref. read transfer size */
76 __u32 rtmult; /* reads should be multiple of this */
77 __u32 wtmax; /* max. write transfer size */
78 __u32 wtpref; /* pref. write transfer size */
79 __u32 wtmult; /* writes should be multiple of this */
80 __u32 dtpref; /* pref. readdir transfer size */
81 __u64 maxfilesize;
82 __u32 lease_time; /* in seconds */
83};
84
85struct nfs_fsstat {
86 struct nfs_fattr *fattr; /* Post-op attributes */
87 __u64 tbytes; /* total size in bytes */
88 __u64 fbytes; /* # of free bytes */
89 __u64 abytes; /* # of bytes available to user */
90 __u64 tfiles; /* # of files */
91 __u64 ffiles; /* # of free files */
92 __u64 afiles; /* # of files available to user */
93};
94
95struct nfs2_fsstat {
96 __u32 tsize; /* Server transfer size */
97 __u32 bsize; /* Filesystem block size */
98 __u32 blocks; /* No. of "bsize" blocks on filesystem */
99 __u32 bfree; /* No. of free "bsize" blocks */
100 __u32 bavail; /* No. of available "bsize" blocks */
101};
102
103struct nfs_pathconf {
104 struct nfs_fattr *fattr; /* Post-op attributes */
105 __u32 max_link; /* max # of hard links */
106 __u32 max_namelen; /* max name length */
107};
108
109struct nfs4_change_info {
110 u32 atomic;
111 u64 before;
112 u64 after;
113};
114
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700115struct nfs_seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116/*
117 * Arguments to the open call.
118 */
119struct nfs_openargs {
120 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700121 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 int open_flags;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500123 fmode_t fmode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400125 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126 union {
127 struct iattr * attrs; /* UNCHECKED, GUARDED */
128 nfs4_verifier verifier; /* EXCLUSIVE */
129 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500130 fmode_t delegation_type; /* CLAIM_PREVIOUS */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 } u;
132 const struct qstr * name;
133 const struct nfs_server *server; /* Needed for ID mapping */
134 const u32 * bitmask;
135 __u32 claim;
136};
137
138struct nfs_openres {
139 nfs4_stateid stateid;
140 struct nfs_fh fh;
141 struct nfs4_change_info cinfo;
142 __u32 rflags;
143 struct nfs_fattr * f_attr;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400144 struct nfs_fattr * dir_attr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400145 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 const struct nfs_server *server;
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500147 fmode_t delegation_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 nfs4_stateid delegation;
149 __u32 do_recall;
150 __u64 maxsize;
Jeff Laytonaa53ed52007-06-05 14:49:03 -0400151 __u32 attrset[NFS4_BITMAP_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152};
153
154/*
155 * Arguments to the open_confirm call.
156 */
157struct nfs_open_confirmargs {
158 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100159 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700160 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161};
162
163struct nfs_open_confirmres {
164 nfs4_stateid stateid;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400165 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166};
167
168/*
169 * Arguments to the close call.
170 */
171struct nfs_closeargs {
172 struct nfs_fh * fh;
Trond Myklebust95121352005-10-18 14:20:12 -0700173 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700174 struct nfs_seqid * seqid;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500175 fmode_t fmode;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400176 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700177};
178
179struct nfs_closeres {
180 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400181 struct nfs_fattr * fattr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400182 struct nfs_seqid * seqid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400183 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184};
185/*
186 * * Arguments to the lock,lockt, and locku call.
187 * */
188struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100189 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400190 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700191};
192
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100193struct nfs_lock_args {
194 struct nfs_fh * fh;
195 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700196 struct nfs_seqid * lock_seqid;
197 nfs4_stateid * lock_stateid;
198 struct nfs_seqid * open_seqid;
199 nfs4_stateid * open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100200 struct nfs_lowner lock_owner;
201 unsigned char block : 1;
202 unsigned char reclaim : 1;
203 unsigned char new_lock_owner : 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700204};
205
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100206struct nfs_lock_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400207 nfs4_stateid stateid;
208 struct nfs_seqid * lock_seqid;
209 struct nfs_seqid * open_seqid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100210};
211
212struct nfs_locku_args {
213 struct nfs_fh * fh;
214 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700215 struct nfs_seqid * seqid;
Trond Myklebustfaf5f492005-10-18 14:20:15 -0700216 nfs4_stateid * stateid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217};
218
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100219struct nfs_locku_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400220 nfs4_stateid stateid;
221 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222};
223
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100224struct nfs_lockt_args {
225 struct nfs_fh * fh;
226 struct file_lock * fl;
227 struct nfs_lowner lock_owner;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228};
229
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100230struct nfs_lockt_res {
231 struct file_lock * denied; /* LOCK, LOCKT failed */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232};
233
234struct nfs4_delegreturnargs {
235 const struct nfs_fh *fhandle;
236 const nfs4_stateid *stateid;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100237 const u32 * bitmask;
238};
239
240struct nfs4_delegreturnres {
241 struct nfs_fattr * fattr;
242 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243};
244
245/*
246 * Arguments to the read call.
247 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700248struct nfs_readargs {
249 struct nfs_fh * fh;
250 struct nfs_open_context *context;
251 __u64 offset;
252 __u32 count;
253 unsigned int pgbase;
254 struct page ** pages;
255};
256
257struct nfs_readres {
258 struct nfs_fattr * fattr;
259 __u32 count;
260 int eof;
261};
262
263/*
264 * Arguments to the write call.
265 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700266struct nfs_writeargs {
267 struct nfs_fh * fh;
268 struct nfs_open_context *context;
269 __u64 offset;
270 __u32 count;
271 enum nfs3_stable_how stable;
272 unsigned int pgbase;
273 struct page ** pages;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400274 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275};
276
277struct nfs_writeverf {
278 enum nfs3_stable_how committed;
Al Virobc4785c2006-10-19 23:28:51 -0700279 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280};
281
282struct nfs_writeres {
283 struct nfs_fattr * fattr;
284 struct nfs_writeverf * verf;
285 __u32 count;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400286 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287};
288
289/*
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400290 * Common arguments to the unlink call
291 */
292struct nfs_removeargs {
293 const struct nfs_fh *fh;
294 struct qstr name;
295 const u32 * bitmask;
296};
297
298struct nfs_removeres {
299 const struct nfs_server *server;
300 struct nfs4_change_info cinfo;
301 struct nfs_fattr dir_attr;
302};
303
304/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305 * Argument struct for decode_entry function
306 */
307struct nfs_entry {
308 __u64 ino;
309 __u64 cookie,
310 prev_cookie;
311 const char * name;
312 unsigned int len;
313 int eof;
314 struct nfs_fh * fh;
315 struct nfs_fattr * fattr;
316};
317
318/*
319 * The following types are for NFSv2 only.
320 */
321struct nfs_sattrargs {
322 struct nfs_fh * fh;
323 struct iattr * sattr;
324};
325
326struct nfs_diropargs {
327 struct nfs_fh * fh;
328 const char * name;
329 unsigned int len;
330};
331
332struct nfs_createargs {
333 struct nfs_fh * fh;
334 const char * name;
335 unsigned int len;
336 struct iattr * sattr;
337};
338
339struct nfs_renameargs {
340 struct nfs_fh * fromfh;
341 const char * fromname;
342 unsigned int fromlen;
343 struct nfs_fh * tofh;
344 const char * toname;
345 unsigned int tolen;
346};
347
348struct nfs_setattrargs {
349 struct nfs_fh * fh;
350 nfs4_stateid stateid;
351 struct iattr * iap;
352 const struct nfs_server * server; /* Needed for name mapping */
353 const u32 * bitmask;
354};
355
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000356struct nfs_setaclargs {
357 struct nfs_fh * fh;
358 size_t acl_len;
359 unsigned int acl_pgbase;
360 struct page ** acl_pages;
361};
362
J. Bruce Fields029d1052005-06-22 17:16:22 +0000363struct nfs_getaclargs {
364 struct nfs_fh * fh;
365 size_t acl_len;
366 unsigned int acl_pgbase;
367 struct page ** acl_pages;
368};
369
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370struct nfs_setattrres {
371 struct nfs_fattr * fattr;
372 const struct nfs_server * server;
373};
374
375struct nfs_linkargs {
376 struct nfs_fh * fromfh;
377 struct nfs_fh * tofh;
378 const char * toname;
379 unsigned int tolen;
380};
381
382struct nfs_symlinkargs {
383 struct nfs_fh * fromfh;
384 const char * fromname;
385 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400386 struct page ** pages;
387 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388 struct iattr * sattr;
389};
390
391struct nfs_readdirargs {
392 struct nfs_fh * fh;
393 __u32 cookie;
394 unsigned int count;
395 struct page ** pages;
396};
397
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000398struct nfs3_getaclargs {
399 struct nfs_fh * fh;
400 int mask;
401 struct page ** pages;
402};
403
404struct nfs3_setaclargs {
405 struct inode * inode;
406 int mask;
407 struct posix_acl * acl_access;
408 struct posix_acl * acl_default;
409 struct page ** pages;
410};
411
Linus Torvalds1da177e2005-04-16 15:20:36 -0700412struct nfs_diropok {
413 struct nfs_fh * fh;
414 struct nfs_fattr * fattr;
415};
416
417struct nfs_readlinkargs {
418 struct nfs_fh * fh;
419 unsigned int pgbase;
420 unsigned int pglen;
421 struct page ** pages;
422};
423
424struct nfs3_sattrargs {
425 struct nfs_fh * fh;
426 struct iattr * sattr;
427 unsigned int guard;
428 struct timespec guardtime;
429};
430
431struct nfs3_diropargs {
432 struct nfs_fh * fh;
433 const char * name;
434 unsigned int len;
435};
436
437struct nfs3_accessargs {
438 struct nfs_fh * fh;
439 __u32 access;
440};
441
442struct nfs3_createargs {
443 struct nfs_fh * fh;
444 const char * name;
445 unsigned int len;
446 struct iattr * sattr;
447 enum nfs3_createmode createmode;
Al Virobc4785c2006-10-19 23:28:51 -0700448 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449};
450
451struct nfs3_mkdirargs {
452 struct nfs_fh * fh;
453 const char * name;
454 unsigned int len;
455 struct iattr * sattr;
456};
457
458struct nfs3_symlinkargs {
459 struct nfs_fh * fromfh;
460 const char * fromname;
461 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400462 struct page ** pages;
463 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 struct iattr * sattr;
465};
466
467struct nfs3_mknodargs {
468 struct nfs_fh * fh;
469 const char * name;
470 unsigned int len;
471 enum nfs3_ftype type;
472 struct iattr * sattr;
473 dev_t rdev;
474};
475
476struct nfs3_renameargs {
477 struct nfs_fh * fromfh;
478 const char * fromname;
479 unsigned int fromlen;
480 struct nfs_fh * tofh;
481 const char * toname;
482 unsigned int tolen;
483};
484
485struct nfs3_linkargs {
486 struct nfs_fh * fromfh;
487 struct nfs_fh * tofh;
488 const char * toname;
489 unsigned int tolen;
490};
491
492struct nfs3_readdirargs {
493 struct nfs_fh * fh;
494 __u64 cookie;
Al Virobc4785c2006-10-19 23:28:51 -0700495 __be32 verf[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496 int plus;
497 unsigned int count;
498 struct page ** pages;
499};
500
501struct nfs3_diropres {
502 struct nfs_fattr * dir_attr;
503 struct nfs_fh * fh;
504 struct nfs_fattr * fattr;
505};
506
507struct nfs3_accessres {
508 struct nfs_fattr * fattr;
509 __u32 access;
510};
511
512struct nfs3_readlinkargs {
513 struct nfs_fh * fh;
514 unsigned int pgbase;
515 unsigned int pglen;
516 struct page ** pages;
517};
518
519struct nfs3_renameres {
520 struct nfs_fattr * fromattr;
521 struct nfs_fattr * toattr;
522};
523
524struct nfs3_linkres {
525 struct nfs_fattr * dir_attr;
526 struct nfs_fattr * fattr;
527};
528
529struct nfs3_readdirres {
530 struct nfs_fattr * dir_attr;
Al Virobc4785c2006-10-19 23:28:51 -0700531 __be32 * verf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700532 int plus;
533};
534
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000535struct nfs3_getaclres {
536 struct nfs_fattr * fattr;
537 int mask;
538 unsigned int acl_access_count;
539 unsigned int acl_default_count;
540 struct posix_acl * acl_access;
541 struct posix_acl * acl_default;
542};
543
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544#ifdef CONFIG_NFS_V4
545
546typedef u64 clientid4;
547
548struct nfs4_accessargs {
549 const struct nfs_fh * fh;
Trond Myklebust76b32992007-08-10 17:45:11 -0400550 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551 u32 access;
552};
553
554struct nfs4_accessres {
Trond Myklebust76b32992007-08-10 17:45:11 -0400555 const struct nfs_server * server;
556 struct nfs_fattr * fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700557 u32 supported;
558 u32 access;
559};
560
561struct nfs4_create_arg {
562 u32 ftype;
563 union {
Chuck Lever94a6d752006-08-22 20:06:23 -0400564 struct {
565 struct page ** pages;
566 unsigned int len;
567 } symlink; /* NF4LNK */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700568 struct {
569 u32 specdata1;
570 u32 specdata2;
571 } device; /* NF4BLK, NF4CHR */
572 } u;
573 const struct qstr * name;
574 const struct nfs_server * server;
575 const struct iattr * attrs;
576 const struct nfs_fh * dir_fh;
577 const u32 * bitmask;
578};
579
580struct nfs4_create_res {
581 const struct nfs_server * server;
582 struct nfs_fh * fh;
583 struct nfs_fattr * fattr;
584 struct nfs4_change_info dir_cinfo;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400585 struct nfs_fattr * dir_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586};
587
588struct nfs4_fsinfo_arg {
589 const struct nfs_fh * fh;
590 const u32 * bitmask;
591};
592
593struct nfs4_getattr_arg {
594 const struct nfs_fh * fh;
595 const u32 * bitmask;
596};
597
598struct nfs4_getattr_res {
599 const struct nfs_server * server;
600 struct nfs_fattr * fattr;
601};
602
603struct nfs4_link_arg {
604 const struct nfs_fh * fh;
605 const struct nfs_fh * dir_fh;
606 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400607 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608};
609
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400610struct nfs4_link_res {
611 const struct nfs_server * server;
612 struct nfs_fattr * fattr;
613 struct nfs4_change_info cinfo;
614 struct nfs_fattr * dir_attr;
615};
616
617
Linus Torvalds1da177e2005-04-16 15:20:36 -0700618struct nfs4_lookup_arg {
619 const struct nfs_fh * dir_fh;
620 const struct qstr * name;
621 const u32 * bitmask;
622};
623
624struct nfs4_lookup_res {
625 const struct nfs_server * server;
626 struct nfs_fattr * fattr;
627 struct nfs_fh * fh;
628};
629
630struct nfs4_lookup_root_arg {
631 const u32 * bitmask;
632};
633
634struct nfs4_pathconf_arg {
635 const struct nfs_fh * fh;
636 const u32 * bitmask;
637};
638
639struct nfs4_readdir_arg {
640 const struct nfs_fh * fh;
641 u64 cookie;
642 nfs4_verifier verifier;
643 u32 count;
644 struct page ** pages; /* zero-copy data */
645 unsigned int pgbase; /* zero-copy data */
646 const u32 * bitmask;
647};
648
649struct nfs4_readdir_res {
650 nfs4_verifier verifier;
651 unsigned int pgbase;
652};
653
654struct nfs4_readlink {
655 const struct nfs_fh * fh;
656 unsigned int pgbase;
657 unsigned int pglen; /* zero-copy data */
658 struct page ** pages; /* zero-copy data */
659};
660
Linus Torvalds1da177e2005-04-16 15:20:36 -0700661struct nfs4_rename_arg {
662 const struct nfs_fh * old_dir;
663 const struct nfs_fh * new_dir;
664 const struct qstr * old_name;
665 const struct qstr * new_name;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400666 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667};
668
669struct nfs4_rename_res {
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400670 const struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 struct nfs4_change_info old_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400672 struct nfs_fattr * old_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673 struct nfs4_change_info new_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400674 struct nfs_fattr * new_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675};
676
Trond Myklebust19d771f2008-10-08 13:54:52 -0400677#define NFS4_SETCLIENTID_NAMELEN (127)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678struct nfs4_setclientid {
Chuck Levercc38bac2007-12-10 14:56:54 -0500679 const nfs4_verifier * sc_verifier;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680 unsigned int sc_name_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400681 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500682 u32 sc_prog;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 unsigned int sc_netid_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400684 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685 unsigned int sc_uaddr_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400686 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500687 u32 sc_cb_ident;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688};
689
690struct nfs4_statfs_arg {
691 const struct nfs_fh * fh;
692 const u32 * bitmask;
693};
694
695struct nfs4_server_caps_res {
696 u32 attr_bitmask[2];
697 u32 acl_bitmask;
698 u32 has_links;
699 u32 has_symlinks;
700};
701
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400702struct nfs4_string {
703 unsigned int len;
704 char *data;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400705};
706
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400707#define NFS4_PATHNAME_MAXCOMPONENTS 512
708struct nfs4_pathname {
709 unsigned int ncomponents;
710 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
711};
712
713#define NFS4_FS_LOCATION_MAXSERVERS 10
714struct nfs4_fs_location {
715 unsigned int nservers;
716 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
717 struct nfs4_pathname rootpath;
718};
719
720#define NFS4_FS_LOCATIONS_MAXENTRIES 10
721struct nfs4_fs_locations {
Trond Myklebust683b57b2006-06-09 09:34:22 -0400722 struct nfs_fattr fattr;
723 const struct nfs_server *server;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400724 struct nfs4_pathname fs_path;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400725 int nlocations;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400726 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
Trond Myklebust683b57b2006-06-09 09:34:22 -0400727};
728
729struct nfs4_fs_locations_arg {
730 const struct nfs_fh *dir_fh;
731 const struct qstr *name;
732 struct page *page;
733 const u32 *bitmask;
734};
735
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736#endif /* CONFIG_NFS_V4 */
737
738struct nfs_page;
739
Chuck Lever40859d72005-11-30 18:09:02 -0500740#define NFS_PAGEVEC_SIZE (8U)
741
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742struct nfs_read_data {
743 int flags;
744 struct rpc_task task;
745 struct inode *inode;
746 struct rpc_cred *cred;
747 struct nfs_fattr fattr; /* fattr storage */
748 struct list_head pages; /* Coalesced read requests */
749 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500750 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -0700751 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752 struct nfs_readargs args;
753 struct nfs_readres res;
754#ifdef CONFIG_NFS_V4
755 unsigned long timestamp; /* For lease renewal */
756#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -0400757 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700758};
759
760struct nfs_write_data {
761 int flags;
762 struct rpc_task task;
763 struct inode *inode;
764 struct rpc_cred *cred;
765 struct nfs_fattr fattr;
766 struct nfs_writeverf verf;
767 struct list_head pages; /* Coalesced requests we wish to flush */
768 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500769 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -0700770 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771 struct nfs_writeargs args; /* argument struct */
772 struct nfs_writeres res; /* result struct */
773#ifdef CONFIG_NFS_V4
774 unsigned long timestamp; /* For lease renewal */
775#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -0400776 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700777};
778
779struct nfs_access_entry;
780
781/*
782 * RPC procedure vector for NFSv2/NFSv3 demuxing
783 */
784struct nfs_rpc_ops {
Chuck Leverc0e07cb2008-01-14 12:32:05 -0500785 u32 version; /* Protocol version */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786 struct dentry_operations *dentry_ops;
Arjan van de Venc5ef1c42007-02-12 00:55:40 -0800787 const struct inode_operations *dir_inode_ops;
788 const struct inode_operations *file_inode_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789
790 int (*getroot) (struct nfs_server *, struct nfs_fh *,
791 struct nfs_fsinfo *);
David Howells2b3de442006-08-22 20:06:09 -0400792 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
793 struct qstr *, struct nfs_fh *,
794 struct nfs_fattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795 int (*getattr) (struct nfs_server *, struct nfs_fh *,
796 struct nfs_fattr *);
797 int (*setattr) (struct dentry *, struct nfs_fattr *,
798 struct iattr *);
799 int (*lookup) (struct inode *, struct qstr *,
800 struct nfs_fh *, struct nfs_fattr *);
801 int (*access) (struct inode *, struct nfs_access_entry *);
802 int (*readlink)(struct inode *, struct page *, unsigned int,
803 unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 int (*create) (struct inode *, struct dentry *,
Trond Myklebust02a913a2005-10-18 14:20:17 -0700805 struct iattr *, int, struct nameidata *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 int (*remove) (struct inode *, struct qstr *);
Trond Myklebuste4eff1a2007-07-14 15:39:58 -0400807 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
808 int (*unlink_done) (struct rpc_task *, struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809 int (*rename) (struct inode *, struct qstr *,
810 struct inode *, struct qstr *);
811 int (*link) (struct inode *, struct inode *, struct qstr *);
Chuck Lever94a6d752006-08-22 20:06:23 -0400812 int (*symlink) (struct inode *, struct dentry *, struct page *,
813 unsigned int, struct iattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
815 int (*rmdir) (struct inode *, struct qstr *);
816 int (*readdir) (struct dentry *, struct rpc_cred *,
817 u64, struct page *, unsigned int, int);
818 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
819 dev_t);
820 int (*statfs) (struct nfs_server *, struct nfs_fh *,
821 struct nfs_fsstat *);
822 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
823 struct nfs_fsinfo *);
824 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
825 struct nfs_pathconf *);
David Howellse9326dc2006-08-22 20:06:10 -0400826 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
Al Viro0dbb4c62006-10-19 23:28:49 -0700827 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
Trond Myklebustbdc7f022007-07-14 15:40:00 -0400828 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
Trond Myklebustec06c092006-03-20 13:44:27 -0500829 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -0400830 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500831 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -0400832 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500833 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700834 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebust21162712008-05-20 19:34:39 -0400835 int (*lock_check_bounds)(const struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +0000836 void (*clear_acl_cache)(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700837};
838
839/*
840 * NFS_CALL(getattr, inode, (fattr));
841 * into
842 * NFS_PROTO(inode)->getattr(fattr);
843 */
844#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
845
846/*
847 * Function vectors etc. for the NFS client
848 */
David Howells509de812006-08-22 20:06:11 -0400849extern const struct nfs_rpc_ops nfs_v2_clientops;
850extern const struct nfs_rpc_ops nfs_v3_clientops;
851extern const struct nfs_rpc_ops nfs_v4_clientops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852extern struct rpc_version nfs_version2;
853extern struct rpc_version nfs_version3;
854extern struct rpc_version nfs_version4;
855
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000856extern struct rpc_version nfsacl_version3;
857extern struct rpc_program nfsacl_program;
858
Linus Torvalds1da177e2005-04-16 15:20:36 -0700859#endif