summaryrefslogtreecommitdiff
path: root/lib9p/types.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-02 14:51:13 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-02 14:51:13 -0600
commit79480e66113b7654d1ed89b940222b6eee84c8b0 (patch)
tree65e9b76969aebd88fb45e974e9569d27630ab027 /lib9p/types.c
parent79e6cb0f6f7627284a7614b70a25e976b426d82e (diff)
bitfield versions
Diffstat (limited to 'lib9p/types.c')
-rw-r--r--lib9p/types.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib9p/types.c b/lib9p/types.c
index 3505a4a..18dcbfe 100644
--- a/lib9p/types.c
+++ b/lib9p/types.c
@@ -346,11 +346,16 @@ static ALWAYS_INLINE bool validate_s(struct _validate_ctx *ctx) {
static ALWAYS_INLINE bool validate_qt(struct _validate_ctx *ctx) {
if (validate_1(ctx))
return true;
- const lib9p_qt_t mask = 0b11111110;
+ static const lib9p_qt_t masks[LIB9P_VER_NUM] = {
+ [LIB9P_VER_9P2000] = 0b11111100,
+ [LIB9P_VER_9P2000_e] = 0b11111100,
+ [LIB9P_VER_9P2000_u] = 0b11111110,
+ };
+ lib9p_qt_t mask = masks[ctx->ctx->version];
lib9p_qt_t val = decode_u8le(&ctx->net_bytes[ctx->net_offset-1]);
if (val & ~mask)
- return lib9p_error(ctx->ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#01"PRIx8,
- val & ~mask);
+ return lib9p_errorf(ctx->ctx, LINUX_EBADMSG, "unknown bits in qt bitfield: %#01"PRIx8,
+ val & ~mask);
return false;
}