blob: 6013acb0131ff646e7dd19c7e8959f60fed6b1ed [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 {
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040030 unsigned int valid; /* which fields are valid */
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 enum nfs_ftype type; /* always use NFSv2 types */
32 __u32 mode;
33 __u32 nlink;
34 __u32 uid;
35 __u32 gid;
Richard Kennedy9fa8d662008-08-26 16:23:20 +010036 dev_t rdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 __u64 size;
38 union {
39 struct {
40 __u32 blocksize;
41 __u32 blocks;
42 } nfs2;
43 struct {
44 __u64 used;
45 } nfs3;
46 } du;
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040047 struct nfs_fsid fsid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 __u64 fileid;
49 struct timespec atime;
50 struct timespec mtime;
51 struct timespec ctime;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 __u64 change_attr; /* NFSv4 change attribute */
53 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
Trond Myklebust1ca277d2009-03-11 14:10:25 -040054 __u64 pre_size; /* pre_op_attr.size */
55 struct timespec pre_mtime; /* pre_op_attr.mtime */
56 struct timespec pre_ctime; /* pre_op_attr.ctime */
Trond Myklebust33801142005-10-27 22:12:39 -040057 unsigned long time_start;
Trond Myklebust4704f0e2008-10-14 19:16:07 -040058 unsigned long gencount;
Linus Torvalds1da177e2005-04-16 15:20:36 -070059};
60
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040061#define NFS_ATTR_FATTR_TYPE (1U << 0)
62#define NFS_ATTR_FATTR_MODE (1U << 1)
63#define NFS_ATTR_FATTR_NLINK (1U << 2)
64#define NFS_ATTR_FATTR_OWNER (1U << 3)
65#define NFS_ATTR_FATTR_GROUP (1U << 4)
66#define NFS_ATTR_FATTR_RDEV (1U << 5)
67#define NFS_ATTR_FATTR_SIZE (1U << 6)
68#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
69#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
70#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
71#define NFS_ATTR_FATTR_FSID (1U << 10)
72#define NFS_ATTR_FATTR_FILEID (1U << 11)
73#define NFS_ATTR_FATTR_ATIME (1U << 12)
74#define NFS_ATTR_FATTR_MTIME (1U << 13)
75#define NFS_ATTR_FATTR_CTIME (1U << 14)
76#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
77#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
78#define NFS_ATTR_FATTR_CHANGE (1U << 17)
79#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
80#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
81
82#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
83 | NFS_ATTR_FATTR_MODE \
84 | NFS_ATTR_FATTR_NLINK \
85 | NFS_ATTR_FATTR_OWNER \
86 | NFS_ATTR_FATTR_GROUP \
87 | NFS_ATTR_FATTR_RDEV \
88 | NFS_ATTR_FATTR_SIZE \
89 | NFS_ATTR_FATTR_FSID \
90 | NFS_ATTR_FATTR_FILEID \
91 | NFS_ATTR_FATTR_ATIME \
92 | NFS_ATTR_FATTR_MTIME \
93 | NFS_ATTR_FATTR_CTIME)
94#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
95 | NFS_ATTR_FATTR_BLOCKS_USED)
96#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
97 | NFS_ATTR_FATTR_SPACE_USED)
98#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
99 | NFS_ATTR_FATTR_SPACE_USED \
100 | NFS_ATTR_FATTR_CHANGE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
102/*
103 * Info on the file system
104 */
105struct nfs_fsinfo {
106 struct nfs_fattr *fattr; /* Post-op attributes */
107 __u32 rtmax; /* max. read transfer size */
108 __u32 rtpref; /* pref. read transfer size */
109 __u32 rtmult; /* reads should be multiple of this */
110 __u32 wtmax; /* max. write transfer size */
111 __u32 wtpref; /* pref. write transfer size */
112 __u32 wtmult; /* writes should be multiple of this */
113 __u32 dtpref; /* pref. readdir transfer size */
114 __u64 maxfilesize;
115 __u32 lease_time; /* in seconds */
116};
117
118struct nfs_fsstat {
119 struct nfs_fattr *fattr; /* Post-op attributes */
120 __u64 tbytes; /* total size in bytes */
121 __u64 fbytes; /* # of free bytes */
122 __u64 abytes; /* # of bytes available to user */
123 __u64 tfiles; /* # of files */
124 __u64 ffiles; /* # of free files */
125 __u64 afiles; /* # of files available to user */
126};
127
128struct nfs2_fsstat {
129 __u32 tsize; /* Server transfer size */
130 __u32 bsize; /* Filesystem block size */
131 __u32 blocks; /* No. of "bsize" blocks on filesystem */
132 __u32 bfree; /* No. of free "bsize" blocks */
133 __u32 bavail; /* No. of available "bsize" blocks */
134};
135
136struct nfs_pathconf {
137 struct nfs_fattr *fattr; /* Post-op attributes */
138 __u32 max_link; /* max # of hard links */
139 __u32 max_namelen; /* max name length */
140};
141
142struct nfs4_change_info {
143 u32 atomic;
144 u64 before;
145 u64 after;
146};
147
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700148struct nfs_seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149/*
150 * Arguments to the open call.
151 */
152struct nfs_openargs {
153 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700154 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 int open_flags;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500156 fmode_t fmode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400158 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 union {
160 struct iattr * attrs; /* UNCHECKED, GUARDED */
161 nfs4_verifier verifier; /* EXCLUSIVE */
162 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500163 fmode_t delegation_type; /* CLAIM_PREVIOUS */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 } u;
165 const struct qstr * name;
166 const struct nfs_server *server; /* Needed for ID mapping */
167 const u32 * bitmask;
168 __u32 claim;
169};
170
171struct nfs_openres {
172 nfs4_stateid stateid;
173 struct nfs_fh fh;
174 struct nfs4_change_info cinfo;
175 __u32 rflags;
176 struct nfs_fattr * f_attr;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400177 struct nfs_fattr * dir_attr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400178 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179 const struct nfs_server *server;
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500180 fmode_t delegation_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 nfs4_stateid delegation;
182 __u32 do_recall;
183 __u64 maxsize;
Jeff Laytonaa53ed52007-06-05 14:49:03 -0400184 __u32 attrset[NFS4_BITMAP_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185};
186
187/*
188 * Arguments to the open_confirm call.
189 */
190struct nfs_open_confirmargs {
191 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100192 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700193 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194};
195
196struct nfs_open_confirmres {
197 nfs4_stateid stateid;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400198 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199};
200
201/*
202 * Arguments to the close call.
203 */
204struct nfs_closeargs {
205 struct nfs_fh * fh;
Trond Myklebust95121352005-10-18 14:20:12 -0700206 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700207 struct nfs_seqid * seqid;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500208 fmode_t fmode;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400209 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210};
211
212struct nfs_closeres {
213 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400214 struct nfs_fattr * fattr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400215 struct nfs_seqid * seqid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400216 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700217};
218/*
219 * * Arguments to the lock,lockt, and locku call.
220 * */
221struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100222 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400223 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224};
225
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100226struct nfs_lock_args {
227 struct nfs_fh * fh;
228 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700229 struct nfs_seqid * lock_seqid;
230 nfs4_stateid * lock_stateid;
231 struct nfs_seqid * open_seqid;
232 nfs4_stateid * open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100233 struct nfs_lowner lock_owner;
234 unsigned char block : 1;
235 unsigned char reclaim : 1;
236 unsigned char new_lock_owner : 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237};
238
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100239struct nfs_lock_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400240 nfs4_stateid stateid;
241 struct nfs_seqid * lock_seqid;
242 struct nfs_seqid * open_seqid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100243};
244
245struct nfs_locku_args {
246 struct nfs_fh * fh;
247 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700248 struct nfs_seqid * seqid;
Trond Myklebustfaf5f492005-10-18 14:20:15 -0700249 nfs4_stateid * stateid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250};
251
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100252struct nfs_locku_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400253 nfs4_stateid stateid;
254 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255};
256
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100257struct nfs_lockt_args {
258 struct nfs_fh * fh;
259 struct file_lock * fl;
260 struct nfs_lowner lock_owner;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261};
262
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100263struct nfs_lockt_res {
264 struct file_lock * denied; /* LOCK, LOCKT failed */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265};
266
267struct nfs4_delegreturnargs {
268 const struct nfs_fh *fhandle;
269 const nfs4_stateid *stateid;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100270 const u32 * bitmask;
271};
272
273struct nfs4_delegreturnres {
274 struct nfs_fattr * fattr;
275 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276};
277
278/*
279 * Arguments to the read call.
280 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281struct nfs_readargs {
282 struct nfs_fh * fh;
283 struct nfs_open_context *context;
284 __u64 offset;
285 __u32 count;
286 unsigned int pgbase;
287 struct page ** pages;
288};
289
290struct nfs_readres {
291 struct nfs_fattr * fattr;
292 __u32 count;
293 int eof;
294};
295
296/*
297 * Arguments to the write call.
298 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299struct nfs_writeargs {
300 struct nfs_fh * fh;
301 struct nfs_open_context *context;
302 __u64 offset;
303 __u32 count;
304 enum nfs3_stable_how stable;
305 unsigned int pgbase;
306 struct page ** pages;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400307 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308};
309
310struct nfs_writeverf {
311 enum nfs3_stable_how committed;
Al Virobc4785c2006-10-19 23:28:51 -0700312 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313};
314
315struct nfs_writeres {
316 struct nfs_fattr * fattr;
317 struct nfs_writeverf * verf;
318 __u32 count;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400319 const struct nfs_server *server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320};
321
322/*
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400323 * Common arguments to the unlink call
324 */
325struct nfs_removeargs {
326 const struct nfs_fh *fh;
327 struct qstr name;
328 const u32 * bitmask;
329};
330
331struct nfs_removeres {
332 const struct nfs_server *server;
333 struct nfs4_change_info cinfo;
334 struct nfs_fattr dir_attr;
335};
336
337/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338 * Argument struct for decode_entry function
339 */
340struct nfs_entry {
341 __u64 ino;
342 __u64 cookie,
343 prev_cookie;
344 const char * name;
345 unsigned int len;
346 int eof;
347 struct nfs_fh * fh;
348 struct nfs_fattr * fattr;
349};
350
351/*
352 * The following types are for NFSv2 only.
353 */
354struct nfs_sattrargs {
355 struct nfs_fh * fh;
356 struct iattr * sattr;
357};
358
359struct nfs_diropargs {
360 struct nfs_fh * fh;
361 const char * name;
362 unsigned int len;
363};
364
365struct nfs_createargs {
366 struct nfs_fh * fh;
367 const char * name;
368 unsigned int len;
369 struct iattr * sattr;
370};
371
372struct nfs_renameargs {
373 struct nfs_fh * fromfh;
374 const char * fromname;
375 unsigned int fromlen;
376 struct nfs_fh * tofh;
377 const char * toname;
378 unsigned int tolen;
379};
380
381struct nfs_setattrargs {
382 struct nfs_fh * fh;
383 nfs4_stateid stateid;
384 struct iattr * iap;
385 const struct nfs_server * server; /* Needed for name mapping */
386 const u32 * bitmask;
387};
388
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000389struct nfs_setaclargs {
390 struct nfs_fh * fh;
391 size_t acl_len;
392 unsigned int acl_pgbase;
393 struct page ** acl_pages;
394};
395
J. Bruce Fields029d1052005-06-22 17:16:22 +0000396struct nfs_getaclargs {
397 struct nfs_fh * fh;
398 size_t acl_len;
399 unsigned int acl_pgbase;
400 struct page ** acl_pages;
401};
402
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403struct nfs_setattrres {
404 struct nfs_fattr * fattr;
405 const struct nfs_server * server;
406};
407
408struct nfs_linkargs {
409 struct nfs_fh * fromfh;
410 struct nfs_fh * tofh;
411 const char * toname;
412 unsigned int tolen;
413};
414
415struct nfs_symlinkargs {
416 struct nfs_fh * fromfh;
417 const char * fromname;
418 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400419 struct page ** pages;
420 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 struct iattr * sattr;
422};
423
424struct nfs_readdirargs {
425 struct nfs_fh * fh;
426 __u32 cookie;
427 unsigned int count;
428 struct page ** pages;
429};
430
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000431struct nfs3_getaclargs {
432 struct nfs_fh * fh;
433 int mask;
434 struct page ** pages;
435};
436
437struct nfs3_setaclargs {
438 struct inode * inode;
439 int mask;
440 struct posix_acl * acl_access;
441 struct posix_acl * acl_default;
Trond Myklebustae461412009-03-10 20:33:18 -0400442 size_t len;
443 unsigned int npages;
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000444 struct page ** pages;
445};
446
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447struct nfs_diropok {
448 struct nfs_fh * fh;
449 struct nfs_fattr * fattr;
450};
451
452struct nfs_readlinkargs {
453 struct nfs_fh * fh;
454 unsigned int pgbase;
455 unsigned int pglen;
456 struct page ** pages;
457};
458
459struct nfs3_sattrargs {
460 struct nfs_fh * fh;
461 struct iattr * sattr;
462 unsigned int guard;
463 struct timespec guardtime;
464};
465
466struct nfs3_diropargs {
467 struct nfs_fh * fh;
468 const char * name;
469 unsigned int len;
470};
471
472struct nfs3_accessargs {
473 struct nfs_fh * fh;
474 __u32 access;
475};
476
477struct nfs3_createargs {
478 struct nfs_fh * fh;
479 const char * name;
480 unsigned int len;
481 struct iattr * sattr;
482 enum nfs3_createmode createmode;
Al Virobc4785c2006-10-19 23:28:51 -0700483 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484};
485
486struct nfs3_mkdirargs {
487 struct nfs_fh * fh;
488 const char * name;
489 unsigned int len;
490 struct iattr * sattr;
491};
492
493struct nfs3_symlinkargs {
494 struct nfs_fh * fromfh;
495 const char * fromname;
496 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400497 struct page ** pages;
498 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 struct iattr * sattr;
500};
501
502struct nfs3_mknodargs {
503 struct nfs_fh * fh;
504 const char * name;
505 unsigned int len;
506 enum nfs3_ftype type;
507 struct iattr * sattr;
508 dev_t rdev;
509};
510
511struct nfs3_renameargs {
512 struct nfs_fh * fromfh;
513 const char * fromname;
514 unsigned int fromlen;
515 struct nfs_fh * tofh;
516 const char * toname;
517 unsigned int tolen;
518};
519
520struct nfs3_linkargs {
521 struct nfs_fh * fromfh;
522 struct nfs_fh * tofh;
523 const char * toname;
524 unsigned int tolen;
525};
526
527struct nfs3_readdirargs {
528 struct nfs_fh * fh;
529 __u64 cookie;
Al Virobc4785c2006-10-19 23:28:51 -0700530 __be32 verf[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531 int plus;
532 unsigned int count;
533 struct page ** pages;
534};
535
536struct nfs3_diropres {
537 struct nfs_fattr * dir_attr;
538 struct nfs_fh * fh;
539 struct nfs_fattr * fattr;
540};
541
542struct nfs3_accessres {
543 struct nfs_fattr * fattr;
544 __u32 access;
545};
546
547struct nfs3_readlinkargs {
548 struct nfs_fh * fh;
549 unsigned int pgbase;
550 unsigned int pglen;
551 struct page ** pages;
552};
553
554struct nfs3_renameres {
555 struct nfs_fattr * fromattr;
556 struct nfs_fattr * toattr;
557};
558
559struct nfs3_linkres {
560 struct nfs_fattr * dir_attr;
561 struct nfs_fattr * fattr;
562};
563
564struct nfs3_readdirres {
565 struct nfs_fattr * dir_attr;
Al Virobc4785c2006-10-19 23:28:51 -0700566 __be32 * verf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567 int plus;
568};
569
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000570struct nfs3_getaclres {
571 struct nfs_fattr * fattr;
572 int mask;
573 unsigned int acl_access_count;
574 unsigned int acl_default_count;
575 struct posix_acl * acl_access;
576 struct posix_acl * acl_default;
577};
578
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579#ifdef CONFIG_NFS_V4
580
581typedef u64 clientid4;
582
583struct nfs4_accessargs {
584 const struct nfs_fh * fh;
Trond Myklebust76b32992007-08-10 17:45:11 -0400585 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586 u32 access;
587};
588
589struct nfs4_accessres {
Trond Myklebust76b32992007-08-10 17:45:11 -0400590 const struct nfs_server * server;
591 struct nfs_fattr * fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592 u32 supported;
593 u32 access;
594};
595
596struct nfs4_create_arg {
597 u32 ftype;
598 union {
Chuck Lever94a6d752006-08-22 20:06:23 -0400599 struct {
600 struct page ** pages;
601 unsigned int len;
602 } symlink; /* NF4LNK */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700603 struct {
604 u32 specdata1;
605 u32 specdata2;
606 } device; /* NF4BLK, NF4CHR */
607 } u;
608 const struct qstr * name;
609 const struct nfs_server * server;
610 const struct iattr * attrs;
611 const struct nfs_fh * dir_fh;
612 const u32 * bitmask;
613};
614
615struct nfs4_create_res {
616 const struct nfs_server * server;
617 struct nfs_fh * fh;
618 struct nfs_fattr * fattr;
619 struct nfs4_change_info dir_cinfo;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400620 struct nfs_fattr * dir_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621};
622
623struct nfs4_fsinfo_arg {
624 const struct nfs_fh * fh;
625 const u32 * bitmask;
626};
627
628struct nfs4_getattr_arg {
629 const struct nfs_fh * fh;
630 const u32 * bitmask;
631};
632
633struct nfs4_getattr_res {
634 const struct nfs_server * server;
635 struct nfs_fattr * fattr;
636};
637
638struct nfs4_link_arg {
639 const struct nfs_fh * fh;
640 const struct nfs_fh * dir_fh;
641 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400642 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700643};
644
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400645struct nfs4_link_res {
646 const struct nfs_server * server;
647 struct nfs_fattr * fattr;
648 struct nfs4_change_info cinfo;
649 struct nfs_fattr * dir_attr;
650};
651
652
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653struct nfs4_lookup_arg {
654 const struct nfs_fh * dir_fh;
655 const struct qstr * name;
656 const u32 * bitmask;
657};
658
659struct nfs4_lookup_res {
660 const struct nfs_server * server;
661 struct nfs_fattr * fattr;
662 struct nfs_fh * fh;
663};
664
665struct nfs4_lookup_root_arg {
666 const u32 * bitmask;
667};
668
669struct nfs4_pathconf_arg {
670 const struct nfs_fh * fh;
671 const u32 * bitmask;
672};
673
674struct nfs4_readdir_arg {
675 const struct nfs_fh * fh;
676 u64 cookie;
677 nfs4_verifier verifier;
678 u32 count;
679 struct page ** pages; /* zero-copy data */
680 unsigned int pgbase; /* zero-copy data */
681 const u32 * bitmask;
682};
683
684struct nfs4_readdir_res {
685 nfs4_verifier verifier;
686 unsigned int pgbase;
687};
688
689struct nfs4_readlink {
690 const struct nfs_fh * fh;
691 unsigned int pgbase;
692 unsigned int pglen; /* zero-copy data */
693 struct page ** pages; /* zero-copy data */
694};
695
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696struct nfs4_rename_arg {
697 const struct nfs_fh * old_dir;
698 const struct nfs_fh * new_dir;
699 const struct qstr * old_name;
700 const struct qstr * new_name;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400701 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702};
703
704struct nfs4_rename_res {
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400705 const struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700706 struct nfs4_change_info old_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400707 struct nfs_fattr * old_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708 struct nfs4_change_info new_cinfo;
Trond Myklebust6caf2c82005-10-27 22:12:43 -0400709 struct nfs_fattr * new_fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710};
711
Trond Myklebust19d771f2008-10-08 13:54:52 -0400712#define NFS4_SETCLIENTID_NAMELEN (127)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700713struct nfs4_setclientid {
Chuck Levercc38bac2007-12-10 14:56:54 -0500714 const nfs4_verifier * sc_verifier;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 unsigned int sc_name_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400716 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500717 u32 sc_prog;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700718 unsigned int sc_netid_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400719 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720 unsigned int sc_uaddr_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400721 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500722 u32 sc_cb_ident;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723};
724
725struct nfs4_statfs_arg {
726 const struct nfs_fh * fh;
727 const u32 * bitmask;
728};
729
730struct nfs4_server_caps_res {
731 u32 attr_bitmask[2];
732 u32 acl_bitmask;
733 u32 has_links;
734 u32 has_symlinks;
735};
736
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400737struct nfs4_string {
738 unsigned int len;
739 char *data;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400740};
741
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400742#define NFS4_PATHNAME_MAXCOMPONENTS 512
743struct nfs4_pathname {
744 unsigned int ncomponents;
745 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
746};
747
748#define NFS4_FS_LOCATION_MAXSERVERS 10
749struct nfs4_fs_location {
750 unsigned int nservers;
751 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
752 struct nfs4_pathname rootpath;
753};
754
755#define NFS4_FS_LOCATIONS_MAXENTRIES 10
756struct nfs4_fs_locations {
Trond Myklebust683b57b2006-06-09 09:34:22 -0400757 struct nfs_fattr fattr;
758 const struct nfs_server *server;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400759 struct nfs4_pathname fs_path;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400760 int nlocations;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400761 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
Trond Myklebust683b57b2006-06-09 09:34:22 -0400762};
763
764struct nfs4_fs_locations_arg {
765 const struct nfs_fh *dir_fh;
766 const struct qstr *name;
767 struct page *page;
768 const u32 *bitmask;
769};
770
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771#endif /* CONFIG_NFS_V4 */
772
773struct nfs_page;
774
Chuck Lever40859d72005-11-30 18:09:02 -0500775#define NFS_PAGEVEC_SIZE (8U)
776
Linus Torvalds1da177e2005-04-16 15:20:36 -0700777struct nfs_read_data {
778 int flags;
779 struct rpc_task task;
780 struct inode *inode;
781 struct rpc_cred *cred;
782 struct nfs_fattr fattr; /* fattr storage */
783 struct list_head pages; /* Coalesced read requests */
784 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500785 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -0700786 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787 struct nfs_readargs args;
788 struct nfs_readres res;
789#ifdef CONFIG_NFS_V4
790 unsigned long timestamp; /* For lease renewal */
791#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -0400792 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700793};
794
795struct nfs_write_data {
796 int flags;
797 struct rpc_task task;
798 struct inode *inode;
799 struct rpc_cred *cred;
800 struct nfs_fattr fattr;
801 struct nfs_writeverf verf;
802 struct list_head pages; /* Coalesced requests we wish to flush */
803 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -0500804 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -0700805 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 struct nfs_writeargs args; /* argument struct */
807 struct nfs_writeres res; /* result struct */
808#ifdef CONFIG_NFS_V4
809 unsigned long timestamp; /* For lease renewal */
810#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -0400811 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700812};
813
814struct nfs_access_entry;
815
816/*
817 * RPC procedure vector for NFSv2/NFSv3 demuxing
818 */
819struct nfs_rpc_ops {
Chuck Leverc0e07cb2008-01-14 12:32:05 -0500820 u32 version; /* Protocol version */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821 struct dentry_operations *dentry_ops;
Arjan van de Venc5ef1c42007-02-12 00:55:40 -0800822 const struct inode_operations *dir_inode_ops;
823 const struct inode_operations *file_inode_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824
825 int (*getroot) (struct nfs_server *, struct nfs_fh *,
826 struct nfs_fsinfo *);
David Howells2b3de442006-08-22 20:06:09 -0400827 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
828 struct qstr *, struct nfs_fh *,
829 struct nfs_fattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700830 int (*getattr) (struct nfs_server *, struct nfs_fh *,
831 struct nfs_fattr *);
832 int (*setattr) (struct dentry *, struct nfs_fattr *,
833 struct iattr *);
834 int (*lookup) (struct inode *, struct qstr *,
835 struct nfs_fh *, struct nfs_fattr *);
836 int (*access) (struct inode *, struct nfs_access_entry *);
837 int (*readlink)(struct inode *, struct page *, unsigned int,
838 unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839 int (*create) (struct inode *, struct dentry *,
Trond Myklebust02a913a2005-10-18 14:20:17 -0700840 struct iattr *, int, struct nameidata *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 int (*remove) (struct inode *, struct qstr *);
Trond Myklebuste4eff1a2007-07-14 15:39:58 -0400842 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
843 int (*unlink_done) (struct rpc_task *, struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844 int (*rename) (struct inode *, struct qstr *,
845 struct inode *, struct qstr *);
846 int (*link) (struct inode *, struct inode *, struct qstr *);
Chuck Lever94a6d752006-08-22 20:06:23 -0400847 int (*symlink) (struct inode *, struct dentry *, struct page *,
848 unsigned int, struct iattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
850 int (*rmdir) (struct inode *, struct qstr *);
851 int (*readdir) (struct dentry *, struct rpc_cred *,
852 u64, struct page *, unsigned int, int);
853 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
854 dev_t);
855 int (*statfs) (struct nfs_server *, struct nfs_fh *,
856 struct nfs_fsstat *);
857 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
858 struct nfs_fsinfo *);
859 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
860 struct nfs_pathconf *);
David Howellse9326dc2006-08-22 20:06:10 -0400861 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
Al Viro0dbb4c62006-10-19 23:28:49 -0700862 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
Trond Myklebustbdc7f022007-07-14 15:40:00 -0400863 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
Trond Myklebustec06c092006-03-20 13:44:27 -0500864 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -0400865 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500866 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -0400867 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -0500868 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebust21162712008-05-20 19:34:39 -0400870 int (*lock_check_bounds)(const struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +0000871 void (*clear_acl_cache)(struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700872};
873
874/*
875 * NFS_CALL(getattr, inode, (fattr));
876 * into
877 * NFS_PROTO(inode)->getattr(fattr);
878 */
879#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
880
881/*
882 * Function vectors etc. for the NFS client
883 */
David Howells509de812006-08-22 20:06:11 -0400884extern const struct nfs_rpc_ops nfs_v2_clientops;
885extern const struct nfs_rpc_ops nfs_v3_clientops;
886extern const struct nfs_rpc_ops nfs_v4_clientops;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700887extern struct rpc_version nfs_version2;
888extern struct rpc_version nfs_version3;
889extern struct rpc_version nfs_version4;
890
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000891extern struct rpc_version nfsacl_version3;
892extern struct rpc_program nfsacl_program;
893
Linus Torvalds1da177e2005-04-16 15:20:36 -0700894#endif