blob: adbc84ac345fdb482219d3f2e65768836ac891ab [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>
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00005#include <linux/sunrpc/gss_api.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
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +000017/* Forward declaration for NFS v3 */
18struct nfs4_secinfo_flavors;
19
Trond Myklebust6926afd2012-01-07 13:22:46 -050020struct nfs4_string {
21 unsigned int len;
22 char *data;
23};
24
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040025struct nfs_fsid {
26 uint64_t major;
27 uint64_t minor;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028};
29
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040030/*
31 * Helper for checking equality between 2 fsids.
32 */
33static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
34{
35 return a->major == b->major && a->minor == b->minor;
36}
37
Linus Torvalds1da177e2005-04-16 15:20:36 -070038struct nfs_fattr {
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040039 unsigned int valid; /* which fields are valid */
Trond Myklebustbca79472009-03-11 14:10:26 -040040 umode_t mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 __u32 nlink;
42 __u32 uid;
43 __u32 gid;
Richard Kennedy9fa8d662008-08-26 16:23:20 +010044 dev_t rdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 __u64 size;
46 union {
47 struct {
48 __u32 blocksize;
49 __u32 blocks;
50 } nfs2;
51 struct {
52 __u64 used;
53 } nfs3;
54 } du;
Trond Myklebust8b4bdcf2006-06-09 09:34:19 -040055 struct nfs_fsid fsid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 __u64 fileid;
Trond Myklebust28331a42011-04-27 13:47:52 -040057 __u64 mounted_on_fileid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 struct timespec atime;
59 struct timespec mtime;
60 struct timespec ctime;
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 __u64 change_attr; /* NFSv4 change attribute */
62 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
Trond Myklebust1ca277d2009-03-11 14:10:25 -040063 __u64 pre_size; /* pre_op_attr.size */
64 struct timespec pre_mtime; /* pre_op_attr.mtime */
65 struct timespec pre_ctime; /* pre_op_attr.ctime */
Trond Myklebust33801142005-10-27 22:12:39 -040066 unsigned long time_start;
Trond Myklebust4704f0e2008-10-14 19:16:07 -040067 unsigned long gencount;
Trond Myklebust6926afd2012-01-07 13:22:46 -050068 struct nfs4_string *owner_name;
69 struct nfs4_string *group_name;
Linus Torvalds1da177e2005-04-16 15:20:36 -070070};
71
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040072#define NFS_ATTR_FATTR_TYPE (1U << 0)
73#define NFS_ATTR_FATTR_MODE (1U << 1)
74#define NFS_ATTR_FATTR_NLINK (1U << 2)
75#define NFS_ATTR_FATTR_OWNER (1U << 3)
76#define NFS_ATTR_FATTR_GROUP (1U << 4)
77#define NFS_ATTR_FATTR_RDEV (1U << 5)
78#define NFS_ATTR_FATTR_SIZE (1U << 6)
79#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
80#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
81#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
82#define NFS_ATTR_FATTR_FSID (1U << 10)
83#define NFS_ATTR_FATTR_FILEID (1U << 11)
84#define NFS_ATTR_FATTR_ATIME (1U << 12)
85#define NFS_ATTR_FATTR_MTIME (1U << 13)
86#define NFS_ATTR_FATTR_CTIME (1U << 14)
87#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
88#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
89#define NFS_ATTR_FATTR_CHANGE (1U << 17)
90#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
91#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
Bryan Schumaker7ebb9312011-03-24 17:12:30 +000092#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
Trond Myklebust28331a42011-04-27 13:47:52 -040093#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21)
Trond Myklebust6926afd2012-01-07 13:22:46 -050094#define NFS_ATTR_FATTR_OWNER_NAME (1U << 22)
95#define NFS_ATTR_FATTR_GROUP_NAME (1U << 23)
Trond Myklebust9e6e70f2009-03-11 14:10:24 -040096
97#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
98 | NFS_ATTR_FATTR_MODE \
99 | NFS_ATTR_FATTR_NLINK \
100 | NFS_ATTR_FATTR_OWNER \
101 | NFS_ATTR_FATTR_GROUP \
102 | NFS_ATTR_FATTR_RDEV \
103 | NFS_ATTR_FATTR_SIZE \
104 | NFS_ATTR_FATTR_FSID \
105 | NFS_ATTR_FATTR_FILEID \
106 | NFS_ATTR_FATTR_ATIME \
107 | NFS_ATTR_FATTR_MTIME \
108 | NFS_ATTR_FATTR_CTIME)
109#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
110 | NFS_ATTR_FATTR_BLOCKS_USED)
111#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
112 | NFS_ATTR_FATTR_SPACE_USED)
113#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
114 | NFS_ATTR_FATTR_SPACE_USED \
115 | NFS_ATTR_FATTR_CHANGE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
117/*
118 * Info on the file system
119 */
120struct nfs_fsinfo {
121 struct nfs_fattr *fattr; /* Post-op attributes */
122 __u32 rtmax; /* max. read transfer size */
123 __u32 rtpref; /* pref. read transfer size */
124 __u32 rtmult; /* reads should be multiple of this */
125 __u32 wtmax; /* max. write transfer size */
126 __u32 wtpref; /* pref. write transfer size */
127 __u32 wtmult; /* writes should be multiple of this */
128 __u32 dtpref; /* pref. readdir transfer size */
129 __u64 maxfilesize;
Ricardo Labiaga6b967242010-10-12 16:30:05 -0700130 struct timespec time_delta; /* server time granularity */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 __u32 lease_time; /* in seconds */
Andy Adamson504913f2010-10-20 00:17:57 -0400132 __u32 layouttype; /* supported pnfs layout driver */
Fred Isamandae100c2011-07-30 20:52:37 -0400133 __u32 blksize; /* preferred pnfs io block size */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134};
135
136struct nfs_fsstat {
137 struct nfs_fattr *fattr; /* Post-op attributes */
138 __u64 tbytes; /* total size in bytes */
139 __u64 fbytes; /* # of free bytes */
140 __u64 abytes; /* # of bytes available to user */
141 __u64 tfiles; /* # of files */
142 __u64 ffiles; /* # of free files */
143 __u64 afiles; /* # of files available to user */
144};
145
146struct nfs2_fsstat {
147 __u32 tsize; /* Server transfer size */
148 __u32 bsize; /* Filesystem block size */
149 __u32 blocks; /* No. of "bsize" blocks on filesystem */
150 __u32 bfree; /* No. of free "bsize" blocks */
151 __u32 bavail; /* No. of available "bsize" blocks */
152};
153
154struct nfs_pathconf {
155 struct nfs_fattr *fattr; /* Post-op attributes */
156 __u32 max_link; /* max # of hard links */
157 __u32 max_namelen; /* max name length */
158};
159
160struct nfs4_change_info {
161 u32 atomic;
162 u64 before;
163 u64 after;
164};
165
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700166struct nfs_seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400167
Andy Adamson557134a2009-04-01 09:21:53 -0400168/* nfs41 sessions channel attributes */
169struct nfs4_channel_attrs {
Andy Adamson557134a2009-04-01 09:21:53 -0400170 u32 max_rqst_sz;
171 u32 max_resp_sz;
172 u32 max_resp_sz_cached;
173 u32 max_ops;
174 u32 max_reqs;
175};
176
177/* nfs41 sessions slot seqid */
178struct nfs4_slot {
179 u32 seq_nr;
180};
181
Benny Halevy9ff71c32009-04-01 09:21:52 -0400182struct nfs4_sequence_args {
Benny Halevyf3752972009-04-01 09:22:04 -0400183 struct nfs4_session *sa_session;
Trond Myklebust45d43c22012-02-06 19:38:51 -0500184 u32 sa_slotid;
Andy Adamsonfbcd4ab2009-04-01 09:22:15 -0400185 u8 sa_cache_this;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400186};
187
188struct nfs4_sequence_res {
Benny Halevyf3752972009-04-01 09:22:04 -0400189 struct nfs4_session *sr_session;
Benny Halevydfb4f3092010-09-24 09:17:01 -0400190 struct nfs4_slot *sr_slot; /* slot used to send request */
Andy Adamsonfbcd4ab2009-04-01 09:22:15 -0400191 int sr_status; /* sequence operation status */
Richard Kennedya01878a2009-12-03 15:58:56 -0500192 unsigned long sr_renewal_time;
Alexandros Batsakis0629e372009-12-05 13:46:14 -0500193 u32 sr_status_flags;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400194};
195
Andy Adamson2050f0c2009-04-01 09:22:30 -0400196struct nfs4_get_lease_time_args {
197 struct nfs4_sequence_args la_seq_args;
198};
199
200struct nfs4_get_lease_time_res {
201 struct nfs_fsinfo *lr_fsinfo;
202 struct nfs4_sequence_res lr_seq_res;
203};
204
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400205#define PNFS_LAYOUT_MAXSIZE 4096
206
207struct nfs4_layoutdriver_data {
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400208 struct page **pages;
209 __u32 pglen;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400210 __u32 len;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400211};
212
213struct pnfs_layout_range {
214 u32 iomode;
215 u64 offset;
216 u64 length;
217};
218
219struct nfs4_layoutget_args {
220 __u32 type;
221 struct pnfs_layout_range range;
222 __u64 minlength;
223 __u32 maxcount;
224 struct inode *inode;
225 struct nfs_open_context *ctx;
226 struct nfs4_sequence_args seq_args;
Fred Isamancf7d63f2011-01-06 11:36:25 +0000227 nfs4_stateid stateid;
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400228 struct nfs4_layoutdriver_data layout;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400229};
230
231struct nfs4_layoutget_res {
232 __u32 return_on_close;
233 struct pnfs_layout_range range;
234 __u32 type;
235 nfs4_stateid stateid;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400236 struct nfs4_sequence_res seq_res;
Weston Andros Adamson35124a02011-03-24 16:48:21 -0400237 struct nfs4_layoutdriver_data *layoutp;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400238};
239
240struct nfs4_layoutget {
241 struct nfs4_layoutget_args args;
242 struct nfs4_layoutget_res res;
243 struct pnfs_layout_segment **lsegpp;
Trond Myklebusta75b9df2011-05-11 18:00:51 -0400244 gfp_t gfp_flags;
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400245};
246
Andy Adamson7f11d8d2011-07-30 20:52:35 -0400247struct nfs4_getdevicelist_args {
248 const struct nfs_fh *fh;
249 u32 layoutclass;
250 struct nfs4_sequence_args seq_args;
251};
252
253struct nfs4_getdevicelist_res {
254 struct pnfs_devicelist *devlist;
255 struct nfs4_sequence_res seq_res;
256};
257
Andy Adamsonb1f69b72010-10-20 00:18:03 -0400258struct nfs4_getdeviceinfo_args {
259 struct pnfs_device *pdev;
260 struct nfs4_sequence_args seq_args;
261};
262
263struct nfs4_getdeviceinfo_res {
264 struct pnfs_device *pdev;
265 struct nfs4_sequence_res seq_res;
266};
267
Andy Adamson863a3c62011-03-23 13:27:54 +0000268struct nfs4_layoutcommit_args {
269 nfs4_stateid stateid;
270 __u64 lastbytewritten;
271 struct inode *inode;
272 const u32 *bitmask;
273 struct nfs4_sequence_args seq_args;
274};
275
276struct nfs4_layoutcommit_res {
277 struct nfs_fattr *fattr;
278 const struct nfs_server *server;
279 struct nfs4_sequence_res seq_res;
Andy Adamsondb29c082011-07-30 20:52:38 -0400280 int status;
Andy Adamson863a3c62011-03-23 13:27:54 +0000281};
282
283struct nfs4_layoutcommit_data {
284 struct rpc_task task;
285 struct nfs_fattr fattr;
Peng Taoa9bae562011-07-30 20:52:33 -0400286 struct list_head lseg_list;
Andy Adamson863a3c62011-03-23 13:27:54 +0000287 struct rpc_cred *cred;
288 struct nfs4_layoutcommit_args args;
289 struct nfs4_layoutcommit_res res;
290};
291
Benny Halevycbe82602011-05-22 19:52:37 +0300292struct nfs4_layoutreturn_args {
Trond Myklebusta56aaa02011-06-15 11:59:10 -0400293 struct pnfs_layout_hdr *layout;
Benny Halevycbe82602011-05-22 19:52:37 +0300294 struct inode *inode;
295 nfs4_stateid stateid;
Trond Myklebusta56aaa02011-06-15 11:59:10 -0400296 __u32 layout_type;
Benny Halevycbe82602011-05-22 19:52:37 +0300297 struct nfs4_sequence_args seq_args;
298};
299
300struct nfs4_layoutreturn_res {
301 struct nfs4_sequence_res seq_res;
302 u32 lrs_present;
303 nfs4_stateid stateid;
304};
305
306struct nfs4_layoutreturn {
307 struct nfs4_layoutreturn_args args;
308 struct nfs4_layoutreturn_res res;
309 struct rpc_cred *cred;
310 struct nfs_client *clp;
311 int rpc_status;
312};
313
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314/*
315 * Arguments to the open call.
316 */
317struct nfs_openargs {
318 const struct nfs_fh * fh;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700319 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 int open_flags;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500321 fmode_t fmode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400323 __u64 id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 union {
Trond Myklebustd77d76f2010-06-16 09:52:27 -0400325 struct {
326 struct iattr * attrs; /* UNCHECKED, GUARDED */
327 nfs4_verifier verifier; /* EXCLUSIVE */
328 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700329 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500330 fmode_t delegation_type; /* CLAIM_PREVIOUS */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331 } u;
332 const struct qstr * name;
333 const struct nfs_server *server; /* Needed for ID mapping */
334 const u32 * bitmask;
Trond Myklebust6926afd2012-01-07 13:22:46 -0500335 const u32 * dir_bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 __u32 claim;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400337 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338};
339
340struct nfs_openres {
341 nfs4_stateid stateid;
342 struct nfs_fh fh;
343 struct nfs4_change_info cinfo;
344 __u32 rflags;
345 struct nfs_fattr * f_attr;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400346 struct nfs_fattr * dir_attr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400347 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348 const struct nfs_server *server;
Trond Myklebustbd7bf9d2008-12-23 15:21:53 -0500349 fmode_t delegation_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350 nfs4_stateid delegation;
351 __u32 do_recall;
352 __u64 maxsize;
Jeff Laytonaa53ed52007-06-05 14:49:03 -0400353 __u32 attrset[NFS4_BITMAP_SIZE];
Trond Myklebust6926afd2012-01-07 13:22:46 -0500354 struct nfs4_string *owner;
355 struct nfs4_string *group_owner;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400356 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357};
358
359/*
360 * Arguments to the open_confirm call.
361 */
362struct nfs_open_confirmargs {
363 const struct nfs_fh * fh;
Trond Myklebustcdd4e682006-01-03 09:55:12 +0100364 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700365 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366};
367
368struct nfs_open_confirmres {
369 nfs4_stateid stateid;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400370 struct nfs_seqid * seqid;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371};
372
373/*
374 * Arguments to the close call.
375 */
376struct nfs_closeargs {
377 struct nfs_fh * fh;
Trond Myklebust95121352005-10-18 14:20:12 -0700378 nfs4_stateid * stateid;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700379 struct nfs_seqid * seqid;
Trond Myklebustdc0b0272008-12-23 15:21:56 -0500380 fmode_t fmode;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400381 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400382 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383};
384
385struct nfs_closeres {
386 nfs4_stateid stateid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400387 struct nfs_fattr * fattr;
Trond Myklebustc1d51932008-04-07 13:20:54 -0400388 struct nfs_seqid * seqid;
Trond Myklebust516a6af2005-10-27 22:12:41 -0400389 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400390 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391};
392/*
393 * * Arguments to the lock,lockt, and locku call.
394 * */
395struct nfs_lowner {
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100396 __u64 clientid;
Trond Myklebust9f958ab2007-07-02 13:58:33 -0400397 __u64 id;
Trond Myklebustd035c362010-12-21 10:45:27 -0500398 dev_t s_dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399};
400
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100401struct nfs_lock_args {
402 struct nfs_fh * fh;
403 struct file_lock * fl;
Trond Myklebust06735b32005-10-18 14:20:15 -0700404 struct nfs_seqid * lock_seqid;
405 nfs4_stateid * lock_stateid;
406 struct nfs_seqid * open_seqid;
407 nfs4_stateid * open_stateid;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100408 struct nfs_lowner lock_owner;
409 unsigned char block : 1;
410 unsigned char reclaim : 1;
411 unsigned char new_lock_owner : 1;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400412 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700413};
414
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100415struct nfs_lock_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400416 nfs4_stateid stateid;
417 struct nfs_seqid * lock_seqid;
418 struct nfs_seqid * open_seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400419 struct nfs4_sequence_res seq_res;
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100420};
421
422struct nfs_locku_args {
423 struct nfs_fh * fh;
424 struct file_lock * fl;
Trond Myklebustcee54fc2005-10-18 14:20:12 -0700425 struct nfs_seqid * seqid;
Trond Myklebustfaf5f492005-10-18 14:20:15 -0700426 nfs4_stateid * stateid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400427 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428};
429
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100430struct nfs_locku_res {
Trond Myklebustc1d51932008-04-07 13:20:54 -0400431 nfs4_stateid stateid;
432 struct nfs_seqid * seqid;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400433 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434};
435
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100436struct nfs_lockt_args {
437 struct nfs_fh * fh;
438 struct file_lock * fl;
439 struct nfs_lowner lock_owner;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400440 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441};
442
Trond Myklebust911d1aa2006-01-03 09:55:16 +0100443struct nfs_lockt_res {
444 struct file_lock * denied; /* LOCK, LOCKT failed */
Benny Halevy9ff71c32009-04-01 09:21:52 -0400445 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446};
447
Trond Myklebustd3c7b7c2010-07-01 12:49:01 -0400448struct nfs_release_lockowner_args {
449 struct nfs_lowner lock_owner;
450};
451
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452struct nfs4_delegreturnargs {
453 const struct nfs_fh *fhandle;
454 const nfs4_stateid *stateid;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100455 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400456 struct nfs4_sequence_args seq_args;
Trond Myklebustfa178f22006-01-03 09:55:38 +0100457};
458
459struct nfs4_delegreturnres {
460 struct nfs_fattr * fattr;
461 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400462 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700463};
464
465/*
466 * Arguments to the read call.
467 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700468struct nfs_readargs {
469 struct nfs_fh * fh;
470 struct nfs_open_context *context;
Trond Myklebustf11ac8d2010-06-25 16:35:53 -0400471 struct nfs_lock_context *lock_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700472 __u64 offset;
473 __u32 count;
474 unsigned int pgbase;
475 struct page ** pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400476 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477};
478
479struct nfs_readres {
480 struct nfs_fattr * fattr;
481 __u32 count;
482 int eof;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400483 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700484};
485
486/*
487 * Arguments to the write call.
488 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700489struct nfs_writeargs {
490 struct nfs_fh * fh;
491 struct nfs_open_context *context;
Trond Myklebustf11ac8d2010-06-25 16:35:53 -0400492 struct nfs_lock_context *lock_context;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493 __u64 offset;
494 __u32 count;
495 enum nfs3_stable_how stable;
496 unsigned int pgbase;
497 struct page ** pages;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400498 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400499 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500};
501
502struct nfs_writeverf {
503 enum nfs3_stable_how committed;
Al Virobc4785c2006-10-19 23:28:51 -0700504 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505};
506
507struct nfs_writeres {
508 struct nfs_fattr * fattr;
509 struct nfs_writeverf * verf;
510 __u32 count;
Trond Myklebust4f9838c2005-10-27 22:12:44 -0400511 const struct nfs_server *server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400512 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513};
514
515/*
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400516 * Common arguments to the unlink call
517 */
518struct nfs_removeargs {
519 const struct nfs_fh *fh;
520 struct qstr name;
521 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400522 struct nfs4_sequence_args seq_args;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400523};
524
525struct nfs_removeres {
526 const struct nfs_server *server;
Trond Myklebustd3468902010-04-16 16:22:50 -0400527 struct nfs_fattr *dir_attr;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400528 struct nfs4_change_info cinfo;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400529 struct nfs4_sequence_res seq_res;
Trond Myklebust4fdc17b2007-07-14 15:39:57 -0400530};
531
532/*
Jeff Layton920769f2010-09-17 17:30:25 -0400533 * Common arguments to the rename call
534 */
535struct nfs_renameargs {
536 const struct nfs_fh *old_dir;
537 const struct nfs_fh *new_dir;
538 const struct qstr *old_name;
539 const struct qstr *new_name;
540 const u32 *bitmask;
541 struct nfs4_sequence_args seq_args;
542};
543
Jeff Laytone8582a82010-09-17 17:31:06 -0400544struct nfs_renameres {
545 const struct nfs_server *server;
546 struct nfs4_change_info old_cinfo;
547 struct nfs_fattr *old_fattr;
548 struct nfs4_change_info new_cinfo;
549 struct nfs_fattr *new_fattr;
550 struct nfs4_sequence_res seq_res;
551};
552
Jeff Layton920769f2010-09-17 17:30:25 -0400553/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 * Argument struct for decode_entry function
555 */
556struct nfs_entry {
557 __u64 ino;
558 __u64 cookie,
559 prev_cookie;
560 const char * name;
561 unsigned int len;
562 int eof;
563 struct nfs_fh * fh;
564 struct nfs_fattr * fattr;
Trond Myklebust0b26a0b2010-11-20 14:26:44 -0500565 unsigned char d_type;
Chuck Lever573c4e12010-12-14 14:58:11 +0000566 struct nfs_server * server;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700567};
568
569/*
570 * The following types are for NFSv2 only.
571 */
572struct nfs_sattrargs {
573 struct nfs_fh * fh;
574 struct iattr * sattr;
575};
576
577struct nfs_diropargs {
578 struct nfs_fh * fh;
579 const char * name;
580 unsigned int len;
581};
582
583struct nfs_createargs {
584 struct nfs_fh * fh;
585 const char * name;
586 unsigned int len;
587 struct iattr * sattr;
588};
589
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590struct nfs_setattrargs {
591 struct nfs_fh * fh;
592 nfs4_stateid stateid;
593 struct iattr * iap;
594 const struct nfs_server * server; /* Needed for name mapping */
595 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400596 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597};
598
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000599struct nfs_setaclargs {
600 struct nfs_fh * fh;
601 size_t acl_len;
602 unsigned int acl_pgbase;
603 struct page ** acl_pages;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400604 struct nfs4_sequence_args seq_args;
J. Bruce Fields23ec6962005-06-22 17:16:22 +0000605};
606
Benny Halevy73c403a2009-04-01 09:22:01 -0400607struct nfs_setaclres {
608 struct nfs4_sequence_res seq_res;
609};
610
J. Bruce Fields029d1052005-06-22 17:16:22 +0000611struct nfs_getaclargs {
612 struct nfs_fh * fh;
613 size_t acl_len;
614 unsigned int acl_pgbase;
615 struct page ** acl_pages;
Andy Adamsonbf118a32011-12-07 11:55:27 -0500616 struct page * acl_scratch;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400617 struct nfs4_sequence_args seq_args;
J. Bruce Fields029d1052005-06-22 17:16:22 +0000618};
619
Andy Adamsonbf118a32011-12-07 11:55:27 -0500620/* getxattr ACL interface flags */
621#define NFS4_ACL_LEN_REQUEST 0x0001 /* zero length getxattr buffer */
Benny Halevy663c79b2009-04-01 09:21:59 -0400622struct nfs_getaclres {
623 size_t acl_len;
Andy Adamsonbf118a32011-12-07 11:55:27 -0500624 size_t acl_data_offset;
625 int acl_flags;
Benny Halevy663c79b2009-04-01 09:21:59 -0400626 struct nfs4_sequence_res seq_res;
627};
628
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629struct nfs_setattrres {
630 struct nfs_fattr * fattr;
631 const struct nfs_server * server;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400632 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700633};
634
635struct nfs_linkargs {
636 struct nfs_fh * fromfh;
637 struct nfs_fh * tofh;
638 const char * toname;
639 unsigned int tolen;
640};
641
642struct nfs_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 nfs_readdirargs {
652 struct nfs_fh * fh;
653 __u32 cookie;
654 unsigned int count;
655 struct page ** pages;
656};
657
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000658struct nfs3_getaclargs {
659 struct nfs_fh * fh;
660 int mask;
661 struct page ** pages;
662};
663
664struct nfs3_setaclargs {
665 struct inode * inode;
666 int mask;
667 struct posix_acl * acl_access;
668 struct posix_acl * acl_default;
Trond Myklebustae461412009-03-10 20:33:18 -0400669 size_t len;
670 unsigned int npages;
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000671 struct page ** pages;
672};
673
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674struct nfs_diropok {
675 struct nfs_fh * fh;
676 struct nfs_fattr * fattr;
677};
678
679struct nfs_readlinkargs {
680 struct nfs_fh * fh;
681 unsigned int pgbase;
682 unsigned int pglen;
683 struct page ** pages;
684};
685
686struct nfs3_sattrargs {
687 struct nfs_fh * fh;
688 struct iattr * sattr;
689 unsigned int guard;
690 struct timespec guardtime;
691};
692
693struct nfs3_diropargs {
694 struct nfs_fh * fh;
695 const char * name;
696 unsigned int len;
697};
698
699struct nfs3_accessargs {
700 struct nfs_fh * fh;
701 __u32 access;
702};
703
704struct nfs3_createargs {
705 struct nfs_fh * fh;
706 const char * name;
707 unsigned int len;
708 struct iattr * sattr;
709 enum nfs3_createmode createmode;
Al Virobc4785c2006-10-19 23:28:51 -0700710 __be32 verifier[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711};
712
713struct nfs3_mkdirargs {
714 struct nfs_fh * fh;
715 const char * name;
716 unsigned int len;
717 struct iattr * sattr;
718};
719
720struct nfs3_symlinkargs {
721 struct nfs_fh * fromfh;
722 const char * fromname;
723 unsigned int fromlen;
Chuck Lever94a6d752006-08-22 20:06:23 -0400724 struct page ** pages;
725 unsigned int pathlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700726 struct iattr * sattr;
727};
728
729struct nfs3_mknodargs {
730 struct nfs_fh * fh;
731 const char * name;
732 unsigned int len;
733 enum nfs3_ftype type;
734 struct iattr * sattr;
735 dev_t rdev;
736};
737
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738struct nfs3_linkargs {
739 struct nfs_fh * fromfh;
740 struct nfs_fh * tofh;
741 const char * toname;
742 unsigned int tolen;
743};
744
745struct nfs3_readdirargs {
746 struct nfs_fh * fh;
747 __u64 cookie;
Al Virobc4785c2006-10-19 23:28:51 -0700748 __be32 verf[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700749 int plus;
750 unsigned int count;
751 struct page ** pages;
752};
753
754struct nfs3_diropres {
755 struct nfs_fattr * dir_attr;
756 struct nfs_fh * fh;
757 struct nfs_fattr * fattr;
758};
759
760struct nfs3_accessres {
761 struct nfs_fattr * fattr;
762 __u32 access;
763};
764
765struct nfs3_readlinkargs {
766 struct nfs_fh * fh;
767 unsigned int pgbase;
768 unsigned int pglen;
769 struct page ** pages;
770};
771
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772struct nfs3_linkres {
773 struct nfs_fattr * dir_attr;
774 struct nfs_fattr * fattr;
775};
776
777struct nfs3_readdirres {
778 struct nfs_fattr * dir_attr;
Al Virobc4785c2006-10-19 23:28:51 -0700779 __be32 * verf;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700780 int plus;
781};
782
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +0000783struct nfs3_getaclres {
784 struct nfs_fattr * fattr;
785 int mask;
786 unsigned int acl_access_count;
787 unsigned int acl_default_count;
788 struct posix_acl * acl_access;
789 struct posix_acl * acl_default;
790};
791
Linus Torvalds1da177e2005-04-16 15:20:36 -0700792#ifdef CONFIG_NFS_V4
793
794typedef u64 clientid4;
795
796struct nfs4_accessargs {
797 const struct nfs_fh * fh;
Trond Myklebust76b32992007-08-10 17:45:11 -0400798 const u32 * bitmask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799 u32 access;
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_accessres {
Trond Myklebust76b32992007-08-10 17:45:11 -0400804 const struct nfs_server * server;
805 struct nfs_fattr * fattr;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 u32 supported;
807 u32 access;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400808 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700809};
810
811struct nfs4_create_arg {
812 u32 ftype;
813 union {
Chuck Lever94a6d752006-08-22 20:06:23 -0400814 struct {
815 struct page ** pages;
816 unsigned int len;
817 } symlink; /* NF4LNK */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700818 struct {
819 u32 specdata1;
820 u32 specdata2;
821 } device; /* NF4BLK, NF4CHR */
822 } u;
823 const struct qstr * name;
824 const struct nfs_server * server;
825 const struct iattr * attrs;
826 const struct nfs_fh * dir_fh;
827 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400828 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700829};
830
831struct nfs4_create_res {
832 const struct nfs_server * server;
833 struct nfs_fh * fh;
834 struct nfs_fattr * fattr;
835 struct nfs4_change_info dir_cinfo;
Trond Myklebust56ae19f2005-10-27 22:12:40 -0400836 struct nfs_fattr * dir_fattr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400837 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838};
839
840struct nfs4_fsinfo_arg {
841 const struct nfs_fh * fh;
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
Benny Halevy3dda5e42009-04-01 09:21:57 -0400846struct nfs4_fsinfo_res {
847 struct nfs_fsinfo *fsinfo;
848 struct nfs4_sequence_res seq_res;
849};
850
Linus Torvalds1da177e2005-04-16 15:20:36 -0700851struct nfs4_getattr_arg {
852 const struct nfs_fh * fh;
853 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400854 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855};
856
857struct nfs4_getattr_res {
858 const struct nfs_server * server;
859 struct nfs_fattr * fattr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400860 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861};
862
863struct nfs4_link_arg {
864 const struct nfs_fh * fh;
865 const struct nfs_fh * dir_fh;
866 const struct qstr * name;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400867 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400868 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869};
870
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400871struct nfs4_link_res {
872 const struct nfs_server * server;
873 struct nfs_fattr * fattr;
874 struct nfs4_change_info cinfo;
875 struct nfs_fattr * dir_attr;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400876 struct nfs4_sequence_res seq_res;
Trond Myklebust91ba2ee2005-10-27 22:12:42 -0400877};
878
879
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880struct nfs4_lookup_arg {
881 const struct nfs_fh * dir_fh;
882 const struct qstr * name;
883 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400884 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885};
886
887struct nfs4_lookup_res {
888 const struct nfs_server * server;
889 struct nfs_fattr * fattr;
890 struct nfs_fh * fh;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400891 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892};
893
894struct nfs4_lookup_root_arg {
895 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400896 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700897};
898
899struct nfs4_pathconf_arg {
900 const struct nfs_fh * fh;
901 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400902 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700903};
904
Benny Halevyd45b2982009-04-01 09:21:58 -0400905struct nfs4_pathconf_res {
906 struct nfs_pathconf *pathconf;
907 struct nfs4_sequence_res seq_res;
908};
909
Linus Torvalds1da177e2005-04-16 15:20:36 -0700910struct nfs4_readdir_arg {
911 const struct nfs_fh * fh;
912 u64 cookie;
913 nfs4_verifier verifier;
914 u32 count;
915 struct page ** pages; /* zero-copy data */
916 unsigned int pgbase; /* zero-copy data */
917 const u32 * bitmask;
Bryan Schumaker82f2e542010-10-21 16:33:18 -0400918 int plus;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400919 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700920};
921
922struct nfs4_readdir_res {
923 nfs4_verifier verifier;
924 unsigned int pgbase;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400925 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700926};
927
928struct nfs4_readlink {
929 const struct nfs_fh * fh;
930 unsigned int pgbase;
931 unsigned int pglen; /* zero-copy data */
932 struct page ** pages; /* zero-copy data */
Benny Halevy9ff71c32009-04-01 09:21:52 -0400933 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700934};
935
Benny Halevyf50c7002009-04-01 09:21:55 -0400936struct nfs4_readlink_res {
937 struct nfs4_sequence_res seq_res;
938};
939
Trond Myklebust19d771f2008-10-08 13:54:52 -0400940#define NFS4_SETCLIENTID_NAMELEN (127)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700941struct nfs4_setclientid {
Chuck Levercc38bac2007-12-10 14:56:54 -0500942 const nfs4_verifier * sc_verifier;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700943 unsigned int sc_name_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400944 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500945 u32 sc_prog;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700946 unsigned int sc_netid_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400947 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700948 unsigned int sc_uaddr_len;
Chuck Leverd1ce02e2008-09-25 11:57:12 -0400949 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
Chuck Levercc38bac2007-12-10 14:56:54 -0500950 u32 sc_cb_ident;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700951};
952
Trond Myklebustbb8b27e2010-04-16 16:43:06 -0400953struct nfs4_setclientid_res {
954 u64 clientid;
955 nfs4_verifier confirm;
956};
957
Linus Torvalds1da177e2005-04-16 15:20:36 -0700958struct nfs4_statfs_arg {
959 const struct nfs_fh * fh;
960 const u32 * bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400961 struct nfs4_sequence_args seq_args;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700962};
963
Benny Halevy24ad1482009-04-01 09:21:56 -0400964struct nfs4_statfs_res {
965 struct nfs_fsstat *fsstat;
966 struct nfs4_sequence_res seq_res;
967};
968
Benny Halevy43652ad2009-04-01 09:21:54 -0400969struct nfs4_server_caps_arg {
970 struct nfs_fh *fhandle;
971 struct nfs4_sequence_args seq_args;
972};
973
Linus Torvalds1da177e2005-04-16 15:20:36 -0700974struct nfs4_server_caps_res {
Fred Isamandae100c2011-07-30 20:52:37 -0400975 u32 attr_bitmask[3];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700976 u32 acl_bitmask;
977 u32 has_links;
978 u32 has_symlinks;
Benny Halevy9ff71c32009-04-01 09:21:52 -0400979 struct nfs4_sequence_res seq_res;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700980};
981
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400982#define NFS4_PATHNAME_MAXCOMPONENTS 512
983struct nfs4_pathname {
984 unsigned int ncomponents;
985 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
986};
987
988#define NFS4_FS_LOCATION_MAXSERVERS 10
989struct nfs4_fs_location {
990 unsigned int nservers;
991 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
992 struct nfs4_pathname rootpath;
993};
994
995#define NFS4_FS_LOCATIONS_MAXENTRIES 10
996struct nfs4_fs_locations {
Trond Myklebust683b57b2006-06-09 09:34:22 -0400997 struct nfs_fattr fattr;
998 const struct nfs_server *server;
Manoj Naik7aaa0b32006-06-09 09:34:23 -0400999 struct nfs4_pathname fs_path;
Trond Myklebust683b57b2006-06-09 09:34:22 -04001000 int nlocations;
Manoj Naik7aaa0b32006-06-09 09:34:23 -04001001 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
Trond Myklebust683b57b2006-06-09 09:34:22 -04001002};
1003
1004struct nfs4_fs_locations_arg {
1005 const struct nfs_fh *dir_fh;
1006 const struct qstr *name;
1007 struct page *page;
1008 const u32 *bitmask;
Benny Halevy9ff71c32009-04-01 09:21:52 -04001009 struct nfs4_sequence_args seq_args;
Trond Myklebust683b57b2006-06-09 09:34:22 -04001010};
1011
Benny Halevy22958462009-04-01 09:22:02 -04001012struct nfs4_fs_locations_res {
1013 struct nfs4_fs_locations *fs_locations;
1014 struct nfs4_sequence_res seq_res;
1015};
1016
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001017struct nfs4_secinfo_oid {
1018 unsigned int len;
1019 char data[GSS_OID_MAX_LEN];
1020};
1021
1022struct nfs4_secinfo_gss {
1023 struct nfs4_secinfo_oid sec_oid4;
1024 unsigned int qop4;
1025 unsigned int service;
1026};
1027
1028struct nfs4_secinfo_flavor {
1029 unsigned int flavor;
1030 struct nfs4_secinfo_gss gss;
1031};
1032
1033struct nfs4_secinfo_flavors {
1034 unsigned int num_flavors;
1035 struct nfs4_secinfo_flavor flavors[0];
1036};
1037
1038struct nfs4_secinfo_arg {
1039 const struct nfs_fh *dir_fh;
1040 const struct qstr *name;
1041 struct nfs4_sequence_args seq_args;
1042};
1043
1044struct nfs4_secinfo_res {
1045 struct nfs4_secinfo_flavors *flavors;
1046 struct nfs4_sequence_res seq_res;
1047};
1048
Linus Torvalds1da177e2005-04-16 15:20:36 -07001049#endif /* CONFIG_NFS_V4 */
1050
Benny Halevy99fe60d2009-04-01 09:22:29 -04001051struct nfstime4 {
1052 u64 seconds;
1053 u32 nseconds;
1054};
1055
1056#ifdef CONFIG_NFS_V4_1
1057struct nfs_impl_id4 {
1058 u32 domain_len;
1059 char *domain;
1060 u32 name_len;
1061 char *name;
1062 struct nfstime4 date;
1063};
1064
1065#define NFS4_EXCHANGE_ID_LEN (48)
1066struct nfs41_exchange_id_args {
1067 struct nfs_client *client;
1068 nfs4_verifier *verifier;
1069 unsigned int id_len;
1070 char id[NFS4_EXCHANGE_ID_LEN];
1071 u32 flags;
1072};
1073
1074struct server_owner {
1075 uint64_t minor_id;
1076 uint32_t major_id_sz;
1077 char major_id[NFS4_OPAQUE_LIMIT];
1078};
1079
1080struct server_scope {
1081 uint32_t server_scope_sz;
1082 char server_scope[NFS4_OPAQUE_LIMIT];
1083};
1084
1085struct nfs41_exchange_id_res {
1086 struct nfs_client *client;
1087 u32 flags;
Weston Andros Adamson78fe0f42011-05-31 19:05:47 -04001088 struct server_scope *server_scope;
Benny Halevy99fe60d2009-04-01 09:22:29 -04001089};
Andy Adamsonfc931582009-04-01 09:22:31 -04001090
1091struct nfs41_create_session_args {
1092 struct nfs_client *client;
1093 uint32_t flags;
1094 uint32_t cb_program;
1095 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1096 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1097};
1098
1099struct nfs41_create_session_res {
1100 struct nfs_client *client;
1101};
Ricardo Labiaga180197532009-12-05 16:08:40 -05001102
1103struct nfs41_reclaim_complete_args {
1104 /* In the future extend to include curr_fh for use with migration */
1105 unsigned char one_fs:1;
1106 struct nfs4_sequence_args seq_args;
1107};
1108
1109struct nfs41_reclaim_complete_res {
1110 struct nfs4_sequence_res seq_res;
1111};
Bryan Schumakerfca78d62011-06-02 14:59:07 -04001112
1113#define SECINFO_STYLE_CURRENT_FH 0
1114#define SECINFO_STYLE_PARENT 1
1115struct nfs41_secinfo_no_name_args {
1116 int style;
1117 struct nfs4_sequence_args seq_args;
1118};
1119
Bryan Schumaker7d974792011-06-02 14:59:08 -04001120struct nfs41_test_stateid_args {
1121 nfs4_stateid *stateid;
1122 struct nfs4_sequence_args seq_args;
1123};
1124
1125struct nfs41_test_stateid_res {
1126 unsigned int status;
1127 struct nfs4_sequence_res seq_res;
1128};
1129
Bryan Schumaker9aeda352011-06-02 14:59:09 -04001130struct nfs41_free_stateid_args {
1131 nfs4_stateid *stateid;
1132 struct nfs4_sequence_args seq_args;
1133};
1134
1135struct nfs41_free_stateid_res {
1136 unsigned int status;
1137 struct nfs4_sequence_res seq_res;
1138};
1139
Benny Halevy99fe60d2009-04-01 09:22:29 -04001140#endif /* CONFIG_NFS_V4_1 */
1141
Linus Torvalds1da177e2005-04-16 15:20:36 -07001142struct nfs_page;
1143
Chuck Lever40859d72005-11-30 18:09:02 -05001144#define NFS_PAGEVEC_SIZE (8U)
1145
Linus Torvalds1da177e2005-04-16 15:20:36 -07001146struct nfs_read_data {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001147 struct rpc_task task;
1148 struct inode *inode;
1149 struct rpc_cred *cred;
1150 struct nfs_fattr fattr; /* fattr storage */
1151 struct list_head pages; /* Coalesced read requests */
Trond Myklebust6e4efd52011-07-12 13:42:02 -04001152 struct list_head list; /* lists of struct nfs_read_data */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001153 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -05001154 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -07001155 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001156 struct nfs_readargs args;
1157 struct nfs_readres res;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001158 unsigned long timestamp; /* For lease renewal */
Fred Isamanbae724e2011-03-01 01:34:15 +00001159 struct pnfs_layout_segment *lseg;
Andy Adamsond83217c2011-03-01 01:34:17 +00001160 struct nfs_client *ds_clp; /* pNFS data server */
Andy Adamson64419a92011-03-01 01:34:16 +00001161 const struct rpc_call_ops *mds_ops;
Andy Adamsoncbdabc7f2011-03-01 01:34:20 +00001162 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
Andy Adamsondc70d7b2011-03-01 01:34:19 +00001163 __u64 mds_offset;
Benny Halevyd20581a2011-05-22 19:52:03 +03001164 int pnfs_error;
Chuck Lever0d0b5cb2006-05-25 01:40:53 -04001165 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001166};
1167
1168struct nfs_write_data {
Linus Torvalds1da177e2005-04-16 15:20:36 -07001169 struct rpc_task task;
1170 struct inode *inode;
1171 struct rpc_cred *cred;
1172 struct nfs_fattr fattr;
1173 struct nfs_writeverf verf;
1174 struct list_head pages; /* Coalesced requests we wish to flush */
Trond Myklebust6e4efd52011-07-12 13:42:02 -04001175 struct list_head list; /* lists of struct nfs_write_data */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001176 struct nfs_page *req; /* multi ops per nfs_page */
Chuck Lever40859d72005-11-30 18:09:02 -05001177 struct page **pagevec;
Trond Myklebuste9f7bee2006-09-08 09:48:54 -07001178 unsigned int npages; /* Max length of pagevec */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001179 struct nfs_writeargs args; /* argument struct */
1180 struct nfs_writeres res; /* result struct */
Fred Isaman5053aa52011-03-03 15:13:43 +00001181 struct pnfs_layout_segment *lseg;
Fred Isamana69aef12011-03-03 15:13:47 +00001182 struct nfs_client *ds_clp; /* pNFS data server */
Fred Isamane0c2b382011-03-23 13:27:53 +00001183 int ds_commit_index;
Andy Adamson0382b742011-03-03 15:13:45 +00001184 const struct rpc_call_ops *mds_ops;
Fred Isamanb029bc92011-03-03 15:13:42 +00001185 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001186#ifdef CONFIG_NFS_V4
1187 unsigned long timestamp; /* For lease renewal */
1188#endif
Fred Isamana69aef12011-03-03 15:13:47 +00001189 __u64 mds_offset; /* Filelayout dense stripe */
Benny Halevyd20581a2011-05-22 19:52:03 +03001190 int pnfs_error;
Chuck Lever0d0b5cb2006-05-25 01:40:53 -04001191 struct page *page_array[NFS_PAGEVEC_SIZE];
Linus Torvalds1da177e2005-04-16 15:20:36 -07001192};
1193
1194struct nfs_access_entry;
Andy Adamson45a52a02011-03-01 01:34:08 +00001195struct nfs_client;
Trond Myklebuste0dca7a2011-03-14 18:20:01 -04001196struct rpc_timeout;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001197
1198/*
1199 * RPC procedure vector for NFSv2/NFSv3 demuxing
1200 */
1201struct nfs_rpc_ops {
Chuck Leverc0e07cb2008-01-14 12:32:05 -05001202 u32 version; /* Protocol version */
Al Virof786aa92009-02-20 05:51:22 +00001203 const struct dentry_operations *dentry_ops;
Arjan van de Venc5ef1c42007-02-12 00:55:40 -08001204 const struct inode_operations *dir_inode_ops;
1205 const struct inode_operations *file_inode_ops;
Jeff Layton1788ea62011-11-04 13:31:21 -04001206 const struct file_operations *file_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001207
1208 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1209 struct nfs_fsinfo *);
1210 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1211 struct nfs_fattr *);
1212 int (*setattr) (struct dentry *, struct nfs_fattr *,
1213 struct iattr *);
Bryan Schumaker7c513052011-03-24 17:12:24 +00001214 int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001215 struct nfs_fh *, struct nfs_fattr *);
1216 int (*access) (struct inode *, struct nfs_access_entry *);
1217 int (*readlink)(struct inode *, struct page *, unsigned int,
1218 unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001219 int (*create) (struct inode *, struct dentry *,
Trond Myklebustc0204fd2010-09-17 10:56:51 -04001220 struct iattr *, int, struct nfs_open_context *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001221 int (*remove) (struct inode *, struct qstr *);
Trond Myklebuste4eff1a2007-07-14 15:39:58 -04001222 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1223 int (*unlink_done) (struct rpc_task *, struct inode *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001224 int (*rename) (struct inode *, struct qstr *,
1225 struct inode *, struct qstr *);
Jeff Laytond3d41522010-09-17 17:31:57 -04001226 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1227 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001228 int (*link) (struct inode *, struct inode *, struct qstr *);
Chuck Lever94a6d752006-08-22 20:06:23 -04001229 int (*symlink) (struct inode *, struct dentry *, struct page *,
1230 unsigned int, struct iattr *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001231 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1232 int (*rmdir) (struct inode *, struct qstr *);
1233 int (*readdir) (struct dentry *, struct rpc_cred *,
Bryan Schumaker56e4ebf2010-10-20 15:44:37 -04001234 u64, struct page **, unsigned int, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001235 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1236 dev_t);
1237 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1238 struct nfs_fsstat *);
1239 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1240 struct nfs_fsinfo *);
1241 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1242 struct nfs_pathconf *);
David Howellse9326dc2006-08-22 20:06:10 -04001243 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
Chuck Lever573c4e12010-12-14 14:58:11 +00001244 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001245 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
Trond Myklebustec06c092006-03-20 13:44:27 -05001246 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001247 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -05001248 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
Trond Myklebustbdc7f022007-07-14 15:40:00 -04001249 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
Trond Myklebust788e7a82006-03-20 13:44:27 -05001250 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001251 int (*lock)(struct file *, int, struct file_lock *);
Trond Myklebust21162712008-05-20 19:34:39 -04001252 int (*lock_check_bounds)(const struct file_lock *);
Trond Myklebustada70d92005-06-22 17:16:22 +00001253 void (*clear_acl_cache)(struct inode *);
Trond Myklebust7fe5c392009-03-19 15:35:50 -04001254 void (*close_context)(struct nfs_open_context *ctx, int);
Trond Myklebust2b484292010-09-17 10:56:51 -04001255 struct inode * (*open_context) (struct inode *dir,
1256 struct nfs_open_context *ctx,
1257 int open_flags,
1258 struct iattr *iattr);
Andy Adamson45a52a02011-03-01 01:34:08 +00001259 int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1260 const char *, rpc_authflavor_t, int);
Bryan Schumaker5a5ea0d2011-03-24 17:12:29 +00001261 int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
Linus Torvalds1da177e2005-04-16 15:20:36 -07001262};
1263
1264/*
1265 * NFS_CALL(getattr, inode, (fattr));
1266 * into
1267 * NFS_PROTO(inode)->getattr(fattr);
1268 */
1269#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1270
1271/*
1272 * Function vectors etc. for the NFS client
1273 */
David Howells509de812006-08-22 20:06:11 -04001274extern const struct nfs_rpc_ops nfs_v2_clientops;
1275extern const struct nfs_rpc_ops nfs_v3_clientops;
1276extern const struct nfs_rpc_ops nfs_v4_clientops;
Trond Myklebusta613fa12012-01-20 13:53:56 -05001277extern const struct rpc_version nfs_version2;
1278extern const struct rpc_version nfs_version3;
1279extern const struct rpc_version nfs_version4;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001280
Trond Myklebusta613fa12012-01-20 13:53:56 -05001281extern const struct rpc_version nfsacl_version3;
1282extern const struct rpc_program nfsacl_program;
Andreas Gruenbacherb7fa0552005-06-22 17:16:27 +00001283
Linus Torvalds1da177e2005-04-16 15:20:36 -07001284#endif