summaryrefslogtreecommitdiff
path: root/lib9p/9p.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/9p.c')
-rw-r--r--lib9p/9p.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib9p/9p.c b/lib9p/9p.c
index ecb75fd..06f4023 100644
--- a/lib9p/9p.c
+++ b/lib9p/9p.c
@@ -146,15 +146,17 @@ void _lib9p_unmarshal(const struct _lib9p_recv_tentry xxx_table[LIB9P_VER_NUM][0
}
void lib9p_Tmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes,
- enum lib9p_msg_type *ret_typ, void *ret_body) {
+ struct lib9p_Tmsg *ret) {
+ assert(ret);
_lib9p_unmarshal(_lib9p_table_Tmsg_recv,
- ctx, net_bytes, ret_typ, ret_body);
+ ctx, net_bytes, &ret->typ, &ret->body);
}
void lib9p_Rmsg_unmarshal(struct lib9p_ctx *ctx, uint8_t *net_bytes,
- enum lib9p_msg_type *ret_typ, void *ret_body) {
+ struct lib9p_Rmsg *ret) {
+ assert(ret);
_lib9p_unmarshal(_lib9p_table_Rmsg_recv,
- ctx, net_bytes, ret_typ, ret_body);
+ ctx, net_bytes, &ret->typ, &ret->body);
}
static
@@ -171,16 +173,20 @@ bool _lib9p_marshal(const struct _lib9p_send_tentry xxx_table[LIB9P_VER_NUM][0x8
return tentry.marshal(&subctx, body);
}
-bool lib9p_Tmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body,
+bool lib9p_Tmsg_marshal(struct lib9p_ctx *ctx, struct lib9p_Tmsg *msg,
uint8_t *ret_bytes) {
- assert(typ % 2 == 0);
- return _lib9p_marshal(_lib9p_table_Tmsg_send, ctx, typ, body, ret_bytes);
+ assert(msg);
+ assert(msg->typ % 2 == 0);
+ return _lib9p_marshal(_lib9p_table_Tmsg_send, ctx, msg->typ, &msg->body,
+ ret_bytes);
}
-bool lib9p_Rmsg_marshal(struct lib9p_ctx *ctx, enum lib9p_msg_type typ, void *body,
+bool lib9p_Rmsg_marshal(struct lib9p_ctx *ctx, struct lib9p_Rmsg *msg,
uint8_t *ret_bytes) {
- assert(typ % 2 == 1);
- return _lib9p_marshal(_lib9p_table_Rmsg_send, ctx, typ, body, ret_bytes);
+ assert(msg);
+ assert(msg->typ % 2 == 1);
+ return _lib9p_marshal(_lib9p_table_Rmsg_send, ctx, msg->typ, &msg->body,
+ ret_bytes);
}
/* `struct lib9p_stat` helpers ************************************************/