]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
7663dacd | 2 | /* XDR types for nfsd. This is mainly a typing exercise. */ |
1da177e4 LT |
3 | |
4 | #ifndef LINUX_NFSD_H | |
5 | #define LINUX_NFSD_H | |
6 | ||
1da177e4 | 7 | #include <linux/vfs.h> |
9a74af21 | 8 | #include "nfsd.h" |
1557aca7 | 9 | #include "nfsfh.h" |
1da177e4 LT |
10 | |
11 | struct nfsd_fhandle { | |
12 | struct svc_fh fh; | |
13 | }; | |
14 | ||
15 | struct nfsd_sattrargs { | |
16 | struct svc_fh fh; | |
17 | struct iattr attrs; | |
18 | }; | |
19 | ||
20 | struct nfsd_diropargs { | |
21 | struct svc_fh fh; | |
22 | char * name; | |
29d5e555 | 23 | unsigned int len; |
1da177e4 LT |
24 | }; |
25 | ||
26 | struct nfsd_readargs { | |
27 | struct svc_fh fh; | |
28 | __u32 offset; | |
29 | __u32 count; | |
1da177e4 LT |
30 | }; |
31 | ||
32 | struct nfsd_writeargs { | |
33 | svc_fh fh; | |
34 | __u32 offset; | |
184416d4 | 35 | __u32 len; |
dae9a6ca | 36 | struct xdr_buf payload; |
1da177e4 LT |
37 | }; |
38 | ||
39 | struct nfsd_createargs { | |
40 | struct svc_fh fh; | |
41 | char * name; | |
29d5e555 | 42 | unsigned int len; |
1da177e4 LT |
43 | struct iattr attrs; |
44 | }; | |
45 | ||
46 | struct nfsd_renameargs { | |
47 | struct svc_fh ffh; | |
48 | char * fname; | |
29d5e555 | 49 | unsigned int flen; |
1da177e4 LT |
50 | struct svc_fh tfh; |
51 | char * tname; | |
29d5e555 | 52 | unsigned int tlen; |
1da177e4 LT |
53 | }; |
54 | ||
1da177e4 LT |
55 | struct nfsd_linkargs { |
56 | struct svc_fh ffh; | |
57 | struct svc_fh tfh; | |
58 | char * tname; | |
29d5e555 | 59 | unsigned int tlen; |
1da177e4 LT |
60 | }; |
61 | ||
62 | struct nfsd_symlinkargs { | |
63 | struct svc_fh ffh; | |
64 | char * fname; | |
29d5e555 | 65 | unsigned int flen; |
1da177e4 | 66 | char * tname; |
48b4ba3f | 67 | unsigned int tlen; |
1da177e4 | 68 | struct iattr attrs; |
38a70315 | 69 | struct kvec first; |
1da177e4 LT |
70 | }; |
71 | ||
72 | struct nfsd_readdirargs { | |
73 | struct svc_fh fh; | |
74 | __u32 cookie; | |
75 | __u32 count; | |
1da177e4 LT |
76 | }; |
77 | ||
cc028a10 CL |
78 | struct nfsd_stat { |
79 | __be32 status; | |
80 | }; | |
81 | ||
1da177e4 | 82 | struct nfsd_attrstat { |
f0af2210 | 83 | __be32 status; |
1da177e4 | 84 | struct svc_fh fh; |
a334de28 | 85 | struct kstat stat; |
1da177e4 LT |
86 | }; |
87 | ||
88 | struct nfsd_diropres { | |
f0af2210 | 89 | __be32 status; |
1da177e4 | 90 | struct svc_fh fh; |
a334de28 | 91 | struct kstat stat; |
1da177e4 LT |
92 | }; |
93 | ||
94 | struct nfsd_readlinkres { | |
f0af2210 | 95 | __be32 status; |
1da177e4 | 96 | int len; |
d9014b0f | 97 | struct page *page; |
1da177e4 LT |
98 | }; |
99 | ||
100 | struct nfsd_readres { | |
f0af2210 | 101 | __be32 status; |
1da177e4 LT |
102 | struct svc_fh fh; |
103 | unsigned long count; | |
a334de28 | 104 | struct kstat stat; |
a6f8d9dc | 105 | struct page **pages; |
1da177e4 LT |
106 | }; |
107 | ||
108 | struct nfsd_readdirres { | |
f5dcccd6 | 109 | /* Components of the reply */ |
f0af2210 CL |
110 | __be32 status; |
111 | ||
1da177e4 LT |
112 | int count; |
113 | ||
f5dcccd6 CL |
114 | /* Used to encode the reply's entry list */ |
115 | struct xdr_stream xdr; | |
116 | struct xdr_buf dirlist; | |
1da177e4 | 117 | struct readdir_cd common; |
f5dcccd6 | 118 | unsigned int cookie_offset; |
1da177e4 LT |
119 | }; |
120 | ||
121 | struct nfsd_statfsres { | |
f0af2210 | 122 | __be32 status; |
1da177e4 LT |
123 | struct kstatfs stats; |
124 | }; | |
125 | ||
126 | /* | |
127 | * Storage requirements for XDR arguments and results. | |
128 | */ | |
129 | union nfsd_xdrstore { | |
130 | struct nfsd_sattrargs sattr; | |
131 | struct nfsd_diropargs dirop; | |
132 | struct nfsd_readargs read; | |
133 | struct nfsd_writeargs write; | |
134 | struct nfsd_createargs create; | |
135 | struct nfsd_renameargs rename; | |
136 | struct nfsd_linkargs link; | |
137 | struct nfsd_symlinkargs symlink; | |
138 | struct nfsd_readdirargs readdir; | |
139 | }; | |
140 | ||
141 | #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) | |
142 | ||
143 | ||
c44b31c2 CL |
144 | bool nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); |
145 | bool nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
146 | bool nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
147 | bool nfssvc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
148 | bool nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
149 | bool nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
150 | bool nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
151 | bool nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
152 | bool nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
153 | bool nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
16c66364 | 154 | |
130e2054 CL |
155 | bool nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr); |
156 | bool nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
157 | bool nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
158 | bool nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
159 | bool nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
160 | bool nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
161 | bool nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr); | |
1da177e4 | 162 | |
d5253200 | 163 | void nfssvc_encode_nfscookie(struct nfsd_readdirres *resp, u32 offset); |
8a2cf9f5 CL |
164 | int nfssvc_encode_entry(void *data, const char *name, int namlen, |
165 | loff_t offset, u64 ino, unsigned int d_type); | |
1da177e4 | 166 | |
1841b9b6 CL |
167 | void nfssvc_release_attrstat(struct svc_rqst *rqstp); |
168 | void nfssvc_release_diropres(struct svc_rqst *rqstp); | |
169 | void nfssvc_release_readres(struct svc_rqst *rqstp); | |
1da177e4 | 170 | |
a257cdd0 | 171 | /* Helper functions for NFSv2 ACL code */ |
635a45d3 | 172 | bool svcxdr_decode_fhandle(struct xdr_stream *xdr, struct svc_fh *fhp); |
f8cba473 CL |
173 | bool svcxdr_encode_stat(struct xdr_stream *xdr, __be32 status); |
174 | bool svcxdr_encode_fattr(struct svc_rqst *rqstp, struct xdr_stream *xdr, | |
175 | const struct svc_fh *fhp, const struct kstat *stat); | |
a257cdd0 | 176 | |
1da177e4 | 177 | #endif /* LINUX_NFSD_H */ |