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 #}
enum { {{ name }} = {{ value }} };
@@ -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 }})
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
#endif /* _LINUX_XDRGEN_{{ infix }}_DECL_H */
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
#endif /* _LINUX_XDRGEN_{{ infix }}_DEF_H */
@@ -0,0 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Generated by xdrgen. Manual edits will be lost. */
/* XDR specification file: {{ filename }} */
/* XDR specification modification time: {{ mtime }} */
#ifndef _LINUX_XDRGEN_{{ infix }}_DECL_H
#define _LINUX_XDRGEN_{{ infix }}_DECL_H
#include <linux/types.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/xdrgen/_defs.h>
#include <linux/sunrpc/xdrgen/_builtins.h>
#include <linux/sunrpc/xdrgen/{{ infix.lower() }}.h>
@@ -0,0 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Generated by xdrgen. Manual edits will be lost. */
/* XDR specification file: {{ filename }} */
/* XDR specification modification time: {{ mtime }} */
#ifndef _LINUX_XDRGEN_{{ infix }}_DEF_H
#define _LINUX_XDRGEN_{{ infix }}_DEF_H
#include <linux/types.h>
#include <linux/sunrpc/xdrgen/_defs.h>
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{{ content }}
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{{ content }}
@@ -0,0 +1,4 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, struct {{ name }} *ptr);
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const struct {{ name }} *value);
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (basic) */
{% endif %}
if (!xdrgen_decode_{{ type }}(xdr, &ptr->{{ name }}))
return false;
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
return true;
}
@@ -0,0 +1,8 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (fixed-length array) */
{% endif %}
for (u32 i = 0; i < {{ size }}; i++) {
if (xdrgen_decode_{{ type }}(xdr, &ptr->{{ name }}.items[i]) < 0)
return false;
}
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (fixed-length opaque) */
{% endif %}
if (xdr_stream_decode_opaque_fixed(xdr, ptr->{{ name }}, {{ size }}) < 0)
return false;
@@ -0,0 +1,22 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* pointer {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, struct {{ name }} *ptr)
{
bool opted;
{% if annotate %}
/* opted */
{% endif %}
if (!xdrgen_decode_bool(xdr, &opted))
return false;
if (!opted)
return true;
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (optional data) */
{% endif %}
if (!xdrgen_decode_{{ type }}(xdr, ptr->{{ name }}))
return false;
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length string) */
{% endif %}
if (!xdrgen_decode_string(xdr, (string *)ptr, {{ maxsize }}))
return false;
@@ -0,0 +1,13 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length array) */
{% endif %}
if (xdr_stream_decode_u32(xdr, &ptr->{{ name }}.count) < 0)
return false;
{% if maxsize != "0" %}
if (ptr->{{ name }}.count > {{ maxsize }})
return false;
{% endif %}
for (u32 i = 0; i < ptr->{{ name }}.count; i++)
if (!xdrgen_decode_{{ type }}(xdr, &ptr->{{ name }}.element[i]))
return false;
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length opaque) */
{% endif %}
if (!xdrgen_decode_opaque(xdr, (opaque *)ptr, {{ maxsize }}))
return false;
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (basic) */
{% endif %}
{{ classifier }}{{ type }} {{ name }};
@@ -0,0 +1,2 @@
{# SPDX-License-Identifier: GPL-2.0 #}
};
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (fixed-length array) */
{% endif %}
{{ type }} {{ name }}[{{ size }}];
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (fixed-length opaque) */
{% endif %}
u8 {{ name }}[{{ size }}];
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* pointer {{ name }} */
{% endif %}
struct {{ name }} {
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (optional data) */
{% endif %}
{{ classifier }}{{ type }} *{{ name }};
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (variable-length string) */
{% endif %}
string {{ name }};
@@ -0,0 +1,8 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (variable-length array) */
{% endif %}
struct {
u32 count;
{{ classifier }}{{ type }} *element;
} {{ name }};
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (variable-length opaque) */
{% endif %}
opaque {{ name }};
@@ -0,0 +1,10 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (basic) */
{% endif %}
{% if type in pass_by_reference %}
if (!xdrgen_encode_{{ type }}(xdr, &value->{{ name }}))
{% else %}
if (!xdrgen_encode_{{ type }}(xdr, value->{{ name }}))
{% endif %}
return false;
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
return true;
}
@@ -0,0 +1,12 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (fixed-length array) */
{% endif %}
for (u32 i = 0; i < {{ size }}; i++) {
{% if type in pass_by_reference %}
if (xdrgen_encode_{{ type }}(xdr, &value->items[i]) < 0)
{% else %}
if (xdrgen_encode_{{ type }}(xdr, value->items[i]) < 0)
{% endif %}
return false;
}
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (fixed-length opaque) */
{% endif %}
if (xdr_stream_encode_opaque_fixed(xdr, value->{{ name }}, {{ size }}) < 0)
return false;
@@ -0,0 +1,20 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* pointer {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const struct {{ name }} *value)
{
{% if annotate %}
/* opted */
{% endif %}
if (!xdrgen_encode_bool(xdr, value != NULL))
return false;
if (!value)
return true;
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (optional data) */
{% endif %}
if (!xdrgen_encode_{{ type }}(xdr, value->{{ name }}))
return false;
@@ -0,0 +1,8 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length string) */
{% endif %}
if (value->{{ name }}.len > {{ maxsize }})
return false;
if (xdr_stream_encode_opaque(xdr, value->{{ name }}.data, value->{{ name }}.len) < 0)
return false;
@@ -0,0 +1,17 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length array) */
{% endif %}
{% if maxsize != "0" %}
if (value->{{ name }}.count > {{ maxsize }})
return false;
{% endif %}
if (xdr_stream_encode_u32(xdr, value->{{ name }}.count) != XDR_UNIT)
return false;
for (u32 i = 0; i < value->{{ name }}.count; i++)
{% if type in pass_by_reference %}
if (!xdrgen_encode_{{ type }}(xdr, &value->{{ name }}.element[i]))
{% else %}
if (!xdrgen_encode_{{ type }}(xdr, value->{{ name }}.element[i]))
{% endif %}
return false;
@@ -0,0 +1,8 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length opaque) */
{% endif %}
if (value->{{ name }}.len > {{ maxsize }})
return false;
if (xdr_stream_encode_opaque(xdr, value->{{ name }}.data, value->{{ name }}.len) < 0)
return false;
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
#define {{ '{:<31}'.format(macro) }} \
({{ width }})
@@ -0,0 +1,2 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool {{ program }}_svc_decode_{{ argument }}(struct svc_rqst *rqstp, struct xdr_stream *xdr);
@@ -0,0 +1,2 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool {{ program }}_svc_encode_{{ result }}(struct svc_rqst *rqstp, struct xdr_stream *xdr);
@@ -0,0 +1,25 @@
{# SPDX-License-Identifier: GPL-2.0 #}
/**
* {{ program }}_svc_decode_{{ argument }} - Decode a {{ argument }} argument
* @rqstp: RPC transaction context
* @xdr: source XDR data stream
*
* Return values:
* %true: procedure arguments decoded successfully
* %false: decode failed
*/
bool {{ program }}_svc_decode_{{ argument }}(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
{% if argument == 'void' %}
return xdrgen_decode_void(xdr);
{% else %}
{% if argument in structs %}
struct {{ argument }} *argp = rqstp->rq_argp;
{% else %}
{{ argument }} *argp = rqstp->rq_argp;
{% endif %}
return xdrgen_decode_{{ argument }}(xdr, argp);
{% endif %}
}
@@ -0,0 +1,18 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* Decode {{ result }} results */
{% endif %}
static int {{ program }}_xdr_dec_{{ result }}(struct rpc_rqst *req,
struct xdr_stream *xdr, void *data)
{
{% if result == 'void' %}
xdrgen_decode_void(xdr);
{% else %}
struct {{ result }} *result = data;
if (!xdrgen_decode_{{ result }}(xdr, result))
return -EIO;
{% endif %}
return 0;
}
@@ -0,0 +1,2 @@
{# SPDX-License-Identifier: GPL-2.0 #}
};
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* procedure numbers for {{ program }} */
{% endif %}
enum {
@@ -0,0 +1,2 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{{ name }} = {{ value }},
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
#ifndef {{ name }}
#define {{ name }} ({{ value }})
#endif
@@ -0,0 +1,16 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{%if annotate %}
/* Encode {{ argument }} arguments */
{% endif %}
static void {{ program }}_xdr_enc_{{ argument }}(struct rpc_rqst *req,
struct xdr_stream *xdr, const void *data)
{
{% if argument == 'void' %}
xdrgen_encode_void(xdr);
{% else %}
const struct {{ argument }} *args = data;
xdrgen_encode_{{ argument }}(xdr, args);
{% endif %}
}
@@ -0,0 +1,27 @@
{# SPDX-License-Identifier: GPL-2.0 #}
/**
* {{ program }}_svc_encode_{{ result }} - Encode a {{ result }} result
* @rqstp: RPC transaction context
* @xdr: target XDR data stream
*
* Return values:
* %true: procedure results encoded successfully
* %false: encode failed
*/
bool {{ program }}_svc_encode_{{ result }}(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
{% if result == 'void' %}
return xdrgen_encode_void(xdr);
{% else %}
{% if result in structs %}
struct {{ result }} *resp = rqstp->rq_resp;
return xdrgen_encode_{{ result }}(xdr, resp);
{% else %}
{{ result }} *resp = rqstp->rq_resp;
return xdrgen_encode_{{ result }}(xdr, *resp);
{% endif %}
{% endif %}
}
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
#define {{ '{:<31}'.format(macro) }} \
({{ width }})
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
// Generated by xdrgen. Manual edits will be lost.
// XDR specification file: {{ filename }}
// XDR specification modification time: {{ mtime }}
#include <linux/types.h>
#include <linux/sunrpc/xdr.h>
#include <linux/sunrpc/xdrgen/_defs.h>
#include <linux/sunrpc/xdrgen/_builtins.h>
#include <linux/sunrpc/clnt.h>
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
// Generated by xdrgen. Manual edits will be lost.
// XDR specification file: {{ filename }}
// XDR specification modification time: {{ mtime }}
#include <linux/sunrpc/svc.h>
#include "{{ program }}xdr_gen.h"
@@ -0,0 +1,4 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, struct {{ name }} *ptr);
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const struct {{ name }} *value);
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (basic) */
{% endif %}
if (!xdrgen_decode_{{ type }}(xdr, &ptr->{{ name }}))
return false;
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
return true;
}
@@ -0,0 +1,8 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (fixed-length array) */
{% endif %}
for (u32 i = 0; i < {{ size }}; i++) {
if (xdrgen_decode_{{ type }}(xdr, &ptr->{{ name }}.items[i]) < 0)
return false;
}
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (fixed-length opaque) */
{% endif %}
if (xdr_stream_decode_opaque_fixed(xdr, ptr->{{ name }}, {{ size }}) < 0)
return false;
@@ -0,0 +1,12 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* struct {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, struct {{ name }} *ptr)
{
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (optional data) */
{% endif %}
if (!xdrgen_decode_{{ type }}(xdr, ptr->{{ name }}))
return false;
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length string) */
{% endif %}
if (!xdrgen_decode_string(xdr, (string *)ptr, {{ maxsize }}))
return false;
@@ -0,0 +1,13 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length array) */
{% endif %}
if (xdr_stream_decode_u32(xdr, &ptr->{{ name }}.count) < 0)
return false;
{% if maxsize != "0" %}
if (ptr->{{ name }}.count > {{ maxsize }})
return false;
{% endif %}
for (u32 i = 0; i < ptr->{{ name }}.count; i++)
if (!xdrgen_decode_{{ type }}(xdr, &ptr->{{ name }}.element[i]))
return false;
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length opaque) */
{% endif %}
if (!xdrgen_decode_opaque(xdr, &ptr->{{ name }}, {{ maxsize }}))
return false;
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (basic) */
{% endif %}
{{ classifier }}{{ type }} {{ name }};
@@ -0,0 +1,2 @@
{# SPDX-License-Identifier: GPL-2.0 #}
};
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (fixed-length array) */
{% endif %}
{{ type }} {{ name }}[{{ size }}];
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (fixed-length opaque) */
{% endif %}
u8 {{ name }}[{{ size }}];
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* struct {{ name }} */
{% endif %}
struct {{ name }} {
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (optional data) */
{% endif %}
{{ classifier }}{{ type }} *{{ name }};
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (variable-length string) */
{% endif %}
string {{ name }};
@@ -0,0 +1,8 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (variable-length array) */
{% endif %}
struct {
u32 count;
{{ classifier }}{{ type }} *element;
} {{ name }};
@@ -0,0 +1,5 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* (variable-length opaque) */
{% endif %}
opaque {{ name }};
@@ -0,0 +1,10 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (basic) */
{% endif %}
{% if type in pass_by_reference %}
if (!xdrgen_encode_{{ type }}(xdr, &value->{{ name }}))
{% else %}
if (!xdrgen_encode_{{ type }}(xdr, value->{{ name }}))
{% endif %}
return false;
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
return true;
}
@@ -0,0 +1,12 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (fixed-length array) */
{% endif %}
for (u32 i = 0; i < {{ size }}; i++) {
{% if type in pass_by_reference %}
if (xdrgen_encode_{{ type }}(xdr, &value->items[i]) < 0)
{% else %}
if (xdrgen_encode_{{ type }}(xdr, value->items[i]) < 0)
{% endif %}
return false;
}
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (fixed-length opaque) */
{% endif %}
if (xdr_stream_encode_opaque_fixed(xdr, value->{{ name }}, {{ size }}) < 0)
return false;
@@ -0,0 +1,12 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* struct {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const struct {{ name }} *value)
{
@@ -0,0 +1,6 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (optional data) */
{% endif %}
if (!xdrgen_encode_{{ type }}(xdr, value->{{ name }}))
return false;
@@ -0,0 +1,8 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length string) */
{% endif %}
if (value->{{ name }}.len > {{ maxsize }})
return false;
if (xdr_stream_encode_opaque(xdr, value->{{ name }}.data, value->{{ name }}.len) < 0)
return false;
@@ -0,0 +1,17 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length array) */
{% endif %}
{% if maxsize != "0" %}
if (value->{{ name }}.count > {{ maxsize }})
return false;
{% endif %}
if (xdr_stream_encode_u32(xdr, value->{{ name }}.count) != XDR_UNIT)
return false;
for (u32 i = 0; i < value->{{ name }}.count; i++)
{% if type in pass_by_reference %}
if (!xdrgen_encode_{{ type }}(xdr, &value->{{ name }}.element[i]))
{% else %}
if (!xdrgen_encode_{{ type }}(xdr, value->{{ name }}.element[i]))
{% endif %}
return false;
@@ -0,0 +1,8 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* member {{ name }} (variable-length opaque) */
{% endif %}
if (value->{{ name }}.len > {{ maxsize }})
return false;
if (xdr_stream_encode_opaque(xdr, value->{{ name }}.data, value->{{ name }}.len) < 0)
return false;
@@ -0,0 +1,3 @@
{# SPDX-License-Identifier: GPL-2.0 #}
#define {{ '{:<31}'.format(macro) }} \
({{ width }})
@@ -0,0 +1,8 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ name }} *ptr);
{% if name in pass_by_reference %}
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const {{ name }} *value);
{%- else -%}
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const {{ name }} value);
{% endif %}
@@ -0,0 +1,4 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr);
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const {{ classifier }}{{ name }} value);
@@ -0,0 +1,4 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr);
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const {{ classifier }}{{ name }} value);
@@ -0,0 +1,4 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr);
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const {{ classifier }}{{ name }} value);
@@ -0,0 +1,4 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr);
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const {{ classifier }}{{ name }} value);
@@ -0,0 +1,4 @@
{# SPDX-License-Identifier: GPL-2.0 #}
bool xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr);
bool xdrgen_encode_{{ name }}(struct xdr_stream *xdr, const {{ classifier }}{{ name }} value);
@@ -0,0 +1,17 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* typedef {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ name }} *ptr)
{
{% if annotate %}
/* (basic) */
{% endif %}
return xdrgen_decode_{{ type }}(xdr, ptr);
}
@@ -0,0 +1,25 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* typedef {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr)
{
{% if annotate %}
/* (fixed-length array) */
{% endif %}
for (u32 i = 0; i < {{ size }}; i++) {
{%- if classifier == '' %}
if (xdrgen_decode_{{ type }}(xdr, ptr->items[i]) < 0)
{% else %}
if (xdrgen_decode_{{ type }}(xdr, &ptr->items[i]) < 0)
{% endif %}
return false;
}
return true;
}
@@ -0,0 +1,17 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* typedef {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr)
{
{% if annotate %}
/* (fixed-length opaque) */
{% endif %}
return xdr_stream_decode_opaque_fixed(xdr, ptr, {{ size }}) == 0;
}
@@ -0,0 +1,17 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* typedef {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr)
{
{% if annotate %}
/* (variable-length string) */
{% endif %}
return xdrgen_decode_string(xdr, ptr, {{ maxsize }});
}
@@ -0,0 +1,26 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* typedef {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr)
{
{% if annotate %}
/* (variable-length array) */
{% endif %}
if (xdr_stream_decode_u32(xdr, &ptr->count) < 0)
return false;
{% if maxsize != "0" %}
if (ptr->count > {{ maxsize }})
return false;
{% endif %}
for (u32 i = 0; i < ptr->count; i++)
if (!xdrgen_decode_{{ type }}(xdr, &ptr->element[i]))
return false;
return true;
}
@@ -0,0 +1,17 @@
{# SPDX-License-Identifier: GPL-2.0 #}
{% if annotate %}
/* typedef {{ name }} */
{% endif %}
{% if name in public_apis %}
bool
{% else %}
static bool __maybe_unused
{% endif %}
xdrgen_decode_{{ name }}(struct xdr_stream *xdr, {{ classifier }}{{ name }} *ptr)
{
{% if annotate %}
/* (variable-length opaque) */
{% endif %}
return xdrgen_decode_opaque(xdr, ptr, {{ maxsize }});
}

Some files were not shown because too many files have changed in this diff Show More