diff options
Diffstat (limited to 'src/fan')
-rw-r--r-- | src/fan/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/fan/LMI_FanAssociatedSensorProvider.c | 1 | ||||
-rw-r--r-- | src/fan/LMI_FanProvider.c | 10 | ||||
-rw-r--r-- | src/fan/LMI_FanSensorProvider.c | 9 | ||||
-rw-r--r-- | src/fan/fan.c | 20 | ||||
-rw-r--r-- | src/fan/fan.h | 1 |
6 files changed, 18 insertions, 25 deletions
diff --git a/src/fan/CMakeLists.txt b/src/fan/CMakeLists.txt index 446e38b..6ccccbb 100644 --- a/src/fan/CMakeLists.txt +++ b/src/fan/CMakeLists.txt @@ -25,7 +25,7 @@ add_library(${LIBRARY_NAME} SHARED include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR}) -target_link_libraries(${LIBRARY_NAME} openlmicommon ${KONKRETCMPI_LIBRARIES} sensors) +target_link_libraries(${LIBRARY_NAME} openlmi ${KONKRETCMPI_LIBRARIES} sensors) # Create registration file cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} share/openlmi-providers) diff --git a/src/fan/LMI_FanAssociatedSensorProvider.c b/src/fan/LMI_FanAssociatedSensorProvider.c index 249fdad..5879118 100644 --- a/src/fan/LMI_FanAssociatedSensorProvider.c +++ b/src/fan/LMI_FanAssociatedSensorProvider.c @@ -21,7 +21,6 @@ #include <konkret/konkret.h> #include "LMI_FanAssociatedSensor.h" #include "fan.h" -#include "globals.h" static const CMPIBroker* _cb; diff --git a/src/fan/LMI_FanProvider.c b/src/fan/LMI_FanProvider.c index 9e780ad..3d7145b 100644 --- a/src/fan/LMI_FanProvider.c +++ b/src/fan/LMI_FanProvider.c @@ -22,8 +22,8 @@ #include <konkret/konkret.h> #include <stdint.h> #include "LMI_Fan.h" -#include "globals.h" #include "fan.h" + static const CMPIBroker* _cb = NULL; static void LMI_FanInitialize(const CMPIContext *ctx) @@ -60,7 +60,7 @@ static CMPIStatus LMI_FanEnumInstances( const char *ns = KNameSpace(cop); CMPIStatus status; - char buf[200]; + char buf[BUFLEN]; struct fanlist *lptr = NULL; struct fanlist *fans = NULL; struct cim_fan *sptr; @@ -82,7 +82,7 @@ static CMPIStatus LMI_FanEnumInstances( LMI_Fan_Set_Caption(&w, "Computer's fan"); LMI_Fan_Set_Description(&w,"Computer's fan."); - snprintf(buf, 200, "Fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name); + snprintf(buf, BUFLEN, "Fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name); LMI_Fan_Set_ElementName(&w, buf); // ManagedSystemElement @@ -102,7 +102,7 @@ static CMPIStatus LMI_FanEnumInstances( " Thus the measurement for this channel should not be trusted." : "Fan seems to be functioning correctly."); if (sptr->alarm || sptr->alarm_min || sptr->alarm_max) { - snprintf(buf, 200, "These alarm flags are set by the fan's chip:" + snprintf(buf, BUFLEN, "These alarm flags are set by the fan's chip:" " alarm=%s, min_alarm=%s, max_alarm=%s", sptr->alarm ? "1":"0", sptr->alarm_min ? "1":"0", @@ -136,7 +136,7 @@ static CMPIStatus LMI_FanEnumInstances( uint32_t i = 1; int index = 0; - debug("accessible_features: %d", sptr->accessible_features); + lmi_debug("accessible_features: %d", sptr->accessible_features); LMI_Fan_Init_AccessibleFeatures(&w, 8); while (i <= CIM_FAN_AF_FEATURE_MAX) { if (i & sptr->accessible_features) { diff --git a/src/fan/LMI_FanSensorProvider.c b/src/fan/LMI_FanSensorProvider.c index 70e1be2..0df31ff 100644 --- a/src/fan/LMI_FanSensorProvider.c +++ b/src/fan/LMI_FanSensorProvider.c @@ -22,7 +22,6 @@ #include <konkret/konkret.h> #include "LMI_FanSensor.h" #include "fan.h" -#include "globals.h" static const CMPIBroker* _cb = NULL; @@ -58,7 +57,7 @@ static CMPIStatus LMI_FanSensorEnumInstances( const char** properties) { CMPIStatus status; - char buf[200]; + char buf[BUFLEN]; struct cim_fan *sptr = NULL; struct fanlist *lptr = NULL, *fans = NULL; if (enum_all_fans(&fans) != 0 ) { @@ -78,7 +77,7 @@ static CMPIStatus LMI_FanSensorEnumInstances( LMI_FanSensor_Set_Caption(&w, "Computer's fan"); LMI_FanSensor_Set_Description(&w,"Computer's fan."); - snprintf(buf, 200, "Fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name); + snprintf(buf, BUFLEN, "Fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name); LMI_FanSensor_Set_ElementName(&w, buf); // ManagedSystemElement @@ -99,7 +98,7 @@ static CMPIStatus LMI_FanSensorEnumInstances( " Thus the measurement for this channel should not be trusted." : "Fan seems to be functioning correctly."); if (sptr->alarm || sptr->alarm_min || sptr->alarm_max) { - snprintf(buf, 200, "These alarm flags are set by the fan's chip:" + snprintf(buf, BUFLEN, "These alarm flags are set by the fan's chip:" " alarm=%s, min_alarm=%s, max_alarm=%s", sptr->alarm ? "1":"0", sptr->alarm_min ? "1":"0", @@ -132,7 +131,7 @@ static CMPIStatus LMI_FanSensorEnumInstances( LMI_FanSensor_Set_Caption(&w, "Fan's tachometer"); LMI_FanSensor_Set_Description(&w,"Associated sensor of fan. Giving information about its speed."); - snprintf(buf, 200, "Tachometer of fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name); + snprintf(buf, BUFLEN, "Tachometer of fan \"%s\" on chip \"%s\"", sptr->name, sptr->chip_name); LMI_FanSensor_Set_ElementName(&w, buf); // Sensor diff --git a/src/fan/fan.c b/src/fan/fan.c index adc49cc..a9cf754 100644 --- a/src/fan/fan.c +++ b/src/fan/fan.c @@ -23,18 +23,14 @@ #include <string.h> #include <libgen.h> #include <errno.h> -#include <stdbool.h> #include <sensors/sensors.h> #include <sensors/error.h> #include "fan.h" -#include "globals.h" const char *provider_name = "fan"; const ConfigEntry *provider_config_defaults = NULL; -#define MAX_CHIP_NAME_LENGTH 200 - //* constants ***************************************************************** static bool MODULE_INITIALIZED = false; @@ -98,8 +94,8 @@ static cim_fan_error_t libsensors2cim_fan_error(int err) { static const char * sprintf_chip_name(sensors_chip_name const *name) { /** @return NULL on error, cstring otherwise, it needs to be freed */ int charcnt; - char buf[MAX_CHIP_NAME_LENGTH]; - if ((charcnt = sensors_snprintf_chip_name(buf, MAX_CHIP_NAME_LENGTH, name)) < 0) + char buf[BUFLEN]; + if ((charcnt = sensors_snprintf_chip_name(buf, BUFLEN, name)) < 0) return NULL; return strndup(buf, charcnt); } @@ -110,17 +106,17 @@ static cim_fan_error_t reload_config_file(char const * fp) { * @return 0 on success */ FILE *config_file = NULL; int err; - char errbuf[STRERROR_BUF_LEN]; + char errbuf[BUFLEN]; if (fp) { if (!(config_file = fopen(fp, "r"))) { - error("Cound not open config file \"%s\": %s\n", - fp, strerror_r(errno, errbuf, sizeof(errbuf))); + lmi_error("Cound not open config file \"%s\": %s\n", + fp, strerror_r(errno, errbuf, sizeof(errbuf))); } } err = sensors_init(config_file); if (err) { - error("sensors_init: %s\n", sensors_strerror(err)); + lmi_error("sensors_init: %s\n", sensors_strerror(err)); if (config_file) fclose(config_file); }else { if (config_file) fclose(config_file); @@ -251,12 +247,12 @@ static struct cim_fan * _load_fan_data( sensors_chip_name const *chip return NULL; } if (!(f->chip_name = sprintf_chip_name(chip))) { - error("could not get chip name\n"); + lmi_error("could not get chip name\n"); goto lab_err_free_fan; } f->sys_path = chip->path; if (!(f->name = sensors_get_label(chip, feature))) { - error("could not get fan name for chip: %s\n", + lmi_error("could not get fan name for chip: %s\n", f->chip_name); goto lab_err_chip_name; } diff --git a/src/fan/fan.h b/src/fan/fan.h index 6115ab2..4883e64 100644 --- a/src/fan/fan.h +++ b/src/fan/fan.h @@ -21,7 +21,6 @@ #ifndef LINUX_FAN_H_ #define LINUX_FAN_H_ -#include <stdbool.h> #include "openlmi.h" /** accessible features of fan |