summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2024-09-10 15:51:46 -0400
committerChuck Lever <chuck.lever@oracle.com>2024-09-20 19:31:40 -0400
commitfed8a17c61ffa2ba53dc749068b6f07ecf40e3bf (patch)
treefc2b7da1e632089ab965995ff068af1435efffbd
parent663ad8b1df8724cd5e01df66ea67ce0424fbcdf6 (diff)
xdrgen: typedefs should use the built-in string and opaque functions
'typedef opaque yada<XYZ>' should use xdrgen's built-in opaque encoder and decoder, to enable better compiler optimization. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
-rw-r--r--tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_opaque.j22
-rw-r--r--tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_string.j22
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_opaque.j2 b/tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_opaque.j2
index c1b7ad84f99c..f28f8b228ad5 100644
--- a/tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_opaque.j2
+++ b/tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_opaque.j2
@@ -13,5 +13,5 @@ xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr
{% if annotate %}
/* (variable-length opaque) */
{% endif %}
- return xdr_stream_decode_opaque(xdr, ptr->data, ptr->len) >= 0;
+ return xdrgen_decode_opaque(xdr, ptr, {{ maxsize }});
};
diff --git a/tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_string.j2 b/tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_string.j2
index 937286d76688..56c5a17d6a70 100644
--- a/tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_string.j2
+++ b/tools/net/sunrpc/xdrgen/templates/C/typedef/decoder/variable_length_string.j2
@@ -13,5 +13,5 @@ xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr
{% if annotate %}
/* (variable-length string) */
{% endif %}
- return xdr_stream_decode_opaque(xdr, ptr->data, ptr->len) >= 0;
+ return xdrgen_decode_string(xdr, ptr, {{ maxsize }});
};