summaryrefslogtreecommitdiff
path: root/lib9p
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-21 23:51:38 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-23 13:56:38 -0700
commit0615af6f4748e4f7dc6a4f034a9db636742cc3bd (patch)
treea0c09720ca4c8670869b56d03e57431b46073f75 /lib9p
parent3064cb13577edd31d3a3ceb79b2bc72314ec208b (diff)
Use C23 (C++11) attribute syntax instead of __attribute__
Diffstat (limited to 'lib9p')
-rw-r--r--lib9p/9p.generated.c276
-rwxr-xr-xlib9p/idl.gen30
-rw-r--r--lib9p/include/lib9p/srv.h2
-rw-r--r--lib9p/internal.h22
-rw-r--r--lib9p/srv.c6
5 files changed, 168 insertions, 168 deletions
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c
index 536063a..f3a907b 100644
--- a/lib9p/9p.generated.c
+++ b/lib9p/9p.generated.c
@@ -33,7 +33,7 @@ const char *lib9p_version_str(enum lib9p_version ver) {
/* 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
@@ -44,7 +44,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
@@ -53,7 +53,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++)
@@ -68,15 +68,15 @@ static ALWAYS_INLINE bool _validate_list(struct _validate_ctx *ctx,
#define validate_8(ctx) _validate_size_net(ctx, 8)
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u
-static ALWAYS_INLINE bool validate_tag(struct _validate_ctx *ctx) {
+ALWAYS_INLINE static bool validate_tag(struct _validate_ctx *ctx) {
return validate_2(ctx);
}
-static ALWAYS_INLINE bool validate_fid(struct _validate_ctx *ctx) {
+ALWAYS_INLINE static bool validate_fid(struct _validate_ctx *ctx) {
return validate_4(ctx);
}
-static ALWAYS_INLINE bool validate_d(struct _validate_ctx *ctx) {
+ALWAYS_INLINE static bool validate_d(struct _validate_ctx *ctx) {
uint32_t base_offset = ctx->net_offset;
if (validate_4(ctx))
return true;
@@ -84,7 +84,7 @@ static ALWAYS_INLINE bool validate_d(struct _validate_ctx *ctx) {
return _validate_size_net(ctx, len) || _validate_size_host(ctx, len);
}
-static ALWAYS_INLINE bool validate_s(struct _validate_ctx *ctx) {
+ALWAYS_INLINE static bool validate_s(struct _validate_ctx *ctx) {
uint32_t base_offset = ctx->net_offset;
if (validate_2(ctx))
return true;
@@ -107,7 +107,7 @@ static const lib9p_dm_t dm_masks[LIB9P_VER_NUM] = {
[LIB9P_VER_9P2000_u] = 0b11101100101111000000000111111111,
#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-static ALWAYS_INLINE bool validate_dm(struct _validate_ctx *ctx) {
+ALWAYS_INLINE static bool validate_dm(struct _validate_ctx *ctx) {
if (validate_4(ctx))
return true;
lib9p_dm_t mask = dm_masks[ctx->ctx->version];
@@ -128,7 +128,7 @@ static const lib9p_qt_t qt_masks[LIB9P_VER_NUM] = {
[LIB9P_VER_9P2000_u] = 0b11101110,
#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-static ALWAYS_INLINE bool validate_qt(struct _validate_ctx *ctx) {
+ALWAYS_INLINE static bool validate_qt(struct _validate_ctx *ctx) {
if (validate_1(ctx))
return true;
lib9p_qt_t mask = qt_masks[ctx->ctx->version];
@@ -138,7 +138,7 @@ static ALWAYS_INLINE bool validate_qt(struct _validate_ctx *ctx) {
return false;
}
-static ALWAYS_INLINE bool validate_qid(struct _validate_ctx *ctx) {
+ALWAYS_INLINE static bool validate_qid(struct _validate_ctx *ctx) {
return false
|| validate_qt(ctx)
|| validate_4(ctx)
@@ -146,7 +146,7 @@ static ALWAYS_INLINE bool validate_qid(struct _validate_ctx *ctx) {
;
}
-static ALWAYS_INLINE bool validate_stat(struct _validate_ctx *ctx) {
+ALWAYS_INLINE static bool validate_stat(struct _validate_ctx *ctx) {
uint16_t stat_size;
uint32_t _kern_type_offset;
return false
@@ -184,7 +184,7 @@ static const lib9p_o_t o_masks[LIB9P_VER_NUM] = {
[LIB9P_VER_9P2000_u] = 0b01010011,
#endif /* CONFIG_9P_ENABLE_9P2000_u */
};
-static ALWAYS_INLINE bool validate_o(struct _validate_ctx *ctx) {
+ALWAYS_INLINE static bool validate_o(struct _validate_ctx *ctx) {
if (validate_1(ctx))
return true;
lib9p_o_t mask = o_masks[ctx->ctx->version];
@@ -194,7 +194,7 @@ static ALWAYS_INLINE bool validate_o(struct _validate_ctx *ctx) {
return false;
}
-static FLATTEN bool validate_Tversion(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tversion(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -211,7 +211,7 @@ static FLATTEN bool validate_Tversion(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rversion(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rversion(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -228,7 +228,7 @@ static FLATTEN bool validate_Rversion(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tauth(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tauth(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -249,7 +249,7 @@ static FLATTEN bool validate_Tauth(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rauth(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rauth(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -265,7 +265,7 @@ static FLATTEN bool validate_Rauth(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tattach(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tattach(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -287,7 +287,7 @@ static FLATTEN bool validate_Tattach(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rattach(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rattach(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -303,7 +303,7 @@ static FLATTEN bool validate_Rattach(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rerror(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rerror(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -322,7 +322,7 @@ static FLATTEN bool validate_Rerror(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tflush(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tflush(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -338,7 +338,7 @@ static FLATTEN bool validate_Tflush(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rflush(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rflush(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -353,7 +353,7 @@ static FLATTEN bool validate_Rflush(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Twalk(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Twalk(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint16_t nwname;
@@ -375,7 +375,7 @@ static FLATTEN bool validate_Twalk(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rwalk(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rwalk(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint16_t nwqid;
@@ -395,7 +395,7 @@ static FLATTEN bool validate_Rwalk(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Topen(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Topen(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -412,7 +412,7 @@ static FLATTEN bool validate_Topen(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Ropen(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Ropen(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -429,7 +429,7 @@ static FLATTEN bool validate_Ropen(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tcreate(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tcreate(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -448,7 +448,7 @@ static FLATTEN bool validate_Tcreate(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rcreate(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rcreate(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -465,7 +465,7 @@ static FLATTEN bool validate_Rcreate(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tread(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tread(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -483,7 +483,7 @@ static FLATTEN bool validate_Tread(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rread(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rread(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -499,7 +499,7 @@ static FLATTEN bool validate_Rread(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Twrite(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Twrite(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -517,7 +517,7 @@ static FLATTEN bool validate_Twrite(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rwrite(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rwrite(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -533,7 +533,7 @@ static FLATTEN bool validate_Rwrite(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tclunk(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tclunk(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -549,7 +549,7 @@ static FLATTEN bool validate_Tclunk(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rclunk(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rclunk(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -564,7 +564,7 @@ static FLATTEN bool validate_Rclunk(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tremove(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tremove(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -580,7 +580,7 @@ static FLATTEN bool validate_Tremove(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rremove(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rremove(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -595,7 +595,7 @@ static FLATTEN bool validate_Rremove(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tstat(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tstat(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -611,7 +611,7 @@ static FLATTEN bool validate_Tstat(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rstat(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rstat(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint16_t nstat;
@@ -632,7 +632,7 @@ static FLATTEN bool validate_Rstat(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Twstat(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Twstat(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint16_t nstat;
@@ -654,7 +654,7 @@ static FLATTEN bool validate_Twstat(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rwstat(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rwstat(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -671,7 +671,7 @@ static FLATTEN bool validate_Rwstat(struct _validate_ctx *ctx) {
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_e
-static FLATTEN bool validate_Tsession(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tsession(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -687,7 +687,7 @@ static FLATTEN bool validate_Tsession(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rsession(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rsession(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -702,7 +702,7 @@ static FLATTEN bool validate_Rsession(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tsread(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tsread(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -720,7 +720,7 @@ static FLATTEN bool validate_Tsread(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rsread(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rsread(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -736,7 +736,7 @@ static FLATTEN bool validate_Rsread(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Tswrite(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Tswrite(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -755,7 +755,7 @@ static FLATTEN bool validate_Tswrite(struct _validate_ctx *ctx) {
;
}
-static FLATTEN bool validate_Rswrite(struct _validate_ctx *ctx) {
+FLATTEN static bool validate_Rswrite(struct _validate_ctx *ctx) {
uint32_t size;
uint8_t typ;
uint32_t _size_offset;
@@ -774,36 +774,36 @@ static FLATTEN bool validate_Rswrite(struct _validate_ctx *ctx) {
/* 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;
}
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u
-static ALWAYS_INLINE void unmarshal_tag(struct _unmarshal_ctx *ctx, lib9p_tag_t *out) {
+ALWAYS_INLINE static void unmarshal_tag(struct _unmarshal_ctx *ctx, lib9p_tag_t *out) {
unmarshal_2(ctx, (uint16_t *)out);
}
-static ALWAYS_INLINE void unmarshal_fid(struct _unmarshal_ctx *ctx, lib9p_fid_t *out) {
+ALWAYS_INLINE static void unmarshal_fid(struct _unmarshal_ctx *ctx, lib9p_fid_t *out) {
unmarshal_4(ctx, (uint32_t *)out);
}
-static ALWAYS_INLINE void unmarshal_d(struct _unmarshal_ctx *ctx, struct lib9p_d *out) {
+ALWAYS_INLINE static void unmarshal_d(struct _unmarshal_ctx *ctx, struct lib9p_d *out) {
memset(out, 0, sizeof(*out));
unmarshal_4(ctx, &out->len);
out->dat = ctx->extra;
@@ -812,7 +812,7 @@ static ALWAYS_INLINE void unmarshal_d(struct _unmarshal_ctx *ctx, struct lib9p_d
unmarshal_1(ctx, (uint8_t *)&out->dat[i]);
}
-static ALWAYS_INLINE void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9p_s *out) {
+ALWAYS_INLINE static void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9p_s *out) {
memset(out, 0, sizeof(*out));
unmarshal_2(ctx, &out->len);
out->utf8 = ctx->extra;
@@ -823,22 +823,22 @@ static ALWAYS_INLINE void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9p_s
out->utf8[out->len] = '\0';
}
-static ALWAYS_INLINE void unmarshal_dm(struct _unmarshal_ctx *ctx, lib9p_dm_t *out) {
+ALWAYS_INLINE static void unmarshal_dm(struct _unmarshal_ctx *ctx, lib9p_dm_t *out) {
unmarshal_4(ctx, (uint32_t *)out);
}
-static ALWAYS_INLINE void unmarshal_qt(struct _unmarshal_ctx *ctx, lib9p_qt_t *out) {
+ALWAYS_INLINE static void unmarshal_qt(struct _unmarshal_ctx *ctx, lib9p_qt_t *out) {
unmarshal_1(ctx, (uint8_t *)out);
}
-static ALWAYS_INLINE void unmarshal_qid(struct _unmarshal_ctx *ctx, struct lib9p_qid *out) {
+ALWAYS_INLINE static void unmarshal_qid(struct _unmarshal_ctx *ctx, struct lib9p_qid *out) {
memset(out, 0, sizeof(*out));
unmarshal_qt(ctx, &out->type);
unmarshal_4(ctx, &out->vers);
unmarshal_8(ctx, &out->path);
}
-static ALWAYS_INLINE void unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) {
+ALWAYS_INLINE static void unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9p_stat *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 2;
unmarshal_2(ctx, &out->kern_type);
@@ -860,11 +860,11 @@ static ALWAYS_INLINE void unmarshal_stat(struct _unmarshal_ctx *ctx, struct lib9
#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-static ALWAYS_INLINE void unmarshal_o(struct _unmarshal_ctx *ctx, lib9p_o_t *out) {
+ALWAYS_INLINE static void unmarshal_o(struct _unmarshal_ctx *ctx, lib9p_o_t *out) {
unmarshal_1(ctx, (uint8_t *)out);
}
-static FLATTEN void unmarshal_Tversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tversion *out) {
+FLATTEN static void unmarshal_Tversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tversion *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -873,7 +873,7 @@ static FLATTEN void unmarshal_Tversion(struct _unmarshal_ctx *ctx, struct lib9p_
unmarshal_s(ctx, &out->version);
}
-static FLATTEN void unmarshal_Rversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rversion *out) {
+FLATTEN static void unmarshal_Rversion(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rversion *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -882,7 +882,7 @@ static FLATTEN void unmarshal_Rversion(struct _unmarshal_ctx *ctx, struct lib9p_
unmarshal_s(ctx, &out->version);
}
-static FLATTEN void unmarshal_Tauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tauth *out) {
+FLATTEN static void unmarshal_Tauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tauth *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -895,7 +895,7 @@ static FLATTEN void unmarshal_Tauth(struct _unmarshal_ctx *ctx, struct lib9p_msg
#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-static FLATTEN void unmarshal_Rauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rauth *out) {
+FLATTEN static void unmarshal_Rauth(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rauth *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -903,7 +903,7 @@ static FLATTEN void unmarshal_Rauth(struct _unmarshal_ctx *ctx, struct lib9p_msg
unmarshal_qid(ctx, &out->aqid);
}
-static FLATTEN void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tattach *out) {
+FLATTEN static void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tattach *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -917,7 +917,7 @@ static FLATTEN void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_m
#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-static FLATTEN void unmarshal_Rattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rattach *out) {
+FLATTEN static void unmarshal_Rattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rattach *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -925,7 +925,7 @@ static FLATTEN void unmarshal_Rattach(struct _unmarshal_ctx *ctx, struct lib9p_m
unmarshal_qid(ctx, &out->qid);
}
-static FLATTEN void unmarshal_Rerror(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rerror *out) {
+FLATTEN static void unmarshal_Rerror(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rerror *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -936,7 +936,7 @@ static FLATTEN void unmarshal_Rerror(struct _unmarshal_ctx *ctx, struct lib9p_ms
#endif /* CONFIG_9P_ENABLE_9P2000_u */
}
-static FLATTEN void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tflush *out) {
+FLATTEN static void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tflush *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -944,14 +944,14 @@ static FLATTEN void unmarshal_Tflush(struct _unmarshal_ctx *ctx, struct lib9p_ms
unmarshal_2(ctx, &out->oldtag);
}
-static FLATTEN void unmarshal_Rflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rflush *out) {
+FLATTEN static void unmarshal_Rflush(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rflush *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
}
-static FLATTEN void unmarshal_Twalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twalk *out) {
+FLATTEN static void unmarshal_Twalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twalk *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -965,7 +965,7 @@ static FLATTEN void unmarshal_Twalk(struct _unmarshal_ctx *ctx, struct lib9p_msg
unmarshal_s(ctx, &out->wname[i]);
}
-static FLATTEN void unmarshal_Rwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwalk *out) {
+FLATTEN static void unmarshal_Rwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwalk *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -977,7 +977,7 @@ static FLATTEN void unmarshal_Rwalk(struct _unmarshal_ctx *ctx, struct lib9p_msg
unmarshal_qid(ctx, &out->wqid[i]);
}
-static FLATTEN void unmarshal_Topen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Topen *out) {
+FLATTEN static void unmarshal_Topen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Topen *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -986,7 +986,7 @@ static FLATTEN void unmarshal_Topen(struct _unmarshal_ctx *ctx, struct lib9p_msg
unmarshal_o(ctx, &out->mode);
}
-static FLATTEN void unmarshal_Ropen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Ropen *out) {
+FLATTEN static void unmarshal_Ropen(struct _unmarshal_ctx *ctx, struct lib9p_msg_Ropen *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -995,7 +995,7 @@ static FLATTEN void unmarshal_Ropen(struct _unmarshal_ctx *ctx, struct lib9p_msg
unmarshal_4(ctx, &out->iounit);
}
-static FLATTEN void unmarshal_Tcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tcreate *out) {
+FLATTEN static void unmarshal_Tcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tcreate *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1006,7 +1006,7 @@ static FLATTEN void unmarshal_Tcreate(struct _unmarshal_ctx *ctx, struct lib9p_m
unmarshal_o(ctx, &out->mode);
}
-static FLATTEN void unmarshal_Rcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rcreate *out) {
+FLATTEN static void unmarshal_Rcreate(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rcreate *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1015,7 +1015,7 @@ static FLATTEN void unmarshal_Rcreate(struct _unmarshal_ctx *ctx, struct lib9p_m
unmarshal_4(ctx, &out->iounit);
}
-static FLATTEN void unmarshal_Tread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tread *out) {
+FLATTEN static void unmarshal_Tread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tread *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1025,7 +1025,7 @@ static FLATTEN void unmarshal_Tread(struct _unmarshal_ctx *ctx, struct lib9p_msg
unmarshal_4(ctx, &out->count);
}
-static FLATTEN void unmarshal_Rread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rread *out) {
+FLATTEN static void unmarshal_Rread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rread *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1033,7 +1033,7 @@ static FLATTEN void unmarshal_Rread(struct _unmarshal_ctx *ctx, struct lib9p_msg
unmarshal_d(ctx, &out->data);
}
-static FLATTEN void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twrite *out) {
+FLATTEN static void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twrite *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1043,7 +1043,7 @@ static FLATTEN void unmarshal_Twrite(struct _unmarshal_ctx *ctx, struct lib9p_ms
unmarshal_d(ctx, &out->data);
}
-static FLATTEN void unmarshal_Rwrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwrite *out) {
+FLATTEN static void unmarshal_Rwrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwrite *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1051,7 +1051,7 @@ static FLATTEN void unmarshal_Rwrite(struct _unmarshal_ctx *ctx, struct lib9p_ms
unmarshal_4(ctx, &out->count);
}
-static FLATTEN void unmarshal_Tclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tclunk *out) {
+FLATTEN static void unmarshal_Tclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tclunk *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1059,14 +1059,14 @@ static FLATTEN void unmarshal_Tclunk(struct _unmarshal_ctx *ctx, struct lib9p_ms
unmarshal_fid(ctx, &out->fid);
}
-static FLATTEN void unmarshal_Rclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rclunk *out) {
+FLATTEN static void unmarshal_Rclunk(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rclunk *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
}
-static FLATTEN void unmarshal_Tremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tremove *out) {
+FLATTEN static void unmarshal_Tremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tremove *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1074,14 +1074,14 @@ static FLATTEN void unmarshal_Tremove(struct _unmarshal_ctx *ctx, struct lib9p_m
unmarshal_fid(ctx, &out->fid);
}
-static FLATTEN void unmarshal_Rremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rremove *out) {
+FLATTEN static void unmarshal_Rremove(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rremove *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
}
-static FLATTEN void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstat *out) {
+FLATTEN static void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tstat *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1089,7 +1089,7 @@ static FLATTEN void unmarshal_Tstat(struct _unmarshal_ctx *ctx, struct lib9p_msg
unmarshal_fid(ctx, &out->fid);
}
-static FLATTEN void unmarshal_Rstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstat *out) {
+FLATTEN static void unmarshal_Rstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rstat *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1098,7 +1098,7 @@ static FLATTEN void unmarshal_Rstat(struct _unmarshal_ctx *ctx, struct lib9p_msg
unmarshal_stat(ctx, &out->stat);
}
-static FLATTEN void unmarshal_Twstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twstat *out) {
+FLATTEN static void unmarshal_Twstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Twstat *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1108,7 +1108,7 @@ static FLATTEN void unmarshal_Twstat(struct _unmarshal_ctx *ctx, struct lib9p_ms
unmarshal_stat(ctx, &out->stat);
}
-static FLATTEN void unmarshal_Rwstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwstat *out) {
+FLATTEN static void unmarshal_Rwstat(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rwstat *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1117,7 +1117,7 @@ static FLATTEN void unmarshal_Rwstat(struct _unmarshal_ctx *ctx, struct lib9p_ms
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_e
-static FLATTEN void unmarshal_Tsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsession *out) {
+FLATTEN static void unmarshal_Tsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsession *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1125,14 +1125,14 @@ static FLATTEN void unmarshal_Tsession(struct _unmarshal_ctx *ctx, struct lib9p_
unmarshal_8(ctx, &out->key);
}
-static FLATTEN void unmarshal_Rsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsession *out) {
+FLATTEN static void unmarshal_Rsession(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsession *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
unmarshal_tag(ctx, &out->tag);
}
-static FLATTEN void unmarshal_Tsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsread *out) {
+FLATTEN static void unmarshal_Tsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tsread *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1145,7 +1145,7 @@ static FLATTEN void unmarshal_Tsread(struct _unmarshal_ctx *ctx, struct lib9p_ms
unmarshal_s(ctx, &out->wname[i]);
}
-static FLATTEN void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsread *out) {
+FLATTEN static void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rsread *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1153,7 +1153,7 @@ static FLATTEN void unmarshal_Rsread(struct _unmarshal_ctx *ctx, struct lib9p_ms
unmarshal_d(ctx, &out->data);
}
-static FLATTEN void unmarshal_Tswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tswrite *out) {
+FLATTEN static void unmarshal_Tswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Tswrite *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1167,7 +1167,7 @@ static FLATTEN void unmarshal_Tswrite(struct _unmarshal_ctx *ctx, struct lib9p_m
unmarshal_d(ctx, &out->data);
}
-static FLATTEN void unmarshal_Rswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rswrite *out) {
+FLATTEN static void unmarshal_Rswrite(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rswrite *out) {
memset(out, 0, sizeof(*out));
ctx->net_offset += 4;
ctx->net_offset += 1;
@@ -1178,7 +1178,7 @@ static FLATTEN void unmarshal_Rswrite(struct _unmarshal_ctx *ctx, struct lib9p_m
/* 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"),
@@ -1186,7 +1186,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;
@@ -1194,7 +1194,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]);
@@ -1202,7 +1202,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]);
@@ -1210,7 +1210,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]);
@@ -1219,15 +1219,15 @@ static ALWAYS_INLINE bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val) {
}
#if CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u
-static ALWAYS_INLINE bool marshal_tag(struct _marshal_ctx *ctx, lib9p_tag_t *val) {
+ALWAYS_INLINE static bool marshal_tag(struct _marshal_ctx *ctx, lib9p_tag_t *val) {
return marshal_2(ctx, (uint16_t *)val);
}
-static ALWAYS_INLINE bool marshal_fid(struct _marshal_ctx *ctx, lib9p_fid_t *val) {
+ALWAYS_INLINE static bool marshal_fid(struct _marshal_ctx *ctx, lib9p_fid_t *val) {
return marshal_4(ctx, (uint32_t *)val);
}
-static ALWAYS_INLINE bool marshal_d(struct _marshal_ctx *ctx, struct lib9p_d *val) {
+ALWAYS_INLINE static bool marshal_d(struct _marshal_ctx *ctx, struct lib9p_d *val) {
return false
|| marshal_4(ctx, &val->len)
|| ({ bool err = false;
@@ -1237,7 +1237,7 @@ static ALWAYS_INLINE bool marshal_d(struct _marshal_ctx *ctx, struct lib9p_d *va
;
}
-static ALWAYS_INLINE bool marshal_s(struct _marshal_ctx *ctx, struct lib9p_s *val) {
+ALWAYS_INLINE static bool marshal_s(struct _marshal_ctx *ctx, struct lib9p_s *val) {
return false
|| marshal_2(ctx, &val->len)
|| ({ bool err = false;
@@ -1247,17 +1247,17 @@ static ALWAYS_INLINE bool marshal_s(struct _marshal_ctx *ctx, struct lib9p_s *va
;
}
-static ALWAYS_INLINE bool marshal_dm(struct _marshal_ctx *ctx, lib9p_dm_t *val) {
+ALWAYS_INLINE static bool marshal_dm(struct _marshal_ctx *ctx, lib9p_dm_t *val) {
lib9p_dm_t masked_val = *val & dm_masks[ctx->ctx->version];
return marshal_4(ctx, (uint32_t *)&masked_val);
}
-static ALWAYS_INLINE bool marshal_qt(struct _marshal_ctx *ctx, lib9p_qt_t *val) {
+ALWAYS_INLINE static bool marshal_qt(struct _marshal_ctx *ctx, lib9p_qt_t *val) {
lib9p_qt_t masked_val = *val & qt_masks[ctx->ctx->version];
return marshal_1(ctx, (uint8_t *)&masked_val);
}
-static ALWAYS_INLINE bool marshal_qid(struct _marshal_ctx *ctx, struct lib9p_qid *val) {
+ALWAYS_INLINE static bool marshal_qid(struct _marshal_ctx *ctx, struct lib9p_qid *val) {
return false
|| marshal_qt(ctx, &val->type)
|| marshal_4(ctx, &val->vers)
@@ -1265,7 +1265,7 @@ static ALWAYS_INLINE bool marshal_qid(struct _marshal_ctx *ctx, struct lib9p_qid
;
}
-static ALWAYS_INLINE bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) {
+ALWAYS_INLINE static bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val) {
uint32_t _stat_size_offset;
uint32_t _kern_type_offset;
return false
@@ -1291,12 +1291,12 @@ static ALWAYS_INLINE bool marshal_stat(struct _marshal_ctx *ctx, struct lib9p_st
;
}
-static ALWAYS_INLINE bool marshal_o(struct _marshal_ctx *ctx, lib9p_o_t *val) {
+ALWAYS_INLINE static bool marshal_o(struct _marshal_ctx *ctx, lib9p_o_t *val) {
lib9p_o_t masked_val = *val & o_masks[ctx->ctx->version];
return marshal_1(ctx, (uint8_t *)&masked_val);
}
-static FLATTEN bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_Tversion *val) {
+FLATTEN static bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_Tversion *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1310,7 +1310,7 @@ static FLATTEN bool marshal_Tversion(struct _marshal_ctx *ctx, struct lib9p_msg_
;
}
-static FLATTEN bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_msg_Rversion *val) {
+FLATTEN static bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_msg_Rversion *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1324,7 +1324,7 @@ static FLATTEN bool marshal_Rversion(struct _marshal_ctx *ctx, struct lib9p_msg_
;
}
-static FLATTEN bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_Tauth *val) {
+FLATTEN static bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_Tauth *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1342,7 +1342,7 @@ static FLATTEN bool marshal_Tauth(struct _marshal_ctx *ctx, struct lib9p_msg_Tau
;
}
-static FLATTEN bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rauth *val) {
+FLATTEN static bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rauth *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1355,7 +1355,7 @@ static FLATTEN bool marshal_Rauth(struct _marshal_ctx *ctx, struct lib9p_msg_Rau
;
}
-static FLATTEN bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_Tattach *val) {
+FLATTEN static bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_Tattach *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1374,7 +1374,7 @@ static FLATTEN bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_T
;
}
-static FLATTEN bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_Rattach *val) {
+FLATTEN static bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_Rattach *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1387,7 +1387,7 @@ static FLATTEN bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_R
;
}
-static FLATTEN bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rerror *val) {
+FLATTEN static bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Rerror *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1403,7 +1403,7 @@ static FLATTEN bool marshal_Rerror(struct _marshal_ctx *ctx, struct lib9p_msg_Re
;
}
-static FLATTEN bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *val) {
+FLATTEN static bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tflush *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1416,7 +1416,7 @@ static FLATTEN bool marshal_Tflush(struct _marshal_ctx *ctx, struct lib9p_msg_Tf
;
}
-static FLATTEN bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg_Rflush *val) {
+FLATTEN static bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg_Rflush *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1428,7 +1428,7 @@ static FLATTEN bool marshal_Rflush(struct _marshal_ctx *ctx, struct lib9p_msg_Rf
;
}
-static FLATTEN bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twalk *val) {
+FLATTEN static bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twalk *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1447,7 +1447,7 @@ static FLATTEN bool marshal_Twalk(struct _marshal_ctx *ctx, struct lib9p_msg_Twa
;
}
-static FLATTEN bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwalk *val) {
+FLATTEN static bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwalk *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1464,7 +1464,7 @@ static FLATTEN bool marshal_Rwalk(struct _marshal_ctx *ctx, struct lib9p_msg_Rwa
;
}
-static FLATTEN bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Topen *val) {
+FLATTEN static bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Topen *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1478,7 +1478,7 @@ static FLATTEN bool marshal_Topen(struct _marshal_ctx *ctx, struct lib9p_msg_Top
;
}
-static FLATTEN bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Ropen *val) {
+FLATTEN static bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Ropen *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1492,7 +1492,7 @@ static FLATTEN bool marshal_Ropen(struct _marshal_ctx *ctx, struct lib9p_msg_Rop
;
}
-static FLATTEN bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tcreate *val) {
+FLATTEN static bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Tcreate *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1508,7 +1508,7 @@ static FLATTEN bool marshal_Tcreate(struct _marshal_ctx *ctx, struct lib9p_msg_T
;
}
-static FLATTEN bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rcreate *val) {
+FLATTEN static bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_Rcreate *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1522,7 +1522,7 @@ static FLATTEN bool marshal_Rcreate(struct _marshal_ctx *ctx, struct lib9p_msg_R
;
}
-static FLATTEN bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_Tread *val) {
+FLATTEN static bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_Tread *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1537,7 +1537,7 @@ static FLATTEN bool marshal_Tread(struct _marshal_ctx *ctx, struct lib9p_msg_Tre
;
}
-static FLATTEN bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rread *val) {
+FLATTEN static bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rread *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1550,7 +1550,7 @@ static FLATTEN bool marshal_Rread(struct _marshal_ctx *ctx, struct lib9p_msg_Rre
;
}
-static FLATTEN bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Twrite *val) {
+FLATTEN static bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Twrite *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1565,7 +1565,7 @@ static FLATTEN bool marshal_Twrite(struct _marshal_ctx *ctx, struct lib9p_msg_Tw
;
}
-static FLATTEN bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rwrite *val) {
+FLATTEN static bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rwrite *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1578,7 +1578,7 @@ static FLATTEN bool marshal_Rwrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rw
;
}
-static FLATTEN bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tclunk *val) {
+FLATTEN static bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tclunk *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1591,7 +1591,7 @@ static FLATTEN bool marshal_Tclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Tc
;
}
-static FLATTEN bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Rclunk *val) {
+FLATTEN static bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Rclunk *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1603,7 +1603,7 @@ static FLATTEN bool marshal_Rclunk(struct _marshal_ctx *ctx, struct lib9p_msg_Rc
;
}
-static FLATTEN bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_msg_Tremove *val) {
+FLATTEN static bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_msg_Tremove *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1616,7 +1616,7 @@ static FLATTEN bool marshal_Tremove(struct _marshal_ctx *ctx, struct lib9p_msg_T
;
}
-static FLATTEN bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_msg_Rremove *val) {
+FLATTEN static bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_msg_Rremove *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1628,7 +1628,7 @@ static FLATTEN bool marshal_Rremove(struct _marshal_ctx *ctx, struct lib9p_msg_R
;
}
-static FLATTEN bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tstat *val) {
+FLATTEN static bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tstat *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1641,7 +1641,7 @@ static FLATTEN bool marshal_Tstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tst
;
}
-static FLATTEN bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val) {
+FLATTEN static bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rstat *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
uint32_t _nstat_offset;
@@ -1658,7 +1658,7 @@ static FLATTEN bool marshal_Rstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rst
;
}
-static FLATTEN bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Twstat *val) {
+FLATTEN static bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Twstat *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
uint32_t _nstat_offset;
@@ -1676,7 +1676,7 @@ static FLATTEN bool marshal_Twstat(struct _marshal_ctx *ctx, struct lib9p_msg_Tw
;
}
-static FLATTEN bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rwstat *val) {
+FLATTEN static bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rwstat *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1690,7 +1690,7 @@ static FLATTEN bool marshal_Rwstat(struct _marshal_ctx *ctx, struct lib9p_msg_Rw
#endif /* CONFIG_9P_ENABLE_9P2000 || CONFIG_9P_ENABLE_9P2000_e || CONFIG_9P_ENABLE_9P2000_u */
#if CONFIG_9P_ENABLE_9P2000_e
-static FLATTEN bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_msg_Tsession *val) {
+FLATTEN static bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_msg_Tsession *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1703,7 +1703,7 @@ static FLATTEN bool marshal_Tsession(struct _marshal_ctx *ctx, struct lib9p_msg_
;
}
-static FLATTEN bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_msg_Rsession *val) {
+FLATTEN static bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_msg_Rsession *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1715,7 +1715,7 @@ static FLATTEN bool marshal_Rsession(struct _marshal_ctx *ctx, struct lib9p_msg_
;
}
-static FLATTEN bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg_Tsread *val) {
+FLATTEN static bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg_Tsread *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1733,7 +1733,7 @@ static FLATTEN bool marshal_Tsread(struct _marshal_ctx *ctx, struct lib9p_msg_Ts
;
}
-static FLATTEN bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *val) {
+FLATTEN static bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rsread *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1746,7 +1746,7 @@ static FLATTEN bool marshal_Rsread(struct _marshal_ctx *ctx, struct lib9p_msg_Rs
;
}
-static FLATTEN bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Tswrite *val) {
+FLATTEN static bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Tswrite *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
@@ -1765,7 +1765,7 @@ static FLATTEN bool marshal_Tswrite(struct _marshal_ctx *ctx, struct lib9p_msg_T
;
}
-static FLATTEN bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rswrite *val) {
+FLATTEN static bool marshal_Rswrite(struct _marshal_ctx *ctx, struct lib9p_msg_Rswrite *val) {
uint32_t _size_offset;
uint32_t _typ_offset;
return false
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"
diff --git a/lib9p/include/lib9p/srv.h b/lib9p/include/lib9p/srv.h
index ab7ec43..eb0e4f4 100644
--- a/lib9p/include/lib9p/srv.h
+++ b/lib9p/include/lib9p/srv.h
@@ -114,7 +114,7 @@ struct lib9p_srv {
* @errno LINUX_ERANGE R-message does not fit into max_msg_size
*/
-__attribute__ ((noreturn)) void lib9p_srv_read_cr(struct lib9p_srv *srv, implements_net_stream_listener *listener);
+[[noreturn]] void lib9p_srv_read_cr(struct lib9p_srv *srv, implements_net_stream_listener *listener);
COROUTINE lib9p_srv_write_cr(void *_srv);
#endif /* _LIB9P_SRV_H_ */
diff --git a/lib9p/internal.h b/lib9p/internal.h
index 004660a..57f7aa7 100644
--- a/lib9p/internal.h
+++ b/lib9p/internal.h
@@ -38,9 +38,9 @@ static_assert(CONFIG_9P_MAX_HOSTMSG_SIZE <= SSIZE_MAX);
/* C language *****************************************************************/
-#define UNUSED(name) /* name __attribute__((unused)) */
-#define ALWAYS_INLINE inline __attribute__((always_inline))
-#define FLATTEN __attribute__((flatten))
+#define UNUSED(name)
+#define ALWAYS_INLINE [[gnu::always_inline]] inline
+#define FLATTEN [[gnu::flatten]]
#define ARRAY_LEN(arr) (sizeof(arr)/sizeof((arr)[0]))
#define CAT2(a, b) a##b
#define CAT3(a, b, c) a##b##c
@@ -99,22 +99,22 @@ bool _lib9p_marshal_stat(struct _marshal_ctx *ctx, struct lib9p_stat *val);
/* unmarshal utilities ********************************************************/
-static ALWAYS_INLINE uint8_t decode_u8le(uint8_t *in) {
+ALWAYS_INLINE static uint8_t decode_u8le(uint8_t *in) {
return in[0];
}
-static ALWAYS_INLINE uint16_t decode_u16le(uint8_t *in) {
+ALWAYS_INLINE static uint16_t decode_u16le(uint8_t *in) {
return (((uint16_t)(in[0])) << 0)
| (((uint16_t)(in[1])) << 8)
;
}
-static ALWAYS_INLINE uint32_t decode_u32le(uint8_t *in) {
+ALWAYS_INLINE static uint32_t decode_u32le(uint8_t *in) {
return (((uint32_t)(in[0])) << 0)
| (((uint32_t)(in[1])) << 8)
| (((uint32_t)(in[2])) << 16)
| (((uint32_t)(in[3])) << 24)
;
}
-static ALWAYS_INLINE uint64_t decode_u64le(uint8_t *in) {
+ALWAYS_INLINE static uint64_t decode_u64le(uint8_t *in) {
return (((uint64_t)(in[0])) << 0)
| (((uint64_t)(in[1])) << 8)
| (((uint64_t)(in[2])) << 16)
@@ -152,20 +152,20 @@ static inline bool _is_valid_utf8(uint8_t *str, size_t len, bool forbid_nul) {
/* marshal utilities **********************************************************/
-static ALWAYS_INLINE void encode_u8le(uint8_t in, uint8_t *out) {
+ALWAYS_INLINE static void encode_u8le(uint8_t in, uint8_t *out) {
out[0] = in;
}
-static ALWAYS_INLINE void encode_u16le(uint16_t in, uint8_t *out) {
+ALWAYS_INLINE static void encode_u16le(uint16_t in, uint8_t *out) {
out[0] = (uint8_t)((in >> 0) & 0xFF);
out[1] = (uint8_t)((in >> 8) & 0xFF);
}
-static ALWAYS_INLINE void encode_u32le(uint32_t in, uint8_t *out) {
+ALWAYS_INLINE static void encode_u32le(uint32_t in, uint8_t *out) {
out[0] = (uint8_t)((in >> 0) & 0xFF);
out[1] = (uint8_t)((in >> 8) & 0xFF);
out[2] = (uint8_t)((in >> 16) & 0xFF);
out[3] = (uint8_t)((in >> 24) & 0xFF);
}
-static ALWAYS_INLINE void encode_u64le(uint64_t in, uint8_t *out) {
+ALWAYS_INLINE static void encode_u64le(uint64_t in, uint8_t *out) {
out[0] = (uint8_t)((in >> 0) & 0xFF);
out[1] = (uint8_t)((in >> 8) & 0xFF);
out[2] = (uint8_t)((in >> 16) & 0xFF);
diff --git a/lib9p/srv.c b/lib9p/srv.c
index a7c4293..2fb2120 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -196,7 +196,7 @@ static bool read_at_least(implements_net_stream_conn *fd, uint8_t *buf, size_t g
static void handle_message(struct _lib9p_srv_req *ctx);
-__attribute__ ((noreturn)) void lib9p_srv_read_cr(struct lib9p_srv *srv, implements_net_stream_listener *listener) {
+[[noreturn]] void lib9p_srv_read_cr(struct lib9p_srv *srv, implements_net_stream_listener *listener) {
uint8_t buf[CONFIG_9P_MAX_MSG_SIZE];
assert(srv);
@@ -484,7 +484,7 @@ static void handle_Tversion(struct _lib9p_srv_req *ctx,
* to finish. */
struct cr_select_arg *list = alloca(sizeof(struct cr_select_arg) * ctx->parent_sess->reqs.len);
while (ctx->parent_sess->reqs.len) {
- uint16_t tag __attribute__((unused));
+ uint16_t tag [[gnu::unused]];
struct _lib9p_srv_req **reqpp;
size_t i = 0;
bool flushed;
@@ -497,7 +497,7 @@ static void handle_Tversion(struct _lib9p_srv_req *ctx,
if (ctx->parent_sess->fids.len) {
/* Close all FIDs. */
uint32_t fid;
- struct _srv_fidinfo *fidinfo __attribute__((unused));
+ struct _srv_fidinfo *fidinfo [[gnu::unused]];
MAP_FOREACH(&ctx->parent_sess->fids, fid, fidinfo) {
handle_Tclunk(ctx,
&(struct lib9p_msg_Tclunk){.fid = fid},