NFSv4: Fix an Oops in the open recovery code
[linux-2.6-block.git] / include / linux / nfs_xdr.h
CommitLineData
1da177e4
LT
1#ifndef _LINUX_NFS_XDR_H
2#define _LINUX_NFS_XDR_H
3
b7fa0554 4#include <linux/nfsacl.h>
5a5ea0d4 5#include <linux/sunrpc/gss_api.h>
1da177e4 6
40859d7e
CL
7/*
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
5a5ea0d4
BS
17/* Forward declaration for NFS v3 */
18struct nfs4_secinfo_flavors;
19
6926afd1
TM
20struct nfs4_string {
21 unsigned int len;
22 char *data;
23};
24
8b4bdcf8
TM
25struct nfs_fsid {
26 uint64_t major;
27 uint64_t minor;
1da177e4
LT
28};
29
8b4bdcf8
TM
30/*
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
88034c3d
AA
38struct nfs4_threshold {
39 __u32 bm;
40 __u32 l_type;
41 __u64 rd_sz;
42 __u64 wr_sz;
43 __u64 rd_io_sz;
44 __u64 wr_io_sz;
45};
46
1da177e4 47struct nfs_fattr {
9e6e70f8 48 unsigned int valid; /* which fields are valid */
bca79478 49 umode_t mode;
1da177e4
LT
50 __u32 nlink;
51 __u32 uid;
52 __u32 gid;
9fa8d66f 53 dev_t rdev;
1da177e4
LT
54 __u64 size;
55 union {
56 struct {
57 __u32 blocksize;
58 __u32 blocks;
59 } nfs2;
60 struct {
61 __u64 used;
62 } nfs3;
63 } du;
8b4bdcf8 64 struct nfs_fsid fsid;
1da177e4 65 __u64 fileid;
28331a46 66 __u64 mounted_on_fileid;
1da177e4
LT
67 struct timespec atime;
68 struct timespec mtime;
69 struct timespec ctime;
1da177e4
LT
70 __u64 change_attr; /* NFSv4 change attribute */
71 __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
1ca277d8
TM
72 __u64 pre_size; /* pre_op_attr.size */
73 struct timespec pre_mtime; /* pre_op_attr.mtime */
74 struct timespec pre_ctime; /* pre_op_attr.ctime */
33801147 75 unsigned long time_start;
4704f0e2 76 unsigned long gencount;
6926afd1
TM
77 struct nfs4_string *owner_name;
78 struct nfs4_string *group_name;
88034c3d 79 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
1da177e4
LT
80};
81
9e6e70f8
TM
82#define NFS_ATTR_FATTR_TYPE (1U << 0)
83#define NFS_ATTR_FATTR_MODE (1U << 1)
84#define NFS_ATTR_FATTR_NLINK (1U << 2)
85#define NFS_ATTR_FATTR_OWNER (1U << 3)
86#define NFS_ATTR_FATTR_GROUP (1U << 4)
87#define NFS_ATTR_FATTR_RDEV (1U << 5)
88#define NFS_ATTR_FATTR_SIZE (1U << 6)
89#define NFS_ATTR_FATTR_PRESIZE (1U << 7)
90#define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
91#define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
92#define NFS_ATTR_FATTR_FSID (1U << 10)
93#define NFS_ATTR_FATTR_FILEID (1U << 11)
94#define NFS_ATTR_FATTR_ATIME (1U << 12)
95#define NFS_ATTR_FATTR_MTIME (1U << 13)
96#define NFS_ATTR_FATTR_CTIME (1U << 14)
97#define NFS_ATTR_FATTR_PREMTIME (1U << 15)
98#define NFS_ATTR_FATTR_PRECTIME (1U << 16)
99#define NFS_ATTR_FATTR_CHANGE (1U << 17)
100#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
81934ddb
CL
101#define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
102#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
103#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
104#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
105#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
106#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
9e6e70f8
TM
107
108#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
109 | NFS_ATTR_FATTR_MODE \
110 | NFS_ATTR_FATTR_NLINK \
111 | NFS_ATTR_FATTR_OWNER \
112 | NFS_ATTR_FATTR_GROUP \
113 | NFS_ATTR_FATTR_RDEV \
114 | NFS_ATTR_FATTR_SIZE \
115 | NFS_ATTR_FATTR_FSID \
116 | NFS_ATTR_FATTR_FILEID \
117 | NFS_ATTR_FATTR_ATIME \
118 | NFS_ATTR_FATTR_MTIME \
3a1556e8
TM
119 | NFS_ATTR_FATTR_CTIME \
120 | NFS_ATTR_FATTR_CHANGE)
9e6e70f8
TM
121#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
122 | NFS_ATTR_FATTR_BLOCKS_USED)
123#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
124 | NFS_ATTR_FATTR_SPACE_USED)
125#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
3a1556e8 126 | NFS_ATTR_FATTR_SPACE_USED)
1da177e4
LT
127
128/*
129 * Info on the file system
130 */
131struct nfs_fsinfo {
132 struct nfs_fattr *fattr; /* Post-op attributes */
133 __u32 rtmax; /* max. read transfer size */
134 __u32 rtpref; /* pref. read transfer size */
135 __u32 rtmult; /* reads should be multiple of this */
136 __u32 wtmax; /* max. write transfer size */
137 __u32 wtpref; /* pref. write transfer size */
138 __u32 wtmult; /* writes should be multiple of this */
139 __u32 dtpref; /* pref. readdir transfer size */
140 __u64 maxfilesize;
6b96724e 141 struct timespec time_delta; /* server time granularity */
1da177e4 142 __u32 lease_time; /* in seconds */
504913fb 143 __u32 layouttype; /* supported pnfs layout driver */
dae100c2 144 __u32 blksize; /* preferred pnfs io block size */
1da177e4
LT
145};
146
147struct nfs_fsstat {
148 struct nfs_fattr *fattr; /* Post-op attributes */
149 __u64 tbytes; /* total size in bytes */
150 __u64 fbytes; /* # of free bytes */
151 __u64 abytes; /* # of bytes available to user */
152 __u64 tfiles; /* # of files */
153 __u64 ffiles; /* # of free files */
154 __u64 afiles; /* # of files available to user */
155};
156
157struct nfs2_fsstat {
158 __u32 tsize; /* Server transfer size */
159 __u32 bsize; /* Filesystem block size */
160 __u32 blocks; /* No. of "bsize" blocks on filesystem */
161 __u32 bfree; /* No. of free "bsize" blocks */
162 __u32 bavail; /* No. of available "bsize" blocks */
163};
164
165struct nfs_pathconf {
166 struct nfs_fattr *fattr; /* Post-op attributes */
167 __u32 max_link; /* max # of hard links */
168 __u32 max_namelen; /* max name length */
169};
170
171struct nfs4_change_info {
172 u32 atomic;
173 u64 before;
174 u64 after;
175};
176
cee54fc9 177struct nfs_seqid;
9ff71c3a 178
557134a3
AA
179/* nfs41 sessions channel attributes */
180struct nfs4_channel_attrs {
557134a3
AA
181 u32 max_rqst_sz;
182 u32 max_resp_sz;
183 u32 max_resp_sz_cached;
184 u32 max_ops;
185 u32 max_reqs;
186};
187
188/* nfs41 sessions slot seqid */
189struct nfs4_slot {
190 u32 seq_nr;
191};
192
9ff71c3a 193struct nfs4_sequence_args {
f3752975 194 struct nfs4_session *sa_session;
45d43c29 195 u32 sa_slotid;
fbcd4abc 196 u8 sa_cache_this;
9ff71c3a
BH
197};
198
199struct nfs4_sequence_res {
f3752975 200 struct nfs4_session *sr_session;
dfb4f309 201 struct nfs4_slot *sr_slot; /* slot used to send request */
fbcd4abc 202 int sr_status; /* sequence operation status */
a01878aa 203 unsigned long sr_renewal_time;
0629e370 204 u32 sr_status_flags;
9ff71c3a
BH
205};
206
2050f0cc
AA
207struct nfs4_get_lease_time_args {
208 struct nfs4_sequence_args la_seq_args;
209};
210
211struct nfs4_get_lease_time_res {
212 struct nfs_fsinfo *lr_fsinfo;
213 struct nfs4_sequence_res lr_seq_res;
214};
215
b1f69b75
AA
216#define PNFS_LAYOUT_MAXSIZE 4096
217
218struct nfs4_layoutdriver_data {
35124a09
WAA
219 struct page **pages;
220 __u32 pglen;
b1f69b75 221 __u32 len;
b1f69b75
AA
222};
223
224struct pnfs_layout_range {
225 u32 iomode;
226 u64 offset;
227 u64 length;
228};
229
230struct nfs4_layoutget_args {
231 __u32 type;
232 struct pnfs_layout_range range;
233 __u64 minlength;
234 __u32 maxcount;
235 struct inode *inode;
236 struct nfs_open_context *ctx;
237 struct nfs4_sequence_args seq_args;
cf7d63f1 238 nfs4_stateid stateid;
35124a09 239 struct nfs4_layoutdriver_data layout;
b1f69b75
AA
240};
241
242struct nfs4_layoutget_res {
243 __u32 return_on_close;
244 struct pnfs_layout_range range;
245 __u32 type;
246 nfs4_stateid stateid;
b1f69b75 247 struct nfs4_sequence_res seq_res;
35124a09 248 struct nfs4_layoutdriver_data *layoutp;
b1f69b75
AA
249};
250
251struct nfs4_layoutget {
252 struct nfs4_layoutget_args args;
253 struct nfs4_layoutget_res res;
254 struct pnfs_layout_segment **lsegpp;
a75b9df9 255 gfp_t gfp_flags;
b1f69b75
AA
256};
257
7f11d8d3
AA
258struct nfs4_getdevicelist_args {
259 const struct nfs_fh *fh;
260 u32 layoutclass;
261 struct nfs4_sequence_args seq_args;
262};
263
264struct nfs4_getdevicelist_res {
265 struct pnfs_devicelist *devlist;
266 struct nfs4_sequence_res seq_res;
267};
268
b1f69b75
AA
269struct nfs4_getdeviceinfo_args {
270 struct pnfs_device *pdev;
271 struct nfs4_sequence_args seq_args;
272};
273
274struct nfs4_getdeviceinfo_res {
275 struct pnfs_device *pdev;
276 struct nfs4_sequence_res seq_res;
277};
278
863a3c6c
AA
279struct nfs4_layoutcommit_args {
280 nfs4_stateid stateid;
281 __u64 lastbytewritten;
282 struct inode *inode;
283 const u32 *bitmask;
284 struct nfs4_sequence_args seq_args;
285};
286
287struct nfs4_layoutcommit_res {
288 struct nfs_fattr *fattr;
289 const struct nfs_server *server;
290 struct nfs4_sequence_res seq_res;
db29c089 291 int status;
863a3c6c
AA
292};
293
294struct nfs4_layoutcommit_data {
295 struct rpc_task task;
296 struct nfs_fattr fattr;
a9bae566 297 struct list_head lseg_list;
863a3c6c
AA
298 struct rpc_cred *cred;
299 struct nfs4_layoutcommit_args args;
300 struct nfs4_layoutcommit_res res;
301};
302
cbe82603 303struct nfs4_layoutreturn_args {
a56aaa02 304 struct pnfs_layout_hdr *layout;
cbe82603
BH
305 struct inode *inode;
306 nfs4_stateid stateid;
a56aaa02 307 __u32 layout_type;
cbe82603
BH
308 struct nfs4_sequence_args seq_args;
309};
310
311struct nfs4_layoutreturn_res {
312 struct nfs4_sequence_res seq_res;
313 u32 lrs_present;
314 nfs4_stateid stateid;
315};
316
317struct nfs4_layoutreturn {
318 struct nfs4_layoutreturn_args args;
319 struct nfs4_layoutreturn_res res;
320 struct rpc_cred *cred;
321 struct nfs_client *clp;
322 int rpc_status;
323};
324
95b72eb0
TM
325struct stateowner_id {
326 __u64 create_time;
327 __u32 uniquifier;
328};
329
1da177e4
LT
330/*
331 * Arguments to the open call.
332 */
333struct nfs_openargs {
334 const struct nfs_fh * fh;
cee54fc9 335 struct nfs_seqid * seqid;
1da177e4 336 int open_flags;
dc0b027d 337 fmode_t fmode;
1da177e4 338 __u64 clientid;
95b72eb0 339 struct stateowner_id id;
1da177e4 340 union {
d77d76ff
TM
341 struct {
342 struct iattr * attrs; /* UNCHECKED, GUARDED */
343 nfs4_verifier verifier; /* EXCLUSIVE */
344 };
1da177e4 345 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
bd7bf9d5 346 fmode_t delegation_type; /* CLAIM_PREVIOUS */
1da177e4
LT
347 } u;
348 const struct qstr * name;
349 const struct nfs_server *server; /* Needed for ID mapping */
350 const u32 * bitmask;
1549210f 351 const u32 * open_bitmap;
1da177e4 352 __u32 claim;
9ff71c3a 353 struct nfs4_sequence_args seq_args;
1da177e4
LT
354};
355
356struct nfs_openres {
357 nfs4_stateid stateid;
358 struct nfs_fh fh;
359 struct nfs4_change_info cinfo;
360 __u32 rflags;
361 struct nfs_fattr * f_attr;
c1d51931 362 struct nfs_seqid * seqid;
1da177e4 363 const struct nfs_server *server;
bd7bf9d5 364 fmode_t delegation_type;
1da177e4
LT
365 nfs4_stateid delegation;
366 __u32 do_recall;
367 __u64 maxsize;
aa53ed54 368 __u32 attrset[NFS4_BITMAP_SIZE];
6926afd1
TM
369 struct nfs4_string *owner;
370 struct nfs4_string *group_owner;
9ff71c3a 371 struct nfs4_sequence_res seq_res;
1da177e4
LT
372};
373
374/*
375 * Arguments to the open_confirm call.
376 */
377struct nfs_open_confirmargs {
378 const struct nfs_fh * fh;
cdd4e68b 379 nfs4_stateid * stateid;
cee54fc9 380 struct nfs_seqid * seqid;
1da177e4
LT
381};
382
383struct nfs_open_confirmres {
384 nfs4_stateid stateid;
c1d51931 385 struct nfs_seqid * seqid;
1da177e4
LT
386};
387
388/*
389 * Arguments to the close call.
390 */
391struct nfs_closeargs {
392 struct nfs_fh * fh;
9512135d 393 nfs4_stateid * stateid;
cee54fc9 394 struct nfs_seqid * seqid;
dc0b027d 395 fmode_t fmode;
516a6af6 396 const u32 * bitmask;
9ff71c3a 397 struct nfs4_sequence_args seq_args;
1da177e4
LT
398};
399
400struct nfs_closeres {
401 nfs4_stateid stateid;
516a6af6 402 struct nfs_fattr * fattr;
c1d51931 403 struct nfs_seqid * seqid;
516a6af6 404 const struct nfs_server *server;
9ff71c3a 405 struct nfs4_sequence_res seq_res;
1da177e4
LT
406};
407/*
408 * * Arguments to the lock,lockt, and locku call.
409 * */
410struct nfs_lowner {
911d1aaf 411 __u64 clientid;
9f958ab8 412 __u64 id;
d035c36c 413 dev_t s_dev;
1da177e4
LT
414};
415
911d1aaf
TM
416struct nfs_lock_args {
417 struct nfs_fh * fh;
418 struct file_lock * fl;
cee54fc9 419 struct nfs_seqid * lock_seqid;
06735b34
TM
420 nfs4_stateid * lock_stateid;
421 struct nfs_seqid * open_seqid;
422 nfs4_stateid * open_stateid;
911d1aaf
TM
423 struct nfs_lowner lock_owner;
424 unsigned char block : 1;
425 unsigned char reclaim : 1;
426 unsigned char new_lock_owner : 1;
9ff71c3a 427 struct nfs4_sequence_args seq_args;
911d1aaf
TM
428};
429
430struct nfs_lock_res {
c1d51931
TM
431 nfs4_stateid stateid;
432 struct nfs_seqid * lock_seqid;
433 struct nfs_seqid * open_seqid;
9ff71c3a 434 struct nfs4_sequence_res seq_res;
1da177e4
LT
435};
436
911d1aaf
TM
437struct nfs_locku_args {
438 struct nfs_fh * fh;
439 struct file_lock * fl;
cee54fc9 440 struct nfs_seqid * seqid;
faf5f49c 441 nfs4_stateid * stateid;
9ff71c3a 442 struct nfs4_sequence_args seq_args;
1da177e4
LT
443};
444
911d1aaf 445struct nfs_locku_res {
c1d51931
TM
446 nfs4_stateid stateid;
447 struct nfs_seqid * seqid;
9ff71c3a 448 struct nfs4_sequence_res seq_res;
1da177e4
LT
449};
450
911d1aaf
TM
451struct nfs_lockt_args {
452 struct nfs_fh * fh;
453 struct file_lock * fl;
454 struct nfs_lowner lock_owner;
9ff71c3a 455 struct nfs4_sequence_args seq_args;
1da177e4
LT
456};
457
911d1aaf
TM
458struct nfs_lockt_res {
459 struct file_lock * denied; /* LOCK, LOCKT failed */
9ff71c3a 460 struct nfs4_sequence_res seq_res;
1da177e4
LT
461};
462
d3c7b7cc
TM
463struct nfs_release_lockowner_args {
464 struct nfs_lowner lock_owner;
465};
466
1da177e4
LT
467struct nfs4_delegreturnargs {
468 const struct nfs_fh *fhandle;
469 const nfs4_stateid *stateid;
fa178f29 470 const u32 * bitmask;
9ff71c3a 471 struct nfs4_sequence_args seq_args;
fa178f29
TM
472};
473
474struct nfs4_delegreturnres {
475 struct nfs_fattr * fattr;
476 const struct nfs_server *server;
9ff71c3a 477 struct nfs4_sequence_res seq_res;
1da177e4
LT
478};
479
480/*
481 * Arguments to the read call.
482 */
1da177e4
LT
483struct nfs_readargs {
484 struct nfs_fh * fh;
485 struct nfs_open_context *context;
f11ac8db 486 struct nfs_lock_context *lock_context;
1da177e4
LT
487 __u64 offset;
488 __u32 count;
489 unsigned int pgbase;
490 struct page ** pages;
9ff71c3a 491 struct nfs4_sequence_args seq_args;
1da177e4
LT
492};
493
494struct nfs_readres {
495 struct nfs_fattr * fattr;
496 __u32 count;
497 int eof;
9ff71c3a 498 struct nfs4_sequence_res seq_res;
1da177e4
LT
499};
500
501/*
502 * Arguments to the write call.
503 */
1da177e4
LT
504struct nfs_writeargs {
505 struct nfs_fh * fh;
506 struct nfs_open_context *context;
f11ac8db 507 struct nfs_lock_context *lock_context;
1da177e4
LT
508 __u64 offset;
509 __u32 count;
510 enum nfs3_stable_how stable;
511 unsigned int pgbase;
512 struct page ** pages;
4f9838c7 513 const u32 * bitmask;
9ff71c3a 514 struct nfs4_sequence_args seq_args;
1da177e4
LT
515};
516
517struct nfs_writeverf {
518 enum nfs3_stable_how committed;
bc4785cd 519 __be32 verifier[2];
1da177e4
LT
520};
521
522struct nfs_writeres {
523 struct nfs_fattr * fattr;
524 struct nfs_writeverf * verf;
525 __u32 count;
4f9838c7 526 const struct nfs_server *server;
9ff71c3a 527 struct nfs4_sequence_res seq_res;
1da177e4
LT
528};
529
0b7c0153
FI
530/*
531 * Arguments to the commit call.
532 */
533struct nfs_commitargs {
534 struct nfs_fh *fh;
535 __u64 offset;
536 __u32 count;
537 const u32 *bitmask;
538 struct nfs4_sequence_args seq_args;
539};
540
541struct nfs_commitres {
542 struct nfs_fattr *fattr;
543 struct nfs_writeverf *verf;
544 const struct nfs_server *server;
545 struct nfs4_sequence_res seq_res;
546};
547
4fdc17b2
TM
548/*
549 * Common arguments to the unlink call
550 */
551struct nfs_removeargs {
552 const struct nfs_fh *fh;
553 struct qstr name;
9ff71c3a 554 struct nfs4_sequence_args seq_args;
4fdc17b2
TM
555};
556
557struct nfs_removeres {
558 const struct nfs_server *server;
d346890b 559 struct nfs_fattr *dir_attr;
4fdc17b2 560 struct nfs4_change_info cinfo;
9ff71c3a 561 struct nfs4_sequence_res seq_res;
4fdc17b2
TM
562};
563
920769f0
JL
564/*
565 * Common arguments to the rename call
566 */
567struct nfs_renameargs {
568 const struct nfs_fh *old_dir;
569 const struct nfs_fh *new_dir;
570 const struct qstr *old_name;
571 const struct qstr *new_name;
920769f0
JL
572 struct nfs4_sequence_args seq_args;
573};
574
e8582a8b
JL
575struct nfs_renameres {
576 const struct nfs_server *server;
577 struct nfs4_change_info old_cinfo;
578 struct nfs_fattr *old_fattr;
579 struct nfs4_change_info new_cinfo;
580 struct nfs_fattr *new_fattr;
581 struct nfs4_sequence_res seq_res;
582};
583
1da177e4
LT
584/*
585 * Argument struct for decode_entry function
586 */
587struct nfs_entry {
588 __u64 ino;
589 __u64 cookie,
590 prev_cookie;
591 const char * name;
592 unsigned int len;
593 int eof;
594 struct nfs_fh * fh;
595 struct nfs_fattr * fattr;
0b26a0bf 596 unsigned char d_type;
573c4e1e 597 struct nfs_server * server;
1da177e4
LT
598};
599
600/*
601 * The following types are for NFSv2 only.
602 */
603struct nfs_sattrargs {
604 struct nfs_fh * fh;
605 struct iattr * sattr;
606};
607
608struct nfs_diropargs {
609 struct nfs_fh * fh;
610 const char * name;
611 unsigned int len;
612};
613
614struct nfs_createargs {
615 struct nfs_fh * fh;
616 const char * name;
617 unsigned int len;
618 struct iattr * sattr;
619};
620
1da177e4
LT
621struct nfs_setattrargs {
622 struct nfs_fh * fh;
623 nfs4_stateid stateid;
624 struct iattr * iap;
625 const struct nfs_server * server; /* Needed for name mapping */
626 const u32 * bitmask;
9ff71c3a 627 struct nfs4_sequence_args seq_args;
1da177e4
LT
628};
629
23ec6965
BF
630struct nfs_setaclargs {
631 struct nfs_fh * fh;
632 size_t acl_len;
633 unsigned int acl_pgbase;
634 struct page ** acl_pages;
9ff71c3a 635 struct nfs4_sequence_args seq_args;
23ec6965
BF
636};
637
73c403a9
BH
638struct nfs_setaclres {
639 struct nfs4_sequence_res seq_res;
640};
641
029d105e
BF
642struct nfs_getaclargs {
643 struct nfs_fh * fh;
644 size_t acl_len;
645 unsigned int acl_pgbase;
646 struct page ** acl_pages;
9ff71c3a 647 struct nfs4_sequence_args seq_args;
029d105e
BF
648};
649
bf118a34
AA
650/* getxattr ACL interface flags */
651#define NFS4_ACL_LEN_REQUEST 0x0001 /* zero length getxattr buffer */
663c79b3
BH
652struct nfs_getaclres {
653 size_t acl_len;
bf118a34
AA
654 size_t acl_data_offset;
655 int acl_flags;
331818f1 656 struct page * acl_scratch;
663c79b3
BH
657 struct nfs4_sequence_res seq_res;
658};
659
1da177e4
LT
660struct nfs_setattrres {
661 struct nfs_fattr * fattr;
662 const struct nfs_server * server;
9ff71c3a 663 struct nfs4_sequence_res seq_res;
1da177e4
LT
664};
665
666struct nfs_linkargs {
667 struct nfs_fh * fromfh;
668 struct nfs_fh * tofh;
669 const char * toname;
670 unsigned int tolen;
671};
672
673struct nfs_symlinkargs {
674 struct nfs_fh * fromfh;
675 const char * fromname;
676 unsigned int fromlen;
94a6d753
CL
677 struct page ** pages;
678 unsigned int pathlen;
1da177e4
LT
679 struct iattr * sattr;
680};
681
682struct nfs_readdirargs {
683 struct nfs_fh * fh;
684 __u32 cookie;
685 unsigned int count;
686 struct page ** pages;
687};
688
b7fa0554
AG
689struct nfs3_getaclargs {
690 struct nfs_fh * fh;
691 int mask;
692 struct page ** pages;
693};
694
695struct nfs3_setaclargs {
696 struct inode * inode;
697 int mask;
698 struct posix_acl * acl_access;
699 struct posix_acl * acl_default;
ae46141f
TM
700 size_t len;
701 unsigned int npages;
b7fa0554
AG
702 struct page ** pages;
703};
704
1da177e4
LT
705struct nfs_diropok {
706 struct nfs_fh * fh;
707 struct nfs_fattr * fattr;
708};
709
710struct nfs_readlinkargs {
711 struct nfs_fh * fh;
712 unsigned int pgbase;
713 unsigned int pglen;
714 struct page ** pages;
715};
716
717struct nfs3_sattrargs {
718 struct nfs_fh * fh;
719 struct iattr * sattr;
720 unsigned int guard;
721 struct timespec guardtime;
722};
723
724struct nfs3_diropargs {
725 struct nfs_fh * fh;
726 const char * name;
727 unsigned int len;
728};
729
730struct nfs3_accessargs {
731 struct nfs_fh * fh;
732 __u32 access;
733};
734
735struct nfs3_createargs {
736 struct nfs_fh * fh;
737 const char * name;
738 unsigned int len;
739 struct iattr * sattr;
740 enum nfs3_createmode createmode;
bc4785cd 741 __be32 verifier[2];
1da177e4
LT
742};
743
744struct nfs3_mkdirargs {
745 struct nfs_fh * fh;
746 const char * name;
747 unsigned int len;
748 struct iattr * sattr;
749};
750
751struct nfs3_symlinkargs {
752 struct nfs_fh * fromfh;
753 const char * fromname;
754 unsigned int fromlen;
94a6d753
CL
755 struct page ** pages;
756 unsigned int pathlen;
1da177e4
LT
757 struct iattr * sattr;
758};
759
760struct nfs3_mknodargs {
761 struct nfs_fh * fh;
762 const char * name;
763 unsigned int len;
764 enum nfs3_ftype type;
765 struct iattr * sattr;
766 dev_t rdev;
767};
768
1da177e4
LT
769struct nfs3_linkargs {
770 struct nfs_fh * fromfh;
771 struct nfs_fh * tofh;
772 const char * toname;
773 unsigned int tolen;
774};
775
776struct nfs3_readdirargs {
777 struct nfs_fh * fh;
778 __u64 cookie;
bc4785cd 779 __be32 verf[2];
1da177e4
LT
780 int plus;
781 unsigned int count;
782 struct page ** pages;
783};
784
785struct nfs3_diropres {
786 struct nfs_fattr * dir_attr;
787 struct nfs_fh * fh;
788 struct nfs_fattr * fattr;
789};
790
791struct nfs3_accessres {
792 struct nfs_fattr * fattr;
793 __u32 access;
794};
795
796struct nfs3_readlinkargs {
797 struct nfs_fh * fh;
798 unsigned int pgbase;
799 unsigned int pglen;
800 struct page ** pages;
801};
802
1da177e4
LT
803struct nfs3_linkres {
804 struct nfs_fattr * dir_attr;
805 struct nfs_fattr * fattr;
806};
807
808struct nfs3_readdirres {
809 struct nfs_fattr * dir_attr;
bc4785cd 810 __be32 * verf;
1da177e4
LT
811 int plus;
812};
813
b7fa0554
AG
814struct nfs3_getaclres {
815 struct nfs_fattr * fattr;
816 int mask;
817 unsigned int acl_access_count;
818 unsigned int acl_default_count;
819 struct posix_acl * acl_access;
820 struct posix_acl * acl_default;
821};
822
1da177e4
LT
823#ifdef CONFIG_NFS_V4
824
825typedef u64 clientid4;
826
827struct nfs4_accessargs {
828 const struct nfs_fh * fh;
76b32999 829 const u32 * bitmask;
1da177e4 830 u32 access;
9ff71c3a 831 struct nfs4_sequence_args seq_args;
1da177e4
LT
832};
833
834struct nfs4_accessres {
76b32999
TM
835 const struct nfs_server * server;
836 struct nfs_fattr * fattr;
1da177e4
LT
837 u32 supported;
838 u32 access;
9ff71c3a 839 struct nfs4_sequence_res seq_res;
1da177e4
LT
840};
841
842struct nfs4_create_arg {
843 u32 ftype;
844 union {
94a6d753
CL
845 struct {
846 struct page ** pages;
847 unsigned int len;
848 } symlink; /* NF4LNK */
1da177e4
LT
849 struct {
850 u32 specdata1;
851 u32 specdata2;
852 } device; /* NF4BLK, NF4CHR */
853 } u;
854 const struct qstr * name;
855 const struct nfs_server * server;
856 const struct iattr * attrs;
857 const struct nfs_fh * dir_fh;
858 const u32 * bitmask;
9ff71c3a 859 struct nfs4_sequence_args seq_args;
1da177e4
LT
860};
861
862struct nfs4_create_res {
863 const struct nfs_server * server;
864 struct nfs_fh * fh;
865 struct nfs_fattr * fattr;
866 struct nfs4_change_info dir_cinfo;
9ff71c3a 867 struct nfs4_sequence_res seq_res;
1da177e4
LT
868};
869
870struct nfs4_fsinfo_arg {
871 const struct nfs_fh * fh;
872 const u32 * bitmask;
9ff71c3a 873 struct nfs4_sequence_args seq_args;
1da177e4
LT
874};
875
3dda5e43
BH
876struct nfs4_fsinfo_res {
877 struct nfs_fsinfo *fsinfo;
878 struct nfs4_sequence_res seq_res;
879};
880
1da177e4
LT
881struct nfs4_getattr_arg {
882 const struct nfs_fh * fh;
883 const u32 * bitmask;
9ff71c3a 884 struct nfs4_sequence_args seq_args;
1da177e4
LT
885};
886
887struct nfs4_getattr_res {
888 const struct nfs_server * server;
889 struct nfs_fattr * fattr;
9ff71c3a 890 struct nfs4_sequence_res seq_res;
1da177e4
LT
891};
892
893struct nfs4_link_arg {
894 const struct nfs_fh * fh;
895 const struct nfs_fh * dir_fh;
896 const struct qstr * name;
91ba2eee 897 const u32 * bitmask;
9ff71c3a 898 struct nfs4_sequence_args seq_args;
91ba2eee
TM
899};
900
901struct nfs4_link_res {
902 const struct nfs_server * server;
903 struct nfs_fattr * fattr;
904 struct nfs4_change_info cinfo;
905 struct nfs_fattr * dir_attr;
9ff71c3a 906 struct nfs4_sequence_res seq_res;
1da177e4
LT
907};
908
91ba2eee 909
1da177e4
LT
910struct nfs4_lookup_arg {
911 const struct nfs_fh * dir_fh;
912 const struct qstr * name;
913 const u32 * bitmask;
9ff71c3a 914 struct nfs4_sequence_args seq_args;
1da177e4
LT
915};
916
917struct nfs4_lookup_res {
918 const struct nfs_server * server;
919 struct nfs_fattr * fattr;
920 struct nfs_fh * fh;
9ff71c3a 921 struct nfs4_sequence_res seq_res;
1da177e4
LT
922};
923
924struct nfs4_lookup_root_arg {
925 const u32 * bitmask;
9ff71c3a 926 struct nfs4_sequence_args seq_args;
1da177e4
LT
927};
928
929struct nfs4_pathconf_arg {
930 const struct nfs_fh * fh;
931 const u32 * bitmask;
9ff71c3a 932 struct nfs4_sequence_args seq_args;
1da177e4
LT
933};
934
d45b2989
BH
935struct nfs4_pathconf_res {
936 struct nfs_pathconf *pathconf;
937 struct nfs4_sequence_res seq_res;
938};
939
1da177e4
LT
940struct nfs4_readdir_arg {
941 const struct nfs_fh * fh;
942 u64 cookie;
943 nfs4_verifier verifier;
944 u32 count;
945 struct page ** pages; /* zero-copy data */
946 unsigned int pgbase; /* zero-copy data */
947 const u32 * bitmask;
82f2e547 948 int plus;
9ff71c3a 949 struct nfs4_sequence_args seq_args;
1da177e4
LT
950};
951
952struct nfs4_readdir_res {
953 nfs4_verifier verifier;
954 unsigned int pgbase;
9ff71c3a 955 struct nfs4_sequence_res seq_res;
1da177e4
LT
956};
957
958struct nfs4_readlink {
959 const struct nfs_fh * fh;
960 unsigned int pgbase;
961 unsigned int pglen; /* zero-copy data */
962 struct page ** pages; /* zero-copy data */
9ff71c3a 963 struct nfs4_sequence_args seq_args;
1da177e4
LT
964};
965
f50c7000
BH
966struct nfs4_readlink_res {
967 struct nfs4_sequence_res seq_res;
968};
969
19d771f3 970#define NFS4_SETCLIENTID_NAMELEN (127)
1da177e4 971struct nfs4_setclientid {
cc38bac3 972 const nfs4_verifier * sc_verifier;
1da177e4 973 unsigned int sc_name_len;
d1ce02e1 974 char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
cc38bac3 975 u32 sc_prog;
1da177e4 976 unsigned int sc_netid_len;
d1ce02e1 977 char sc_netid[RPCBIND_MAXNETIDLEN + 1];
1da177e4 978 unsigned int sc_uaddr_len;
d1ce02e1 979 char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
cc38bac3 980 u32 sc_cb_ident;
1da177e4
LT
981};
982
bb8b27e5
TM
983struct nfs4_setclientid_res {
984 u64 clientid;
985 nfs4_verifier confirm;
986};
987
1da177e4
LT
988struct nfs4_statfs_arg {
989 const struct nfs_fh * fh;
990 const u32 * bitmask;
9ff71c3a 991 struct nfs4_sequence_args seq_args;
1da177e4
LT
992};
993
24ad148a
BH
994struct nfs4_statfs_res {
995 struct nfs_fsstat *fsstat;
996 struct nfs4_sequence_res seq_res;
997};
998
43652ad5
BH
999struct nfs4_server_caps_arg {
1000 struct nfs_fh *fhandle;
1001 struct nfs4_sequence_args seq_args;
1002};
1003
1da177e4 1004struct nfs4_server_caps_res {
dae100c2 1005 u32 attr_bitmask[3];
1da177e4
LT
1006 u32 acl_bitmask;
1007 u32 has_links;
1008 u32 has_symlinks;
264e6351 1009 u32 fh_expire_type;
9ff71c3a 1010 struct nfs4_sequence_res seq_res;
1da177e4
LT
1011};
1012
7aaa0b3b
MN
1013#define NFS4_PATHNAME_MAXCOMPONENTS 512
1014struct nfs4_pathname {
1015 unsigned int ncomponents;
1016 struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
1017};
1018
1019#define NFS4_FS_LOCATION_MAXSERVERS 10
1020struct nfs4_fs_location {
1021 unsigned int nservers;
1022 struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
1023 struct nfs4_pathname rootpath;
1024};
1025
1026#define NFS4_FS_LOCATIONS_MAXENTRIES 10
1027struct nfs4_fs_locations {
683b57b4
TM
1028 struct nfs_fattr fattr;
1029 const struct nfs_server *server;
7aaa0b3b 1030 struct nfs4_pathname fs_path;
683b57b4 1031 int nlocations;
7aaa0b3b 1032 struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
683b57b4
TM
1033};
1034
1035struct nfs4_fs_locations_arg {
1036 const struct nfs_fh *dir_fh;
1037 const struct qstr *name;
1038 struct page *page;
1039 const u32 *bitmask;
9ff71c3a 1040 struct nfs4_sequence_args seq_args;
683b57b4
TM
1041};
1042
22958463
BH
1043struct nfs4_fs_locations_res {
1044 struct nfs4_fs_locations *fs_locations;
1045 struct nfs4_sequence_res seq_res;
1046};
1047
5a5ea0d4
BS
1048struct nfs4_secinfo_oid {
1049 unsigned int len;
1050 char data[GSS_OID_MAX_LEN];
1051};
1052
1053struct nfs4_secinfo_gss {
1054 struct nfs4_secinfo_oid sec_oid4;
1055 unsigned int qop4;
1056 unsigned int service;
1057};
1058
1059struct nfs4_secinfo_flavor {
1060 unsigned int flavor;
1061 struct nfs4_secinfo_gss gss;
1062};
1063
1064struct nfs4_secinfo_flavors {
1065 unsigned int num_flavors;
1066 struct nfs4_secinfo_flavor flavors[0];
1067};
1068
1069struct nfs4_secinfo_arg {
1070 const struct nfs_fh *dir_fh;
1071 const struct qstr *name;
1072 struct nfs4_sequence_args seq_args;
1073};
1074
1075struct nfs4_secinfo_res {
1076 struct nfs4_secinfo_flavors *flavors;
1077 struct nfs4_sequence_res seq_res;
1078};
1079
1da177e4
LT
1080#endif /* CONFIG_NFS_V4 */
1081
99fe60d0
BH
1082struct nfstime4 {
1083 u64 seconds;
1084 u32 nseconds;
1085};
1086
1087#ifdef CONFIG_NFS_V4_1
ea2cf228
FI
1088
1089struct pnfs_commit_bucket {
1090 struct list_head written;
1091 struct list_head committing;
1092 struct pnfs_layout_segment *wlseg;
1093 struct pnfs_layout_segment *clseg;
1094};
1095
1096struct pnfs_ds_commit_info {
1097 int nwritten;
1098 int ncommitting;
1099 int nbuckets;
1100 struct pnfs_commit_bucket *buckets;
1101};
1102
99fe60d0
BH
1103#define NFS4_EXCHANGE_ID_LEN (48)
1104struct nfs41_exchange_id_args {
1105 struct nfs_client *client;
1106 nfs4_verifier *verifier;
1107 unsigned int id_len;
1108 char id[NFS4_EXCHANGE_ID_LEN];
1109 u32 flags;
1110};
1111
acdeb69d 1112struct nfs41_server_owner {
99fe60d0
BH
1113 uint64_t minor_id;
1114 uint32_t major_id_sz;
1115 char major_id[NFS4_OPAQUE_LIMIT];
1116};
1117
79d4e1f0 1118struct nfs41_server_scope {
99fe60d0
BH
1119 uint32_t server_scope_sz;
1120 char server_scope[NFS4_OPAQUE_LIMIT];
1121};
1122
7d2ed9ac
WAA
1123struct nfs41_impl_id {
1124 char domain[NFS4_OPAQUE_LIMIT + 1];
1125 char name[NFS4_OPAQUE_LIMIT + 1];
1126 struct nfstime4 date;
1127};
1128
7c44f1ae
WAA
1129struct nfs41_bind_conn_to_session_res {
1130 struct nfs4_session *session;
1131 u32 dir;
1132 bool use_conn_in_rdma_mode;
1133};
1134
99fe60d0 1135struct nfs41_exchange_id_res {
32b01310
TM
1136 u64 clientid;
1137 u32 seqid;
99fe60d0 1138 u32 flags;
acdeb69d 1139 struct nfs41_server_owner *server_owner;
79d4e1f0 1140 struct nfs41_server_scope *server_scope;
7d2ed9ac 1141 struct nfs41_impl_id *impl_id;
99fe60d0 1142};
fc931582
AA
1143
1144struct nfs41_create_session_args {
1145 struct nfs_client *client;
1146 uint32_t flags;
1147 uint32_t cb_program;
1148 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
1149 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
1150};
1151
1152struct nfs41_create_session_res {
1153 struct nfs_client *client;
1154};
18019753
RL
1155
1156struct nfs41_reclaim_complete_args {
1157 /* In the future extend to include curr_fh for use with migration */
1158 unsigned char one_fs:1;
1159 struct nfs4_sequence_args seq_args;
1160};
1161
1162struct nfs41_reclaim_complete_res {
1163 struct nfs4_sequence_res seq_res;
1164};
fca78d6d
BS
1165
1166#define SECINFO_STYLE_CURRENT_FH 0
1167#define SECINFO_STYLE_PARENT 1
1168struct nfs41_secinfo_no_name_args {
1169 int style;
1170 struct nfs4_sequence_args seq_args;
1171};
1172
7d974794
BS
1173struct nfs41_test_stateid_args {
1174 nfs4_stateid *stateid;
1175 struct nfs4_sequence_args seq_args;
1176};
1177
1178struct nfs41_test_stateid_res {
1179 unsigned int status;
1180 struct nfs4_sequence_res seq_res;
1181};
1182
9aeda35f
BS
1183struct nfs41_free_stateid_args {
1184 nfs4_stateid *stateid;
1185 struct nfs4_sequence_args seq_args;
1186};
1187
1188struct nfs41_free_stateid_res {
1189 unsigned int status;
1190 struct nfs4_sequence_res seq_res;
1191};
1192
4f97615d
TM
1193#else
1194
1195struct pnfs_ds_commit_info {
1196};
1197
99fe60d0
BH
1198#endif /* CONFIG_NFS_V4_1 */
1199
1da177e4
LT
1200struct nfs_page;
1201
40859d7e
CL
1202#define NFS_PAGEVEC_SIZE (8U)
1203
30dd374f
FI
1204struct nfs_page_array {
1205 struct page **pagevec;
1206 unsigned int npages; /* Max length of pagevec */
1207 struct page *page_array[NFS_PAGEVEC_SIZE];
1208};
1209
1da177e4 1210struct nfs_read_data {
cd841605
FI
1211 struct nfs_pgio_header *header;
1212 struct list_head list;
1da177e4 1213 struct rpc_task task;
1da177e4 1214 struct nfs_fattr fattr; /* fattr storage */
1da177e4
LT
1215 struct nfs_readargs args;
1216 struct nfs_readres res;
1da177e4 1217 unsigned long timestamp; /* For lease renewal */
cbdabc7f 1218 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
dc70d7b3 1219 __u64 mds_offset;
30dd374f 1220 struct nfs_page_array pages;
cd841605
FI
1221 struct nfs_client *ds_clp; /* pNFS data server */
1222};
1223
4db6e0b7
FI
1224/* used as flag bits in nfs_pgio_header */
1225enum {
1226 NFS_IOHDR_ERROR = 0,
1227 NFS_IOHDR_EOF,
1228 NFS_IOHDR_REDO,
6c75dc0d
FI
1229 NFS_IOHDR_NEED_COMMIT,
1230 NFS_IOHDR_NEED_RESCHED,
4db6e0b7
FI
1231};
1232
cd841605
FI
1233struct nfs_pgio_header {
1234 struct inode *inode;
1235 struct rpc_cred *cred;
1236 struct list_head pages;
4db6e0b7
FI
1237 struct list_head rpc_list;
1238 atomic_t refcnt;
cd841605
FI
1239 struct nfs_page *req;
1240 struct pnfs_layout_segment *lseg;
4db6e0b7 1241 loff_t io_start;
cd841605 1242 const struct rpc_call_ops *mds_ops;
4db6e0b7 1243 void (*release) (struct nfs_pgio_header *hdr);
061ae2ed 1244 const struct nfs_pgio_completion_ops *completion_ops;
584aa810 1245 struct nfs_direct_req *dreq;
4db6e0b7
FI
1246 spinlock_t lock;
1247 /* fields protected by lock */
cd841605 1248 int pnfs_error;
4db6e0b7
FI
1249 int error; /* merge with pnfs_error */
1250 unsigned long good_bytes; /* boundary of good data */
1251 unsigned long flags;
cd841605
FI
1252};
1253
1254struct nfs_read_header {
1255 struct nfs_pgio_header header;
1256 struct nfs_read_data rpc_data;
1da177e4
LT
1257};
1258
1259struct nfs_write_data {
cd841605
FI
1260 struct nfs_pgio_header *header;
1261 struct list_head list;
1da177e4 1262 struct rpc_task task;
1da177e4
LT
1263 struct nfs_fattr fattr;
1264 struct nfs_writeverf verf;
1da177e4
LT
1265 struct nfs_writeargs args; /* argument struct */
1266 struct nfs_writeres res; /* result struct */
1da177e4 1267 unsigned long timestamp; /* For lease renewal */
cd841605 1268 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
a69aef14 1269 __u64 mds_offset; /* Filelayout dense stripe */
30dd374f 1270 struct nfs_page_array pages;
cd841605
FI
1271 struct nfs_client *ds_clp; /* pNFS data server */
1272};
1273
1274struct nfs_write_header {
1275 struct nfs_pgio_header header;
1276 struct nfs_write_data rpc_data;
1da177e4
LT
1277};
1278
ea2cf228
FI
1279struct nfs_mds_commit_info {
1280 atomic_t rpcs_out;
1281 unsigned long ncommit;
1282 struct list_head list;
1283};
1284
f453a54a
FI
1285struct nfs_commit_data;
1286struct nfs_inode;
1287struct nfs_commit_completion_ops {
1288 void (*error_cleanup) (struct nfs_inode *nfsi);
1289 void (*completion) (struct nfs_commit_data *data);
1290};
1291
ea2cf228
FI
1292struct nfs_commit_info {
1293 spinlock_t *lock;
1294 struct nfs_mds_commit_info *mds;
1295 struct pnfs_ds_commit_info *ds;
b359f9d0 1296 struct nfs_direct_req *dreq; /* O_DIRECT request */
f453a54a 1297 const struct nfs_commit_completion_ops *completion_ops;
ea2cf228
FI
1298};
1299
0b7c0153
FI
1300struct nfs_commit_data {
1301 struct rpc_task task;
1302 struct inode *inode;
1303 struct rpc_cred *cred;
1304 struct nfs_fattr fattr;
1305 struct nfs_writeverf verf;
1306 struct list_head pages; /* Coalesced requests we wish to flush */
1307 struct list_head list; /* lists of struct nfs_write_data */
1308 struct nfs_direct_req *dreq; /* O_DIRECT request */
1309 struct nfs_commitargs args; /* argument struct */
1310 struct nfs_commitres res; /* result struct */
1311 struct nfs_open_context *context;
1312 struct pnfs_layout_segment *lseg;
1313 struct nfs_client *ds_clp; /* pNFS data server */
1314 int ds_commit_index;
1315 const struct rpc_call_ops *mds_ops;
f453a54a 1316 const struct nfs_commit_completion_ops *completion_ops;
0b7c0153
FI
1317 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
1318};
1319
061ae2ed
FI
1320struct nfs_pgio_completion_ops {
1321 void (*error_cleanup)(struct list_head *head);
584aa810 1322 void (*init_hdr)(struct nfs_pgio_header *hdr);
061ae2ed
FI
1323 void (*completion)(struct nfs_pgio_header *hdr);
1324};
1325
34e137cc
BS
1326struct nfs_unlinkdata {
1327 struct hlist_node list;
1328 struct nfs_removeargs args;
1329 struct nfs_removeres res;
1330 struct inode *dir;
1331 struct rpc_cred *cred;
1332 struct nfs_fattr dir_attr;
1333};
1334
c6bfa1a1
BS
1335struct nfs_renamedata {
1336 struct nfs_renameargs args;
1337 struct nfs_renameres res;
1338 struct rpc_cred *cred;
1339 struct inode *old_dir;
1340 struct dentry *old_dentry;
1341 struct nfs_fattr old_fattr;
1342 struct inode *new_dir;
1343 struct dentry *new_dentry;
1344 struct nfs_fattr new_fattr;
1345};
1346
1da177e4 1347struct nfs_access_entry;
45a52a02 1348struct nfs_client;
e0dca7a0 1349struct rpc_timeout;
1da177e4
LT
1350
1351/*
1352 * RPC procedure vector for NFSv2/NFSv3 demuxing
1353 */
1354struct nfs_rpc_ops {
c0e07cb6 1355 u32 version; /* Protocol version */
f786aa90 1356 const struct dentry_operations *dentry_ops;
c5ef1c42
AV
1357 const struct inode_operations *dir_inode_ops;
1358 const struct inode_operations *file_inode_ops;
1788ea6e 1359 const struct file_operations *file_ops;
1da177e4
LT
1360
1361 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1362 struct nfs_fsinfo *);
281cad46
BS
1363 struct vfsmount *(*submount) (struct nfs_server *, struct dentry *,
1364 struct nfs_fh *, struct nfs_fattr *);
1da177e4
LT
1365 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1366 struct nfs_fattr *);
1367 int (*setattr) (struct dentry *, struct nfs_fattr *,
1368 struct iattr *);
80a16b21 1369 int (*lookup) (struct inode *, struct qstr *,
1da177e4
LT
1370 struct nfs_fh *, struct nfs_fattr *);
1371 int (*access) (struct inode *, struct nfs_access_entry *);
1372 int (*readlink)(struct inode *, struct page *, unsigned int,
1373 unsigned int);
1da177e4 1374 int (*create) (struct inode *, struct dentry *,
c0204fd2 1375 struct iattr *, int, struct nfs_open_context *);
1da177e4 1376 int (*remove) (struct inode *, struct qstr *);
e4eff1a6 1377 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
34e137cc 1378 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
e4eff1a6 1379 int (*unlink_done) (struct rpc_task *, struct inode *);
1da177e4
LT
1380 int (*rename) (struct inode *, struct qstr *,
1381 struct inode *, struct qstr *);
d3d4152a 1382 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
c6bfa1a1 1383 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
d3d4152a 1384 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
1da177e4 1385 int (*link) (struct inode *, struct inode *, struct qstr *);
94a6d753
CL
1386 int (*symlink) (struct inode *, struct dentry *, struct page *,
1387 unsigned int, struct iattr *);
1da177e4
LT
1388 int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
1389 int (*rmdir) (struct inode *, struct qstr *);
1390 int (*readdir) (struct dentry *, struct rpc_cred *,
56e4ebf8 1391 u64, struct page **, unsigned int, int);
1da177e4
LT
1392 int (*mknod) (struct inode *, struct dentry *, struct iattr *,
1393 dev_t);
1394 int (*statfs) (struct nfs_server *, struct nfs_fh *,
1395 struct nfs_fsstat *);
1396 int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
1397 struct nfs_fsinfo *);
1398 int (*pathconf) (struct nfs_server *, struct nfs_fh *,
1399 struct nfs_pathconf *);
e9326dca 1400 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
573c4e1e 1401 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
bdc7f021 1402 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
ea7c3303 1403 void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
ec06c096 1404 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
bdc7f021 1405 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
c6cb80d0 1406 void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
788e7a89 1407 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
0b7c0153
FI
1408 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1409 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1410 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
1da177e4 1411 int (*lock)(struct file *, int, struct file_lock *);
2116271a 1412 int (*lock_check_bounds)(const struct file_lock *);
ada70d94 1413 void (*clear_acl_cache)(struct inode *);
7fe5c398 1414 void (*close_context)(struct nfs_open_context *ctx, int);
2b484297
TM
1415 struct inode * (*open_context) (struct inode *dir,
1416 struct nfs_open_context *ctx,
1417 int open_flags,
1418 struct iattr *iattr);
8cab4c39
CL
1419 struct nfs_client *
1420 (*init_client) (struct nfs_client *, const struct rpc_timeout *,
4bf590e0 1421 const char *, rpc_authflavor_t);
1da177e4
LT
1422};
1423
1424/*
1425 * NFS_CALL(getattr, inode, (fattr));
1426 * into
1427 * NFS_PROTO(inode)->getattr(fattr);
1428 */
1429#define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
1430
1431/*
1432 * Function vectors etc. for the NFS client
1433 */
509de811
DH
1434extern const struct nfs_rpc_ops nfs_v2_clientops;
1435extern const struct nfs_rpc_ops nfs_v3_clientops;
1436extern const struct nfs_rpc_ops nfs_v4_clientops;
a613fa16
TM
1437extern const struct rpc_version nfs_version2;
1438extern const struct rpc_version nfs_version3;
1439extern const struct rpc_version nfs_version4;
1da177e4 1440
a613fa16
TM
1441extern const struct rpc_version nfsacl_version3;
1442extern const struct rpc_program nfsacl_program;
b7fa0554 1443
1da177e4 1444#endif