summaryrefslogtreecommitdiff
path: root/lib9p/tests/test_server/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/tests/test_server/main.c')
-rw-r--r--lib9p/tests/test_server/main.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c
index 052d180..0431c40 100644
--- a/lib9p/tests/test_server/main.c
+++ b/lib9p/tests/test_server/main.c
@@ -5,10 +5,13 @@
*/
#include <errno.h>
-#include <error.h>
#include <stdio.h>
#include <stdlib.h> /* for atoi() */
+#define error __error
+#include <error.h>
+#undef error
+
#include <lib9p/srv.h>
#include <libcr/coroutine.h>
#include <libhw/generic/alarmclock.h>
@@ -36,7 +39,7 @@
/* globals ********************************************************************/
-static lo_interface lib9p_srv_file get_root(struct lib9p_srv_ctx *, struct lib9p_s);
+static lib9p_srv_file_or_error get_root(struct lib9p_srv_ctx *, struct lib9p_s);
static const char *hexdig = "0123456789abcdef";
@@ -84,8 +87,8 @@ static struct lib9p_srv_file root =
API_FILE(13, "flush-slowread", flush, .flush_cnt=0, .flush_behavior=FLUSH_READ),
);
-static lo_interface lib9p_srv_file get_root(struct lib9p_srv_ctx *LM_UNUSED(ctx), struct lib9p_s LM_UNUSED(treename)) {
- return root;
+static lib9p_srv_file_or_error get_root(struct lib9p_srv_ctx *LM_UNUSED(ctx), struct lib9p_s LM_UNUSED(treename)) {
+ return ERROR_NEW_VAL(lib9p_srv_file, root);
}
/* main ***********************************************************************/
@@ -117,12 +120,12 @@ static COROUTINE init_cr(void *) {
for (int i = 0; i < _CONFIG_9P_MAX_CONNS; i++) {
char name[] = {'r', 'e', 'a', 'd', '-', hexdig[i], '\0'};
if (!coroutine_add(name, read_cr, &i))
- error(1, 0, "coroutine_add(read_cr, &i)");
+ __error(1, 0, "coroutine_add(read_cr, &i)");
}
for (int i = 0; i < _CONFIG_9P_MAX_REQS; i++) {
char name[] = {'w', 'r', 'i', 't', 'e', '-', hexdig[i], '\0'};
if (!coroutine_add(name, write_cr, NULL))
- error(1, 0, "coroutine_add(write_cr, NULL)");
+ __error(1, 0, "coroutine_add(write_cr, NULL)");
}
cr_exit();
@@ -153,12 +156,12 @@ static void tstlog_msg(struct lib9p_srv_ctx *ctx, enum lib9p_msg_type typ, void
int main(int argc, char *argv[]) {
if (argc != 3)
- error(2, 0, "usage: %s PORT_NUMBER LOGFILE", argv[0]);
+ __error(2, 0, "usage: %s PORT_NUMBER LOGFILE", argv[0]);
globals.port = atoi(argv[1]);
globals.logstream = fopen(argv[2], "w");
if (!globals.logstream)
- error(2, errno, "fopen");
+ __error(2, errno, "fopen");
globals.srv.msglog = tstlog_msg;
struct hostclock clock_monotonic = {