From 1f3d48b22d8761b5c3c4f964d169e0cf0d9ce5c8 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 8 Nov 2016 14:09:08 -0700 Subject: [PATCH] bdev: move spdk_bdev_fn_table into bdev_module.h The bdev function table should not be part of the public API. Change-Id: I5d6f40d1b37c4471041c1c9d6253a3f92e9e9701 Signed-off-by: Daniel Verkamp --- include/spdk/bdev.h | 22 +--------------------- lib/bdev/bdev_module.h | 20 ++++++++++++++++++++ test/lib/scsi/scsi_bdev/scsi_bdev_ut.c | 6 ------ 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/include/spdk/bdev.h b/include/spdk/bdev.h index fd2ab0433..e2540dc20 100644 --- a/include/spdk/bdev.h +++ b/include/spdk/bdev.h @@ -55,6 +55,7 @@ #define SPDK_BDEV_MAX_PRODUCT_NAME_LENGTH 50 struct spdk_bdev_io; +struct spdk_bdev_fn_table; /** * \brief SPDK block device. @@ -114,27 +115,6 @@ enum spdk_bdev_io_type { SPDK_BDEV_IO_TYPE_RESET, }; -/** - * Function table for a block device backend. - * - * The backend block device function table provides a set of APIs to allow - * communication with a backend. The main commands are read/write API - * calls for I/O via submit_request. - */ -struct spdk_bdev_fn_table { - /** Destroy the backend block device object */ - int (*destruct)(struct spdk_bdev *bdev); - - /** Process the IO. */ - void (*submit_request)(struct spdk_bdev_io *); - - /** Check if the block device supports a specific I/O type. */ - bool (*io_type_supported)(struct spdk_bdev *bdev, enum spdk_bdev_io_type); - - /** Get an I/O channel for the specific bdev for the calling thread. */ - struct spdk_io_channel *(*get_io_channel)(struct spdk_bdev *bdev, uint32_t priority); -}; - /** Blockdev I/O completion status */ enum spdk_bdev_io_status { SPDK_BDEV_IO_STATUS_SCSI_ERROR = -3, diff --git a/lib/bdev/bdev_module.h b/lib/bdev/bdev_module.h index 31f9ead71..ebc3f8e5d 100644 --- a/lib/bdev/bdev_module.h +++ b/lib/bdev/bdev_module.h @@ -120,6 +120,26 @@ struct spdk_bdev_module_if { TAILQ_ENTRY(spdk_bdev_module_if) tailq; }; +/** + * Function table for a block device backend. + * + * The backend block device function table provides a set of APIs to allow + * communication with a backend. The main commands are read/write API + * calls for I/O via submit_request. + */ +struct spdk_bdev_fn_table { + /** Destroy the backend block device object */ + int (*destruct)(struct spdk_bdev *bdev); + + /** Process the IO. */ + void (*submit_request)(struct spdk_bdev_io *); + + /** Check if the block device supports a specific I/O type. */ + bool (*io_type_supported)(struct spdk_bdev *bdev, enum spdk_bdev_io_type); + + /** Get an I/O channel for the specific bdev for the calling thread. */ + struct spdk_io_channel *(*get_io_channel)(struct spdk_bdev *bdev, uint32_t priority); +}; void spdk_bdev_register(struct spdk_bdev *bdev); void spdk_bdev_io_get_rbuf(struct spdk_bdev_io *bdev_io, spdk_bdev_io_get_rbuf_cb cb); diff --git a/test/lib/scsi/scsi_bdev/scsi_bdev_ut.c b/test/lib/scsi/scsi_bdev/scsi_bdev_ut.c index 78d2cd9a4..d75c8b1e7 100644 --- a/test/lib/scsi/scsi_bdev/scsi_bdev_ut.c +++ b/test/lib/scsi/scsi_bdev/scsi_bdev_ut.c @@ -381,15 +381,12 @@ inquiry_standard_test(void) struct spdk_scsi_task task; struct spdk_scsi_lun lun; struct spdk_scsi_dev dev; - struct spdk_bdev_fn_table fn_table; char cdb[6]; /* expects a 4K internal data buffer */ char data[4096]; struct spdk_scsi_cdb_inquiry_data *inq_data; int rc; - bdev.fn_table = &fn_table; - cdb[0] = 0x12; cdb[1] = 0x00; // EVPD = 0 cdb[2] = 0x00; // PageCode zero - requesting standard inquiry @@ -420,14 +417,11 @@ _inquiry_overflow_test(uint8_t alloc_len) struct spdk_scsi_task task; struct spdk_scsi_lun lun; struct spdk_scsi_dev dev; - struct spdk_bdev_fn_table fn_table; uint8_t cdb[6]; /* expects a 4K internal data buffer */ char data[256], data_compare[256]; int rc; - bdev.fn_table = &fn_table; - cdb[0] = 0x12; cdb[1] = 0x00; // EVPD = 0 cdb[2] = 0x00; // PageCode zero - requesting standard inquiry