summaryrefslogtreecommitdiff
path: root/tools/net/sunrpc/xdrgen/templates/C/enum/decoder/enum.j2
diff options
context:
space:
mode:
Diffstat (limited to 'tools/net/sunrpc/xdrgen/templates/C/enum/decoder/enum.j2')
-rw-r--r--tools/net/sunrpc/xdrgen/templates/C/enum/decoder/enum.j219
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/net/sunrpc/xdrgen/templates/C/enum/decoder/enum.j2 b/tools/net/sunrpc/xdrgen/templates/C/enum/decoder/enum.j2
new file mode 100644
index 000000000000..341d829afeda
--- /dev/null
+++ b/tools/net/sunrpc/xdrgen/templates/C/enum/decoder/enum.j2
@@ -0,0 +1,19 @@
+{# SPDX-License-Identifier: GPL-2.0 #}
+
+{% if annotate %}
+/* enum {{ name }} */
+{% endif %}
+{% if name in public_apis %}
+bool
+{% else %}
+static bool __maybe_unused
+{% endif %}
+xdrgen_decode_{{ name }}(struct xdr_stream *xdr, enum {{ name }} *ptr)
+{
+ u32 val;
+
+ if (xdr_stream_decode_u32(xdr, &val) < 0)
+ return false;
+ *ptr = val;
+ return true;
+}