1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ****************************************************************************
11  ****************************************************************************/
12 #ifndef _LINUX_NFS_XDR_H
13 #define _LINUX_NFS_XDR_H
14 
15 #include <linux/sunrpc/xprt.h>
16 #include <linux/nfsacl.h>
17 
18 #define NFS_MAX_FILE_IO_SIZE (1048576U)
19 #define NFS_DEF_FILE_IO_SIZE (4096U)
20 #define NFS_MIN_FILE_IO_SIZE (1024U)
21 
22 struct nfs_fsid {
23  uint64_t major;
24  uint64_t minor;
25 };
26 
27 #define NFS_ATTR_WCC 0x0001
28 #define NFS_ATTR_FATTR 0x0002
29 #define NFS_ATTR_FATTR_V3 0x0004
30 #define NFS_ATTR_FATTR_V4 0x0008
31 #define NFS_ATTR_FATTR_V4_REFERRAL 0x0010
32 
33 struct nfs_fsinfo {
34  struct nfs_fattr *fattr;
35  __u32 rtmax;
36  __u32 rtpref;
37  __u32 rtmult;
38  __u32 wtmax;
39  __u32 wtpref;
40  __u32 wtmult;
41  __u32 dtpref;
42  __u64 maxfilesize;
43  __u32 lease_time;
44 };
45 
46 struct nfs_fsstat {
47  struct nfs_fattr *fattr;
48  __u64 tbytes;
49  __u64 fbytes;
50  __u64 abytes;
51  __u64 tfiles;
52  __u64 ffiles;
53  __u64 afiles;
54 };
55 
56 struct nfs2_fsstat {
57  __u32 tsize;
58  __u32 bsize;
59  __u32 blocks;
60  __u32 bfree;
61  __u32 bavail;
62 };
63 
64 struct nfs_pathconf {
65  struct nfs_fattr *fattr;
66  __u32 max_link;
67  __u32 max_namelen;
68 };
69 
70 struct nfs4_change_info {
71  u32 atomic;
72  u64 before;
73  u64 after;
74 };
75 
76 struct nfs_seqid;
77 
78 struct nfs_openargs {
79  const struct nfs_fh * fh;
80  struct nfs_seqid * seqid;
81  int open_flags;
82  __u64 clientid;
83  __u32 id;
84  union {
85  struct iattr * attrs;
86  nfs4_verifier verifier;
87  nfs4_stateid delegation;
88  int delegation_type;
89  } u;
90  const struct qstr * name;
91  const struct nfs_server *server;
92  const u32 * bitmask;
93  __u32 claim;
94 };
95 
96 struct nfs_openres {
97  nfs4_stateid stateid;
98  struct nfs_fh fh;
99  struct nfs4_change_info cinfo;
100  __u32 rflags;
101  struct nfs_fattr * f_attr;
102  struct nfs_fattr * dir_attr;
103  const struct nfs_server *server;
104  int delegation_type;
105  nfs4_stateid delegation;
106  __u32 do_recall;
107  __u64 maxsize;
108 };
109 
110 struct nfs_open_confirmargs {
111  const struct nfs_fh * fh;
112  nfs4_stateid * stateid;
113  struct nfs_seqid * seqid;
114 };
115 
116 struct nfs_open_confirmres {
117  nfs4_stateid stateid;
118 };
119 
120 struct nfs_closeargs {
121  struct nfs_fh * fh;
122  nfs4_stateid * stateid;
123  struct nfs_seqid * seqid;
124  int open_flags;
125  const u32 * bitmask;
126 };
127 
128 struct nfs_closeres {
129  nfs4_stateid stateid;
130  struct nfs_fattr * fattr;
131  const struct nfs_server *server;
132 };
133 
134 struct nfs_lowner {
135  __u64 clientid;
136  u32 id;
137 };
138 
139 struct nfs_lock_args {
140  struct nfs_fh * fh;
141  struct file_lock * fl;
142  struct nfs_seqid * lock_seqid;
143  nfs4_stateid * lock_stateid;
144  struct nfs_seqid * open_seqid;
145  nfs4_stateid * open_stateid;
146  struct nfs_lowner lock_owner;
147  unsigned char block : 1;
148  unsigned char reclaim : 1;
149  unsigned char new_lock_owner : 1;
150 };
151 
152 struct nfs_lock_res {
153  nfs4_stateid stateid;
154 };
155 
156 struct nfs_locku_args {
157  struct nfs_fh * fh;
158  struct file_lock * fl;
159  struct nfs_seqid * seqid;
160  nfs4_stateid * stateid;
161 };
162 
163 struct nfs_locku_res {
164  nfs4_stateid stateid;
165 };
166 
167 struct nfs_lockt_args {
168  struct nfs_fh * fh;
169  struct file_lock * fl;
170  struct nfs_lowner lock_owner;
171 };
172 
173 struct nfs_lockt_res {
174  struct file_lock * denied;
175 };
176 
177 struct nfs4_delegreturnargs {
178  const struct nfs_fh *fhandle;
179  const nfs4_stateid *stateid;
180  const u32 * bitmask;
181 };
182 
183 struct nfs4_delegreturnres {
184  struct nfs_fattr * fattr;
185  const struct nfs_server *server;
186 };
187 
188 struct nfs_readargs {
189  struct nfs_fh * fh;
190  struct nfs_open_context *context;
191  __u64 offset;
192  __u32 count;
193  unsigned int pgbase;
194  struct page ** pages;
195 };
196 
197 struct nfs_readres {
198  struct nfs_fattr * fattr;
199  __u32 count;
200  int eof;
201 };
202 
203 struct nfs_writeargs {
204  struct nfs_fh * fh;
205  struct nfs_open_context *context;
206  __u64 offset;
207  __u32 count;
208  enum nfs3_stable_how stable;
209  unsigned int pgbase;
210  struct page ** pages;
211  const u32 * bitmask;
212 };
213 
214 struct nfs_writeverf {
215  enum nfs3_stable_how committed;
216  __u32 verifier[2];
217 };
218 
219 struct nfs_writeres {
220  struct nfs_fattr * fattr;
221  struct nfs_writeverf * verf;
222  __u32 count;
223  const struct nfs_server *server;
224 };
225 
226 struct nfs_entry {
227  __u64 ino;
228  __u64 cookie,
229  prev_cookie;
230  const char * name;
231  unsigned int len;
232  int eof;
233  struct nfs_fh * fh;
234  struct nfs_fattr * fattr;
235 };
236 
237 struct nfs_sattrargs {
238  struct nfs_fh * fh;
239  struct iattr * sattr;
240 };
241 
242 struct nfs_diropargs {
243  struct nfs_fh * fh;
244  const char * name;
245  unsigned int len;
246 };
247 
248 struct nfs_createargs {
249  struct nfs_fh * fh;
250  const char * name;
251  unsigned int len;
252  struct iattr * sattr;
253 };
254 
255 struct nfs_renameargs {
256  struct nfs_fh * fromfh;
257  const char * fromname;
258  unsigned int fromlen;
259  struct nfs_fh * tofh;
260  const char * toname;
261  unsigned int tolen;
262 };
263 
264 struct nfs_setattrargs {
265  struct nfs_fh * fh;
266  nfs4_stateid stateid;
267  struct iattr * iap;
268  const struct nfs_server * server;
269  const u32 * bitmask;
270 };
271 
272 struct nfs_setaclargs {
273  struct nfs_fh * fh;
274  size_t acl_len;
275  unsigned int acl_pgbase;
276  struct page ** acl_pages;
277 };
278 
279 struct nfs_getaclargs {
280  struct nfs_fh * fh;
281  size_t acl_len;
282  unsigned int acl_pgbase;
283  struct page ** acl_pages;
284 };
285 
286 struct nfs_setattrres {
287  struct nfs_fattr * fattr;
288  const struct nfs_server * server;
289 };
290 
291 struct nfs_linkargs {
292  struct nfs_fh * fromfh;
293  struct nfs_fh * tofh;
294  const char * toname;
295  unsigned int tolen;
296 };
297 
298 struct nfs_symlinkargs {
299  struct nfs_fh * fromfh;
300  const char * fromname;
301  unsigned int fromlen;
302  const char * topath;
303  unsigned int tolen;
304  struct iattr * sattr;
305 };
306 
307 struct nfs_readdirargs {
308  struct nfs_fh * fh;
309  __u32 cookie;
310  unsigned int count;
311  struct page ** pages;
312 };
313 
314 struct nfs3_getaclargs {
315  struct nfs_fh * fh;
316  int mask;
317  struct page ** pages;
318 };
319 
320 struct nfs3_setaclargs {
321  struct inode * inode;
322  int mask;
323  struct posix_acl * acl_access;
324  struct posix_acl * acl_default;
325  struct page ** pages;
326 };
327 
328 struct nfs_diropok {
329  struct nfs_fh * fh;
330  struct nfs_fattr * fattr;
331 };
332 
333 struct nfs_readlinkargs {
334  struct nfs_fh * fh;
335  unsigned int pgbase;
336  unsigned int pglen;
337  struct page ** pages;
338 };
339 
340 struct nfs3_sattrargs {
341  struct nfs_fh * fh;
342  struct iattr * sattr;
343  unsigned int guard;
344  struct timespec guardtime;
345 };
346 
347 struct nfs3_diropargs {
348  struct nfs_fh * fh;
349  const char * name;
350  unsigned int len;
351 };
352 
353 struct nfs3_accessargs {
354  struct nfs_fh * fh;
355  __u32 access;
356 };
357 
358 struct nfs3_createargs {
359  struct nfs_fh * fh;
360  const char * name;
361  unsigned int len;
362  struct iattr * sattr;
363  enum nfs3_createmode createmode;
364  __u32 verifier[2];
365 };
366 
367 struct nfs3_mkdirargs {
368  struct nfs_fh * fh;
369  const char * name;
370  unsigned int len;
371  struct iattr * sattr;
372 };
373 
374 struct nfs3_symlinkargs {
375  struct nfs_fh * fromfh;
376  const char * fromname;
377  unsigned int fromlen;
378  const char * topath;
379  unsigned int tolen;
380  struct iattr * sattr;
381 };
382 
383 struct nfs3_mknodargs {
384  struct nfs_fh * fh;
385  const char * name;
386  unsigned int len;
387  enum nfs3_ftype type;
388  struct iattr * sattr;
389  dev_t rdev;
390 };
391 
392 struct nfs3_renameargs {
393  struct nfs_fh * fromfh;
394  const char * fromname;
395  unsigned int fromlen;
396  struct nfs_fh * tofh;
397  const char * toname;
398  unsigned int tolen;
399 };
400 
401 struct nfs3_linkargs {
402  struct nfs_fh * fromfh;
403  struct nfs_fh * tofh;
404  const char * toname;
405  unsigned int tolen;
406 };
407 
408 struct nfs3_readdirargs {
409  struct nfs_fh * fh;
410  __u64 cookie;
411  __u32 verf[2];
412  int plus;
413  unsigned int count;
414  struct page ** pages;
415 };
416 
417 struct nfs3_diropres {
418  struct nfs_fattr * dir_attr;
419  struct nfs_fh * fh;
420  struct nfs_fattr * fattr;
421 };
422 
423 struct nfs3_accessres {
424  struct nfs_fattr * fattr;
425  __u32 access;
426 };
427 
428 struct nfs3_readlinkargs {
429  struct nfs_fh * fh;
430  unsigned int pgbase;
431  unsigned int pglen;
432  struct page ** pages;
433 };
434 
435 struct nfs3_renameres {
436  struct nfs_fattr * fromattr;
437  struct nfs_fattr * toattr;
438 };
439 
440 struct nfs3_linkres {
441  struct nfs_fattr * dir_attr;
442  struct nfs_fattr * fattr;
443 };
444 
445 struct nfs3_readdirres {
446  struct nfs_fattr * dir_attr;
447  __u32 * verf;
448  int plus;
449 };
450 
451 struct nfs3_getaclres {
452  struct nfs_fattr * fattr;
453  int mask;
454  unsigned int acl_access_count;
455  unsigned int acl_default_count;
456  struct posix_acl * acl_access;
457  struct posix_acl * acl_default;
458 };
459 
460 struct nfs_page;
461 
462 #define NFS_PAGEVEC_SIZE (8U)
463 
464 struct nfs_read_data {
465  int flags;
466  struct rpc_task task;
467  struct inode *inode;
468  struct rpc_cred *cred;
469  struct nfs_fattr fattr;
470  struct list_head pages;
471  struct nfs_page *req;
472  struct page **pagevec;
473  unsigned int npages;
474  struct nfs_readargs args;
475  struct nfs_readres res;
476  struct page *page_array[NFS_PAGEVEC_SIZE];
477 };
478 
479 struct nfs_write_data {
480  int flags;
481  struct rpc_task task;
482  struct inode *inode;
483  struct rpc_cred *cred;
484  struct nfs_fattr fattr;
485  struct nfs_writeverf verf;
486  struct list_head pages;
487  struct nfs_page *req;
488  struct page **pagevec;
489  unsigned int npages;
490  struct nfs_writeargs args;
491  struct nfs_writeres res;
492  struct page *page_array[NFS_PAGEVEC_SIZE];
493 };
494 
495 struct nfs_access_entry;
496 
497 struct nfs_rpc_ops {
498  int version;
499  struct dentry_operations *dentry_ops;
500  struct inode_operations *dir_inode_ops;
501  struct inode_operations *file_inode_ops;
502 
503  int (*getroot) (struct nfs_server *, struct nfs_fh *,
504  struct nfs_fsinfo *);
505  int (*getattr) (struct nfs_server *, struct nfs_fh *,
506  struct nfs_fattr *);
507  int (*setattr) (struct dentry *, struct nfs_fattr *,
508  struct iattr *);
509  int (*lookup) (struct inode *, struct qstr *,
510  struct nfs_fh *, struct nfs_fattr *);
511  int (*access) (struct inode *, struct nfs_access_entry *);
512  int (*readlink)(struct inode *, struct page *, unsigned int,
513  unsigned int);
514  int (*read) (struct nfs_read_data *);
515  int (*write) (struct nfs_write_data *);
516  int (*commit) (struct nfs_write_data *);
517  int (*create) (struct inode *, struct dentry *,
518  struct iattr *, int, struct nameidata *);
519  int (*remove) (struct inode *, struct qstr *);
520  int (*unlink_setup) (struct rpc_message *,
521  struct dentry *, struct qstr *);
522  int (*unlink_done) (struct dentry *, struct rpc_task *);
523  int (*rename) (struct inode *, struct qstr *,
524  struct inode *, struct qstr *);
525  int (*link) (struct inode *, struct inode *, struct qstr *);
526  int (*symlink) (struct inode *, struct qstr *, struct qstr *,
527  struct iattr *, struct nfs_fh *,
528  struct nfs_fattr *);
529  int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
530  int (*rmdir) (struct inode *, struct qstr *);
531  int (*readdir) (struct dentry *, struct rpc_cred *,
532  u64, struct page *, unsigned int, int);
533  int (*mknod) (struct inode *, struct dentry *, struct iattr *,
534  dev_t);
535  int (*statfs) (struct nfs_server *, struct nfs_fh *,
536  struct nfs_fsstat *);
537  int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
538  struct nfs_fsinfo *);
539  int (*pathconf) (struct nfs_server *, struct nfs_fh *,
540  struct nfs_pathconf *);
541  u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
542  void (*read_setup) (struct nfs_read_data *);
543  int (*read_done) (struct rpc_task *, struct nfs_read_data *);
544  void (*write_setup) (struct nfs_write_data *, int how);
545  int (*write_done) (struct rpc_task *, struct nfs_write_data *);
546  void (*commit_setup) (struct nfs_write_data *, int how);
547  int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
548  int (*file_open) (struct inode *, struct file *);
549  int (*file_release) (struct inode *, struct file *);
550  int (*lock)(struct file *, int, struct file_lock *);
551  void (*clear_acl_cache)(struct inode *);
552 };
553 
554 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
555 
556 #endif
557