import ledmon-0.93-1.el8
This commit is contained in:
parent
17481908ac
commit
6df854d5ab
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/ledmon-0.92.tar.gz
|
||||
SOURCES/ledmon-0.93.tar.gz
|
||||
|
@ -1 +1 @@
|
||||
1abf8102caa411baf39e8613080df54f13d8f7db SOURCES/ledmon-0.92.tar.gz
|
||||
c5a3c52b1dee64972ea5fba8cc3f92689360d6c9 SOURCES/ledmon-0.93.tar.gz
|
||||
|
@ -1,192 +0,0 @@
|
||||
From e44a22e2226a059bb46b06aae47a0f6d1c1284e9 Mon Sep 17 00:00:00 2001
|
||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||
Date: Tue, 7 May 2019 16:13:00 +0200
|
||||
Subject: [PATCH] fix segfault when a value is missing from ibpi_str[]
|
||||
|
||||
Replace all usages of ibpi_str[] with ibpi2str(), which always returns a
|
||||
valid string.
|
||||
|
||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||
---
|
||||
src/ibpi.h | 3 ++-
|
||||
src/ledctl.c | 4 ++--
|
||||
src/ledmon.c | 10 +++++-----
|
||||
src/scsi.c | 2 +-
|
||||
src/smp.c | 8 ++++----
|
||||
src/sysfs.c | 2 +-
|
||||
src/utils.c | 18 ++++++++++++++++++
|
||||
src/utils.h | 4 ++++
|
||||
9 files changed, 38 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/ibpi.h b/src/ibpi.h
|
||||
index 776fba3..109f112 100644
|
||||
--- a/src/ibpi.h
|
||||
+++ b/src/ibpi.h
|
||||
@@ -93,8 +93,9 @@ enum ibpi_pattern {
|
||||
SES_REQ_DEV_OFF,
|
||||
SES_REQ_FAULT,
|
||||
SES_REQ_PRDFAIL,
|
||||
+ ibpi_pattern_count,
|
||||
};
|
||||
|
||||
-extern const char *ibpi_str[];
|
||||
+extern const char *ibpi_str[ibpi_pattern_count];
|
||||
|
||||
#endif /* _IBPI_H_INCLUDED_ */
|
||||
diff --git a/src/ledctl.c b/src/ledctl.c
|
||||
index 2aa1abc..4dada8e 100644
|
||||
--- a/src/ledctl.c
|
||||
+++ b/src/ledctl.c
|
||||
@@ -267,7 +267,7 @@ static void _determine(struct ibpi_state *state)
|
||||
} else {
|
||||
log_warning
|
||||
("IBPI %s: missing block device(s)... pattern ignored.",
|
||||
- ibpi_str[state->ibpi]);
|
||||
+ ibpi2str(state->ibpi));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ static status_t _ibpi_state_add_block(struct ibpi_state *state, char *name)
|
||||
list_append(&state->block_list, blk1);
|
||||
else
|
||||
log_info("%s: %s: device already on the list.",
|
||||
- ibpi_str[state->ibpi], path);
|
||||
+ ibpi2str(state->ibpi), path);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
diff --git a/src/ledmon.c b/src/ledmon.c
|
||||
index 0ea2583..b775e6f 100644
|
||||
--- a/src/ledmon.c
|
||||
+++ b/src/ledmon.c
|
||||
@@ -667,8 +667,8 @@ static void _add_block(struct block_device *block)
|
||||
|
||||
if (ibpi != temp->ibpi && ibpi <= IBPI_PATTERN_REMOVED) {
|
||||
log_info("CHANGE %s: from '%s' to '%s'.",
|
||||
- temp->sysfs_path, ibpi_str[ibpi],
|
||||
- ibpi_str[temp->ibpi]);
|
||||
+ temp->sysfs_path, ibpi2str(ibpi),
|
||||
+ ibpi2str(temp->ibpi));
|
||||
}
|
||||
/* Check if name of the device changed.*/
|
||||
if (strcmp(temp->sysfs_path, block->sysfs_path)) {
|
||||
@@ -682,7 +682,7 @@ static void _add_block(struct block_device *block)
|
||||
temp = block_device_duplicate(block);
|
||||
if (temp != NULL) {
|
||||
log_info("NEW %s: state '%s'.", temp->sysfs_path,
|
||||
- ibpi_str[temp->ibpi]);
|
||||
+ ibpi2str(temp->ibpi));
|
||||
list_append(&ledmon_block_list, temp);
|
||||
}
|
||||
}
|
||||
@@ -714,8 +714,8 @@ static void _send_msg(struct block_device *block)
|
||||
block->ibpi == IBPI_PATTERN_REMOVED) {
|
||||
if (block->ibpi != IBPI_PATTERN_FAILED_DRIVE) {
|
||||
log_info("CHANGE %s: from '%s' to '%s'.",
|
||||
- block->sysfs_path, ibpi_str[block->ibpi],
|
||||
- ibpi_str[IBPI_PATTERN_FAILED_DRIVE]);
|
||||
+ block->sysfs_path, ibpi2str(block->ibpi),
|
||||
+ ibpi2str(IBPI_PATTERN_FAILED_DRIVE));
|
||||
block->ibpi = IBPI_PATTERN_FAILED_DRIVE;
|
||||
} else {
|
||||
char *host = strstr(block->sysfs_path, "host");
|
||||
diff --git a/src/scsi.c b/src/scsi.c
|
||||
index 3267076..03b43dd 100644
|
||||
--- a/src/scsi.c
|
||||
+++ b/src/scsi.c
|
||||
@@ -673,7 +673,7 @@ int scsi_ses_write(struct block_device *device, enum ibpi_pattern ibpi)
|
||||
if (ret) {
|
||||
log_warning
|
||||
("Unable to send %s message to %s. Device is missing?",
|
||||
- ibpi_str[ibpi], strstr(device->sysfs_path, "host"));
|
||||
+ ibpi2str(ibpi), strstr(device->sysfs_path, "host"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/src/smp.c b/src/smp.c
|
||||
index 038fe02..6023b0a 100644
|
||||
--- a/src/smp.c
|
||||
+++ b/src/smp.c
|
||||
@@ -468,16 +468,16 @@ int scsi_smp_fill_buffer(struct block_device *device, enum ibpi_pattern ibpi)
|
||||
if (c++) {
|
||||
log_debug
|
||||
("pattern %s not supported for device (/dev/%s)",
|
||||
- ibpi_str[ibpi], c);
|
||||
+ ibpi2str(ibpi), c);
|
||||
fprintf(stderr,
|
||||
"%s(): pattern %s not supported for device (/dev/%s)\n",
|
||||
- __func__, ibpi_str[ibpi], c);
|
||||
+ __func__, ibpi2str(ibpi), c);
|
||||
} else {
|
||||
log_debug("pattern %s not supported for device %s",
|
||||
- ibpi_str[ibpi], device->sysfs_path);
|
||||
+ ibpi2str(ibpi), device->sysfs_path);
|
||||
fprintf(stderr,
|
||||
"%s(): pattern %s not supported for device\n\t(%s)\n",
|
||||
- __func__, ibpi_str[ibpi], device->sysfs_path);
|
||||
+ __func__, ibpi2str(ibpi), device->sysfs_path);
|
||||
}
|
||||
__set_errno_and_return(ENOTSUP);
|
||||
}
|
||||
diff --git a/src/sysfs.c b/src/sysfs.c
|
||||
index 694878a..d4622dc 100644
|
||||
--- a/src/sysfs.c
|
||||
+++ b/src/sysfs.c
|
||||
@@ -487,7 +487,7 @@ static void _set_block_state(struct block_device *block, enum ibpi_pattern ibpi)
|
||||
char *debug_dev = strrchr(block->sysfs_path, '/');
|
||||
debug_dev = debug_dev ? debug_dev + 1 : block->sysfs_path;
|
||||
log_debug("(%s): device: %s, state: %s", __func__, debug_dev,
|
||||
- ibpi_str[ibpi]);
|
||||
+ ibpi2str(ibpi));
|
||||
if (block->ibpi < ibpi)
|
||||
block->ibpi = ibpi;
|
||||
}
|
||||
diff --git a/src/utils.c b/src/utils.c
|
||||
index eb189b1..2920fba 100644
|
||||
--- a/src/utils.c
|
||||
+++ b/src/utils.c
|
||||
@@ -616,3 +616,21 @@ status_t set_verbose_level(int log_level)
|
||||
}
|
||||
return STATUS_CMDLINE_ERROR;
|
||||
}
|
||||
+
|
||||
+const char *ibpi2str(enum ibpi_pattern ibpi)
|
||||
+{
|
||||
+ static char buf[20];
|
||||
+ const char *ret;
|
||||
+
|
||||
+ if (ibpi >= 0 && ibpi < ibpi_pattern_count)
|
||||
+ ret = ibpi_str[ibpi];
|
||||
+ else
|
||||
+ ret = NULL;
|
||||
+
|
||||
+ if (!ret) {
|
||||
+ snprintf(buf, sizeof(buf), "(unknown: %d)", ibpi);
|
||||
+ ret = buf;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
diff --git a/src/utils.h b/src/utils.h
|
||||
index 720447a..67a211c 100644
|
||||
--- a/src/utils.h
|
||||
+++ b/src/utils.h
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "list.h"
|
||||
#include "status.h"
|
||||
#include "syslog.h"
|
||||
+#include "ibpi.h"
|
||||
|
||||
/**
|
||||
* Maximum number of bytes in temporary buffer. It is used for local variables.
|
||||
@@ -354,4 +355,7 @@ void setup_options(struct option **longopt, char **shortopt, int *options,
|
||||
int options_nr);
|
||||
int get_option_id(const char *optarg);
|
||||
status_t set_verbose_level(int log_level);
|
||||
+
|
||||
+const char *ibpi2str(enum ibpi_pattern ibpi);
|
||||
+
|
||||
#endif /* _UTILS_H_INCLUDED_ */
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,54 @@
|
||||
commit 13040e80dec77d7c9e9e3636f2068fce9e056dc2
|
||||
Author: Krzysztof Smolinski <krzysztof.smolinski@intel.com>
|
||||
Date: Sun Nov 10 18:58:01 2019 +0100
|
||||
|
||||
ledmon: paths in systemd service file are generated
|
||||
|
||||
Ledmon service file contained hardcoded path to ledmon executable.
|
||||
This patch places correct installation path of ledmon in systemd
|
||||
service file.
|
||||
|
||||
Signed-off-by: Krzysztof Smolinski <krzysztof.smolinski@intel.com>
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 0bfc188..63bf8a3 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -21,5 +21,5 @@ if SYSTEMD_CONDITION
|
||||
endif
|
||||
|
||||
SUBDIRS = doc src $(OPTIONAL_SUBDIR)
|
||||
-EXTRA_DIST = config/config.h systemd/ledmon.service
|
||||
+EXTRA_DIST = config/config.h systemd/ledmon.service.in
|
||||
dist_doc_DATA = README
|
||||
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
|
||||
index 4303628..962b122 100644
|
||||
--- a/systemd/Makefile.am
|
||||
+++ b/systemd/Makefile.am
|
||||
@@ -18,6 +18,12 @@
|
||||
|
||||
# Installation directory of ledmon systemd service unit.
|
||||
systemddir = @SYSTEMD_PATH@
|
||||
+SED = sed
|
||||
+
|
||||
+CLEANFILES = ledmon.service ledmon.service.tmp
|
||||
|
||||
systemd_DATA = ledmon.service
|
||||
|
||||
+ledmon.service : ledmon.service.in
|
||||
+ $(SED) -e 's|@sbindir[@]|$(sbindir)|g' < $< > $@.tmp
|
||||
+ mv $@.tmp $@
|
||||
diff --git a/systemd/ledmon.service b/systemd/ledmon.service.in
|
||||
similarity index 76%
|
||||
rename from systemd/ledmon.service
|
||||
rename to systemd/ledmon.service.in
|
||||
index d2fa08c..059fd95 100644
|
||||
--- a/systemd/ledmon.service
|
||||
+++ b/systemd/ledmon.service.in
|
||||
@@ -7,5 +7,5 @@ WantedBy=multi-user.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
-ExecStart=/usr/sbin/ledmon --foreground
|
||||
+ExecStart=@sbindir@/ledmon --foreground
|
||||
Restart=on-failure
|
@ -1,97 +0,0 @@
|
||||
From 7d57e3844af6aec97aef0757c85a4b82e999f199 Mon Sep 17 00:00:00 2001
|
||||
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||
Date: Wed, 8 May 2019 11:08:36 +0200
|
||||
Subject: [PATCH] fix the _ledmon_status() function
|
||||
|
||||
Remove a wrong strncat() usage and simplify the whole function while at
|
||||
it. Don't print an exit message when the parent is exiting - it always
|
||||
exits immediately after fork with status = EXIT_SUCCESS.
|
||||
|
||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||
---
|
||||
src/ledmon.c | 36 ++++++++++++++++++------------------
|
||||
1 file changed, 18 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/ledmon.c b/src/ledmon.c
|
||||
index b775e6f..bbe04fc 100644
|
||||
--- a/src/ledmon.c
|
||||
+++ b/src/ledmon.c
|
||||
@@ -178,34 +178,31 @@ static void _ledmon_fini(int __attribute__ ((unused)) status, void *program_name
|
||||
*
|
||||
* @param[in] status Status given in the last call to exit()
|
||||
* function.
|
||||
- * @param[in] ignore Pointer to placeholder where ignore flag is
|
||||
- * stored. If flag is set 0 then parent process
|
||||
- * is exiting, otherwise a child is exiting.
|
||||
- * This argument must not be NULL pointer.
|
||||
+ * @param[in] arg Argument passed to on_exit().
|
||||
*
|
||||
* @return The function does not return a value.
|
||||
*/
|
||||
-static void _ledmon_status(int status, void *ignore)
|
||||
+static void _ledmon_status(int status, void *arg)
|
||||
{
|
||||
- struct log_level_info *lli;
|
||||
int log_level;
|
||||
char message[4096];
|
||||
+ int ignore = *((int *)arg);
|
||||
|
||||
- memset(message, 0, 4096);
|
||||
- if (*((int *)ignore) != 0) {
|
||||
+ if (ignore)
|
||||
+ return;
|
||||
+
|
||||
+ if (status == STATUS_SUCCESS)
|
||||
log_level = LOG_LEVEL_INFO;
|
||||
- } else if (status != STATUS_SUCCESS) {
|
||||
+ else
|
||||
log_level = LOG_LEVEL_ERROR;
|
||||
- snprintf(message, sizeof(message), "parent ");
|
||||
- } else
|
||||
- return;
|
||||
|
||||
- strncat(message, "exit status is", sizeof(message));
|
||||
- lli = &log_level_infos[log_level];
|
||||
+ snprintf(message, sizeof(message), "exit status is %s.",
|
||||
+ strstatus(status));
|
||||
+
|
||||
if (get_log_fd() >= 0)
|
||||
- _log(log_level, "%s %s.", message, strstatus(status));
|
||||
+ _log(log_level, message);
|
||||
else
|
||||
- syslog(lli->priority, "%s %s.", message, strstatus(status));
|
||||
+ syslog(log_level_infos[log_level].priority, message);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -854,13 +851,14 @@ static void _close_parent_fds(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
status_t status = STATUS_SUCCESS;
|
||||
+ int ignore = 0;
|
||||
|
||||
setup_options(&longopt, &shortopt, possible_params,
|
||||
possible_params_size);
|
||||
set_invocation_name(argv[0]);
|
||||
openlog(progname, LOG_PID | LOG_PERROR, LOG_DAEMON);
|
||||
|
||||
- if (on_exit(_ledmon_status, &terminate))
|
||||
+ if (on_exit(_ledmon_status, &ignore))
|
||||
return STATUS_ONEXIT_ERROR;
|
||||
|
||||
if (_cmdline_parse_non_daemonise(argc, argv) != STATUS_SUCCESS)
|
||||
@@ -900,8 +898,10 @@ int main(int argc, char *argv[])
|
||||
log_debug("main(): fork() failed (errno=%d).", errno);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
- if (pid > 0)
|
||||
+ if (pid > 0) {
|
||||
+ ignore = 1; /* parent: don't print exit status */
|
||||
exit(EXIT_SUCCESS);
|
||||
+ }
|
||||
|
||||
pid_t sid = setsid();
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
26
SOURCES/0002-smp_fix_the_activity_indicator_states.patch
Normal file
26
SOURCES/0002-smp_fix_the_activity_indicator_states.patch
Normal file
@ -0,0 +1,26 @@
|
||||
commit dc6d2c546b938b106f4f8ba708989193d9a6c90d
|
||||
Author: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||
Date: Fri Nov 29 11:56:41 2019 +0100
|
||||
|
||||
smp: fix the activity indicator states
|
||||
|
||||
The values for SOF and EOF were interchanged, which caused an incorrect
|
||||
default value to be used (100b instead of 101b).
|
||||
|
||||
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
|
||||
|
||||
diff --git a/src/smp.c b/src/smp.c
|
||||
index b893d76..2c089f8 100644
|
||||
--- a/src/smp.c
|
||||
+++ b/src/smp.c
|
||||
@@ -61,8 +61,8 @@
|
||||
#define LED_ON 1
|
||||
#define LED_4HZ 2
|
||||
#define LED_I4HZ 3
|
||||
-#define LED_SOF 4
|
||||
-#define LED_EOF 5
|
||||
+#define LED_EOF 4
|
||||
+#define LED_SOF 5
|
||||
#define LED_2HZ 6
|
||||
#define LED_I2HZ 7
|
||||
|
320
SOURCES/0003-amd_sgpio_correct_use_of_packed_structs.patch
Normal file
320
SOURCES/0003-amd_sgpio_correct_use_of_packed_structs.patch
Normal file
@ -0,0 +1,320 @@
|
||||
commit d4687596f64190afd772bfd5404e56b411424eab
|
||||
Author: Nathan Fontenot <nafonten@amd.com>
|
||||
Date: Mon Dec 2 10:59:04 2019 -0600
|
||||
|
||||
amd_sgpio: Correct use of packed structs
|
||||
|
||||
With gcc-9 the -Waddress-of-packed-member flag is enabled by default to
|
||||
prevent access to unaligned members of a struct on systems that do not
|
||||
support unaligned accesses.
|
||||
|
||||
To correct this the amd_sgpio code is updated to no longer use pointers
|
||||
to packed structures.
|
||||
|
||||
Signed-off-by: Nathan Fontenot <nathan.fonteno@amd.com>
|
||||
|
||||
diff --git a/src/amd_sgpio.c b/src/amd_sgpio.c
|
||||
index 8150e4c..efe1c26 100644
|
||||
--- a/src/amd_sgpio.c
|
||||
+++ b/src/amd_sgpio.c
|
||||
@@ -330,112 +330,114 @@ static int _send_sgpio_register(const char *em_buffer_path, void *reg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void _init_sgpio_hdr(sgpio_hdr_t *hdr, int data_size, int msg_size)
|
||||
+static sgpio_hdr_t _init_sgpio_hdr(int data_size, int msg_size)
|
||||
{
|
||||
- memset(hdr, 0, sizeof(*hdr));
|
||||
+ sgpio_hdr_t hdr = 0;
|
||||
|
||||
- set_sgpio_hdr_msg_type(hdr, SGPIO_HDR_MSG_TYPE_SGPIO);
|
||||
- set_sgpio_hdr_data_size(hdr, data_size);
|
||||
- set_sgpio_hdr_msg_size(hdr, msg_size);
|
||||
+ set_sgpio_hdr_msg_type(&hdr, SGPIO_HDR_MSG_TYPE_SGPIO);
|
||||
+ set_sgpio_hdr_data_size(&hdr, data_size);
|
||||
+ set_sgpio_hdr_msg_size(&hdr, msg_size);
|
||||
+
|
||||
+ return hdr;
|
||||
}
|
||||
|
||||
-static void _dump_sgpio_hdr(sgpio_hdr_t *hdr)
|
||||
+static void _dump_sgpio_hdr(const char *type, sgpio_hdr_t hdr)
|
||||
{
|
||||
- log_debug("SGPIO Header\n");
|
||||
- log_debug(REG_FMT_2, "message type", get_sgpio_hdr_msg_type(hdr),
|
||||
- "data size", get_sgpio_hdr_data_size(hdr));
|
||||
- log_debug(REG_FMT_1, "message size", get_sgpio_hdr_msg_size(hdr));
|
||||
+ log_debug("%s SGPIO Header: %08x\n", type, hdr);
|
||||
+ log_debug(REG_FMT_2, "message type", get_sgpio_hdr_msg_type(&hdr),
|
||||
+ "data size", get_sgpio_hdr_data_size(&hdr));
|
||||
+ log_debug(REG_FMT_1, "message size", get_sgpio_hdr_msg_size(&hdr));
|
||||
}
|
||||
|
||||
-static void _init_sgpio_req(sgpio_req_t *req, int frame_type, int function,
|
||||
- int reg_type, int reg_index, int reg_count)
|
||||
+static sgpio_req_t _init_sgpio_req(int frame_type, int function,
|
||||
+ int reg_type, int reg_index,
|
||||
+ int reg_count)
|
||||
{
|
||||
- memset(req, 0, sizeof(*req));
|
||||
+ sgpio_req_t req = 0;
|
||||
+
|
||||
+ set_sgpio_req_frame_type(&req, frame_type);
|
||||
+ set_sgpio_req_function(&req, function);
|
||||
+ set_sgpio_req_reg_type(&req, reg_type);
|
||||
+ set_sgpio_req_reg_index(&req, reg_index);
|
||||
+ set_sgpio_req_reg_count(&req, reg_count);
|
||||
|
||||
- set_sgpio_req_frame_type(req, frame_type);
|
||||
- set_sgpio_req_function(req, function);
|
||||
- set_sgpio_req_reg_type(req, reg_type);
|
||||
- set_sgpio_req_reg_index(req, reg_index);
|
||||
- set_sgpio_req_reg_count(req, reg_count);
|
||||
+ return req;
|
||||
}
|
||||
|
||||
-static void _dump_sgpio_req(sgpio_req_t *req)
|
||||
+static void _dump_sgpio_req(const char *type, sgpio_req_t req)
|
||||
{
|
||||
- log_debug("SGPIO Request Register:\n");
|
||||
- log_debug(REG_FMT_2, "frame type", get_sgpio_req_frame_type(req),
|
||||
- "function", get_sgpio_req_function(req));
|
||||
- log_debug(REG_FMT_2, "register type", get_sgpio_req_reg_type(req),
|
||||
- "register index", get_sgpio_req_reg_index(req));
|
||||
- log_debug(REG_FMT_1, "register count", get_sgpio_req_reg_count(req));
|
||||
+ uint32_t *r = (uint32_t *)&req;
|
||||
+
|
||||
+ log_debug("%s SGPIO Request Register: %08x %08x\n", type, r[0], r[1]);
|
||||
+ log_debug(REG_FMT_2, "frame type", get_sgpio_req_frame_type(&req),
|
||||
+ "function", get_sgpio_req_function(&req));
|
||||
+ log_debug(REG_FMT_2, "register type", get_sgpio_req_reg_type(&req),
|
||||
+ "register index", get_sgpio_req_reg_index(&req));
|
||||
+ log_debug(REG_FMT_1, "register count", get_sgpio_req_reg_count(&req));
|
||||
}
|
||||
|
||||
-static void _init_sgpio_cfg(sgpio_cfg_t *cfg, int gpio_enable, int blink_a,
|
||||
- int blink_b, int force_off, int max_on,
|
||||
- int stretch_off, int stretch_on)
|
||||
+static sgpio_cfg_t _init_sgpio_cfg(int gpio_enable, int blink_a,
|
||||
+ int blink_b, int force_off, int max_on,
|
||||
+ int stretch_off, int stretch_on)
|
||||
{
|
||||
- memset(cfg, 0, sizeof(*cfg));
|
||||
+ sgpio_cfg_t cfg = 0;
|
||||
|
||||
if (gpio_enable)
|
||||
- set_sgpio_cfg_gpio_enable(cfg, 1);
|
||||
-
|
||||
- set_sgpio_cfg_blink_gen_a(cfg, blink_a);
|
||||
- set_sgpio_cfg_blink_gen_b(cfg, blink_b);
|
||||
- set_sgpio_cfg_max_on(cfg, max_on);
|
||||
- set_sgpio_cfg_force_off(cfg, force_off);
|
||||
- set_sgpio_cfg_stretch_on(cfg, stretch_on);
|
||||
- set_sgpio_cfg_stretch_off(cfg, stretch_off);
|
||||
+ set_sgpio_cfg_gpio_enable(&cfg, 1);
|
||||
+
|
||||
+ set_sgpio_cfg_blink_gen_a(&cfg, blink_a);
|
||||
+ set_sgpio_cfg_blink_gen_b(&cfg, blink_b);
|
||||
+ set_sgpio_cfg_max_on(&cfg, max_on);
|
||||
+ set_sgpio_cfg_force_off(&cfg, force_off);
|
||||
+ set_sgpio_cfg_stretch_on(&cfg, stretch_on);
|
||||
+ set_sgpio_cfg_stretch_off(&cfg, stretch_off);
|
||||
+
|
||||
+ return cfg;
|
||||
}
|
||||
|
||||
-static void _dump_sgpio_cfg(sgpio_cfg_t *cfg)
|
||||
+static void _dump_sgpio_cfg(const char *type, sgpio_cfg_t cfg)
|
||||
{
|
||||
- log_debug("SGPIO Configuration Register:\n");
|
||||
- log_debug(REG_FMT_2, "version", get_sgpio_cfg_version(cfg),
|
||||
- "gp register count", get_sgpio_cfg_gp_reg_count(cfg));
|
||||
+ uint32_t *r = (uint32_t *)&cfg;
|
||||
+
|
||||
+ log_debug("%s SGPIO Configuration Register: %08x %08x\n", type,
|
||||
+ r[0], r[1]);
|
||||
+ log_debug(REG_FMT_2, "version", get_sgpio_cfg_version(&cfg),
|
||||
+ "gp register count", get_sgpio_cfg_gp_reg_count(&cfg));
|
||||
log_debug(REG_FMT_2, "cfg register count",
|
||||
- get_sgpio_cfg_cfg_reg_count(cfg), "gpio enabled",
|
||||
- get_sgpio_cfg_gpio_enable(cfg));
|
||||
- log_debug(REG_FMT_2, "drive count", get_sgpio_cfg_drive_count(cfg),
|
||||
- "blink gen rate A", get_sgpio_cfg_blink_gen_a(cfg));
|
||||
+ get_sgpio_cfg_cfg_reg_count(&cfg), "gpio enabled",
|
||||
+ get_sgpio_cfg_gpio_enable(&cfg));
|
||||
+ log_debug(REG_FMT_2, "drive count", get_sgpio_cfg_drive_count(&cfg),
|
||||
+ "blink gen rate A", get_sgpio_cfg_blink_gen_a(&cfg));
|
||||
|
||||
log_debug(REG_FMT_2, "blink gen rate B",
|
||||
- get_sgpio_cfg_blink_gen_b(cfg), "force activity off",
|
||||
- get_sgpio_cfg_force_off(cfg));
|
||||
- log_debug(REG_FMT_2, "max activity on", get_sgpio_cfg_max_on(cfg),
|
||||
- "stretch activity off", get_sgpio_cfg_stretch_off(cfg));
|
||||
+ get_sgpio_cfg_blink_gen_b(&cfg), "force activity off",
|
||||
+ get_sgpio_cfg_force_off(&cfg));
|
||||
+ log_debug(REG_FMT_2, "max activity on", get_sgpio_cfg_max_on(&cfg),
|
||||
+ "stretch activity off", get_sgpio_cfg_stretch_off(&cfg));
|
||||
log_debug(REG_FMT_1, "stretch activity on",
|
||||
- get_sgpio_cfg_stretch_on(cfg));
|
||||
+ get_sgpio_cfg_stretch_on(&cfg));
|
||||
}
|
||||
|
||||
-static void _init_sgpio_amd(sgpio_amd_t *amd, int initiator, int polarity,
|
||||
- int bypass, int normal)
|
||||
+static sgpio_amd_t _init_sgpio_amd(int initiator, int polarity,
|
||||
+ int bypass, int normal)
|
||||
{
|
||||
- memset(amd, 0, sizeof(*amd));
|
||||
+ sgpio_amd_t amd = 0;
|
||||
|
||||
- set_sgpio_amd_initiator(amd, initiator);
|
||||
- set_sgpio_amd_polarity_flip(amd, polarity);
|
||||
- set_sgpio_amd_bypass_enable(amd, bypass);
|
||||
- set_sgpio_amd_return_to_normal(amd, normal);
|
||||
-}
|
||||
+ set_sgpio_amd_initiator(&amd, initiator);
|
||||
+ set_sgpio_amd_polarity_flip(&amd, polarity);
|
||||
+ set_sgpio_amd_bypass_enable(&amd, bypass);
|
||||
+ set_sgpio_amd_return_to_normal(&amd, normal);
|
||||
|
||||
-static void _dump_sgpio_amd(sgpio_amd_t *amd)
|
||||
-{
|
||||
- log_debug("SGPIO AMD Register\n");
|
||||
- log_debug(REG_FMT_2, "initiator", get_sgpio_amd_initiator(amd),
|
||||
- "polarity", get_sgpio_amd_polarity_flip(amd));
|
||||
- log_debug(REG_FMT_2, "bypass enable", get_sgpio_amd_bypass_enable(amd),
|
||||
- "return to normal", get_sgpio_amd_return_to_normal(amd));
|
||||
+ return amd;
|
||||
}
|
||||
|
||||
-static void _dump_cfg_register(struct config_register *cfg_reg)
|
||||
+static void _dump_sgpio_amd(const char *type, sgpio_amd_t amd)
|
||||
{
|
||||
- uint32_t *reg = (uint32_t *)cfg_reg;
|
||||
-
|
||||
- log_info("CFG Register: %08x %08x %08x %08x %08x",
|
||||
- reg[0], reg[1], reg[2], reg[3], reg[4]);
|
||||
-
|
||||
- _dump_sgpio_hdr(&cfg_reg->hdr);
|
||||
- _dump_sgpio_req(&cfg_reg->req);
|
||||
- _dump_sgpio_cfg(&cfg_reg->cfg);
|
||||
+ log_debug("%s SGPIO AMD Register: %08x\n", type, amd);
|
||||
+ log_debug(REG_FMT_2, "initiator", get_sgpio_amd_initiator(&amd),
|
||||
+ "polarity", get_sgpio_amd_polarity_flip(&amd));
|
||||
+ log_debug(REG_FMT_2, "bypass enable", get_sgpio_amd_bypass_enable(&amd),
|
||||
+ "return to normal", get_sgpio_amd_return_to_normal(&amd));
|
||||
}
|
||||
|
||||
static int _write_cfg_register(const char *em_buffer_path,
|
||||
@@ -443,53 +445,49 @@ static int _write_cfg_register(const char *em_buffer_path,
|
||||
{
|
||||
struct config_register cfg_reg;
|
||||
|
||||
- _init_sgpio_hdr(&cfg_reg.hdr, 0, sizeof(cfg_reg));
|
||||
- _init_sgpio_req(&cfg_reg.req, 0x40, 0x82, SGPIO_REQ_REG_TYPE_CFG, 0, 2);
|
||||
+ cfg_reg.hdr = _init_sgpio_hdr(0, sizeof(cfg_reg));
|
||||
+ cfg_reg.req = _init_sgpio_req(0x40, 0x82, SGPIO_REQ_REG_TYPE_CFG,
|
||||
+ 0, 2);
|
||||
|
||||
if (cache->blink_gen_a)
|
||||
cache->blink_gen_b = ibpi_pattern[ibpi];
|
||||
else
|
||||
cache->blink_gen_a = ibpi_pattern[ibpi];
|
||||
|
||||
- _init_sgpio_cfg(&cfg_reg.cfg, 1, cache->blink_gen_a, cache->blink_gen_b,
|
||||
- 2, 1, 0, 0);
|
||||
+ cfg_reg.cfg = _init_sgpio_cfg(1, cache->blink_gen_a,
|
||||
+ cache->blink_gen_b, 2, 1, 0, 0);
|
||||
+
|
||||
+ _dump_sgpio_hdr("CFG", cfg_reg.hdr);
|
||||
+ _dump_sgpio_req("CFG", cfg_reg.req);
|
||||
+ _dump_sgpio_cfg("CFG", cfg_reg.cfg);
|
||||
|
||||
- _dump_cfg_register(&cfg_reg);
|
||||
return _send_sgpio_register(em_buffer_path, &cfg_reg, sizeof(cfg_reg));
|
||||
}
|
||||
|
||||
-static void _dump_sgpio_tx(sgpio_tx_t *tx)
|
||||
+static void _dump_sgpio_tx(const char *type, sgpio_tx_t tx)
|
||||
{
|
||||
int i;
|
||||
|
||||
- log_debug("SGPIO TX Register:\n");
|
||||
+ log_debug("%s SGPIO TX Register: %08x\n", type, tx);
|
||||
for (i = 0; i < 4; i++) {
|
||||
log_debug("\tdrive %d: error %x, locate %x, activity %x\n", i,
|
||||
- get_error_led(&tx->drive[i]),
|
||||
- get_locate_led(&tx->drive[i]),
|
||||
- get_activity_led(&tx->drive[i]));
|
||||
+ get_error_led(&tx.drive[i]),
|
||||
+ get_locate_led(&tx.drive[i]),
|
||||
+ get_activity_led(&tx.drive[i]));
|
||||
}
|
||||
}
|
||||
|
||||
-static void _dump_tx_register(struct transmit_register *tx_reg)
|
||||
-{
|
||||
- uint32_t *reg = (uint32_t *)tx_reg;
|
||||
-
|
||||
- log_info("TX Register: %08x %08x %08x %08x", reg[0], reg[1],
|
||||
- reg[2], reg[3]);
|
||||
-
|
||||
- _dump_sgpio_hdr(&tx_reg->hdr);
|
||||
- _dump_sgpio_req(&tx_reg->req);
|
||||
- _dump_sgpio_tx(&tx_reg->tx);
|
||||
-}
|
||||
-
|
||||
static int _write_tx_register(const char *em_buffer_path,
|
||||
struct transmit_register *tx_reg)
|
||||
{
|
||||
- _init_sgpio_hdr(&tx_reg->hdr, 0, sizeof(*tx_reg));
|
||||
- _init_sgpio_req(&tx_reg->req, 0x40, 0x82, SGPIO_REQ_REG_TYPE_TX, 0, 1);
|
||||
+ tx_reg->hdr = _init_sgpio_hdr(0, sizeof(*tx_reg));
|
||||
+ tx_reg->req = _init_sgpio_req(0x40, 0x82, SGPIO_REQ_REG_TYPE_TX,
|
||||
+ 0, 1);
|
||||
+
|
||||
+ _dump_sgpio_hdr("TX", tx_reg->hdr);
|
||||
+ _dump_sgpio_req("TX", tx_reg->req);
|
||||
+ _dump_sgpio_tx("TX", tx_reg->tx);
|
||||
|
||||
- _dump_tx_register(tx_reg);
|
||||
return _send_sgpio_register(em_buffer_path, tx_reg, sizeof(*tx_reg));
|
||||
}
|
||||
|
||||
@@ -538,28 +536,20 @@ static int _init_tx_drive_leds(struct transmit_register *tx_reg,
|
||||
return init_done;
|
||||
}
|
||||
|
||||
-static void _dump_amd_register(struct amd_register *amd_reg)
|
||||
-{
|
||||
- uint32_t *reg = (uint32_t *)amd_reg;
|
||||
-
|
||||
- log_info("AMD Register: %08x %08x %08x %08x", reg[0], reg[1],
|
||||
- reg[2], reg[3]);
|
||||
-
|
||||
- _dump_sgpio_hdr(&amd_reg->hdr);
|
||||
- _dump_sgpio_req(&amd_reg->req);
|
||||
- _dump_sgpio_amd(&amd_reg->amd);
|
||||
-}
|
||||
-
|
||||
static int _write_amd_register(const char *em_buffer_path,
|
||||
struct amd_drive *drive)
|
||||
{
|
||||
struct amd_register amd_reg;
|
||||
|
||||
- _init_sgpio_hdr(&amd_reg.hdr, 0, sizeof(amd_reg));
|
||||
- _init_sgpio_req(&amd_reg.req, 0x40, 0x82, SGPIO_REQ_REG_TYPE_AMD, 0, 1);
|
||||
- _init_sgpio_amd(&amd_reg.amd, drive->initiator, 0, 1, 1);
|
||||
+ amd_reg.hdr = _init_sgpio_hdr(0, sizeof(amd_reg));
|
||||
+ amd_reg.req = _init_sgpio_req(0x40, 0x82, SGPIO_REQ_REG_TYPE_AMD,
|
||||
+ 0, 1);
|
||||
+ amd_reg.amd = _init_sgpio_amd(drive->initiator, 0, 1, 1);
|
||||
+
|
||||
+ _dump_sgpio_hdr("AMD", amd_reg.hdr);
|
||||
+ _dump_sgpio_req("AMD", amd_reg.req);
|
||||
+ _dump_sgpio_amd("AMD", amd_reg.amd);
|
||||
|
||||
- _dump_amd_register(&amd_reg);
|
||||
return _send_sgpio_register(em_buffer_path, &amd_reg, sizeof(amd_reg));
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
From d787b0e649df63b89e5d7b597f35caa3712ffeff Mon Sep 17 00:00:00 2001
|
||||
From: Jan Synacek <jsynacek@redhat.com>
|
||||
Date: Wed, 22 May 2019 14:38:37 +0200
|
||||
Subject: [PATCH] use proper format string with syslog()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes the following:
|
||||
|
||||
$ CFLAGS="-Wall -Werror=format-security" make
|
||||
...
|
||||
ledmon.c: In function ‘_ledmon_status’:
|
||||
ledmon.c:205:47: error: format not a string literal and no format arguments [-Werror=format-security]
|
||||
syslog(log_level_infos[log_level].priority, message);
|
||||
^~~~~~~
|
||||
---
|
||||
src/ledmon.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ledmon.c b/src/ledmon.c
|
||||
index bbe04fc..677af7f 100644
|
||||
--- a/src/ledmon.c
|
||||
+++ b/src/ledmon.c
|
||||
@@ -202,7 +202,7 @@ static void _ledmon_status(int status, void *arg)
|
||||
if (get_log_fd() >= 0)
|
||||
_log(log_level, message);
|
||||
else
|
||||
- syslog(log_level_infos[log_level].priority, message);
|
||||
+ syslog(log_level_infos[log_level].priority, "%s", message);
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
2.20.1
|
||||
|
29
SOURCES/0004-dont_build_with_werror.patch
Normal file
29
SOURCES/0004-dont_build_with_werror.patch
Normal file
@ -0,0 +1,29 @@
|
||||
commit e4ee8feed7a2b460bbb202704072c1927015265f
|
||||
Author: Adrian Bunk <bunk@debian.org>
|
||||
Date: Thu Oct 31 12:28:48 2019 +0200
|
||||
|
||||
Don't build with -Werror
|
||||
|
||||
New compiler versions might output new warnings by default
|
||||
(see #47 for an example), which makes -Werror problematic
|
||||
for distributions.
|
||||
|
||||
The more specific -Werror= settings are usually not a problem.
|
||||
|
||||
The warnings are still shown, but they will no longer break
|
||||
the build.
|
||||
|
||||
Signed-off-by: Adrian Bunk <bunk@debian.org>
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 7bc20f8..7e01bd5 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -22,7 +22,6 @@ AX_AM_CFLAGS_ADD([-Werror=format-truncation=1])
|
||||
AX_AM_CFLAGS_ADD([-Werror=shift-negative-value])
|
||||
AX_AM_CFLAGS_ADD([-Werror=alloca])
|
||||
AX_AM_CFLAGS_ADD([-Werror=missing-field-initializers])
|
||||
-AX_AM_CFLAGS_ADD([-Werror])
|
||||
AX_AM_CFLAGS_ADD([-Werror=format-signedness])
|
||||
|
||||
AC_SUBST([AM_CFLAGS])
|
@ -1,18 +0,0 @@
|
||||
--- ledmon-0.92/src/Makefile 2019-04-12 11:49:04.000000000 +0200
|
||||
+++ ledmon-0.92-new/src/Makefile 2019-04-15 11:34:45.842774001 +0200
|
||||
@@ -64,15 +64,10 @@ TEST_CONFIG_OBJECTS=\
|
||||
$(OUTDIR)/list.o \
|
||||
$(OUTDIR)/utils.o
|
||||
|
||||
-CXFLAGS+=-std=gnu99
|
||||
-CWFLAGS=-Wall
|
||||
-CFLAGS=$(CXFLAGS) $(CWFLAGS)
|
||||
-
|
||||
DEFFLAGS=-D_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -DDMALLOC_DISABLE -DBUILD_LABEL=\""$(BUILD_LABEL)"\"
|
||||
CPPFLAGS=$(DEFFLAGS)
|
||||
ALL_CPPFLAGS=$(CPPFLAGS) -I../config
|
||||
|
||||
-LDFLAGS=$(CXFLAGS)
|
||||
LDLIBS=-lsgutils2 -ludev -lrt
|
||||
|
||||
SOURCES:=$(shell find -name "*.[cC]" -print)
|
@ -1,18 +1,19 @@
|
||||
Summary: Enclosure LED Utilities
|
||||
Name: ledmon
|
||||
Version: 0.92
|
||||
Release: 7%{?dist}
|
||||
Version: 0.93
|
||||
Release: 1%{?dist}
|
||||
License: GPLv2+
|
||||
Group: Applications/System
|
||||
URL: https://github.com/intel/ledmon
|
||||
Source0: https://github.com/intel/ledmon/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0: ledmon_cflags.patch
|
||||
Patch1: 0001-fix-segfault-when-a-value-is-missing-from-ibpi_str.patch
|
||||
Patch2: 0002-fix-the-_ledmon_status-function.patch
|
||||
Patch3: 0003-use-proper-format-string-with-syslog.patch
|
||||
Patch1: 0001-ledmon_paths_in_systemd_service_file_are_generated.patch
|
||||
Patch2: 0002-smp_fix_the_activity_indicator_states.patch
|
||||
Patch3: 0003-amd_sgpio_correct_use_of_packed_structs.patch
|
||||
Patch4: 0004-dont_build_with_werror.patch
|
||||
BuildRequires: perl-interpreter perl-podlators
|
||||
BuildRequires: sg3_utils-devel
|
||||
BuildRequires: autoconf, automake
|
||||
# Needed for the udev dependency.
|
||||
BuildRequires: systemd-devel
|
||||
Obsoletes: ledctl = 0.1-1
|
||||
@ -28,14 +29,17 @@ use this application.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1 -b .cflags
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
%build
|
||||
# can't use smp_flags because -j4 makes the build fail
|
||||
make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
|
||||
#make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
|
||||
sh autogen.sh
|
||||
%configure --enable-systemd=yes
|
||||
make
|
||||
|
||||
%install
|
||||
make install INSTALL="%{__install} -p" DESTDIR=$RPM_BUILD_ROOT SBIN_DIR=$RPM_BUILD_ROOT/%{_sbindir} MANDIR=$RPM_BUILD_ROOT%{_mandir}
|
||||
@ -45,8 +49,12 @@ make install INSTALL="%{__install} -p" DESTDIR=$RPM_BUILD_ROOT SBIN_DIR=$RPM_BUI
|
||||
%{_sbindir}/ledctl
|
||||
%{_sbindir}/ledmon
|
||||
%{_mandir}/*/*
|
||||
%{_unitdir}/ledmon.service
|
||||
|
||||
%changelog
|
||||
* Tue Dec 10 2019 Jan Synáček <jsynacek@redhat.com> - 0.93-1
|
||||
- update to 0.93 (#1721928)
|
||||
|
||||
* Tue Jun 4 2019 Jan Synáček <jsynacek@redhat.com> - 0.92-7
|
||||
- tests: fix tests (#1681030)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user