summaryrefslogtreecommitdiff
path: root/lib9p/idl.gen
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/idl.gen')
-rwxr-xr-xlib9p/idl.gen30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib9p/idl.gen b/lib9p/idl.gen
index e423196..262e5f0 100755
--- a/lib9p/idl.gen
+++ b/lib9p/idl.gen
@@ -733,7 +733,7 @@ const char *{idprefix}version_str(enum {idprefix}version ver) {{
ret += """
/* validate_* *****************************************************************/
-static ALWAYS_INLINE bool _validate_size_net(struct _validate_ctx *ctx, uint32_t n) {
+ALWAYS_INLINE static bool _validate_size_net(struct _validate_ctx *ctx, uint32_t n) {
if (__builtin_add_overflow(ctx->net_offset, n, &ctx->net_offset))
/* If needed-net-size overflowed uint32_t, then
* there's no way that actual-net-size will live up to
@@ -744,7 +744,7 @@ static ALWAYS_INLINE bool _validate_size_net(struct _validate_ctx *ctx, uint32_t
return false;
}
-static ALWAYS_INLINE bool _validate_size_host(struct _validate_ctx *ctx, size_t n) {
+ALWAYS_INLINE static bool _validate_size_host(struct _validate_ctx *ctx, size_t n) {
if (__builtin_add_overflow(ctx->host_extra, n, &ctx->host_extra))
/* If needed-host-size overflowed size_t, then there's
* no way that actual-net-size will live up to
@@ -753,7 +753,7 @@ static ALWAYS_INLINE bool _validate_size_host(struct _validate_ctx *ctx, size_t
return false;
}
-static ALWAYS_INLINE bool _validate_list(struct _validate_ctx *ctx,
+ALWAYS_INLINE static bool _validate_list(struct _validate_ctx *ctx,
size_t cnt,
_validate_fn_t item_fn, size_t item_host_size) {
for (size_t i = 0; i < cnt; i++)
@@ -789,7 +789,7 @@ static ALWAYS_INLINE bool _validate_list(struct _validate_ctx *ctx,
ret += ifdef_pop(1)
ret += "};\n"
- ret += f"static {inline} bool validate_{typ.name}(struct _validate_ctx *{argfn('ctx')}) {{\n"
+ ret += f"{inline} static bool validate_{typ.name}(struct _validate_ctx *{argfn('ctx')}) {{\n"
if typ.name == "d": # SPECIAL
# Optimize... maybe the compiler could figure out to do
@@ -900,22 +900,22 @@ static ALWAYS_INLINE bool _validate_list(struct _validate_ctx *ctx,
ret += """
/* unmarshal_* ****************************************************************/
-static ALWAYS_INLINE void unmarshal_1(struct _unmarshal_ctx *ctx, uint8_t *out) {
+ALWAYS_INLINE static void unmarshal_1(struct _unmarshal_ctx *ctx, uint8_t *out) {
*out = decode_u8le(&ctx->net_bytes[ctx->net_offset]);
ctx->net_offset += 1;
}
-static ALWAYS_INLINE void unmarshal_2(struct _unmarshal_ctx *ctx, uint16_t *out) {
+ALWAYS_INLINE static void unmarshal_2(struct _unmarshal_ctx *ctx, uint16_t *out) {
*out = decode_u16le(&ctx->net_bytes[ctx->net_offset]);
ctx->net_offset += 2;
}
-static ALWAYS_INLINE void unmarshal_4(struct _unmarshal_ctx *ctx, uint32_t *out) {
+ALWAYS_INLINE static void unmarshal_4(struct _unmarshal_ctx *ctx, uint32_t *out) {
*out = decode_u32le(&ctx->net_bytes[ctx->net_offset]);
ctx->net_offset += 4;
}
-static ALWAYS_INLINE void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *out) {
+ALWAYS_INLINE static void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *out) {
*out = decode_u64le(&ctx->net_bytes[ctx->net_offset]);
ctx->net_offset += 8;
}
@@ -925,7 +925,7 @@ static ALWAYS_INLINE void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *out)
argfn = unused if (isinstance(typ, Struct) and not typ.members) else used
ret += "\n"
ret += ifdef_push(1, c_ver_ifdef(typ.in_versions))
- ret += f"static {inline} void unmarshal_{typ.name}(struct _unmarshal_ctx *{argfn('ctx')}, {c_typename(typ)} *out) {{\n"
+ ret += f"{inline} static void unmarshal_{typ.name}(struct _unmarshal_ctx *{argfn('ctx')}, {c_typename(typ)} *out) {{\n"
match typ:
case Number():
ret += f"\tunmarshal_{typ.prim.name}(ctx, ({c_typename(typ.prim)} *)out);\n"
@@ -973,7 +973,7 @@ static ALWAYS_INLINE void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *out)
ret += """
/* marshal_* ******************************************************************/
-static ALWAYS_INLINE bool _marshal_too_large(struct _marshal_ctx *ctx) {
+ALWAYS_INLINE static bool _marshal_too_large(struct _marshal_ctx *ctx) {
lib9p_errorf(ctx->ctx, LINUX_ERANGE, "%s too large to marshal into %s limit (limit=%"PRIu32")",
(ctx->net_bytes[4] % 2 == 0) ? "T-message" : "R-message",
ctx->ctx->version ? "negotiated" : ((ctx->net_bytes[4] % 2 == 0) ? "client" : "server"),
@@ -981,7 +981,7 @@ static ALWAYS_INLINE bool _marshal_too_large(struct _marshal_ctx *ctx) {
return true;
}
-static ALWAYS_INLINE bool marshal_1(struct _marshal_ctx *ctx, uint8_t *val) {
+ALWAYS_INLINE static bool marshal_1(struct _marshal_ctx *ctx, uint8_t *val) {
if (ctx->net_offset + 1 > ctx->ctx->max_msg_size)
return _marshal_too_large(ctx);
ctx->net_bytes[ctx->net_offset] = *val;
@@ -989,7 +989,7 @@ static ALWAYS_INLINE bool marshal_1(struct _marshal_ctx *ctx, uint8_t *val) {
return false;
}
-static ALWAYS_INLINE bool marshal_2(struct _marshal_ctx *ctx, uint16_t *val) {
+ALWAYS_INLINE static bool marshal_2(struct _marshal_ctx *ctx, uint16_t *val) {
if (ctx->net_offset + 2 > ctx->ctx->max_msg_size)
return _marshal_too_large(ctx);
encode_u16le(*val, &ctx->net_bytes[ctx->net_offset]);
@@ -997,7 +997,7 @@ static ALWAYS_INLINE bool marshal_2(struct _marshal_ctx *ctx, uint16_t *val) {
return false;
}
-static ALWAYS_INLINE bool marshal_4(struct _marshal_ctx *ctx, uint32_t *val) {
+ALWAYS_INLINE static bool marshal_4(struct _marshal_ctx *ctx, uint32_t *val) {
if (ctx->net_offset + 4 > ctx->ctx->max_msg_size)
return true;
encode_u32le(*val, &ctx->net_bytes[ctx->net_offset]);
@@ -1005,7 +1005,7 @@ static ALWAYS_INLINE bool marshal_4(struct _marshal_ctx *ctx, uint32_t *val) {
return false;
}
-static ALWAYS_INLINE bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val) {
+ALWAYS_INLINE static bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val) {
if (ctx->net_offset + 8 > ctx->ctx->max_msg_size)
return true;
encode_u64le(*val, &ctx->net_bytes[ctx->net_offset]);
@@ -1018,7 +1018,7 @@ static ALWAYS_INLINE bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val) {
argfn = unused if (isinstance(typ, Struct) and not typ.members) else used
ret += "\n"
ret += ifdef_push(1, c_ver_ifdef(typ.in_versions))
- ret += f"static {inline} bool marshal_{typ.name}(struct _marshal_ctx *{argfn('ctx')}, {c_typename(typ)} *{argfn('val')}) {{\n"
+ ret += f"{inline} static bool marshal_{typ.name}(struct _marshal_ctx *{argfn('ctx')}, {c_typename(typ)} *{argfn('val')}) {{\n"
match typ:
case Number():
ret += f"\treturn marshal_{typ.prim.name}(ctx, ({c_typename(typ.prim)} *)val);\n"