blob: fa1ba78ca2c8eeec082343c1d66c19cf3434d199 [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>
Boaz Harroshd7031582009-12-03 20:28:47 +02005#include <linux/nfs3.h>
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00006#include <linux/sunrpc/gss_api.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
Chuck Lever40859d72005-11-30 18:09:02 -05008/*
9 * To change the maximum rsize and wsize supported by the NFS client, adjust
10 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
11 * support a megabyte or more. The default is left at 4096 bytes, which is
12 * reasonable for NFS over UDP.
13 */
14#define NFS_MAX_FILE_IO_SIZE (1048576U)
15#define NFS_DEF_FILE_IO_SIZE (4096U)
16#define NFS_MIN_FILE_IO_SIZE (1024U)
17
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +000018/* Forward declaration for NFS v3 */
19struct nfs4_secinfo_flavors;
20
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040021struct nfs_fsid {
22 uint64_t major;
23 uint64_t minor;
Linus Torvalds1da177e2005-04-16 15:20:36 -070024};
25
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040026/*
27 * Helper for checking equality between 2 fsids.
28 */
29static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
30{
31 return a->major == b->major && a->minor == b->minor;
32}
33
Linus Torvalds1da177e2005-04-16 15:20:36 -070034struct nfs_fattr {
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040035 unsigned int valid; /* which fields are valid */
Trond Myklebustbca79472009-03-11 14:10:26 -040036 umode_t mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 __u32 nlink;
38 __u32 uid;
39 __u32 gid;
Richard Kennedy9fa8d662008-08-26 16:23:20 +010040 dev_t rdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 __u64 size;
42 union {
43 struct {
44 __u32 blocksize;
45 __u32 blocks;
46 } nfs2;
47 struct {
48 __u64 used;
49 } nfs3;
50 } du;
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040051 struct nfs_fsid fsid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 __u64 fileid;
53 struct timespec atime;
54 struct timespec mtime;
55 struct timespec ctime;
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 __u64 change_attr; /* NFSv4 change attribute */
57 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
Trond Myklebust1ca277d2009-03-11 14:10:25 -040058 __u64 pre_size; /* pre_op_attr.size */
59 struct timespec pre_mtime; /* pre_op_attr.mtime */
60 struct timespec pre_ctime; /* pre_op_attr.ctime */
Trond Myklebust33801142005-10-27 22:12:39 -040061 unsigned long time_start;
Trond Myklebust4704f0e2008-10-14 19:16:07 -040062 unsigned long gencount;
Linus Torvalds1da177e2005-04-16 15:20:36 -070063};
64
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040065#define NFS_ATTR_FATTR_TYPE (1U << 0)
66#define NFS_ATTR_FATTR_MODE (1U << 1)
67#define NFS_ATTR_FATTR_NLINK (1U << 2)
68#define NFS_ATTR_FATTR_OWNER (1U << 3)
69#define NFS_ATTR_FATTR_GROUP (1U << 4)
70#define NFS_ATTR_FATTR_RDEV (1U << 5)
71#define NFS_ATTR_FATTR_SIZE (1U << 6)
72#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
73#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
74#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
75#define NFS_ATTR_FATTR_FSID (1U << 10)
76#define NFS_ATTR_FATTR_FILEID (1U << 11)
77#define NFS_ATTR_FATTR_ATIME (1U << 12)
78#define NFS_ATTR_FATTR_MTIME (1U << 13)
79#define NFS_ATTR_FATTR_CTIME (1U << 14)
80#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
81#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
82#define NFS_ATTR_FATTR_CHANGE (1U << 17)
83#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
84#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
Bryan Schumaker7ebb9312011-03-24 17:12:30 +000085#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040086
87#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
88 | NFS_ATTR_FATTR_MODE \
89 | NFS_ATTR_FATTR_NLINK \
90 | NFS_ATTR_FATTR_OWNER \
91 | NFS_ATTR_FATTR_GROUP \
92 | NFS_ATTR_FATTR_RDEV \
93 | NFS_ATTR_FATTR_SIZE \
94 | NFS_ATTR_FATTR_FSID \
95 | NFS_ATTR_FATTR_FILEID \
96 | NFS_ATTR_FATTR_ATIME \
97 | NFS_ATTR_FATTR_MTIME \
98 | NFS_ATTR_FATTR_CTIME)
99#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
100 | NFS_ATTR_FATTR_BLOCKS_USED)
101#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
102 | NFS_ATTR_FATTR_SPACE_USED)
103#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
104 | NFS_ATTR_FATTR_SPACE_USED \
105 | NFS_ATTR_FATTR_CHANGE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106
107/*
108 * Info on the file system
109 */
110struct nfs_fsinfo {
111 struct nfs_fattr *fattr; /* Post-op attributes */
112 __u32 rtmax; /* max. read transfer size */
113 __u32 rtpref; /* pref. read transfer size */
114 __u32 rtmult; /* reads should be multiple of this */
115 __u32 wtmax; /* max. write transfer size */
116 __u32 wtpref; /* pref. write transfer size */
117 __u32 wtmult; /* writes should be multiple of this */
118 __u32 dtpref; /* pref. readdir transfer size */
119 __u64 maxfilesize;
Ricardo Labiaga6b967242010-10-12 16:30:05 -0700120 struct timespec time_delta; /* server time granularity */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 __u32 lease_time; /* in seconds */
Andy Adamson504913f2010-10-20 00:17:57 -0400122 __u32 layouttype; /* supported pnfs layout driver */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123};
124
125struct nfs_fsstat {
126 struct nfs_fattr *fattr; /* Post-op attributes */
127 __u64 tbytes; /* total size in bytes */
128 __u64 fbytes; /* # of free bytes */
129 __u64 abytes; /* # of bytes available to user */
130 __u64 tfiles; /* # of files */
131 __u64 ffiles; /* # of free files */
132 __u64 afiles; /* # of files available to user */
133};
134
135struct nfs2_fsstat {
136 __u32 tsize; /* Server transfer size */
137 __u32 bsize; /* Filesystem block size */
138 __u32 blocks; /* No. of "bsize" blocks on filesystem */
139 __u32 bfree; /* No. of free "bsize" blocks */
140 __u32 bavail; /* No. of available "bsize" blocks */
141};
142
143struct nfs_pathconf {
144 struct nfs_fattr *fattr; /* Post-op attributes */
145 __u32 max_link; /* max # of hard links */
146 __u32 max_namelen; /* max name length */
147};
148
149struct nfs4_change_info {
150 u32 atomic;
151 u64 before;
152 u64 after;
153};
154
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700155struct nfs_seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400156
Andy Adamson557134a2009-04-01 09:21:53 -0400157/* nfs41 sessions channel attributes */
158struct nfs4_channel_attrs {
159 u32 headerpadsz;
160 u32 max_rqst_sz;
161 u32 max_resp_sz;
162 u32 max_resp_sz_cached;
163 u32 max_ops;
164 u32 max_reqs;
165};
166
167/* nfs41 sessions slot seqid */
168struct nfs4_slot {
169 u32 seq_nr;
170};
171
Benny Halevy9ff71c32009-04-01 09:21:52 -0400172struct nfs4_sequence_args {
Benny Halevyf3752972009-04-01 09:22:04 -0400173 struct nfs4_session *sa_session;
Andy Adamsonfbcd4ab2009-04-01 09:22:15 -0400174 u8 sa_slotid;
175 u8 sa_cache_this;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400176};
177
178struct nfs4_sequence_res {
Benny Halevyf3752972009-04-01 09:22:04 -0400179 struct nfs4_session *sr_session;
Benny Halevydfb4f302010-09-24 09:17:01 -0400180 struct nfs4_slot *sr_slot; /* slot used to send request */
Andy Adamsonfbcd4ab2009-04-01 09:22:15 -0400181 int sr_status; /* sequence operation status */
Richard Kennedya01878a2009-12-03 15:58:56 -0500182 unsigned long sr_renewal_time;
Alexandros Batsakis0629e372009-12-05 13:46:14 -0500183 u32 sr_status_flags;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400184};
185
Andy Adamson2050f0c2009-04-01 09:22:30 -0400186struct nfs4_get_lease_time_args {
187 struct nfs4_sequence_args la_seq_args;
188};
189
190struct nfs4_get_lease_time_res {
191 struct nfs_fsinfo *lr_fsinfo;
192 struct nfs4_sequence_res lr_seq_res;
193};
194
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400195#define PNFS_LAYOUT_MAXSIZE 4096
196
197struct nfs4_layoutdriver_data {
198 __u32 len;
199 void *buf;
200};
201
202struct pnfs_layout_range {
203 u32 iomode;
204 u64 offset;
205 u64 length;
206};
207
208struct nfs4_layoutget_args {
209 __u32 type;
210 struct pnfs_layout_range range;
211 __u64 minlength;
212 __u32 maxcount;
213 struct inode *inode;
214 struct nfs_open_context *ctx;
215 struct nfs4_sequence_args seq_args;
Fred Isamancf7d63f2011-01-06 11:36:25 +0000216 nfs4_stateid stateid;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400217};
218
219struct nfs4_layoutget_res {
220 __u32 return_on_close;
221 struct pnfs_layout_range range;
222 __u32 type;
223 nfs4_stateid stateid;
224 struct nfs4_layoutdriver_data layout;
225 struct nfs4_sequence_res seq_res;
226};
227
228struct nfs4_layoutget {
229 struct nfs4_layoutget_args args;
230 struct nfs4_layoutget_res res;
231 struct pnfs_layout_segment **lsegpp;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400232};
233
234struct nfs4_getdeviceinfo_args {
235 struct pnfs_device *pdev;
236 struct nfs4_sequence_args seq_args;
237};
238
239struct nfs4_getdeviceinfo_res {
240 struct pnfs_device *pdev;
241 struct nfs4_sequence_res seq_res;
242};
243
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244/*
245 * Arguments to the open call.
246 */
247struct nfs_openargs {
248 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700249 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 int open_flags;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500251 fmode_t fmode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400253 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 union {
Trond Myklebustd77d76f2010-06-16 09:52:27 -0400255 struct {
256 struct iattr * attrs; /* UNCHECKED, GUARDED */
257 nfs4_verifier verifier; /* EXCLUSIVE */
258 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500260 fmode_t delegation_type; /* CLAIM_PREVIOUS */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261 } u;
262 const struct qstr * name;
263 const struct nfs_server *server; /* Needed for ID mapping */
264 const u32 * bitmask;
265 __u32 claim;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400266 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267};
268
269struct nfs_openres {
270 nfs4_stateid stateid;
271 struct nfs_fh fh;
272 struct nfs4_change_info cinfo;
273 __u32 rflags;
274 struct nfs_fattr * f_attr;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400275 struct nfs_fattr * dir_attr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400276 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 const struct nfs_server *server;
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500278 fmode_t delegation_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 nfs4_stateid delegation;
280 __u32 do_recall;
281 __u64 maxsize;
Jeff Laytonaa53ed52007-06-05 14:49:03 -0400282 __u32 attrset[NFS4_BITMAP_SIZE];
Benny Halevy9ff71c32009-04-01 09:21:52 -0400283 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284};
285
286/*
287 * Arguments to the open_confirm call.
288 */
289struct nfs_open_confirmargs {
290 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100291 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700292 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293};
294
295struct nfs_open_confirmres {
296 nfs4_stateid stateid;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400297 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298};
299
300/*
301 * Arguments to the close call.
302 */
303struct nfs_closeargs {
304 struct nfs_fh * fh;
Trond Myklebust95121352005-10-18 14:20:12 -0700305 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700306 struct nfs_seqid * seqid;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500307 fmode_t fmode;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400308 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400309 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310};
311
312struct nfs_closeres {
313 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400314 struct nfs_fattr * fattr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400315 struct nfs_seqid * seqid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400316 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400317 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318};
319/*
320 * * Arguments to the lock,lockt, and locku call.
321 * */
322struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100323 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400324 __u64 id;
Trond Myklebustd035c362010-12-21 10:45:27 -0500325 dev_t s_dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326};
327
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100328struct nfs_lock_args {
329 struct nfs_fh * fh;
330 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700331 struct nfs_seqid * lock_seqid;
332 nfs4_stateid * lock_stateid;
333 struct nfs_seqid * open_seqid;
334 nfs4_stateid * open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100335 struct nfs_lowner lock_owner;
336 unsigned char block : 1;
337 unsigned char reclaim : 1;
338 unsigned char new_lock_owner : 1;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400339 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340};
341
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100342struct nfs_lock_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400343 nfs4_stateid stateid;
344 struct nfs_seqid * lock_seqid;
345 struct nfs_seqid * open_seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400346 struct nfs4_sequence_res seq_res;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100347};
348
349struct nfs_locku_args {
350 struct nfs_fh * fh;
351 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700352 struct nfs_seqid * seqid;
Trond Myklebustfaf5f492005-10-18 14:20:15 -0700353 nfs4_stateid * stateid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400354 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355};
356
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100357struct nfs_locku_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400358 nfs4_stateid stateid;
359 struct nfs_seqid * seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400360 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361};
362
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100363struct nfs_lockt_args {
364 struct nfs_fh * fh;
365 struct file_lock * fl;
366 struct nfs_lowner lock_owner;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400367 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700368};
369
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100370struct nfs_lockt_res {
371 struct file_lock * denied; /* LOCK, LOCKT failed */
Benny Halevy9ff71c32009-04-01 09:21:52 -0400372 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373};
374
Trond Myklebustd3c7b7c2010-07-01 12:49:01 -0400375struct nfs_release_lockowner_args {
376 struct nfs_lowner lock_owner;
377};
378
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379struct nfs4_delegreturnargs {
380 const struct nfs_fh *fhandle;
381 const nfs4_stateid *stateid;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100382 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400383 struct nfs4_sequence_args seq_args;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100384};
385
386struct nfs4_delegreturnres {
387 struct nfs_fattr * fattr;
388 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400389 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390};
391
392/*
393 * Arguments to the read call.
394 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700395struct nfs_readargs {
396 struct nfs_fh * fh;
397 struct nfs_open_context *context;
Trond Myklebustf11ac8d2010-06-25 16:35:53 -0400398 struct nfs_lock_context *lock_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399 __u64 offset;
400 __u32 count;
401 unsigned int pgbase;
402 struct page ** pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400403 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404};
405
406struct nfs_readres {
407 struct nfs_fattr * fattr;
408 __u32 count;
409 int eof;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400410 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411};
412
413/*
414 * Arguments to the write call.
415 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700416struct nfs_writeargs {
417 struct nfs_fh * fh;
418 struct nfs_open_context *context;
Trond Myklebustf11ac8d2010-06-25 16:35:53 -0400419 struct nfs_lock_context *lock_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420 __u64 offset;
421 __u32 count;
422 enum nfs3_stable_how stable;
423 unsigned int pgbase;
424 struct page ** pages;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400425 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400426 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700427};
428
429struct nfs_writeverf {
430 enum nfs3_stable_how committed;
Al Virobc4785c2006-10-19 23:28:51 -0700431 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432};
433
434struct nfs_writeres {
435 struct nfs_fattr * fattr;
436 struct nfs_writeverf * verf;
437 __u32 count;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400438 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400439 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440};
441
442/*
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400443 * Common arguments to the unlink call
444 */
445struct nfs_removeargs {
446 const struct nfs_fh *fh;
447 struct qstr name;
448 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400449 struct nfs4_sequence_args seq_args;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400450};
451
452struct nfs_removeres {
453 const struct nfs_server *server;
Trond Myklebustd3468902010-04-16 16:22:50 -0400454 struct nfs_fattr *dir_attr;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400455 struct nfs4_change_info cinfo;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400456 struct nfs4_sequence_res seq_res;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400457};
458
459/*
Jeff Layton920769f2010-09-17 17:30:25 -0400460 * Common arguments to the rename call
461 */
462struct nfs_renameargs {
463 const struct nfs_fh *old_dir;
464 const struct nfs_fh *new_dir;
465 const struct qstr *old_name;
466 const struct qstr *new_name;
467 const u32 *bitmask;
468 struct nfs4_sequence_args seq_args;
469};
470
Jeff Laytone8582a82010-09-17 17:31:06 -0400471struct nfs_renameres {
472 const struct nfs_server *server;
473 struct nfs4_change_info old_cinfo;
474 struct nfs_fattr *old_fattr;
475 struct nfs4_change_info new_cinfo;
476 struct nfs_fattr *new_fattr;
477 struct nfs4_sequence_res seq_res;
478};
479
Jeff Layton920769f2010-09-17 17:30:25 -0400480/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 * Argument struct for decode_entry function
482 */
483struct nfs_entry {
484 __u64 ino;
485 __u64 cookie,
486 prev_cookie;
487 const char * name;
488 unsigned int len;
489 int eof;
490 struct nfs_fh * fh;
491 struct nfs_fattr * fattr;
Trond Myklebust0b26a0b2010-11-20 14:26:44 -0500492 unsigned char d_type;
Chuck Lever573c4e12010-12-14 14:58:11 +0000493 struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700494};
495
496/*
497 * The following types are for NFSv2 only.
498 */
499struct nfs_sattrargs {
500 struct nfs_fh * fh;
501 struct iattr * sattr;
502};
503
504struct nfs_diropargs {
505 struct nfs_fh * fh;
506 const char * name;
507 unsigned int len;
508};
509
510struct nfs_createargs {
511 struct nfs_fh * fh;
512 const char * name;
513 unsigned int len;
514 struct iattr * sattr;
515};
516
Linus Torvalds1da177e2005-04-16 15:20:36 -0700517struct nfs_setattrargs {
518 struct nfs_fh * fh;
519 nfs4_stateid stateid;
520 struct iattr * iap;
521 const struct nfs_server * server; /* Needed for name mapping */
522 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400523 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524};
525
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000526struct nfs_setaclargs {
527 struct nfs_fh * fh;
528 size_t acl_len;
529 unsigned int acl_pgbase;
530 struct page ** acl_pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400531 struct nfs4_sequence_args seq_args;
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000532};
533
Benny Halevy73c403a2009-04-01 09:22:01 -0400534struct nfs_setaclres {
535 struct nfs4_sequence_res seq_res;
536};
537
J. Bruce Fields029d1052005-06-22 17:16:22 +0000538struct nfs_getaclargs {
539 struct nfs_fh * fh;
540 size_t acl_len;
541 unsigned int acl_pgbase;
542 struct page ** acl_pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400543 struct nfs4_sequence_args seq_args;
J. Bruce Fields029d1052005-06-22 17:16:22 +0000544};
545
Benny Halevy663c79b2009-04-01 09:21:59 -0400546struct nfs_getaclres {
547 size_t acl_len;
548 struct nfs4_sequence_res seq_res;
549};
550
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551struct nfs_setattrres {
552 struct nfs_fattr * fattr;
553 const struct nfs_server * server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400554 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555};
556
557struct nfs_linkargs {
558 struct nfs_fh * fromfh;
559 struct nfs_fh * tofh;
560 const char * toname;
561 unsigned int tolen;
562};
563
564struct nfs_symlinkargs {
565 struct nfs_fh * fromfh;
566 const char * fromname;
567 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400568 struct page ** pages;
569 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 struct iattr * sattr;
571};
572
573struct nfs_readdirargs {
574 struct nfs_fh * fh;
575 __u32 cookie;
576 unsigned int count;
577 struct page ** pages;
578};
579
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000580struct nfs3_getaclargs {
581 struct nfs_fh * fh;
582 int mask;
583 struct page ** pages;
584};
585
586struct nfs3_setaclargs {
587 struct inode * inode;
588 int mask;
589 struct posix_acl * acl_access;
590 struct posix_acl * acl_default;
Trond Myklebustae461412009-03-10 20:33:18 -0400591 size_t len;
592 unsigned int npages;
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000593 struct page ** pages;
594};
595
Linus Torvalds1da177e2005-04-16 15:20:36 -0700596struct nfs_diropok {
597 struct nfs_fh * fh;
598 struct nfs_fattr * fattr;
599};
600
601struct nfs_readlinkargs {
602 struct nfs_fh * fh;
603 unsigned int pgbase;
604 unsigned int pglen;
605 struct page ** pages;
606};
607
608struct nfs3_sattrargs {
609 struct nfs_fh * fh;
610 struct iattr * sattr;
611 unsigned int guard;
612 struct timespec guardtime;
613};
614
615struct nfs3_diropargs {
616 struct nfs_fh * fh;
617 const char * name;
618 unsigned int len;
619};
620
621struct nfs3_accessargs {
622 struct nfs_fh * fh;
623 __u32 access;
624};
625
626struct nfs3_createargs {
627 struct nfs_fh * fh;
628 const char * name;
629 unsigned int len;
630 struct iattr * sattr;
631 enum nfs3_createmode createmode;
Al Virobc4785c2006-10-19 23:28:51 -0700632 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633};
634
635struct nfs3_mkdirargs {
636 struct nfs_fh * fh;
637 const char * name;
638 unsigned int len;
639 struct iattr * sattr;
640};
641
642struct nfs3_symlinkargs {
643 struct nfs_fh * fromfh;
644 const char * fromname;
645 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400646 struct page ** pages;
647 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700648 struct iattr * sattr;
649};
650
651struct nfs3_mknodargs {
652 struct nfs_fh * fh;
653 const char * name;
654 unsigned int len;
655 enum nfs3_ftype type;
656 struct iattr * sattr;
657 dev_t rdev;
658};
659
Linus Torvalds1da177e2005-04-16 15:20:36 -0700660struct nfs3_linkargs {
661 struct nfs_fh * fromfh;
662 struct nfs_fh * tofh;
663 const char * toname;
664 unsigned int tolen;
665};
666
667struct nfs3_readdirargs {
668 struct nfs_fh * fh;
669 __u64 cookie;
Al Virobc4785c2006-10-19 23:28:51 -0700670 __be32 verf[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700671 int plus;
672 unsigned int count;
673 struct page ** pages;
674};
675
676struct nfs3_diropres {
677 struct nfs_fattr * dir_attr;
678 struct nfs_fh * fh;
679 struct nfs_fattr * fattr;
680};
681
682struct nfs3_accessres {
683 struct nfs_fattr * fattr;
684 __u32 access;
685};
686
687struct nfs3_readlinkargs {
688 struct nfs_fh * fh;
689 unsigned int pgbase;
690 unsigned int pglen;
691 struct page ** pages;
692};
693
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694struct nfs3_linkres {
695 struct nfs_fattr * dir_attr;
696 struct nfs_fattr * fattr;
697};
698
699struct nfs3_readdirres {
700 struct nfs_fattr * dir_attr;
Al Virobc4785c2006-10-19 23:28:51 -0700701 __be32 * verf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 int plus;
703};
704
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000705struct nfs3_getaclres {
706 struct nfs_fattr * fattr;
707 int mask;
708 unsigned int acl_access_count;
709 unsigned int acl_default_count;
710 struct posix_acl * acl_access;
711 struct posix_acl * acl_default;
712};
713
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714#ifdef CONFIG_NFS_V4
715
716typedef u64 clientid4;
717
718struct nfs4_accessargs {
719 const struct nfs_fh * fh;
Trond Myklebust76b32992007-08-10 17:45:11 -0400720 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721 u32 access;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400722 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723};
724
725struct nfs4_accessres {
Trond Myklebust76b32992007-08-10 17:45:11 -0400726 const struct nfs_server * server;
727 struct nfs_fattr * fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700728 u32 supported;
729 u32 access;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400730 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700731};
732
733struct nfs4_create_arg {
734 u32 ftype;
735 union {
Chuck Lever94a6d752006-08-22 20:06:23 -0400736 struct {
737 struct page ** pages;
738 unsigned int len;
739 } symlink; /* NF4LNK */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740 struct {
741 u32 specdata1;
742 u32 specdata2;
743 } device; /* NF4BLK, NF4CHR */
744 } u;
745 const struct qstr * name;
746 const struct nfs_server * server;
747 const struct iattr * attrs;
748 const struct nfs_fh * dir_fh;
749 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400750 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700751};
752
753struct nfs4_create_res {
754 const struct nfs_server * server;
755 struct nfs_fh * fh;
756 struct nfs_fattr * fattr;
757 struct nfs4_change_info dir_cinfo;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400758 struct nfs_fattr * dir_fattr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400759 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760};
761
762struct nfs4_fsinfo_arg {
763 const struct nfs_fh * fh;
764 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400765 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700766};
767
Benny Halevy3dda5e42009-04-01 09:21:57 -0400768struct nfs4_fsinfo_res {
769 struct nfs_fsinfo *fsinfo;
770 struct nfs4_sequence_res seq_res;
771};
772
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773struct nfs4_getattr_arg {
774 const struct nfs_fh * fh;
775 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400776 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700777};
778
779struct nfs4_getattr_res {
780 const struct nfs_server * server;
781 struct nfs_fattr * fattr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400782 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783};
784
785struct nfs4_link_arg {
786 const struct nfs_fh * fh;
787 const struct nfs_fh * dir_fh;
788 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400789 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400790 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791};
792
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400793struct nfs4_link_res {
794 const struct nfs_server * server;
795 struct nfs_fattr * fattr;
796 struct nfs4_change_info cinfo;
797 struct nfs_fattr * dir_attr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400798 struct nfs4_sequence_res seq_res;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400799};
800
801
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802struct nfs4_lookup_arg {
803 const struct nfs_fh * dir_fh;
804 const struct qstr * name;
805 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400806 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700807};
808
809struct nfs4_lookup_res {
810 const struct nfs_server * server;
811 struct nfs_fattr * fattr;
812 struct nfs_fh * fh;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400813 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700814};
815
816struct nfs4_lookup_root_arg {
817 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400818 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819};
820
821struct nfs4_pathconf_arg {
822 const struct nfs_fh * fh;
823 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400824 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825};
826
Benny Halevyd45b2982009-04-01 09:21:58 -0400827struct nfs4_pathconf_res {
828 struct nfs_pathconf *pathconf;
829 struct nfs4_sequence_res seq_res;
830};
831
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832struct nfs4_readdir_arg {
833 const struct nfs_fh * fh;
834 u64 cookie;
835 nfs4_verifier verifier;
836 u32 count;
837 struct page ** pages; /* zero-copy data */
838 unsigned int pgbase; /* zero-copy data */
839 const u32 * bitmask;
Bryan Schumaker82f2e542010-10-21 16:33:18 -0400840 int plus;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400841 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842};
843
844struct nfs4_readdir_res {
845 nfs4_verifier verifier;
846 unsigned int pgbase;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400847 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700848};
849
850struct nfs4_readlink {
851 const struct nfs_fh * fh;
852 unsigned int pgbase;
853 unsigned int pglen; /* zero-copy data */
854 struct page ** pages; /* zero-copy data */
Benny Halevy9ff71c32009-04-01 09:21:52 -0400855 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856};
857
Benny Halevyf50c7002009-04-01 09:21:55 -0400858struct nfs4_readlink_res {
859 struct nfs4_sequence_res seq_res;
860};
861
Trond Myklebust19d771f2008-10-08 13:54:52 -0400862#define NFS4_SETCLIENTID_NAMELEN (127)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700863struct nfs4_setclientid {
Chuck Levercc38bac2007-12-10 14:56:54 -0500864 const nfs4_verifier * sc_verifier;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700865 unsigned int sc_name_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400866 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500867 u32 sc_prog;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700868 unsigned int sc_netid_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400869 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700870 unsigned int sc_uaddr_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400871 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500872 u32 sc_cb_ident;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700873};
874
Trond Myklebustbb8b27e2010-04-16 16:43:06 -0400875struct nfs4_setclientid_res {
876 u64 clientid;
877 nfs4_verifier confirm;
878};
879
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880struct nfs4_statfs_arg {
881 const struct nfs_fh * fh;
882 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400883 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700884};
885
Benny Halevy24ad1482009-04-01 09:21:56 -0400886struct nfs4_statfs_res {
887 struct nfs_fsstat *fsstat;
888 struct nfs4_sequence_res seq_res;
889};
890
Benny Halevy43652ad2009-04-01 09:21:54 -0400891struct nfs4_server_caps_arg {
892 struct nfs_fh *fhandle;
893 struct nfs4_sequence_args seq_args;
894};
895
Linus Torvalds1da177e2005-04-16 15:20:36 -0700896struct nfs4_server_caps_res {
897 u32 attr_bitmask[2];
898 u32 acl_bitmask;
899 u32 has_links;
900 u32 has_symlinks;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400901 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700902};
903
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400904struct nfs4_string {
905 unsigned int len;
906 char *data;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400907};
908
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400909#define NFS4_PATHNAME_MAXCOMPONENTS 512
910struct nfs4_pathname {
911 unsigned int ncomponents;
912 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
913};
914
915#define NFS4_FS_LOCATION_MAXSERVERS 10
916struct nfs4_fs_location {
917 unsigned int nservers;
918 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
919 struct nfs4_pathname rootpath;
920};
921
922#define NFS4_FS_LOCATIONS_MAXENTRIES 10
923struct nfs4_fs_locations {
Trond Myklebust683b57b2006-06-09 09:34:22 -0400924 struct nfs_fattr fattr;
925 const struct nfs_server *server;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400926 struct nfs4_pathname fs_path;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400927 int nlocations;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400928 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
Trond Myklebust683b57b2006-06-09 09:34:22 -0400929};
930
931struct nfs4_fs_locations_arg {
932 const struct nfs_fh *dir_fh;
933 const struct qstr *name;
934 struct page *page;
935 const u32 *bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400936 struct nfs4_sequence_args seq_args;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400937};
938
Benny Halevy22958462009-04-01 09:22:02 -0400939struct nfs4_fs_locations_res {
940 struct nfs4_fs_locations *fs_locations;
941 struct nfs4_sequence_res seq_res;
942};
943
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +0000944struct nfs4_secinfo_oid {
945 unsigned int len;
946 char data[GSS_OID_MAX_LEN];
947};
948
949struct nfs4_secinfo_gss {
950 struct nfs4_secinfo_oid sec_oid4;
951 unsigned int qop4;
952 unsigned int service;
953};
954
955struct nfs4_secinfo_flavor {
956 unsigned int flavor;
957 struct nfs4_secinfo_gss gss;
958};
959
960struct nfs4_secinfo_flavors {
961 unsigned int num_flavors;
962 struct nfs4_secinfo_flavor flavors[0];
963};
964
965struct nfs4_secinfo_arg {
966 const struct nfs_fh *dir_fh;
967 const struct qstr *name;
968 struct nfs4_sequence_args seq_args;
969};
970
971struct nfs4_secinfo_res {
972 struct nfs4_secinfo_flavors *flavors;
973 struct nfs4_sequence_res seq_res;
974};
975
Linus Torvalds1da177e2005-04-16 15:20:36 -0700976#endif /* CONFIG_NFS_V4 */
977
Benny Halevy99fe60d2009-04-01 09:22:29 -0400978struct nfstime4 {
979 u64 seconds;
980 u32 nseconds;
981};
982
983#ifdef CONFIG_NFS_V4_1
984struct nfs_impl_id4 {
985 u32 domain_len;
986 char *domain;
987 u32 name_len;
988 char *name;
989 struct nfstime4 date;
990};
991
992#define NFS4_EXCHANGE_ID_LEN (48)
993struct nfs41_exchange_id_args {
994 struct nfs_client *client;
995 nfs4_verifier *verifier;
996 unsigned int id_len;
997 char id[NFS4_EXCHANGE_ID_LEN];
998 u32 flags;
999};
1000
1001struct server_owner {
1002 uint64_t minor_id;
1003 uint32_t major_id_sz;
1004 char major_id[NFS4_OPAQUE_LIMIT];
1005};
1006
1007struct server_scope {
1008 uint32_t server_scope_sz;
1009 char server_scope[NFS4_OPAQUE_LIMIT];
1010};
1011
1012struct nfs41_exchange_id_res {
1013 struct nfs_client *client;
1014 u32 flags;
1015};
Andy Adamsonfc931582009-04-01 09:22:31 -04001016
1017struct nfs41_create_session_args {
1018 struct nfs_client *client;
1019 uint32_t flags;
1020 uint32_t cb_program;
1021 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1022 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1023};
1024
1025struct nfs41_create_session_res {
1026 struct nfs_client *client;
1027};
Ricardo Labiaga18019752009-12-05 16:08:40 -05001028
1029struct nfs41_reclaim_complete_args {
1030 /* In the future extend to include curr_fh for use with migration */
1031 unsigned char one_fs:1;
1032 struct nfs4_sequence_args seq_args;
1033};
1034
1035struct nfs41_reclaim_complete_res {
1036 struct nfs4_sequence_res seq_res;
1037};
Benny Halevy99fe60d2009-04-01 09:22:29 -04001038#endif /* CONFIG_NFS_V4_1 */
1039
Linus Torvalds1da177e2005-04-16 15:20:36 -07001040struct nfs_page;
1041
Chuck Lever40859d72005-11-30 18:09:02 -05001042#define NFS_PAGEVEC_SIZE (8U)
1043
Linus Torvalds1da177e2005-04-16 15:20:36 -07001044struct nfs_read_data {
1045 int flags;
1046 struct rpc_task task;
1047 struct inode *inode;
1048 struct rpc_cred *cred;
1049 struct nfs_fattr fattr; /* fattr storage */
1050 struct list_head pages; /* Coalesced read requests */
1051 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -05001052 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -07001053 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001054 struct nfs_readargs args;
1055 struct nfs_readres res;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001056 unsigned long timestamp; /* For lease renewal */
Fred Isamanbae724e2011-03-01 01:34:15 +00001057 struct pnfs_layout_segment *lseg;
Andy Adamsond83217c2011-03-01 01:34:17 +00001058 struct nfs_client *ds_clp; /* pNFS data server */
Andy Adamson64419a92011-03-01 01:34:16 +00001059 const struct rpc_call_ops *mds_ops;
Andy Adamsoncbdabc72011-03-01 01:34:20 +00001060 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
Andy Adamsondc70d7b2011-03-01 01:34:19 +00001061 __u64 mds_offset;
Chuck Lever0d0b5cb2006-05-25 01:40:53 -04001062 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001063};
1064
1065struct nfs_write_data {
1066 int flags;
1067 struct rpc_task task;
1068 struct inode *inode;
1069 struct rpc_cred *cred;
1070 struct nfs_fattr fattr;
1071 struct nfs_writeverf verf;
1072 struct list_head pages; /* Coalesced requests we wish to flush */
1073 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -05001074 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -07001075 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001076 struct nfs_writeargs args; /* argument struct */
1077 struct nfs_writeres res; /* result struct */
Fred Isaman5053aa52011-03-03 15:13:43 +00001078 struct pnfs_layout_segment *lseg;
Fred Isamana69aef12011-03-03 15:13:47 +00001079 struct nfs_client *ds_clp; /* pNFS data server */
Andy Adamson0382b742011-03-03 15:13:45 +00001080 const struct rpc_call_ops *mds_ops;
Fred Isamanb029bc92011-03-03 15:13:42 +00001081 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001082#ifdef CONFIG_NFS_V4
1083 unsigned long timestamp; /* For lease renewal */
1084#endif
Fred Isamana69aef12011-03-03 15:13:47 +00001085 __u64 mds_offset; /* Filelayout dense stripe */
Chuck Lever0d0b5cb2006-05-25 01:40:53 -04001086 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001087};
1088
1089struct nfs_access_entry;
Andy Adamson45a52a02011-03-01 01:34:08 +00001090struct nfs_client;
Trond Myklebuste0dca7a2011-03-14 18:20:01 -04001091struct rpc_timeout;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001092
1093/*
1094 * RPC procedure vector for NFSv2/NFSv3 demuxing
1095 */
1096struct nfs_rpc_ops {
Chuck Leverc0e07cb2008-01-14 12:32:05 -05001097 u32 version; /* Protocol version */
Al Virof786aa92009-02-20 05:51:22 +00001098 const struct dentry_operations *dentry_ops;
Arjan van de Venc5ef1c42007-02-12 00:55:40 -08001099 const struct inode_operations *dir_inode_ops;
1100 const struct inode_operations *file_inode_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001101
1102 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1103 struct nfs_fsinfo *);
David Howells2b3de442006-08-22 20:06:09 -04001104 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
1105 struct qstr *, struct nfs_fh *,
1106 struct nfs_fattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001107 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1108 struct nfs_fattr *);
1109 int (*setattr) (struct dentry *, struct nfs_fattr *,
1110 struct iattr *);
Bryan Schumaker7c513052011-03-24 17:12:24 +00001111 int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001112 struct nfs_fh *, struct nfs_fattr *);
1113 int (*access) (struct inode *, struct nfs_access_entry *);
1114 int (*readlink)(struct inode *, struct page *, unsigned int,
1115 unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001116 int (*create) (struct inode *, struct dentry *,
Trond Myklebustc0204fd2010-09-17 10:56:51 -04001117 struct iattr *, int, struct nfs_open_context *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001118 int (*remove) (struct inode *, struct qstr *);
Trond Myklebuste4eff1a2007-07-14 15:39:58 -04001119 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1120 int (*unlink_done) (struct rpc_task *, struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001121 int (*rename) (struct inode *, struct qstr *,
1122 struct inode *, struct qstr *);
Jeff Laytond3d41522010-09-17 17:31:57 -04001123 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1124 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001125 int (*link) (struct inode *, struct inode *, struct qstr *);
Chuck Lever94a6d752006-08-22 20:06:23 -04001126 int (*symlink) (struct inode *, struct dentry *, struct page *,
1127 unsigned int, struct iattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001128 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1129 int (*rmdir) (struct inode *, struct qstr *);
1130 int (*readdir) (struct dentry *, struct rpc_cred *,
Bryan Schumaker56e4ebf2010-10-20 15:44:37 -04001131 u64, struct page **, unsigned int, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001132 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1133 dev_t);
1134 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1135 struct nfs_fsstat *);
1136 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1137 struct nfs_fsinfo *);
1138 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1139 struct nfs_pathconf *);
David Howellse9326dc2006-08-22 20:06:10 -04001140 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
Chuck Lever573c4e12010-12-14 14:58:11 +00001141 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001142 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
Trond Myklebustec06c092006-03-20 13:44:27 -05001143 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001144 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -05001145 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001146 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -05001147 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001148 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebust21162712008-05-20 19:34:39 -04001149 int (*lock_check_bounds)(const struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +00001150 void (*clear_acl_cache)(struct inode *);
Trond Myklebust7fe5c392009-03-19 15:35:50 -04001151 void (*close_context)(struct nfs_open_context *ctx, int);
Trond Myklebust2b484292010-09-17 10:56:51 -04001152 struct inode * (*open_context) (struct inode *dir,
1153 struct nfs_open_context *ctx,
1154 int open_flags,
1155 struct iattr *iattr);
Andy Adamson45a52a02011-03-01 01:34:08 +00001156 int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1157 const char *, rpc_authflavor_t, int);
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001158 int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001159};
1160
1161/*
1162 * NFS_CALL(getattr, inode, (fattr));
1163 * into
1164 * NFS_PROTO(inode)->getattr(fattr);
1165 */
1166#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1167
1168/*
1169 * Function vectors etc. for the NFS client
1170 */
David Howells509de812006-08-22 20:06:11 -04001171extern const struct nfs_rpc_ops nfs_v2_clientops;
1172extern const struct nfs_rpc_ops nfs_v3_clientops;
1173extern const struct nfs_rpc_ops nfs_v4_clientops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001174extern struct rpc_version nfs_version2;
1175extern struct rpc_version nfs_version3;
1176extern struct rpc_version nfs_version4;
1177
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +00001178extern struct rpc_version nfsacl_version3;
1179extern struct rpc_program nfsacl_program;
1180
Linus Torvalds1da177e2005-04-16 15:20:36 -07001181#endif