Skip to content

Commit

Permalink
event: spdk_app_start now takes spdk_msg_fn
Browse files Browse the repository at this point in the history
This callback type takes 1 argument instead of 2.

Change-Id: Ic3710fafb2828f08fc064f7658849b3d20521092
Signed-off-by: Ben Walker <[email protected]>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446997
Tested-by: SPDK CI Jenkins <[email protected]>
Reviewed-by: Jim Harris <[email protected]>
Reviewed-by: Shuhei Matsumoto <[email protected]>
  • Loading branch information
Ben Walker committed Mar 19, 2019
1 parent b3fc4e7 commit deb8ee5
Show file tree
Hide file tree
Showing 20 changed files with 38 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/iscsi_tgt/iscsi_tgt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion app/nvmf_tgt/nvmf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion app/spdk_tgt/spdk_tgt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion app/vhost/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ vhost_parse_arg(int ch, char *arg)
}

static void
vhost_started(void *arg1, void *arg2)
vhost_started(void *arg1)
{
}

Expand Down
2 changes: 1 addition & 1 deletion examples/bdev/hello_world/hello_bdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions examples/blob/cli/blobcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion examples/blob/hello_world/hello_blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion examples/sock/hello_world/hello_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
23 changes: 13 additions & 10 deletions include/spdk/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "spdk/cpuset.h"
#include "spdk/queue.h"
#include "spdk/log.h"
#include "spdk/thread.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions lib/event/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions lib/rocksdb/env_spdk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion test/app/bdev_svc/bdev_svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/app/stub/stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion test/bdev/bdevio/bdevio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion test/bdev/bdevperf/bdevperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ bdevperf_construct_targets_tasks(void)
}

static void
bdevperf_run(void *arg1, void *arg2)
bdevperf_run(void *arg1)
{
uint32_t i;
struct io_target *target;
Expand Down
2 changes: 1 addition & 1 deletion test/blobfs/fuse/fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/blobfs/mkfs/mkfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/event/event_perf/event_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion test/event/reactor/reactor.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ nop(void *arg)
}

static void
test_start(void *arg1, void *arg2)
test_start(void *arg1)
{
printf("test_start\n");

Expand Down
2 changes: 1 addition & 1 deletion test/event/reactor_perf/reactor_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ __submit_next(void *arg1, void *arg2)
}

static void
test_start(void *arg1, void *arg2)
test_start(void *arg1)
{
int i;

Expand Down

0 comments on commit deb8ee5

Please sign in to comment.