blob: 4f0481d638048feda597888969712ab1d2dd3a08 [file] [log] [blame]
J. Bruce Fields7663dac2009-12-04 19:49:00 -05001/* XDR types for nfsd. This is mainly a typing exercise. */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002
3#ifndef LINUX_NFSD_H
4#define LINUX_NFSD_H
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#include <linux/vfs.h>
Boaz Harrosh9a74af22009-12-03 20:30:56 +02007#include "nfsd.h"
J. Bruce Fields1557aca2009-12-04 19:36:06 -05008#include "nfsfh.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
10struct nfsd_fhandle {
11 struct svc_fh fh;
12};
13
14struct nfsd_sattrargs {
15 struct svc_fh fh;
16 struct iattr attrs;
17};
18
19struct nfsd_diropargs {
20 struct svc_fh fh;
21 char * name;
Chuck Lever29d5e552007-11-01 16:57:04 -040022 unsigned int len;
Linus Torvalds1da177e2005-04-16 15:20:36 -070023};
24
25struct nfsd_readargs {
26 struct svc_fh fh;
27 __u32 offset;
28 __u32 count;
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 int vlen;
30};
31
32struct nfsd_writeargs {
33 svc_fh fh;
34 __u32 offset;
35 int len;
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 int vlen;
37};
38
39struct nfsd_createargs {
40 struct svc_fh fh;
41 char * name;
Chuck Lever29d5e552007-11-01 16:57:04 -040042 unsigned int len;
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 struct iattr attrs;
44};
45
46struct nfsd_renameargs {
47 struct svc_fh ffh;
48 char * fname;
Chuck Lever29d5e552007-11-01 16:57:04 -040049 unsigned int flen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 struct svc_fh tfh;
51 char * tname;
Chuck Lever29d5e552007-11-01 16:57:04 -040052 unsigned int tlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070053};
54
55struct nfsd_readlinkargs {
56 struct svc_fh fh;
57 char * buffer;
58};
59
60struct nfsd_linkargs {
61 struct svc_fh ffh;
62 struct svc_fh tfh;
63 char * tname;
Chuck Lever29d5e552007-11-01 16:57:04 -040064 unsigned int tlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070065};
66
67struct nfsd_symlinkargs {
68 struct svc_fh ffh;
69 char * fname;
Chuck Lever29d5e552007-11-01 16:57:04 -040070 unsigned int flen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 char * tname;
Chuck Lever48b4ba32007-11-01 16:57:25 -040072 unsigned int tlen;
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 struct iattr attrs;
74};
75
76struct nfsd_readdirargs {
77 struct svc_fh fh;
78 __u32 cookie;
79 __u32 count;
Al Viro131a21c2006-10-19 23:28:56 -070080 __be32 * buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -070081};
82
83struct nfsd_attrstat {
84 struct svc_fh fh;
David Shawa334de22006-01-06 00:19:58 -080085 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -070086};
87
88struct nfsd_diropres {
89 struct svc_fh fh;
David Shawa334de22006-01-06 00:19:58 -080090 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091};
92
93struct nfsd_readlinkres {
94 int len;
95};
96
97struct nfsd_readres {
98 struct svc_fh fh;
99 unsigned long count;
David Shawa334de22006-01-06 00:19:58 -0800100 struct kstat stat;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101};
102
103struct nfsd_readdirres {
104 int count;
105
106 struct readdir_cd common;
Al Viro131a21c2006-10-19 23:28:56 -0700107 __be32 * buffer;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 int buflen;
Al Viro131a21c2006-10-19 23:28:56 -0700109 __be32 * offset;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110};
111
112struct nfsd_statfsres {
113 struct kstatfs stats;
114};
115
116/*
117 * Storage requirements for XDR arguments and results.
118 */
119union nfsd_xdrstore {
120 struct nfsd_sattrargs sattr;
121 struct nfsd_diropargs dirop;
122 struct nfsd_readargs read;
123 struct nfsd_writeargs write;
124 struct nfsd_createargs create;
125 struct nfsd_renameargs rename;
126 struct nfsd_linkargs link;
127 struct nfsd_symlinkargs symlink;
128 struct nfsd_readdirargs readdir;
129};
130
131#define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
132
133
Al Viro131a21c2006-10-19 23:28:56 -0700134int nfssvc_decode_void(struct svc_rqst *, __be32 *, void *);
135int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
136int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 struct nfsd_sattrargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700138int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139 struct nfsd_diropargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700140int nfssvc_decode_readargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 struct nfsd_readargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700142int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 struct nfsd_writeargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700144int nfssvc_decode_createargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 struct nfsd_createargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700146int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 struct nfsd_renameargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700148int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149 struct nfsd_readlinkargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700150int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 struct nfsd_linkargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700152int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153 struct nfsd_symlinkargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700154int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 struct nfsd_readdirargs *);
Al Viro131a21c2006-10-19 23:28:56 -0700156int nfssvc_encode_void(struct svc_rqst *, __be32 *, void *);
157int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *, struct nfsd_attrstat *);
158int nfssvc_encode_diropres(struct svc_rqst *, __be32 *, struct nfsd_diropres *);
159int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *, struct nfsd_readlinkres *);
160int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
161int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
162int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163
NeilBrowna0ad13e2007-01-26 00:57:10 -0800164int nfssvc_encode_entry(void *, const char *name,
165 int namlen, loff_t offset, u64 ino, unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166
Al Viro131a21c2006-10-19 23:28:56 -0700167int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000169/* Helper functions for NFSv2 ACL code */
J. Bruce Fields4f4a4fa2013-02-01 15:13:04 -0500170__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat);
Al Viro131a21c2006-10-19 23:28:56 -0700171__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000172
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173#endif /* LINUX_NFSD_H */