nvmf: Add subsystem iterators
Add functions to iterate the list of subsystems for a given target. Change-Id: Id3831f656033092224168b353788ae87238bf800 Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/388294 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
8b79ef3372
commit
33376dd136
@ -148,6 +148,16 @@ struct spdk_nvmf_subsystem *spdk_nvmf_create_subsystem(struct spdk_nvmf_tgt *tgt
|
||||
struct spdk_nvmf_subsystem *spdk_nvmf_tgt_find_subsystem(struct spdk_nvmf_tgt *tgt,
|
||||
const char *subnqn);
|
||||
|
||||
/**
|
||||
* Begin iterating over all known subsystems. If no subsystems are present, return NULL.
|
||||
*/
|
||||
struct spdk_nvmf_subsystem *spdk_nvmf_subsystem_get_first(struct spdk_nvmf_tgt *tgt);
|
||||
|
||||
/**
|
||||
* Continue iterating over all known subsystems. If no additional subsystems, return NULL.
|
||||
*/
|
||||
struct spdk_nvmf_subsystem *spdk_nvmf_subsystem_get_next(struct spdk_nvmf_subsystem *subsystem);
|
||||
|
||||
void spdk_nvmf_delete_subsystem(struct spdk_nvmf_subsystem *subsystem);
|
||||
|
||||
/**
|
||||
|
@ -242,6 +242,43 @@ spdk_nvmf_delete_subsystem(struct spdk_nvmf_subsystem *subsystem)
|
||||
spdk_nvmf_subsystem_delete_done);
|
||||
}
|
||||
|
||||
struct spdk_nvmf_subsystem *
|
||||
spdk_nvmf_subsystem_get_first(struct spdk_nvmf_tgt *tgt)
|
||||
{
|
||||
struct spdk_nvmf_subsystem *subsystem;
|
||||
uint32_t sid;
|
||||
|
||||
for (sid = 0; sid < tgt->max_sid; sid++) {
|
||||
subsystem = tgt->subsystems[sid];
|
||||
if (subsystem) {
|
||||
return subsystem;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct spdk_nvmf_subsystem *
|
||||
spdk_nvmf_subsystem_get_next(struct spdk_nvmf_subsystem *subsystem)
|
||||
{
|
||||
uint32_t sid;
|
||||
struct spdk_nvmf_tgt *tgt;
|
||||
|
||||
if (!subsystem) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tgt = subsystem->tgt;
|
||||
|
||||
for (sid = subsystem->id + 1; sid < tgt->max_sid; sid++) {
|
||||
subsystem = tgt->subsystems[sid];
|
||||
if (subsystem) {
|
||||
return subsystem;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
spdk_nvmf_subsystem_add_host(struct spdk_nvmf_subsystem *subsystem, const char *hostnqn)
|
||||
|
Loading…
x
Reference in New Issue
Block a user