summaryrefslogtreecommitdiff
path: root/lib9p/srv.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/srv.c')
-rw-r--r--lib9p/srv.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/lib9p/srv.c b/lib9p/srv.c
index 04cd119..74aa158 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -99,7 +99,9 @@ static uint32_t rerror_overhead_for_version(enum lib9p_version version,
}
static void respond_error(struct _lib9p_srv_req *req) {
+#ifdef CONFIG_9P_ENABLE_9P2000_u
assert(req->ctx.basectx.err_num);
+#endif
assert(req->ctx.basectx.err_msg[0]);
ssize_t r;
@@ -110,7 +112,9 @@ static void respond_error(struct _lib9p_srv_req *req) {
CONFIG_9P_MAX_ERR_SIZE),
.utf8 = req->ctx.basectx.err_msg,
},
+#ifdef CONFIG_9P_ENABLE_9P2000_u
.errno = req->ctx.basectx.err_num,
+#endif
};
struct _srv_sess *sess = req->parent_sess;
@@ -298,9 +302,11 @@ _HANDLER_PROTO(clunk);
_HANDLER_PROTO(remove);
_HANDLER_PROTO(stat);
_HANDLER_PROTO(wstat);
-_HANDLER_PROTO(session); /* 9P2000.e */
-_HANDLER_PROTO(sread); /* 9P2000.e */
-_HANDLER_PROTO(swrite); /* 9P2000.e */
+#ifdef CONFIG_9P_ENABLE_9P2000_e
+_HANDLER_PROTO(session);
+_HANDLER_PROTO(sread);
+_HANDLER_PROTO(swrite);
+#endif
typedef void (*tmessage_handler)(struct _lib9p_srv_req *, void *, void *);
@@ -318,9 +324,11 @@ static tmessage_handler tmessage_handlers[0x100] = {
[LIB9P_TYP_Tremove] = (tmessage_handler)handle_Tremove,
[LIB9P_TYP_Tstat] = (tmessage_handler)handle_Tstat,
[LIB9P_TYP_Twstat] = (tmessage_handler)handle_Twstat,
- [LIB9P_TYP_Tsession] = (tmessage_handler)handle_Tsession, /* 9P2000.e */
- [LIB9P_TYP_Tsread] = (tmessage_handler)handle_Tsread, /* 9P2000.e */
- [LIB9P_TYP_Tswrite] = (tmessage_handler)handle_Tswrite, /* 9P2000.e */
+#ifdef CONFIG_9P_ENABLE_9P2000_e
+ [LIB9P_TYP_Tsession] = (tmessage_handler)handle_Tsession,
+ [LIB9P_TYP_Tsread] = (tmessage_handler)handle_Tsread,
+ [LIB9P_TYP_Tswrite] = (tmessage_handler)handle_Tswrite,
+#endif
};
static void handle_message(struct _lib9p_srv_req *ctx) {
@@ -409,12 +417,15 @@ static void handle_Tversion(struct _lib9p_srv_req *ctx,
'0' <= req->version.utf8[4] && req->version.utf8[4] <= '9' &&
'0' <= req->version.utf8[5] && req->version.utf8[5] <= '9' &&
(req->version.utf8[6] == '\0' || req->version.utf8[6] == '.')) {
+ version = LIB9P_VER_9P2000;
+#ifdef CONFIG_9P_ENABLE_9P2000_u
if (strcmp((char *)&req->version.utf8[6], ".u") == 0)
version = LIB9P_VER_9P2000_u;
- else if (strcmp((char *)&req->version.utf8[6], ".e") == 0)
+#endif
+#ifdef CONFIG_9P_ENABLE_9P2000_e
+ if (strcmp((char *)&req->version.utf8[6], ".e") == 0)
version = LIB9P_VER_9P2000_e;
- else
- version = LIB9P_VER_9P2000;
+#endif
}
uint32_t min_msg_size = rerror_overhead_for_version(version, ctx->net_bytes);
@@ -741,7 +752,7 @@ static void handle_Tcreate(struct _lib9p_srv_req *ctx,
handler_common(ctx, req, resp);
lib9p_error(&ctx->ctx.basectx,
- LINUX_EOPNOTSUPP, "create not yet implemented");
+ LINUX_EOPNOTSUPP, "create not (yet?) implemented");
}
static void handle_Tread(struct _lib9p_srv_req *ctx,
@@ -826,7 +837,7 @@ static void handle_Tremove(struct _lib9p_srv_req *ctx,
handler_common(ctx, req, resp);
lib9p_error(&ctx->ctx.basectx,
- LINUX_EOPNOTSUPP, "remove not yet implemented");
+ LINUX_EOPNOTSUPP, "remove not (yet?) implemented");
}
static void handle_Tstat(struct _lib9p_srv_req *ctx,
@@ -850,16 +861,17 @@ static void handle_Twstat(struct _lib9p_srv_req *ctx,
handler_common(ctx, req, resp);
lib9p_error(&ctx->ctx.basectx,
- LINUX_EOPNOTSUPP, "wstat not yet implemented");
+ LINUX_EOPNOTSUPP, "wstat not (yet?) implemented");
}
+#ifdef CONFIG_9P_ENABLE_9P2000_e
static void handle_Tsession(struct _lib9p_srv_req *ctx,
struct lib9p_msg_Tsession *req,
struct lib9p_msg_Rsession *resp) {
handler_common(ctx, req, resp);
lib9p_error(&ctx->ctx.basectx,
- LINUX_EOPNOTSUPP, "session not yet implemented");
+ LINUX_EOPNOTSUPP, "session not (yet?) implemented");
}
static void handle_Tsread(struct _lib9p_srv_req *ctx,
@@ -868,7 +880,7 @@ static void handle_Tsread(struct _lib9p_srv_req *ctx,
handler_common(ctx, req, resp);
lib9p_error(&ctx->ctx.basectx,
- LINUX_EOPNOTSUPP, "sread not yet implemented");
+ LINUX_EOPNOTSUPP, "sread not (yet?) implemented");
}
static void handle_Tswrite(struct _lib9p_srv_req *ctx,
@@ -877,5 +889,6 @@ static void handle_Tswrite(struct _lib9p_srv_req *ctx,
handler_common(ctx, req, resp);
lib9p_error(&ctx->ctx.basectx,
- LINUX_EOPNOTSUPP, "swrite not yet implemented");
+ LINUX_EOPNOTSUPP, "swrite not (yet?) implemented");
}
+#endif