| Index: src/platform/update_engine/extent_writer.cc
|
| diff --git a/src/platform/update_engine/extent_writer.cc b/src/platform/update_engine/extent_writer.cc
|
| index 1ae565b03776549be8c1820663f16fb9bab7e399..9f6fbf0837a70ab040aeaf7473854528b85a1416 100644
|
| --- a/src/platform/update_engine/extent_writer.cc
|
| +++ b/src/platform/update_engine/extent_writer.cc
|
| @@ -6,25 +6,12 @@
|
| #include <errno.h>
|
| #include <unistd.h>
|
| #include <algorithm>
|
| +#include "update_engine/utils.h"
|
|
|
| using std::min;
|
|
|
| namespace chromeos_update_engine {
|
|
|
| -namespace {
|
| -// Returns true on success.
|
| -bool WriteAll(int fd, const void *buf, size_t count) {
|
| - const char* c_buf = reinterpret_cast<const char*>(buf);
|
| - ssize_t bytes_written = 0;
|
| - while (bytes_written < static_cast<ssize_t>(count)) {
|
| - ssize_t rc = write(fd, c_buf + bytes_written, count - bytes_written);
|
| - TEST_AND_RETURN_FALSE_ERRNO(rc >= 0);
|
| - bytes_written += rc;
|
| - }
|
| - return true;
|
| -}
|
| -}
|
| -
|
| bool DirectExtentWriter::Write(const void* bytes, size_t count) {
|
| if (count == 0)
|
| return true;
|
| @@ -48,7 +35,7 @@ bool DirectExtentWriter::Write(const void* bytes, size_t count) {
|
| TEST_AND_RETURN_FALSE_ERRNO(lseek64(fd_, offset, SEEK_SET) !=
|
| static_cast<off64_t>(-1));
|
| TEST_AND_RETURN_FALSE(
|
| - WriteAll(fd_, c_bytes + bytes_written, bytes_to_write));
|
| + utils::WriteAll(fd_, c_bytes + bytes_written, bytes_to_write));
|
| }
|
| bytes_written += bytes_to_write;
|
| extent_bytes_written_ += bytes_to_write;
|
|
|