]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Refactor plugins in a file hierarchy
authorEyal Ben David <eyalbe@il.ibm.com>
Wed, 24 Oct 2018 15:08:16 +0000 (18:08 +0300)
committerEyal Ben David <eyalbe@il.ibm.com>
Wed, 24 Oct 2018 16:49:38 +0000 (19:49 +0300)
22 files changed:
Makefile
plugins/huawei/huawei-nvme.c [moved from huawei-nvme.c with 100% similarity]
plugins/huawei/huawei-nvme.h [moved from huawei-nvme.h with 88% similarity]
plugins/intel/intel-nvme.c [moved from intel-nvme.c with 100% similarity]
plugins/intel/intel-nvme.h [moved from intel-nvme.h with 94% similarity]
plugins/lnvm/lnvm-nvme.c [moved from lnvm-nvme.c with 100% similarity]
plugins/lnvm/lnvm-nvme.h [moved from lnvm-nvme.h with 95% similarity]
plugins/memblaze/memblaze-nvme.c [moved from memblaze-nvme.c with 100% similarity]
plugins/memblaze/memblaze-nvme.h [moved from memblaze-nvme.h with 91% similarity]
plugins/micron/micron-nvme.c [moved from micron-nvme.c with 100% similarity]
plugins/micron/micron-nvme.h [moved from micron-nvme.h with 86% similarity]
plugins/netapp/netapp-nvme.c [moved from netapp-nvme.c with 100% similarity]
plugins/netapp/netapp-nvme.h [moved from netapp-nvme.h with 85% similarity]
plugins/seagate/seagate-diag.h [moved from seagate-diag.h with 100% similarity, mode: 0644]
plugins/seagate/seagate-nvme.c [moved from seagate-nvme.c with 100% similarity, mode: 0644]
plugins/seagate/seagate-nvme.h [moved from seagate-nvme.h with 63% similarity, mode: 0644]
plugins/toshiba/toshiba-nvme.c [moved from toshiba-nvme.c with 100% similarity]
plugins/toshiba/toshiba-nvme.h [moved from toshiba-nvme.h with 90% similarity]
plugins/wdc/wdc-nvme.c [moved from wdc-nvme.c with 100% similarity]
plugins/wdc/wdc-nvme.h [moved from wdc-nvme.h with 95% similarity]
plugins/wdc/wdc-utils.c [moved from wdc-utils.c with 100% similarity]
plugins/wdc/wdc-utils.h [moved from wdc-utils.h with 100% similarity]

index 433bc410e8cd3cb35542dff999ca4a14b06a1223..70541cbf6dec6459a1154440f7f186be70a33e31 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS ?= -O2 -g -Wall -Werror
+CFLAGS ?= -O2 -g -Wall -Werror -I.
 CFLAGS += -std=gnu99
 CPPFLAGS += -D_GNU_SOURCE -D__CHECK_ENDIAN__
 LIBUUID = $(shell $(LD) -o /dev/null -luuid >/dev/null 2>&1; echo $$?)
@@ -32,18 +32,31 @@ override CFLAGS += -DNVME_VERSION='"$(NVME_VERSION)"'
 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 wdc-utils.o nvme-models.o \
-       huawei-nvme.o netapp-nvme.o  toshiba-nvme.o micron-nvme.o seagate-nvme.o
-
-nvme: nvme.c nvme.h $(OBJS) NVME-VERSION-FILE
-       $(CC) $(CPPFLAGS) $(CFLAGS) nvme.c -o $(NVME) $(OBJS) $(LDFLAGS)
+       nvme-lightnvm.o fabrics.o json.o nvme-models.o plugin.o
+
+PLUGIN_OBJS :=                                 \
+       plugins/intel/intel-nvme.o              \
+       plugins/lnvm/lnvm-nvme.o                \
+       plugins/memblaze/memblaze-nvme.o        \
+       plugins/wdc/wdc-nvme.o                  \
+       plugins/wdc/wdc-utils.o                 \
+       plugins/huawei/huawei-nvme.o            \
+       plugins/netapp/netapp-nvme.o            \
+       plugins/toshiba/toshiba-nvme.o          \
+       plugins/micron/micron-nvme.o            \
+       plugins/seagate/seagate-nvme.o
+
+nvme: nvme.c nvme.h $(OBJS) $(PLUGIN_OBJS) NVME-VERSION-FILE
+       $(CC) $(CPPFLAGS) $(CFLAGS) nvme.c -o $(NVME) $(OBJS) $(PLUGIN_OBJS) $(LDFLAGS)
+
+verify-no-dep: nvme.c nvme.h $(OBJS) NVME-VERSION-FILE
+       $(CC) $(CPPFLAGS) $(CFLAGS) nvme.c -o $@ $(OBJS) $(LDFLAGS)
 
 nvme.o: nvme.c nvme.h nvme-print.h nvme-ioctl.h argconfig.h suffix.h nvme-lightnvm.h fabrics.h
        $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
 
 %.o: %.c %.h nvme.h linux/nvme_ioctl.h nvme-ioctl.h nvme-print.h argconfig.h
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
+       $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
 
 doc: $(NVME)
        $(MAKE) -C Documentation
