Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@
continue;
nvme_for_each_host(ctx, h) {
nvme_for_each_subsystem(h, s) {
if (strcmp(nvme_subsystem_get_nqn(s), p))
if (strcmp(nvme_subsystem_get_subsysnqn(s), p))
continue;
nvme_subsystem_for_each_ctrl(s, c) {
if (!nvme_disconnect_ctrl(c))
Expand Down Expand Up @@ -1062,7 +1062,7 @@
continue;
nvme_for_each_host(ctx, h) {
nvme_for_each_subsystem(h, s) {
if (strcmp(nvme_subsystem_get_nqn(s), p))
if (strcmp(nvme_subsystem_get_subsysnqn(s), p))

Check failure on line 1065 in fabrics.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 87 exceeds 80 columns
continue;
nvme_subsystem_for_each_ctrl(s, c)
ret = dim_operation(c, tas, p);
Expand Down
4 changes: 2 additions & 2 deletions libnvme/examples/display-columnar.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int main()
nvme_for_each_subsystem(h, s) {
bool first = true;
printf("%-16s %-96s ", nvme_subsystem_get_name(s),
nvme_subsystem_get_nqn(s));
nvme_subsystem_get_subsysnqn(s));

nvme_subsystem_for_each_ctrl(s, c) {
printf("%s%s", first ? "": ", ",
Expand Down Expand Up @@ -70,7 +70,7 @@ int main()
nvme_ctrl_get_model(c),
nvme_ctrl_get_firmware(c),
nvme_ctrl_get_transport(c),
nvme_ctrl_get_address(c),
nvme_ctrl_get_traddr(c),
nvme_subsystem_get_name(s));

nvme_ctrl_for_each_ns(c, n) {
Expand Down
4 changes: 2 additions & 2 deletions libnvme/examples/display-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int main()
nvme_for_each_subsystem_safe(h, s, _s) {
printf("%c-- %s - NQN=%s\n", _s ? '|' : '`',
nvme_subsystem_get_name(s),
nvme_subsystem_get_nqn(s));
nvme_subsystem_get_subsysnqn(s));

nvme_subsystem_for_each_ns_safe(s, n, _n) {
printf("%c |-- %s lba size:%d lba max:%" PRIu64 "\n",
Expand All @@ -54,7 +54,7 @@ int main()
_s ? '|' : ' ', _c ? '|' : '`',
nvme_ctrl_get_name(c),
nvme_ctrl_get_transport(c),
nvme_ctrl_get_address(c),
nvme_ctrl_get_traddr(c),
nvme_ctrl_get_state(c));

nvme_ctrl_for_each_ns_safe(c, n, _n)
Expand Down
35 changes: 17 additions & 18 deletions libnvme/libnvme/nvme.i
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ struct nvme_host {
char *hostid;
char *hostsymname;
%extend {
char *dhchap_key;
char *dhchap_host_key;
}
};

Expand Down Expand Up @@ -457,19 +457,18 @@ struct nvme_ctrl {
char *tls_key_identity;
char *tls_key;

char *dhchap_host_key;
char *dhchap_ctrl_key;

/**
* We are remapping the following members of the C code's
* nvme_ctrl_t to different names in Python. Here's the mapping:
*
* C code Python (SWIG)
* ===================== =====================
* ctrl->s ctrl->subsystem
* ctrl->dhchap_key ctrl->dhchap_host_key
* ctrl->dhchap_ctrl_key ctrl->dhchap_key
*/
struct nvme_subsystem *subsystem; // Maps to "s" in the C code
char *dhchap_host_key; // Maps to "dhchap_key" in the C code
char *dhchap_key; // Maps to "dhchap_ctrl_key" in the C code
}
};

Expand Down Expand Up @@ -562,7 +561,7 @@ struct nvme_ns {
if (hostsymname)
nvme_host_set_hostsymname(h, hostsymname);
if (hostkey)
nvme_host_set_dhchap_key(h, hostkey);
nvme_host_set_dhchap_host_key(h, hostkey);
return h;
}
~nvme_host() {
Expand Down Expand Up @@ -593,11 +592,11 @@ struct nvme_ns {
}

%{
const char *nvme_host_dhchap_key_get(struct nvme_host *h) {
return nvme_host_get_dhchap_key(h);
const char *nvme_host_dhchap_host_key_get(struct nvme_host *h) {
return nvme_host_get_dhchap_host_key(h);
}
void nvme_host_dhchap_key_set(struct nvme_host *h, char *key) {
nvme_host_set_dhchap_key(h, key);
void nvme_host_dhchap_host_key_set(struct nvme_host *h, char *key) {
nvme_host_set_dhchap_host_key(h, key);
}
%};

Expand Down Expand Up @@ -880,11 +879,11 @@ struct nvme_ns {
const char *nvme_ctrl_state_get(struct nvme_ctrl *c) {
return nvme_ctrl_get_state(c);
}
const char *nvme_ctrl_dhchap_key_get(struct nvme_ctrl *c) {
return nvme_ctrl_get_dhchap_key(c);
const char *nvme_ctrl_dhchap_ctrl_key_get(struct nvme_ctrl *c) {
return nvme_ctrl_get_dhchap_ctrl_key(c);
}
void nvme_ctrl_dhchap_key_set(struct nvme_ctrl *c, const char *key) {
nvme_ctrl_set_dhchap_key(c, key);
void nvme_ctrl_dhchap_ctrl_key_set(struct nvme_ctrl *c, const char *key) {
nvme_ctrl_set_dhchap_ctrl_key(c, key);
}
const char *nvme_ctrl_dhchap_host_key_get(struct nvme_ctrl *c) {
return nvme_ctrl_get_dhchap_host_key(c);
Expand All @@ -898,7 +897,7 @@ struct nvme_ns {
}

bool nvme_ctrl_persistent_get(struct nvme_ctrl *c) {
return nvme_ctrl_is_persistent(c);
return nvme_ctrl_get_persistent(c);
}
void nvme_ctrl_persistent_set(struct nvme_ctrl *c, bool persistent) {
nvme_ctrl_set_persistent(c, persistent);
Expand Down Expand Up @@ -949,22 +948,22 @@ struct nvme_ns {
}

const char *nvme_ctrl_address_get(nvme_ctrl_t c) {
return nvme_ctrl_get_address(c);
return nvme_ctrl_get_traddr(c);
}

const char *nvme_ctrl_sysfs_dir_get(nvme_ctrl_t c) {
return nvme_ctrl_get_sysfs_dir(c);
}

bool nvme_ctrl_discovery_ctrl_get(struct nvme_ctrl *c) {
return nvme_ctrl_is_discovery_ctrl(c);
return nvme_ctrl_get_discovery_ctrl(c);
}
void nvme_ctrl_discovery_ctrl_set(struct nvme_ctrl *c, bool discovery) {
nvme_ctrl_set_discovery_ctrl(c, discovery);
}

bool nvme_ctrl_unique_discovery_ctrl_get(nvme_ctrl_t c) {
return nvme_ctrl_is_unique_discovery_ctrl(c);
return nvme_ctrl_get_unique_discovery_ctrl(c);
}
void nvme_ctrl_unique_discovery_ctrl_set(nvme_ctrl_t c, bool unique) {
nvme_ctrl_set_unique_discovery_ctrl(c, unique);
Expand Down
8 changes: 4 additions & 4 deletions libnvme/src/accessors.ld
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ LIBNVME_ACCESSORS_3 {
nvme_ctrl_set_traddr;
nvme_ctrl_get_trsvcid;
nvme_ctrl_set_trsvcid;
nvme_ctrl_get_dhchap_key;
nvme_ctrl_set_dhchap_key;
nvme_ctrl_get_dhchap_host_key;
nvme_ctrl_set_dhchap_host_key;
nvme_ctrl_get_dhchap_ctrl_key;
nvme_ctrl_set_dhchap_ctrl_key;
nvme_ctrl_get_keyring;
Expand Down Expand Up @@ -108,8 +108,8 @@ LIBNVME_ACCESSORS_3 {
nvme_host_set_hostnqn;
nvme_host_get_hostid;
nvme_host_set_hostid;
nvme_host_get_dhchap_key;
nvme_host_set_dhchap_key;
nvme_host_get_dhchap_host_key;
nvme_host_set_dhchap_host_key;
nvme_host_get_hostsymname;
nvme_host_set_hostsymname;
nvme_host_get_pdc_enabled_valid;
Expand Down
9 changes: 0 additions & 9 deletions libnvme/src/libnvme.ld
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,18 @@ LIBNVME_3 {
nvme_ctrl_match_config;
nvme_ctrl_first_ns;
nvme_ctrl_first_path;
nvme_ctrl_get_address;
nvme_ctrl_get_config;
nvme_ctrl_get_dhchap_host_key;
nvme_ctrl_get_phy_slot;
nvme_ctrl_get_src_addr;
nvme_ctrl_get_state;
nvme_ctrl_get_subsysnqn;
nvme_ctrl_get_subsystem;
nvme_ctrl_get_transport_handle;
nvme_ctrl_identify;
nvme_ctrl_is_discovery_ctrl;
nvme_ctrl_is_persistent;
nvme_ctrl_is_unique_discovery_ctrl;
nvme_ctrl_next_ns;
nvme_ctrl_next_path;
nvme_ctrl_release_transport_handle;
nvme_reset_ctrl;
nvme_ctrl_set_dhchap_host_key;
nvme_filter_ctrls;
nvme_describe_key_serial;
nvme_disconnect_ctrl;
Expand Down Expand Up @@ -190,10 +184,7 @@ LIBNVME_3 {
nvme_subsystem_first_ctrl;
nvme_subsystem_first_ns;
nvme_get_subsystem;
nvme_subsystem_get_fw_rev;
nvme_subsystem_get_host;
nvme_subsystem_get_nqn;
nvme_subsystem_get_type;
nvme_subsystem_lookup_namespace;
nvme_subsystem_next_ctrl;
nvme_subsystem_next_ns;
Expand Down
24 changes: 14 additions & 10 deletions libnvme/src/nvme/accessors.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,15 +292,17 @@ const char *nvme_ctrl_get_trsvcid(const struct nvme_ctrl *p)
return p->trsvcid;
}

void nvme_ctrl_set_dhchap_key(struct nvme_ctrl *p, const char *dhchap_key)
void nvme_ctrl_set_dhchap_host_key(
struct nvme_ctrl *p,
const char *dhchap_host_key)
{
free(p->dhchap_key);
p->dhchap_key = dhchap_key ? strdup(dhchap_key) : NULL;
free(p->dhchap_host_key);
p->dhchap_host_key = dhchap_host_key ? strdup(dhchap_host_key) : NULL;
}

const char *nvme_ctrl_get_dhchap_key(const struct nvme_ctrl *p)
const char *nvme_ctrl_get_dhchap_host_key(const struct nvme_ctrl *p)
{
return p->dhchap_key;
return p->dhchap_host_key;
}

void nvme_ctrl_set_dhchap_ctrl_key(
Expand Down Expand Up @@ -586,15 +588,17 @@ const char *nvme_host_get_hostid(const struct nvme_host *p)
return p->hostid;
}

void nvme_host_set_dhchap_key(struct nvme_host *p, const char *dhchap_key)
void nvme_host_set_dhchap_host_key(
struct nvme_host *p,
const char *dhchap_host_key)
{
free(p->dhchap_key);
p->dhchap_key = dhchap_key ? strdup(dhchap_key) : NULL;
free(p->dhchap_host_key);
p->dhchap_host_key = dhchap_host_key ? strdup(dhchap_host_key) : NULL;
}

const char *nvme_host_get_dhchap_key(const struct nvme_host *p)
const char *nvme_host_get_dhchap_host_key(const struct nvme_host *p)
{
return p->dhchap_key;
return p->dhchap_host_key;
}

void nvme_host_set_hostsymname(struct nvme_host *p, const char *hostsymname)
Expand Down
28 changes: 16 additions & 12 deletions libnvme/src/nvme/accessors.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,19 +407,21 @@ void nvme_ctrl_set_trsvcid(struct nvme_ctrl *p, const char *trsvcid);
const char *nvme_ctrl_get_trsvcid(const struct nvme_ctrl *p);

/**
* nvme_ctrl_set_dhchap_key() - Set dhchap_key.
* nvme_ctrl_set_dhchap_host_key() - Set dhchap_host_key.
* @p: The &struct nvme_ctrl instance to update.
* @dhchap_key: New string; a copy is stored. Pass NULL to clear.
* @dhchap_host_key: New string; a copy is stored. Pass NULL to clear.
*/
void nvme_ctrl_set_dhchap_key(struct nvme_ctrl *p, const char *dhchap_key);
void nvme_ctrl_set_dhchap_host_key(
struct nvme_ctrl *p,
const char *dhchap_host_key);

/**
* nvme_ctrl_get_dhchap_key() - Get dhchap_key.
* nvme_ctrl_get_dhchap_host_key() - Get dhchap_host_key.
* @p: The &struct nvme_ctrl instance to query.
*
* Return: The value of the dhchap_key field, or NULL if not set.
* Return: The value of the dhchap_host_key field, or NULL if not set.
*/
const char *nvme_ctrl_get_dhchap_key(const struct nvme_ctrl *p);
const char *nvme_ctrl_get_dhchap_host_key(const struct nvme_ctrl *p);

/**
* nvme_ctrl_set_dhchap_ctrl_key() - Set dhchap_ctrl_key.
Expand Down Expand Up @@ -808,19 +810,21 @@ void nvme_host_set_hostid(struct nvme_host *p, const char *hostid);
const char *nvme_host_get_hostid(const struct nvme_host *p);

/**
* nvme_host_set_dhchap_key() - Set dhchap_key.
* nvme_host_set_dhchap_host_key() - Set dhchap_host_key.
* @p: The &struct nvme_host instance to update.
* @dhchap_key: New string; a copy is stored. Pass NULL to clear.
* @dhchap_host_key: New string; a copy is stored. Pass NULL to clear.
*/
void nvme_host_set_dhchap_key(struct nvme_host *p, const char *dhchap_key);
void nvme_host_set_dhchap_host_key(
struct nvme_host *p,
const char *dhchap_host_key);

/**
* nvme_host_get_dhchap_key() - Get dhchap_key.
* nvme_host_get_dhchap_host_key() - Get dhchap_host_key.
* @p: The &struct nvme_host instance to query.
*
* Return: The value of the dhchap_key field, or NULL if not set.
* Return: The value of the dhchap_host_key field, or NULL if not set.
*/
const char *nvme_host_get_dhchap_key(const struct nvme_host *p);
const char *nvme_host_get_dhchap_host_key(const struct nvme_host *p);

/**
* nvme_host_set_hostsymname() - Set hostsymname.
Expand Down
Loading
Loading