Commit 7b940538 authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

thread: Rename spdk_thread_msg to spdk_msg_fn



This is the callback type used for message passing. The
old name is easy to confuse with the callback to pass
a message to a thread or the upcoming callback to
spawn a thread.

Change-Id: I5fd63b57c4be2a4262a197850e6de4901be03ee7
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/435941


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 978725c0
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -51,11 +51,11 @@ struct spdk_io_channel_iter;
struct spdk_poller;

/**
 * Callback function for a thread.
 * A function that will be called on the target thread.
 *
 * \param ctx Context passed as arg to spdk_thread_pass_msg().
 */
typedef void (*spdk_thread_fn)(void *ctx);
typedef void (*spdk_msg_fn)(void *ctx);

/**
 * Function to be called to pass a message to a thread.
@@ -64,7 +64,7 @@ typedef void (*spdk_thread_fn)(void *ctx);
 * \param ctx Context passed to fn.
 * \param thread_ctx Context for the thread.
 */
typedef void (*spdk_thread_pass_msg)(spdk_thread_fn fn, void *ctx,
typedef void (*spdk_thread_pass_msg)(spdk_msg_fn fn, void *ctx,
				     void *thread_ctx);

/**
@@ -179,7 +179,7 @@ void spdk_thread_lib_fini(void);
 * Initializes the calling thread for I/O channel allocation.
 *
 * \param msg_fn A function that may be called from any thread and is passed a function
 * pointer (spdk_thread_fn) that must be called on the same thread that spdk_allocate_thread
 * pointer (spdk_msg_fn) that must be called on the same thread that spdk_allocate_thread
 * was called from.
 * DEPRECATED. Only used in tests. Pass NULL for this parameter.
 * \param start_poller_fn Function to be called to start a poller for the thread.
@@ -267,7 +267,7 @@ const char *spdk_thread_get_name(const struct spdk_thread *thread);
 * \param fn This function will be called on the given thread.
 * \param ctx This context will be passed to fn when called.
 */
void spdk_thread_send_msg(const struct spdk_thread *thread, spdk_thread_fn fn, void *ctx);
void spdk_thread_send_msg(const struct spdk_thread *thread, spdk_msg_fn fn, void *ctx);

/**
 * Send a message to each thread, serially.
@@ -280,7 +280,7 @@ void spdk_thread_send_msg(const struct spdk_thread *thread, spdk_thread_fn fn, v
 * \param cpl This will be called on the originating thread after `fn` has been
 * called on each thread.
 */
void spdk_for_each_thread(spdk_thread_fn fn, void *ctx, spdk_thread_fn cpl);
void spdk_for_each_thread(spdk_msg_fn fn, void *ctx, spdk_msg_fn cpl);

/**
 * Register a poller on the current thread.
+2 −2
Original line number Diff line number Diff line
@@ -1142,7 +1142,7 @@ spdk_bdev_nvme_set_opts(const struct spdk_bdev_nvme_opts *opts)
struct set_nvme_hotplug_ctx {
	uint64_t period_us;
	bool enabled;
	spdk_thread_fn fn;
	spdk_msg_fn fn;
	void *fn_ctx;
};

@@ -1166,7 +1166,7 @@ set_nvme_hotplug_period_cb(void *_ctx)
}

int
spdk_bdev_nvme_set_hotplug(bool enabled, uint64_t period_us, spdk_thread_fn cb, void *cb_ctx)
spdk_bdev_nvme_set_hotplug(bool enabled, uint64_t period_us, spdk_msg_fn cb, void *cb_ctx)
{
	struct set_nvme_hotplug_ctx *ctx;

+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ struct nvme_ctrlr *spdk_bdev_nvme_first_ctrlr(void);
struct nvme_ctrlr *spdk_bdev_nvme_next_ctrlr(struct nvme_ctrlr *prev);
void spdk_bdev_nvme_get_opts(struct spdk_bdev_nvme_opts *opts);
int spdk_bdev_nvme_set_opts(const struct spdk_bdev_nvme_opts *opts);
int spdk_bdev_nvme_set_hotplug(bool enabled, uint64_t period_us, spdk_thread_fn cb, void *cb_ctx);
int spdk_bdev_nvme_set_hotplug(bool enabled, uint64_t period_us, spdk_msg_fn cb, void *cb_ctx);

int spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid,
			  const char *base_name,
+1 −1
Original line number Diff line number Diff line
@@ -911,7 +911,7 @@ bdev_virtio_tmf_abort_ioerr_cb(void *ctx)
static void
bdev_virtio_tmf_abort(struct spdk_bdev_io *bdev_io, int status)
{
	spdk_thread_fn fn;
	spdk_msg_fn fn;

	if (status == -ENOMEM) {
		fn = bdev_virtio_tmf_abort_nomem_cb;
+1 −1
Original line number Diff line number Diff line
@@ -1228,7 +1228,7 @@ iscsi_unregister_poll_group(void *ctx)
}

static void
spdk_initialize_iscsi_poll_group(spdk_thread_fn cpl)
spdk_initialize_iscsi_poll_group(spdk_msg_fn cpl)
{
	size_t g_num_poll_groups = spdk_env_get_last_core() + 1;

Loading