diff options
author | jimharris <jimharris@FreeBSD.org> | 2013-07-17 23:23:38 +0000 |
---|---|---|
committer | jimharris <jimharris@FreeBSD.org> | 2013-07-17 23:23:38 +0000 |
commit | 8281445679a1a40c3039155ced18766cc7635428 (patch) | |
tree | 127037d85ff2ed1959c788208e14e5ece1cd7fbb /sbin | |
parent | 6ded7d8bc2691570cfdd7fc32187f20214d14279 (diff) | |
download | FreeBSD-src-8281445679a1a40c3039155ced18766cc7635428.zip FreeBSD-src-8281445679a1a40c3039155ced18766cc7635428.tar.gz |
Define constants for the lengths of the serial number, model number
and firmware revision in the controller's identify structure.
Also modify consumers of these fields to ensure they only use the
specified number of bytes for their respective fields.
Sponsored by: Intel
Reviewed by: carl
MFC after: 3 days
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/nvmecontrol/devlist.c | 2 | ||||
-rw-r--r-- | sbin/nvmecontrol/identify.c | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/sbin/nvmecontrol/devlist.c b/sbin/nvmecontrol/devlist.c index 849b364..46879db 100644 --- a/sbin/nvmecontrol/devlist.c +++ b/sbin/nvmecontrol/devlist.c @@ -89,7 +89,7 @@ devlist(int argc, char *argv[]) found++; read_controller_data(fd, &cdata); - printf("%6s: %s\n", name, cdata.mn); + printf("%6s: %.*s\n", name, NVME_MODEL_NUMBER_LENGTH, cdata.mn); for (i = 0; i < cdata.nn; i++) { sprintf(name, "%s%d%s%d", NVME_CTRLR_PREFIX, ctrlr, diff --git a/sbin/nvmecontrol/identify.c b/sbin/nvmecontrol/identify.c index 7cc499c..6585430 100644 --- a/sbin/nvmecontrol/identify.c +++ b/sbin/nvmecontrol/identify.c @@ -47,9 +47,12 @@ print_controller(struct nvme_controller_data *cdata) printf("================================\n"); printf("Vendor ID: %04x\n", cdata->vid); printf("Subsystem Vendor ID: %04x\n", cdata->ssvid); - printf("Serial Number: %s\n", cdata->sn); - printf("Model Number: %s\n", cdata->mn); - printf("Firmware Version: %s\n", cdata->fr); + printf("Serial Number: %.*s\n", + NVME_SERIAL_NUMBER_LENGTH, cdata->sn); + printf("Model Number: %.*s\n", + NVME_MODEL_NUMBER_LENGTH, cdata->mn); + printf("Firmware Version: %.*s\n", + NVME_FIRMWARE_REVISION_LENGTH, cdata->fr); printf("Recommended Arb Burst: %d\n", cdata->rab); printf("IEEE OUI Identifier: %02x %02x %02x\n", cdata->ieee[0], cdata->ieee[1], cdata->ieee[2]); |