afs: Provide a splice-read wrapper
[linux-block.git] / fs / nfsd / xdr3.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4 2/*
1da177e4
LT
3 * XDR types for NFSv3 in nfsd.
4 *
5 * Copyright (C) 1996-1998, Olaf Kirch <okir@monad.swb.de>
6 */
7
8#ifndef _LINUX_NFSD_XDR3_H
9#define _LINUX_NFSD_XDR3_H
10
9a74af21 11#include "xdr.h"
1da177e4
LT
12
13struct nfsd3_sattrargs {
14 struct svc_fh fh;
15 struct iattr attrs;
16 int check_guard;
2a1aa489 17 time64_t guardtime;
1da177e4
LT
18};
19
20struct nfsd3_diropargs {
21 struct svc_fh fh;
22 char * name;
29d5e555 23 unsigned int len;
1da177e4
LT
24};
25
26struct nfsd3_accessargs {
27 struct svc_fh fh;
3b921a2b 28 __u32 access;
1da177e4
LT
29};
30
31struct nfsd3_readargs {
32 struct svc_fh fh;
33 __u64 offset;
34 __u32 count;
1da177e4
LT
35};
36
37struct nfsd3_writeargs {
38 svc_fh fh;
39 __u64 offset;
40 __u32 count;
41 int stable;
0ba7536d 42 __u32 len;
dae9a6ca 43 struct xdr_buf payload;
1da177e4
LT
44};
45
46struct nfsd3_createargs {
47 struct svc_fh fh;
48 char * name;
29d5e555 49 unsigned int len;
1da177e4
LT
50 int createmode;
51 struct iattr attrs;
91f07168 52 __be32 * verf;
1da177e4
LT
53};
54
55struct nfsd3_mknodargs {
56 struct svc_fh fh;
57 char * name;
29d5e555 58 unsigned int len;
1da177e4
LT
59 __u32 ftype;
60 __u32 major, minor;
61 struct iattr attrs;
62};
63
64struct nfsd3_renameargs {
65 struct svc_fh ffh;
66 char * fname;
29d5e555 67 unsigned int flen;
1da177e4
LT
68 struct svc_fh tfh;
69 char * tname;
29d5e555 70 unsigned int tlen;
1da177e4
LT
71};
72
1da177e4
LT
73struct nfsd3_linkargs {
74 struct svc_fh ffh;
75 struct svc_fh tfh;
76 char * tname;
29d5e555 77 unsigned int tlen;
1da177e4
LT
78};
79
80struct nfsd3_symlinkargs {
81 struct svc_fh ffh;
82 char * fname;
29d5e555 83 unsigned int flen;
1da177e4 84 char * tname;
48b4ba3f 85 unsigned int tlen;
1da177e4 86 struct iattr attrs;
38a70315 87 struct kvec first;
1da177e4
LT
88};
89
90struct nfsd3_readdirargs {
91 struct svc_fh fh;
92 __u64 cookie;
1da177e4 93 __u32 count;
91f07168 94 __be32 * verf;
1da177e4
LT
95};
96
97struct nfsd3_commitargs {
98 struct svc_fh fh;
99 __u64 offset;
100 __u32 count;
101};
102
a257cdd0
AG
103struct nfsd3_getaclargs {
104 struct svc_fh fh;
635a45d3 105 __u32 mask;
a257cdd0
AG
106};
107
108struct posix_acl;
109struct nfsd3_setaclargs {
110 struct svc_fh fh;
427eab3b 111 __u32 mask;
a257cdd0
AG
112 struct posix_acl *acl_access;
113 struct posix_acl *acl_default;
114};
115
1da177e4 116struct nfsd3_attrstat {
91f07168 117 __be32 status;
1da177e4 118 struct svc_fh fh;
a334de28 119 struct kstat stat;
1da177e4
LT
120};
121
122/* LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD */
123struct nfsd3_diropres {
91f07168 124 __be32 status;
1da177e4
LT
125 struct svc_fh dirfh;
126 struct svc_fh fh;
127};
128
129struct nfsd3_accessres {
91f07168 130 __be32 status;
1da177e4
LT
131 struct svc_fh fh;
132 __u32 access;
4f4a4fad 133 struct kstat stat;
1da177e4
LT
134};
135
136struct nfsd3_readlinkres {
91f07168 137 __be32 status;
1da177e4
LT
138 struct svc_fh fh;
139 __u32 len;
9a9c8923 140 struct page **pages;
1da177e4
LT
141};
142
143struct nfsd3_readres {
91f07168 144 __be32 status;
1da177e4
LT
145 struct svc_fh fh;
146 unsigned long count;
83a63072 147 __u32 eof;
cc9bcdad 148 struct page **pages;
1da177e4
LT
149};
150
151struct nfsd3_writeres {
91f07168 152 __be32 status;
1da177e4
LT
153 struct svc_fh fh;
154 unsigned long count;
155 int committed;
19e0663f 156 __be32 verf[2];
1da177e4
LT
157};
158
159struct nfsd3_renameres {
91f07168 160 __be32 status;
1da177e4
LT
161 struct svc_fh ffh;
162 struct svc_fh tfh;
163};
164
165struct nfsd3_linkres {
91f07168 166 __be32 status;
1da177e4
LT
167 struct svc_fh tfh;
168 struct svc_fh fh;
169};
170
171struct nfsd3_readdirres {
7f87fc2d 172 /* Components of the reply */
91f07168 173 __be32 status;
1da177e4 174 struct svc_fh fh;
91f07168 175 __be32 verf[2];
1da177e4 176
7f87fc2d
CL
177 /* Used to encode the reply's entry list */
178 struct xdr_stream xdr;
179 struct xdr_buf dirlist;
180 struct svc_fh scratch;
1da177e4 181 struct readdir_cd common;
7f87fc2d 182 unsigned int cookie_offset;
1da177e4
LT
183 struct svc_rqst * rqstp;
184
185};
186
187struct nfsd3_fsstatres {
91f07168 188 __be32 status;
1da177e4
LT
189 struct kstatfs stats;
190 __u32 invarsec;
191};
192
193struct nfsd3_fsinfores {
91f07168 194 __be32 status;
1da177e4
LT
195 __u32 f_rtmax;
196 __u32 f_rtpref;
197 __u32 f_rtmult;
198 __u32 f_wtmax;
199 __u32 f_wtpref;
200 __u32 f_wtmult;
201 __u32 f_dtpref;
202 __u64 f_maxfilesize;
203 __u32 f_properties;
204};
205
206struct nfsd3_pathconfres {
91f07168 207 __be32 status;
1da177e4
LT
208 __u32 p_link_max;
209 __u32 p_name_max;
210 __u32 p_no_trunc;
211 __u32 p_chown_restricted;
212 __u32 p_case_insensitive;
213 __u32 p_case_preserving;
214};
215
216struct nfsd3_commitres {
91f07168 217 __be32 status;
1da177e4 218 struct svc_fh fh;
524ff1af 219 __be32 verf[2];
1da177e4
LT
220};
221
a257cdd0 222struct nfsd3_getaclres {
91f07168 223 __be32 status;
a257cdd0
AG
224 struct svc_fh fh;
225 int mask;
226 struct posix_acl *acl_access;
227 struct posix_acl *acl_default;
4f4a4fad 228 struct kstat stat;
a257cdd0
AG
229};
230
1da177e4
LT
231/* dummy type for release */
232struct nfsd3_fhandle_pair {
233 __u32 dummy;
234 struct svc_fh fh1;
235 struct svc_fh fh2;
236};
237
238/*
239 * Storage requirements for XDR arguments and results.
240 */
241union nfsd3_xdrstore {
242 struct nfsd3_sattrargs sattrargs;
243 struct nfsd3_diropargs diropargs;
244 struct nfsd3_readargs readargs;
245 struct nfsd3_writeargs writeargs;
246 struct nfsd3_createargs createargs;
247 struct nfsd3_renameargs renameargs;
248 struct nfsd3_linkargs linkargs;
249 struct nfsd3_symlinkargs symlinkargs;
250 struct nfsd3_readdirargs readdirargs;
251 struct nfsd3_diropres diropres;
252 struct nfsd3_accessres accessres;
253 struct nfsd3_readlinkres readlinkres;
254 struct nfsd3_readres readres;
255 struct nfsd3_writeres writeres;
256 struct nfsd3_renameres renameres;
257 struct nfsd3_linkres linkres;
258 struct nfsd3_readdirres readdirres;
259 struct nfsd3_fsstatres fsstatres;
260 struct nfsd3_fsinfores fsinfores;
261 struct nfsd3_pathconfres pathconfres;
262 struct nfsd3_commitres commitres;
a257cdd0 263 struct nfsd3_getaclres getaclres;
1da177e4
LT
264};
265
266#define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore)
267
c44b31c2
CL
268bool nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
269bool nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
270bool nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
271bool nfs3svc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
272bool nfs3svc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
273bool nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
274bool nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
275bool nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
276bool nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
277bool nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
278bool nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
279bool nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
280bool nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
281bool nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
282bool nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr);
16c66364 283
130e2054
CL
284bool nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
285bool nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr);
286bool nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
287bool nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
288bool nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
289bool nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
290bool nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
291bool nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
292bool nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
293bool nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
294bool nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
295bool nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
296bool nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr);
297bool nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
298bool nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr);
1da177e4 299
8537488b
CH
300void nfs3svc_release_fhandle(struct svc_rqst *);
301void nfs3svc_release_fhandle2(struct svc_rqst *);
a161e6c7
CL
302
303void nfs3svc_encode_cookie3(struct nfsd3_readdirres *resp, u64 offset);
7f87fc2d
CL
304int nfs3svc_encode_entry3(void *data, const char *name, int namlen,
305 loff_t offset, u64 ino, unsigned int d_type);
306int nfs3svc_encode_entryplus3(void *data, const char *name, int namlen,
307 loff_t offset, u64 ino, unsigned int d_type);
a257cdd0 308/* Helper functions for NFSv3 ACL code */
05027eaf 309bool svcxdr_decode_nfs_fh3(struct xdr_stream *xdr, struct svc_fh *fhp);
20798dfe
CL
310bool svcxdr_encode_nfsstat3(struct xdr_stream *xdr, __be32 status);
311bool svcxdr_encode_post_op_attr(struct svc_rqst *rqstp, struct xdr_stream *xdr,
312 const struct svc_fh *fhp);
1da177e4 313
1da177e4 314#endif /* _LINUX_NFSD_XDR3_H */