blob: 457ce45e5084fde7084cd4a2df3c412cc187f16b [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
Christoph Hellwig026fec72017-05-08 19:01:48 +0200134int nfssvc_decode_void(struct svc_rqst *, __be32 *);
135int nfssvc_decode_fhandle(struct svc_rqst *, __be32 *);
136int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *);
137int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *);
138int nfssvc_decode_readargs(struct svc_rqst *, __be32 *);
139int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *);
140int nfssvc_decode_createargs(struct svc_rqst *, __be32 *);
141int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *);
142int nfssvc_decode_readlinkargs(struct svc_rqst *, __be32 *);
143int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *);
144int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *);
145int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *);
Christoph Hellwig63f8de32017-05-08 19:42:02 +0200146int nfssvc_encode_void(struct svc_rqst *, __be32 *);
147int nfssvc_encode_attrstat(struct svc_rqst *, __be32 *);
148int nfssvc_encode_diropres(struct svc_rqst *, __be32 *);
149int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *);
150int nfssvc_encode_readres(struct svc_rqst *, __be32 *);
151int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *);
152int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153
NeilBrowna0ad13e2007-01-26 00:57:10 -0800154int nfssvc_encode_entry(void *, const char *name,
155 int namlen, loff_t offset, u64 ino, unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156
Christoph Hellwig85374882017-05-08 18:48:24 +0200157void nfssvc_release_fhandle(struct svc_rqst *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000159/* Helper functions for NFSv2 ACL code */
J. Bruce Fields4f4a4fa2013-02-01 15:13:04 -0500160__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat);
Al Viro131a21c2006-10-19 23:28:56 -0700161__be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp);
Andreas Gruenbachera257cdd2005-06-22 17:16:26 +0000162
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163#endif /* LINUX_NFSD_H */