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: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403368
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Daniel Verkamp 2018-03-09 15:20:21 -07:00 committed by Jim Harris
parent c25402c5db
commit 19100ed580
23 changed files with 56 additions and 56 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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 */

View File

@ -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,

View File

@ -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) {

View File

@ -72,7 +72,7 @@ static int vbdev_error_init(void);
static void vbdev_error_examine(struct spdk_bdev *bdev);
static struct spdk_bdev_module_if error_if = {
static struct spdk_bdev_module error_if = {
.name = "error",
.module_init = vbdev_error_init,
.module_fini = NULL,

View File

@ -52,7 +52,7 @@
static int vbdev_gpt_init(void);
static void vbdev_gpt_examine(struct spdk_bdev *bdev);
static struct spdk_bdev_module_if gpt_if = {
static struct spdk_bdev_module gpt_if = {
.name = "gpt",
.module_init = vbdev_gpt_init,
.examine = vbdev_gpt_examine,

View File

@ -47,7 +47,7 @@ static int vbdev_lvs_init(void);
static int vbdev_lvs_get_ctx_size(void);
static void vbdev_lvs_examine(struct spdk_bdev *bdev);
static struct spdk_bdev_module_if g_lvol_if = {
static struct spdk_bdev_module g_lvol_if = {
.name = "lvol",
.module_init = vbdev_lvs_init,
.examine = vbdev_lvs_examine,

View File

@ -101,7 +101,7 @@ bdev_malloc_get_ctx_size(void)
return sizeof(struct malloc_task) + spdk_copy_task_size();
}
static struct spdk_bdev_module_if malloc_if = {
static struct spdk_bdev_module malloc_if = {
.name = "malloc",
.module_init = bdev_malloc_initialize,
.config_text = bdev_malloc_get_spdk_running_config,

View File

@ -60,7 +60,7 @@ static int bdev_null_initialize(void);
static void bdev_null_finish(void);
static void bdev_null_get_spdk_running_config(FILE *fp);
static struct spdk_bdev_module_if null_if = {
static struct spdk_bdev_module null_if = {
.name = "null",
.module_init = bdev_null_initialize,
.module_fini = bdev_null_finish,

View File

@ -158,7 +158,7 @@ bdev_nvme_get_ctx_size(void)
return sizeof(struct nvme_bdev_io);
}
static struct spdk_bdev_module_if nvme_if = {
static struct spdk_bdev_module nvme_if = {
.name = "nvme",
.module_init = bdev_nvme_library_init,
.module_fini = bdev_nvme_library_fini,

View File

@ -195,7 +195,7 @@ spdk_bdev_part_channel_destroy_cb(void *io_device, void *ctx_buf)
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,
spdk_bdev_remove_cb_t remove_cb, 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,
uint32_t channel_size, spdk_io_channel_create_cb ch_create_cb,

View File

@ -54,7 +54,7 @@ static TAILQ_HEAD(, pmem_disk) g_pmem_disks = TAILQ_HEAD_INITIALIZER(g_pmem_disk
static int bdev_pmem_initialize(void);
static void bdev_pmem_finish(void);
static struct spdk_bdev_module_if pmem_if = {
static struct spdk_bdev_module pmem_if = {
.name = "pmem",
.module_init = bdev_pmem_initialize,
.module_fini = bdev_pmem_finish,

View File

@ -214,7 +214,7 @@ bdev_rbd_get_ctx_size(void)
return sizeof(struct bdev_rbd_io);
}
static struct spdk_bdev_module_if rbd_if = {
static struct spdk_bdev_module rbd_if = {
.name = "rbd",
.module_init = bdev_rbd_library_init,
.get_ctx_size = bdev_rbd_get_ctx_size,

View File

@ -57,7 +57,7 @@ struct vbdev_split_channel {
static int vbdev_split_init(void);
static void vbdev_split_examine(struct spdk_bdev *bdev);
static struct spdk_bdev_module_if split_if = {
static struct spdk_bdev_module split_if = {
.name = "split",
.module_init = vbdev_split_init,
.examine = vbdev_split_examine,

View File

@ -82,7 +82,7 @@ struct bdev_virtio_blk_io_channel {
static int bdev_virtio_initialize(void);
static int bdev_virtio_blk_get_ctx_size(void);
static struct spdk_bdev_module_if virtio_blk_if = {
static struct spdk_bdev_module virtio_blk_if = {
.name = "virtio_blk",
.module_init = bdev_virtio_initialize,
.get_ctx_size = bdev_virtio_blk_get_ctx_size,

View File

@ -399,7 +399,7 @@ bdev_virtio_get_ctx_size(void)
return sizeof(struct virtio_scsi_io_ctx);
}
static struct spdk_bdev_module_if virtio_scsi_if = {
static struct spdk_bdev_module virtio_scsi_if = {
.name = "virtio_scsi",
.module_init = bdev_virtio_initialize,
.module_fini = bdev_virtio_finish,

View File

@ -160,7 +160,7 @@ bdev_blob_unmap(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, uint64
}
int
spdk_bs_bdev_claim(struct spdk_bs_dev *bs_dev, struct spdk_bdev_module_if *module)
spdk_bs_bdev_claim(struct spdk_bs_dev *bs_dev, struct spdk_bdev_module *module)
{
struct blob_bdev *blob_bdev = (struct blob_bdev *)bs_dev;
int rc;

View File

@ -68,13 +68,13 @@ static struct spdk_bdev_fn_table fn_table = {
.destruct = stub_destruct,
};
struct spdk_bdev_module_if bdev_ut_if = {
struct spdk_bdev_module bdev_ut_if = {
.name = "bdev_ut",
};
static void vbdev_ut_examine(struct spdk_bdev *bdev);
struct spdk_bdev_module_if vbdev_ut_if = {
struct spdk_bdev_module vbdev_ut_if = {
.name = "vbdev_ut",
.examine = vbdev_ut_examine,
};

View File

@ -176,7 +176,7 @@ module_fini(void)
{
}
struct spdk_bdev_module_if bdev_ut_if = {
struct spdk_bdev_module bdev_ut_if = {
.name = "bdev_ut",
.module_init = module_init,
.module_fini = module_fini,

View File

@ -47,13 +47,13 @@ spdk_scsi_nvme_translate(const struct spdk_bdev_io *bdev_io,
{
}
struct spdk_bdev_module_if bdev_ut_if = {
struct spdk_bdev_module bdev_ut_if = {
.name = "bdev_ut",
};
static void vbdev_ut_examine(struct spdk_bdev *bdev);
struct spdk_bdev_module_if vbdev_ut_if = {
struct spdk_bdev_module vbdev_ut_if = {
.name = "vbdev_ut",
.examine = vbdev_ut_examine,
};

View File

@ -37,7 +37,7 @@
#include "bdev/pmem/bdev_pmem.c"
static struct spdk_bdev_module_if *g_bdev_pmem_module;
static struct spdk_bdev_module *g_bdev_pmem_module;
static int g_bdev_module_cnt;
struct pmemblk {
@ -296,7 +296,7 @@ ut_bdev_pmem_destruct(struct spdk_bdev *bdev)
}
void
spdk_bdev_module_list_add(struct spdk_bdev_module_if *bdev_module)
spdk_bdev_module_list_add(struct spdk_bdev_module *bdev_module)
{
g_bdev_pmem_module = bdev_module;
g_bdev_module_cnt++;

View File

@ -180,7 +180,7 @@ spdk_lvs_load(struct spdk_bs_dev *dev,
}
int
spdk_bs_bdev_claim(struct spdk_bs_dev *bs_dev, struct spdk_bdev_module_if *module)
spdk_bs_bdev_claim(struct spdk_bs_dev *bs_dev, struct spdk_bdev_module *module)
{
if (lvol_already_opened == true) {
return -1;
@ -488,7 +488,7 @@ spdk_blob_io_readv(struct spdk_blob *blob, struct spdk_io_channel *channel,
}
void
spdk_bdev_module_list_add(struct spdk_bdev_module_if *bdev_module)
spdk_bdev_module_list_add(struct spdk_bdev_module *bdev_module)
{
}
@ -538,7 +538,7 @@ spdk_vbdev_register(struct spdk_bdev *vbdev, struct spdk_bdev **base_bdevs, int
}
void
spdk_bdev_module_examine_done(struct spdk_bdev_module_if *module)
spdk_bdev_module_examine_done(struct spdk_bdev_module *module)
{
g_examine_done = true;
}