nvme: remove spdk_nvme_ctrlr_connect_opts data structure

For API spdk_nvme_connect(), users can only use NULL or
struct spdk_nvme_ctrlr_opts for their own driver options,
so parameter opts_size doesn't take effect here.  Since
some applications outside SPDK's git repository are using
such API, so we only remove the internal data structure
for now.

Change-Id: Ia727d2950d56abba637214ad17ecfa3eeab71d38
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/445656
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Changpeng Liu 2019-03-04 23:19:23 -05:00
parent 4ce22e0f0e
commit ef7827dc06
2 changed files with 5 additions and 21 deletions

View File

@ -621,13 +621,10 @@ static bool
spdk_nvme_connect_probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts)
{
struct spdk_nvme_ctrlr_connect_opts *requested_opts = cb_ctx;
struct spdk_nvme_ctrlr_opts *requested_opts = cb_ctx;
assert(requested_opts->opts);
assert(requested_opts->opts_size != 0);
memcpy(opts, requested_opts->opts, spdk_min(sizeof(*opts), requested_opts->opts_size));
assert(requested_opts);
memcpy(opts, requested_opts, sizeof(*opts));
return true;
}
@ -637,8 +634,6 @@ spdk_nvme_connect(const struct spdk_nvme_transport_id *trid,
const struct spdk_nvme_ctrlr_opts *opts, size_t opts_size)
{
int rc;
struct spdk_nvme_ctrlr_connect_opts connect_opts = {};
struct spdk_nvme_ctrlr_connect_opts *user_connect_opts = NULL;
struct spdk_nvme_ctrlr *ctrlr = NULL;
spdk_nvme_probe_cb probe_cb = NULL;
struct spdk_nvme_probe_ctx *probe_ctx;
@ -653,10 +648,7 @@ spdk_nvme_connect(const struct spdk_nvme_transport_id *trid,
return NULL;
}
if (opts && opts_size > 0) {
connect_opts.opts = opts;
connect_opts.opts_size = opts_size;
user_connect_opts = &connect_opts;
if (opts && opts_size == sizeof(*opts)) {
probe_cb = spdk_nvme_connect_probe_cb;
}
@ -664,7 +656,7 @@ spdk_nvme_connect(const struct spdk_nvme_transport_id *trid,
if (!probe_ctx) {
return NULL;
}
spdk_nvme_probe_ctx_init(probe_ctx, trid, user_connect_opts, probe_cb, NULL, NULL);
spdk_nvme_probe_ctx_init(probe_ctx, trid, (void *)opts, probe_cb, NULL, NULL);
spdk_nvme_probe_internal(probe_ctx, true);
rc = nvme_init_controllers(probe_ctx);

View File

@ -714,14 +714,6 @@ extern struct nvme_driver *g_spdk_nvme_driver;
int nvme_driver_init(void);
/*
* Used for the spdk_nvme_connect() public API to save user specified opts.
*/
struct spdk_nvme_ctrlr_connect_opts {
const struct spdk_nvme_ctrlr_opts *opts;
size_t opts_size;
};
#define nvme_delay usleep
static inline bool