X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fthermal.c;h=b6136480c1e5036606f2e9730538e8c068d69e83;hb=db4f7362efcfd89447c950c945f789a44d6e55a5;hp=29ea05f5d18641b261e731295ae70c79996017fc;hpb=5547289c70acc83c02bbd8721236aa2c87efc043;p=collectd.git diff --git a/src/thermal.c b/src/thermal.c index 29ea05f5..b6136480 100644 --- a/src/thermal.c +++ b/src/thermal.c @@ -61,21 +61,8 @@ static void thermal_submit (const char *plugin_instance, enum dev_type dt, plugin_dispatch_values (&vl); } -static int read_file_contents (const char *filename, char *buf, int bufsize) -{ - FILE *fh; - int n; - - if ((fh = fopen (filename, "r")) == NULL) - return -1; - - n = fread(buf, 1, bufsize, fh); - fclose(fh); - - return n; -} - -static int thermal_sysfs_device_read (const char *name) +static int thermal_sysfs_device_read (const char *dir, const char *name, + void *user_data) { char filename[256]; char data[1024]; @@ -126,7 +113,8 @@ static int thermal_sysfs_device_read (const char *name) return ok ? 0 : -1; } -static int thermal_procfs_device_read (const char *name) +static int thermal_procfs_device_read (const char *dir, const char *name, + void *user_data) { const char str_temp[] = "temperature:"; char filename[256]; @@ -229,12 +217,14 @@ static int thermal_config (const char *key, const char *value) static int thermal_sysfs_read (void) { - return walk_directory (dirname_sysfs, thermal_sysfs_device_read); + return walk_directory (dirname_sysfs, thermal_sysfs_device_read, + /* user_data = */ NULL); } static int thermal_procfs_read (void) { - return walk_directory (dirname_procfs, thermal_procfs_device_read); + return walk_directory (dirname_procfs, thermal_procfs_device_read, + /* user_data = */ NULL); } static int thermal_init (void)