avoid to store configuration in psensor struct
[psensor.git] / src / lib / psensor.c
index fb30352..c8dc6a9 100644 (file)
 #include <libintl.h>
 #define _(str) gettext(str)
 
+#include <stdio.h>
+
 #include <hdd.h>
 #include <psensor.h>
-#include <lmsensor.h>
 #include <temperature.h>
 
-#ifdef HAVE_GTOP
-#include <cpu.h>
-#include <pmem.h>
-#endif
-
 struct psensor *psensor_create(char *id,
                               char *name,
                               char *chip,
@@ -67,7 +63,6 @@ struct psensor *psensor_create(char *id,
        psensor->color = NULL;
 
        psensor->graph_enabled = 1;
-       psensor->appindicator_enabled = 0;
 
        psensor->provider_data = NULL;
        psensor->provider_data_free_fct = &free;
@@ -161,32 +156,15 @@ int psensor_list_size(struct psensor **sensors)
        return size;
 }
 
-int psensor_list_contains_type(struct psensor **sensors, unsigned int type)
-{
-       struct psensor **s;
-
-       if (!sensors)
-               return 0;
-
-       s = sensors;
-       while (*s) {
-               if ((*s)->type & type)
-                       return 1;
-               s++;
-       }
-
-       return 0;
-}
-
 struct psensor **psensor_list_add(struct psensor **sensors,
                                  struct psensor *sensor)
 {
        int size;
+       struct psensor **result;
 
        size = psensor_list_size(sensors);
 
-       struct psensor **result
-           = malloc((size + 1 + 1) * sizeof(struct psensor *));
+       result = malloc((size + 1 + 1) * sizeof(struct psensor *));
 
        if (sensors)
                memcpy(result, sensors, size * sizeof(struct psensor *));
@@ -415,44 +393,6 @@ double get_max_temp(struct psensor **sensors)
        return get_max_value(sensors, SENSOR_TYPE_TEMP);
 }
 
-struct psensor **get_all_sensors(int use_libatasmart, int values_max_length)
-{
-       struct psensor **psensors;
-       struct psensor **tmp_psensors;
-
-       psensors = lmsensor_psensor_list_add(NULL, values_max_length);
-
-       if (!use_libatasmart) {
-               tmp_psensors = hddtemp_psensor_list_add(psensors,
-                                                       values_max_length);
-               if (tmp_psensors != psensors) {
-                       free(psensors);
-                       psensors = tmp_psensors;
-               }
-       }
-#ifdef HAVE_ATASMART
-               else {
-                       tmp_psensors = hdd_psensor_list_add(psensors,
-                                                           values_max_length);
-                       if (tmp_psensors != psensors) {
-                               free(psensors);
-                               psensors = tmp_psensors;
-                       }
-               }
-#endif
-
-#ifdef HAVE_GTOP
-       mem_psensor_list_add(&psensors, values_max_length);
-#endif
-
-       if (!psensors) {        /* there is no detected sensors */
-               psensors = malloc(sizeof(struct psensor *));
-               *psensors = NULL;
-       }
-
-       return psensors;
-}
-
 const char *psensor_type_to_str(unsigned int type)
 {
        if (type & SENSOR_TYPE_NVCTRL) {
@@ -518,24 +458,6 @@ const char *psensor_type_to_unit_str(unsigned int type, int use_celsius)
        return _("N/A");
 }
 
-void psensor_list_update_measures(struct psensor **sensors)
-{
-       lmsensor_psensor_list_update(sensors);
-
-#ifdef HAVE_GTOP
-       cpu_psensor_list_update(sensors);
-       mem_psensor_list_update(sensors);
-#endif
-
-       if (psensor_list_contains_type(sensors, SENSOR_TYPE_HDDTEMP))
-               hddtemp_psensor_list_update(sensors);
-
-#ifdef HAVE_ATASMART
-       if (psensor_list_contains_type(sensors, SENSOR_TYPE_ATASMART))
-               hdd_psensor_list_update(sensors);
-#endif
-}
-
 void psensor_log_measures(struct psensor **sensors)
 {
        if (log_level == LOG_DEBUG)
@@ -548,16 +470,6 @@ void psensor_log_measures(struct psensor **sensors)
                }
 }
 
-void psensor_init()
-{
-       lmsensor_init();
-}
-
-void psensor_cleanup()
-{
-       lmsensor_cleanup();
-}
-
 struct psensor **psensor_list_copy(struct psensor **sensors)
 {
        struct psensor **result;