diff options
Diffstat (limited to 'lib9p')
-rw-r--r-- | lib9p/srv.c | 4 | ||||
-rw-r--r-- | lib9p/srv_include/lib9p/srv.h | 16 | ||||
-rw-r--r-- | lib9p/tests/test_server/fs_flush.c | 21 | ||||
-rw-r--r-- | lib9p/tests/test_server/fs_shutdown.c | 21 | ||||
-rw-r--r-- | lib9p/tests/test_server/fs_whoami.c | 21 | ||||
-rw-r--r-- | lib9p/tests/test_server/main.c | 3 |
6 files changed, 41 insertions, 45 deletions
diff --git a/lib9p/srv.c b/lib9p/srv.c index d1f5814..e938dcb 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -1107,7 +1107,7 @@ static void handle_Topen(struct srv_req *ctx, fidinfo->dir.io = dio_r.lib9p_srv_dio; fidinfo->dir.idx = 0; fidinfo->dir.off = 0; - qid = LO_CALL(fidinfo->dir.io, qid); + qid = LO_CALL(fidinfo->dir.io, ioqid); iounit = 0; break; case SRV_FILETYPE_FILE: @@ -1120,7 +1120,7 @@ static void handle_Topen(struct srv_req *ctx, goto topen_return; } fidinfo->file.io = fio_r.lib9p_srv_fio; - qid = LO_CALL(fidinfo->file.io, qid); + qid = LO_CALL(fidinfo->file.io, ioqid); iounit = LO_CALL(fidinfo->file.io, iounit); break; case SRV_FILETYPE_AUTH: diff --git a/lib9p/srv_include/lib9p/srv.h b/lib9p/srv_include/lib9p/srv.h index ce82e59..1114950 100644 --- a/lib9p/srv_include/lib9p/srv.h +++ b/lib9p/srv_include/lib9p/srv.h @@ -116,7 +116,7 @@ DECLARE_ERROR_OR(lib9p_srv_dirent); * FIXME: It would be nice if pread() could return more than 1 iovec. */ #define lib9p_srv_fio_LO_IFACE /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ \ - LO_FUNC(struct lib9p_qid , qid ) \ + LO_FUNC(struct lib9p_qid , ioqid ) \ LO_FUNC(void , iofree ) \ LO_FUNC(uint32_t , iounit ) \ LO_FUNC(iovec_or_error , pread , struct lib9p_srv_ctx *, \ @@ -135,7 +135,7 @@ typedef lo_interface lib9p_srv_fio lib9p_srv_fio; DECLARE_ERROR_OR(lib9p_srv_fio); #define lib9p_srv_dio_LO_IFACE /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/ \ - LO_FUNC(struct lib9p_qid , qid ) \ + LO_FUNC(struct lib9p_qid , ioqid ) \ LO_FUNC(void , iofree ) \ /** \ * Return the idx-th dirent. idx will always be either 0 or \ @@ -203,15 +203,15 @@ DECLARE_ERROR_OR(lib9p_srv_file); LO_FUNC(lib9p_srv_dio_or_error , dopen , struct lib9p_srv_ctx *) LO_INTERFACE(lib9p_srv_file); /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/ -#define LIB9P_SRV_NOTDIR(TYP, NAM) \ - static lib9p_srv_file_or_error NAM##_dwalk (TYP *, struct lib9p_srv_ctx *, struct lib9p_s) { assert_notreached("not a directory"); } \ - static lib9p_srv_file_or_error NAM##_dcreate(TYP *, struct lib9p_srv_ctx *, struct lib9p_s, \ +#define LIB9P_SRV_NOTDIR(QUALS, TYP, NAM) \ + QUALS lib9p_srv_file_or_error NAM##_dwalk (TYP *, struct lib9p_srv_ctx *, struct lib9p_s) { assert_notreached("not a directory"); } \ + QUALS lib9p_srv_file_or_error NAM##_dcreate(TYP *, struct lib9p_srv_ctx *, struct lib9p_s, \ struct lib9p_srv_userid *, struct lib9p_srv_userid *, lib9p_dm_t) { assert_notreached("not a directory"); } \ - static lib9p_srv_dio_or_error NAM##_dopen (TYP *, struct lib9p_srv_ctx *) { assert_notreached("not a directory"); } \ + QUALS lib9p_srv_dio_or_error NAM##_dopen (TYP *, struct lib9p_srv_ctx *) { assert_notreached("not a directory"); } \ LM_FORCE_SEMICOLON -#define LIB9P_SRV_NOTFILE(TYP, NAM) \ - static lib9p_srv_fio_or_error NAM##_fopen (TYP *, struct lib9p_srv_ctx *, bool, bool, bool) { assert_notreached("not a file"); } \ +#define LIB9P_SRV_NOTFILE(QUALS, TYP, NAM) \ + QUALS lib9p_srv_fio_or_error NAM##_fopen (TYP *, struct lib9p_srv_ctx *, bool, bool, bool) { assert_notreached("not a file"); } \ LM_FORCE_SEMICOLON /* main server entrypoints ****************************************************/ diff --git a/lib9p/tests/test_server/fs_flush.c b/lib9p/tests/test_server/fs_flush.c index 63a52af..41156ba 100644 --- a/lib9p/tests/test_server/fs_flush.c +++ b/lib9p/tests/test_server/fs_flush.c @@ -9,20 +9,19 @@ #define IMPLEMENTATION_FOR_LIB9P_SRV_H YES /* for ctx->flush_ch */ #include "fs_flush.h" -LO_IMPLEMENTATION_C(lib9p_srv_file, struct flush_file, flush_file, static); +LO_IMPLEMENTATION_C(lib9p_srv_file, struct flush_file, flush_file); struct flush_fio { struct flush_file *parent; }; -LO_IMPLEMENTATION_H(lib9p_srv_fio, struct flush_fio, flush_fio); -LO_IMPLEMENTATION_C(lib9p_srv_fio, struct flush_fio, flush_fio, static); +LO_IMPLEMENTATION_STATIC(lib9p_srv_fio, struct flush_fio, flush_fio); /* srv_file *******************************************************************/ -static void flush_file_free(struct flush_file *self) { +void flush_file_free(struct flush_file *self) { assert(self); } -static struct lib9p_qid flush_file_qid(struct flush_file *self) { +struct lib9p_qid flush_file_qid(struct flush_file *self) { assert(self); return (struct lib9p_qid){ .type = LIB9P_QT_FILE, @@ -31,7 +30,7 @@ static struct lib9p_qid flush_file_qid(struct flush_file *self) { }; } -static lib9p_srv_stat_or_error flush_file_stat(struct flush_file *self, struct lib9p_srv_ctx *ctx) { +lib9p_srv_stat_or_error flush_file_stat(struct flush_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); return ERROR_NEW_VAL(lib9p_srv_stat, ((struct lib9p_srv_stat){ @@ -47,20 +46,20 @@ static lib9p_srv_stat_or_error flush_file_stat(struct flush_file *self, struct l .extension = lib9p_str(NULL), })); } -static error flush_file_wstat(struct flush_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { +error flush_file_wstat(struct flush_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { assert(self); assert(ctx); return error_new(E_POSIX_EROFS, "cannot wstat API file"); } -static error flush_file_remove(struct flush_file *self, struct lib9p_srv_ctx *ctx) { +error flush_file_remove(struct flush_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); return error_new(E_POSIX_EROFS, "cannot remove API file"); } -LIB9P_SRV_NOTDIR(struct flush_file, flush_file); +LIB9P_SRV_NOTDIR(, struct flush_file, flush_file); -static lib9p_srv_fio_or_error flush_file_fopen(struct flush_file *self, struct lib9p_srv_ctx *ctx, bool, bool, bool) { +lib9p_srv_fio_or_error flush_file_fopen(struct flush_file *self, struct lib9p_srv_ctx *ctx, bool, bool, bool) { assert(self); assert(ctx); @@ -77,7 +76,7 @@ static void flush_fio_iofree(struct flush_fio *self) { free(self); } -static struct lib9p_qid flush_fio_qid(struct flush_fio *self) { +static struct lib9p_qid flush_fio_ioqid(struct flush_fio *self) { assert(self); return flush_file_qid(self->parent); } diff --git a/lib9p/tests/test_server/fs_shutdown.c b/lib9p/tests/test_server/fs_shutdown.c index 079442e..1afbaf3 100644 --- a/lib9p/tests/test_server/fs_shutdown.c +++ b/lib9p/tests/test_server/fs_shutdown.c @@ -8,20 +8,19 @@ #include "fs_shutdown.h" -LO_IMPLEMENTATION_C(lib9p_srv_file, struct shutdown_file, shutdown_file, static); +LO_IMPLEMENTATION_C(lib9p_srv_file, struct shutdown_file, shutdown_file); struct shutdown_fio { struct shutdown_file *parent; }; -LO_IMPLEMENTATION_H(lib9p_srv_fio, struct shutdown_fio, shutdown_fio); -LO_IMPLEMENTATION_C(lib9p_srv_fio, struct shutdown_fio, shutdown_fio, static); +LO_IMPLEMENTATION_STATIC(lib9p_srv_fio, struct shutdown_fio, shutdown_fio); /* srv_file *******************************************************************/ -static void shutdown_file_free(struct shutdown_file *self) { +void shutdown_file_free(struct shutdown_file *self) { assert(self); } -static struct lib9p_qid shutdown_file_qid(struct shutdown_file *self) { +struct lib9p_qid shutdown_file_qid(struct shutdown_file *self) { assert(self); return (struct lib9p_qid){ .type = LIB9P_QT_FILE | LIB9P_QT_APPEND, @@ -30,7 +29,7 @@ static struct lib9p_qid shutdown_file_qid(struct shutdown_file *self) { }; } -static lib9p_srv_stat_or_error shutdown_file_stat(struct shutdown_file *self, struct lib9p_srv_ctx *ctx) { +lib9p_srv_stat_or_error shutdown_file_stat(struct shutdown_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); return ERROR_NEW_VAL(lib9p_srv_stat, ((struct lib9p_srv_stat){ @@ -46,20 +45,20 @@ static lib9p_srv_stat_or_error shutdown_file_stat(struct shutdown_file *self, st .extension = lib9p_str(NULL), })); } -static error shutdown_file_wstat(struct shutdown_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { +error shutdown_file_wstat(struct shutdown_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { assert(self); assert(ctx); return error_new(E_POSIX_EROFS, "cannot wstat API file"); } -static error shutdown_file_remove(struct shutdown_file *self, struct lib9p_srv_ctx *ctx) { +error shutdown_file_remove(struct shutdown_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); return error_new(E_POSIX_EROFS, "cannot remove API file"); } -LIB9P_SRV_NOTDIR(struct shutdown_file, shutdown_file); +LIB9P_SRV_NOTDIR(, struct shutdown_file, shutdown_file); -static lib9p_srv_fio_or_error shutdown_file_fopen(struct shutdown_file *self, struct lib9p_srv_ctx *ctx, bool, bool, bool) { +lib9p_srv_fio_or_error shutdown_file_fopen(struct shutdown_file *self, struct lib9p_srv_ctx *ctx, bool, bool, bool) { assert(self); assert(ctx); @@ -76,7 +75,7 @@ static void shutdown_fio_iofree(struct shutdown_fio *self) { free(self); } -static struct lib9p_qid shutdown_fio_qid(struct shutdown_fio *self) { +static struct lib9p_qid shutdown_fio_ioqid(struct shutdown_fio *self) { assert(self); return shutdown_file_qid(self->parent); } diff --git a/lib9p/tests/test_server/fs_whoami.c b/lib9p/tests/test_server/fs_whoami.c index 3cc0683..a282cae 100644 --- a/lib9p/tests/test_server/fs_whoami.c +++ b/lib9p/tests/test_server/fs_whoami.c @@ -12,15 +12,14 @@ #include "fs_whoami.h" -LO_IMPLEMENTATION_C(lib9p_srv_file, struct whoami_file, whoami_file, static); +LO_IMPLEMENTATION_C(lib9p_srv_file, struct whoami_file, whoami_file); struct whoami_fio { struct whoami_file *parent; size_t buf_len; char *buf; }; -LO_IMPLEMENTATION_H(lib9p_srv_fio, struct whoami_fio, whoami_fio); -LO_IMPLEMENTATION_C(lib9p_srv_fio, struct whoami_fio, whoami_fio, static); +LO_IMPLEMENTATION_STATIC(lib9p_srv_fio, struct whoami_fio, whoami_fio); size_t whoami_len(struct lib9p_srv_ctx *ctx) { assert(ctx); @@ -41,10 +40,10 @@ size_t whoami_len(struct lib9p_srv_ctx *ctx) { /* srv_file *******************************************************************/ -static void whoami_file_free(struct whoami_file *self) { +void whoami_file_free(struct whoami_file *self) { assert(self); } -static struct lib9p_qid whoami_file_qid(struct whoami_file *self) { +struct lib9p_qid whoami_file_qid(struct whoami_file *self) { assert(self); return (struct lib9p_qid){ .type = LIB9P_QT_FILE, @@ -53,7 +52,7 @@ static struct lib9p_qid whoami_file_qid(struct whoami_file *self) { }; } -static lib9p_srv_stat_or_error whoami_file_stat(struct whoami_file *self, struct lib9p_srv_ctx *ctx) { +lib9p_srv_stat_or_error whoami_file_stat(struct whoami_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); @@ -70,20 +69,20 @@ static lib9p_srv_stat_or_error whoami_file_stat(struct whoami_file *self, struct .extension = lib9p_str(NULL), })); } -static error whoami_file_wstat(struct whoami_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { +error whoami_file_wstat(struct whoami_file *self, struct lib9p_srv_ctx *ctx, struct lib9p_srv_stat) { assert(self); assert(ctx); return error_new(E_POSIX_EROFS, "cannot wstat API file"); } -static error whoami_file_remove(struct whoami_file *self, struct lib9p_srv_ctx *ctx) { +error whoami_file_remove(struct whoami_file *self, struct lib9p_srv_ctx *ctx) { assert(self); assert(ctx); return error_new(E_POSIX_EROFS, "cannot remove API file"); } -LIB9P_SRV_NOTDIR(struct whoami_file, whoami_file); +LIB9P_SRV_NOTDIR(, struct whoami_file, whoami_file); -static lib9p_srv_fio_or_error whoami_file_fopen(struct whoami_file *self, struct lib9p_srv_ctx *ctx, bool, bool, bool) { +lib9p_srv_fio_or_error whoami_file_fopen(struct whoami_file *self, struct lib9p_srv_ctx *ctx, bool, bool, bool) { assert(self); assert(ctx); @@ -104,7 +103,7 @@ static void whoami_fio_iofree(struct whoami_fio *self) { free(self); } -static struct lib9p_qid whoami_fio_qid(struct whoami_fio *self) { +static struct lib9p_qid whoami_fio_ioqid(struct whoami_fio *self) { assert(self); assert(self->parent); return whoami_file_qid(self->parent); diff --git a/lib9p/tests/test_server/main.c b/lib9p/tests/test_server/main.c index e28d19e..2519372 100644 --- a/lib9p/tests/test_server/main.c +++ b/lib9p/tests/test_server/main.c @@ -132,8 +132,7 @@ static COROUTINE init_cr(void *) { } struct tstlog_stdout {}; -LO_IMPLEMENTATION_H(fmt_dest, struct tstlog_stdout, tstlog_stdout); -LO_IMPLEMENTATION_C(fmt_dest, struct tstlog_stdout, tstlog_stdout, static); +LO_IMPLEMENTATION_STATIC(fmt_dest, struct tstlog_stdout, tstlog_stdout); static size_t tstlog_bytes = 0; |