blob: 83d36d3a12e6fe929996beb4239ccd66792962be [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>
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
Chuck Lever40859d72005-11-30 18:09:02 -05007/*
8 * To change the maximum rsize and wsize supported by the NFS client, adjust
9 * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
10 * support a megabyte or more. The default is left at 4096 bytes, which is
11 * reasonable for NFS over UDP.
12 */
13#define NFS_MAX_FILE_IO_SIZE (1048576U)
14#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U)
16
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040017struct nfs_fsid {
18 uint64_t major;
19 uint64_t minor;
Linus Torvalds1da177e2005-04-16 15:20:36 -070020};
21
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040022/*
23 * Helper for checking equality between 2 fsids.
24 */
25static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
26{
27 return a->major == b->major && a->minor == b->minor;
28}
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030struct nfs_fattr {
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040031 unsigned int valid; /* which fields are valid */
Trond Myklebustbca79472009-03-11 14:10:26 -040032 umode_t mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 __u32 nlink;
34 __u32 uid;
35 __u32 gid;
Richard Kennedy9fa8d662008-08-26 16:23:20 +010036 dev_t rdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 __u64 size;
38 union {
39 struct {
40 __u32 blocksize;
41 __u32 blocks;
42 } nfs2;
43 struct {
44 __u64 used;
45 } nfs3;
46 } du;
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040047 struct nfs_fsid fsid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 __u64 fileid;
49 struct timespec atime;
50 struct timespec mtime;
51 struct timespec ctime;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 __u64 change_attr; /* NFSv4 change attribute */
53 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
Trond Myklebust1ca277d2009-03-11 14:10:25 -040054 __u64 pre_size; /* pre_op_attr.size */
55 struct timespec pre_mtime; /* pre_op_attr.mtime */
56 struct timespec pre_ctime; /* pre_op_attr.ctime */
Trond Myklebust33801142005-10-27 22:12:39 -040057 unsigned long time_start;
Trond Myklebust4704f0e2008-10-14 19:16:07 -040058 unsigned long gencount;
Linus Torvalds1da177e2005-04-16 15:20:36 -070059};
60
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040061#define NFS_ATTR_FATTR_TYPE (1U << 0)
62#define NFS_ATTR_FATTR_MODE (1U << 1)
63#define NFS_ATTR_FATTR_NLINK (1U << 2)
64#define NFS_ATTR_FATTR_OWNER (1U << 3)
65#define NFS_ATTR_FATTR_GROUP (1U << 4)
66#define NFS_ATTR_FATTR_RDEV (1U << 5)
67#define NFS_ATTR_FATTR_SIZE (1U << 6)
68#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
69#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
70#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
71#define NFS_ATTR_FATTR_FSID (1U << 10)
72#define NFS_ATTR_FATTR_FILEID (1U << 11)
73#define NFS_ATTR_FATTR_ATIME (1U << 12)
74#define NFS_ATTR_FATTR_MTIME (1U << 13)
75#define NFS_ATTR_FATTR_CTIME (1U << 14)
76#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
77#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
78#define NFS_ATTR_FATTR_CHANGE (1U << 17)
79#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
80#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
81
82#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
83 | NFS_ATTR_FATTR_MODE \
84 | NFS_ATTR_FATTR_NLINK \
85 | NFS_ATTR_FATTR_OWNER \
86 | NFS_ATTR_FATTR_GROUP \
87 | NFS_ATTR_FATTR_RDEV \
88 | NFS_ATTR_FATTR_SIZE \
89 | NFS_ATTR_FATTR_FSID \
90 | NFS_ATTR_FATTR_FILEID \
91 | NFS_ATTR_FATTR_ATIME \
92 | NFS_ATTR_FATTR_MTIME \
93 | NFS_ATTR_FATTR_CTIME)
94#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
95 | NFS_ATTR_FATTR_BLOCKS_USED)
96#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
97 | NFS_ATTR_FATTR_SPACE_USED)
98#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
99 | NFS_ATTR_FATTR_SPACE_USED \
100 | NFS_ATTR_FATTR_CHANGE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
102/*
103 * Info on the file system
104 */
105struct nfs_fsinfo {
106 struct nfs_fattr *fattr; /* Post-op attributes */
107 __u32 rtmax; /* max. read transfer size */
108 __u32 rtpref; /* pref. read transfer size */
109 __u32 rtmult; /* reads should be multiple of this */
110 __u32 wtmax; /* max. write transfer size */
111 __u32 wtpref; /* pref. write transfer size */
112 __u32 wtmult; /* writes should be multiple of this */
113 __u32 dtpref; /* pref. readdir transfer size */
114 __u64 maxfilesize;
Ricardo Labiaga6b967242010-10-12 16:30:05 -0700115 struct timespec time_delta; /* server time granularity */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 __u32 lease_time; /* in seconds */
Andy Adamson504913f2010-10-20 00:17:57 -0400117 __u32 layouttype; /* supported pnfs layout driver */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118};
119
120struct nfs_fsstat {
121 struct nfs_fattr *fattr; /* Post-op attributes */
122 __u64 tbytes; /* total size in bytes */
123 __u64 fbytes; /* # of free bytes */
124 __u64 abytes; /* # of bytes available to user */
125 __u64 tfiles; /* # of files */
126 __u64 ffiles; /* # of free files */
127 __u64 afiles; /* # of files available to user */
128};
129
130struct nfs2_fsstat {
131 __u32 tsize; /* Server transfer size */
132 __u32 bsize; /* Filesystem block size */
133 __u32 blocks; /* No. of "bsize" blocks on filesystem */
134 __u32 bfree; /* No. of free "bsize" blocks */
135 __u32 bavail; /* No. of available "bsize" blocks */
136};
137
138struct nfs_pathconf {
139 struct nfs_fattr *fattr; /* Post-op attributes */
140 __u32 max_link; /* max # of hard links */
141 __u32 max_namelen; /* max name length */
142};
143
144struct nfs4_change_info {
145 u32 atomic;
146 u64 before;
147 u64 after;
148};
149
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700150struct nfs_seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400151
Andy Adamson557134a2009-04-01 09:21:53 -0400152/* nfs41 sessions channel attributes */
153struct nfs4_channel_attrs {
154 u32 headerpadsz;
155 u32 max_rqst_sz;
156 u32 max_resp_sz;
157 u32 max_resp_sz_cached;
158 u32 max_ops;
159 u32 max_reqs;
160};
161
162/* nfs41 sessions slot seqid */
163struct nfs4_slot {
164 u32 seq_nr;
165};
166
Benny Halevy9ff71c32009-04-01 09:21:52 -0400167struct nfs4_sequence_args {
Benny Halevyf3752972009-04-01 09:22:04 -0400168 struct nfs4_session *sa_session;
Andy Adamsonfbcd4ab2009-04-01 09:22:15 -0400169 u8 sa_slotid;
170 u8 sa_cache_this;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400171};
172
173struct nfs4_sequence_res {
Benny Halevyf3752972009-04-01 09:22:04 -0400174 struct nfs4_session *sr_session;
Benny Halevydfb4f3092010-09-24 09:17:01 -0400175 struct nfs4_slot *sr_slot; /* slot used to send request */
Andy Adamsonfbcd4ab2009-04-01 09:22:15 -0400176 int sr_status; /* sequence operation status */
Richard Kennedya01878a2009-12-03 15:58:56 -0500177 unsigned long sr_renewal_time;
Alexandros Batsakis0629e372009-12-05 13:46:14 -0500178 u32 sr_status_flags;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400179};
180
Andy Adamson2050f0c2009-04-01 09:22:30 -0400181struct nfs4_get_lease_time_args {
182 struct nfs4_sequence_args la_seq_args;
183};
184
185struct nfs4_get_lease_time_res {
186 struct nfs_fsinfo *lr_fsinfo;
187 struct nfs4_sequence_res lr_seq_res;
188};
189
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400190#define PNFS_LAYOUT_MAXSIZE 4096
191
192struct nfs4_layoutdriver_data {
193 __u32 len;
194 void *buf;
195};
196
197struct pnfs_layout_range {
198 u32 iomode;
199 u64 offset;
200 u64 length;
201};
202
203struct nfs4_layoutget_args {
204 __u32 type;
205 struct pnfs_layout_range range;
206 __u64 minlength;
207 __u32 maxcount;
208 struct inode *inode;
209 struct nfs_open_context *ctx;
210 struct nfs4_sequence_args seq_args;
Fred Isamancf7d63f2011-01-06 11:36:25 +0000211 nfs4_stateid stateid;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400212};
213
214struct nfs4_layoutget_res {
215 __u32 return_on_close;
216 struct pnfs_layout_range range;
217 __u32 type;
218 nfs4_stateid stateid;
219 struct nfs4_layoutdriver_data layout;
220 struct nfs4_sequence_res seq_res;
221};
222
223struct nfs4_layoutget {
224 struct nfs4_layoutget_args args;
225 struct nfs4_layoutget_res res;
226 struct pnfs_layout_segment **lsegpp;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400227};
228
229struct nfs4_getdeviceinfo_args {
230 struct pnfs_device *pdev;
231 struct nfs4_sequence_args seq_args;
232};
233
234struct nfs4_getdeviceinfo_res {
235 struct pnfs_device *pdev;
236 struct nfs4_sequence_res seq_res;
237};
238
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239/*
240 * Arguments to the open call.
241 */
242struct nfs_openargs {
243 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700244 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245 int open_flags;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500246 fmode_t fmode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400248 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 union {
Trond Myklebustd77d76f2010-06-16 09:52:27 -0400250 struct {
251 struct iattr * attrs; /* UNCHECKED, GUARDED */
252 nfs4_verifier verifier; /* EXCLUSIVE */
253 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500255 fmode_t delegation_type; /* CLAIM_PREVIOUS */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256 } u;
257 const struct qstr * name;
258 const struct nfs_server *server; /* Needed for ID mapping */
259 const u32 * bitmask;
260 __u32 claim;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400261 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262};
263
264struct nfs_openres {
265 nfs4_stateid stateid;
266 struct nfs_fh fh;
267 struct nfs4_change_info cinfo;
268 __u32 rflags;
269 struct nfs_fattr * f_attr;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400270 struct nfs_fattr * dir_attr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400271 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 const struct nfs_server *server;
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500273 fmode_t delegation_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700274 nfs4_stateid delegation;
275 __u32 do_recall;
276 __u64 maxsize;
Jeff Laytonaa53ed52007-06-05 14:49:03 -0400277 __u32 attrset[NFS4_BITMAP_SIZE];
Benny Halevy9ff71c32009-04-01 09:21:52 -0400278 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279};
280
281/*
282 * Arguments to the open_confirm call.
283 */
284struct nfs_open_confirmargs {
285 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100286 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700287 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288};
289
290struct nfs_open_confirmres {
291 nfs4_stateid stateid;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400292 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293};
294
295/*
296 * Arguments to the close call.
297 */
298struct nfs_closeargs {
299 struct nfs_fh * fh;
Trond Myklebust95121352005-10-18 14:20:12 -0700300 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700301 struct nfs_seqid * seqid;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500302 fmode_t fmode;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400303 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400304 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305};
306
307struct nfs_closeres {
308 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400309 struct nfs_fattr * fattr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400310 struct nfs_seqid * seqid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400311 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400312 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313};
314/*
315 * * Arguments to the lock,lockt, and locku call.
316 * */
317struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100318 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400319 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320};
321
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100322struct nfs_lock_args {
323 struct nfs_fh * fh;
324 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700325 struct nfs_seqid * lock_seqid;
326 nfs4_stateid * lock_stateid;
327 struct nfs_seqid * open_seqid;
328 nfs4_stateid * open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100329 struct nfs_lowner lock_owner;
330 unsigned char block : 1;
331 unsigned char reclaim : 1;
332 unsigned char new_lock_owner : 1;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400333 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334};
335
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100336struct nfs_lock_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400337 nfs4_stateid stateid;
338 struct nfs_seqid * lock_seqid;
339 struct nfs_seqid * open_seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400340 struct nfs4_sequence_res seq_res;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100341};
342
343struct nfs_locku_args {
344 struct nfs_fh * fh;
345 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700346 struct nfs_seqid * seqid;
Trond Myklebustfaf5f492005-10-18 14:20:15 -0700347 nfs4_stateid * stateid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400348 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349};
350
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100351struct nfs_locku_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400352 nfs4_stateid stateid;
353 struct nfs_seqid * seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400354 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355};
356
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100357struct nfs_lockt_args {
358 struct nfs_fh * fh;
359 struct file_lock * fl;
360 struct nfs_lowner lock_owner;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400361 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362};
363
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100364struct nfs_lockt_res {
365 struct file_lock * denied; /* LOCK, LOCKT failed */
Benny Halevy9ff71c32009-04-01 09:21:52 -0400366 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367};
368
Trond Myklebustd3c7b7c2010-07-01 12:49:01 -0400369struct nfs_release_lockowner_args {
370 struct nfs_lowner lock_owner;
371};
372
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373struct nfs4_delegreturnargs {
374 const struct nfs_fh *fhandle;
375 const nfs4_stateid *stateid;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100376 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400377 struct nfs4_sequence_args seq_args;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100378};
379
380struct nfs4_delegreturnres {
381 struct nfs_fattr * fattr;
382 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400383 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384};
385
386/*
387 * Arguments to the read call.
388 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389struct nfs_readargs {
390 struct nfs_fh * fh;
391 struct nfs_open_context *context;
Trond Myklebustf11ac8d2010-06-25 16:35:53 -0400392 struct nfs_lock_context *lock_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393 __u64 offset;
394 __u32 count;
395 unsigned int pgbase;
396 struct page ** pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400397 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398};
399
400struct nfs_readres {
401 struct nfs_fattr * fattr;
402 __u32 count;
403 int eof;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400404 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405};
406
407/*
408 * Arguments to the write call.
409 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700410struct nfs_writeargs {
411 struct nfs_fh * fh;
412 struct nfs_open_context *context;
Trond Myklebustf11ac8d2010-06-25 16:35:53 -0400413 struct nfs_lock_context *lock_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 __u64 offset;
415 __u32 count;
416 enum nfs3_stable_how stable;
417 unsigned int pgbase;
418 struct page ** pages;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400419 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400420 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421};
422
423struct nfs_writeverf {
424 enum nfs3_stable_how committed;
Al Virobc4785c2006-10-19 23:28:51 -0700425 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426};
427
428struct nfs_writeres {
429 struct nfs_fattr * fattr;
430 struct nfs_writeverf * verf;
431 __u32 count;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400432 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400433 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434};
435
436/*
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400437 * Common arguments to the unlink call
438 */
439struct nfs_removeargs {
440 const struct nfs_fh *fh;
441 struct qstr name;
442 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400443 struct nfs4_sequence_args seq_args;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400444};
445
446struct nfs_removeres {
447 const struct nfs_server *server;
Trond Myklebustd3468902010-04-16 16:22:50 -0400448 struct nfs_fattr *dir_attr;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400449 struct nfs4_change_info cinfo;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400450 struct nfs4_sequence_res seq_res;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400451};
452
453/*
Jeff Layton920769f2010-09-17 17:30:25 -0400454 * Common arguments to the rename call
455 */
456struct nfs_renameargs {
457 const struct nfs_fh *old_dir;
458 const struct nfs_fh *new_dir;
459 const struct qstr *old_name;
460 const struct qstr *new_name;
461 const u32 *bitmask;
462 struct nfs4_sequence_args seq_args;
463};
464
Jeff Laytone8582a82010-09-17 17:31:06 -0400465struct nfs_renameres {
466 const struct nfs_server *server;
467 struct nfs4_change_info old_cinfo;
468 struct nfs_fattr *old_fattr;
469 struct nfs4_change_info new_cinfo;
470 struct nfs_fattr *new_fattr;
471 struct nfs4_sequence_res seq_res;
472};
473
Jeff Layton920769f2010-09-17 17:30:25 -0400474/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 * Argument struct for decode_entry function
476 */
477struct nfs_entry {
478 __u64 ino;
479 __u64 cookie,
480 prev_cookie;
481 const char * name;
482 unsigned int len;
483 int eof;
484 struct nfs_fh * fh;
485 struct nfs_fattr * fattr;
Trond Myklebust0b26a0b2010-11-20 14:26:44 -0500486 unsigned char d_type;
Chuck Lever573c4e12010-12-14 14:58:11 +0000487 struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488};
489
490/*
491 * The following types are for NFSv2 only.
492 */
493struct nfs_sattrargs {
494 struct nfs_fh * fh;
495 struct iattr * sattr;
496};
497
498struct nfs_diropargs {
499 struct nfs_fh * fh;
500 const char * name;
501 unsigned int len;
502};
503
504struct nfs_createargs {
505 struct nfs_fh * fh;
506 const char * name;
507 unsigned int len;
508 struct iattr * sattr;
509};
510
Linus Torvalds1da177e2005-04-16 15:20:36 -0700511struct nfs_setattrargs {
512 struct nfs_fh * fh;
513 nfs4_stateid stateid;
514 struct iattr * iap;
515 const struct nfs_server * server; /* Needed for name mapping */
516 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400517 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518};
519
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000520struct nfs_setaclargs {
521 struct nfs_fh * fh;
522 size_t acl_len;
523 unsigned int acl_pgbase;
524 struct page ** acl_pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400525 struct nfs4_sequence_args seq_args;
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000526};
527
Benny Halevy73c403a2009-04-01 09:22:01 -0400528struct nfs_setaclres {
529 struct nfs4_sequence_res seq_res;
530};
531
J. Bruce Fields029d1052005-06-22 17:16:22 +0000532struct nfs_getaclargs {
533 struct nfs_fh * fh;
534 size_t acl_len;
535 unsigned int acl_pgbase;
536 struct page ** acl_pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400537 struct nfs4_sequence_args seq_args;
J. Bruce Fields029d1052005-06-22 17:16:22 +0000538};
539
Benny Halevy663c79b2009-04-01 09:21:59 -0400540struct nfs_getaclres {
541 size_t acl_len;
542 struct nfs4_sequence_res seq_res;
543};
544
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545struct nfs_setattrres {
546 struct nfs_fattr * fattr;
547 const struct nfs_server * server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400548 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549};
550
551struct nfs_linkargs {
552 struct nfs_fh * fromfh;
553 struct nfs_fh * tofh;
554 const char * toname;
555 unsigned int tolen;
556};
557
558struct nfs_symlinkargs {
559 struct nfs_fh * fromfh;
560 const char * fromname;
561 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400562 struct page ** pages;
563 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 struct iattr * sattr;
565};
566
567struct nfs_readdirargs {
568 struct nfs_fh * fh;
569 __u32 cookie;
570 unsigned int count;
571 struct page ** pages;
572};
573
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000574struct nfs3_getaclargs {
575 struct nfs_fh * fh;
576 int mask;
577 struct page ** pages;
578};
579
580struct nfs3_setaclargs {
581 struct inode * inode;
582 int mask;
583 struct posix_acl * acl_access;
584 struct posix_acl * acl_default;
Trond Myklebustae461412009-03-10 20:33:18 -0400585 size_t len;
586 unsigned int npages;
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000587 struct page ** pages;
588};
589
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590struct nfs_diropok {
591 struct nfs_fh * fh;
592 struct nfs_fattr * fattr;
593};
594
595struct nfs_readlinkargs {
596 struct nfs_fh * fh;
597 unsigned int pgbase;
598 unsigned int pglen;
599 struct page ** pages;
600};
601
602struct nfs3_sattrargs {
603 struct nfs_fh * fh;
604 struct iattr * sattr;
605 unsigned int guard;
606 struct timespec guardtime;
607};
608
609struct nfs3_diropargs {
610 struct nfs_fh * fh;
611 const char * name;
612 unsigned int len;
613};
614
615struct nfs3_accessargs {
616 struct nfs_fh * fh;
617 __u32 access;
618};
619
620struct nfs3_createargs {
621 struct nfs_fh * fh;
622 const char * name;
623 unsigned int len;
624 struct iattr * sattr;
625 enum nfs3_createmode createmode;
Al Virobc4785c2006-10-19 23:28:51 -0700626 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700627};
628
629struct nfs3_mkdirargs {
630 struct nfs_fh * fh;
631 const char * name;
632 unsigned int len;
633 struct iattr * sattr;
634};
635
636struct nfs3_symlinkargs {
637 struct nfs_fh * fromfh;
638 const char * fromname;
639 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400640 struct page ** pages;
641 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700642 struct iattr * sattr;
643};
644
645struct nfs3_mknodargs {
646 struct nfs_fh * fh;
647 const char * name;
648 unsigned int len;
649 enum nfs3_ftype type;
650 struct iattr * sattr;
651 dev_t rdev;
652};
653
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654struct nfs3_linkargs {
655 struct nfs_fh * fromfh;
656 struct nfs_fh * tofh;
657 const char * toname;
658 unsigned int tolen;
659};
660
661struct nfs3_readdirargs {
662 struct nfs_fh * fh;
663 __u64 cookie;
Al Virobc4785c2006-10-19 23:28:51 -0700664 __be32 verf[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 int plus;
666 unsigned int count;
667 struct page ** pages;
668};
669
670struct nfs3_diropres {
671 struct nfs_fattr * dir_attr;
672 struct nfs_fh * fh;
673 struct nfs_fattr * fattr;
674};
675
676struct nfs3_accessres {
677 struct nfs_fattr * fattr;
678 __u32 access;
679};
680
681struct nfs3_readlinkargs {
682 struct nfs_fh * fh;
683 unsigned int pgbase;
684 unsigned int pglen;
685 struct page ** pages;
686};
687
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688struct nfs3_linkres {
689 struct nfs_fattr * dir_attr;
690 struct nfs_fattr * fattr;
691};
692
693struct nfs3_readdirres {
694 struct nfs_fattr * dir_attr;
Al Virobc4785c2006-10-19 23:28:51 -0700695 __be32 * verf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700696 int plus;
697};
698
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000699struct nfs3_getaclres {
700 struct nfs_fattr * fattr;
701 int mask;
702 unsigned int acl_access_count;
703 unsigned int acl_default_count;
704 struct posix_acl * acl_access;
705 struct posix_acl * acl_default;
706};
707
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708#ifdef CONFIG_NFS_V4
709
710typedef u64 clientid4;
711
712struct nfs4_accessargs {
713 const struct nfs_fh * fh;
Trond Myklebust76b32992007-08-10 17:45:11 -0400714 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700715 u32 access;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400716 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700717};
718
719struct nfs4_accessres {
Trond Myklebust76b32992007-08-10 17:45:11 -0400720 const struct nfs_server * server;
721 struct nfs_fattr * fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700722 u32 supported;
723 u32 access;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400724 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700725};
726
727struct nfs4_create_arg {
728 u32 ftype;
729 union {
Chuck Lever94a6d752006-08-22 20:06:23 -0400730 struct {
731 struct page ** pages;
732 unsigned int len;
733 } symlink; /* NF4LNK */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734 struct {
735 u32 specdata1;
736 u32 specdata2;
737 } device; /* NF4BLK, NF4CHR */
738 } u;
739 const struct qstr * name;
740 const struct nfs_server * server;
741 const struct iattr * attrs;
742 const struct nfs_fh * dir_fh;
743 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400744 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700745};
746
747struct nfs4_create_res {
748 const struct nfs_server * server;
749 struct nfs_fh * fh;
750 struct nfs_fattr * fattr;
751 struct nfs4_change_info dir_cinfo;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400752 struct nfs_fattr * dir_fattr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400753 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700754};
755
756struct nfs4_fsinfo_arg {
757 const struct nfs_fh * fh;
758 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400759 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700760};
761
Benny Halevy3dda5e42009-04-01 09:21:57 -0400762struct nfs4_fsinfo_res {
763 struct nfs_fsinfo *fsinfo;
764 struct nfs4_sequence_res seq_res;
765};
766
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767struct nfs4_getattr_arg {
768 const struct nfs_fh * fh;
769 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400770 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771};
772
773struct nfs4_getattr_res {
774 const struct nfs_server * server;
775 struct nfs_fattr * fattr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400776 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700777};
778
779struct nfs4_link_arg {
780 const struct nfs_fh * fh;
781 const struct nfs_fh * dir_fh;
782 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400783 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400784 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785};
786
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400787struct nfs4_link_res {
788 const struct nfs_server * server;
789 struct nfs_fattr * fattr;
790 struct nfs4_change_info cinfo;
791 struct nfs_fattr * dir_attr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400792 struct nfs4_sequence_res seq_res;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400793};
794
795
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796struct nfs4_lookup_arg {
797 const struct nfs_fh * dir_fh;
798 const struct qstr * name;
799 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400800 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700801};
802
803struct nfs4_lookup_res {
804 const struct nfs_server * server;
805 struct nfs_fattr * fattr;
806 struct nfs_fh * fh;
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_lookup_root_arg {
811 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400812 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813};
814
815struct nfs4_pathconf_arg {
816 const struct nfs_fh * fh;
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
Benny Halevyd45b2982009-04-01 09:21:58 -0400821struct nfs4_pathconf_res {
822 struct nfs_pathconf *pathconf;
823 struct nfs4_sequence_res seq_res;
824};
825
Linus Torvalds1da177e2005-04-16 15:20:36 -0700826struct nfs4_readdir_arg {
827 const struct nfs_fh * fh;
828 u64 cookie;
829 nfs4_verifier verifier;
830 u32 count;
831 struct page ** pages; /* zero-copy data */
832 unsigned int pgbase; /* zero-copy data */
833 const u32 * bitmask;
Bryan Schumaker82f2e542010-10-21 16:33:18 -0400834 int plus;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400835 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700836};
837
838struct nfs4_readdir_res {
839 nfs4_verifier verifier;
840 unsigned int pgbase;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400841 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842};
843
844struct nfs4_readlink {
845 const struct nfs_fh * fh;
846 unsigned int pgbase;
847 unsigned int pglen; /* zero-copy data */
848 struct page ** pages; /* zero-copy data */
Benny Halevy9ff71c32009-04-01 09:21:52 -0400849 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850};
851
Benny Halevyf50c7002009-04-01 09:21:55 -0400852struct nfs4_readlink_res {
853 struct nfs4_sequence_res seq_res;
854};
855
Trond Myklebust19d771f2008-10-08 13:54:52 -0400856#define NFS4_SETCLIENTID_NAMELEN (127)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857struct nfs4_setclientid {
Chuck Levercc38bac2007-12-10 14:56:54 -0500858 const nfs4_verifier * sc_verifier;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700859 unsigned int sc_name_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400860 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500861 u32 sc_prog;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700862 unsigned int sc_netid_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400863 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700864 unsigned int sc_uaddr_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400865 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500866 u32 sc_cb_ident;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867};
868
Trond Myklebustbb8b27e2010-04-16 16:43:06 -0400869struct nfs4_setclientid_res {
870 u64 clientid;
871 nfs4_verifier confirm;
872};
873
Linus Torvalds1da177e2005-04-16 15:20:36 -0700874struct nfs4_statfs_arg {
875 const struct nfs_fh * fh;
876 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400877 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878};
879
Benny Halevy24ad1482009-04-01 09:21:56 -0400880struct nfs4_statfs_res {
881 struct nfs_fsstat *fsstat;
882 struct nfs4_sequence_res seq_res;
883};
884
Benny Halevy43652ad2009-04-01 09:21:54 -0400885struct nfs4_server_caps_arg {
886 struct nfs_fh *fhandle;
887 struct nfs4_sequence_args seq_args;
888};
889
Linus Torvalds1da177e2005-04-16 15:20:36 -0700890struct nfs4_server_caps_res {
891 u32 attr_bitmask[2];
892 u32 acl_bitmask;
893 u32 has_links;
894 u32 has_symlinks;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400895 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700896};
897
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400898struct nfs4_string {
899 unsigned int len;
900 char *data;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400901};
902
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400903#define NFS4_PATHNAME_MAXCOMPONENTS 512
904struct nfs4_pathname {
905 unsigned int ncomponents;
906 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
907};
908
909#define NFS4_FS_LOCATION_MAXSERVERS 10
910struct nfs4_fs_location {
911 unsigned int nservers;
912 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
913 struct nfs4_pathname rootpath;
914};
915
916#define NFS4_FS_LOCATIONS_MAXENTRIES 10
917struct nfs4_fs_locations {
Trond Myklebust683b57b2006-06-09 09:34:22 -0400918 struct nfs_fattr fattr;
919 const struct nfs_server *server;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400920 struct nfs4_pathname fs_path;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400921 int nlocations;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400922 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
Trond Myklebust683b57b2006-06-09 09:34:22 -0400923};
924
925struct nfs4_fs_locations_arg {
926 const struct nfs_fh *dir_fh;
927 const struct qstr *name;
928 struct page *page;
929 const u32 *bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400930 struct nfs4_sequence_args seq_args;
Trond Myklebust683b57b2006-06-09 09:34:22 -0400931};
932
Benny Halevy22958462009-04-01 09:22:02 -0400933struct nfs4_fs_locations_res {
934 struct nfs4_fs_locations *fs_locations;
935 struct nfs4_sequence_res seq_res;
936};
937
Linus Torvalds1da177e2005-04-16 15:20:36 -0700938#endif /* CONFIG_NFS_V4 */
939
Benny Halevy99fe60d2009-04-01 09:22:29 -0400940struct nfstime4 {
941 u64 seconds;
942 u32 nseconds;
943};
944
945#ifdef CONFIG_NFS_V4_1
946struct nfs_impl_id4 {
947 u32 domain_len;
948 char *domain;
949 u32 name_len;
950 char *name;
951 struct nfstime4 date;
952};
953
954#define NFS4_EXCHANGE_ID_LEN (48)
955struct nfs41_exchange_id_args {
956 struct nfs_client *client;
957 nfs4_verifier *verifier;
958 unsigned int id_len;
959 char id[NFS4_EXCHANGE_ID_LEN];
960 u32 flags;
961};
962
963struct server_owner {
964 uint64_t minor_id;
965 uint32_t major_id_sz;
966 char major_id[NFS4_OPAQUE_LIMIT];
967};
968
969struct server_scope {
970 uint32_t server_scope_sz;
971 char server_scope[NFS4_OPAQUE_LIMIT];
972};
973
974struct nfs41_exchange_id_res {
975 struct nfs_client *client;
976 u32 flags;
977};
Andy Adamsonfc931582009-04-01 09:22:31 -0400978
979struct nfs41_create_session_args {
980 struct nfs_client *client;
981 uint32_t flags;
982 uint32_t cb_program;
983 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
984 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
985};
986
987struct nfs41_create_session_res {
988 struct nfs_client *client;
989};
Ricardo Labiaga180197532009-12-05 16:08:40 -0500990
991struct nfs41_reclaim_complete_args {
992 /* In the future extend to include curr_fh for use with migration */
993 unsigned char one_fs:1;
994 struct nfs4_sequence_args seq_args;
995};
996
997struct nfs41_reclaim_complete_res {
998 struct nfs4_sequence_res seq_res;
999};
Benny Halevy99fe60d2009-04-01 09:22:29 -04001000#endif /* CONFIG_NFS_V4_1 */
1001
Linus Torvalds1da177e2005-04-16 15:20:36 -07001002struct nfs_page;
1003
Chuck Lever40859d72005-11-30 18:09:02 -05001004#define NFS_PAGEVEC_SIZE (8U)
1005
Linus Torvalds1da177e2005-04-16 15:20:36 -07001006struct nfs_read_data {
1007 int flags;
1008 struct rpc_task task;
1009 struct inode *inode;
1010 struct rpc_cred *cred;
1011 struct nfs_fattr fattr; /* fattr storage */
1012 struct list_head pages; /* Coalesced read requests */
1013 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -05001014 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -07001015 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001016 struct nfs_readargs args;
1017 struct nfs_readres res;
1018#ifdef CONFIG_NFS_V4
1019 unsigned long timestamp; /* For lease renewal */
1020#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -04001021 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001022};
1023
1024struct nfs_write_data {
1025 int flags;
1026 struct rpc_task task;
1027 struct inode *inode;
1028 struct rpc_cred *cred;
1029 struct nfs_fattr fattr;
1030 struct nfs_writeverf verf;
1031 struct list_head pages; /* Coalesced requests we wish to flush */
1032 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -05001033 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -07001034 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001035 struct nfs_writeargs args; /* argument struct */
1036 struct nfs_writeres res; /* result struct */
1037#ifdef CONFIG_NFS_V4
1038 unsigned long timestamp; /* For lease renewal */
1039#endif
Chuck Lever0d0b5cb2006-05-25 01:40:53 -04001040 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001041};
1042
1043struct nfs_access_entry;
1044
1045/*
1046 * RPC procedure vector for NFSv2/NFSv3 demuxing
1047 */
1048struct nfs_rpc_ops {
Chuck Leverc0e07cb2008-01-14 12:32:05 -05001049 u32 version; /* Protocol version */
Al Virof786aa92009-02-20 05:51:22 +00001050 const struct dentry_operations *dentry_ops;
Arjan van de Venc5ef1c42007-02-12 00:55:40 -08001051 const struct inode_operations *dir_inode_ops;
1052 const struct inode_operations *file_inode_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001053
1054 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1055 struct nfs_fsinfo *);
David Howells2b3de442006-08-22 20:06:09 -04001056 int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
1057 struct qstr *, struct nfs_fh *,
1058 struct nfs_fattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001059 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1060 struct nfs_fattr *);
1061 int (*setattr) (struct dentry *, struct nfs_fattr *,
1062 struct iattr *);
1063 int (*lookup) (struct inode *, struct qstr *,
1064 struct nfs_fh *, struct nfs_fattr *);
1065 int (*access) (struct inode *, struct nfs_access_entry *);
1066 int (*readlink)(struct inode *, struct page *, unsigned int,
1067 unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001068 int (*create) (struct inode *, struct dentry *,
Trond Myklebustc0204fd2010-09-17 10:56:51 -04001069 struct iattr *, int, struct nfs_open_context *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001070 int (*remove) (struct inode *, struct qstr *);
Trond Myklebuste4eff1a2007-07-14 15:39:58 -04001071 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1072 int (*unlink_done) (struct rpc_task *, struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001073 int (*rename) (struct inode *, struct qstr *,
1074 struct inode *, struct qstr *);
Jeff Laytond3d41522010-09-17 17:31:57 -04001075 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1076 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001077 int (*link) (struct inode *, struct inode *, struct qstr *);
Chuck Lever94a6d752006-08-22 20:06:23 -04001078 int (*symlink) (struct inode *, struct dentry *, struct page *,
1079 unsigned int, struct iattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001080 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1081 int (*rmdir) (struct inode *, struct qstr *);
1082 int (*readdir) (struct dentry *, struct rpc_cred *,
Bryan Schumaker56e4ebf2010-10-20 15:44:37 -04001083 u64, struct page **, unsigned int, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001084 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1085 dev_t);
1086 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1087 struct nfs_fsstat *);
1088 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1089 struct nfs_fsinfo *);
1090 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1091 struct nfs_pathconf *);
David Howellse9326dc2006-08-22 20:06:10 -04001092 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
Chuck Lever573c4e12010-12-14 14:58:11 +00001093 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001094 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
Trond Myklebustec06c092006-03-20 13:44:27 -05001095 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001096 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -05001097 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001098 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -05001099 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001100 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebust21162712008-05-20 19:34:39 -04001101 int (*lock_check_bounds)(const struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +00001102 void (*clear_acl_cache)(struct inode *);
Trond Myklebust7fe5c392009-03-19 15:35:50 -04001103 void (*close_context)(struct nfs_open_context *ctx, int);
Trond Myklebust2b484292010-09-17 10:56:51 -04001104 struct inode * (*open_context) (struct inode *dir,
1105 struct nfs_open_context *ctx,
1106 int open_flags,
1107 struct iattr *iattr);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001108};
1109
1110/*
1111 * NFS_CALL(getattr, inode, (fattr));
1112 * into
1113 * NFS_PROTO(inode)->getattr(fattr);
1114 */
1115#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1116
1117/*
1118 * Function vectors etc. for the NFS client
1119 */
David Howells509de812006-08-22 20:06:11 -04001120extern const struct nfs_rpc_ops nfs_v2_clientops;
1121extern const struct nfs_rpc_ops nfs_v3_clientops;
1122extern const struct nfs_rpc_ops nfs_v4_clientops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001123extern struct rpc_version nfs_version2;
1124extern struct rpc_version nfs_version3;
1125extern struct rpc_version nfs_version4;
1126
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +00001127extern struct rpc_version nfsacl_version3;
1128extern struct rpc_program nfsacl_program;
1129
Linus Torvalds1da177e2005-04-16 15:20:36 -07001130#endif