2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 06:15:15 +00:00

libsensors: Drop support for algorithm names.

I2C algorithms no longer have names in Linux 2.6, and anyway they are
implementation details user-space doesn't care about. No third party
application is known to have ever used this particular feature of
libsensors. "sensord" and "sensors" no longer do.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4208 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2006-10-13 19:55:41 +00:00
parent 054b265795
commit 6270cf381a
10 changed files with 44 additions and 40 deletions

View File

@@ -4,6 +4,7 @@ lm_sensors CHANGES file
SVN HEAD
Library: Add support for the pc87247 driver (fans only)
Probe for busses before chips
Drop support for algorithm names
Man page sensors.1: Update (option -c) and clean up
Module icspll: Delete. It was useless and dangerous.
Program sensord: Add pc87247 support (fans only)

View File

@@ -317,20 +317,10 @@ const char *sensors_get_adapter_name(int bus_nr)
return NULL;
}
/* This function is deprecated and will be dropped soon. */
const char *sensors_get_algorithm_name(int bus_nr)
{
int i;
if (bus_nr == SENSORS_CHIP_NAME_BUS_ISA)
return "ISA algorithm";
if (bus_nr == SENSORS_CHIP_NAME_BUS_PCI)
return "PCI algorithm";
if (bus_nr == SENSORS_CHIP_NAME_BUS_DUMMY)
return "Dummy algorithm";
for (i = 0; i < sensors_proc_bus_count; i++)
if (sensors_proc_bus[i].number == bus_nr)
return sensors_proc_bus[i].algorithm;
return NULL;
return "No longer available";
}
/* nr1-1 is the last main feature found; nr2-1 is the last subfeature found */

View File

