blob: 235ee5c3be542aaf4bb3c79f15133f1d948bb20a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Uwe Zeisbergerf30c2262006-10-03 23:01:26 +02002 * linux/include/linux/nfsd/xdr.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * XDR types for nfsd. This is mainly a typing exercise.
5 */
6
7#ifndef LINUX_NFSD_H
8#define LINUX_NFSD_H
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/vfs.h>
Boaz Harrosh9a74af22009-12-03 20:30:56 +020011#include "nfsd.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
13struct nfsd_fhandle {
14 struct svc_fh fh;
15};
16
17struct nfsd_sattrargs {
18 struct svc_fh fh;
19 struct iattr attrs;
20};
21
22struct nfsd_diropargs {
23 struct svc_fh fh;
24 char * name;
Chuck Lever29d5e552007-11-01 16:57:04 -040025 unsigned int len;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026};
27
28struct nfsd_readargs {
29 struct svc_fh fh;
30 __u32 offset;
31 __u32 count;
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 int vlen;
33};
34
35struct nfsd_writeargs {
36 svc_fh fh;
37 __u32 offset;
38 int len;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 int vlen;
40};
41
42struct nfsd_createargs {
43 struct svc_fh fh;
44 char * name;
Chuck Lever29d5e552007-11-01 16:57:04 -040045 unsigned int len;
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 struct iattr attrs;
47};
48
49struct nfsd_renameargs {
50 struct svc_fh ffh;
51 char * fname;
Chuck Lever29d5e552007-11-01 16:57:04 -040052 unsigned int flen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 struct svc_fh tfh;
54 char * tname;
Chuck Lever29d5e552007-11-01 16:57:04 -040055 unsigned int tlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070056};
57
58struct nfsd_readlinkargs {
59 struct svc_fh fh;
60 char * buffer;
61};
62
63struct nfsd_linkargs {
64 struct svc_fh ffh;
65 struct svc_fh tfh;
66 char * tname;
Chuck Lever29d5e552007-11-01 16:57:04 -040067 unsigned int tlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070068};
69
70struct nfsd_symlinkargs {
71 struct svc_fh ffh;
72 char * fname;
Chuck Lever29d5e552007-11-01 16:57:04 -040073 unsigned int flen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 char * tname;
Chuck Lever48b4ba32007-11-01 16:57:25 -040075 unsigned int tlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 struct iattr attrs;
77};
78
79struct nfsd_readdirargs {
80 struct svc_fh fh;
81 __u32 cookie;
82 __u32 count;
Al Viro131a21c2006-10-19 23:28:56 -070083 __be32 * buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -070084};
85
86struct nfsd_attrstat {
87 struct svc_fh fh;
David Shawa334de22006-01-06 00:19:58 -080088 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -070089};
90
91struct nfsd_diropres {
92 struct svc_fh fh;
David Shawa334de22006-01-06 00:19:58 -080093 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -070094};
95
96struct nfsd_readlinkres {
97 int len;
98};
99
100struct nfsd_readres {
101 struct svc_fh fh;
102 unsigned long count;
David Shawa334de22006-01-06 00:19:58 -0800103 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104};
105
106struct nfsd_readdirres {
107 int count;
108
109 struct readdir_cd common;
Al Viro131a21c2006-10-19 23:28:56 -0700110 __be32 * buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 int buflen;
Al Viro131a21c2006-10-19 23:28:56 -0700112 __be32 * offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113};
114
115struct nfsd_statfsres {
116 struct kstatfs stats;
117};
118
119/*
120 * Storage requirements for XDR arguments and results.
121 */
122union nfsd_xdrstore {
123 struct nfsd_sattrargs sattr;
124 struct nfsd_diropargs dirop;
125 struct nfsd_readargs read;
126 struct nfsd_writeargs write;
127 struct nfsd_createargs create;
128 struct nfsd_renameargs rename;
129 struct nfsd_linkargs link;
130 struct nfsd_symlinkargs symlink;
131 struct nfsd_readdirargs readdir;
132};
133
134#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
135
136
Al Viro131a21c2006-10-19 23:28:56 -0700137int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *);
138int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
139int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 struct nfsd_sattrargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700141int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 struct nfsd_diropargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700143int nfssvc_decode_readargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 struct nfsd_readargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700145int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 struct nfsd_writeargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700147int nfssvc_decode_createargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 struct nfsd_createargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700149int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 struct nfsd_renameargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700151int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 struct nfsd_readlinkargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700153int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 struct nfsd_linkargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700155int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 struct nfsd_symlinkargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700157int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 struct nfsd_readdirargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700159int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *);
160int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *);
161int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *);
162int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *);
163int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
164int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
165int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166
NeilBrowna0ad13e2007-01-26 00:57:10 -0800167int nfssvc_encode_entry(void *, const char *name,
168 int namlen, loff_t offset, u64 ino, unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169
Al Viro131a21c2006-10-19 23:28:56 -0700170int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000172/* Helper functions for NFSv2 ACL code */
Al Viro131a21c2006-10-19 23:28:56 -0700173__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp);
174__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000175
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176#endif /* LINUX_NFSD_H */