summaryrefslogtreecommitdiff
path: root/lib9p
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p')
-rw-r--r--lib9p/core_include/lib9p/core.h26
-rw-r--r--lib9p/tests/test_server/fs_flush.c2
-rw-r--r--lib9p/tests/test_server/fs_flush.h1
-rw-r--r--lib9p/tests/test_server/fs_shutdown.c4
-rw-r--r--lib9p/tests/test_server/fs_shutdown.h1
-rw-r--r--lib9p/tests/test_server/fs_whoami.c2
-rw-r--r--lib9p/tests/test_server/fs_whoami.h1
-rw-r--r--lib9p/tests/test_server/main.c14
8 files changed, 24 insertions, 27 deletions
diff --git a/lib9p/core_include/lib9p/core.h b/lib9p/core_include/lib9p/core.h
index afefa2b..1fb71f1 100644
--- a/lib9p/core_include/lib9p/core.h
+++ b/lib9p/core_include/lib9p/core.h
@@ -66,19 +66,19 @@ bool lib9p_ctx_has_error(struct lib9p_ctx *ctx);
#endif
/** Write a <libmisc/fmt.h>-style error into ctx, return -1. */
-#define lib9p_error(ctx, linux_errno, ...) ({ \
- if (!lib9p_ctx_has_error(ctx)) { \
- _lib9p_set_err_num(ctx, linux_errno); \
- struct fmt_buf _w = { \
- .dat = (ctx)->err_msg, \
- .cap = sizeof((ctx)->err_msg), \
- }; \
- lo_interface fmt_dest w = lo_box_fmt_buf_as_fmt_dest(&_w); \
- fmt_print(w, __VA_ARGS__); \
- if (_w.len < _w.cap) \
- memset(_w.dat + _w.len, 0, _w.cap - _w.len); \
- } \
- -1; \
+#define lib9p_error(ctx, linux_errno, ...) ({ \
+ if (!lib9p_ctx_has_error(ctx)) { \
+ _lib9p_set_err_num(ctx, linux_errno); \
+ struct fmt_buf _w = { \
+ .dat = (ctx)->err_msg, \
+ .cap = sizeof((ctx)->err_msg), \
+ }; \
+ lo_interface fmt_dest w = LO_BOX(fmt_dest, &_w); \
+ fmt_print(w, __VA_ARGS__); \
+ if (_w.len < _w.cap) \
+ memset(_w.dat + _w.len, 0, _w.cap - _w.len); \
+ } \
+ -1; \
})
/* misc utilities *************************************************************/
diff --git a/lib9p/tests/test_server/fs_flush.c b/lib9p/tests/test_server/fs_flush.c
index e6408d7..fade0a1 100644
--- a/lib9p/tests/test_server/fs_flush.c
+++ b/lib9p/tests/test_server/fs_flush.c
@@ -67,7 +67,7 @@ static lo_interface lib9p_srv_fio flush_file_fopen(struct flush_file *self, stru
struct flush_fio *ret = heap_alloc(1, struct flush_fio);
ret->parent = self;
- return lo_box_flush_fio_as_lib9p_srv_fio(ret);
+ return LO_BOX(lib9p_srv_fio, ret);
}
/* srv_fio ********************************************************************/
diff --git a/lib9p/tests/test_server/fs_flush.h b/lib9p/tests/test_server/fs_flush.h
index 2b08850..023434b 100644
--- a/lib9p/tests/test_server/fs_flush.h
+++ b/lib9p/tests/test_server/fs_flush.h
@@ -22,6 +22,5 @@ struct flush_file {
} flush_behavior;
};
LO_IMPLEMENTATION_H(lib9p_srv_file, struct flush_file, flush_file);
-#define lo_box_flush_file_as_lib9p_srv_file(obj) util9p_box(flush_file, obj)
#endif /* _LIB9P_TESTS_TEST_SERVER_FS_FLUSH_H_ */
diff --git a/lib9p/tests/test_server/fs_shutdown.c b/lib9p/tests/test_server/fs_shutdown.c
index d4ae67e..0dd473d 100644
--- a/lib9p/tests/test_server/fs_shutdown.c
+++ b/lib9p/tests/test_server/fs_shutdown.c
@@ -66,7 +66,7 @@ static lo_interface lib9p_srv_fio shutdown_file_fopen(struct shutdown_file *self
struct shutdown_fio *ret = heap_alloc(1, struct shutdown_fio);
ret->parent = self;
- return lo_box_shutdown_fio_as_lib9p_srv_fio(ret);
+ return LO_BOX(lib9p_srv_fio, ret);
}
/* srv_fio ********************************************************************/
@@ -94,7 +94,7 @@ static uint32_t shutdown_fio_pwrite(struct shutdown_fio *self, struct lib9p_srv_
if (byte_count == 0)
return 0;
for (size_t i = 0; i < self->parent->nlisteners; i++)
- LO_CALL(lo_box_hostnet_tcplist_as_net_stream_listener(&self->parent->listeners[i]), close);
+ LO_CALL(LO_BOX(net_stream_listener, &self->parent->listeners[i]), close);
return byte_count;
}
static void shutdown_fio_pread(struct shutdown_fio *LM_UNUSED(self), struct lib9p_srv_ctx *LM_UNUSED(ctx),
diff --git a/lib9p/tests/test_server/fs_shutdown.h b/lib9p/tests/test_server/fs_shutdown.h
index 6b8683c..7b8d327 100644
--- a/lib9p/tests/test_server/fs_shutdown.h
+++ b/lib9p/tests/test_server/fs_shutdown.h
@@ -18,6 +18,5 @@ struct shutdown_file {
size_t nlisteners;
};
LO_IMPLEMENTATION_H(lib9p_srv_file, struct shutdown_file, shutdown_file);
-#define lo_box_shutdown_file_as_lib9p_srv_file(obj) util9p_box(shutdown_file, obj)
#endif /* _LIB9P_TESTS_TEST_SERVER_FS_SHUTDOWN_H_ */
diff --git a/lib9p/tests/test_server/fs_whoami.c b/lib9p/tests/test_server/fs_whoami.c
index 7e1d635..6cc46ac 100644
--- a/lib9p/tests/test_server/fs_whoami.c
+++ b/lib9p/tests/test_server/fs_whoami.c
@@ -92,7 +92,7 @@ static lo_interface lib9p_srv_fio whoami_file_fopen(struct whoami_file *self, st
ret->buf_len = 0;
ret->buf = NULL;
- return lo_box_whoami_fio_as_lib9p_srv_fio(ret);
+ return LO_BOX(lib9p_srv_fio, ret);
}
/* srv_fio ********************************************************************/
diff --git a/lib9p/tests/test_server/fs_whoami.h b/lib9p/tests/test_server/fs_whoami.h
index 5e1aee9..518e11d 100644
--- a/lib9p/tests/test_server/fs_whoami.h
+++ b/lib9p/tests/test_server/fs_whoami.h
@@ -15,6 +15,5 @@ struct whoami_file {
uint64_t pathnum;
};
LO_IMPLEMENTATION_H(lib9p_srv_file, struct whoami_file, whoami_file);
-#define lo_box_whoami_file_as_lib9p_srv_file(obj) util9p_box(whoami_file, obj)
#endif /* _LIB9P_TESTS_TEST_SERVER_FS_WHOAMI_H_ */
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c
index f2a73bf..052d180 100644
--- a/lib9p/tests/test_server/main.c
+++ b/lib9p/tests/test_server/main.c
@@ -60,11 +60,11 @@ static struct {
#define STATIC_DIR(N, STRNAME, ...) \
UTIL9P_STATIC_DIR(N, STRNAME, __VA_ARGS__)
-#define API_FILE(N, STRNAME, SYMNAME, ...) \
- lo_box_##SYMNAME##_file_as_lib9p_srv_file(&((struct SYMNAME##_file){ \
- .name = STRNAME, \
- .pathnum = N \
- __VA_OPT__(,) __VA_ARGS__ \
+#define API_FILE(N, STRNAME, SYMNAME, ...) \
+ LO_BOX(lib9p_srv_file, &((struct SYMNAME##_file){ \
+ .name = STRNAME, \
+ .pathnum = N \
+ __VA_OPT__(,) __VA_ARGS__ \
}))
static struct lib9p_srv_file root =
@@ -96,7 +96,7 @@ static COROUTINE read_cr(void *_i) {
hostnet_tcp_listener_init(&globals.listeners[i], globals.port);
- lib9p_srv_accept_and_read_loop(&globals.srv, lo_box_hostnet_tcplist_as_net_stream_listener(&globals.listeners[i]));
+ lib9p_srv_accept_and_read_loop(&globals.srv, LO_BOX(net_stream_listener, &globals.listeners[i]));
cr_end();
}
@@ -164,7 +164,7 @@ int main(int argc, char *argv[]) {
struct hostclock clock_monotonic = {
.clock_id = CLOCK_MONOTONIC,
};
- bootclock = lo_box_hostclock_as_alarmclock(&clock_monotonic);
+ bootclock = LO_BOX(alarmclock, &clock_monotonic);
coroutine_add("init", init_cr, NULL);
coroutine_main();
fclose(globals.logstream);