Accepting request 448169 from home:pluskalm:branches:Base:System

- Update to version 0.80:
  * No upstream changelog available
  * refresh Makefile-error-dependency.patch
- Drop no longer needed 0001-Recognize_bool_values_in_sysfs.patch

OBS-URL: https://build.opensuse.org/request/show/448169
OBS-URL: https://build.opensuse.org/package/show/Base:System/ledmon?expand=0&rev=16
This commit is contained in:
Dirk Mueller 2017-01-02 08:53:35 +00:00 committed by Git OBS Bridge
parent 1bfaca2273
commit dcd1092024
6 changed files with 31 additions and 112 deletions

View File

@ -1,87 +0,0 @@
commit 6f7d38bbe5d7b13c84987cf3b3b550a11c39392e
Author: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Date: Tue Jul 29 13:49:05 2014 +0200
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 <boven@jive.nl>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
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.

View File

@ -3,20 +3,20 @@
src/Makefile | 6 +++---
2 files changed, 6 insertions(+), 11 deletions(-)
Index: ledmon-0.79/src/Makefile
Index: src/Makefile
===================================================================
--- ledmon-0.79.orig/src/Makefile
+++ ledmon-0.79/src/Makefile
@@ -56,7 +56,7 @@ LEDCTL_OBJECTS=\
$(OBJECTS)
--- src/Makefile.orig
+++ src/Makefile
@@ -61,7 +61,7 @@ CXFLAGS=-O0 -g
CWFLAGS=-Wall
CFLAGS=$(CXFLAGS) $(CWFLAGS)
CFLAGS=-O0 -g -Wall
-DEFFLAGS=-D_DEBUG -D_GNU_SOURCE -D_BSD_SOURCE -DDMALLOC_DISABLE
+DEFFLAGS=-D_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -DDMALLOC_DISABLE
INCFLAGS=-I../config
LDFLAGS=-O0 -g $(DEFFLAGS) -lsgutils2
CPPFLAGS=$(DEFFLAGS)
ALL_CPPFLAGS=$(CPPFLAGS) -I../config
@@ -65,10 +65,10 @@ SOURCES:=$(shell find -name "*.[cC]" -pr
@@ -73,10 +73,10 @@ SOURCES:=$(shell find -name "*.[cC]" -pr
default: all
ledmon: $(OUTDIR)/.depend $(LEDMON_OBJECTS)
@ -28,11 +28,11 @@ Index: ledmon-0.79/src/Makefile
+ $(CC) $(LDLIBS) $(LEDCTL_OBJECTS) -o $@ $(LDFLAGS)
$(OUTDIR)/%.o: %.c
$(CC) $(CFLAGS) $(DEFFLAGS) $(INCFLAGS) -c $< -o $@
Index: ledmon-0.79/Makefile
$(CC) $(CFLAGS) $(ALL_CPPFLAGS) -c $< -o $@
Index: Makefile
===================================================================
--- ledmon-0.79.orig/Makefile
+++ ledmon-0.79/Makefile
--- Makefile.orig
+++ Makefile
@@ -19,20 +19,15 @@
# Installation directory
DESTDIR?=

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:54568840578997b29632686d848d6d4ac534d02b3b920a38ffcde3ffbce2c730
size 59487

3
ledmon-0.80.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5000b0114c82d04b0bebdfe205458c39eed19cd002868790b2fb498c26917128
size 64199

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Dec 29 13:36:18 UTC 2016 - mpluskal@suse.com
- Update to version 0.80:
* No upstream changelog available
* refresh Makefile-error-dependency.patch
- Drop no longer needed 0001-Recognize_bool_values_in_sysfs.patch
-------------------------------------------------------------------
Thu Jul 14 03:39:05 UTC 2016 - zlliu@suse.com

View File

@ -17,7 +17,7 @@
Name: ledmon
Version: 0.79
Version: 0.80
Release: 0
Summary: Enclosure LED Utilities
License: GPL-2.0
@ -25,7 +25,6 @@ Group: Hardware/Other
Url: http://sourceforge.net/projects/ledmon/
Source0: http://sourceforge.net/projects/ledmon/files/ledmon-%{version}/%{name}-%{version}.tar.gz
Patch0: Makefile-error-dependency.patch
Patch1: 0001-Recognize_bool_values_in_sysfs.patch
BuildRequires: libsgutils-devel
Provides: sgpio:/sbin/ledmon
Provides: sgpio:/{%{_bindir}}/ledctl
@ -38,22 +37,21 @@ solutions.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch0
%build
make %{?_smp_mflags} CFLAGS="%{optflags}"
make %{?_smp_mflags} CXFLAGS="%{optflags} -lsgutils2"
%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
%make_install
%files
%defattr(-,root,root)
%doc README COPYING
%{_sbindir}/ledmon
%{_sbindir}/ledctl
%{_mandir}/man5/ledctl.conf.5.gz
%{_mandir}/man8/ledctl.8.gz
%{_mandir}/man8/ledmon.8.gz
%{_mandir}/man5/ledctl.conf.5%{ext_man}
%{_mandir}/man8/ledctl.8%{ext_man}
%{_mandir}/man8/ledmon.8%{ext_man}
%changelog