summaryrefslogtreecommitdiff
path: root/cmd/sbc_harness
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-21 14:26:38 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-02-23 10:44:58 -0700
commitc990e16bb4754e17a4858274ebd59f1e0859b16f (patch)
treee64814bf4c5e2630c92ca0a7a9bb78930203f0c5 /cmd/sbc_harness
parenta1883e93c1094ed34c21e018d34993e2a9e80506 (diff)
lib9p_util: Pull utility macros into static.h
Diffstat (limited to 'cmd/sbc_harness')
-rw-r--r--cmd/sbc_harness/main.c35
1 files changed, 2 insertions, 33 deletions
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("",