mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libutil: Move some zdev file reading functions into util
In preparation for sharing some zdev udev code with other libraries, move some file operation code from zdev into util_file. Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
a739584d6f
commit
f64b4087dd
@@ -19,6 +19,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lib/util_file.h"
|
||||
|
||||
#include "attrib.h"
|
||||
#include "ccw.h"
|
||||
#include "ccwgroup.h"
|
||||
@@ -187,7 +189,8 @@ static exit_code_t read_fw(struct fw_file *file, FILE *fd, const char *filename)
|
||||
|
||||
for (retry = 0; retry < READ_RETRY; retry++) {
|
||||
/* Read complete file once */
|
||||
rc = misc_read_fd(fd, (void **) &buffer, &size);
|
||||
rc = (exit_code_t) util_file_read_fd_buf(fd, (void **) &buffer,
|
||||
&size);
|
||||
if (rc) {
|
||||
warn("%s: Could not read file", filename);
|
||||
return rc;
|
||||
@@ -203,7 +206,8 @@ static exit_code_t read_fw(struct fw_file *file, FILE *fd, const char *filename)
|
||||
/* Could be a pipe, socket, or FIFO - accept v1. */
|
||||
break;
|
||||
}
|
||||
rc = misc_read_fd(fd, (void **) &buffer2, &size2);
|
||||
rc = (exit_code_t) util_file_read_fd_buf(fd, (void **) &buffer2,
|
||||
&size2);
|
||||
if (rc || !buffer2) {
|
||||
/* Could not get second version - accept v1. */
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user