diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-11-12 13:19:09 -0700 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-11-12 13:23:33 -0700 |
commit | 5be7b1ebd1ab2bce1d53552b627fe55f425bdb38 (patch) | |
tree | 890cda05f97bac976c2120ade2df79408bd40c82 /cmd/srv9p | |
parent | aec7a1209a7c2314acc5703a94509a403c796444 (diff) |
Fuss with compile-time config
Diffstat (limited to 'cmd/srv9p')
-rw-r--r-- | cmd/srv9p/config/config.h | 15 | ||||
-rw-r--r-- | cmd/srv9p/main.c | 8 |
2 files changed, 14 insertions, 9 deletions
diff --git a/cmd/srv9p/config/config.h b/cmd/srv9p/config/config.h index a184e6f..80c8125 100644 --- a/cmd/srv9p/config/config.h +++ b/cmd/srv9p/config/config.h @@ -7,7 +7,9 @@ #ifndef _CONFIG_H_ #define _CONFIG_H_ -#define CONFIG_NETIO_NUM_CONNS 8 +#define CONFIG_SRV9P_NUM_CONNS 8 + +/* 9P *************************************************************************/ #define CONFIG_9P_PORT 564 /** @@ -37,8 +39,11 @@ #define CONFIG_9P_MAX_FIDS 16 #define CONFIG_9P_MAX_REQS 2 #define CONFIG_9P_MAX_ERR_SIZE 128 /* 128 is what Plan 9 4e uses */ -#define CONFIG_9P_ENABLE_9P2000_u -/*#define CONFIG_9P_ENABLE_9P2000_e*/ +#define CONFIG_9P_ENABLE_9P2000 1 /* bool */ +#define CONFIG_9P_ENABLE_9P2000_u 1 /* bool */ +#define CONFIG_9P_ENABLE_9P2000_e 0 /* bool */ + +/* COROUTINE ******************************************************************/ #define CONFIG_COROUTINE_DEFAULT_STACK_SIZE (32*1024) #define CONFIG_COROUTINE_MEASURE_STACK 1 /* bool */ @@ -47,7 +52,7 @@ #define CONFIG_COROUTINE_VALGRIND 1 /* bool */ #define CONFIG_COROUTINE_NUM (1 /* usb_common */ +\ 1 /* usb_keyboard */ +\ - CONFIG_NETIO_NUM_CONNS /* accept+read */ +\ - (CONFIG_9P_MAX_REQS*CONFIG_NETIO_NUM_CONNS) /* work+write */ ) + CONFIG_SRV9P_NUM_CONNS /* accept+read */ +\ + (CONFIG_9P_MAX_REQS*CONFIG_SRV9P_NUM_CONNS) /* work+write */ ) #endif /* _CONFIG_H_ */ diff --git a/cmd/srv9p/main.c b/cmd/srv9p/main.c index d30c4f9..c5a3367 100644 --- a/cmd/srv9p/main.c +++ b/cmd/srv9p/main.c @@ -19,8 +19,8 @@ #include "config.h" -#ifndef CONFIG_NETIO_NUM_CONNS - #error config.h must define CONFIG_NETIO_NUM_CONNS +#ifndef CONFIG_SRV9P_NUM_CONNS + #error config.h must define CONFIG_SRV9P_NUM_CONNS #endif /* implementation *************************************************************/ @@ -104,10 +104,10 @@ int main() { .rootdir = get_root, }; - for (int i = 0; i < CONFIG_NETIO_NUM_CONNS; i++) + for (int i = 0; i < CONFIG_SRV9P_NUM_CONNS; i++) if (!coroutine_add(read_cr, &srv)) error(1, 0, "coroutine_add(read_cr, &srv)"); - for (int i = 0; i < 2*CONFIG_NETIO_NUM_CONNS; i++) + for (int i = 0; i < 2*CONFIG_SRV9P_NUM_CONNS; i++) if (!coroutine_add(lib9p_srv_write_cr, &srv)) error(1, 0, "coroutine_add(lib9p_srv_write_cr, &srv)"); |