summaryrefslogtreecommitdiff
path: root/lib9p/core.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-17 02:49:53 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-17 12:24:46 -0600
commit5c4004ff3bd66306e03579f6ee350b3517aa4ea9 (patch)
tree18ee437f386ee581e50fffb8398905bf295d8eaf /lib9p/core.c
parent0cf05b66f94bfe02ecca37a4cbafba25b27c32ae (diff)
lib9p: Check that we compile for the whole the matrix of "enable"-toggles
Diffstat (limited to 'lib9p/core.c')
-rw-r--r--lib9p/core.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/lib9p/core.c b/lib9p/core.c
index a07461d..cb8ddee 100644
--- a/lib9p/core.c
+++ b/lib9p/core.c
@@ -47,7 +47,7 @@ bool lib9p_str_eq(struct lib9p_s a, struct lib9p_s b) {
void lib9p_ctx_clear_error(struct lib9p_ctx *ctx) {
assert(ctx);
-#if CONFIG_9P_ENABLE_9P2000_u
+#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
ctx->err_num = 0;
#endif
ctx->err_msg[0] = '\0';
@@ -58,22 +58,31 @@ bool lib9p_ctx_has_error(struct lib9p_ctx *ctx) {
return ctx->err_msg[0];
}
-int lib9p_error(struct lib9p_ctx *ctx, lib9p_errno_t linux_errno, char const *msg) {
+#undef lib9p_error
+#undef lib9p_errorf
+
+int lib9p_error(struct lib9p_ctx *ctx,
+#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
+ lib9p_errno_t linux_errno,
+#endif
+ char const *msg) {
if (lib9p_ctx_has_error(ctx))
return -1;
strncpy(ctx->err_msg, msg, sizeof(ctx->err_msg));
ctx->err_msg[sizeof(ctx->err_msg)-1] = '\0';
-#if CONFIG_9P_ENABLE_9P2000_u
+#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
ctx->err_num = linux_errno;
-#else
- (void)(linux_errno);
#endif
return -1;
}
-int lib9p_errorf(struct lib9p_ctx *ctx, lib9p_errno_t linux_errno, char const *fmt, ...) {
+int lib9p_errorf(struct lib9p_ctx *ctx,
+#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
+ lib9p_errno_t linux_errno,
+#endif
+ char const *fmt, ...) {
int n;
va_list args;
@@ -85,10 +94,8 @@ int lib9p_errorf(struct lib9p_ctx *ctx, lib9p_errno_t linux_errno, char const *f
if ((size_t)(n+1) < sizeof(ctx->err_msg))
memset(&ctx->err_msg[n+1], 0, sizeof(ctx->err_msg)-(n+1));
-#if CONFIG_9P_ENABLE_9P2000_u
+#if CONFIG_9P_ENABLE_9P2000_u || CONFIG_9P_ENABLE_9P2000_L
ctx->err_num = linux_errno;
-#else
- (void)(linux_errno);
#endif
return -1;