Skip to content

Commit

Permalink
nvme-print: Print cntlid number for controller
Browse files Browse the repository at this point in the history
Print the controller identifier number (cntlid) for the nvme controller.
The cntlid is printed if nvme list verbose is specified.

Signed-off-by: Nilay Shroff <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Daniel Wagner <[email protected]>
  • Loading branch information
shroffni authored and igaw committed Apr 9, 2024
1 parent 8db9bbb commit 764b9a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions nvme-print-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -3899,6 +3899,7 @@ static void json_detail_list(nvme_root_t t)
struct json_object *jpaths = json_create_array();

obj_add_str(jctrl, "Controller", nvme_ctrl_get_name(c));
obj_add_str(jctrl, "Cntlid", nvme_ctrl_get_cntlid(c));
obj_add_str(jctrl, "SerialNumber", nvme_ctrl_get_serial(c));
obj_add_str(jctrl, "ModelNumber", nvme_ctrl_get_model(c));
obj_add_str(jctrl, "Firmware", nvme_ctrl_get_firmware(c));
Expand Down
12 changes: 7 additions & 5 deletions nvme-print-stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -4802,8 +4802,9 @@ static bool stdout_detailed_ctrl(const char *name, void *arg)
c = htable_ctrl_get(&res->ht_c, name);
assert(c);

printf("%-8s %-20s %-40s %-8s %-6s %-14s %-6s %-12s ",
printf("%-8s %-6s %-20s %-40s %-8s %-6s %-14s %-6s %-12s ",
nvme_ctrl_get_name(c),
nvme_ctrl_get_cntlid(c),
nvme_ctrl_get_serial(c),
nvme_ctrl_get_model(c),
nvme_ctrl_get_firmware(c),
Expand Down Expand Up @@ -4882,10 +4883,11 @@ static void stdout_detailed_list(nvme_root_t r)
strset_iterate(&res.subsystems, stdout_detailed_subsys, &res);
printf("\n");

printf("%-8s %-20s %-40s %-8s %-6s %-14s %-6s %-12s %-16s\n", "Device",
"SN", "MN", "FR", "TxPort", "Address", "Slot", "Subsystem", "Namespaces");
printf("%-.8s %-.20s %-.40s %-.8s %-.6s %-.14s %-.6s %-.12s %-.16s\n", dash,
dash, dash, dash, dash, dash, dash, dash, dash);
printf("%-8s %-6s %-20s %-40s %-8s %-6s %-14s %-6s %-12s %-16s\n", "Device",
"Cntlid", "SN", "MN", "FR", "TxPort", "Address", "Slot", "Subsystem",
"Namespaces");
printf("%-.8s %-.6s %-.20s %-.40s %-.8s %-.6s %-.14s %-.6s %-.12s %-.16s\n",
dash, dash, dash, dash, dash, dash, dash, dash, dash, dash);
strset_iterate(&res.ctrls, stdout_detailed_ctrl, &res);
printf("\n");

Expand Down

0 comments on commit 764b9a1

Please sign in to comment.