summaryrefslogtreecommitdiff
path: root/lib9p
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p')
-rw-r--r--lib9p/9P2000.u.txt3
-rw-r--r--lib9p/9p.c15
-rwxr-xr-xlib9p/9p.gen10
-rw-r--r--lib9p/9p.generated.c15
-rw-r--r--lib9p/include/lib9p/9p.generated.h1
-rw-r--r--lib9p/include/lib9p/9p.h22
-rw-r--r--lib9p/include/lib9p/srv.h12
-rw-r--r--lib9p/internal.h16
-rw-r--r--lib9p/map.h5
-rw-r--r--lib9p/srv.c134
10 files changed, 153 insertions, 80 deletions
diff --git a/lib9p/9P2000.u.txt b/lib9p/9P2000.u.txt
index 3958a92..9f28f33 100644
--- a/lib9p/9P2000.u.txt
+++ b/lib9p/9P2000.u.txt
@@ -15,7 +15,8 @@ stat += "file_extension[s]"
"file_owner_n_gid[4]"
"file_last_modified_n_uid[4]"
-Tauth += "n_uname[4]"
+Tauth += "n_uname[4]"
+Tattach += "n_uname[4]"
Rerror += "errno[4]"
diff --git a/lib9p/9p.c b/lib9p/9p.c
index fffef31..0ab940c 100644
--- a/lib9p/9p.c
+++ b/lib9p/9p.c
@@ -13,21 +13,6 @@
#include "internal.h"
-enum lib9p_version lib9p_ctx_version(struct lib9p_ctx *ctx) {
- assert(ctx);
- return ctx->version;
-}
-
-uint32_t lib9p_ctx_max_msg_size(struct lib9p_ctx *ctx) {
- assert(ctx);
- return ctx->max_msg_size;
-}
-
-bool lib9p_ctx_has_error(struct lib9p_ctx *ctx) {
- assert(ctx);
- return ctx->err_num || ctx->err_msg[0];
-}
-
int lib9p_error(struct lib9p_ctx *ctx, uint32_t linux_errno, char const *msg) {
strncpy(ctx->err_msg, msg, sizeof(ctx->err_msg));
ctx->err_msg[sizeof(ctx->err_msg)-1] = '\0';
diff --git a/lib9p/9p.gen b/lib9p/9p.gen
index cdec067..2b7745e 100755
--- a/lib9p/9p.gen
+++ b/lib9p/9p.gen
@@ -754,7 +754,10 @@ static ALWAYS_INLINE void unmarshal_8(struct _unmarshal_ctx *ctx, uint64_t *out)
ret += f"{prefix}out->{member.name} = ctx->extra;\n"
ret += f"{prefix}ctx->extra += sizeof(out->{member.name}[0]) * out->{member.cnt};\n"
ret += f"{prefix}for (typeof(out->{member.cnt}) i = 0; i < out->{member.cnt}; i++)\n"
- ret += f"{prefix}\tunmarshal_{member.typ.name}(ctx, &out->{member.name}[i]);\n"
+ if typ.name in ['d', 's']: # SPECIAL
+ ret += f"{prefix}\tunmarshal_{member.typ.name}(ctx, (uint8_t *)&out->{member.name}[i]);\n"
+ else:
+ ret += f"{prefix}\tunmarshal_{member.typ.name}(ctx, &out->{member.name}[i]);\n"
if member.ver != struct_versions:
ret += "\t}\n"
else:
@@ -850,7 +853,10 @@ static ALWAYS_INLINE bool marshal_8(struct _marshal_ctx *ctx, uint64_t *val) {
ret += "({"
ret += f"\n{prefix2}\tbool err = false;"
ret += f"\n{prefix2}\tfor (typeof(val->{member.cnt}) i = 0; i < val->{member.cnt} && !err; i++)"
- ret += f"\n{prefix2}\t\terr = marshal_{member.typ.name}(ctx, &val->{member.name}[i]);"
+ if typ.name in ['d', 's']: # SPECIAL
+ ret += f"\n{prefix2}\t\terr = marshal_{member.typ.name}(ctx, (uint8_t *)&val->{member.name}[i]);"
+ else:
+ ret += f"\n{prefix2}\t\terr = marshal_{member.typ.name}(ctx, &val->{member.name}[i]);"
ret += f"\n{prefix2}\terr;"
ret += f"\n{prefix2}}})"
else:
diff --git a/lib9p/9p.generated.c b/lib9p/9p.generated.c
index fc243f5..54e7613 100644
--- a/lib9p/9p.generated.c
+++ b/lib9p/9p.generated.c
@@ -441,7 +441,8 @@ static FLATTEN bool validate_Tattach(struct _validate_ctx *ctx) {
return validate_4(ctx)
|| validate_4(ctx)
|| validate_s(ctx)
- || validate_s(ctx);
+ || validate_s(ctx)
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && validate_4(ctx) );
}
static FLATTEN bool validate_Rattach(struct _validate_ctx *ctx) {
@@ -613,7 +614,7 @@ static ALWAYS_INLINE void unmarshal_d(struct _unmarshal_ctx *ctx, struct lib9p_d
out->dat = ctx->extra;
ctx->extra += sizeof(out->dat[0]) * out->len;
for (typeof(out->len) i = 0; i < out->len; i++)
- unmarshal_1(ctx, &out->dat[i]);
+ unmarshal_1(ctx, (uint8_t *)&out->dat[i]);
}
static ALWAYS_INLINE void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9p_s *out) {
@@ -622,7 +623,7 @@ static ALWAYS_INLINE void unmarshal_s(struct _unmarshal_ctx *ctx, struct lib9p_s
out->utf8 = ctx->extra;
ctx->extra += sizeof(out->utf8[0]) * out->len;
for (typeof(out->len) i = 0; i < out->len; i++)
- unmarshal_1(ctx, &out->utf8[i]);
+ unmarshal_1(ctx, (uint8_t *)&out->utf8[i]);
}
static ALWAYS_INLINE void unmarshal_dm(struct _unmarshal_ctx *ctx, lib9p_dm_t *out) {
@@ -695,6 +696,7 @@ static FLATTEN void unmarshal_Tattach(struct _unmarshal_ctx *ctx, struct lib9p_m
unmarshal_4(ctx, &out->afid);
unmarshal_s(ctx, &out->uname);
unmarshal_s(ctx, &out->aname);
+ if ( (ctx->ctx->version==LIB9P_VER_9P2000_u) ) unmarshal_4(ctx, &out->n_uname);
}
static FLATTEN void unmarshal_Rattach(struct _unmarshal_ctx *ctx, struct lib9p_msg_Rattach *out) {
@@ -912,7 +914,7 @@ static ALWAYS_INLINE bool marshal_d(struct _marshal_ctx *ctx, struct lib9p_d *va
|| ({
bool err = false;
for (typeof(val->len) i = 0; i < val->len && !err; i++)
- err = marshal_1(ctx, &val->dat[i]);
+ err = marshal_1(ctx, (uint8_t *)&val->dat[i]);
err;
});
}
@@ -922,7 +924,7 @@ static ALWAYS_INLINE bool marshal_s(struct _marshal_ctx *ctx, struct lib9p_s *va
|| ({
bool err = false;
for (typeof(val->len) i = 0; i < val->len && !err; i++)
- err = marshal_1(ctx, &val->utf8[i]);
+ err = marshal_1(ctx, (uint8_t *)&val->utf8[i]);
err;
});
}
@@ -996,7 +998,8 @@ static FLATTEN bool marshal_Tattach(struct _marshal_ctx *ctx, struct lib9p_msg_T
return marshal_4(ctx, &val->fid)
|| marshal_4(ctx, &val->afid)
|| marshal_s(ctx, &val->uname)
- || marshal_s(ctx, &val->aname);
+ || marshal_s(ctx, &val->aname)
+ || ( (ctx->ctx->version==LIB9P_VER_9P2000_u) && marshal_4(ctx, &val->n_uname) );
}
static FLATTEN bool marshal_Rattach(struct _marshal_ctx *ctx, struct lib9p_msg_Rattach *val) {
diff --git a/lib9p/include/lib9p/9p.generated.h b/lib9p/include/lib9p/9p.generated.h
index 135cf8a..a682908 100644
--- a/lib9p/include/lib9p/9p.generated.h
+++ b/lib9p/include/lib9p/9p.generated.h
@@ -179,6 +179,7 @@ struct lib9p_msg_Tattach {
uint32_t afid;
struct lib9p_s uname;
struct lib9p_s aname;
+ uint32_t n_uname; /* 9P2000.u */
};
struct lib9p_msg_Rattach {
diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h
index b96c938..66f7542 100644
--- a/lib9p/include/lib9p/9p.h
+++ b/lib9p/include/lib9p/9p.h
@@ -7,19 +7,33 @@
#ifndef _LIB9P_9P_H_
#define _LIB9P_9P_H_
+#include <assert.h>
#include <stdbool.h>
#include <sys/types.h> /* for ssize_t */
#include <lib9p/9p.generated.h>
#include <lib9p/linux-errno.h>
+#define _USE_CONFIG_9P_ERR
+#include "config.h"
+
#define LIB9P_NOTAG ((uint16_t)~0U)
#define LIB9P_NOFID ((uint32_t)~0U)
-struct lib9p_ctx;
-enum lib9p_version lib9p_ctx_version(struct lib9p_ctx *);
-uint32_t lib9p_ctx_max_msg_size(struct lib9p_ctx *);
-bool lib9p_ctx_has_error(struct lib9p_ctx *);
+struct lib9p_ctx {
+ /* negotiated */
+ enum lib9p_version version;
+ uint32_t max_msg_size;
+
+ /* state */
+ uint32_t err_num;
+ char err_msg[CONFIG_9P_MAX_ERR_SIZE];
+};
+
+static bool lib9p_ctx_has_error(struct lib9p_ctx *ctx) {
+ assert(ctx);
+ return ctx->err_num || ctx->err_msg[0];
+}
/** Write an static error into ctx, return -1. */
int lib9p_error(struct lib9p_ctx *ctx, uint32_t linux_errno, char const *msg);
diff --git a/lib9p/include/lib9p/srv.h b/lib9p/include/lib9p/srv.h
index 11894ea..769b562 100644
--- a/lib9p/include/lib9p/srv.h
+++ b/lib9p/include/lib9p/srv.h
@@ -6,6 +6,12 @@
#include <lib9p/9p.h>
+struct lib9p_srv_reqctx {
+ struct lib9p_ctx *base;
+ uint32_t uid;
+ char *uname;
+};
+
/* vtables you must implement *************************************************/
struct lib9p_srv_file_vtable {
@@ -39,12 +45,6 @@ struct lib9p_srv_io_file_vtable {
/* objects you'll deal with ***************************************************/
-struct lib9p_srv_reqctx {
- struct lib9p_ctx ctx;
- uint32_t uid;
- char *uname;
-};
-
struct lib9p_srv_file {
struct lib9p_srv_file_vtable vtable;
diff --git a/lib9p/internal.h b/lib9p/internal.h
index cbec829..36a2647 100644
--- a/lib9p/internal.h
+++ b/lib9p/internal.h
@@ -7,7 +7,6 @@
#ifndef _LIB9P_INTERNAL_H_
#define _LIB9P_INTERNAL_H_
-#include <assert.h>
#include <stddef.h> /* for size_t */
#include <limits.h> /* for SSIZE_MAX */
@@ -30,21 +29,6 @@ static_assert(CONFIG_9P_MAX_ERR_SIZE + CONFIG_9P_MAX_MSG_SIZE + 2*CONFIG_9P_MAX_
#define CAT2(a, b) a##b
#define CAT3(a, b, c) a##b##c
-/* types **********************************************************************/
-
-/* NB: We declare this here instead of in the public <lib9p/9p.h>
- * because we don't want to include "config.h" from public headers,
- * and I want the MAX_ERR_SIZE to be configurable. */
-struct lib9p_ctx {
- /* negotiated */
- enum lib9p_version version;
- uint32_t max_msg_size;
-
- /* state */
- uint32_t err_num;
- char err_msg[CONFIG_9P_MAX_ERR_SIZE];
-};
-
/* vtables ********************************************************************/
struct _validate_ctx {
diff --git a/lib9p/map.h b/lib9p/map.h
index a8d26b5..9df9be7 100644
--- a/lib9p/map.h
+++ b/lib9p/map.h
@@ -45,6 +45,9 @@ struct NAME {
struct MAP_KV(NAME) items[CAP];
};
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
+
/**
* Load an item from the map; return a pointer to the in-map value, or
* NULL if the item is not in the map.
@@ -96,6 +99,8 @@ static bool MAP_METHOD(NAME,del)(struct NAME *m, KEY_T k) {
return false;
}
+#pragma GCC diagnostic pop
+
#undef NAME
#undef KEY_T
#undef VAL_T
diff --git a/lib9p/srv.c b/lib9p/srv.c
index 1510a4a..0f9466c 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -8,7 +8,6 @@
#include <libcr_ipc/mutex.h>
#include <libnetio/netio.h>
-#include <lib9p/9p.h>
#include <lib9p/srv.h>
#include "internal.h"
@@ -55,7 +54,7 @@ struct lib9p_req {
uint16_t tag;
/* mutable */
uint8_t *net_bytes; /* CONFIG_9P_MAX_MSG_SIZE-sized */
- struct lib9p_reqctx ctx;
+ struct lib9p_ctx ctx;
};
/* base utilities *************************************************************/
@@ -85,7 +84,7 @@ static void respond_error(struct lib9p_req *req) {
struct lib9p_msg_Rerror host = {
.ename = {
.len = strnlen(req->ctx.err_msg, CONFIG_9P_MAX_ERR_SIZE),
- .utf8 = (uint8_t*)req->ctx.err_msg,
+ .utf8 = req->ctx.err_msg,
},
.errno = req->ctx.err_num,
};
@@ -204,6 +203,19 @@ COROUTINE lib9p_srv_read_cr(void *_srv) {
static void handle_Tversion(struct lib9p_req *ctx, struct lib9p_msg_Tversion *req, struct lib9p_msg_Rversion *resp);
static void handle_Tauth(struct lib9p_req *ctx, struct lib9p_msg_Tauth *req, struct lib9p_msg_Rauth *resp);
static void handle_Tattach(struct lib9p_req *ctx, struct lib9p_msg_Tattach *req, struct lib9p_msg_Rattach *resp);
+static void handle_Tflush(struct lib9p_req *ctx, struct lib9p_msg_Tflush *req, struct lib9p_msg_Rflush *resp);
+static void handle_Twalk(struct lib9p_req *ctx, struct lib9p_msg_Twalk *req, struct lib9p_msg_Rwalk *resp);
+static void handle_Topen(struct lib9p_req *ctx, struct lib9p_msg_Topen *req, struct lib9p_msg_Ropen *resp);
+static void handle_Tcreate(struct lib9p_req *ctx, struct lib9p_msg_Tcreate *req, struct lib9p_msg_Rcreate *resp);
+static void handle_Tread(struct lib9p_req *ctx, struct lib9p_msg_Tread *req, struct lib9p_msg_Rread *resp);
+static void handle_Twrite(struct lib9p_req *ctx, struct lib9p_msg_Twrite *req, struct lib9p_msg_Rwrite *resp);
+static void handle_Tclunk(struct lib9p_req *ctx, struct lib9p_msg_Tclunk *req, struct lib9p_msg_Rclunk *resp);
+static void handle_Tremove(struct lib9p_req *ctx, struct lib9p_msg_Tremove *req, struct lib9p_msg_Rremove *resp);
+static void handle_Tstat(struct lib9p_req *ctx, struct lib9p_msg_Tstat *req, struct lib9p_msg_Rstat *resp);
+static void handle_Twstat(struct lib9p_req *ctx, struct lib9p_msg_Twstat *req, struct lib9p_msg_Rwstat *resp);
+static void handle_Tsession(struct lib9p_req *ctx, struct lib9p_msg_Tsession *req, struct lib9p_msg_Rsession *resp);
+static void handle_Tsread(struct lib9p_req *ctx, struct lib9p_msg_Tsread *req, struct lib9p_msg_Rsread *resp);
+static void handle_Tswrite(struct lib9p_req *ctx, struct lib9p_msg_Tswrite *req, struct lib9p_msg_Rswrite *resp);
COROUTINE lib9p_srv_write_cr(void *_srv) {
uint8_t net[CONFIG_9P_MAX_MSG_SIZE];
@@ -247,49 +259,49 @@ COROUTINE lib9p_srv_write_cr(void *_srv) {
handle_Tversion(&req, (struct lib9p_msg_Tversion *)host_req, (struct lib9p_msg_Rversion *)host_resp);
break;
case LIB9P_TYP_Tauth:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tauth(&req, (struct lib9p_msg_Tauth *)host_req, (struct lib9p_msg_Rauth *)host_resp);
break;
case LIB9P_TYP_Tattach:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tattach(&req, (struct lib9p_msg_Tattach *)host_req, (struct lib9p_msg_Rattach *)host_resp);
break;
case LIB9P_TYP_Tflush:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tflush(&req, (struct lib9p_msg_Tflush *)host_req, (struct lib9p_msg_Rflush *)host_resp);
break;
case LIB9P_TYP_Twalk:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Twalk(&req, (struct lib9p_msg_Twalk *)host_req, (struct lib9p_msg_Rwalk *)host_resp);
break;
case LIB9P_TYP_Topen:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Topen(&req, (struct lib9p_msg_Topen *)host_req, (struct lib9p_msg_Ropen *)host_resp);
break;
case LIB9P_TYP_Tcreate:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tcreate(&req, (struct lib9p_msg_Tcreate *)host_req, (struct lib9p_msg_Rcreate *)host_resp);
break;
case LIB9P_TYP_Tread:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tread(&req, (struct lib9p_msg_Tread *)host_req, (struct lib9p_msg_Rread *)host_resp);
break;
case LIB9P_TYP_Twrite:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Twrite(&req, (struct lib9p_msg_Twrite *)host_req, (struct lib9p_msg_Rwrite *)host_resp);
break;
case LIB9P_TYP_Tclunk:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tclunk(&req, (struct lib9p_msg_Tclunk *)host_req, (struct lib9p_msg_Rclunk *)host_resp);
break;
case LIB9P_TYP_Tremove:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tremove(&req, (struct lib9p_msg_Tremove *)host_req, (struct lib9p_msg_Rremove *)host_resp);
break;
case LIB9P_TYP_Tstat:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tstat(&req, (struct lib9p_msg_Tstat *)host_req, (struct lib9p_msg_Rstat *)host_resp);
break;
case LIB9P_TYP_Twstat:
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Twstat(&req, (struct lib9p_msg_Twstat *)host_req, (struct lib9p_msg_Rwstat *)host_resp);
break;
case LIB9P_TYP_Tsession: /* 9P2000.e */
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tsession(&req, (struct lib9p_msg_Tsession *)host_req, (struct lib9p_msg_Rsession *)host_resp);
break;
case LIB9P_TYP_Tsread: /* 9P2000.e */
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tsread(&req, (struct lib9p_msg_Tsread *)host_req, (struct lib9p_msg_Rsread *)host_resp);
break;
case LIB9P_TYP_Tswrite: /* 9P2000.e */
- lib9p_errorf(&req.ctx, LINUX_EOPNOTSUPP, "%s not yet implemented", lib9p_msg_type_str(typ));
+ handle_Tswrite(&req, (struct lib9p_msg_Tswrite *)host_req, (struct lib9p_msg_Rswrite *)host_resp);
break;
default:
assert(false);
@@ -338,27 +350,37 @@ static void handle_Tversion(struct lib9p_req *ctx, struct lib9p_msg_Tversion *re
return;
}
- resp->version.utf8 = (uint8_t *)lib9p_version_str(version);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
+ resp->version.utf8 = lib9p_version_str(version);
+#pragma GCC diagnostic pop
resp->version.len = strlen((char *)resp->version.utf8);
resp->max_msg_size = (CONFIG_9P_MAX_MSG_SIZE < req->max_msg_size)
? CONFIG_9P_MAX_MSG_SIZE
: req->max_msg_size;
}
-static void handle_Tauth(struct lib9p_req *ctx, struct lib9p_msg_Tauth *UNUSED(req), struct lib9p_msg_Rauth *UNUSED(resp)) {
+static void handle_Tauth(struct lib9p_req *ctx, struct lib9p_msg_Tauth *req, struct lib9p_msg_Rauth *UNUSED(resp)) {
if (!ctx->parent_sess->parent_conn->parent_srv->auth) {
lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "authentication not required");
return;
}
- ctx->ctx.uid = req->uid;
- ctx->ctx.uname = req->uname.utf8;
+ struct lib9p_srv_reqctx subctx = {
+ .base = &ctx->ctx,
+ .uid = req->n_uname,
+ .uname = req->uname.utf8,
+ };
+ ctx->parent_sess->parent_conn->parent_srv->auth(&subctx, req->aname.utf8);
lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "TODO: auth not implemented");
return;
}
-static void handle_Tattach(struct lib9p_req *ctx, struct lib9p_msg_Tattach *req, struct lib9p_msg_Rattach *resp) {
- ctx->ctx.uid = req->uid;
- ctx->ctx.uname = req->uname.utf8;
+static void handle_Tattach(struct lib9p_req *ctx, struct lib9p_msg_Tattach *req, struct lib9p_msg_Rattach *UNUSED(resp)) {
+ struct lib9p_srv_reqctx subctx = {
+ .base = &ctx->ctx,
+ .uid = req->n_uname,
+ .uname = req->uname.utf8,
+ };
if (ctx->parent_sess->parent_conn->parent_srv->auth) {
/*
struct lib9p_srv_filehandle *fh = fidmap_get(req->afid);
@@ -392,18 +414,70 @@ static void handle_Tattach(struct lib9p_req *ctx, struct lib9p_msg_Tattach *req,
return;
}
- struct lib9p_srv_file rootdir = ctx->parent_sess->parent_conn->parent_srv->rootdir(&ctx->ctx, req->aname.utf8);
- if (lib9p_ctx_has_error(&ctx->ctx.ctx))
+ struct lib9p_srv_file rootdir = ctx->parent_sess->parent_conn->parent_srv->rootdir(&subctx, req->aname.utf8);
+ if (lib9p_ctx_has_error(&ctx->ctx))
return;
struct lib9p_srv_file *rootdir_ptr = fidmap_store(&ctx->parent_sess->fids, req->fid, rootdir);
if (!rootdir_ptr) {
lib9p_error(&ctx->ctx, LINUX_EMFILE, "too many open files");
- if (rootdir.free)
- rootdir.free(ctx, rootdir.impldata);
+ if (rootdir.vtable.free)
+ rootdir.vtable.free(&subctx, rootdir.impldata);
return;
}
- resp->qid = rootdir.qid;
+ //resp->qid = rootdir.qid;
return;
}
+
+static void handle_Tflush(struct lib9p_req *ctx, struct lib9p_msg_Tflush *UNUSED(req), struct lib9p_msg_Rflush *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "flush not yet implemented");
+}
+
+static void handle_Twalk(struct lib9p_req *ctx, struct lib9p_msg_Twalk *UNUSED(req), struct lib9p_msg_Rwalk *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "walk not yet implemented");
+}
+
+static void handle_Topen(struct lib9p_req *ctx, struct lib9p_msg_Topen *UNUSED(req), struct lib9p_msg_Ropen *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "open not yet implemented");
+}
+
+static void handle_Tcreate(struct lib9p_req *ctx, struct lib9p_msg_Tcreate *UNUSED(req), struct lib9p_msg_Rcreate *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "create not yet implemented");
+}
+
+static void handle_Tread(struct lib9p_req *ctx, struct lib9p_msg_Tread *UNUSED(req), struct lib9p_msg_Rread *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "read not yet implemented");
+}
+
+static void handle_Twrite(struct lib9p_req *ctx, struct lib9p_msg_Twrite *UNUSED(req), struct lib9p_msg_Rwrite *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "write not yet implemented");
+}
+
+static void handle_Tclunk(struct lib9p_req *ctx, struct lib9p_msg_Tclunk *UNUSED(req), struct lib9p_msg_Rclunk *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "clunk not yet implemented");
+}
+
+static void handle_Tremove(struct lib9p_req *ctx, struct lib9p_msg_Tremove *UNUSED(req), struct lib9p_msg_Rremove *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "remove not yet implemented");
+}
+
+static void handle_Tstat(struct lib9p_req *ctx, struct lib9p_msg_Tstat *UNUSED(req), struct lib9p_msg_Rstat *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "stat not yet implemented");
+}
+
+static void handle_Twstat(struct lib9p_req *ctx, struct lib9p_msg_Twstat *UNUSED(req), struct lib9p_msg_Rwstat *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "wstat not yet implemented");
+}
+
+static void handle_Tsession(struct lib9p_req *ctx, struct lib9p_msg_Tsession *UNUSED(req), struct lib9p_msg_Rsession *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "session not yet implemented");
+}
+
+static void handle_Tsread(struct lib9p_req *ctx, struct lib9p_msg_Tsread *UNUSED(req), struct lib9p_msg_Rsread *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "sread not yet implemented");
+}
+
+static void handle_Tswrite(struct lib9p_req *ctx, struct lib9p_msg_Tswrite *UNUSED(req), struct lib9p_msg_Rswrite *UNUSED(resp)) {
+ lib9p_error(&ctx->ctx, LINUX_EOPNOTSUPP, "swrite not yet implemented");
+}