Skip to content

Commit ca241ed

Browse files
committed
libnvme: drop nvme_subsystem accessors from tree.c
The accessor functions already have implementations for the various nvme subsystem accessors, so drop them from tree.c Signed-off-by: Hannes Reinecke <[email protected]>
1 parent 20f0529 commit ca241ed

12 files changed

Lines changed: 24 additions & 122 deletions

File tree

fabrics.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ static void nvmf_disconnect_nqn(struct nvme_global_ctx *ctx, char *nqn)
716716
continue;
717717
nvme_for_each_host(ctx, h) {
718718
nvme_for_each_subsystem(h, s) {
719-
if (strcmp(nvme_subsystem_get_nqn(s), p))
719+
if (strcmp(nvme_subsystem_get_subsysnqn(s), p))
720720
continue;
721721
nvme_subsystem_for_each_ctrl(s, c) {
722722
if (!nvme_disconnect_ctrl(c))
@@ -1062,7 +1062,7 @@ int fabrics_dim(const char *desc, int argc, char **argv)
10621062
continue;
10631063
nvme_for_each_host(ctx, h) {
10641064
nvme_for_each_subsystem(h, s) {
1065-
if (strcmp(nvme_subsystem_get_nqn(s), p))
1065+
if (strcmp(nvme_subsystem_get_subsysnqn(s), p))
10661066
continue;
10671067
nvme_subsystem_for_each_ctrl(s, c)
10681068
ret = dim_operation(c, tas, p);

libnvme/examples/display-columnar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ int main()
4242
nvme_for_each_subsystem(h, s) {
4343
bool first = true;
4444
printf("%-16s %-96s ", nvme_subsystem_get_name(s),
45-
nvme_subsystem_get_nqn(s));
45+
nvme_subsystem_get_subsysnqn(s));
4646

4747
nvme_subsystem_for_each_ctrl(s, c) {
4848
printf("%s%s", first ? "": ", ",

libnvme/examples/display-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ int main()
3939
nvme_for_each_subsystem_safe(h, s, _s) {
4040
printf("%c-- %s - NQN=%s\n", _s ? '|' : '`',
4141
nvme_subsystem_get_name(s),
42-
nvme_subsystem_get_nqn(s));
42+
nvme_subsystem_get_subsysnqn(s));
4343

4444
nvme_subsystem_for_each_ns_safe(s, n, _n) {
4545
printf("%c |-- %s lba size:%d lba max:%" PRIu64 "\n",

libnvme/src/libnvme.ld

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,7 @@ LIBNVME_3 {
188188
nvme_subsystem_first_ctrl;
189189
nvme_subsystem_first_ns;
190190
nvme_get_subsystem;
191-
nvme_subsystem_get_fw_rev;
192191
nvme_subsystem_get_host;
193-
nvme_subsystem_get_nqn;
194-
nvme_subsystem_get_type;
195192
nvme_subsystem_lookup_namespace;
196193
nvme_subsystem_next_ctrl;
197194
nvme_subsystem_next_ns;

libnvme/src/nvme/fabrics.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ int nvmf_add_ctrl(nvme_host_t h, nvme_ctrl_t c,
10511051
*/
10521052
if (app && strcmp(app, root_app)) {
10531053
nvme_msg(h->ctx, LOG_INFO, "skip %s, not managed by %s\n",
1054-
nvme_subsystem_get_nqn(s), root_app);
1054+
nvme_subsystem_get_subsysnqn(s), root_app);
10551055
return -ENVME_CONNECT_IGNORED;
10561056
}
10571057
}

libnvme/src/nvme/json.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ static void json_update_subsys(struct json_object *subsys_array,
356356
nvme_subsystem_t s)
357357
{
358358
nvme_ctrl_t c;
359-
const char *subsysnqn = nvme_subsystem_get_nqn(s), *app;
359+
const char *subsysnqn = nvme_subsystem_get_subsysnqn(s), *app;
360360
struct json_object *subsys_obj = json_object_new_object();
361361
struct json_object *port_array;
362362

@@ -602,7 +602,7 @@ static void json_dump_subsys(struct json_object *subsys_array,
602602
json_object_object_add(subsys_obj, "name",
603603
json_object_new_string(nvme_subsystem_get_name(s)));
604604
json_object_object_add(subsys_obj, "nqn",
605-
json_object_new_string(nvme_subsystem_get_nqn(s)));
605+
json_object_new_string(nvme_subsystem_get_subsysnqn(s)));
606606

607607
ns_array = json_object_new_array();
608608
if (!json_dump_subsys_multipath(s, ns_array))

libnvme/src/nvme/tree.c

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -429,21 +429,6 @@ void nvme_root_release_fds(struct nvme_global_ctx *ctx)
429429
nvme_host_release_fds(h);
430430
}
431431

432-
const char *nvme_subsystem_get_nqn(nvme_subsystem_t s)
433-
{
434-
return s->subsysnqn;
435-
}
436-
437-
const char *nvme_subsystem_get_type(nvme_subsystem_t s)
438-
{
439-
return s->subsystype;
440-
}
441-
442-
const char *nvme_subsystem_get_fw_rev(nvme_subsystem_t s)
443-
{
444-
return s->firmware;
445-
}
446-
447432
nvme_ctrl_t nvme_subsystem_first_ctrl(nvme_subsystem_t s)
448433
{
449434
return list_top(&s->ctrls, struct nvme_ctrl, entry);
@@ -955,26 +940,6 @@ struct nvme_fabrics_config *nvme_ctrl_get_config(nvme_ctrl_t c)
955940
return &c->cfg;
956941
}
957942

958-
bool nvme_ctrl_is_discovered(nvme_ctrl_t c)
959-
{
960-
return c->discovered;
961-
}
962-
963-
bool nvme_ctrl_is_persistent(nvme_ctrl_t c)
964-
{
965-
return c->persistent;
966-
}
967-
968-
bool nvme_ctrl_is_discovery_ctrl(nvme_ctrl_t c)
969-
{
970-
return c->discovery_ctrl;
971-
}
972-
973-
bool nvme_ctrl_is_unique_discovery_ctrl(nvme_ctrl_t c)
974-
{
975-
return c->unique_discovery_ctrl;
976-
}
977-
978943
int nvme_ctrl_identify(nvme_ctrl_t c, struct nvme_id_ctrl *id)
979944
{
980945
struct nvme_transport_handle *hdl = nvme_ctrl_get_transport_handle(c);

libnvme/src/nvme/tree.h

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -775,41 +775,6 @@ const char *nvme_ns_head_get_sysfs_dir(nvme_ns_head_t head);
775775
*/
776776
struct nvme_fabrics_config *nvme_ctrl_get_config(nvme_ctrl_t c);
777777

778-
/**
779-
* nvme_ctrl_is_discovered() - Returns the value of the 'discovered' flag
780-
* @c: Controller instance
781-
*
782-
* Return: Value of the 'discovered' flag of @c
783-
*/
784-
bool nvme_ctrl_is_discovered(nvme_ctrl_t c);
785-
786-
/**
787-
* nvme_ctrl_is_persistent() - Returns the value of the 'persistent' flag
788-
* @c: Controller instance
789-
*
790-
* Return: Value of the 'persistent' flag of @c
791-
*/
792-
bool nvme_ctrl_is_persistent(nvme_ctrl_t c);
793-
794-
/**
795-
* nvme_ctrl_is_discovery_ctrl() - Check the 'discovery_ctrl' flag
796-
* @c: Controller to be checked
797-
*
798-
* Returns the value of the 'discovery_ctrl' flag which specifies whether
799-
* @c connects to a discovery subsystem.
800-
*
801-
* Return: Value of the 'discover_ctrl' flag
802-
*/
803-
bool nvme_ctrl_is_discovery_ctrl(nvme_ctrl_t c);
804-
805-
/**
806-
* nvme_ctrl_is_unique_discovery_ctrl() - Check the 'unique_discovery_ctrl' flag
807-
* @c: Controller to be checked
808-
*
809-
* Return: Value of the 'unique_discovery_ctrl' flag
810-
*/
811-
bool nvme_ctrl_is_unique_discovery_ctrl(nvme_ctrl_t c);
812-
813778
/**
814779
* nvme_ctrl_identify() - Issues an 'identify controller' command
815780
* @c: Controller instance
@@ -872,32 +837,6 @@ void nvme_free_ctrl(struct nvme_ctrl *c);
872837
*/
873838
void nvme_unlink_ctrl(struct nvme_ctrl *c);
874839

875-
/**
876-
* nvme_subsystem_get_nqn() - Retrieve NQN from subsystem
877-
* @s: nvme_subsystem_t object
878-
*
879-
* Return: NQN of subsystem
880-
*/
881-
const char *nvme_subsystem_get_nqn(nvme_subsystem_t s);
882-
883-
/**
884-
* nvme_subsystem_get_type() - Returns the type of a subsystem
885-
* @s: nvme_subsystem_t object
886-
*
887-
* Returns the subsystem type of @s.
888-
*
889-
* Return: 'nvm' or 'discovery'
890-
*/
891-
const char *nvme_subsystem_get_type(nvme_subsystem_t s);
892-
893-
/**
894-
* nvme_subsystem_get_fw_rev() - Return the firmware rev of subsystem
895-
* @s: nvme_subsystem_t object
896-
*
897-
* Return: Firmware revision of the current subsystem
898-
*/
899-
const char *nvme_subsystem_get_fw_rev(nvme_subsystem_t s);
900-
901840
/**
902841
* nvme_scan_topology() - Scan NVMe topology and apply filter
903842
* @ctx: struct nvme_global_ctx object

libnvme/test/cpp.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int main()
3434
nvme_for_each_host(ctx, h) {
3535
nvme_for_each_subsystem(h, s) {
3636
std::cout << nvme_subsystem_get_name(s)
37-
<< " - NQN=" << nvme_subsystem_get_nqn(s)
37+
<< " - NQN=" << nvme_subsystem_get_subsysnqn(s)
3838
<< "\n";
3939
nvme_subsystem_for_each_ctrl(s, c) {
4040
std::cout << " `- " << nvme_ctrl_get_name(c)

libnvme/test/test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static bool nvme_match_subsysnqn_filter(nvme_subsystem_t s,
3333
char *nqn_match = f_args;
3434

3535
if (s)
36-
return strcmp(nvme_subsystem_get_nqn(s), nqn_match) == 0;
36+
return strcmp(nvme_subsystem_get_subsysnqn(s), nqn_match) == 0;
3737
return true;
3838
}
3939

@@ -405,7 +405,7 @@ int main(int argc, char **argv)
405405
nvme_for_each_host(ctx, h) {
406406
nvme_for_each_subsystem(h, s) {
407407
printf("%s - NQN=%s\n", nvme_subsystem_get_name(s),
408-
nvme_subsystem_get_nqn(s));
408+
nvme_subsystem_get_subsysnqn(s));
409409
nvme_subsystem_for_each_ctrl(s, c) {
410410
printf(" %s %s %s %s\n", nvme_ctrl_get_name(c),
411411
nvme_ctrl_get_transport(c),
@@ -433,7 +433,7 @@ int main(int argc, char **argv)
433433
nvme_for_each_host(ctx, h) {
434434
nvme_for_each_subsystem(h, s) {
435435
printf("%s - NQN=%s\n", nvme_subsystem_get_name(s),
436-
nvme_subsystem_get_nqn(s));
436+
nvme_subsystem_get_subsysnqn(s));
437437
nvme_subsystem_for_each_ctrl(s, c) {
438438
printf(" `- %s %s %s %s\n",
439439
nvme_ctrl_get_name(c),

0 commit comments

Comments
 (0)