diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/sbc_harness/CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmd/sbc_harness/config/config.h | 19 | ||||
-rw-r--r-- | cmd/sbc_harness/fs_harness_flash_bin.c | 10 | ||||
-rw-r--r-- | cmd/sbc_harness/fs_harness_uptime_txt.c | 8 | ||||
-rw-r--r-- | cmd/sbc_harness/main.c | 13 |
5 files changed, 29 insertions, 23 deletions
diff --git a/cmd/sbc_harness/CMakeLists.txt b/cmd/sbc_harness/CMakeLists.txt index 678af07..6e722d7 100644 --- a/cmd/sbc_harness/CMakeLists.txt +++ b/cmd/sbc_harness/CMakeLists.txt @@ -30,7 +30,7 @@ target_link_libraries(sbc_harness_objs libusb libdhcp libhw_cr - lib9p + lib9p_srv lib9p_util ) pico_minimize_runtime(sbc_harness_objs diff --git a/cmd/sbc_harness/config/config.h b/cmd/sbc_harness/config/config.h index 14c2f03..5367dbe 100644 --- a/cmd/sbc_harness/config/config.h +++ b/cmd/sbc_harness/config/config.h @@ -11,6 +11,9 @@ #define CONFIG_FLASH_DEBUG 1 +#define _CONFIG_9P_MAX_CONNS 3 /* FIXME: bump this back up to 8 */ +#define _CONFIG_9P_MAX_REQS (2*_CONFIG_9P_MAX_CONNS) + /* RP2040 *********************************************************************/ #define CONFIG_RP2040_SPI_DEBUG 1 /* bool */ @@ -60,9 +63,6 @@ * struct padding, (2) array pointers. */ #define CONFIG_9P_SRV_MAX_HOSTMSG_SIZE CONFIG_9P_SRV_MAX_MSG_SIZE+16 -#define CONFIG_9P_SRV_MAX_FIDS 16 -#define CONFIG_9P_SRV_MAX_REQS 2 -#define CONFIG_9P_SRV_MAX_DEPTH 3 #define CONFIG_9P_ENABLE_9P2000 1 /* bool */ #define CONFIG_9P_ENABLE_9P2000_u 1 /* bool */ @@ -104,12 +104,11 @@ extern const size_t CONFIG_COROUTINE_STACK_SIZE_w5500_irq_cr; #define CONFIG_COROUTINE_VALGRIND 0 /* bool */ #define CONFIG_COROUTINE_GDB 1 /* bool */ -#define _CONFIG_9P_NUM_SOCKS 3 /* FIXME: bump this back up to 8 */ -#define CONFIG_COROUTINE_NUM ( \ - 1 /* usb_common */ + \ - 1 /* usb_keyboard */ + \ - 1 /* W5500 irq handler */ + \ - _CONFIG_9P_NUM_SOCKS /* 9P accept()+read() */ + \ - (CONFIG_9P_SRV_MAX_REQS*_CONFIG_9P_NUM_SOCKS) /* 9P work+write() */ ) +#define CONFIG_COROUTINE_NUM ( \ + 1 /* usb_common */ + \ + 1 /* usb_keyboard */ + \ + 1 /* W5500 irq handler */ + \ + _CONFIG_9P_MAX_CONNS /* 9P accept()+read() */ + \ + _CONFIG_9P_MAX_REQS /* 9P work+write() */ ) #endif /* _CONFIG_H_ */ diff --git a/cmd/sbc_harness/fs_harness_flash_bin.c b/cmd/sbc_harness/fs_harness_flash_bin.c index bcdf296..bc3d061 100644 --- a/cmd/sbc_harness/fs_harness_flash_bin.c +++ b/cmd/sbc_harness/fs_harness_flash_bin.c @@ -175,13 +175,13 @@ static void flash_file_wstat(struct flash_file *self, struct lib9p_srv_ctx *ctx, assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LINUX_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); } static void flash_file_remove(struct flash_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LINUX_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); } LIB9P_SRV_NOTDIR(struct flash_file, flash_file); @@ -235,7 +235,7 @@ static void flash_file_pread(struct flash_file *self, struct lib9p_srv_ctx *ctx, if (byte_offset > DATA_SIZE) { lib9p_error(&ctx->basectx, - LINUX_EINVAL, "offset is past the chip size"); + LIB9P_ERRNO_L_EINVAL, "offset is past the chip size"); return; } @@ -281,14 +281,14 @@ static uint32_t flash_file_pwrite(struct flash_file *self, struct lib9p_srv_ctx if (byte_offset > DATA_HSIZE) { lib9p_error(&ctx->basectx, - LINUX_EINVAL, "offset is past half the chip size"); + LIB9P_ERRNO_L_EINVAL, "offset is past half the chip size"); return 0; } if (byte_count == 0) return 0; if (byte_offset == DATA_HSIZE) { lib9p_error(&ctx->basectx, - LINUX_EINVAL, "offset is at half the chip size"); + LIB9P_ERRNO_L_EINVAL, "offset is at half the chip size"); return 0; } diff --git a/cmd/sbc_harness/fs_harness_uptime_txt.c b/cmd/sbc_harness/fs_harness_uptime_txt.c index 9216986..1425bf9 100644 --- a/cmd/sbc_harness/fs_harness_uptime_txt.c +++ b/cmd/sbc_harness/fs_harness_uptime_txt.c @@ -75,13 +75,13 @@ static void uptime_file_wstat(struct uptime_file *self, struct lib9p_srv_ctx *ct assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LINUX_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); } static void uptime_file_remove(struct uptime_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LINUX_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); } LIB9P_SRV_NOTDIR(struct uptime_file, uptime_file); @@ -130,7 +130,7 @@ static void uptime_fio_pread(struct uptime_fio *self, struct lib9p_srv_ctx *ctx, if (byte_offset > (uint64_t)self->buf_len) { lib9p_error(&ctx->basectx, - LINUX_EINVAL, "offset is past end-of-file length"); + LIB9P_ERRNO_L_EINVAL, "offset is past end-of-file length"); return; } @@ -151,6 +151,6 @@ static uint32_t uptime_fio_pwrite(struct uptime_fio *self, struct lib9p_srv_ctx assert(self); assert(ctx); - lib9p_error(&ctx->basectx, LINUX_EROFS, "read-only part of filesystem"); + lib9p_error(&ctx->basectx, LIB9P_ERRNO_L_EROFS, "read-only part of filesystem"); return 0; } diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c index 20cf5b1..5630e83 100644 --- a/cmd/sbc_harness/main.c +++ b/cmd/sbc_harness/main.c @@ -39,6 +39,13 @@ #include "config.h" +#ifndef _CONFIG_9P_MAX_CONNS + #error config.h must define _CONFIG_9P_MAX_CONNS +#endif +#ifndef _CONFIG_9P_MAX_REQS + #error config.h must define _CONFIG_9P_MAX_REQS +#endif + /* file tree ******************************************************************/ enum { PATH_BASE = __COUNTER__ }; @@ -167,7 +174,7 @@ static COROUTINE write9p_cr(void *) { } const char *const hexdig = "0123456789ABCDEF"; -static_assert(CONFIG_9P_SRV_MAX_REQS*_CONFIG_9P_NUM_SOCKS <= 16); +static_assert(_CONFIG_9P_MAX_REQS <= 16); COROUTINE init_cr(void *) { cr_begin(); @@ -223,11 +230,11 @@ COROUTINE init_cr(void *) { coroutine_add("usb_keyboard", usb_keyboard_cr, &globals.keyboard_chan); //coroutine_add("hello_world", hello_world_cr, &globals.keyboard_chan); coroutine_add("dhcp", dhcp_cr, NULL); - for (int i = 0; i < _CONFIG_9P_NUM_SOCKS; i++) { + for (int i = 0; i < _CONFIG_9P_MAX_CONNS; i++) { char name[] = {'r', 'e', 'a', 'd', '-', hexdig[i], '\0'}; coroutine_add(name, read9p_cr, NULL); } - for (int i = 0; i < CONFIG_9P_SRV_MAX_REQS*_CONFIG_9P_NUM_SOCKS; i++) { + for (int i = 0; i < _CONFIG_9P_MAX_REQS; i++) { char name[] = {'w', 'r', 'i', 't', 'e', '-', hexdig[i], '\0'}; coroutine_add(name, write9p_cr, NULL); } |