Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
nvme-cli.12152
0032-nvme-print-out-controller-state-for-list-s...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0032-nvme-print-out-controller-state-for-list-subsys.patch of Package nvme-cli.12152
From: Hannes Reinecke <hare@suse.de> Date: Tue, 6 Nov 2018 09:40:06 +0100 Subject: [PATCH] nvme: print out controller state for 'list-subsys' References: bsc#1113400 Git-commit: 381e48c239a339d9aae5a16d425e6964777af8ed Provide details about the controller state. Signed-off-by: Hannes Reinecke <hare@suse.com> --- nvme-print.c | 7 +++++-- nvme.c | 9 +++++++++ nvme.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/nvme-print.c b/nvme-print.c index 9a27a2e..156b48f 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -2121,9 +2121,10 @@ static void show_nvme_subsystem(struct subsys_list_item *item) printf("\\\n"); for (i = 0; i < item->nctrls; i++) { - printf(" +- %s %s %s\n", item->ctrls[i].name, + printf(" +- %s %s %s %s\n", item->ctrls[i].name, item->ctrls[i].transport, - item->ctrls[i].address); + item->ctrls[i].address, + item->ctrls[i].state); } } @@ -2169,6 +2170,8 @@ void json_print_nvme_subsystem_list(struct subsys_list_item *slist, int n) slist[i].ctrls[j].transport); json_object_add_value_string(path_attrs, "Address", slist[i].ctrls[j].address); + json_object_add_value_string(path_attrs, "State", + slist[i].ctrls[j].state); json_array_add_value_object(paths, path_attrs); } if (j) { diff --git a/nvme.c b/nvme.c index 547e083..22ef7d5 100644 --- a/nvme.c +++ b/nvme.c @@ -1038,6 +1038,7 @@ static void free_ctrl_list_item(struct ctrl_list_item *ctrls) free(ctrls->name); free(ctrls->transport); free(ctrls->address); + free(ctrls->state); } int get_nvme_subsystem_info(char *name, char *path, @@ -1091,6 +1092,14 @@ int get_nvme_subsystem_info(char *name, char *path, continue; } + item->ctrls[ccnt].state = + get_nvme_ctrl_attr(ctrl_path, "state"); + if (!item->ctrls[ccnt].state) { + fprintf(stderr, "failed to get controller[%d] state.\n", i); + free_ctrl_list_item(&item->ctrls[ccnt]); + continue; + } + ccnt++; } diff --git a/nvme.h b/nvme.h index b134be1..df48175 100644 --- a/nvme.h +++ b/nvme.h @@ -121,6 +121,7 @@ struct ctrl_list_item { char *name; char *address; char *transport; + char *state; }; struct subsys_list_item { -- 2.12.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor