Commit 44ef085b authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Ben Walker
Browse files

event: pass arg1 and arg2 directly to event fn



This allows the elimination of the spdk_event_get_arg1() and
spdk_event_get_arg2() macros, which accessed the event structure
directly; this was preventing the event structure definition from being
moved out of the public API header.

Change-Id: I74eced799ad7df61ff0b1390c63fb533e3fae8eb
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 3d528833
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ usage(char *executable_name)
}

static void
spdk_startup(spdk_event_t event)
spdk_startup(void *arg1, void *arg2)
{
	if (getenv("MEMZONE_DUMP") != NULL) {
		spdk_memzone_dump(stdout);
+10 −10
Original line number Diff line number Diff line
@@ -64,9 +64,9 @@ shutdown_complete(void)
}

static void
subsystem_delete_event(struct spdk_event *event)
subsystem_delete_event(void *arg1, void *arg2)
{
	struct nvmf_tgt_subsystem *app_subsys = spdk_event_get_arg1(event);
	struct nvmf_tgt_subsystem *app_subsys = arg1;
	struct spdk_nvmf_subsystem *subsystem = app_subsys->subsystem;

	TAILQ_REMOVE(&g_subsystems, app_subsys, tailq);
@@ -116,7 +116,7 @@ shutdown_subsystems(void)
}

static void
acceptor_poller_unregistered_event(struct spdk_event *event)
acceptor_poller_unregistered_event(void *arg1, void *arg2)
{
	spdk_nvmf_tgt_fini();
	shutdown_subsystems();
@@ -145,9 +145,9 @@ subsystem_poll(void *arg)
}

static void
connect_event(struct spdk_event *event)
connect_event(void *arg1, void *arg2)
{
	struct spdk_nvmf_request *req = spdk_event_get_arg1(event);
	struct spdk_nvmf_request *req = arg1;

	spdk_nvmf_handle_connect(req);
}
@@ -164,9 +164,9 @@ connect_cb(void *cb_ctx, struct spdk_nvmf_request *req)
}

static void
disconnect_event(struct spdk_event *event)
disconnect_event(void *arg1, void *arg2)
{
	struct spdk_nvmf_conn *conn = spdk_event_get_arg1(event);
	struct spdk_nvmf_conn *conn = arg1;

	spdk_nvmf_session_disconnect(conn);
}
@@ -183,9 +183,9 @@ disconnect_cb(void *cb_ctx, struct spdk_nvmf_conn *conn)
}

static void
_nvmf_tgt_start_subsystem(struct spdk_event *event)
_nvmf_tgt_start_subsystem(void *arg1, void *arg2)
{
	struct nvmf_tgt_subsystem *app_subsys = spdk_event_get_arg1(event);
	struct nvmf_tgt_subsystem *app_subsys = arg1;
	struct spdk_nvmf_subsystem *subsystem = app_subsys->subsystem;
	struct spdk_bdev *bdev;
	struct spdk_io_channel *ch;
@@ -326,7 +326,7 @@ acceptor_poll(void *arg)
}

static void
spdk_nvmf_startup(spdk_event_t event)
spdk_nvmf_startup(void *arg1, void *arg2)
{
	int rc;

+1 −4
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@
#include "spdk/queue.h"

typedef struct spdk_event *spdk_event_t;
typedef void (*spdk_event_fn)(spdk_event_t);
typedef void (*spdk_event_fn)(void *arg1, void *arg2);

/**
 * \brief An event is a function that is passed to and called on an lcore.
@@ -214,9 +214,6 @@ spdk_event_t spdk_event_allocate(uint32_t lcore, spdk_event_fn fn,
 */
void spdk_event_call(spdk_event_t event);

#define spdk_event_get_arg1(event)	(event)->arg1
#define spdk_event_get_arg2(event)	(event)->arg2

/* TODO: This is only used by tests and should be made private */
uint32_t spdk_event_queue_run_batch(uint32_t lcore);

+1 −1
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ __shutdown_signal(int signo)
}

static void
__shutdown_event_cb(spdk_event_t event)
__shutdown_event_cb(void *arg1, void *arg2)
{
	g_spdk_app.shutdown_cb();
}
+9 −9
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ spdk_event_queue_run_batch(uint32_t lcore)
	for (i = 0; i < count; i++) {
		struct spdk_event *event = events[i];

		event->fn(event);
		event->fn(event->arg1, event->arg2);
	}

	spdk_mempool_put_bulk(g_spdk_event_mempool[socket_id], events, count);
@@ -635,10 +635,10 @@ _spdk_poller_register(struct spdk_reactor *reactor, struct spdk_poller *poller)
}

static void
_spdk_event_add_poller(spdk_event_t event)
_spdk_event_add_poller(void *arg1, void *arg2)
{
	struct spdk_reactor *reactor = spdk_event_get_arg1(event);
	struct spdk_poller *poller = spdk_event_get_arg2(event);
	struct spdk_reactor *reactor = arg1;
	struct spdk_poller *poller = arg2;

	_spdk_poller_register(reactor, poller);
}
@@ -719,11 +719,11 @@ _spdk_poller_unregister(struct spdk_reactor *reactor, struct spdk_poller *poller
}

static void
_spdk_event_remove_poller(spdk_event_t event)
_spdk_event_remove_poller(void *arg1, void *arg2)
{
	struct spdk_poller *poller = spdk_event_get_arg1(event);
	struct spdk_poller *poller = arg1;
	struct spdk_reactor *reactor = spdk_reactor_get(poller->lcore);
	struct spdk_event *next = event->next;
	struct spdk_event *next = arg2;

	_spdk_poller_unregister(reactor, poller, next);
}
@@ -759,7 +759,7 @@ spdk_poller_unregister(struct spdk_poller **ppoller,
		 * The poller is registered on a different core.
		 * Schedule an event to run on the poller's core that will remove the poller.
		 */
		spdk_event_call(spdk_event_allocate(lcore, _spdk_event_remove_poller, poller, NULL,
						    complete));
		spdk_event_call(spdk_event_allocate(lcore, _spdk_event_remove_poller, poller, complete,
						    NULL));
	}
}
Loading