From c990e16bb4754e17a4858274ebd59f1e0859b16f Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 21 Feb 2025 14:26:38 -0700 Subject: lib9p_util: Pull utility macros into static.h --- cmd/sbc_harness/main.c | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) (limited to 'cmd/sbc_harness') diff --git a/cmd/sbc_harness/main.c b/cmd/sbc_harness/main.c index 2e83476..1c14762 100644 --- a/cmd/sbc_harness/main.c +++ b/cmd/sbc_harness/main.c @@ -39,42 +39,11 @@ /* file tree ******************************************************************/ -#define _box(nam, obj) \ - ((struct lib9p_srv_file){ \ - .self = obj, \ - .vtable = (void*)&_lo_##nam##_lib9p_srv_file_vtable, \ - }) -#define lo_box_util9p_static_file_as_lib9p_srv_file(obj) _box(util9p_static_file, obj) -#define lo_box_util9p_static_dir_as_lib9p_srv_file(obj) _box(util9p_static_dir, obj) -#define lo_box_api_as_lib9p_srv_file(obj) _box(api, obj) - enum { PATH_BASE = __COUNTER__ }; #define PATH_COUNTER __COUNTER__ - PATH_BASE -#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, ...) \ - lo_box_util9p_static_file_as_lib9p_srv_file(&((struct util9p_static_file){ \ - ._util9p_static_common = STATIC_COMMON(STRNAME, 0444), \ - __VA_ARGS__ \ - })) - -#define STATIC_DIR(STRNAME, ...) \ - lo_box_util9p_static_dir_as_lib9p_srv_file(&((struct util9p_static_dir){ \ - ._util9p_static_common = STATIC_COMMON(STRNAME, 0555), \ - .members = { __VA_ARGS__ LO_NULL(lib9p_srv_file) }, \ - })) +#define STATIC_FILE(STRNAME, ...) UTIL9P_STATIC_FILE(PATH_COUNTER, STRNAME, __VA_ARGS__) +#define STATIC_DIR(STRNAME, ...) UTIL9P_STATIC_DIR(PATH_COUNTER, STRNAME, __VA_ARGS__) struct lib9p_srv_file root = STATIC_DIR("", -- cgit v1.2.3-2-g168b