From 9aa3990e50efffc8a2f76e6c55ad769e5f711602 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Thu, 3 Apr 2025 16:16:33 -0600 Subject: lib9p: srv: Whoops, add a missing `return` --- lib9p/srv.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib9p') diff --git a/lib9p/srv.c b/lib9p/srv.c index bfeb06f..6e6a91b 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -903,6 +903,7 @@ static void handle_Topen(struct _lib9p_srv_req *ctx, if (!srv_util_check_perm(ctx, &stat, perm_bits)) { lib9p_error(&ctx->ctx.basectx, LINUX_EACCES, "permission denied"); + return; } /* Actually make the call. */ -- cgit v1.2.3-2-g168b From 76eb7f598349aeec09c2d70a7cf87fced73fd8a8 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 5 Apr 2025 00:45:53 -0600 Subject: libobj, libmisc/private.h: Allow+force semicolons --- lib9p/include/lib9p/srv.h | 8 ++++---- lib9p/tests/test_server/main.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'lib9p') diff --git a/lib9p/include/lib9p/srv.h b/lib9p/include/lib9p/srv.h index ff5ebdc..070cf5a 100644 --- a/lib9p/include/lib9p/srv.h +++ b/lib9p/include/lib9p/srv.h @@ -26,9 +26,9 @@ struct lib9p_srv_ctx { uint32_t uid; struct lib9p_s uname; - BEGIN_PRIVATE(LIB9P_SRV_H) + BEGIN_PRIVATE(LIB9P_SRV_H); _lib9p_srv_flushch_t _flushch; - END_PRIVATE(LIB9P_SRV_H) + END_PRIVATE(LIB9P_SRV_H); }; bool lib9p_srv_flush_requested(struct lib9p_srv_ctx *ctx); @@ -140,11 +140,11 @@ struct lib9p_srv { lo_interface lib9p_srv_file (*rootdir)(struct lib9p_srv_ctx *, struct lib9p_s treename); /* For internal use */ - BEGIN_PRIVATE(LIB9P_SRV_H) + BEGIN_PRIVATE(LIB9P_SRV_H); unsigned int readers; unsigned int writers; _lib9p_srv_reqch_t _reqch; - END_PRIVATE(LIB9P_SRV_H) + END_PRIVATE(LIB9P_SRV_H); }; /** diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c index c759029..a31c083 100644 --- a/lib9p/tests/test_server/main.c +++ b/lib9p/tests/test_server/main.c @@ -47,11 +47,11 @@ struct { struct api_file { uint64_t pathnum; }; -LO_IMPLEMENTATION_H(lib9p_srv_file, struct api_file, api) -LO_IMPLEMENTATION_H(lib9p_srv_fio, struct api_file, api) +LO_IMPLEMENTATION_H(lib9p_srv_file, struct api_file, api); +LO_IMPLEMENTATION_H(lib9p_srv_fio, struct api_file, api); -LO_IMPLEMENTATION_C(lib9p_srv_file, struct api_file, api, static) -LO_IMPLEMENTATION_C(lib9p_srv_fio, struct api_file, api, static) +LO_IMPLEMENTATION_C(lib9p_srv_file, struct api_file, api, static); +LO_IMPLEMENTATION_C(lib9p_srv_fio, struct api_file, api, static); static void api_free(struct api_file *self) { assert(self); -- cgit v1.2.3-2-g168b From 8a39cfe7f245bea8b3a458238b694de13c61b88a Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 5 Apr 2025 03:41:44 -0600 Subject: SYSTEM headers don't get strict GCC checks, so change them to PUBLIC --- lib9p/CMakeLists.txt | 2 +- lib9p/srv.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'lib9p') diff --git a/lib9p/CMakeLists.txt b/lib9p/CMakeLists.txt index 11a58ba..d433a12 100644 --- a/lib9p/CMakeLists.txt +++ b/lib9p/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later add_library(lib9p INTERFACE) -target_include_directories(lib9p SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories(lib9p PUBLIC INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) target_sources(lib9p INTERFACE 9p.generated.c 9p.c diff --git a/lib9p/srv.c b/lib9p/srv.c index 6e6a91b..12556b0 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -199,7 +199,11 @@ static void respond_error(struct _lib9p_srv_req *req) { LIB9P_TYP_Rerror, &host, &net); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wformat-extra-args" infof("< %v", lo_box_lib9p_msg_Rerror_as_fmt_formatter(&host)); +#pragma GCC diagnostic pop r = write_Rmsg(req, &net); if (r < 0) nonrespond_errorf("write: %s", net_strerror(-r)); @@ -425,7 +429,11 @@ static void handle_message(struct _lib9p_srv_req *ctx) { enum lib9p_msg_type typ; lib9p_Tmsg_unmarshal(&ctx->ctx.basectx, ctx->net_bytes, &typ, host_req); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wformat-extra-args" infof("> %v", lo_box_lib9p_msg_as_fmt_formatter(&ctx->ctx.basectx, typ, host_req)); +#pragma GCC diagnostic pop /* Handle it. */ tmessage_handlers[typ](ctx, (void *)host_req, (void *)host_resp); @@ -439,7 +447,11 @@ static void handle_message(struct _lib9p_srv_req *ctx) { typ+1, host_resp, &net_resp)) goto write; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wformat-extra-args" infof("< %v", lo_box_lib9p_msg_as_fmt_formatter(&ctx->ctx.basectx, typ+1, &host_resp)); +#pragma GCC diagnostic pop write_Rmsg(ctx, &net_resp); } if (host_req) -- cgit v1.2.3-2-g168b From 45f90d1bf6a5f974ed8bc62b6838b5d2e906a3f8 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 22 Feb 2025 04:07:17 -0700 Subject: lib9p: srv: Add comments about safety things to do --- lib9p/srv.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib9p') diff --git a/lib9p/srv.c b/lib9p/srv.c index 12556b0..a425dc9 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -966,6 +966,8 @@ static void handle_Tread(struct _lib9p_srv_req *ctx, struct lib9p_msg_Rread *resp) { util_handler_common(ctx, req, resp); + /* TODO: serialize simultaneous reads to the same FID */ + /* Check that the FID is valid for this. */ struct _srv_fidinfo *fidinfo = fidmap_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { @@ -1028,6 +1030,8 @@ static void handle_Twrite(struct _lib9p_srv_req *ctx, struct lib9p_msg_Rwrite *resp) { util_handler_common(ctx, req, resp); + /* TODO: serialize simultaneous writes to the same FID */ + /* Check that the FID is valid for this. */ struct _srv_fidinfo *fidinfo = fidmap_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { -- cgit v1.2.3-2-g168b