@@ -54,9 +67,10 @@ test:
 all: doc
 
 clean:
-       $(RM) $(NVME) *.o *~ a.out NVME-VERSION-FILE *.tar* nvme.spec version control nvme-*.deb
+       $(RM) $(NVME) $(OBJS) $(PLUGIN_OBJS) *~ a.out NVME-VERSION-FILE *.tar* nvme.spec version control nvme-*.deb
        $(MAKE) -C Documentation clean
        $(RM) tests/*.pyc
+       $(RM) verify-no-dep
 
 clobber: clean
        $(MAKE) -C Documentation clobber
similarity index 100%
rename from huawei-nvme.c
rename to plugins/huawei/huawei-nvme.c
similarity index 88%
rename from huawei-nvme.h
rename to plugins/huawei/huawei-nvme.h
index 91e8dfb38916a1b6db8da9d1935adfbb70a7be9a..7aac90cb76e9806e1459d5c3083b10cadc302eb4 100644 (file)
@@ -1,5 +1,5 @@
 #undef CMD_INC_FILE
-#define CMD_INC_FILE huawei-nvme
+#define CMD_INC_FILE plugins/huawei/huawei-nvme
 
 #if !defined(HUAWEI_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define HUAWEI_NVME
similarity index 100%
rename from intel-nvme.c
rename to plugins/intel/intel-nvme.c
similarity index 94%
rename from intel-nvme.h
rename to plugins/intel/intel-nvme.h
index 5e6af0bbf35e9fb7c4f4f16fb60f4b823a2b2bb4..6d70efa401d091de34f00f2539de2517e657803b 100644 (file)
@@ -1,5 +1,5 @@
 #undef CMD_INC_FILE
-#define CMD_INC_FILE intel-nvme
+#define CMD_INC_FILE plugins/intel/intel-nvme
 
 #if !defined(INTEL_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define INTEL_NVME
similarity index 100%
rename from lnvm-nvme.c
rename to plugins/lnvm/lnvm-nvme.c
similarity index 95%
rename from lnvm-nvme.h
rename to plugins/lnvm/lnvm-nvme.h
index 293ec8f13eb85fb50d3757da8c586a2c224c0799..3d5cbc57ea7710def03cfaf7303f0c3f2d2108b4 100644 (file)
@@ -1,6 +1,6 @@
 
 #undef CMD_INC_FILE
-#define CMD_INC_FILE lnvm-nvme
+#define CMD_INC_FILE plugins/lnvm/lnvm-nvme
 
 #if !defined(LNVM_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define LNVM_NVME
similarity index 91%
rename from memblaze-nvme.h
rename to plugins/memblaze/memblaze-nvme.h
index 82a04496106872ab7e90cdd1fd87ad16d75621da..528285ef40848496363b51f7106cd0aa289c79a0 100644 (file)
@@ -1,5 +1,5 @@
 #undef CMD_INC_FILE
-#define CMD_INC_FILE memblaze-nvme
+#define CMD_INC_FILE plugins/memblaze/memblaze-nvme
 
 #if !defined(MEMBLAZE_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define MEMBLAZE_NVME
similarity index 100%
rename from micron-nvme.c
rename to plugins/micron/micron-nvme.c
similarity index 86%
rename from micron-nvme.h
rename to plugins/micron/micron-nvme.h
index 40549335b8de67674492a8296fbc000e81b9c35c..43e720c2a80a528c8fdcd0b393b97d7f72205ec1 100644 (file)
@@ -1,5 +1,5 @@
 #undef CMD_INC_FILE
-#define CMD_INC_FILE micron-nvme
+#define CMD_INC_FILE plugins/micron/micron-nvme
 
 #if !defined(MICRON_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define MICRON_NVME
similarity index 100%
rename from netapp-nvme.c
rename to plugins/netapp/netapp-nvme.c
similarity index 85%
rename from netapp-nvme.h
rename to plugins/netapp/netapp-nvme.h
index 6e3324c791b45507bc402706a6a7134f9a8f5b6a..3dd019ea8b744020b06c46a29639a11d0d39b829 100644 (file)
@@ -1,5 +1,5 @@
 #undef CMD_INC_FILE
-#define CMD_INC_FILE netapp-nvme
+#define CMD_INC_FILE plugins/netapp/netapp-nvme
 
 #if !defined(NETAPP_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define NETAPP_NVME
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from seagate-diag.h
rename to plugins/seagate/seagate-diag.h
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from seagate-nvme.c
rename to plugins/seagate/seagate-nvme.c
old mode 100755 (executable)
new mode 100644 (file)
similarity index 63%
rename from seagate-nvme.h
rename to plugins/seagate/seagate-nvme.h
index bcf19d3..2a00e77
@@ -4,7 +4,7 @@
 // Copyright (c) 2017-2018 Seagate Technology LLC and/or its Affiliates, All Rights Reserved
 //
 // ******************************************************************************************
-// 
+//
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
 // as published by the Free Software Foundation; either version 2
@@ -17,9 +17,9 @@
 //
 // \file seagate-nvme.h
 // \brief This file defines the functions and macros to make building a nvme-cli seagate plug-in.
+
 #undef CMD_INC_FILE
-#define CMD_INC_FILE seagate-nvme
+#define CMD_INC_FILE plugins/seagate/seagate-nvme
 
 #if !defined(SEAGATE_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define SEAGATE_NVME
 
 PLUGIN(NAME("seagate", "Seagate vendor specific extensions"),
        COMMAND_LIST(
-               ENTRY("vs-temperature-stats",      "Retrieve Seagate temperature statistics ",             temp_stats)          
-               ENTRY("vs-log-page-sup",    "Retrieve Seagate Supported Log-pages Information ", log_pages_supp)                
-        ENTRY("vs-smart-add-log",       "Retrieve Seagate extended-SMART Information ",         vs_smart_log)          
-               ENTRY("vs-pcie-stats",      "Retrieve Seagate PCIe error statistics ", vs_pcie_error_log)               
-        ENTRY("clear-pcie-correctable-errors",      "Clear Seagate PCIe error statistics  ",             vs_clr_pcie_correctable_errs)
-        ENTRY("get-host-tele",       "Retrieve Seagate Host-Initiated Telemetry ",          get_host_tele)
-        ENTRY("get-ctrl-tele",       "Retrieve Seagate Controller-Initiated Telemetry ",    get_ctrl_tele)
-        ENTRY("vs-internal-log",       "Retrieve Seagate Controller-Initiated Telemetry in binary format",  vs_internal_log)           
-               ENTRY("plugin-version",     "Shows Seagate plugin's version information ", seagate_plugin_version)              
+               ENTRY("vs-temperature-stats",      "Retrieve Seagate temperature statistics ",             temp_stats)
+               ENTRY("vs-log-page-sup",    "Retrieve Seagate Supported Log-pages Information ", log_pages_supp)
+               ENTRY("vs-smart-add-log",       "Retrieve Seagate extended-SMART Information ",         vs_smart_log)
+               ENTRY("vs-pcie-stats",      "Retrieve Seagate PCIe error statistics ", vs_pcie_error_log)
+               ENTRY("clear-pcie-correctable-errors",      "Clear Seagate PCIe error statistics  ",             vs_clr_pcie_correctable_errs)
+               ENTRY("get-host-tele",       "Retrieve Seagate Host-Initiated Telemetry ",          get_host_tele)
+               ENTRY("get-ctrl-tele",       "Retrieve Seagate Controller-Initiated Telemetry ",    get_ctrl_tele)
+               ENTRY("vs-internal-log",       "Retrieve Seagate Controller-Initiated Telemetry in binary format",  vs_internal_log)
+               ENTRY("plugin-version",     "Shows Seagate plugin's version information ", seagate_plugin_version)
        )
 );
 
similarity index 90%
rename from toshiba-nvme.h
rename to plugins/toshiba/toshiba-nvme.h
index cecbbf33979979195d7147b7be35d6923d7752fb..c405e78129d17c78eb33649d5cc7bed25617265c 100644 (file)
@@ -1,5 +1,5 @@
 #undef CMD_INC_FILE
-#define CMD_INC_FILE toshiba-nvme
+#define CMD_INC_FILE plugins/toshiba/toshiba-nvme
 
 #if !defined(TOSHIBA_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define TOSHIBA_NVME
similarity index 100%
rename from wdc-nvme.c
rename to plugins/wdc/wdc-nvme.c
similarity index 95%
rename from wdc-nvme.h
rename to plugins/wdc/wdc-nvme.h
index 3732005c231b6ccabbbe1701f084e95ab6b792e6..c2d892b478331afb60cfd1a6ddafdba7ce19eb24 100644 (file)
@@ -1,5 +1,5 @@
 #undef CMD_INC_FILE
-#define CMD_INC_FILE wdc-nvme
+#define CMD_INC_FILE plugins/wdc/wdc-nvme
 
 #if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define WDC_NVME
similarity index 100%
rename from wdc-utils.c
rename to plugins/wdc/wdc-utils.c
similarity index 100%
rename from wdc-utils.h
rename to plugins/wdc/wdc-utils.h