mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-12-05 22:08:19 +00:00
sensord: Change signature of (*FeatureFN)
This patch changes the signature of function pointer (*FeatureFN) and the related functions: rrdGetSensors_DS() rrdCGI_DEF() rrdCGI_LINE() Return type is now void because none of the functions return an error code. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5793 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
ae56c60bff
commit
bb6495d47d
1 file changed
+14
-17
+14
-17
@@ -68,8 +68,8 @@ static char rrdLabels[MAX_RRD_SENSORS][RAW_LABEL_LENGTH + 1];
|
|||||||
#define LOADAVG "loadavg"
|
#define LOADAVG "loadavg"
|
||||||
#define LOAD_AVERAGE "Load Average"
|
#define LOAD_AVERAGE "Load Average"
|
||||||
|
|
||||||
typedef int (*FeatureFN) (void *data, const char *rawLabel, const char *label,
|
typedef void (*FeatureFN) (void *data, const char *rawLabel, const char *label,
|
||||||
const FeatureDescriptor *feature);
|
const FeatureDescriptor *feature);
|
||||||
|
|
||||||
static char rrdNextChar(char c)
|
static char rrdNextChar(char c)
|
||||||
{
|
{
|
||||||
@@ -141,7 +141,7 @@ static int _applyToFeatures(FeatureFN fn, void *data,
|
|||||||
const sensors_chip_name *chip,
|
const sensors_chip_name *chip,
|
||||||
const ChipDescriptor *desc)
|
const ChipDescriptor *desc)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i;
|
||||||
const FeatureDescriptor *features = desc->features;
|
const FeatureDescriptor *features = desc->features;
|
||||||
const FeatureDescriptor *feature;
|
const FeatureDescriptor *feature;
|
||||||
const char *rawLabel;
|
const char *rawLabel;
|
||||||
@@ -159,7 +159,7 @@ static int _applyToFeatures(FeatureFN fn, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rrdCheckLabel(rawLabel, i);
|
rrdCheckLabel(rawLabel, i);
|
||||||
ret = fn(data, rrdLabels[i], label, feature);
|
fn(data, rrdLabels[i], label, feature);
|
||||||
free(label);
|
free(label);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -210,9 +210,9 @@ struct ds {
|
|||||||
const char **argv;
|
const char **argv;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int rrdGetSensors_DS(void *_data, const char *rawLabel,
|
static void rrdGetSensors_DS(void *_data, const char *rawLabel,
|
||||||
const char *label,
|
const char *label,
|
||||||
const FeatureDescriptor *feature)
|
const FeatureDescriptor *feature)
|
||||||
{
|
{
|
||||||
(void) label; /* no warning */
|
(void) label; /* no warning */
|
||||||
if (!feature || feature->rrd) {
|
if (!feature || feature->rrd) {
|
||||||
@@ -247,7 +247,6 @@ static int rrdGetSensors_DS(void *_data, const char *rawLabel,
|
|||||||
sprintf(ptr, "DS:%s:GAUGE:%d:%s:%s", rawLabel, 5 *
|
sprintf(ptr, "DS:%s:GAUGE:%d:%s:%s", rawLabel, 5 *
|
||||||
sensord_args.rrdTime, min, max);
|
sensord_args.rrdTime, min, max);
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rrdGetSensors(const char **argv)
|
static int rrdGetSensors(const char **argv)
|
||||||
@@ -256,7 +255,7 @@ static int rrdGetSensors(const char **argv)
|
|||||||
struct ds data = { 0, argv};
|
struct ds data = { 0, argv};
|
||||||
ret = applyToFeatures(rrdGetSensors_DS, &data);
|
ret = applyToFeatures(rrdGetSensors_DS, &data);
|
||||||
if (!ret && sensord_args.doLoad)
|
if (!ret && sensord_args.doLoad)
|
||||||
ret = rrdGetSensors_DS(&data, LOADAVG, LOAD_AVERAGE, NULL);
|
rrdGetSensors_DS(&data, LOADAVG, LOAD_AVERAGE, NULL);
|
||||||
return ret ? -1 : data.num;
|
return ret ? -1 : data.num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,15 +322,14 @@ struct gr {
|
|||||||
int loadAvg;
|
int loadAvg;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int rrdCGI_DEF(void *_data, const char *rawLabel, const char *label,
|
static void rrdCGI_DEF(void *_data, const char *rawLabel, const char *label,
|
||||||
const FeatureDescriptor *feature)
|
const FeatureDescriptor *feature)
|
||||||
{
|
{
|
||||||
struct gr *data = _data;
|
struct gr *data = _data;
|
||||||
(void) label; /* no warning */
|
(void) label; /* no warning */
|
||||||
if (!feature || (feature->rrd && (feature->type == data->type)))
|
if (!feature || (feature->rrd && (feature->type == data->type)))
|
||||||
printf("\n\tDEF:%s=%s:%s:AVERAGE", rawLabel,
|
printf("\n\tDEF:%s=%s:%s:AVERAGE", rawLabel,
|
||||||
sensord_args.rrdFile, rawLabel);
|
sensord_args.rrdFile, rawLabel);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -359,14 +357,13 @@ static int rrdCGI_color(const char *label)
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rrdCGI_LINE(void *_data, const char *rawLabel, const char *label,
|
static void rrdCGI_LINE(void *_data, const char *rawLabel, const char *label,
|
||||||
const FeatureDescriptor *feature)
|
const FeatureDescriptor *feature)
|
||||||
{
|
{
|
||||||
struct gr *data = _data;
|
struct gr *data = _data;
|
||||||
if (!feature || (feature->rrd && (feature->type == data->type)))
|
if (!feature || (feature->rrd && (feature->type == data->type)))
|
||||||
printf("\n\tLINE2:%s#%.6x:\"%s\"", rawLabel,
|
printf("\n\tLINE2:%s#%.6x:\"%s\"", rawLabel,
|
||||||
rrdCGI_color(label), label);
|
rrdCGI_color(label), label);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct gr graphs[] = {
|
static struct gr graphs[] = {
|
||||||
@@ -488,11 +485,11 @@ int rrdCGI(void)
|
|||||||
if (!ret)
|
if (!ret)
|
||||||
ret = applyToFeatures(rrdCGI_DEF, graph);
|
ret = applyToFeatures(rrdCGI_DEF, graph);
|
||||||
if (!ret && sensord_args.doLoad && graph->loadAvg)
|
if (!ret && sensord_args.doLoad && graph->loadAvg)
|
||||||
ret = rrdCGI_DEF(graph, LOADAVG, LOAD_AVERAGE, NULL);
|
rrdCGI_DEF(graph, LOADAVG, LOAD_AVERAGE, NULL);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = applyToFeatures(rrdCGI_LINE, graph);
|
ret = applyToFeatures(rrdCGI_LINE, graph);
|
||||||
if (!ret && sensord_args.doLoad && graph->loadAvg)
|
if (!ret && sensord_args.doLoad && graph->loadAvg)
|
||||||
ret = rrdCGI_LINE(graph, LOADAVG, LOAD_AVERAGE, NULL);
|
rrdCGI_LINE(graph, LOADAVG, LOAD_AVERAGE, NULL);
|
||||||
printf (">\n</p>\n");
|
printf (">\n</p>\n");
|
||||||
}
|
}
|
||||||
printf("<p>\n<small><b>sensord</b> by "
|
printf("<p>\n<small><b>sensord</b> by "
|
||||||
|
|||||||
Reference in new issue
Block a user