SOURCES: openhpi-sysfs2.patch (NEW) - don't use obsolete API (sysf...

qboosh qboosh at pld-linux.org
Tue Jan 24 20:04:34 CET 2006


Author: qboosh                       Date: Tue Jan 24 19:04:34 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- don't use obsolete API (sysfs_read_attribute_value); ready for sysfsutils 2.0.0

---- Files affected:
SOURCES:
   openhpi-sysfs2.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/openhpi-sysfs2.patch
diff -u /dev/null SOURCES/openhpi-sysfs2.patch:1.1
--- /dev/null	Tue Jan 24 20:04:34 2006
+++ SOURCES/openhpi-sysfs2.patch	Tue Jan 24 20:04:29 2006
@@ -0,0 +1,76 @@
+--- openhpi-2.3.1/plugins/sysfs/sysfs2hpi.c.orig	2005-10-27 05:00:47.000000000 +0200
++++ openhpi-2.3.1/plugins/sysfs/sysfs2hpi.c	2006-01-24 19:41:23.444302750 +0100
+@@ -636,7 +636,7 @@
+ 					SaHpiEventStateT *state)
+ {
+ 	struct sensor *s;
+-	char tmp[SCRATCHSIZE];
++	struct sysfs_attribute *tmpattr;
+ 	struct oh_handler_state *inst = (struct oh_handler_state *)hnd;
+         SaHpiRdrT *tmprdr;
+ 
+@@ -673,12 +673,19 @@
+ 
+ 	*state = 0x0000;
+ 
+-	if (sysfs_read_attribute_value(s->value->path,tmp,SCRATCHSIZE)) {
++	if ((tmpattr = sysfs_open_attribute(s->value->path)) == NULL) {
+ 		dbg("error attempting to read value of %s",s->name);
+ 		return SA_ERR_HPI_INVALID_DATA;
+ 	}
++	
++	if (sysfs_read_attribute(tmpattr)) {
++		dbg("error attempting to read value of %s",s->name);
++		sysfs_close_attribute(tmpattr);
++		return SA_ERR_HPI_INVALID_DATA;
++	}
+ 
+-        reading_int64_set(reading, atoi(tmp));
++        reading_int64_set(reading, atoi(tmpattr->value));
++	sysfs_close_attribute(tmpattr);
+ 	
+ 	return 0;
+ }
+@@ -708,7 +715,7 @@
+ 					   	SaHpiSensorThresholdsT *thres)
+ {
+ 	struct sensor *s;
+-	char tmp[SCRATCHSIZE];
++	struct sysfs_attribute *tmpattr;
+ 	struct oh_handler_state *inst = (struct oh_handler_state *)hnd;
+ 	SaHpiRdrT *tmprdr;
+ 
+@@ -746,17 +753,29 @@
+ 	 * Setting ValuesPresent for all other items to 0.
+ 	 */
+ 	/* get min values */
+-        if (sysfs_read_attribute_value(s->min->path,tmp,SCRATCHSIZE)) {
++        if ((tmpattr = sysfs_open_attribute(s->min->path)) == NULL) {
++                dbg("error attempting to read value of %s",s->name);
++                return SA_ERR_HPI_INVALID_DATA;
++        }
++        if (sysfs_read_attribute(tmpattr)) {
+                 dbg("error attempting to read value of %s",s->name);
++		sysfs_close_attribute(tmpattr);
+                 return SA_ERR_HPI_INVALID_DATA;
+         }
+-        reading_int64_set(&thres->LowCritical, atoi(tmp));
++        reading_int64_set(&thres->LowCritical, atoi(tmpattr->value));
++	sysfs_close_attribute(tmpattr);
+ 
+-        if (sysfs_read_attribute_value(s->max->path,tmp,SCRATCHSIZE)) {
++        if ((tmpattr = sysfs_open_attribute(s->max->path)) == NULL) {
++                dbg("error attempting to read value of %s",s->name);
++                return SA_ERR_HPI_INVALID_DATA;
++        }
++        if (sysfs_read_attribute(tmpattr)) {
+                 dbg("error attempting to read value of %s",s->name);
++		sysfs_close_attribute(tmpattr);
+                 return SA_ERR_HPI_INVALID_DATA;
+         }
+-        reading_int64_set(&thres->UpCritical, atoi(tmp));
++        reading_int64_set(&thres->UpCritical, atoi(tmpattr->value));
++	sysfs_close_attribute(tmpattr);
+ 
+         thres->LowMajor.IsSupported = SAHPI_FALSE;
+         thres->LowMinor.IsSupported = SAHPI_FALSE;
================================================================


More information about the pld-cvs-commit mailing list