bdev/nvme: fix vendor_id formatting

The printf # specifier adds 0x for %x values, but the field width then
includes the 0x part, so for example printf("%#04x", 0x1) prints "0x01"
rather than the intended "0x0001".

Rather than increasing the field width, just manually insert the 0x in
the format string and drop # for less confusion.

Change-Id: Ie6044619a22b51b39562bfa5c0c0239933bf38c8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-12-06 15:21:05 -07:00
parent 307d1320d8
commit cdc332d178

View File

@ -358,7 +358,7 @@ blockdev_nvme_dump_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ct
nvme_dev->pci_addr.func);
spdk_json_write_name(w, "vendor_id");
spdk_json_write_string_fmt(w, "%#04x", cdata->vid);
spdk_json_write_string_fmt(w, "0x%04x", cdata->vid);
snprintf(buf, sizeof(cdata->mn) + 1, "%s", cdata->mn);
spdk_str_trim(buf);