]>
Commit | Line | Data |
---|---|---|
b0c95cd8 JB |
1 | --- openhpi-2.3.1/plugins/sysfs/sysfs2hpi.c.orig 2005-10-27 05:00:47.000000000 +0200 |
2 | +++ openhpi-2.3.1/plugins/sysfs/sysfs2hpi.c 2006-01-24 19:41:23.444302750 +0100 | |
3 | @@ -636,7 +636,7 @@ | |
4 | SaHpiEventStateT *state) | |
5 | { | |
6 | struct sensor *s; | |
7 | - char tmp[SCRATCHSIZE]; | |
8 | + struct sysfs_attribute *tmpattr; | |
9 | struct oh_handler_state *inst = (struct oh_handler_state *)hnd; | |
10 | SaHpiRdrT *tmprdr; | |
11 | ||
12 | @@ -673,12 +673,19 @@ | |
13 | ||
14 | *state = 0x0000; | |
15 | ||
16 | - if (sysfs_read_attribute_value(s->value->path,tmp,SCRATCHSIZE)) { | |
17 | + if ((tmpattr = sysfs_open_attribute(s->value->path)) == NULL) { | |
18 | dbg("error attempting to read value of %s",s->name); | |
19 | return SA_ERR_HPI_INVALID_DATA; | |
20 | } | |
21 | + | |
22 | + if (sysfs_read_attribute(tmpattr)) { | |
23 | + dbg("error attempting to read value of %s",s->name); | |
24 | + sysfs_close_attribute(tmpattr); | |
25 | + return SA_ERR_HPI_INVALID_DATA; | |
26 | + } | |
27 | ||
28 | - reading_int64_set(reading, atoi(tmp)); | |
29 | + reading_int64_set(reading, atoi(tmpattr->value)); | |
30 | + sysfs_close_attribute(tmpattr); | |
31 | ||
32 | return 0; | |
33 | } | |
34 | @@ -708,7 +715,7 @@ | |
35 | SaHpiSensorThresholdsT *thres) | |
36 | { | |
37 | struct sensor *s; | |
38 | - char tmp[SCRATCHSIZE]; | |
39 | + struct sysfs_attribute *tmpattr; | |
40 | struct oh_handler_state *inst = (struct oh_handler_state *)hnd; | |
41 | SaHpiRdrT *tmprdr; | |
42 | ||
43 | @@ -746,17 +753,29 @@ | |
44 | * Setting ValuesPresent for all other items to 0. | |
45 | */ | |
46 | /* get min values */ | |
47 | - if (sysfs_read_attribute_value(s->min->path,tmp,SCRATCHSIZE)) { | |
48 | + if ((tmpattr = sysfs_open_attribute(s->min->path)) == NULL) { | |
49 | + dbg("error attempting to read value of %s",s->name); | |
50 | + return SA_ERR_HPI_INVALID_DATA; | |
51 | + } | |
52 | + if (sysfs_read_attribute(tmpattr)) { | |
53 | dbg("error attempting to read value of %s",s->name); | |
54 | + sysfs_close_attribute(tmpattr); | |
55 | return SA_ERR_HPI_INVALID_DATA; | |
56 | } | |
57 | - reading_int64_set(&thres->LowCritical, atoi(tmp)); | |
58 | + reading_int64_set(&thres->LowCritical, atoi(tmpattr->value)); | |
59 | + sysfs_close_attribute(tmpattr); | |
60 | ||
61 | - if (sysfs_read_attribute_value(s->max->path,tmp,SCRATCHSIZE)) { | |
62 | + if ((tmpattr = sysfs_open_attribute(s->max->path)) == NULL) { | |
63 | + dbg("error attempting to read value of %s",s->name); | |
64 | + return SA_ERR_HPI_INVALID_DATA; | |
65 | + } | |
66 | + if (sysfs_read_attribute(tmpattr)) { | |
67 | dbg("error attempting to read value of %s",s->name); | |
68 | + sysfs_close_attribute(tmpattr); | |
69 | return SA_ERR_HPI_INVALID_DATA; | |
70 | } | |
71 | - reading_int64_set(&thres->UpCritical, atoi(tmp)); | |
72 | + reading_int64_set(&thres->UpCritical, atoi(tmpattr->value)); | |
73 | + sysfs_close_attribute(tmpattr); | |
74 | ||
75 | thres->LowMajor.IsSupported = SAHPI_FALSE; | |
76 | thres->LowMinor.IsSupported = SAHPI_FALSE; |