From 62e8081e0ac4a4c170bc536303f7a9bd3e91fd7b Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Mon, 7 Oct 2024 17:24:18 -0600 Subject: tidy config --- lib9p/include/lib9p/9p.h | 9 ++++++++- lib9p/internal.h | 22 +++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'lib9p') diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h index 66f7542..616a0e1 100644 --- a/lib9p/include/lib9p/9p.h +++ b/lib9p/include/lib9p/9p.h @@ -14,9 +14,16 @@ #include #include -#define _USE_CONFIG_9P_ERR +/* configuration **************************************************************/ + #include "config.h" +#ifndef CONFIG_9P_MAX_ERR_SIZE +# error config.h must define CONFIG_9P_MAX_ERR_SIZE +#endif + +/******************************************************************************/ + #define LIB9P_NOTAG ((uint16_t)~0U) #define LIB9P_NOFID ((uint32_t)~0U) diff --git a/lib9p/internal.h b/lib9p/internal.h index 36a2647..2b5f8f3 100644 --- a/lib9p/internal.h +++ b/lib9p/internal.h @@ -12,13 +12,29 @@ #include -#define USE_CONFIG_9P -#define USE_CONFIG_COROUTINE +/* configuration **************************************************************/ + #include "config.h" + +#ifndef CONFIG_9P_MAX_MSG_SIZE +# error config.h must define CONFIG_9P_MAX_MSG_SIZE +#endif +#ifndef CONFIG_9P_MAX_HOSTMSG_SIZE +# error config.h must define CONFIG_9P_MAX_HOSTMSG_SIZE +#endif +#ifndef CONFIG_9P_MAX_FIDS +# error config.h must define CONFIG_9P_MAX_FIDS +#endif +#ifndef CONFIG_9P_MAX_REQS +# error config.h must define CONFIG_9P_MAX_REQS +#endif +#ifndef CONFIG_9P_MAX_ERR_SIZE +# error config.h must define CONFIG_9P_MAX_ERR_SIZE +#endif + static_assert(CONFIG_9P_MAX_ERR_SIZE <= UINT16_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 *****************************************************************/ -- cgit v1.2.3-2-g168b