diff options
Diffstat (limited to 'lib9p/tests')
-rw-r--r-- | lib9p/tests/test_server/config/config.h | 4 | ||||
-rw-r--r-- | lib9p/tests/test_server/main.c | 51 |
2 files changed, 25 insertions, 30 deletions
diff --git a/lib9p/tests/test_server/config/config.h b/lib9p/tests/test_server/config/config.h index d852470..201cfd0 100644 --- a/lib9p/tests/test_server/config/config.h +++ b/lib9p/tests/test_server/config/config.h @@ -11,7 +11,7 @@ /* 9P *************************************************************************/ -#define CONFIG_9P_PORT 564 +#define CONFIG_9P_PORT LIB9P_DEFAULT_PORT_9FS /** * This max-msg-size is sized so that a Twrite message can return * 8KiB of data. @@ -48,7 +48,7 @@ /* COROUTINE ******************************************************************/ -#define CONFIG_COROUTINE_DEFAULT_STACK_SIZE (32*1024) +#define CONFIG_COROUTINE_STACK_SIZE_DEFAULT (32*1024) #define CONFIG_COROUTINE_NAME_LEN 16 #define CONFIG_COROUTINE_MEASURE_STACK 1 /* bool */ #define CONFIG_COROUTINE_PROTECT_STACK 1 /* bool */ diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c index 10f67a3..2c64cd4 100644 --- a/lib9p/tests/test_server/main.c +++ b/lib9p/tests/test_server/main.c @@ -127,45 +127,40 @@ static uint32_t api_pread(struct api_file *, struct lib9p_srv_ctx *, void *, uin enum { PATH_BASE = __COUNTER__ }; #define PATH_COUNTER __COUNTER__ - PATH_BASE -#define STATIC_FILE(STRNAME, SYMNAME) \ +#define STATIC_COMMON(STRNAME, MODE) \ + { \ + .u_name = "root", .u_num = 0, /* owner user */ \ + .g_name = "root", .g_num = 0, /* owner group */ \ + .m_name = "root", .m_num = 0, /* last-modified-by user */ \ + \ + .pathnum = PATH_COUNTER, \ + .name = STRNAME, \ + .perm = MODE, \ + .atime = 1728337905, \ + .mtime = 1728337904, \ + } + +#define STATIC_FILE(STRNAME, SYMNAME) \ lo_box_util9p_static_file_as_lib9p_srv_file(&((struct util9p_static_file){ \ - ._util9p_static_common = { \ - .u_name = "root", .u_num = 0, /* owner user */ \ - .g_name = "root", .g_num = 0, /* owner group */ \ - .m_name = "root", .m_num = 0, /* last-modified-by user */ \ - \ - .pathnum = PATH_COUNTER, \ - .name = STRNAME, \ - .perm = 0444, \ - .atime = 1728337905, \ - .mtime = 1728337904, \ - }, \ - .data_start = _binary_static_##SYMNAME##_start, \ - .data_end = _binary_static_##SYMNAME##_end, \ + ._util9p_static_common = STATIC_COMMON(STRNAME, 0444), \ + .data_start = _binary_static_##SYMNAME##_start, \ + .data_end = _binary_static_##SYMNAME##_end, \ })) #define STATIC_DIR(STRNAME, ...) \ lo_box_util9p_static_dir_as_lib9p_srv_file(&((struct util9p_static_dir){ \ - ._util9p_static_common = { \ - .u_name = "root", .u_num = 0, /* owner user */ \ - .g_name = "root", .g_num = 0, /* owner group */ \ - .m_name = "root", .m_num = 0, /* last-modified-by user */ \ - \ - .pathnum = PATH_COUNTER, \ - .name = STRNAME, \ - .perm = 0555, \ - .atime = 1728337905, \ - .mtime = 1728337904, \ - }, \ - .members = { __VA_ARGS__ __VA_OPT__(,) LO_NULL(lib9p_srv_file) }, \ + ._util9p_static_common = STATIC_COMMON(STRNAME, 0555), \ + .members = { __VA_ARGS__ LO_NULL(lib9p_srv_file) }, \ })) struct lib9p_srv_file root = STATIC_DIR("", STATIC_DIR("Documentation", - STATIC_FILE("x", Documentation_x)), + STATIC_FILE("x", Documentation_x), + ), STATIC_FILE("README.md", README_md), - lo_box_api_as_lib9p_srv_file(&(struct api_file){.pathnum = PATH_COUNTER})); + lo_box_api_as_lib9p_srv_file(&(struct api_file){.pathnum = PATH_COUNTER}), + ); static lo_interface lib9p_srv_file get_root(struct lib9p_srv_ctx *LM_UNUSED(ctx), struct lib9p_s LM_UNUSED(treename)) { return root; |