From: seehearfeel Date: Tue, 22 Mar 2016 11:23:15 +0000 (+0800) Subject: Fix the bug of Model Number and display the info of Serial Number X-Git-Tag: v0.6~10^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=ab43012f21c2e55cfd005de845c4f391f68cd4be;p=users%2Fhch%2Fnvme-cli.git Fix the bug of Model Number and display the info of Serial Number According to the NVMe Specification, there is an error when display Model Number. In addition, currently it does not display the info of Serial Number, so add it. --- diff --git a/nvme-print.c b/nvme-print.c index 60a4c34..5722111 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -579,7 +579,7 @@ void show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode) printf("vid : %#x\n", le16toh(ctrl->vid)); printf("ssvid : %#x\n", le16toh(ctrl->ssvid)); printf("sn : %-20.20s\n", ctrl->sn); - printf("mn : %-20.20s\n", ctrl->mn); + printf("mn : %-40.40s\n", ctrl->mn); printf("fr : %-.8s\n", ctrl->fr); printf("rab : %d\n", ctrl->rab); printf("ieee : %02x%02x%02x\n", diff --git a/nvme.c b/nvme.c index 9a7e4b3..4f4307a 100644 --- a/nvme.c +++ b/nvme.c @@ -758,19 +758,19 @@ static void print_list_item(struct list_item list_item) sprintf(version,"%d.%d", (list_item.ver >> 16), (list_item.ver >> 8) & 0xff); - printf("%-16s %-20.20s %-8s %-8d %-26s %-16s %-.8s\n", list_item.node, - list_item.ctrl.mn, version, list_item.nsid, usage, format, list_item.ctrl.fr); + printf("%-16s %-20.20s %-40.40s %-8s %-8d %-26s %-16s %-.8s\n", list_item.node, + list_item.ctrl.sn, list_item.ctrl.mn, version, list_item.nsid, usage, format, list_item.ctrl.fr); } static void print_list_items(struct list_item *list_items, unsigned len) { unsigned i; - printf("%-16s %-20s %-8s %-8s %-26s %-16s %-8s\n", - "Node","Model","Version","Namepace", "Usage", "Format", "FW Rev"); - printf("%-16s %-20s %-8s %-8s %-26s %-16s %-8s\n", - "----------------","--------------------","--------","--------", - "--------------------------","----------------","--------"); + printf("%-16s %-20s %-40s %-8s %-8s %-26s %-16s %-8s\n", + "Node", "SN", "Model", "Version", "Namepace", "Usage", "Format", "FW Rev"); + printf("%-16s %-20s %-40s %-8s %-8s %-26s %-16s %-8s\n", + "----------------", "--------------------", "----------------------------------------", + "--------", "--------", "--------------------------", "----------------", "--------"); for (i = 0 ; i < len ; i++) print_list_item(list_items[i]);