diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-05-29 22:25:02 -0400 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-06-06 23:01:30 -0600 |
commit | 945756b1b050bdf09d1119854cc5b22ad15efacd (patch) | |
tree | 8223c149ea0ff2863ffd2e1a90c2ebdfe8eb8b4b /lib9p_util | |
parent | 8a9fc1704dcf3ec117a3bf37fd70a44a43873659 (diff) |
lib9p_core: Switch to use error.h
Diffstat (limited to 'lib9p_util')
-rw-r--r-- | lib9p_util/static.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib9p_util/static.c b/lib9p_util/static.c index 7196813..4354166 100644 --- a/lib9p_util/static.c +++ b/lib9p_util/static.c @@ -55,13 +55,13 @@ static void util9p_static_dir_wstat(struct util9p_static_dir *self, struct lib9p assert(self); assert(ctx); - lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); + lib9p_error(ctx, E_POSIX_EROFS, "read-only part of filesystem"); } static void util9p_static_dir_remove(struct util9p_static_dir *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); + lib9p_error(ctx, E_POSIX_EROFS, "read-only part of filesystem"); } static lo_interface lib9p_srv_file util9p_static_dir_dwalk(struct util9p_static_dir *self, struct lib9p_srv_ctx *ctx, @@ -72,14 +72,13 @@ static lo_interface lib9p_srv_file util9p_static_dir_dwalk(struct util9p_static_ for (size_t i = 0; !LO_IS_NULL(self->members[i]); i++) { lo_interface lib9p_srv_file file = self->members[i]; struct lib9p_srv_stat stat = LO_CALL(file, stat, ctx); - if (lib9p_ctx_has_error(&ctx->basectx)) + if (lib9p_ctx_has_error(ctx)) break; lib9p_srv_stat_assert(stat); if (lib9p_str_eq(stat.name, childname)) return file; } - lib9p_error(&ctx->basectx, - E_POSIX_ENOENT, "no such file or directory"); + lib9p_error(ctx, E_POSIX_ENOENT, "no such file or directory"); return LO_NULL(lib9p_srv_file); } @@ -91,7 +90,7 @@ static lo_interface lib9p_srv_file util9p_static_dir_dcreate(struct util9p_stati assert(self); assert(ctx); - lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); + lib9p_error(ctx, E_POSIX_EROFS, "read-only part of filesystem"); return LO_NULL(lib9p_srv_file); } @@ -114,7 +113,7 @@ static struct lib9p_srv_dirent util9p_static_dir_dread(struct util9p_static_dir return (struct lib9p_srv_dirent){}; struct lib9p_srv_stat stat = LO_CALL(file, stat, ctx); - if (lib9p_ctx_has_error(&ctx->basectx)) + if (lib9p_ctx_has_error(ctx)) return (struct lib9p_srv_dirent){}; lib9p_srv_stat_assert(stat); @@ -173,13 +172,13 @@ static void util9p_static_file_wstat(struct util9p_static_file *self, struct lib assert(self); assert(ctx); - lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); + lib9p_error(ctx, E_POSIX_EROFS, "read-only part of filesystem"); } static void util9p_static_file_remove(struct util9p_static_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); - lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); + lib9p_error(ctx, E_POSIX_EROFS, "read-only part of filesystem"); } LIB9P_SRV_NOTDIR(struct util9p_static_file, util9p_static_file); @@ -210,8 +209,7 @@ static void util9p_static_file_pread(struct util9p_static_file *self, struct lib size_t data_size = util9p_static_file_size(self); if (byte_offset > (uint64_t)data_size) { - lib9p_error(&ctx->basectx, - E_POSIX_EINVAL, "offset is past end-of-file length"); + lib9p_error(ctx, E_POSIX_EINVAL, "offset is past end-of-file length"); return; } @@ -229,6 +227,6 @@ static uint32_t util9p_static_file_pwrite(struct util9p_static_file *self, struc assert(self); assert(ctx); - lib9p_error(&ctx->basectx, E_POSIX_EROFS, "read-only part of filesystem"); + lib9p_error(ctx, E_POSIX_EROFS, "read-only part of filesystem"); return 0; } |