|
|
8b3e94 |
commit f3921810fe1e28491c62bca1d6d9ca02d99eda3f
|
|
|
8b3e94 |
Author: Eyal Ben David <eyalbe@il.ibm.com>
|
|
|
8b3e94 |
Date: Wed Oct 24 18:08:16 2018 +0300
|
|
|
8b3e94 |
|
|
|
8b3e94 |
Refactor plugins in a file hierarchy
|
|
|
8b3e94 |
|
|
|
8b3e94 |
diff --git a/Makefile b/Makefile
|
|
|
8b3e94 |
index 433bc41..70541cb 100644
|
|
|
8b3e94 |
--- a/Makefile
|
|
|
8b3e94 |
+++ b/Makefile
|
|
|
8b3e94 |
@@ -1,4 +1,4 @@
|
|
|
8b3e94 |
-CFLAGS ?= -O2 -g -Wall -Werror
|
|
|
8b3e94 |
+CFLAGS ?= -O2 -g -Wall -Werror -I.
|
|
|
8b3e94 |
CFLAGS += -std=gnu99
|
|
|
8b3e94 |
CPPFLAGS += -D_GNU_SOURCE -D__CHECK_ENDIAN__
|
|
|
8b3e94 |
LIBUUID = $(shell $(LD) -o /dev/null -luuid >/dev/null 2>&1; echo $$?)
|
|
|
8b3e94 |
@@ -32,18 +32,31 @@ override CFLAGS += -DNVME_VERSION='"$(NVME_VERSION)"'
|
|
|
8b3e94 |
NVME_DPKG_VERSION=1~`lsb_release -sc`
|
|
|
8b3e94 |
|
|
|
8b3e94 |
OBJS := argconfig.o suffix.o parser.o nvme-print.o nvme-ioctl.o \
|
|
|
8b3e94 |
- nvme-lightnvm.o fabrics.o json.o plugin.o intel-nvme.o \
|
|
|
8b3e94 |
- lnvm-nvme.o memblaze-nvme.o wdc-nvme.o wdc-utils.o nvme-models.o \
|
|
|
8b3e94 |
- huawei-nvme.o netapp-nvme.o toshiba-nvme.o micron-nvme.o seagate-nvme.o
|
|
|
8b3e94 |
-
|
|
|
8b3e94 |
-nvme: nvme.c nvme.h $(OBJS) NVME-VERSION-FILE
|
|
|
8b3e94 |
- $(CC) $(CPPFLAGS) $(CFLAGS) nvme.c -o $(NVME) $(OBJS) $(LDFLAGS)
|
|
|
8b3e94 |
+ nvme-lightnvm.o fabrics.o json.o nvme-models.o plugin.o
|
|
|
8b3e94 |
+
|
|
|
8b3e94 |
+PLUGIN_OBJS := \
|
|
|
8b3e94 |
+ plugins/intel/intel-nvme.o \
|
|
|
8b3e94 |
+ plugins/lnvm/lnvm-nvme.o \
|
|
|
8b3e94 |
+ plugins/memblaze/memblaze-nvme.o \
|
|
|
8b3e94 |
+ plugins/wdc/wdc-nvme.o \
|
|
|
8b3e94 |
+ plugins/wdc/wdc-utils.o \
|
|
|
8b3e94 |
+ plugins/huawei/huawei-nvme.o \
|
|
|
8b3e94 |
+ plugins/netapp/netapp-nvme.o \
|
|
|
8b3e94 |
+ plugins/toshiba/toshiba-nvme.o \
|
|
|
8b3e94 |
+ plugins/micron/micron-nvme.o \
|
|
|
8b3e94 |
+ plugins/seagate/seagate-nvme.o
|
|
|
8b3e94 |
+
|
|
|
8b3e94 |
+nvme: nvme.c nvme.h $(OBJS) $(PLUGIN_OBJS) NVME-VERSION-FILE
|
|
|
8b3e94 |
+ $(CC) $(CPPFLAGS) $(CFLAGS) nvme.c -o $(NVME) $(OBJS) $(PLUGIN_OBJS) $(LDFLAGS)
|
|
|
8b3e94 |
+
|
|
|
8b3e94 |
+verify-no-dep: nvme.c nvme.h $(OBJS) NVME-VERSION-FILE
|
|
|
8b3e94 |
+ $(CC) $(CPPFLAGS) $(CFLAGS) nvme.c -o $@ $(OBJS) $(LDFLAGS)
|
|
|
8b3e94 |
|
|
|
8b3e94 |
nvme.o: nvme.c nvme.h nvme-print.h nvme-ioctl.h argconfig.h suffix.h nvme-lightnvm.h fabrics.h
|
|
|
8b3e94 |
$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
|
|
8b3e94 |
|
|
|
8b3e94 |
%.o: %.c %.h nvme.h linux/nvme_ioctl.h nvme-ioctl.h nvme-print.h argconfig.h
|
|
|
8b3e94 |
- $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
|
|
8b3e94 |
+ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
|
|
8b3e94 |
|
|
|
8b3e94 |
doc: $(NVME)
|
|
|
8b3e94 |
$(MAKE) -C Documentation
|
|
|
8b3e94 |
@@ -54,9 +67,10 @@ test:
|
|
|
8b3e94 |
all: doc
|
|
|
8b3e94 |
|
|
|
8b3e94 |
clean:
|
|
|
8b3e94 |
- $(RM) $(NVME) *.o *~ a.out NVME-VERSION-FILE *.tar* nvme.spec version control nvme-*.deb
|
|
|
8b3e94 |
+ $(RM) $(NVME) $(OBJS) $(PLUGIN_OBJS) *~ a.out NVME-VERSION-FILE *.tar* nvme.spec version control nvme-*.deb
|
|
|
8b3e94 |
$(MAKE) -C Documentation clean
|
|
|
8b3e94 |
$(RM) tests/*.pyc
|
|
|
8b3e94 |
+ $(RM) verify-no-dep
|
|
|
8b3e94 |
|
|
|
8b3e94 |
clobber: clean
|
|
|
8b3e94 |
$(MAKE) -C Documentation clobber
|
|
|
8b3e94 |
diff --git a/huawei-nvme.c b/plugins/huawei/huawei-nvme.c
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from huawei-nvme.c
|
|
|
8b3e94 |
rename to plugins/huawei/huawei-nvme.c
|
|
|
8b3e94 |
diff --git a/huawei-nvme.h b/plugins/huawei/huawei-nvme.h
|
|
|
8b3e94 |
similarity index 88%
|
|
|
8b3e94 |
rename from huawei-nvme.h
|
|
|
8b3e94 |
rename to plugins/huawei/huawei-nvme.h
|
|
|
8b3e94 |
index 91e8dfb..7aac90c 100644
|
|
|
8b3e94 |
--- a/huawei-nvme.h
|
|
|
8b3e94 |
+++ b/plugins/huawei/huawei-nvme.h
|
|
|
8b3e94 |
@@ -1,5 +1,5 @@
|
|
|
8b3e94 |
#undef CMD_INC_FILE
|
|
|
8b3e94 |
-#define CMD_INC_FILE huawei-nvme
|
|
|
8b3e94 |
+#define CMD_INC_FILE plugins/huawei/huawei-nvme
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#if !defined(HUAWEI_NVME) || defined(CMD_HEADER_MULTI_READ)
|
|
|
8b3e94 |
#define HUAWEI_NVME
|
|
|
8b3e94 |
diff --git a/intel-nvme.c b/plugins/intel/intel-nvme.c
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from intel-nvme.c
|
|
|
8b3e94 |
rename to plugins/intel/intel-nvme.c
|
|
|
8b3e94 |
diff --git a/intel-nvme.h b/plugins/intel/intel-nvme.h
|
|
|
8b3e94 |
similarity index 94%
|
|
|
8b3e94 |
rename from intel-nvme.h
|
|
|
8b3e94 |
rename to plugins/intel/intel-nvme.h
|
|
|
8b3e94 |
index 5e6af0b..6d70efa 100644
|
|
|
8b3e94 |
--- a/intel-nvme.h
|
|
|
8b3e94 |
+++ b/plugins/intel/intel-nvme.h
|
|
|
8b3e94 |
@@ -1,5 +1,5 @@
|
|
|
8b3e94 |
#undef CMD_INC_FILE
|
|
|
8b3e94 |
-#define CMD_INC_FILE intel-nvme
|
|
|
8b3e94 |
+#define CMD_INC_FILE plugins/intel/intel-nvme
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#if !defined(INTEL_NVME) || defined(CMD_HEADER_MULTI_READ)
|
|
|
8b3e94 |
#define INTEL_NVME
|
|
|
8b3e94 |
diff --git a/lnvm-nvme.c b/plugins/lnvm/lnvm-nvme.c
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from lnvm-nvme.c
|
|
|
8b3e94 |
rename to plugins/lnvm/lnvm-nvme.c
|
|
|
8b3e94 |
diff --git a/lnvm-nvme.h b/plugins/lnvm/lnvm-nvme.h
|
|
|
8b3e94 |
similarity index 95%
|
|
|
8b3e94 |
rename from lnvm-nvme.h
|
|
|
8b3e94 |
rename to plugins/lnvm/lnvm-nvme.h
|
|
|
8b3e94 |
index 293ec8f..3d5cbc5 100644
|
|
|
8b3e94 |
--- a/lnvm-nvme.h
|
|
|
8b3e94 |
+++ b/plugins/lnvm/lnvm-nvme.h
|
|
|
8b3e94 |
@@ -1,6 +1,6 @@
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#undef CMD_INC_FILE
|
|
|
8b3e94 |
-#define CMD_INC_FILE lnvm-nvme
|
|
|
8b3e94 |
+#define CMD_INC_FILE plugins/lnvm/lnvm-nvme
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#if !defined(LNVM_NVME) || defined(CMD_HEADER_MULTI_READ)
|
|
|
8b3e94 |
#define LNVM_NVME
|
|
|
8b3e94 |
diff --git a/memblaze-nvme.c b/plugins/memblaze/memblaze-nvme.c
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from memblaze-nvme.c
|
|
|
8b3e94 |
rename to plugins/memblaze/memblaze-nvme.c
|
|
|
8b3e94 |
diff --git a/memblaze-nvme.h b/plugins/memblaze/memblaze-nvme.h
|
|
|
8b3e94 |
similarity index 91%
|
|
|
8b3e94 |
rename from memblaze-nvme.h
|
|
|
8b3e94 |
rename to plugins/memblaze/memblaze-nvme.h
|
|
|
8b3e94 |
index 82a0449..528285e 100644
|
|
|
8b3e94 |
--- a/memblaze-nvme.h
|
|
|
8b3e94 |
+++ b/plugins/memblaze/memblaze-nvme.h
|
|
|
8b3e94 |
@@ -1,5 +1,5 @@
|
|
|
8b3e94 |
#undef CMD_INC_FILE
|
|
|
8b3e94 |
-#define CMD_INC_FILE memblaze-nvme
|
|
|
8b3e94 |
+#define CMD_INC_FILE plugins/memblaze/memblaze-nvme
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#if !defined(MEMBLAZE_NVME) || defined(CMD_HEADER_MULTI_READ)
|
|
|
8b3e94 |
#define MEMBLAZE_NVME
|
|
|
8b3e94 |
diff --git a/micron-nvme.c b/plugins/micron/micron-nvme.c
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from micron-nvme.c
|
|
|
8b3e94 |
rename to plugins/micron/micron-nvme.c
|
|
|
8b3e94 |
diff --git a/micron-nvme.h b/plugins/micron/micron-nvme.h
|
|
|
8b3e94 |
similarity index 86%
|
|
|
8b3e94 |
rename from micron-nvme.h
|
|
|
8b3e94 |
rename to plugins/micron/micron-nvme.h
|
|
|
8b3e94 |
index 4054933..43e720c 100644
|
|
|
8b3e94 |
--- a/micron-nvme.h
|
|
|
8b3e94 |
+++ b/plugins/micron/micron-nvme.h
|
|
|
8b3e94 |
@@ -1,5 +1,5 @@
|
|
|
8b3e94 |
#undef CMD_INC_FILE
|
|
|
8b3e94 |
-#define CMD_INC_FILE micron-nvme
|
|
|
8b3e94 |
+#define CMD_INC_FILE plugins/micron/micron-nvme
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#if !defined(MICRON_NVME) || defined(CMD_HEADER_MULTI_READ)
|
|
|
8b3e94 |
#define MICRON_NVME
|
|
|
8b3e94 |
diff --git a/netapp-nvme.c b/plugins/netapp/netapp-nvme.c
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from netapp-nvme.c
|
|
|
8b3e94 |
rename to plugins/netapp/netapp-nvme.c
|
|
|
8b3e94 |
diff --git a/netapp-nvme.h b/plugins/netapp/netapp-nvme.h
|
|
|
8b3e94 |
similarity index 85%
|
|
|
8b3e94 |
rename from netapp-nvme.h
|
|
|
8b3e94 |
rename to plugins/netapp/netapp-nvme.h
|
|
|
8b3e94 |
index 6e3324c..3dd019e 100644
|
|
|
8b3e94 |
--- a/netapp-nvme.h
|
|
|
8b3e94 |
+++ b/plugins/netapp/netapp-nvme.h
|
|
|
8b3e94 |
@@ -1,5 +1,5 @@
|
|
|
8b3e94 |
#undef CMD_INC_FILE
|
|
|
8b3e94 |
-#define CMD_INC_FILE netapp-nvme
|
|
|
8b3e94 |
+#define CMD_INC_FILE plugins/netapp/netapp-nvme
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#if !defined(NETAPP_NVME) || defined(CMD_HEADER_MULTI_READ)
|
|
|
8b3e94 |
#define NETAPP_NVME
|
|
|
8b3e94 |
diff --git a/seagate-diag.h b/plugins/seagate/seagate-diag.h
|
|
|
8b3e94 |
old mode 100755
|
|
|
8b3e94 |
new mode 100644
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from seagate-diag.h
|
|
|
8b3e94 |
rename to plugins/seagate/seagate-diag.h
|
|
|
8b3e94 |
diff --git a/seagate-nvme.c b/plugins/seagate/seagate-nvme.c
|
|
|
8b3e94 |
old mode 100755
|
|
|
8b3e94 |
new mode 100644
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from seagate-nvme.c
|
|
|
8b3e94 |
rename to plugins/seagate/seagate-nvme.c
|
|
|
8b3e94 |
diff --git a/seagate-nvme.h b/plugins/seagate/seagate-nvme.h
|
|
|
8b3e94 |
old mode 100755
|
|
|
8b3e94 |
new mode 100644
|
|
|
8b3e94 |
similarity index 63%
|
|
|
8b3e94 |
rename from seagate-nvme.h
|
|
|
8b3e94 |
rename to plugins/seagate/seagate-nvme.h
|
|
|
8b3e94 |
index bcf19d3..2a00e77
|
|
|
8b3e94 |
--- a/seagate-nvme.h
|
|
|
8b3e94 |
+++ b/plugins/seagate/seagate-nvme.h
|
|
|
8b3e94 |
@@ -4,7 +4,7 @@
|
|
|
8b3e94 |
// Copyright (c) 2017-2018 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
|
|
|
8b3e94 |
//
|
|
|
8b3e94 |
// ******************************************************************************************
|
|
|
8b3e94 |
-//
|
|
|
8b3e94 |
+//
|
|
|
8b3e94 |
// This program is free software; you can redistribute it and/or
|
|
|
8b3e94 |
// modify it under the terms of the GNU General Public License
|
|
|
8b3e94 |
// as published by the Free Software Foundation; either version 2
|
|
|
8b3e94 |
@@ -17,9 +17,9 @@
|
|
|
8b3e94 |
//
|
|
|
8b3e94 |
// \file seagate-nvme.h
|
|
|
8b3e94 |
// \brief This file defines the functions and macros to make building a nvme-cli seagate plug-in.
|
|
|
8b3e94 |
-
|
|
|
8b3e94 |
+
|
|
|
8b3e94 |
#undef CMD_INC_FILE
|
|
|
8b3e94 |
-#define CMD_INC_FILE seagate-nvme
|
|
|
8b3e94 |
+#define CMD_INC_FILE plugins/seagate/seagate-nvme
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#if !defined(SEAGATE_NVME) || defined(CMD_HEADER_MULTI_READ)
|
|
|
8b3e94 |
#define SEAGATE_NVME
|
|
|
8b3e94 |
@@ -28,15 +28,15 @@
|
|
|
8b3e94 |
|
|
|
8b3e94 |
PLUGIN(NAME("seagate", "Seagate vendor specific extensions"),
|
|
|
8b3e94 |
COMMAND_LIST(
|
|
|
8b3e94 |
- ENTRY("vs-temperature-stats", "Retrieve Seagate temperature statistics ", temp_stats)
|
|
|
8b3e94 |
- ENTRY("vs-log-page-sup", "Retrieve Seagate Supported Log-pages Information ", log_pages_supp)
|
|
|
8b3e94 |
- ENTRY("vs-smart-add-log", "Retrieve Seagate extended-SMART Information ", vs_smart_log)
|
|
|
8b3e94 |
- ENTRY("vs-pcie-stats", "Retrieve Seagate PCIe error statistics ", vs_pcie_error_log)
|
|
|
8b3e94 |
- ENTRY("clear-pcie-correctable-errors", "Clear Seagate PCIe error statistics ", vs_clr_pcie_correctable_errs)
|
|
|
8b3e94 |
- ENTRY("get-host-tele", "Retrieve Seagate Host-Initiated Telemetry ", get_host_tele)
|
|
|
8b3e94 |
- ENTRY("get-ctrl-tele", "Retrieve Seagate Controller-Initiated Telemetry ", get_ctrl_tele)
|
|
|
8b3e94 |
- ENTRY("vs-internal-log", "Retrieve Seagate Controller-Initiated Telemetry in binary format", vs_internal_log)
|
|
|
8b3e94 |
- ENTRY("plugin-version", "Shows Seagate plugin's version information ", seagate_plugin_version)
|
|
|
8b3e94 |
+ ENTRY("vs-temperature-stats", "Retrieve Seagate temperature statistics ", temp_stats)
|
|
|
8b3e94 |
+ ENTRY("vs-log-page-sup", "Retrieve Seagate Supported Log-pages Information ", log_pages_supp)
|
|
|
8b3e94 |
+ ENTRY("vs-smart-add-log", "Retrieve Seagate extended-SMART Information ", vs_smart_log)
|
|
|
8b3e94 |
+ ENTRY("vs-pcie-stats", "Retrieve Seagate PCIe error statistics ", vs_pcie_error_log)
|
|
|
8b3e94 |
+ ENTRY("clear-pcie-correctable-errors", "Clear Seagate PCIe error statistics ", vs_clr_pcie_correctable_errs)
|
|
|
8b3e94 |
+ ENTRY("get-host-tele", "Retrieve Seagate Host-Initiated Telemetry ", get_host_tele)
|
|
|
8b3e94 |
+ ENTRY("get-ctrl-tele", "Retrieve Seagate Controller-Initiated Telemetry ", get_ctrl_tele)
|
|
|
8b3e94 |
+ ENTRY("vs-internal-log", "Retrieve Seagate Controller-Initiated Telemetry in binary format", vs_internal_log)
|
|
|
8b3e94 |
+ ENTRY("plugin-version", "Shows Seagate plugin's version information ", seagate_plugin_version)
|
|
|
8b3e94 |
)
|
|
|
8b3e94 |
);
|
|
|
8b3e94 |
|
|
|
8b3e94 |
diff --git a/toshiba-nvme.c b/plugins/toshiba/toshiba-nvme.c
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from toshiba-nvme.c
|
|
|
8b3e94 |
rename to plugins/toshiba/toshiba-nvme.c
|
|
|
8b3e94 |
diff --git a/toshiba-nvme.h b/plugins/toshiba/toshiba-nvme.h
|
|
|
8b3e94 |
similarity index 90%
|
|
|
8b3e94 |
rename from toshiba-nvme.h
|
|
|
8b3e94 |
rename to plugins/toshiba/toshiba-nvme.h
|
|
|
8b3e94 |
index cecbbf3..c405e78 100644
|
|
|
8b3e94 |
--- a/toshiba-nvme.h
|
|
|
8b3e94 |
+++ b/plugins/toshiba/toshiba-nvme.h
|
|
|
8b3e94 |
@@ -1,5 +1,5 @@
|
|
|
8b3e94 |
#undef CMD_INC_FILE
|
|
|
8b3e94 |
-#define CMD_INC_FILE toshiba-nvme
|
|
|
8b3e94 |
+#define CMD_INC_FILE plugins/toshiba/toshiba-nvme
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#if !defined(TOSHIBA_NVME) || defined(CMD_HEADER_MULTI_READ)
|
|
|
8b3e94 |
#define TOSHIBA_NVME
|
|
|
8b3e94 |
diff --git a/wdc-nvme.c b/plugins/wdc/wdc-nvme.c
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from wdc-nvme.c
|
|
|
8b3e94 |
rename to plugins/wdc/wdc-nvme.c
|
|
|
8b3e94 |
diff --git a/wdc-nvme.h b/plugins/wdc/wdc-nvme.h
|
|
|
8b3e94 |
similarity index 95%
|
|
|
8b3e94 |
rename from wdc-nvme.h
|
|
|
8b3e94 |
rename to plugins/wdc/wdc-nvme.h
|
|
|
8b3e94 |
index 3732005..c2d892b 100644
|
|
|
8b3e94 |
--- a/wdc-nvme.h
|
|
|
8b3e94 |
+++ b/plugins/wdc/wdc-nvme.h
|
|
|
8b3e94 |
@@ -1,5 +1,5 @@
|
|
|
8b3e94 |
#undef CMD_INC_FILE
|
|
|
8b3e94 |
-#define CMD_INC_FILE wdc-nvme
|
|
|
8b3e94 |
+#define CMD_INC_FILE plugins/wdc/wdc-nvme
|
|
|
8b3e94 |
|
|
|
8b3e94 |
#if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ)
|
|
|
8b3e94 |
#define WDC_NVME
|
|
|
8b3e94 |
diff --git a/wdc-utils.c b/plugins/wdc/wdc-utils.c
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from wdc-utils.c
|
|
|
8b3e94 |
rename to plugins/wdc/wdc-utils.c
|
|
|
8b3e94 |
diff --git a/wdc-utils.h b/plugins/wdc/wdc-utils.h
|
|
|
8b3e94 |
similarity index 100%
|
|
|
8b3e94 |
rename from wdc-utils.h
|
|
|
8b3e94 |
rename to plugins/wdc/wdc-utils.h
|