xref: /linux/tools/net/sunrpc/xdrgen/templates/C/program/decoder/result.j2 (revision 2cd86f02c017bf9733e5cd891381b7d40f6f37ad)
1{# SPDX-License-Identifier: GPL-2.0 #}
2
3{% if annotate %}
4/* Decode {{ result }} results */
5{% endif %}
6static int {{ program }}_xdr_dec_{{ result }}(struct rpc_rqst *req,
7		struct xdr_stream *xdr, void *data)
8{
9{% if result == 'void' %}
10	xdrgen_decode_void(xdr);
11{% else %}
12	struct {{ result }} *result = data;
13
14	if (!xdrgen_decode_{{ result }}(xdr, result))
15		return -EIO;
16	if (result->stat != nfs_ok) {
17		trace_nfs_xdr_status(xdr, (int)result->stat);
18		return {{ program }}_stat_to_errno(result->stat);
19	}
20{% endif %}
21	return 0;
22}
23