diff options
| -rw-r--r-- | util/libreboot-utils/include/common.h | 2 | ||||
| -rw-r--r-- | util/libreboot-utils/lib/command.c | 2 | ||||
| -rw-r--r-- | util/libreboot-utils/lib/file.c | 18 | ||||
| -rw-r--r-- | util/libreboot-utils/lib/io.c | 8 |
4 files changed, 15 insertions, 15 deletions
diff --git a/util/libreboot-utils/include/common.h b/util/libreboot-utils/include/common.h index 2e8cb9a7..de643402 100644 --- a/util/libreboot-utils/include/common.h +++ b/util/libreboot-utils/include/common.h @@ -457,7 +457,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, +ssize_t rw_exact(int fd, unsigned char *mem, size_t len, off_t off, int rw_type); ssize_t rw(int fd, void *mem, size_t nrw, off_t off, int rw_type); diff --git a/util/libreboot-utils/lib/command.c b/util/libreboot-utils/lib/command.c index be5e8712..3bdc4191 100644 --- a/util/libreboot-utils/lib/command.c +++ b/util/libreboot-utils/lib/command.c @@ -492,7 +492,7 @@ cat_buf(unsigned char *b) if (b == NULL) exitf("null pointer in cat command"); - if (rw_file_exact(STDOUT_FILENO, b, + if (rw_exact(STDOUT_FILENO, b, GBE_PART_SIZE, 0, IO_WRITE) < 0) exitf("stdout: cat"); } diff --git a/util/libreboot-utils/lib/file.c b/util/libreboot-utils/lib/file.c index 741e6793..b62cb87a 100644 --- a/util/libreboot-utils/lib/file.c +++ b/util/libreboot-utils/lib/file.c @@ -127,7 +127,7 @@ err_fsync_dir: return with_fallback_errno(EIO); } -/* rw_file_exact() - Read perfectly or die +/* rw_exact() - Read perfectly or die * * Read/write, and absolutely insist on an * absolute read; e.g. if 100 bytes are @@ -145,7 +145,7 @@ err_fsync_dir: */ ssize_t -rw_file_exact(int fd, unsigned char *mem, size_t nrw, +rw_exact(int fd, unsigned char *mem, size_t nrw, off_t off, int rw_type) { int saved_errno = errno; @@ -157,13 +157,13 @@ rw_file_exact(int fd, unsigned char *mem, size_t nrw, errno = 0; if (io_args(fd, mem, nrw, off, rw_type) == -1) - goto err_rw_file_exact; + goto err_rw_exact; while (1) { /* Prevent theoretical overflow */ if (if_err(rval >= 0 && (size_t)rval > (nrw - rc), EOVERFLOW)) - goto err_rw_file_exact; + goto err_rw_exact; rc += rval; if ((size_t)rc >= nrw) @@ -173,22 +173,22 @@ rw_file_exact(int fd, unsigned char *mem, size_t nrw, nrw_cur = (size_t)(nrw - (size_t)rc); if (if_err(off < 0, EOVERFLOW)) - goto err_rw_file_exact; + goto err_rw_exact; off_cur = off + (off_t)rc; if ((rval = rw(fd, mem_cur, nrw_cur, off_cur, rw_type)) <= 0) - goto err_rw_file_exact; + goto err_rw_exact; } if (if_err((size_t)rc != nrw, EIO) || (rval = rw_over_nrw(rc, nrw)) < 0) - goto err_rw_file_exact; + goto err_rw_exact; reset_caller_errno(rval); return rval; -err_rw_file_exact: +err_rw_exact: return with_fallback_errno(EIO); } @@ -202,7 +202,7 @@ err_rw_file_exact: * * WARNING: this function allows zero-byte returns. * this is intentional, to mimic libc behaviour. - * use rw_file_exact if you need to avoid this. + * use rw_exact if you need to avoid this. * (ditto partial writes/reads) * */ diff --git a/util/libreboot-utils/lib/io.c b/util/libreboot-utils/lib/io.c index 81f9f52a..801d4c53 100644 --- a/util/libreboot-utils/lib/io.c +++ b/util/libreboot-utils/lib/io.c @@ -108,7 +108,7 @@ read_file(void) /* read main file */ - _r = rw_file_exact(f->gbe_fd, f->buf, f->gbe_file_size, + _r = rw_exact(f->gbe_fd, f->buf, f->gbe_file_size, 0, IO_PREAD); if (_r < 0) @@ -116,7 +116,7 @@ read_file(void) /* copy to tmpfile */ - _r = rw_file_exact(f->tmp_fd, f->buf, f->gbe_file_size, + _r = rw_exact(f->tmp_fd, f->buf, f->gbe_file_size, 0, IO_PWRITE); if (_r < 0) @@ -139,7 +139,7 @@ read_file(void) if (fsync_on_eintr(f->tmp_fd) == -1) exitf("%s: fsync (tmpfile copy)", f->tname); - _r = rw_file_exact(f->tmp_fd, f->bufcmp, f->gbe_file_size, + _r = rw_exact(f->tmp_fd, f->bufcmp, f->gbe_file_size, 0, IO_PREAD); if (_r < 0) @@ -556,7 +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); + r = rw_exact(fd, mem, nrw, off, rw_type); return rw_over_nrw(r, nrw); |
