summaryrefslogtreecommitdiff
path: root/lib9p/srv.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-19 15:32:10 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-19 15:43:56 -0700
commit0ab9da9bc3c6cdaef00b7202ba03eff917b44c95 (patch)
tree9b5a167833b9caa4f8f829c9bc7a3711a1cd837a /lib9p/srv.c
parentabc16ce9b5ba132769e14b4b3d649d79a92effc3 (diff)
lib9p: Use <libmisc/endian.h>
Diffstat (limited to 'lib9p/srv.c')
-rw-r--r--lib9p/srv.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib9p/srv.c b/lib9p/srv.c
index 9eb945c..f2d1315 100644
--- a/lib9p/srv.c
+++ b/lib9p/srv.c
@@ -121,7 +121,7 @@ static uint32_t rerror_overhead_for_version(enum lib9p_version version,
scratch); /* net_bytes */
assert(!e);
- uint32_t min_msg_size = decode_u32le(scratch);
+ uint32_t min_msg_size = uint32le_decode(scratch);
/* Assert that min_msg_size + biggest_possible_MAX_ERR_SIZE
* won't overflow uint32... because using
@@ -164,7 +164,7 @@ static void respond_error(struct _lib9p_srv_req *req) {
cr_mutex_lock(&sess->parent_conn->writelock);
r = VCALL(sess->parent_conn->fd, write,
- req->net_bytes, decode_u32le(req->net_bytes));
+ req->net_bytes, uint32le_decode(req->net_bytes));
cr_mutex_unlock(&sess->parent_conn->writelock);
if (r < 0)
nonrespond_errorf("write: %s", net_strerror(-r));
@@ -226,7 +226,7 @@ static void handle_message(struct _lib9p_srv_req *ctx);
size_t done = 0;
if (read_at_least(conn.fd, buf, 4, &done))
goto close;
- size_t goal = decode_u32le(buf);
+ size_t goal = uint32le_decode(buf);
if (goal < 7) {
nonrespond_errorf("T-message is impossibly small");
goto close;
@@ -235,7 +235,7 @@ static void handle_message(struct _lib9p_srv_req *ctx);
goto close;
struct _lib9p_srv_req req = {
.parent_sess = &sess,
- .tag = decode_u16le(&buf[5]),
+ .tag = uint16le_decode(&buf[5]),
.net_bytes = buf,
.ctx = {
.basectx = {
@@ -293,7 +293,7 @@ COROUTINE lib9p_srv_write_cr(void *_srv) {
/* Deep-copy the request from the reader coroutine's
* stack to our stack. */
req = *rpc_handle.req;
- memcpy(net, req.net_bytes, decode_u32le(req.net_bytes));
+ memcpy(net, req.net_bytes, uint32le_decode(req.net_bytes));
req.net_bytes = net;
/* Record that we have it. */
reqmap_store(&req.parent_sess->reqs, req.tag, &req);
@@ -392,7 +392,7 @@ static void handle_message(struct _lib9p_srv_req *ctx) {
cr_mutex_lock(&ctx->parent_sess->parent_conn->writelock);
VCALL(ctx->parent_sess->parent_conn->fd, write,
- ctx->net_bytes, decode_u32le(ctx->net_bytes));
+ ctx->net_bytes, uint32le_decode(ctx->net_bytes));
cr_mutex_unlock(&ctx->parent_sess->parent_conn->writelock);
}
}