Rename PReadAll/PWriteAll for file descriptor ptr to ReadAll/WriteAll
Utils.cc contain 2 implementation of PReadAll: 1 for unix fd, and 1 for
FileDescriptorPtr. However, the implementation for unix fd calls pread
syscall under the hood, which does not change file offset. The
implementation for FileDescriptorPtr DOES change file offset, making
code inconsistent. For now we rename inconsistent functions to
ReadAll/WriteAll. The next CL adds PReadAll/PWriteAll implementation for
FileDescriptorPtr.
Test: treehugger
Change-Id: I2781b294f0f8e866275e1649e9b45d565d4cd5b8
diff --git a/common/utils.cc b/common/utils.cc
index c8924b1..66fd12d 100644
--- a/common/utils.cc
+++ b/common/utils.cc
@@ -192,10 +192,10 @@
return true;
}
-bool PWriteAll(const FileDescriptorPtr& fd,
- const void* buf,
- size_t count,
- off_t offset) {
+bool WriteAll(const FileDescriptorPtr& fd,
+ const void* buf,
+ size_t count,
+ off_t offset) {
TEST_AND_RETURN_FALSE_ERRNO(fd->Seek(offset, SEEK_SET) !=
static_cast<off_t>(-1));
return WriteAll(fd, buf, count);
@@ -218,11 +218,11 @@
return true;
}
-bool PReadAll(const FileDescriptorPtr& fd,
- void* buf,
- size_t count,
- off_t offset,
- ssize_t* out_bytes_read) {
+bool ReadAll(const FileDescriptorPtr& fd,
+ void* buf,
+ size_t count,
+ off_t offset,
+ ssize_t* out_bytes_read) {
TEST_AND_RETURN_FALSE_ERRNO(fd->Seek(offset, SEEK_SET) !=
static_cast<off_t>(-1));
char* c_buf = static_cast<char*>(buf);