From: Florian Forster Date: Sun, 10 Feb 2019 20:50:51 +0000 (+0100) Subject: Merge branch 'collectd-5.8' X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=711f5b6c86f51061c21bedcaa46214a01de0125c;p=collectd.git Merge branch 'collectd-5.8' Conflicts: src/sensors.c --- 711f5b6c86f51061c21bedcaa46214a01de0125c diff --cc src/sensors.c index 0d4a400c,33982e06..b800e98f --- a/src/sensors.c +++ b/src/sensors.c @@@ -58,12 -157,43 +73,13 @@@ typedef struct featurelist struct featurelist *next; } featurelist_t; -static char *conffile = NULL; -static _Bool use_labels = 0; +static char *conffile; +static bool use_labels; + #endif -static featurelist_t *first_feature = NULL; +static featurelist_t *first_feature; static ignorelist_t *sensor_list; -#if SENSORS_API_VERSION < 0x400 -/* full chip name logic borrowed from lm_sensors */ -static int sensors_snprintf_chip_name(char *buf, size_t buf_size, - const sensors_chip_name *chip) { - int status = -1; - - if (chip->bus == SENSORS_CHIP_NAME_BUS_ISA) { - status = snprintf(buf, buf_size, "%s-isa-%04x", chip->prefix, chip->addr); - } else if (chip->bus == SENSORS_CHIP_NAME_BUS_DUMMY) { - status = snprintf(buf, buf_size, "%s-%s-%04x", chip->prefix, chip->busname, - chip->addr); - } else { - status = snprintf(buf, buf_size, "%s-i2c-%d-%02x", chip->prefix, chip->bus, - chip->addr); - } - - return status; -} /* int sensors_snprintf_chip_name */ - -static int sensors_feature_name_to_type(const char *name) { - /* Yes, this is slow, but it's only ever done during initialization, so - * it's a one time cost.. */ - for (int i = 0; i < known_features_num; i++) - if (strcasecmp(known_features[i].label, name) == 0) - return known_features[i].type; - - return SENSOR_TYPE_UNKNOWN; -} /* int sensors_feature_name_to_type */ -#endif - static int sensors_config(const char *key, const char *value) { if (sensor_list == NULL) sensor_list = ignorelist_create(1); @@@ -87,9 -217,13 +103,13 @@@ ignorelist_set_invert(sensor_list, 1); if (IS_TRUE(value)) ignorelist_set_invert(sensor_list, 0); - } else if (strcasecmp(key, "UseLabels") == 0) { + } + #if (SENSORS_API_VERSION >= 0x400) + else if (strcasecmp(key, "UseLabels") == 0) { - use_labels = IS_TRUE(value) ? 1 : 0; + use_labels = IS_TRUE(value); - } else { + } + #endif + else { return -1; }