diff --git a/.gitignore b/.gitignore index 05e4f13..e0bc970 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/ledmon-0.79.tar.gz +SOURCES/ledmon-0.80.tar.gz diff --git a/.ledmon.metadata b/.ledmon.metadata index 8722ec2..89a7c2d 100644 --- a/.ledmon.metadata +++ b/.ledmon.metadata @@ -1 +1 @@ -3e37778ad6435fc61a650d2ded46799323b280b7 SOURCES/ledmon-0.79.tar.gz +58376a4ee280503c52b8ca5693af2c5f3af2e738 SOURCES/ledmon-0.80.tar.gz diff --git a/SOURCES/0001-Recognize-bool-values-in-sysfs.patch b/SOURCES/0001-Recognize-bool-values-in-sysfs.patch deleted file mode 100644 index 15224d5..0000000 --- a/SOURCES/0001-Recognize-bool-values-in-sysfs.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 6f7d38bbe5d7b13c84987cf3b3b550a11c39392e Mon Sep 17 00:00:00 2001 -From: Artur Paszkiewicz -Date: Tue, 29 Jul 2014 13:49:05 +0200 -Subject: [PATCH] Recognize bool values in sysfs - -The type of libahci parameter ahci_em_messages was changed from int to -bool in kernel v3.13, which caused AHCI HBAs to not be detected -properly. - -Reported-and-tested-by: Paul Boven -Signed-off-by: Artur Paszkiewicz ---- - src/cntrl.c | 7 +++++-- - src/utils.c | 17 +++++++++++++++++ - src/utils.h | 17 +++++++++++++++++ - 3 files changed, 39 insertions(+), 2 deletions(-) - -diff --git a/src/cntrl.c b/src/cntrl.c -index 2e6509b..e5170a2 100644 ---- a/src/cntrl.c -+++ b/src/cntrl.c -@@ -216,8 +216,11 @@ static unsigned int _ahci_em_messages(const char *path) - if (get_int(path, 0, "driver/module/parameters/ahci_em_messages") != 0) - return 1; - -- if (!get_int("", 0, "sys/module/libahci/parameters/ahci_em_messages")) -- return 0; -+ /* parameter type changed from int to bool since kernel v3.13 */ -+ if (!get_int("", 0, "sys/module/libahci/parameters/ahci_em_messages")) { -+ if (!get_bool("", 0, "sys/module/libahci/parameters/ahci_em_messages")) -+ return 0; -+ } - - if (snprintf(buf, sizeof(buf), "%s/%s", path, "driver") < 0) - return 0; -diff --git a/src/utils.c b/src/utils.c -index 36e4147..fca00a8 100644 ---- a/src/utils.c -+++ b/src/utils.c -@@ -86,6 +86,23 @@ char *get_text(const char *path, const char *name) - } - - /* -+ * Function returns integer value (1 or 0) based on a boolean value ('Y' or 'N') -+ * read from a text file. See utils.h for details. -+ */ -+int get_bool(const char *path, int defval, const char *name) -+{ -+ char *p = get_text(path, name); -+ if (p) { -+ if (*p == 'Y') -+ defval = 1; -+ else if (*p == 'N') -+ defval = 0; -+ free(p); -+ } -+ return defval; -+} -+ -+/* - * Function returns 64-bit unsigned integer value read from a text file. See - * utils.h for details. - */ -diff --git a/src/utils.h b/src/utils.h -index c982113..5a0a76c 100644 ---- a/src/utils.h -+++ b/src/utils.h -@@ -111,6 +111,23 @@ uint64_t get_uint64(const char *path, uint64_t defval, const char *name); - char *get_text(const char *path, const char *name); - - /** -+ * @brief Reads boolean value from a text file. -+ * -+ * This function assumes that the only text in a file is the requested value to -+ * read. The recognized boolean values are in the format 'Y' for True and 'N' -+ * for False. In case of an error while reading from file the function will -+ * return a value stored in defval argument. -+ * -+ * @param[in] path Path where a file is located. -+ * @param[in] defval Default value to be returned in case of error. -+ * @param[in] name Name of a file to be read. -+ * -+ * @return Value read from a file if successful, otherwise a value stored in -+ * defval argument. 1 is returned for True, 0 for False. -+ */ -+int get_bool(const char *path, int defval, const char *name); -+ -+/** - * @brief Writes a text to file. - * - * This function writes a text to a file and return the number of bytes written. --- -2.4.3 - diff --git a/SOURCES/ledmon-nvme.patch b/SOURCES/ledmon-nvme.patch new file mode 100644 index 0000000..749f916 --- /dev/null +++ b/SOURCES/ledmon-nvme.patch @@ -0,0 +1,67 @@ +commit 868a01e894f6abd33a98457a7ee4c1aa7e1eb2fe +Author: Artur Paszkiewicz +Date: Tue May 9 11:21:25 2017 +0200 + + Don't rely on searching for "/block" in sysfs path for detecting partitions + + It is simpler and more reliable to check for a "partition" file in the + device's directory (supported since kernel 2.6.28). The previous + approach would fail for nvme devices because their device path looks + like this: + /sys/devices/pci0000:00/0000:00:0c.0/nvme/nvme0/nvme0n1 + + Fixes: b30173ec8c05 ("* fix off-normal-failure block dev status loop * remove unused raid->slave_list member * support md raid on block device partitions") + +diff --git a/src/slave.c b/src/slave.c +index 9843ffd..436ed4a 100644 +--- a/src/slave.c ++++ b/src/slave.c +@@ -22,6 +22,8 @@ + #include + #include + #include ++#include ++#include + + #if _HAVE_DMALLOC_H + #include +@@ -100,27 +102,26 @@ static struct block_device *_get_block(const char *path, void *block_list) + { + char temp[PATH_MAX]; + char link[PATH_MAX]; +- char *ptr; +- struct block_device *device = NULL; + + str_cpy(temp, path, PATH_MAX); + str_cat(temp, "/block", PATH_MAX); + +- if (realpath(temp, link)) { +- ptr = strrchr(link, '/'); +- if (ptr && link < ptr - strlen("/block")) { +- /* translate partition to master block dev */ +- if(strncmp( +- ptr - strlen("/block"), +- "/block", +- strlen("/block"))) { ++ if (!realpath(temp, link)) ++ return NULL; + ++ /* translate partition to master block dev */ ++ if (snprintf(temp, PATH_MAX, "%s/partition", link) > 0) { ++ struct stat sb; ++ char *ptr; ++ ++ if (stat(temp, &sb) == 0 && S_ISREG(sb.st_mode)) { ++ ptr = strrchr(link, '/'); ++ if (ptr) + *ptr = '\0'; +- } +- device = list_first_that(block_list, _compare, link); + } + } +- return device; ++ ++ return list_first_that(block_list, _compare, link); + } + + /** diff --git a/SOURCES/ledmon_cflags.patch b/SOURCES/ledmon_cflags.patch index 23ccc75..72da7e3 100644 --- a/SOURCES/ledmon_cflags.patch +++ b/SOURCES/ledmon_cflags.patch @@ -1,15 +1,13 @@ ---- ledmon-0.79/src/Makefile 2013-11-27 16:38:17.000000000 +0100 -+++ ledmon-0.79-new/src/Makefile 2013-11-28 11:31:17.781209924 +0100 -@@ -55,10 +55,10 @@ +--- ledmon-0.80/src/Makefile 2016-11-25 13:59:48.000000000 +0100 ++++ ledmon-0.80-new/src/Makefile 2016-12-06 14:03:59.935258740 +0100 +@@ -57,10 +57,6 @@ LEDCTL_OBJECTS=\ $(OUTDIR)/ledctl.o \ $(OBJECTS) --CFLAGS=-O0 -g -Wall -+CFLAGS=-O2 -g -Wall +-CXFLAGS=-O0 -g +-CWFLAGS=-Wall +-CFLAGS=$(CXFLAGS) $(CWFLAGS) +- DEFFLAGS=-D_DEBUG -D_GNU_SOURCE -D_BSD_SOURCE -DDMALLOC_DISABLE - INCFLAGS=-I../config --LDFLAGS=-O0 -g $(DEFFLAGS) -lsgutils2 -+LDFLAGS=-O2 -g $(DEFFLAGS) -lsgutils2 - - SOURCES:=$(shell find -name "*.[cC]" -print) - + CPPFLAGS=$(DEFFLAGS) + ALL_CPPFLAGS=$(CPPFLAGS) -I../config diff --git a/SPECS/ledmon.spec b/SPECS/ledmon.spec index 30b10fc..0d00e84 100644 --- a/SPECS/ledmon.spec +++ b/SPECS/ledmon.spec @@ -1,13 +1,13 @@ Summary: Enclosure LED Utilities Name: ledmon -Version: 0.79 -Release: 4%{?dist} +Version: 0.80 +Release: 2%{?dist} License: GPLv2+ Group: Applications/System URL: http://sourceforge.net/projects/ledmon/ Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.gz Patch0: ledmon_cflags.patch -Patch1: 0001-Recognize-bool-values-in-sysfs.patch +Patch1: ledmon-nvme.patch BuildRequires: perl BuildRequires: sg3_utils-devel Obsoletes: ledctl = 0.1-1 @@ -40,6 +40,12 @@ make install INSTALL="%{__install} -p" DESTDIR=$RPM_BUILD_ROOT SBIN_DIR=$RPM_BUI %{_mandir}/*/* %changelog +* Fri May 12 2017 Jan Synáček - 0.80-2 +- LEDs don't blink during resync/recovery operations on the NVMe RAID volume (#1449990) + +* Mon Feb 6 2017 Jan Synáček - 0.80-1 +- Update to 0.80 (#1380018) + * Wed Sep 16 2015 Jan Synáček - 0.79-4 - Fix: Ledmon does not work with AHCI (#1262799)