Commit 19100ed5 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

bdev: rename spdk_bdev_module_if -> spdk_bdev_module



This better matches the style in the rest of SPDK.

No functional change - this is a pure find/replace of
spdk_bdev_module_if to spdk_bdev_module.  Instances of this struct will
be renamed in another patch.

Change-Id: I3f6933c8a366e625fc3a1b6401aee26ee03ba69c
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403368


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent c25402c5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -27,14 +27,14 @@ starting point is to copy the existing 'null' bdev module.
The primary interface that bdev modules will interact with is in
include/spdk_internal/bdev.h. In that header a macro is defined that registers
a new bdev module - SPDK_BDEV_MODULE_REGISTER. This macro take as argument a
pointer spdk_bdev_module_if structure that is used to register new bdev module.
pointer spdk_bdev_module structure that is used to register new bdev module.

The spdk_bdev_module_if structure describes the module properties like
The spdk_bdev_module structure describes the module properties like
initialization (`module_init`) and teardown (`module_fini`) functions,
the function that returns context size (`get_ctx_size`) - scratch space that
will be allocated in each I/O request for use by this module, and a callback
that will be called each time a new bdev is registered by another module
(`examine`). Please check the documentation of struct spdk_bdev_module_if for
(`examine`). Please check the documentation of struct spdk_bdev_module for
more details.

## Creating Bdevs
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ extern "C" {

struct spdk_bs_dev;
struct spdk_bdev;
struct spdk_bdev_module_if;
struct spdk_bdev_module;

/**
 * Create a blobstore block device from a bdev.
@@ -69,7 +69,7 @@ struct spdk_bs_dev *spdk_bdev_create_bs_dev(struct spdk_bdev *bdev, spdk_bdev_re
 *
 * \return 0 on success, negative errno on failure.
 */
int spdk_bs_bdev_claim(struct spdk_bs_dev *bs_dev, struct spdk_bdev_module_if *module);
int spdk_bs_bdev_claim(struct spdk_bs_dev *bs_dev, struct spdk_bdev_module *module);

#ifdef __cplusplus
}
+12 −12
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@
 */

/** Block device module */
struct spdk_bdev_module_if {
struct spdk_bdev_module {
	/**
	 * Initialization function for the module.  Called by the spdk
	 * application during startup.
@@ -138,7 +138,7 @@ struct spdk_bdev_module_if {
	 */
	bool async_fini;

