From fa7f6a5176a386f8847810f34538d5c0e56f0fb1 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Wed, 2 Oct 2024 13:12:16 -0600 Subject: lib9p: Rename checksize to validate --- lib9p/internal.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib9p/internal.h') diff --git a/lib9p/internal.h b/lib9p/internal.h index d1da014..d1c36cf 100644 --- a/lib9p/internal.h +++ b/lib9p/internal.h @@ -17,7 +17,8 @@ #define USE_CONFIG_COROUTINE #include "config.h" static_assert(CONFIG_9P_MAX_ERR_SIZE <= UINT16_MAX); -static_assert(CONFIG_9P_MAX_MSG_SIZE <= SSIZE_MAX); +static_assert(CONFIG_9P_MAX_MSG_SIZE <= CONFIG_9P_MAX_HOSTMSG_SIZE); +static_assert(CONFIG_9P_MAX_HOSTMSG_SIZE <= SSIZE_MAX); static_assert(CONFIG_9P_MAX_ERR_SIZE + CONFIG_9P_MAX_MSG_SIZE + 2*CONFIG_9P_MAX_HOSTMSG_SIZE < CONFIG_COROUTINE_DEFAULT_STACK_SIZE); /* C language *****************************************************************/ @@ -43,7 +44,7 @@ struct lib9p_ctx { /* vtables ********************************************************************/ -struct _checksize_ctx { +struct _validate_ctx { struct lib9p_ctx *ctx; uint32_t net_size; uint8_t *net_bytes; @@ -53,7 +54,7 @@ struct _checksize_ctx { * "extra" beyond sizeof(). */ size_t host_extra; }; -typedef bool (*_checksize_fn_t)(struct _checksize_ctx *ctx); +typedef bool (*_validate_fn_t)(struct _validate_ctx *ctx); struct _unmarshal_ctx { struct lib9p_ctx *ctx; @@ -74,8 +75,8 @@ struct _marshal_ctx { typedef bool (*_marshal_fn_t)(struct _marshal_ctx *ctx, void *host_val); struct _vtable_msg { - size_t unmarshal_basesize; - _checksize_fn_t unmarshal_extrasize; + size_t basesize; + _validate_fn_t validate; _unmarshal_fn_t unmarshal; _marshal_fn_t marshal; }; -- cgit v1.2.3-2-g168b