diff --git a/app/iscsi_tgt/iscsi_tgt.c b/app/iscsi_tgt/iscsi_tgt.c index 1dbc606d7..b780a3771 100644 --- a/app/iscsi_tgt/iscsi_tgt.c +++ b/app/iscsi_tgt/iscsi_tgt.c @@ -63,7 +63,7 @@ iscsi_usage(void) } static void -spdk_startup(void *arg1, void *arg2) +spdk_startup(void *arg1) { if (getenv("MEMZONE_DUMP") != NULL) { spdk_memzone_dump(stdout); diff --git a/app/nvmf_tgt/nvmf_main.c b/app/nvmf_tgt/nvmf_main.c index da079d481..87e402149 100644 --- a/app/nvmf_tgt/nvmf_main.c +++ b/app/nvmf_tgt/nvmf_main.c @@ -48,7 +48,7 @@ nvmf_parse_arg(int ch, char *arg) } static void -nvmf_tgt_started(void *arg1, void *arg2) +nvmf_tgt_started(void *arg1) { if (getenv("MEMZONE_DUMP") != NULL) { spdk_memzone_dump(stdout); diff --git a/app/spdk_tgt/spdk_tgt.c b/app/spdk_tgt/spdk_tgt.c index b30e552c0..2dde2f47f 100644 --- a/app/spdk_tgt/spdk_tgt.c +++ b/app/spdk_tgt/spdk_tgt.c @@ -96,7 +96,7 @@ spdk_tgt_parse_arg(int ch, char *arg) } static void -spdk_tgt_started(void *arg1, void *arg2) +spdk_tgt_started(void *arg1) { if (g_pid_path) { spdk_tgt_save_pid(g_pid_path); diff --git a/app/vhost/vhost.c b/app/vhost/vhost.c index 5bae19be6..4457edd7d 100644 --- a/app/vhost/vhost.c +++ b/app/vhost/vhost.c @@ -79,7 +79,7 @@ vhost_parse_arg(int ch, char *arg) } static void -vhost_started(void *arg1, void *arg2) +vhost_started(void *arg1) { } diff --git a/examples/bdev/hello_world/hello_bdev.c b/examples/bdev/hello_world/hello_bdev.c index 29164dfa4..92e977ef2 100644 --- a/examples/bdev/hello_world/hello_bdev.c +++ b/examples/bdev/hello_world/hello_bdev.c @@ -188,7 +188,7 @@ hello_write(void *arg) * Our initial event that kicks off everything from main(). */ static void -hello_start(void *arg1, void *arg2) +hello_start(void *arg1) { struct hello_context_t *hello_context = arg1; uint32_t blk_size, buf_align; diff --git a/examples/blob/cli/blobcli.c b/examples/blob/cli/blobcli.c index 7b9948e41..e52b77561 100644 --- a/examples/blob/cli/blobcli.c +++ b/examples/blob/cli/blobcli.c @@ -49,7 +49,7 @@ * include it here. */ #include "../lib/blob/blobstore.h" -static void cli_start(void *arg1, void *arg2); +static void cli_start(void *arg1); static const char *program_name = "blobcli"; /* default name for .conf file, any name can be used however with -c switch */ @@ -233,7 +233,7 @@ unload_complete(void *cb_arg, int bserrno) /* when action is CLI_NONE, we know we need to remain in the shell */ cli_context->bs = NULL; cli_context->action = CLI_NONE; - cli_start(cli_context, NULL); + cli_start(cli_context); } } @@ -912,7 +912,7 @@ list_bdevs(struct cli_context_t *cli_context) spdk_app_stop(0); } else { cli_context->action = CLI_NONE; - cli_start(cli_context, NULL); + cli_start(cli_context); } } @@ -973,7 +973,7 @@ spdk_bsdump_done(void *arg, int bserrno) spdk_app_stop(0); } else { cli_context->action = CLI_NONE; - cli_start(cli_context, NULL); + cli_start(cli_context); } } @@ -1424,7 +1424,7 @@ cli_shell(void *arg1, void *arg2) * called first. */ static void -cli_start(void *arg1, void *arg2) +cli_start(void *arg1) { struct cli_context_t *cli_context = arg1; diff --git a/examples/blob/hello_world/hello_blob.c b/examples/blob/hello_world/hello_blob.c index 9e607610f..02207678c 100644 --- a/examples/blob/hello_world/hello_blob.c +++ b/examples/blob/hello_world/hello_blob.c @@ -395,7 +395,7 @@ bs_init_complete(void *cb_arg, struct spdk_blob_store *bs, * Our initial event that kicks off everything from main(). */ static void -hello_start(void *arg1, void *arg2) +hello_start(void *arg1) { struct hello_context_t *hello_context = arg1; struct spdk_bdev *bdev = NULL; diff --git a/examples/sock/hello_world/hello_sock.c b/examples/sock/hello_world/hello_sock.c index 5c2a71e79..b3dc5e792 100644 --- a/examples/sock/hello_world/hello_sock.c +++ b/examples/sock/hello_world/hello_sock.c @@ -407,7 +407,7 @@ hello_start(void *arg1, int rc) } static void -start_net_framework(void *arg1, void *arg2) +start_net_framework(void *arg1) { spdk_net_framework_start(hello_start, arg1); } diff --git a/include/spdk/event.h b/include/spdk/event.h index cc59c683f..0260cc215 100644 --- a/include/spdk/event.h +++ b/include/spdk/event.h @@ -46,6 +46,7 @@ #include "spdk/cpuset.h" #include "spdk/queue.h" #include "spdk/log.h" +#include "spdk/thread.h" #ifdef __cplusplus extern "C" { @@ -140,21 +141,23 @@ void spdk_app_opts_init(struct spdk_app_opts *opts); /** * Start the framework. * - * Before calling this function, the fields of opts must be initialized by - * spdk_app_opts_init(). Once started, the framework will call start_fn on the - * master core with the arguments provided. This call will block until spdk_app_stop() - * is called, or if an error condition occurs during the intialization - * code within spdk_app_start(), itself, before invoking the caller's - * supplied function. + * Before calling this function, opts must be initialized by + * spdk_app_opts_init(). Once started, the framework will call start_fn on + * an spdk_thread running on the current system thread with the + * argument provided. This call will block until spdk_app_stop() + * is called. If an error condition occurs during the intialization + * code within spdk_app_start(), this function will immediately return + * before invoking start_fn. * * \param opts Initialization options used for this application. - * \param start_fn Event function that is called when the framework starts. - * \param arg1 Argument passed to function start_fn. + * \param start_fn Entry point that will execute on an internally created thread + * once the framework has been started. + * \param ctx Argument passed to function start_fn. * * \return 0 on success or non-zero on failure. */ -int spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn, - void *arg1); +int spdk_app_start(struct spdk_app_opts *opts, spdk_msg_fn start_fn, + void *ctx); /** * Perform final shutdown operations on an application using the event framework. diff --git a/lib/event/app.c b/lib/event/app.c index a10f266a2..0b17fb8ff 100644 --- a/lib/event/app.c +++ b/lib/event/app.c @@ -67,7 +67,7 @@ struct spdk_app { }; static struct spdk_app g_spdk_app; -static spdk_event_fn g_start_fn = NULL; +static spdk_msg_fn g_start_fn = NULL; static void *g_start_arg = NULL; static struct spdk_event *g_shutdown_event = NULL; static uint32_t g_init_lcore; @@ -352,7 +352,7 @@ spdk_app_start_application(void) assert(spdk_env_get_current_core() == g_init_lcore); - g_start_fn(g_start_arg, NULL); + g_start_fn(g_start_arg); } static void @@ -574,7 +574,7 @@ bootstrap_fn(void *arg1, void *arg2) } int -spdk_app_start(struct spdk_app_opts *opts, spdk_event_fn start_fn, +spdk_app_start(struct spdk_app_opts *opts, spdk_msg_fn start_fn, void *arg1) { struct spdk_conf *config = NULL; diff --git a/lib/rocksdb/env_spdk.cc b/lib/rocksdb/env_spdk.cc index 91d9da5ab..748e6df61 100644 --- a/lib/rocksdb/env_spdk.cc +++ b/lib/rocksdb/env_spdk.cc @@ -623,8 +623,7 @@ fs_load_cb(__attribute__((unused)) void *ctx, } static void -spdk_rocksdb_run(__attribute__((unused)) void *arg1, - __attribute__((unused)) void *arg2) +spdk_rocksdb_run(__attribute__((unused)) void *arg1) { struct spdk_bdev *bdev; diff --git a/test/app/bdev_svc/bdev_svc.c b/test/app/bdev_svc/bdev_svc.c index 946fa1d82..84580d3f6 100644 --- a/test/app/bdev_svc/bdev_svc.c +++ b/test/app/bdev_svc/bdev_svc.c @@ -51,7 +51,7 @@ bdev_svc_parse_arg(int ch, char *arg) } static void -bdev_svc_start(void *arg1, void *arg2) +bdev_svc_start(void *arg1) { int fd; int shm_id = (intptr_t)arg1; diff --git a/test/app/stub/stub.c b/test/app/stub/stub.c index 5defa73c4..2b525f40d 100644 --- a/test/app/stub/stub.c +++ b/test/app/stub/stub.c @@ -80,7 +80,7 @@ stub_sleep(void *arg) } static void -stub_start(void *arg1, void *arg2) +stub_start(void *arg1) { int shm_id = (intptr_t)arg1; diff --git a/test/bdev/bdevio/bdevio.c b/test/bdev/bdevio/bdevio.c index ffef2c3b8..9e7b7ed47 100644 --- a/test/bdev/bdevio/bdevio.c +++ b/test/bdev/bdevio/bdevio.c @@ -912,7 +912,7 @@ __run_ut_thread(void *arg1, void *arg2) } static void -test_main(void *arg1, void *arg2) +test_main(void *arg1) { struct spdk_event *event; diff --git a/test/bdev/bdevperf/bdevperf.c b/test/bdev/bdevperf/bdevperf.c index 88d6b1443..64e90ae43 100644 --- a/test/bdev/bdevperf/bdevperf.c +++ b/test/bdev/bdevperf/bdevperf.c @@ -862,7 +862,7 @@ ret: } static void -bdevperf_run(void *arg1, void *arg2) +bdevperf_run(void *arg1) { uint32_t i; struct io_target *target; diff --git a/test/blobfs/fuse/fuse.c b/test/blobfs/fuse/fuse.c index 13b956eaa..7e1ff6d24 100644 --- a/test/blobfs/fuse/fuse.c +++ b/test/blobfs/fuse/fuse.c @@ -298,7 +298,7 @@ init_cb(void *ctx, struct spdk_filesystem *fs, int fserrno) } static void -spdk_fuse_run(void *arg1, void *arg2) +spdk_fuse_run(void *arg1) { construct_targets(); spdk_fs_load(g_bs_dev, __send_request, init_cb, NULL); diff --git a/test/blobfs/mkfs/mkfs.c b/test/blobfs/mkfs/mkfs.c index 8d1ee7166..7a186766a 100644 --- a/test/blobfs/mkfs/mkfs.c +++ b/test/blobfs/mkfs/mkfs.c @@ -69,7 +69,7 @@ init_cb(void *ctx, struct spdk_filesystem *fs, int fserrno) } static void -spdk_mkfs_run(void *arg1, void *arg2) +spdk_mkfs_run(void *arg1) { struct spdk_bdev *bdev; struct spdk_blobfs_opts blobfs_opt; diff --git a/test/event/event_perf/event_perf.c b/test/event/event_perf/event_perf.c index a2f61f733..fe44e604d 100644 --- a/test/event/event_perf/event_perf.c +++ b/test/event/event_perf/event_perf.c @@ -85,7 +85,7 @@ event_work_fn(void *arg1, void *arg2) } static void -event_perf_start(void *arg1, void *arg2) +event_perf_start(void *arg1) { uint32_t i; diff --git a/test/event/reactor/reactor.c b/test/event/reactor/reactor.c index 97db5ef41..260ba5a02 100644 --- a/test/event/reactor/reactor.c +++ b/test/event/reactor/reactor.c @@ -85,7 +85,7 @@ nop(void *arg) } static void -test_start(void *arg1, void *arg2) +test_start(void *arg1) { printf("test_start\n"); diff --git a/test/event/reactor_perf/reactor_perf.c b/test/event/reactor_perf/reactor_perf.c index 0a4e1a7e5..e4287f3ed 100644 --- a/test/event/reactor_perf/reactor_perf.c +++ b/test/event/reactor_perf/reactor_perf.c @@ -64,7 +64,7 @@ __submit_next(void *arg1, void *arg2) } static void -test_start(void *arg1, void *arg2) +test_start(void *arg1) { int i;