root/lm-sensors/tags/V3-0-1/lib/data.h

Revision 4902, 4.7 kB (checked in by khali, 1 year ago)

Add my copyright everywhere it is missing.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
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        Jean Delvare <khali@linux-fr.org>
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program 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 General Public License for more details.
15
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., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #ifndef LIB_SENSORS_DATA_H
22 #define LIB_SENSORS_DATA_H
23
24 #include "sensors.h"
25
26 /* This header file contains all kinds of data structures which are used
27    for the representation of the config file data and the /proc/...
28    data. */
29
30 /* Kinds of expression operators recognized */
31 typedef enum sensors_operation {
32         sensors_add, sensors_sub, sensors_multiply, sensors_divide,
33         sensors_negate, sensors_exp, sensors_log,
34 } sensors_operation;
35
36 /* An expression can have several forms */
37 typedef enum sensors_expr_kind {
38         sensors_kind_val, sensors_kind_source, sensors_kind_var,
39         sensors_kind_sub
40 } sensors_expr_kind;
41
42 /* An expression. It is either a floating point value, a variable name,
43    an operation on subexpressions, or the special value 'sub' } */
44 struct sensors_expr;
45
46 typedef struct sensors_subexpr {
47         sensors_operation op;
48         struct sensors_expr *sub1;
49         struct sensors_expr *sub2;
50 } sensors_subexpr;
51
52 typedef struct sensors_expr {
53         sensors_expr_kind kind;
54         union {
55                 double val;
56                 char *var;
57                 sensors_subexpr subexpr;
58         } data;
59 } sensors_expr;
60
61 /* Config file label declaration: a feature name, combined with the label
62    value */
63 typedef struct sensors_label {
64         char *name;
65         char *value;
66         int lineno;
67 } sensors_label;
68
69 /* Config file set declaration: a subfeature name, combined with an
70    expression */
71 typedef struct sensors_set {
72         char *name;
73         sensors_expr *value;
74         int lineno;
75 } sensors_set;
76
77 /* Config file compute declaration: a feature name, combined with two
78    expressions */
79 typedef struct sensors_compute {
80         char *name;
81         sensors_expr *from_proc;
82         sensors_expr *to_proc;
83         int lineno;
84 } sensors_compute;
85
86 /* Config file ignore declaration: a feature name */
87 typedef struct sensors_ignore {
88         char *name;
89         int lineno;
90 } sensors_ignore;
91
92 /* A list of chip names, used to represent a config file chips declaration */
93 typedef struct sensors_chip_name_list {
94         sensors_chip_name *fits;
95         int fits_count;
96         int fits_max;
97 } sensors_chip_name_list;
98
99 /* A config file chip block */
100 typedef struct sensors_chip {
101         sensors_chip_name_list chips;
102         sensors_label *labels;
103         int labels_count;
104         int labels_max;
105         sensors_set *sets;
106         int sets_count;
107         int sets_max;
108         sensors_compute *computes;
109         int computes_count;
110         int computes_max;
111         sensors_ignore *ignores;
112         int ignores_count;
113         int ignores_max;
114         int lineno;
115 } sensors_chip;
116
117 /* Config file bus declaration: the bus type and number, combined with adapter
118    name */
119 typedef struct sensors_bus {
120         char *adapter;
121         sensors_bus_id bus;
122         int lineno;
123 } sensors_bus;
124
125 /* Internal data about all features and subfeatures of a chip */
126 typedef struct sensors_chip_features {
127         struct sensors_chip_name chip;
128         struct sensors_feature *feature;
129         struct sensors_subfeature *subfeature;
130         int feature_count;
131         int subfeature_count;
132 } sensors_chip_features;
133
134 extern sensors_chip *sensors_config_chips;
135 extern int sensors_config_chips_count;
136 extern int sensors_config_chips_max;
137
138 extern sensors_bus *sensors_config_busses;
139 extern int sensors_config_busses_count;
140 extern int sensors_config_busses_max;
141
142 extern sensors_chip_features *sensors_proc_chips;
143 extern int sensors_proc_chips_count;
144 extern int sensors_proc_chips_max;
145
146 #define sensors_add_proc_chips(el) sensors_add_array_el( \
147         (el), &sensors_proc_chips, &sensors_proc_chips_count,\
148         &sensors_proc_chips_max, sizeof(struct sensors_chip_features))
149
150 extern sensors_bus *sensors_proc_bus;
151 extern int sensors_proc_bus_count;
152 extern int sensors_proc_bus_max;
153
154 #define sensors_add_proc_bus(el) sensors_add_array_el( \
155         (el), &sensors_proc_bus, &sensors_proc_bus_count,\
156         &sensors_proc_bus_max, sizeof(struct sensors_bus))
157
158 /* Substitute configuration bus numbers with real-world /proc bus numbers
159    in the chips lists */
160 int sensors_substitute_busses(void);
161
162
163 /* Parse a bus id into its components. Returns 0 on succes, a value from
164    error.h on failure. */
165 int sensors_parse_bus_id(const char *name, sensors_bus_id *bus);
166
167 #endif /* def LIB_SENSORS_DATA_H */
Note: See TracBrowser for help on using the browser.