Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Unified Diff: src/platform/update_engine/extent_writer.cc

Issue 891002: AU: Delta Diff Generator (Closed)
Patch Set: fixes for review Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
« no previous file with comments | « src/platform/update_engine/extent_mapper_unittest.cc ('k') | src/platform/update_engine/filesystem_copier_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698