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 <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/424270
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Ben Walker 2018-08-31 13:39:11 -07:00
parent bfc5b558fa
commit 5bc5f86408
3 changed files with 11 additions and 5 deletions

View File

@ -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
}

View File

@ -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);

View File

@ -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