File iprutils.generate_ipr_dump_file.patch of Package iprutils.558

---
 iprutils/iprdump.c |    7 ++++++-
 iprutils/iprlib.c  |    8 ++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

Index: b/iprutils/iprdump.c
===================================================================
--- a/iprutils/iprdump.c	2014-05-02 17:58:23.447765969 -0500
+++ b/iprutils/iprdump.c	2014-05-02 17:59:07.888676030 -0500
@@ -98,8 +98,13 @@ static void disable_dump(struct ipr_ioa 
 static int read_dump(struct ipr_ioa *ioa)
 {
 	int count = 0;
+	char path[PATH_MAX];
+	FILE *file;
+
+	sprintf(path, "/sys/class/scsi_host/%s/%s", ioa->host_name, "dump");
+	file = fopen(path, "r");
+	count = fread(&dump, 1 , sizeof(dump), file);
 
-	count = ipr_read_host_attr(ioa, "dump", &dump, sizeof(dump));
 	return (count < 0) ? 0: count;
 }
 
Index: b/iprutils/iprlib.c
===================================================================
--- a/iprutils/iprlib.c	2014-05-02 17:57:56.477764788 -0500
+++ b/iprutils/iprlib.c	2014-05-02 17:59:07.888676030 -0500
@@ -2184,7 +2184,7 @@ void ipr_reset_adapter(struct ipr_ioa *i
  * @value_len:		length of value string
  *
  * Returns:
- *   0 if success / non-zero on failure
+ *   >= 0 if success / < 0 on failure
  **/
 int ipr_read_host_attr(struct ipr_ioa *ioa, char *name,
 		       void *value, size_t value_len)
@@ -2198,7 +2198,7 @@ int ipr_read_host_attr(struct ipr_ioa *i
 		ioa_dbg(ioa, "Failed to read %s attribute. %m\n", name);
 		return -EIO;
 	}
-	return 0;
+	return len;
 }
 
 /**
@@ -2209,7 +2209,7 @@ int ipr_read_host_attr(struct ipr_ioa *i
  * @value_len:		length of value string
  *
  * Returns:
- *   0 if success / non-zero on failure
+ *   >= 0 if success / < 0 on failure
  **/
 int ipr_write_host_attr(struct ipr_ioa *ioa, char *name,
 			void *value, size_t value_len)
@@ -2223,7 +2223,7 @@ int ipr_write_host_attr(struct ipr_ioa *
 		ioa_dbg(ioa, "Failed to write %s attribute. %m\n", name);
 		return -EIO;
 	}
-	return 0;
+	return len;
 }
 
 /**
openSUSE Build Service is sponsored by