Commit 1f3d48b2 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 3e324621
Loading
Loading
Loading
Loading
+1 −21
Original line number Diff line number Diff line
@@ -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,
+20 −0
Original line number Diff line number Diff line
@@ -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);
+0 −6
Original line number Diff line number Diff line
@@ -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