| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
#ifndef LIB_SENSORS_DATA_H |
|---|
| 21 |
#define LIB_SENSORS_DATA_H |
|---|
| 22 |
|
|---|
| 23 |
#include "sensors.h" |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
typedef enum sensors_operation { |
|---|
| 31 |
sensors_add, sensors_sub, sensors_multiply, sensors_divide, |
|---|
| 32 |
sensors_negate, sensors_exp, sensors_log } sensors_operation; |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
typedef enum sensors_expr_kind { |
|---|
| 36 |
sensors_kind_val, sensors_kind_source, sensors_kind_var, |
|---|
| 37 |
sensors_kind_sub } sensors_expr_kind; |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
struct sensors_expr; |
|---|
| 42 |
|
|---|
| 43 |
typedef struct sensors_subexpr { |
|---|
| 44 |
sensors_operation op; |
|---|
| 45 |
struct sensors_expr *sub1; |
|---|
| 46 |
struct sensors_expr *sub2; |
|---|
| 47 |
} sensors_subexpr; |
|---|
| 48 |
|
|---|
| 49 |
typedef struct sensors_expr { |
|---|
| 50 |
sensors_expr_kind kind; |
|---|
| 51 |
union { |
|---|
| 52 |
double val; |
|---|
| 53 |
char *var; |
|---|
| 54 |
sensors_subexpr subexpr; |
|---|
| 55 |
} data; |
|---|
| 56 |
} sensors_expr; |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
typedef struct sensors_label { |
|---|
| 61 |
char *name; |
|---|
| 62 |
char *value; |
|---|
| 63 |
int lineno; |
|---|
| 64 |
} sensors_label; |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
typedef struct sensors_set { |
|---|
| 68 |
char *name; |
|---|
| 69 |
sensors_expr *value; |
|---|
| 70 |
int lineno; |
|---|
| 71 |
} sensors_set; |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 |
typedef struct sensors_compute { |
|---|
| 76 |
char *name; |
|---|
| 77 |
sensors_expr *from_proc; |
|---|
| 78 |
sensors_expr *to_proc; |
|---|
| 79 |
int lineno; |
|---|
| 80 |
} sensors_compute; |
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
typedef struct sensors_ignore { |
|---|
| 84 |
char *name; |
|---|
| 85 |
int lineno; |
|---|
| 86 |
} sensors_ignore; |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
typedef struct sensors_chip_name_list { |
|---|
| 90 |
sensors_chip_name *fits; |
|---|
| 91 |
int fits_count; |
|---|
| 92 |
int fits_max; |
|---|
| 93 |
} sensors_chip_name_list; |
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
typedef struct sensors_chip { |
|---|
| 97 |
sensors_chip_name_list chips; |
|---|
| 98 |
sensors_label *labels; |
|---|
| 99 |
int labels_count; |
|---|
| 100 |
int labels_max; |
|---|
| 101 |
sensors_set *sets; |
|---|
| 102 |
int sets_count; |
|---|
| 103 |
int sets_max; |
|---|
| 104 |
sensors_compute *computes; |
|---|
| 105 |
int computes_count; |
|---|
| 106 |
int computes_max; |
|---|
| 107 |
sensors_ignore *ignores; |
|---|
| 108 |
int ignores_count; |
|---|
| 109 |
int ignores_max; |
|---|
| 110 |
int lineno; |
|---|
| 111 |
} sensors_chip; |
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
typedef struct sensors_bus { |
|---|
| 116 |
int number; |
|---|
| 117 |
char *adapter; |
|---|
| 118 |
int lineno; |
|---|
| 119 |
} sensors_bus; |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
typedef struct sensors_proc_chips_entry { |
|---|
| 123 |
int sysctl; |
|---|
| 124 |
sensors_chip_name name; |
|---|
| 125 |
} sensors_proc_chips_entry; |
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
typedef struct sensors_chip_feature { |
|---|
| 153 |
sensors_feature_data data; |
|---|
| 154 |
int sysctl; |
|---|
| 155 |
int offset; |
|---|
| 156 |
int scaling; |
|---|
| 157 |
const char *sysname; |
|---|
| 158 |
int sysscaling; |
|---|
| 159 |
const char *altsysname; |
|---|
| 160 |
} sensors_chip_feature; |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
typedef struct sensors_chip_features { |
|---|
| 164 |
const char *prefix; |
|---|
| 165 |
struct sensors_chip_feature *feature; |
|---|
| 166 |
} sensors_chip_features; |
|---|
| 167 |
|
|---|
| 168 |
extern sensors_chip *sensors_config_chips; |
|---|
| 169 |
extern int sensors_config_chips_count; |
|---|
| 170 |
extern int sensors_config_chips_max; |
|---|
| 171 |
|
|---|
| 172 |
extern sensors_bus *sensors_config_busses; |
|---|
| 173 |
extern int sensors_config_busses_count; |
|---|
| 174 |
extern int sensors_config_busses_max; |
|---|
| 175 |
|
|---|
| 176 |
extern sensors_proc_chips_entry *sensors_proc_chips; |
|---|
| 177 |
extern int sensors_proc_chips_count; |
|---|
| 178 |
extern int sensors_proc_chips_max; |
|---|
| 179 |
|
|---|
| 180 |
#define sensors_add_proc_chips(el) sensors_add_array_el( \ |
|---|
| 181 |
(el), &sensors_proc_chips, &sensors_proc_chips_count,\ |
|---|
| 182 |
&sensors_proc_chips_max, sizeof(struct sensors_proc_chips_entry)) |
|---|
| 183 |
|
|---|
| 184 |
extern sensors_bus *sensors_proc_bus; |
|---|
| 185 |
extern int sensors_proc_bus_count; |
|---|
| 186 |
extern int sensors_proc_bus_max; |
|---|
| 187 |
|
|---|
| 188 |
#define sensors_add_proc_bus(el) sensors_add_array_el( \ |
|---|
| 189 |
(el), &sensors_proc_bus, &sensors_proc_bus_count,\ |
|---|
| 190 |
&sensors_proc_bus_max, sizeof(struct sensors_bus)) |
|---|
| 191 |
|
|---|
| 192 |
extern sensors_chip_features sensors_chip_features_list[]; |
|---|
| 193 |
|
|---|
| 194 |
#endif |
|---|