summaryrefslogtreecommitdiff
path: root/lib9p
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-07 17:24:18 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-10-07 17:24:36 -0600
commit62e8081e0ac4a4c170bc536303f7a9bd3e91fd7b (patch)
tree2c40e8297ff0d423bf5e811fa7212345af6141de /lib9p
parentb1b07aea8841d78e935e7de13d693a267709e711 (diff)
tidy config
Diffstat (limited to 'lib9p')
-rw-r--r--lib9p/include/lib9p/9p.h9
-rw-r--r--lib9p/internal.h22
2 files changed, 27 insertions, 4 deletions
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 <lib9p/9p.generated.h>
#include <lib9p/linux-errno.h>
-#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 <lib9p/9p.h>
-#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 *****************************************************************/