2
data.h - Part of libsensors, a Linux library for reading sensor data.
3
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
4
Copyright (C) 2007-2010 Jean Delvare <jdelvare@suse.de>
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) any later version.
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU Lesser General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
#ifndef LIB_SENSORS_DATA_H
23
#define LIB_SENSORS_DATA_H
28
/* This header file contains all kinds of data structures which are used
29
for the representation of the config file data and the sensors
32
/* Kinds of expression operators recognized */
33
typedef enum sensors_operation {
34
sensors_add, sensors_sub, sensors_multiply, sensors_divide,
35
sensors_negate, sensors_exp, sensors_log,
38
/* An expression can have several forms */
39
typedef enum sensors_expr_kind {
40
sensors_kind_val, sensors_kind_source, sensors_kind_var,
44
/* An expression. It is either a floating point value, a variable name,
45
an operation on subexpressions, or the special value 'sub' } */
48
typedef struct sensors_subexpr {
50
struct sensors_expr *sub1;
51
struct sensors_expr *sub2;
54
typedef struct sensors_expr {
55
sensors_expr_kind kind;
59
sensors_subexpr subexpr;
63
/* Config file line reference */
64
typedef struct sensors_config_line {
67
} sensors_config_line;
69
/* Config file label declaration: a feature name, combined with the label
71
typedef struct sensors_label {
74
sensors_config_line line;
77
/* Config file set declaration: a subfeature name, combined with an
79
typedef struct sensors_set {
82
sensors_config_line line;
85
/* Config file compute declaration: a feature name, combined with two
87
typedef struct sensors_compute {
89
sensors_expr *from_proc;
90
sensors_expr *to_proc;
91
sensors_config_line line;
94
/* Config file ignore declaration: a feature name */
95
typedef struct sensors_ignore {
97
sensors_config_line line;
100
/* A list of chip names, used to represent a config file chips declaration */
101
typedef struct sensors_chip_name_list {
102
sensors_chip_name *fits;
105
} sensors_chip_name_list;
107
/* A config file chip block */
108
typedef struct sensors_chip {
109
sensors_chip_name_list chips;
110
sensors_label *labels;
116
sensors_compute *computes;
119
sensors_ignore *ignores;
122
sensors_config_line line;
125
/* Config file bus declaration: the bus type and number, combined with adapter
127
typedef struct sensors_bus {
130
sensors_config_line line;
133
/* Internal data about all features and subfeatures of a chip */
134
typedef struct sensors_chip_features {
135
struct sensors_chip_name chip;
136
struct sensors_feature *feature;
137
struct sensors_subfeature *subfeature;
139
int subfeature_count;
140
} sensors_chip_features;
142
extern char **sensors_config_files;
143
extern int sensors_config_files_count;
144
extern int sensors_config_files_max;
146
#define sensors_add_config_files(el) sensors_add_array_el( \
147
(el), &sensors_config_files, &sensors_config_files_count, \
148
&sensors_config_files_max, sizeof(char *))
150
extern sensors_chip *sensors_config_chips;
151
extern int sensors_config_chips_count;
152
extern int sensors_config_chips_subst;
153
extern int sensors_config_chips_max;
155
extern sensors_bus *sensors_config_busses;
156
extern int sensors_config_busses_count;
157
extern int sensors_config_busses_max;
159
extern sensors_chip_features *sensors_proc_chips;
160
extern int sensors_proc_chips_count;
161
extern int sensors_proc_chips_max;
163
#define sensors_add_proc_chips(el) sensors_add_array_el( \
164
(el), &sensors_proc_chips, &sensors_proc_chips_count,\
165
&sensors_proc_chips_max, sizeof(struct sensors_chip_features))
167
extern sensors_bus *sensors_proc_bus;
168
extern int sensors_proc_bus_count;
169
extern int sensors_proc_bus_max;
171
#define sensors_add_proc_bus(el) sensors_add_array_el( \
172
(el), &sensors_proc_bus, &sensors_proc_bus_count,\
173
&sensors_proc_bus_max, sizeof(struct sensors_bus))
175
/* Substitute configuration bus numbers with real-world bus numbers
176
in the chips lists */
177
int sensors_substitute_busses(void);
180
/* Parse a bus id into its components. Returns 0 on success, a value from
181
error.h on failure. */
182
int sensors_parse_bus_id(const char *name, sensors_bus_id *bus);
184
#endif /* def LIB_SENSORS_DATA_H */