Skip to contentSkip to conversation

NVMe-CLI WDC-Plugin Add drive-essentials command

PATCH New Jeff Lien 3 participants 3 messages Jan 18, 2018 – Jan 19, 2018

Subsystems (2)
lore
Share & tools
lore

Jeff Lien

author
#0 lore raw

PATCH 1/2 NVMe-CLI WDC-Plugin Add drive-essentials command

Signed-off-by Jeff Lien <jeff.lien at wdc.com>
---
 Makefile    |   2 +-
 wdc-nvme.c  | 940 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 wdc-nvme.h  |   1 +
 wdc-utils.c | 165 +++++++++++
 wdc-utils.h |  81 ++++++
 5 files changed, 1183 insertions(+), 6 deletions(-)
 create mode 100644 wdc-utils.c
 create mode 100644 wdc-utils.h
Makefile +1 -1
index cc74bdd..c06bec8 100644
@@ -33,7 +33,7 @@ NVME_DPKG_VERSION=1~`lsb_release -sc`
 
 OBJS := argconfig.o suffix.o parser.o nvme-print.o nvme-ioctl.o \
 	nvme-lightnvm.o fabrics.o json.o plugin.o intel-nvme.o \
-	lnvm-nvme.o memblaze-nvme.o wdc-nvme.o nvme-models.o huawei-nvme.o
+	lnvm-nvme.o memblaze-nvme.o wdc-nvme.o wdc-utils.o nvme-models.o huawei-nvme.o
 
 nvme: nvme.c nvme.h $(OBJS) NVME-VERSION-FILE
 	$(CC) $(CPPFLAGS) $(CFLAGS) nvme.c -o $(NVME) $(OBJS) $(LDFLAGS)
wdc-nvme.c +935 -5

989 lines not on this page · raw message

wdc-nvme.h +1 -0
index 9f6b726..2e28ee9 100644
@@ -15,6 +15,7 @@ PLUGIN(NAME("wdc", "Western Digital vendor specific extensions"),
 		ENTRY("purge", "WDC Purge", wdc_purge)
 		ENTRY("purge-monitor", "WDC Purge Monitor", wdc_purge_monitor)
 		ENTRY("smart-add-log", "WDC Additional Smart Log", wdc_smart_add_log)
+		ENTRY("drive-essentials", "WDC Drive Essentials", wdc_drive_essentials)
 	)
 );
 
wdc-utils.c new file +165 -0

165 lines not on this page · raw message

wdc-utils.h new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.14.2.746.g8fb8a94
#1 lore raw

PATCH 1/2 NVMe-CLI WDC-Plugin Add drive-essentials command

Hi Jeff,

wdc-nvme.c static int wdc_smart_add_log(int argc, char **argv, struct command *command, · line 2016

Quoted 8 lines · Jeff Lien
Signed-off-by Jeff Lien <jeff.lien at wdc.com>
wdc-nvme.c +6 -0
+       free(dataBuffer);
+       dataBuffer = NULL;
+
+       /* Get Smart log page  */
+       memset(&smart_log, 0, sizeof (struct nvme_smart_log));
+       ret = nvme_smart_log(fd, 0xffffffff, &smart_log);

0xffffffff seems it could be replaced with NVME_NSID_ALL defined in linux/nvme.h,
or your own WDC_DE_GLOBAL_NSID.

wdc-nvme.c static int wdc_smart_add_log(int argc, char **argv, struct command *command, · line 2090

Quoted 2 lines
wdc-nvme.c +2 -0
+               memset(&deEssentialsList, 0, sizeof(deEssentialsList));
+               deEssentialsList.logEntry = (WDC_DRIVE_ESSENTIALS*)calloc(1, sizeof(WDC_DRIVE_ESSENTIALS)*maxNumOfVUFiles);

_deEssentialsList.logEntry_ seems not freed after used or hardly found.

Additionally, please rebase this patch which causes errors below.
- nvme_error_log() no longer has namespace parameter.
- nvme_get_log() has appended parameters for LSP newly introduced in
NVMe 1.3 spec and LPO.

Nit - Indentation seems almost mixed both tab and whitespaces.
- Few descriptions declared in (char *) could have _const_.

Thanks,

#2 lore raw

PATCH 1/2 NVMe-CLI WDC-Plugin Add drive-essentials command

In reply to Jeff Lien

Thanks, Jeff. All applied.

I made minor modifications to account for recent changes to the internal API, but the update should faithfully reflect your intention.

I think it may have been a mistake to not create a new get-log interface so that the common use doesn't need to provide the LSP/LPO parameters. I will try to get around to simplifying that before tagging another release, but we'll see.