nvmf: add functions for iterating over transports
Part of a larger series aimed at exposing NVMe-oF transports though rpc and spdkcli. This is in line with the goal of initializing all NVMe-oF options on a per-transport basis. Change-Id: I4f07d58d49b925cf51df3980d2e2161c50169cee Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/430622 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
91420344f4
commit
433a1e7b67
@ -192,6 +192,9 @@ enum spdk_nvme_transport_type {
|
||||
SPDK_NVME_TRANSPORT_FC = SPDK_NVMF_TRTYPE_FC,
|
||||
};
|
||||
|
||||
/* typedef added for coding style reasons */
|
||||
typedef enum spdk_nvme_transport_type spdk_nvme_transport_type_t;
|
||||
|
||||
/**
|
||||
* NVMe transport identifier.
|
||||
*
|
||||
|
@ -747,6 +747,43 @@ int spdk_nvmf_transport_destroy(struct spdk_nvmf_transport *transport);
|
||||
struct spdk_nvmf_transport *spdk_nvmf_tgt_get_transport(struct spdk_nvmf_tgt *tgt,
|
||||
enum spdk_nvme_transport_type type);
|
||||
|
||||
/**
|
||||
* Get the first transport registered with the given target
|
||||
*
|
||||
* \param tgt The NVMe-oF target
|
||||
*
|
||||
* \return The first transport registered on the target
|
||||
*/
|
||||
struct spdk_nvmf_transport *spdk_nvmf_transport_get_first(struct spdk_nvmf_tgt *tgt);
|
||||
|
||||
/**
|
||||
* Get the next transport in a target's list.
|
||||
*
|
||||
* \param transport A handle to a transport object
|
||||
*
|
||||
* \return The next transport associated with the NVMe-oF target
|
||||
*/
|
||||
struct spdk_nvmf_transport *spdk_nvmf_transport_get_next(struct spdk_nvmf_transport *transport);
|
||||
|
||||
/**
|
||||
* Get the opts for a given transport.
|
||||
*
|
||||
* \param transport The transport to query
|
||||
*
|
||||
* \return The opts associated with the given transport
|
||||
*/
|
||||
const struct spdk_nvmf_transport_opts *spdk_nvmf_get_transport_opts(struct spdk_nvmf_transport
|
||||
*transport);
|
||||
|
||||
/**
|
||||
* Get the transport type for a given transport.
|
||||
*
|
||||
* \param transport The transport to query
|
||||
*
|
||||
* \return the transport type for the given transport
|
||||
*/
|
||||
spdk_nvme_transport_type_t spdk_nvmf_get_transport_type(struct spdk_nvmf_transport *transport);
|
||||
|
||||
/**
|
||||
* Function to be called once transport add is complete
|
||||
*
|
||||
|
@ -62,6 +62,18 @@ spdk_nvmf_get_transport_ops(enum spdk_nvme_transport_type type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const struct spdk_nvmf_transport_opts *
|
||||
spdk_nvmf_get_transport_opts(struct spdk_nvmf_transport *transport)
|
||||
{
|
||||
return &transport->opts;
|
||||
}
|
||||
|
||||
spdk_nvme_transport_type_t
|
||||
spdk_nvmf_get_transport_type(struct spdk_nvmf_transport *transport)
|
||||
{
|
||||
return transport->ops->type;
|
||||
}
|
||||
|
||||
struct spdk_nvmf_transport *
|
||||
spdk_nvmf_transport_create(enum spdk_nvme_transport_type type,
|
||||
struct spdk_nvmf_transport_opts *opts)
|
||||
@ -100,6 +112,18 @@ spdk_nvmf_transport_create(enum spdk_nvme_transport_type type,
|
||||
return transport;
|
||||
}
|
||||
|
||||
struct spdk_nvmf_transport *
|
||||
spdk_nvmf_transport_get_first(struct spdk_nvmf_tgt *tgt)
|
||||
{
|
||||
return TAILQ_FIRST(&tgt->transports);
|
||||
}
|
||||
|
||||
struct spdk_nvmf_transport *
|
||||
spdk_nvmf_transport_get_next(struct spdk_nvmf_transport *transport)
|
||||
{
|
||||
return TAILQ_NEXT(transport, link);
|
||||
}
|
||||
|
||||
int
|
||||
spdk_nvmf_transport_destroy(struct spdk_nvmf_transport *transport)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user