nvmf: remove struct spdk_bdev definition dependencies

1) use spdk_bdev_get_name() accessor
2) use __SPDK_BDEV_MODULE_ONLY #define

The latter allows nvmf to just get the spdk_bdev_module
definitions and APIs that it needs for claiming bdevs
for purposes of avoiding the same namespace used in
different subsystems.

This also ensures that future changes to structures
like spdk_bdev and spdk_bdev_io will not cause
lib/nvmf so version changes.

Note: we include bdev_module.h explicitly in the
nvmf/subsystem unit tests now, before including
subsystem.c, because the unit tests do depend on
knowing the internal structure of spdk_bdev.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2f499a741d19f4749eadb402641f28137245fd23
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7738
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2021-05-04 18:45:04 +00:00 committed by Tomasz Zawadzki
parent 2b9ec05ba7
commit fa79643725
3 changed files with 4 additions and 1 deletions

View File

@ -44,6 +44,7 @@
#include "spdk/json.h"
#include "spdk/file.h"
#define __SPDK_BDEV_MODULE_ONLY
#include "spdk/bdev_module.h"
#include "spdk/log.h"
#include "spdk_internal/utf.h"
@ -1320,7 +1321,7 @@ nvmf_ns_event(enum spdk_bdev_event_type type,
{
SPDK_DEBUGLOG(nvmf, "Bdev event: type %d, name %s, subsystem_id %d, ns_id %d\n",
type,
bdev->name,
spdk_bdev_get_name(bdev),
((struct spdk_nvmf_ns *)event_ctx)->subsystem->id,
((struct spdk_nvmf_ns *)event_ctx)->nsid);

View File

@ -51,6 +51,7 @@
#include "json/json_write.c"
#include "nvmf/nvmf.c"
#include "nvmf/transport.c"
#include "spdk/bdev_module.h"
#include "nvmf/subsystem.c"
#include "nvmf/fc.c"
#include "nvmf/fc_ls.c"

View File

@ -37,6 +37,7 @@
#include "spdk_cunit.h"
#include "spdk_internal/mock.h"
#include "spdk/bdev_module.h"
#include "nvmf/subsystem.c"
SPDK_LOG_REGISTER_COMPONENT(nvmf)