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
4 SaHpiEventStateT *state)
7 - char tmp[SCRATCHSIZE];
8 + struct sysfs_attribute *tmpattr;
9 struct oh_handler_state *inst = (struct oh_handler_state *)hnd;
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;
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;
28 - reading_int64_set(reading, atoi(tmp));
29 + reading_int64_set(reading, atoi(tmpattr->value));
30 + sysfs_close_attribute(tmpattr);
35 SaHpiSensorThresholdsT *thres)
38 - char tmp[SCRATCHSIZE];
39 + struct sysfs_attribute *tmpattr;
40 struct oh_handler_state *inst = (struct oh_handler_state *)hnd;
44 * Setting ValuesPresent for all other items to 0.
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;
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;
57 - reading_int64_set(&thres->LowCritical, atoi(tmp));
58 + reading_int64_set(&thres->LowCritical, atoi(tmpattr->value));
59 + sysfs_close_attribute(tmpattr);
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;
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;
71 - reading_int64_set(&thres->UpCritical, atoi(tmp));
72 + reading_int64_set(&thres->UpCritical, atoi(tmpattr->value));
73 + sysfs_close_attribute(tmpattr);
75 thres->LowMajor.IsSupported = SAHPI_FALSE;
76 thres->LowMinor.IsSupported = SAHPI_FALSE;