1 #ifndef _LINUX_NFS_XDR_H
2 #define _LINUX_NFS_XDR_H
4 extern struct rpc_program nfs_program
;
5 extern struct rpc_stat nfs_rpcstat
;
8 unsigned short valid
; /* which fields are valid */
9 __u64 pre_size
; /* pre_op_attr.size */
10 __u64 pre_mtime
; /* pre_op_attr.mtime */
11 __u64 pre_ctime
; /* pre_op_attr.ctime */
12 enum nfs_ftype type
; /* always use NFSv2 types */
35 #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
36 #define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
37 #define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
40 * Info on the file system
43 __u32 rtmax
; /* max. read transfer size */
44 __u32 rtpref
; /* pref. read transfer size */
45 __u32 rtmult
; /* reads should be multiple of this */
46 __u32 wtmax
; /* max. write transfer size */
47 __u32 wtpref
; /* pref. write transfer size */
48 __u32 wtmult
; /* writes should be multiple of this */
49 __u32 dtpref
; /* pref. readdir transfer size */
51 __u64 bsize
; /* block size */
52 __u64 tbytes
; /* total size in bytes */
53 __u64 fbytes
; /* # of free bytes */
54 __u64 abytes
; /* # of bytes available to user */
55 __u64 tfiles
; /* # of files */
56 __u64 ffiles
; /* # of free files */
57 __u64 afiles
; /* # of files available to user */
58 __u32 linkmax
;/* max # of hard links */
59 __u32 namelen
;/* max name length */
62 /* Arguments to the read call.
63 * Note that NFS_READ_MAXIOV must be <= (MAX_IOVEC-2) from sunrpc/xprt.h
65 #define NFS_READ_MAXIOV 8
72 struct iovec iov
[NFS_READ_MAXIOV
];
76 struct nfs_fattr
* fattr
;
81 /* Arguments to the write call.
82 * Note that NFS_WRITE_MAXIOV must be <= (MAX_IOVEC-2) from sunrpc/xprt.h
84 #define NFS_WRITE_MAXIOV 8
85 struct nfs_writeargs
{
89 enum nfs3_stable_how stable
;
91 struct iovec iov
[NFS_WRITE_MAXIOV
];
94 struct nfs_writeverf
{
95 enum nfs3_stable_how committed
;
100 struct nfs_fattr
* fattr
;
101 struct nfs_writeverf
* verf
;
106 * Argument struct for decode_entry function
116 struct nfs_fattr fattr
;
120 * The following types are for NFSv2 only.
122 struct nfs_sattrargs
{
124 struct iattr
* sattr
;
127 struct nfs_diropargs
{
133 struct nfs_createargs
{
137 struct iattr
* sattr
;
140 struct nfs_renameargs
{
141 struct nfs_fh
* fromfh
;
142 const char * fromname
;
143 unsigned int fromlen
;
144 struct nfs_fh
* tofh
;
149 struct nfs_linkargs
{
150 struct nfs_fh
* fromfh
;
151 struct nfs_fh
* tofh
;
156 struct nfs_symlinkargs
{
157 struct nfs_fh
* fromfh
;
158 const char * fromname
;
159 unsigned int fromlen
;
162 struct iattr
* sattr
;
165 struct nfs_readdirargs
{
174 struct nfs_fattr
* fattr
;
177 struct nfs_readlinkargs
{
183 struct nfs_readlinkres
{
188 struct nfs_readdirres
{
193 struct nfs3_sattrargs
{
195 struct iattr
* sattr
;
200 struct nfs3_diropargs
{
206 struct nfs3_accessargs
{
211 struct nfs3_createargs
{
215 struct iattr
* sattr
;
216 enum nfs3_createmode createmode
;
220 struct nfs3_mkdirargs
{
224 struct iattr
* sattr
;
227 struct nfs3_symlinkargs
{
228 struct nfs_fh
* fromfh
;
229 const char * fromname
;
230 unsigned int fromlen
;
233 struct iattr
* sattr
;
236 struct nfs3_mknodargs
{
240 enum nfs3_ftype type
;
241 struct iattr
* sattr
;
245 struct nfs3_renameargs
{
246 struct nfs_fh
* fromfh
;
247 const char * fromname
;
248 unsigned int fromlen
;
249 struct nfs_fh
* tofh
;
254 struct nfs3_linkargs
{
255 struct nfs_fh
* fromfh
;
256 struct nfs_fh
* tofh
;
261 struct nfs3_readdirargs
{
270 struct nfs3_diropres
{
271 struct nfs_fattr
* dir_attr
;
273 struct nfs_fattr
* fattr
;
276 struct nfs3_accessres
{
277 struct nfs_fattr
* fattr
;
281 struct nfs3_readlinkargs
{
287 struct nfs3_readlinkres
{
288 struct nfs_fattr
* fattr
;
293 struct nfs3_renameres
{
294 struct nfs_fattr
* fromattr
;
295 struct nfs_fattr
* toattr
;
298 struct nfs3_linkres
{
299 struct nfs_fattr
* dir_attr
;
300 struct nfs_fattr
* fattr
;
303 struct nfs3_readdirres
{
304 struct nfs_fattr
* dir_attr
;
312 * RPC procedure vector for NFSv2/NFSv3 demuxing
315 int version
; /* Protocol version */
317 int (*getroot
) (struct nfs_server
*, struct nfs_fh
*,
319 int (*getattr
) (struct inode
*, struct nfs_fattr
*);
320 int (*setattr
) (struct inode
*, struct nfs_fattr
*,
322 int (*lookup
) (struct inode
*, struct qstr
*,
323 struct nfs_fh
*, struct nfs_fattr
*);
324 int (*access
) (struct inode
*, int , int);
325 int (*readlink
)(struct inode
*, void *, unsigned int);
326 int (*read
) (struct inode
*, struct rpc_cred
*,
328 int, loff_t
, unsigned int,
329 void *buffer
, int *eofp
);
330 int (*write
) (struct inode
*, struct rpc_cred
*,
332 int, loff_t
, unsigned int,
333 void *buffer
, struct nfs_writeverf
*verfp
);
334 int (*commit
) (struct inode
*, struct nfs_fattr
*,
335 unsigned long, unsigned int);
336 int (*create
) (struct inode
*, struct qstr
*, struct iattr
*,
337 int, struct nfs_fh
*, struct nfs_fattr
*);
338 int (*remove
) (struct inode
*, struct qstr
*);
339 int (*unlink_setup
) (struct rpc_message
*,
340 struct dentry
*, struct qstr
*);
341 void (*unlink_done
) (struct dentry
*, struct rpc_message
*);
342 int (*rename
) (struct inode
*, struct qstr
*,
343 struct inode
*, struct qstr
*);
344 int (*link
) (struct inode
*, struct inode
*, struct qstr
*);
345 int (*symlink
) (struct inode
*, struct qstr
*, struct qstr
*,
346 struct iattr
*, struct nfs_fh
*,
348 int (*mkdir
) (struct inode
*, struct qstr
*, struct iattr
*,
349 struct nfs_fh
*, struct nfs_fattr
*);
350 int (*rmdir
) (struct inode
*, struct qstr
*);
351 int (*readdir
) (struct inode
*, struct rpc_cred
*,
352 u64
, void *, unsigned int, int);
353 int (*mknod
) (struct inode
*, struct qstr
*, struct iattr
*,
354 dev_t
, struct nfs_fh
*, struct nfs_fattr
*);
355 int (*statfs
) (struct nfs_server
*, struct nfs_fh
*,
356 struct nfs_fsinfo
*);
357 u32
* (*decode_dirent
)(u32
*, struct nfs_entry
*, int plus
);
361 * NFS_CALL(getattr, inode, (fattr));
363 * NFS_PROTO(inode)->getattr(fattr);
365 #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
368 * Function vectors etc. for the NFS client
370 extern struct nfs_rpc_ops nfs_v2_clientops
;
371 extern struct nfs_rpc_ops nfs_v3_clientops
;
372 extern struct rpc_version nfs_version2
;
373 extern struct rpc_version nfs_version3
;
374 extern struct rpc_program nfs_program
;