1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* XDR types for nfsd. This is mainly a typing exercise. */
15 struct nfsd_sattrargs
{
20 struct nfsd_diropargs
{
26 struct nfsd_readargs
{
32 struct nfsd_writeargs
{
36 struct xdr_buf payload
;
39 struct nfsd_createargs
{
46 struct nfsd_renameargs
{
55 struct nfsd_linkargs
{
62 struct nfsd_symlinkargs
{
72 struct nfsd_readdirargs
{
82 struct nfsd_attrstat
{
88 struct nfsd_diropres
{
94 struct nfsd_readlinkres
{
100 struct nfsd_readres
{
108 struct nfsd_readdirres
{
109 /* Components of the reply */
114 /* Used to encode the reply's entry list */
115 struct xdr_stream xdr
;
116 struct xdr_buf dirlist
;
117 struct readdir_cd common
;
118 unsigned int cookie_offset
;
121 struct nfsd_statfsres
{
123 struct kstatfs stats
;
127 * Storage requirements for XDR arguments and results.
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
;
141 #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore)
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
);
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
);
163 void nfssvc_encode_nfscookie(struct nfsd_readdirres
*resp
, u32 offset
);
164 int nfssvc_encode_entry(void *data
, const char *name
, int namlen
,
165 loff_t offset
, u64 ino
, unsigned int d_type
);
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
);
171 /* Helper functions for NFSv2 ACL code */
172 bool svcxdr_decode_fhandle(struct xdr_stream
*xdr
, struct svc_fh
*fhp
);
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
);
177 #endif /* LINUX_NFSD_H */