xref: /linux/tools/net/sunrpc/xdrgen/templates/C/program/decoder/result.j2 (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
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