Resguardo inicial

This commit is contained in:
lastdragon
2026-09-06 12:53:21 -06:00
parent 662efe3c2a
commit ad2088d178
94853 changed files with 43200404 additions and 0 deletions
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ name }} *ptr);
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, {{ name }} value);
@@ -0,0 +1,30 @@
{# 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, {{ name }} *ptr)
{
u32 val;
if (xdr_stream_decode_u32(xdr, &val) < 0)
return false;
{% if validate and enumerators %}
/* Compiler may optimize to a range check for dense enums */
switch (val) {
{% for e in enumerators %}
case {{ e.name }}:
{% endfor %}
break;
default:
return false;
}
{% endif %}
*ptr = val;
return true;
}
@@ -0,0 +1,34 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* enum {{ name }} (big-endian) */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ name }} *ptr)
{
{% if validate and enumerators %}
__be32 raw;
u32 val;
if (xdr_stream_decode_be32(xdr, &raw) < 0)
return false;
val = be32_to_cpu(raw);
/* Compiler may optimize to a range check for dense enums */
switch (val) {
{% for e in enumerators %}
case {{ e.name }}:
{% endfor %}
break;
default:
return false;
}
*ptr = raw;
return true;
{% else %}
return xdr_stream_decode_be32(xdr, ptr) == 0;
{% endif %}
}
@@ -0,0 +1,4 @@
{# SPDX-License-Identifier: GPL-2.0 #}
};
typedef enum {{ name }} {{ name }};
@@ -0,0 +1,4 @@
{# SPDX-License-Identifier: GPL-2.0 #}
};
typedef __be32 {{ name }};
@@ -0,0 +1,2 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{{ name }} = {{ value }},
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
enum {{ name }} {
@@ -0,0 +1,14 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* enum {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_encode_{{ name }}(struct xdr_stream *xdr, {{ name }} value)
{
return xdr_stream_encode_u32(xdr, value) == XDR_UNIT;
}
@@ -0,0 +1,14 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* enum {{ name }} (big-endian) */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_encode_{{ name }}(struct xdr_stream *xdr, {{ name }} value)
{
return xdr_stream_encode_be32(xdr, value) == XDR_UNIT;
}
@@ -0,0 +1,2 @@
{# SPDX-License-Identifier: GPL-2.0 #}
#define {{ '{:<31}'.format(macro) }} ({{ width }})