@@ -134,6 +134,7 @@ input: /* empty */
;
line: bus_statement EOL
| busalgo_statement EOL
| label_statement EOL
| set_statement EOL
| chip_statement EOL
@@ -142,16 +143,26 @@ line: bus_statement EOL
| error EOL
;
bus_statement: BUS i2cbus_name adapter_name algorithm_name
bus_statement: BUS i2cbus_name adapter_name
{ sensors_bus new_el;
new_el.lineno = $1;
new_el.number = $2;
new_el.adapter = $3;
new_el.algorithm = $4;
bus_add_el(&new_el);
}
;
/* for compatibility, deprecated */
busalgo_statement: BUS i2cbus_name adapter_name algorithm_name
{ sensors_bus new_el;
new_el.lineno = $1;
new_el.number = $2;
new_el.adapter = $3;
free($4);
bus_add_el(&new_el);
}
;
label_statement: LABEL function_name string
{ sensors_label new_el;
check_current_chip();

View File

@@ -111,11 +111,10 @@ typedef struct sensors_chip {
} sensors_chip;
/* Config file bus declaration: the i2c bus number, combined with adapter
and algorithm names */
name */
typedef struct sensors_bus {
int number;
char *adapter;
char *algorithm;
int lineno;
} sensors_bus;

View File

@@ -103,7 +103,6 @@ void free_chip_name(sensors_chip_name name)
void free_bus(sensors_bus bus)
{
free(bus.adapter);
free(bus.algorithm);
}
void free_chip(sensors_chip chip)

View File

@@ -24,9 +24,9 @@
.\"
.\" References consulted:
.\" libsensors source code
.TH libsensors 3 "December 30, 1998" "" "Linux Programmer's Manual"
.TH libsensors 3 "October 2006" "" "Linux Programmer's Manual"
.SH NAME
libsensors \- publically accessible functions provided by the sensors library
libsensors \- publicly accessible functions provided by the sensors library
.SH SYNOPSIS
.nf
.B #include <sensors/sensors.h>
@@ -39,7 +39,6 @@ libsensors \- publically accessible functions provided by the sensors library
\fBsensors_chip_name chip2);\fP
.B int sensors_chip_name_has_wildcards(sensors_chip_name chip);
.B const char *sensors_get_adapter_name(int bus_nr);
.B const char *sensors_get_algorithm_name(int bus_nr);
.B int sensors_get_label(sensors_chip_name name, int feature,
\fBchar **result);\fP
.B int sensors_get_feature(sensors_chip_name name, int feature,
@@ -79,9 +78,14 @@ Check whether the chip name is an 'absolute' name, which can only match one chip
.B const char *sensors_get_adapter_name(int bus_nr);
.br
This function returns the adapter name of a bus number, as used within the
sensors_chip_name structure. If it could not be found, it returns NULL.
.B const char *sensors_get_algorithm_name(int bus_nr);
.br
These functions return the adapter and algorithm names of a bus number, as used within the sensors_chip_name structure. If it could not be found, it returns NULL
This function used to return the algorithm name of a bus number.
It is now deprecated and returns an arbitrary string. It will be dropped
in a later version of the library so you should stop using it.
\fBint sensors_get_label(sensors_chip_name name, int feature,
char **result);\fP

View File

@@ -94,8 +94,7 @@ int sensors_read_proc_bus(void)
line[strlen(line)-1] = '\0';
if (! (border = rindex(line,'\t')))
goto ERROR;
if (! (entry.algorithm = strdup(border+1)))
goto FAT_ERROR;
/* Skip algorithm name */
*border='\0';
if (! (border = rindex(line,'\t')))
goto ERROR;
@@ -109,7 +108,6 @@ int sensors_read_proc_bus(void)
goto ERROR;
if (sensors_parse_i2cbus_name(line,&entry.number))
goto ERROR;
sensors_strip_of_spaces(entry.algorithm);
sensors_strip_of_spaces(entry.adapter);
sensors_add_proc_bus(&entry);
lineno++;

View File

@@ -23,7 +23,7 @@
.\"
.\" References consulted:
.\" sensors.conf.eg by Frodo Looijaard
.TH sensors.conf 5 "February 8, 1999" "" "Linux Programmer's Manual"
.TH sensors.conf 5 "October 2006" "" "Linux Programmer's Manual"
.SH NAME
sensors.conf \- libsensors configuration file
@@ -124,7 +124,7 @@ accompanied by an example line. Please ignore line wrap\-arounds.
.SS BUS STATEMENT
.RS
bus "i2c\-0" "SMBus PIIX4 adapter at e800" "Non\-I2C SMBus adapter"
bus "i2c\-0" "SMBus PIIX4 adapter at e800"
.RE
A
@@ -139,12 +139,18 @@ The first argument is the bus number. It is the literal text
followed by a number. As there is a dash in this argument, it must
always be quoted.
The second and third arguments are the
description texts. They must be exactly match the texts as they appear in
.IR /proc/bus/i2c ,
except for trailing spaces, which are removed both from the /proc
entries and the arguments. The adapter description comes first, followed
by the algorithm description.
The second argument is the adapter name, it must match exactly the
adapter name as it appears in
.I /proc/bus/i2c
(2.4 kernel)
or
.I /sys/class/i2c-adapter/i2c-*/device/name
(2.6 kernel).
It should always be quoted as well as it will most certainly contain
spaces or dashes.
There used to be a third argument, the algorithm name. For compatibility
reasons, the parser still accepts this third argument, but ignores it.
The
.I bus

View File

@@ -68,10 +68,12 @@ extern int sensors_match_chip(sensors_chip_name chip1,
if there are wildcards. */
extern int sensors_chip_name_has_wildcards(sensors_chip_name chip);
/* These functions return the adapter and algorithm names of a bus number,
/* This function returns the adapter name of a bus number,
as used within the sensors_chip_name structure. If it could not be found,
it returns NULL */
extern const char *sensors_get_adapter_name(int bus_nr);
/* This function is deprecated and will be dropped soon. */
extern const char *sensors_get_algorithm_name(int bus_nr);
/* Look up the label which belongs to this chip. Note that chip should not

View File

@@ -207,15 +207,9 @@ int sensors_read_sysfs_bus(void)
if (!strncmp(entry.adapter, "ISA ", 4)) {
entry.number = SENSORS_CHIP_NAME_BUS_ISA;
entry.algorithm = strdup("ISA bus algorithm");
} else if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1) {
entry.number = SENSORS_CHIP_NAME_BUS_DUMMY;
entry.algorithm = strdup("Dummy bus algorithm");
} else
entry.algorithm = strdup("Unavailable from sysfs");
if (!entry.algorithm)
sensors_fatal_error(__FUNCTION__, "out of memory");
}
sensors_add_proc_bus(&entry);
}