	TAILQ_ENTRY(spdk_bdev_module_if) tailq;
	TAILQ_ENTRY(spdk_bdev_module) tailq;
};

typedef void (*spdk_bdev_unregister_cb)(void *cb_arg, int rc);
@@ -257,7 +257,7 @@ struct spdk_bdev {
	/**
	 * Pointer to the bdev module that registered this bdev.
	 */
	struct spdk_bdev_module_if *module;
	struct spdk_bdev_module *module;

	/** function table for all LUN ops */
	const struct spdk_bdev_fn_table *fn_table;
@@ -282,7 +282,7 @@ struct spdk_bdev {
	 * Pointer to the module that has claimed this bdev for purposes of creating virtual
	 *  bdevs on top of it.  Set to NULL if the bdev has not been claimed.
	 */
	struct spdk_bdev_module_if *claim_module;
	struct spdk_bdev_module *claim_module;

	/** Callback function that will be called after bdev destruct is completed. */
	spdk_bdev_unregister_cb	unregister_cb;
@@ -439,11 +439,11 @@ void spdk_bdev_unregister_done(struct spdk_bdev *bdev, int bdeverrno);
int spdk_vbdev_register(struct spdk_bdev *vbdev, struct spdk_bdev **base_bdevs,
			int base_bdev_count);

void spdk_bdev_module_examine_done(struct spdk_bdev_module_if *module);
void spdk_bdev_module_init_done(struct spdk_bdev_module_if *module);
void spdk_bdev_module_examine_done(struct spdk_bdev_module *module);
void spdk_bdev_module_init_done(struct spdk_bdev_module *module);
void spdk_bdev_module_finish_done(void);
int spdk_bdev_module_claim_bdev(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc,
				struct spdk_bdev_module_if *module);
				struct spdk_bdev_module *module);
void spdk_bdev_module_release_bdev(struct spdk_bdev *bdev);

/**
@@ -542,7 +542,7 @@ int spdk_bdev_notify_blockcnt_change(struct spdk_bdev *bdev, uint64_t size);
void spdk_scsi_nvme_translate(const struct spdk_bdev_io *bdev_io,
			      int *sc, int *sk, int *asc, int *ascq);

void spdk_bdev_module_list_add(struct spdk_bdev_module_if *bdev_module);
void spdk_bdev_module_list_add(struct spdk_bdev_module *bdev_module);

/**
 * Find registered module with name pointed by \c name.
@@ -550,7 +550,7 @@ void spdk_bdev_module_list_add(struct spdk_bdev_module_if *bdev_module);
 * \param name name of module to be searched for.
 * \return pointer to module or NULL if no module with \c name exist
 */
struct spdk_bdev_module_if *spdk_bdev_module_list_find(const char *name);
struct spdk_bdev_module *spdk_bdev_module_list_find(const char *name);

static inline struct spdk_bdev_io *
spdk_bdev_io_from_ctx(void *ctx)
@@ -570,7 +570,7 @@ struct spdk_bdev_part_base {
	uint32_t			channel_size;
	spdk_bdev_part_base_free_fn	base_free_fn;
	bool				claimed;
	struct spdk_bdev_module_if	*module;
	struct spdk_bdev_module		*module;
	struct spdk_bdev_fn_table	*fn_table;
	struct bdev_part_tailq		*tailq;
	spdk_io_channel_create_cb	ch_create_cb;
@@ -596,7 +596,7 @@ void spdk_bdev_part_free(struct spdk_bdev_part *part);
void spdk_bdev_part_base_hotremove(struct spdk_bdev *base_bdev, struct bdev_part_tailq *tailq);
int spdk_bdev_part_base_construct(struct spdk_bdev_part_base *base, struct spdk_bdev *bdev,
				  spdk_bdev_remove_cb_t remove_cb,
				  struct spdk_bdev_module_if *module,
				  struct spdk_bdev_module *module,
				  struct spdk_bdev_fn_table *fn_table,
				  struct bdev_part_tailq *tailq,
				  spdk_bdev_part_base_free_fn free_fn,
@@ -628,6 +628,6 @@ void spdk_bdev_part_submit_request(struct spdk_bdev_part_channel *ch, struct spd
/*
 *  Second helper macro for "stringize" trick to work.
 */
#define SPDK_BDEV_MODULE_REGISTER_FN_NAME_(line) spdk_bdev_module_if_register_ ## line
#define SPDK_BDEV_MODULE_REGISTER_FN_NAME_(line) spdk_bdev_module_register_ ## line

#endif /* SPDK_INTERNAL_BDEV_H */
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ bdev_aio_get_ctx_size(void)
	return sizeof(struct bdev_aio_task);
}

static struct spdk_bdev_module_if aio_if = {
static struct spdk_bdev_module aio_if = {
	.name		= "aio",
	.module_init	= bdev_aio_initialize,
	.module_fini	= NULL,
+15 −15
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ struct spdk_bdev_mgr {

	void *zero_buffer;

	TAILQ_HEAD(, spdk_bdev_module_if) bdev_modules;
	TAILQ_HEAD(, spdk_bdev_module) bdev_modules;

	TAILQ_HEAD(, spdk_bdev) bdevs;

@@ -396,7 +396,7 @@ spdk_bdev_io_get_buf(struct spdk_bdev_io *bdev_io, spdk_bdev_io_get_buf_cb cb, u
static int
spdk_bdev_module_get_max_ctx_size(void)
{
	struct spdk_bdev_module_if *bdev_module;
	struct spdk_bdev_module *bdev_module;
	int max_bdev_module_size = 0;

	TAILQ_FOREACH(bdev_module, &g_bdev_mgr.bdev_modules, tailq) {
@@ -411,7 +411,7 @@ spdk_bdev_module_get_max_ctx_size(void)
void
spdk_bdev_config_text(FILE *fp)
{
	struct spdk_bdev_module_if *bdev_module;
	struct spdk_bdev_module *bdev_module;

	TAILQ_FOREACH(bdev_module, &g_bdev_mgr.bdev_modules, tailq) {
		if (bdev_module->config_text) {
@@ -479,7 +479,7 @@ spdk_bdev_init_complete(int rc)
static void
spdk_bdev_module_action_complete(void)
{
	struct spdk_bdev_module_if *m;
	struct spdk_bdev_module *m;

	/*
	 * Don't finish bdev subsystem initialization if
@@ -510,7 +510,7 @@ spdk_bdev_module_action_complete(void)
}

static void
spdk_bdev_module_action_done(struct spdk_bdev_module_if *module)
spdk_bdev_module_action_done(struct spdk_bdev_module *module)
{
	assert(module->action_in_progress > 0);
	module->action_in_progress--;
@@ -518,13 +518,13 @@ spdk_bdev_module_action_done(struct spdk_bdev_module_if *module)
}

void
spdk_bdev_module_init_done(struct spdk_bdev_module_if *module)
spdk_bdev_module_init_done(struct spdk_bdev_module *module)
{
	spdk_bdev_module_action_done(module);
}

void
spdk_bdev_module_examine_done(struct spdk_bdev_module_if *module)
spdk_bdev_module_examine_done(struct spdk_bdev_module *module)
{
	spdk_bdev_module_action_done(module);
}
@@ -532,7 +532,7 @@ spdk_bdev_module_examine_done(struct spdk_bdev_module_if *module)
static int
spdk_bdev_modules_init(void)
{
	struct spdk_bdev_module_if *module;
	struct spdk_bdev_module *module;
	int rc = 0;

	TAILQ_FOREACH(module, &g_bdev_mgr.bdev_modules, tailq) {
@@ -687,8 +687,8 @@ spdk_bdev_module_finish_iter(void *arg)
{
	/* Notice that this variable is static. It is saved between calls to
	 * this function. */
	static struct spdk_bdev_module_if *resume_bdev_module = NULL;
	struct spdk_bdev_module_if *bdev_module;
	static struct spdk_bdev_module *resume_bdev_module = NULL;
	struct spdk_bdev_module *bdev_module;

	/* Start iterating from the last touched module */
	if (!resume_bdev_module) {
@@ -2374,7 +2374,7 @@ spdk_bdev_io_get_thread(struct spdk_bdev_io *bdev_io)
static int
_spdk_bdev_register(struct spdk_bdev *bdev)
{
	struct spdk_bdev_module_if *module;
	struct spdk_bdev_module *module;

	assert(bdev->module != NULL);

@@ -2572,7 +2572,7 @@ spdk_bdev_close(struct spdk_bdev_desc *desc)

int
spdk_bdev_module_claim_bdev(struct spdk_bdev *bdev, struct spdk_bdev_desc *desc,
			    struct spdk_bdev_module_if *module)
			    struct spdk_bdev_module *module)
{
	if (bdev->claim_module != NULL) {
		SPDK_ERRLOG("bdev %s already claimed by module %s\n", bdev->name,
@@ -2635,7 +2635,7 @@ spdk_bdev_io_get_iovec(struct spdk_bdev_io *bdev_io, struct iovec **iovp, int *i
}

void
spdk_bdev_module_list_add(struct spdk_bdev_module_if *bdev_module)
spdk_bdev_module_list_add(struct spdk_bdev_module *bdev_module)
{

	if (spdk_bdev_module_list_find(bdev_module->name)) {
@@ -2659,10 +2659,10 @@ spdk_bdev_module_list_add(struct spdk_bdev_module_if *bdev_module)
	}
}

struct spdk_bdev_module_if *
struct spdk_bdev_module *
spdk_bdev_module_list_find(const char *name)
{
	struct spdk_bdev_module_if *bdev_module;
	struct spdk_bdev_module *bdev_module;

	TAILQ_FOREACH(bdev_module, &g_bdev_mgr.bdev_modules, tailq) {
		if (strcmp(name, bdev_module->name) == 0) {
Loading