From 5bc5f864089b99c7335667cafb3df4a182901f46 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Fri, 31 Aug 2018 13:39:11 -0700 Subject: [PATCH] nbd: Encapsulate spdk_event usage in subsystem module Events are part of the SPDK event framework and should be isolated inside lib/event. Change-Id: I8e9a5250bcbb9dd891f98df3177a6b5370a65fe3 Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/424270 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Shuhei Matsumoto Reviewed-by: Changpeng Liu --- include/spdk/nbd.h | 3 +-- lib/event/subsystems/nbd/nbd.c | 10 +++++++++- lib/nbd/nbd.c | 3 +-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/spdk/nbd.h b/include/spdk/nbd.h index 584dd0652..d987c1c4b 100644 --- a/include/spdk/nbd.h +++ b/include/spdk/nbd.h @@ -81,9 +81,8 @@ void spdk_nbd_stop(struct spdk_nbd_disk *nbd); * Write NBD subsystem configuration into provided JSON context. * * \param w JSON write context - * \param done_ev call this event when done. */ -void spdk_nbd_write_config_json(struct spdk_json_write_ctx *w, struct spdk_event *done_ev); +void spdk_nbd_write_config_json(struct spdk_json_write_ctx *w); #ifdef __cplusplus } diff --git a/lib/event/subsystems/nbd/nbd.c b/lib/event/subsystems/nbd/nbd.c index 767364462..a943eb82f 100644 --- a/lib/event/subsystems/nbd/nbd.c +++ b/lib/event/subsystems/nbd/nbd.c @@ -54,12 +54,20 @@ spdk_nbd_subsystem_fini(void) spdk_subsystem_fini_next(); } +static void +spdk_nbd_subsystem_write_config_json(struct spdk_json_write_ctx *w, + struct spdk_event *done_ev) +{ + spdk_nbd_write_config_json(w); + spdk_event_call(done_ev); +} + static struct spdk_subsystem g_spdk_subsystem_nbd = { .name = "nbd", .init = spdk_nbd_subsystem_init, .fini = spdk_nbd_subsystem_fini, .config = NULL, - .write_config_json = spdk_nbd_write_config_json, + .write_config_json = spdk_nbd_subsystem_write_config_json, }; SPDK_SUBSYSTEM_REGISTER(g_spdk_subsystem_nbd); diff --git a/lib/nbd/nbd.c b/lib/nbd/nbd.c index ad635ff4d..fc7726a44 100644 --- a/lib/nbd/nbd.c +++ b/lib/nbd/nbd.c @@ -211,7 +211,7 @@ spdk_nbd_disk_get_bdev_name(struct spdk_nbd_disk *nbd) } void -spdk_nbd_write_config_json(struct spdk_json_write_ctx *w, struct spdk_event *done_ev) +spdk_nbd_write_config_json(struct spdk_json_write_ctx *w) { struct spdk_nbd_disk *nbd; @@ -231,7 +231,6 @@ spdk_nbd_write_config_json(struct spdk_json_write_ctx *w, struct spdk_event *don } spdk_json_write_array_end(w); - spdk_event_call(done_ev); } void