summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/libreboot-utils/include/common.h6
-rw-r--r--util/libreboot-utils/lib/command.c2
-rw-r--r--util/libreboot-utils/lib/file.c14
-rw-r--r--util/libreboot-utils/lib/io.c9
4 files changed, 8 insertions, 23 deletions
diff --git a/util/libreboot-utils/include/common.h b/util/libreboot-utils/include/common.h
index 5058317c..2e8cb9a7 100644
--- a/util/libreboot-utils/include/common.h
+++ b/util/libreboot-utils/include/common.h
@@ -83,10 +83,6 @@
#error "Unexpected bit layout"
#endif
-#ifndef MAX_ZERO_RW_RETRY
-#define MAX_ZERO_RW_RETRY 5
-#endif
-
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
@@ -462,7 +458,7 @@ ssize_t rw_gbe_file_exact(int fd, unsigned char *mem, size_t nrw,
int fsync_dir(const char *path);
ssize_t rw_file_exact(int fd, unsigned char *mem, size_t len,
- off_t off, int rw_type, size_t max_retries);
+ off_t off, int rw_type);
ssize_t rw(int fd, void *mem, size_t nrw,
off_t off, int rw_type);
int io_args(int fd, void *mem, size_t nrw,
diff --git a/util/libreboot-utils/lib/command.c b/util/libreboot-utils/lib/command.c
index 526ad03b..be5e8712 100644
--- a/util/libreboot-utils/lib/command.c
+++ b/util/libreboot-utils/lib/command.c
@@ -493,7 +493,7 @@ cat_buf(unsigned char *b)
exitf("null pointer in cat command");
if (rw_file_exact(STDOUT_FILENO, b,
- GBE_PART_SIZE, 0, IO_WRITE, MAX_ZERO_RW_RETRY) < 0)
+ GBE_PART_SIZE, 0, IO_WRITE) < 0)
exitf("stdout: cat");
}
void
diff --git a/util/libreboot-utils/lib/file.c b/util/libreboot-utils/lib/file.c
index d44d8cf9..741e6793 100644
--- a/util/libreboot-utils/lib/file.c
+++ b/util/libreboot-utils/lib/file.c
@@ -146,7 +146,7 @@ err_fsync_dir:
ssize_t
rw_file_exact(int fd, unsigned char *mem, size_t nrw,
- off_t off, int rw_type, size_t max_retries)
+ off_t off, int rw_type)
{
int saved_errno = errno;
ssize_t rval = 0;
@@ -154,7 +154,6 @@ rw_file_exact(int fd, unsigned char *mem, size_t nrw,
size_t nrw_cur;
off_t off_cur;
void *mem_cur;
- size_t retries_on_zero = 0;
errno = 0;
if (io_args(fd, mem, nrw, off, rw_type) == -1)
@@ -178,17 +177,8 @@ rw_file_exact(int fd, unsigned char *mem, size_t nrw,
off_cur = off + (off_t)rc;
- if ((rval = rw(fd, mem_cur, nrw_cur, off_cur, rw_type)) < 0)
- goto err_rw_file_exact;
-
- if (rval == 0) {
- if (retries_on_zero++ < max_retries)
- continue;
-
+ if ((rval = rw(fd, mem_cur, nrw_cur, off_cur, rw_type)) <= 0)
goto err_rw_file_exact;
- }
-
- retries_on_zero = 0;
}
if (if_err((size_t)rc != nrw, EIO) ||
diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c
index f8e67977..81f9f52a 100644
--- a/util/libreboot-utils/lib/io.c
+++ b/util/libreboot-utils/lib/io.c
@@ -109,7 +109,7 @@ read_file(void)
/* read main file
*/
_r = rw_file_exact(f->gbe_fd, f->buf, f->gbe_file_size,
- 0, IO_PREAD, MAX_ZERO_RW_RETRY);
+ 0, IO_PREAD);
if (_r < 0)
exitf("%s: read failed", f->fname);
@@ -117,7 +117,7 @@ read_file(void)
/* copy to tmpfile
*/
_r = rw_file_exact(f->tmp_fd, f->buf, f->gbe_file_size,
- 0, IO_PWRITE, MAX_ZERO_RW_RETRY);
+ 0, IO_PWRITE);
if (_r < 0)
exitf("%s: %s: copy failed",
@@ -140,7 +140,7 @@ read_file(void)
exitf("%s: fsync (tmpfile copy)", f->tname);
_r = rw_file_exact(f->tmp_fd, f->bufcmp, f->gbe_file_size,
- 0, IO_PREAD, MAX_ZERO_RW_RETRY);
+ 0, IO_PREAD);
if (_r < 0)
exitf("%s: read failed (cmp)", f->tname);
@@ -556,8 +556,7 @@ rw_gbe_file_exact(int fd, unsigned char *mem, size_t nrw,
if (nrw > (size_t)GBE_PART_SIZE)
goto err_rw_gbe_file_exact;
- r = rw_file_exact(fd, mem, nrw, off, rw_type,
- MAX_ZERO_RW_RETRY);
+ r = rw_file_exact(fd, mem, nrw, off, rw_type);
return rw_over_nrw(r, nrw);