diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-02 13:55:08 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-02 13:55:08 -0600 |
commit | b7a140a42f272aadb5400f013cd21a7a218d26e8 (patch) | |
tree | 6770864edd0330704b43d4b2c8f9d8240f691678 /lib9p/types.c | |
parent | fa7f6a5176a386f8847810f34538d5c0e56f0fb1 (diff) |
wip validate, bitfield
Diffstat (limited to 'lib9p/types.c')
-rw-r--r-- | lib9p/types.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib9p/types.c b/lib9p/types.c index 8582161..cb410ea 100644 --- a/lib9p/types.c +++ b/lib9p/types.c @@ -343,6 +343,10 @@ static ALWAYS_INLINE bool validate_s(struct _validate_ctx *ctx) { return false; } +static ALWAYS_INLINE bool validate_qt(struct _validate_ctx *ctx) { + return validate_1(ctx); +} + static ALWAYS_INLINE bool validate_qid(struct _validate_ctx *ctx) { return validate_qt(ctx) || validate_4(ctx) @@ -569,6 +573,10 @@ static ALWAYS_INLINE void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9p_s unmarshal_1(ctx, &out->utf8[i]); } +static ALWAYS_INLINE 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) { memset(out, 0, sizeof(*out)); unmarshal_qt(ctx, &out->type); @@ -859,6 +867,10 @@ static ALWAYS_INLINE bool marshal_s(struct _marshal_ctx *ctx, struct lib9p_s *va }); } +static ALWAYS_INLINE bool marshal_qt(struct _marshal_ctx *ctx, lib9p_qt_t *val) { + return marshal_1(ctx, (uint8_t *)val); +} + static ALWAYS_INLINE bool marshal_qid(struct _marshal_ctx *ctx, struct lib9p_qid *val) { return marshal_qt(ctx, &val->type) || marshal_4(ctx, &val->vers) |