blob: 78b101e487eac78113ea001974d7e50ebf6b6e8b [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 Halevydfb4f3092010-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 {
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400198 struct page **pages;
199 __u32 pglen;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400200 __u32 len;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400201};
202
203struct pnfs_layout_range {
204 u32 iomode;
205 u64 offset;
206 u64 length;
207};
208
209struct nfs4_layoutget_args {
210 __u32 type;
211 struct pnfs_layout_range range;
212 __u64 minlength;
213 __u32 maxcount;
214 struct inode *inode;
215 struct nfs_open_context *ctx;
216 struct nfs4_sequence_args seq_args;
Fred Isamancf7d63f2011-01-06 11:36:25 +0000217 nfs4_stateid stateid;
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400218 struct nfs4_layoutdriver_data layout;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400219};
220
221struct nfs4_layoutget_res {
222 __u32 return_on_close;
223 struct pnfs_layout_range range;
224 __u32 type;
225 nfs4_stateid stateid;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400226 struct nfs4_sequence_res seq_res;
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400227 struct nfs4_layoutdriver_data *layoutp;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400228};
229
230struct nfs4_layoutget {
231 struct nfs4_layoutget_args args;
232 struct nfs4_layoutget_res res;
233 struct pnfs_layout_segment **lsegpp;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400234};
235
236struct nfs4_getdeviceinfo_args {
237 struct pnfs_device *pdev;
238 struct nfs4_sequence_args seq_args;
239};
240
241struct nfs4_getdeviceinfo_res {
242 struct pnfs_device *pdev;
243 struct nfs4_sequence_res seq_res;
244};
245
Andy Adamson863a3c62011-03-23 13:27:54 +0000246struct nfs4_layoutcommit_args {
247 nfs4_stateid stateid;
248 __u64 lastbytewritten;
249 struct inode *inode;
250 const u32 *bitmask;
251 struct nfs4_sequence_args seq_args;
252};
253
254struct nfs4_layoutcommit_res {
255 struct nfs_fattr *fattr;
256 const struct nfs_server *server;
257 struct nfs4_sequence_res seq_res;
258};
259
260struct nfs4_layoutcommit_data {
261 struct rpc_task task;
262 struct nfs_fattr fattr;
263 struct pnfs_layout_segment *lseg;
264 struct rpc_cred *cred;
265 struct nfs4_layoutcommit_args args;
266 struct nfs4_layoutcommit_res res;
267};
268
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269/*
270 * Arguments to the open call.
271 */
272struct nfs_openargs {
273 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700274 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 int open_flags;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500276 fmode_t fmode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400278 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 union {
Trond Myklebustd77d76f2010-06-16 09:52:27 -0400280 struct {
281 struct iattr * attrs; /* UNCHECKED, GUARDED */
282 nfs4_verifier verifier; /* EXCLUSIVE */
283 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500285 fmode_t delegation_type; /* CLAIM_PREVIOUS */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 } u;
287 const struct qstr * name;
288 const struct nfs_server *server; /* Needed for ID mapping */
289 const u32 * bitmask;
290 __u32 claim;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400291 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292};
293
294struct nfs_openres {
295 nfs4_stateid stateid;
296 struct nfs_fh fh;
297 struct nfs4_change_info cinfo;
298 __u32 rflags;
299 struct nfs_fattr * f_attr;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400300 struct nfs_fattr * dir_attr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400301 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302 const struct nfs_server *server;
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500303 fmode_t delegation_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304 nfs4_stateid delegation;
305 __u32 do_recall;
306 __u64 maxsize;
Jeff Laytonaa53ed52007-06-05 14:49:03 -0400307 __u32 attrset[NFS4_BITMAP_SIZE];
Benny Halevy9ff71c32009-04-01 09:21:52 -0400308 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309};
310
311/*
312 * Arguments to the open_confirm call.
313 */
314struct nfs_open_confirmargs {
315 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100316 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700317 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318};
319
320struct nfs_open_confirmres {
321 nfs4_stateid stateid;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400322 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323};
324
325/*
326 * Arguments to the close call.
327 */
328struct nfs_closeargs {
329 struct nfs_fh * fh;
Trond Myklebust95121352005-10-18 14:20:12 -0700330 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700331 struct nfs_seqid * seqid;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500332 fmode_t fmode;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400333 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400334 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335};
336
337struct nfs_closeres {
338 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400339 struct nfs_fattr * fattr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400340 struct nfs_seqid * seqid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400341 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400342 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343};
344/*
345 * * Arguments to the lock,lockt, and locku call.
346 * */
347struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100348 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400349 __u64 id;
Trond Myklebustd035c362010-12-21 10:45:27 -0500350 dev_t s_dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351};
352
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100353struct nfs_lock_args {
354 struct nfs_fh * fh;
355 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700356 struct nfs_seqid * lock_seqid;
357 nfs4_stateid * lock_stateid;
358 struct nfs_seqid * open_seqid;
359 nfs4_stateid * open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100360 struct nfs_lowner lock_owner;
361 unsigned char block : 1;
362 unsigned char reclaim : 1;
363 unsigned char new_lock_owner : 1;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400364 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365};
366
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100367struct nfs_lock_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400368 nfs4_stateid stateid;
369 struct nfs_seqid * lock_seqid;
370 struct nfs_seqid * open_seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400371 struct nfs4_sequence_res seq_res;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100372};
373
374struct nfs_locku_args {
375 struct nfs_fh * fh;
376 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700377 struct nfs_seqid * seqid;
Trond Myklebustfaf5f492005-10-18 14:20:15 -0700378 nfs4_stateid * stateid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400379 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380};
381
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100382struct nfs_locku_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400383 nfs4_stateid stateid;
384 struct nfs_seqid * seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400385 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386};
387
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100388struct nfs_lockt_args {
389 struct nfs_fh * fh;
390 struct file_lock * fl;
391 struct nfs_lowner lock_owner;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400392 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393};
394
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100395struct nfs_lockt_res {
396 struct file_lock * denied; /* LOCK, LOCKT failed */
Benny Halevy9ff71c32009-04-01 09:21:52 -0400397 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398};
399
Trond Myklebustd3c7b7c2010-07-01 12:49:01 -0400400struct nfs_release_lockowner_args {
401 struct nfs_lowner lock_owner;
402};
403
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404struct nfs4_delegreturnargs {
405 const struct nfs_fh *fhandle;
406 const nfs4_stateid *stateid;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100407 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400408 struct nfs4_sequence_args seq_args;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100409};
410
411struct nfs4_delegreturnres {
412 struct nfs_fattr * fattr;
413 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400414 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415};
416
417/*
418 * Arguments to the read call.
419 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420struct nfs_readargs {
421 struct nfs_fh * fh;
422 struct nfs_open_context *context;
Trond Myklebustf11ac8d2010-06-25 16:35:53 -0400423 struct nfs_lock_context *lock_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 __u64 offset;
425 __u32 count;
426 unsigned int pgbase;
427 struct page ** pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400428 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429};
430
431struct nfs_readres {
432 struct nfs_fattr * fattr;
433 __u32 count;
434 int eof;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400435 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700436};
437
438/*
439 * Arguments to the write call.
440 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441struct nfs_writeargs {
442 struct nfs_fh * fh;
443 struct nfs_open_context *context;
Trond Myklebustf11ac8d2010-06-25 16:35:53 -0400444 struct nfs_lock_context *lock_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 __u64 offset;
446 __u32 count;
447 enum nfs3_stable_how stable;
448 unsigned int pgbase;
449 struct page ** pages;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400450 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400451 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452};
453
454struct nfs_writeverf {
455 enum nfs3_stable_how committed;
Al Virobc4785c2006-10-19 23:28:51 -0700456 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457};
458
459struct nfs_writeres {
460 struct nfs_fattr * fattr;
461 struct nfs_writeverf * verf;
462 __u32 count;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400463 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400464 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700465};
466
467/*
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400468 * Common arguments to the unlink call
469 */
470struct nfs_removeargs {
471 const struct nfs_fh *fh;
472 struct qstr name;
473 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400474 struct nfs4_sequence_args seq_args;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400475};
476
477struct nfs_removeres {
478 const struct nfs_server *server;
Trond Myklebustd3468902010-04-16 16:22:50 -0400479 struct nfs_fattr *dir_attr;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400480 struct nfs4_change_info cinfo;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400481 struct nfs4_sequence_res seq_res;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400482};
483
484/*
Jeff Layton920769f2010-09-17 17:30:25 -0400485 * Common arguments to the rename call
486 */
487struct nfs_renameargs {
488 const struct nfs_fh *old_dir;
489 const struct nfs_fh *new_dir;
490 const struct qstr *old_name;
491 const struct qstr *new_name;
492 const u32 *bitmask;
493 struct nfs4_sequence_args seq_args;
494};
495
Jeff Laytone8582a82010-09-17 17:31:06 -0400496struct nfs_renameres {
497 const struct nfs_server *server;
498 struct nfs4_change_info old_cinfo;
499 struct nfs_fattr *old_fattr;
500 struct nfs4_change_info new_cinfo;
501 struct nfs_fattr *new_fattr;
502 struct nfs4_sequence_res seq_res;
503};
504
Jeff Layton920769f2010-09-17 17:30:25 -0400505/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506 * Argument struct for decode_entry function
507 */
508struct nfs_entry {
509 __u64 ino;
510 __u64 cookie,
511 prev_cookie;
512 const char * name;
513 unsigned int len;
514 int eof;
515 struct nfs_fh * fh;
516 struct nfs_fattr * fattr;
Trond Myklebust0b26a0b2010-11-20 14:26:44 -0500517 unsigned char d_type;
Chuck Lever573c4e12010-12-14 14:58:11 +0000518 struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700519};
520
521/*
522 * The following types are for NFSv2 only.
523 */
524struct nfs_sattrargs {
525 struct nfs_fh * fh;
526 struct iattr * sattr;
527};
528
529struct nfs_diropargs {
530 struct nfs_fh * fh;
531 const char * name;
532 unsigned int len;
533};
534
535struct nfs_createargs {
536 struct nfs_fh * fh;
537 const char * name;
538 unsigned int len;
539 struct iattr * sattr;
540};
541
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542struct nfs_setattrargs {
543 struct nfs_fh * fh;
544 nfs4_stateid stateid;
545 struct iattr * iap;
546 const struct nfs_server * server; /* Needed for name mapping */
547 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400548 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549};
550
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000551struct nfs_setaclargs {
552 struct nfs_fh * fh;
553 size_t acl_len;
554 unsigned int acl_pgbase;
555 struct page ** acl_pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400556 struct nfs4_sequence_args seq_args;
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000557};
558
Benny Halevy73c403a2009-04-01 09:22:01 -0400559struct nfs_setaclres {
560 struct nfs4_sequence_res seq_res;
561};
562
J. Bruce Fields029d1052005-06-22 17:16:22 +0000563struct nfs_getaclargs {
564 struct nfs_fh * fh;
565 size_t acl_len;
566 unsigned int acl_pgbase;
567 struct page ** acl_pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400568 struct nfs4_sequence_args seq_args;
J. Bruce Fields029d1052005-06-22 17:16:22 +0000569};
570
Benny Halevy663c79b2009-04-01 09:21:59 -0400571struct nfs_getaclres {
572 size_t acl_len;
573 struct nfs4_sequence_res seq_res;
574};
575
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576struct nfs_setattrres {
577 struct nfs_fattr * fattr;
578 const struct nfs_server * server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400579 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700580};
581
582struct nfs_linkargs {
583 struct nfs_fh * fromfh;
584 struct nfs_fh * tofh;
585 const char * toname;
586 unsigned int tolen;
587};
588
589struct nfs_symlinkargs {
590 struct nfs_fh * fromfh;
591 const char * fromname;
592 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400593 struct page ** pages;
594 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700595 struct iattr * sattr;
596};
597
598struct nfs_readdirargs {
599 struct nfs_fh * fh;
600 __u32 cookie;
601 unsigned int count;
602 struct page ** pages;
603};
604
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000605struct nfs3_getaclargs {
606 struct nfs_fh * fh;
607 int mask;
608 struct page ** pages;
609};
610
611struct nfs3_setaclargs {
612 struct inode * inode;
613 int mask;
614 struct posix_acl * acl_access;
615 struct posix_acl * acl_default;
Trond Myklebustae461412009-03-10 20:33:18 -0400616 size_t len;
617 unsigned int npages;
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000618 struct page ** pages;
619};
620
Linus Torvalds1da177e2005-04-16 15:20:36 -0700621struct nfs_diropok {
622 struct nfs_fh * fh;
623 struct nfs_fattr * fattr;
624};
625
626struct nfs_readlinkargs {
627 struct nfs_fh * fh;
628 unsigned int pgbase;
629 unsigned int pglen;
630 struct page ** pages;
631};
632
633struct nfs3_sattrargs {
634 struct nfs_fh * fh;
635 struct iattr * sattr;
636 unsigned int guard;
637 struct timespec guardtime;
638};
639
640struct nfs3_diropargs {
641 struct nfs_fh * fh;
642 const char * name;
643 unsigned int len;
644};
645
646struct nfs3_accessargs {
647 struct nfs_fh * fh;
648 __u32 access;
649};
650
651struct nfs3_createargs {
652 struct nfs_fh * fh;
653 const char * name;
654 unsigned int len;
655 struct iattr * sattr;
656 enum nfs3_createmode createmode;
Al Virobc4785c2006-10-19 23:28:51 -0700657 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700658};
659
660struct nfs3_mkdirargs {
661 struct nfs_fh * fh;
662 const char * name;
663 unsigned int len;
664 struct iattr * sattr;
665};
666
667struct nfs3_symlinkargs {
668 struct nfs_fh * fromfh;
669 const char * fromname;
670 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400671 struct page ** pages;
672 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673 struct iattr * sattr;
674};
675
676struct nfs3_mknodargs {
677 struct nfs_fh * fh;
678 const char * name;
679 unsigned int len;
680 enum nfs3_ftype type;
681 struct iattr * sattr;
682 dev_t rdev;
683};
684
Linus Torvalds1da177e2005-04-16 15:20:36 -0700685struct nfs3_linkargs {
686 struct nfs_fh * fromfh;
687 struct nfs_fh * tofh;
688 const char * toname;
689 unsigned int tolen;
690};
691
692struct nfs3_readdirargs {
693 struct nfs_fh * fh;
694 __u64 cookie;
Al Virobc4785c2006-10-19 23:28:51 -0700695 __be32 verf[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696 int plus;
697 unsigned int count;
698 struct page ** pages;
699};
700
701struct nfs3_diropres {
702 struct nfs_fattr * dir_attr;
703 struct nfs_fh * fh;
704 struct nfs_fattr * fattr;
705};
706
707struct nfs3_accessres {
708 struct nfs_fattr * fattr;
709 __u32 access;
710};
711
712struct nfs3_readlinkargs {
713 struct nfs_fh * fh;
714 unsigned int pgbase;
715 unsigned int pglen;
716 struct page ** pages;
717};
718
Linus Torvalds1da177e2005-04-16 15:20:36 -0700719struct nfs3_linkres {
720 struct nfs_fattr * dir_attr;
721 struct nfs_fattr * fattr;
722};
723
724struct nfs3_readdirres {
725 struct nfs_fattr * dir_attr;
Al Virobc4785c2006-10-19 23:28:51 -0700726 __be32 * verf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727 int plus;
728};
729
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000730struct nfs3_getaclres {
731 struct nfs_fattr * fattr;
732 int mask;
733 unsigned int acl_access_count;
734 unsigned int acl_default_count;
735 struct posix_acl * acl_access;
736 struct posix_acl * acl_default;
737};
738
Linus Torvalds1da177e2005-04-16 15:20:36 -0700739#ifdef CONFIG_NFS_V4
740
741typedef u64 clientid4;
742
743struct nfs4_accessargs {
744 const struct nfs_fh * fh;
Trond Myklebust76b32992007-08-10 17:45:11 -0400745 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700746 u32 access;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400747 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748};
749
750struct nfs4_accessres {
Trond Myklebust76b32992007-08-10 17:45:11 -0400751 const struct nfs_server * server;
752 struct nfs_fattr * fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700753 u32 supported;
754 u32 access;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400755 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756};
757
758struct nfs4_create_arg {
759 u32 ftype;
760 union {
Chuck Lever94a6d752006-08-22 20:06:23 -0400761 struct {
762 struct page ** pages;
763 unsigned int len;
764 } symlink; /* NF4LNK */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 struct {
766 u32 specdata1;
767 u32 specdata2;
768 } device; /* NF4BLK, NF4CHR */
769 } u;
770 const struct qstr * name;
771 const struct nfs_server * server;
772 const struct iattr * attrs;
773 const struct nfs_fh * dir_fh;
774 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400775 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776};
777
778struct nfs4_create_res {
779 const struct nfs_server * server;
780 struct nfs_fh * fh;
781 struct nfs_fattr * fattr;
782 struct nfs4_change_info dir_cinfo;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400783 struct nfs_fattr * dir_fattr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400784 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785};
786
787struct nfs4_fsinfo_arg {
788 const struct nfs_fh * fh;
789 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
Benny Halevy3dda5e42009-04-01 09:21:57 -0400793struct nfs4_fsinfo_res {
794 struct nfs_fsinfo *fsinfo;
795 struct nfs4_sequence_res seq_res;
796};
797
Linus Torvalds1da177e2005-04-16 15:20:36 -0700798struct nfs4_getattr_arg {
799 const struct nfs_fh * fh;
800 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400801 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700802};
803
804struct nfs4_getattr_res {
805 const struct nfs_server * server;
806 struct nfs_fattr * fattr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400807 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808};
809
810struct nfs4_link_arg {
811 const struct nfs_fh * fh;
812 const struct nfs_fh * dir_fh;
813 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400814 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400815 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816};
817
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400818struct nfs4_link_res {
819 const struct nfs_server * server;
820 struct nfs_fattr * fattr;
821 struct nfs4_change_info cinfo;
822 struct nfs_fattr * dir_attr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400823 struct nfs4_sequence_res seq_res;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400824};
825
826
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827struct nfs4_lookup_arg {
828 const struct nfs_fh * dir_fh;
829 const struct qstr * name;
830 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400831 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700832};
833
834struct nfs4_lookup_res {
835 const struct nfs_server * server;
836 struct nfs_fattr * fattr;
837 struct nfs_fh * fh;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400838 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839};
840
841struct nfs4_lookup_root_arg {
842 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400843 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844};
845
846struct nfs4_pathconf_arg {
847 const struct nfs_fh * fh;
848 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400849 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850};
851
Benny Halevyd45b2982009-04-01 09:21:58 -0400852struct nfs4_pathconf_res {
853 struct nfs_pathconf *pathconf;
854 struct nfs4_sequence_res seq_res;
855};
856
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857struct nfs4_readdir_arg {
858 const struct nfs_fh * fh;
859 u64 cookie;
860 nfs4_verifier verifier;
861 u32 count;
862 struct page ** pages; /* zero-copy data */
863 unsigned int pgbase; /* zero-copy data */
864 const u32 * bitmask;
Bryan Schumaker82f2e542010-10-21 16:33:18 -0400865 int plus;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400866 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867};
868
869struct nfs4_readdir_res {
870 nfs4_verifier verifier;
871 unsigned int pgbase;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400872 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700873};
874
875struct nfs4_readlink {
876 const struct nfs_fh * fh;
877 unsigned int pgbase;
878 unsigned int pglen; /* zero-copy data */
879 struct page ** pages; /* zero-copy data */
Benny Halevy9ff71c32009-04-01 09:21:52 -0400880 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700881};
882
Benny Halevyf50c7002009-04-01 09:21:55 -0400883struct nfs4_readlink_res {
884 struct nfs4_sequence_res seq_res;
885};
886
Trond Myklebust19d771f2008-10-08 13:54:52 -0400887#define NFS4_SETCLIENTID_NAMELEN (127)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700888struct nfs4_setclientid {
Chuck Levercc38bac2007-12-10 14:56:54 -0500889 const nfs4_verifier * sc_verifier;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700890 unsigned int sc_name_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400891 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500892 u32 sc_prog;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700893 unsigned int sc_netid_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400894 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700895 unsigned int sc_uaddr_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400896 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500897 u32 sc_cb_ident;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700898};
899
Trond Myklebustbb8b27e2010-04-16 16:43:06 -0400900struct nfs4_setclientid_res {
901 u64 clientid;
902 nfs4_verifier confirm;
903};
904
Linus Torvalds1da177e2005-04-16 15:20:36 -0700905struct nfs4_statfs_arg {
906 const struct nfs_fh * fh;
907 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400908 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700909};
910
Benny Halevy24ad1482009-04-01 09:21:56 -0400911struct nfs4_statfs_res {
912 struct nfs_fsstat *fsstat;
913 struct nfs4_sequence_res seq_res;
914};
915
Benny Halevy43652ad2009-04-01 09:21:54 -0400916struct nfs4_server_caps_arg {
917 struct nfs_fh *fhandle;
918 struct nfs4_sequence_args seq_args;
919};
920
Linus Torvalds1da177e2005-04-16 15:20:36 -0700921struct nfs4_server_caps_res {
922 u32 attr_bitmask[2];
923 u32 acl_bitmask;
924 u32 has_links;
925 u32 has_symlinks;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400926 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700927};
928
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400929struct nfs4_string {
930 unsigned int len;
931 char *data;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400932};
933
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400934#define NFS4_PATHNAME_MAXCOMPONENTS 512
935struct nfs4_pathname {
936 unsigned int ncomponents;
937 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
938};
939
940#define NFS4_FS_LOCATION_MAXSERVERS 10
941struct nfs4_fs_location {
942 unsigned int nservers;
943 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
944 struct nfs4_pathname rootpath;
945};
946
947#define NFS4_FS_LOCATIONS_MAXENTRIES 10
948struct nfs4_fs_locations {
Trond Myklebust683b57b2006-06-09 09:34:22 -0400949 struct nfs_fattr fattr;
950 const struct nfs_server *server;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400951 struct nfs4_pathname fs_path;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400952 int nlocations;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400953 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
Trond Myklebust683b57b2006-06-09 09:34:22 -0400954};
955
956struct nfs4_fs_locations_arg {
957 const struct nfs_fh *dir_fh;
958 const struct qstr *name;
959 struct page *page;
960 const u32 *bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400961 struct nfs4_sequence_args seq_args;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400962};
963
Benny Halevy22958462009-04-01 09:22:02 -0400964struct nfs4_fs_locations_res {
965 struct nfs4_fs_locations *fs_locations;
966 struct nfs4_sequence_res seq_res;
967};
968
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +0000969struct nfs4_secinfo_oid {
970 unsigned int len;
971 char data[GSS_OID_MAX_LEN];
972};
973
974struct nfs4_secinfo_gss {
975 struct nfs4_secinfo_oid sec_oid4;
976 unsigned int qop4;
977 unsigned int service;
978};
979
980struct nfs4_secinfo_flavor {
981 unsigned int flavor;
982 struct nfs4_secinfo_gss gss;
983};
984
985struct nfs4_secinfo_flavors {
986 unsigned int num_flavors;
987 struct nfs4_secinfo_flavor flavors[0];
988};
989
990struct nfs4_secinfo_arg {
991 const struct nfs_fh *dir_fh;
992 const struct qstr *name;
993 struct nfs4_sequence_args seq_args;
994};
995
996struct nfs4_secinfo_res {
997 struct nfs4_secinfo_flavors *flavors;
998 struct nfs4_sequence_res seq_res;
999};
1000
Linus Torvalds1da177e2005-04-16 15:20:36 -07001001#endif /* CONFIG_NFS_V4 */
1002
Benny Halevy99fe60d2009-04-01 09:22:29 -04001003struct nfstime4 {
1004 u64 seconds;
1005 u32 nseconds;
1006};
1007
1008#ifdef CONFIG_NFS_V4_1
1009struct nfs_impl_id4 {
1010 u32 domain_len;
1011 char *domain;
1012 u32 name_len;
1013 char *name;
1014 struct nfstime4 date;
1015};
1016
1017#define NFS4_EXCHANGE_ID_LEN (48)
1018struct nfs41_exchange_id_args {
1019 struct nfs_client *client;
1020 nfs4_verifier *verifier;
1021 unsigned int id_len;
1022 char id[NFS4_EXCHANGE_ID_LEN];
1023 u32 flags;
1024};
1025
1026struct server_owner {
1027 uint64_t minor_id;
1028 uint32_t major_id_sz;
1029 char major_id[NFS4_OPAQUE_LIMIT];
1030};
1031
1032struct server_scope {
1033 uint32_t server_scope_sz;
1034 char server_scope[NFS4_OPAQUE_LIMIT];
1035};
1036
1037struct nfs41_exchange_id_res {
1038 struct nfs_client *client;
1039 u32 flags;
1040};
Andy Adamsonfc931582009-04-01 09:22:31 -04001041
1042struct nfs41_create_session_args {
1043 struct nfs_client *client;
1044 uint32_t flags;
1045 uint32_t cb_program;
1046 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1047 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1048};
1049
1050struct nfs41_create_session_res {
1051 struct nfs_client *client;
1052};
Ricardo Labiaga180197532009-12-05 16:08:40 -05001053
1054struct nfs41_reclaim_complete_args {
1055 /* In the future extend to include curr_fh for use with migration */
1056 unsigned char one_fs:1;
1057 struct nfs4_sequence_args seq_args;
1058};
1059
1060struct nfs41_reclaim_complete_res {
1061 struct nfs4_sequence_res seq_res;
1062};
Benny Halevy99fe60d2009-04-01 09:22:29 -04001063#endif /* CONFIG_NFS_V4_1 */
1064
Linus Torvalds1da177e2005-04-16 15:20:36 -07001065struct nfs_page;
1066
Chuck Lever40859d72005-11-30 18:09:02 -05001067#define NFS_PAGEVEC_SIZE (8U)
1068
Linus Torvalds1da177e2005-04-16 15:20:36 -07001069struct nfs_read_data {
1070 int flags;
1071 struct rpc_task task;
1072 struct inode *inode;
1073 struct rpc_cred *cred;
1074 struct nfs_fattr fattr; /* fattr storage */
1075 struct list_head pages; /* Coalesced read requests */
1076 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -05001077 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -07001078 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001079 struct nfs_readargs args;
1080 struct nfs_readres res;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001081 unsigned long timestamp; /* For lease renewal */
Fred Isamanbae724e2011-03-01 01:34:15 +00001082 struct pnfs_layout_segment *lseg;
Andy Adamsond83217c2011-03-01 01:34:17 +00001083 struct nfs_client *ds_clp; /* pNFS data server */
Andy Adamson64419a92011-03-01 01:34:16 +00001084 const struct rpc_call_ops *mds_ops;
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +00001085 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
Andy Adamsondc70d7b2011-03-01 01:34:19 +00001086 __u64 mds_offset;
Chuck Lever0d0b5cb2006-05-25 01:40:53 -04001087 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001088};
1089
1090struct nfs_write_data {
1091 int flags;
1092 struct rpc_task task;
1093 struct inode *inode;
1094 struct rpc_cred *cred;
1095 struct nfs_fattr fattr;
1096 struct nfs_writeverf verf;
1097 struct list_head pages; /* Coalesced requests we wish to flush */
1098 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -05001099 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -07001100 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001101 struct nfs_writeargs args; /* argument struct */
1102 struct nfs_writeres res; /* result struct */
Fred Isaman5053aa52011-03-03 15:13:43 +00001103 struct pnfs_layout_segment *lseg;
Fred Isamana69aef12011-03-03 15:13:47 +00001104 struct nfs_client *ds_clp; /* pNFS data server */
Fred Isamane0c2b382011-03-23 13:27:53 +00001105 int ds_commit_index;
Andy Adamson0382b742011-03-03 15:13:45 +00001106 const struct rpc_call_ops *mds_ops;
Fred Isamanb029bc92011-03-03 15:13:42 +00001107 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001108#ifdef CONFIG_NFS_V4
1109 unsigned long timestamp; /* For lease renewal */
1110#endif
Fred Isamana69aef12011-03-03 15:13:47 +00001111 __u64 mds_offset; /* Filelayout dense stripe */
Chuck Lever0d0b5cb2006-05-25 01:40:53 -04001112 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001113};
1114
1115struct nfs_access_entry;
Andy Adamson45a52a02011-03-01 01:34:08 +00001116struct nfs_client;
Trond Myklebuste0dca7a2011-03-14 18:20:01 -04001117struct rpc_timeout;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001118
1119/*
1120 * RPC procedure vector for NFSv2/NFSv3 demuxing
1121 */
1122struct nfs_rpc_ops {
Chuck Leverc0e07cb2008-01-14 12:32:05 -05001123 u32 version; /* Protocol version */
Al Virof786aa92009-02-20 05:51:22 +00001124 const struct dentry_operations *dentry_ops;
Arjan van de Venc5ef1c42007-02-12 00:55:40 -08001125 const struct inode_operations *dir_inode_ops;
1126 const struct inode_operations *file_inode_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001127
1128 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1129 struct nfs_fsinfo *);
David Howells2b3de442006-08-22 20:06:09 -04001130 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
1131 struct qstr *, struct nfs_fh *,
1132 struct nfs_fattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001133 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1134 struct nfs_fattr *);
1135 int (*setattr) (struct dentry *, struct nfs_fattr *,
1136 struct iattr *);
Bryan Schumaker7c513052011-03-24 17:12:24 +00001137 int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001138 struct nfs_fh *, struct nfs_fattr *);
1139 int (*access) (struct inode *, struct nfs_access_entry *);
1140 int (*readlink)(struct inode *, struct page *, unsigned int,
1141 unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001142 int (*create) (struct inode *, struct dentry *,
Trond Myklebustc0204fd2010-09-17 10:56:51 -04001143 struct iattr *, int, struct nfs_open_context *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001144 int (*remove) (struct inode *, struct qstr *);
Trond Myklebuste4eff1a2007-07-14 15:39:58 -04001145 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1146 int (*unlink_done) (struct rpc_task *, struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001147 int (*rename) (struct inode *, struct qstr *,
1148 struct inode *, struct qstr *);
Jeff Laytond3d41522010-09-17 17:31:57 -04001149 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1150 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001151 int (*link) (struct inode *, struct inode *, struct qstr *);
Chuck Lever94a6d752006-08-22 20:06:23 -04001152 int (*symlink) (struct inode *, struct dentry *, struct page *,
1153 unsigned int, struct iattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001154 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1155 int (*rmdir) (struct inode *, struct qstr *);
1156 int (*readdir) (struct dentry *, struct rpc_cred *,
Bryan Schumaker56e4ebf2010-10-20 15:44:37 -04001157 u64, struct page **, unsigned int, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001158 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1159 dev_t);
1160 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1161 struct nfs_fsstat *);
1162 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1163 struct nfs_fsinfo *);
1164 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1165 struct nfs_pathconf *);
David Howellse9326dc2006-08-22 20:06:10 -04001166 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
Chuck Lever573c4e12010-12-14 14:58:11 +00001167 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001168 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
Trond Myklebustec06c092006-03-20 13:44:27 -05001169 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001170 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -05001171 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001172 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -05001173 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001174 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebust21162712008-05-20 19:34:39 -04001175 int (*lock_check_bounds)(const struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +00001176 void (*clear_acl_cache)(struct inode *);
Trond Myklebust7fe5c392009-03-19 15:35:50 -04001177 void (*close_context)(struct nfs_open_context *ctx, int);
Trond Myklebust2b484292010-09-17 10:56:51 -04001178 struct inode * (*open_context) (struct inode *dir,
1179 struct nfs_open_context *ctx,
1180 int open_flags,
1181 struct iattr *iattr);
Andy Adamson45a52a02011-03-01 01:34:08 +00001182 int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1183 const char *, rpc_authflavor_t, int);
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001184 int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001185};
1186
1187/*
1188 * NFS_CALL(getattr, inode, (fattr));
1189 * into
1190 * NFS_PROTO(inode)->getattr(fattr);
1191 */
1192#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1193
1194/*
1195 * Function vectors etc. for the NFS client
1196 */
David Howells509de812006-08-22 20:06:11 -04001197extern const struct nfs_rpc_ops nfs_v2_clientops;
1198extern const struct nfs_rpc_ops nfs_v3_clientops;
1199extern const struct nfs_rpc_ops nfs_v4_clientops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001200extern struct rpc_version nfs_version2;
1201extern struct rpc_version nfs_version3;
1202extern struct rpc_version nfs_version4;
1203
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +00001204extern struct rpc_version nfsacl_version3;
1205extern struct rpc_program nfsacl_program;
1206
Linus Torvalds1da177e2005-04-16 15:20:36 -07001207#endif