]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli: Fix the displayed metadata length value on Big Endian systems.
authorJeff Lien <jeff.lien@wdc.com>
Fri, 24 Aug 2018 18:34:27 +0000 (13:34 -0500)
committerKeith Busch <keith.busch@intel.com>
Fri, 24 Aug 2018 19:09:21 +0000 (13:09 -0600)
On BE systems, the metadata length value displayed as part of the
format in the nvme list command is byte swapped.  So a value of 0
appears just fine but a value of 8 bytes is displayed as 0x0800.
This patch fixes that is the value is correct for both LE and BE
systems.

Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
nvme-print.c

index 4c2a73a6f42a21dfdeda059dc1d1be55bd9ab47e..3589c19f82279e1a7b501707ce9dbf07b4dad49f 100644 (file)
@@ -2050,7 +2050,7 @@ static void show_list_item(struct list_item list_item)
        sprintf(usage,"%6.2f %2sB / %6.2f %2sB", nuse, u_suffix,
                nsze, s_suffix);
        sprintf(format,"%3.0f %2sB + %2d B", (double)lba, l_suffix,
-               list_item.ns.lbaf[(list_item.ns.flbas & 0x0f)].ms);
+               le16_to_cpu(list_item.ns.lbaf[(list_item.ns.flbas & 0x0f)].ms));
        printf("%-16s %-*.*s %-*.*s %-9d %-26s %-16s %-.*s\n", list_item.node,
             (int)sizeof(list_item.ctrl.sn), (int)sizeof(list_item.ctrl.sn), list_item.ctrl.sn,
             (int)sizeof(list_item.ctrl.mn), (int)sizeof(list_item.ctrl.mn), list_item.ctrl.mn,