summaryrefslogtreecommitdiffstats
path: root/fastos
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-01-26 12:31:03 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-01-26 12:31:03 +0000
commita1756eb6080701f6e625b6e4affe5e9f1af1d208 (patch)
tree69e12a81aa63a9b68b39e57763c64513864ce5b7 /fastos
parent654ca084c7d1933dced2c4a1cd531c437f222d05 (diff)
Rename read -> has_read
Diffstat (limited to 'fastos')
-rw-r--r--fastos/src/vespa/fastos/linux_file.cpp47
-rw-r--r--fastos/src/vespa/fastos/linux_file.h1
2 files changed, 16 insertions, 32 deletions
diff --git a/fastos/src/vespa/fastos/linux_file.cpp b/fastos/src/vespa/fastos/linux_file.cpp
index f1936ede2da..6cbd320d426 100644
--- a/fastos/src/vespa/fastos/linux_file.cpp
+++ b/fastos/src/vespa/fastos/linux_file.cpp
@@ -38,17 +38,17 @@ ssize_t
FastOS_Linux_File::readInternal(int fh, void *buffer, size_t length, int64_t readOffset)
{
char * data = static_cast<char *>(buffer);
- ssize_t read(0);
- while (read < ssize_t(length)) {
- size_t lenNow = std::min(getChunkSize(), length - read);
- ssize_t readNow = File_RW_Ops::pread(fh, data + read, lenNow, readOffset + read);
+ ssize_t has_read(0);
+ while (has_read < ssize_t(length)) {
+ size_t lenNow = std::min(getChunkSize(), length - has_read);
+ ssize_t readNow = File_RW_Ops::pread(fh, data + has_read, lenNow, readOffset + has_read);
if (readNow > 0) {
- read += readNow;
+ has_read += readNow;
} else {
- return (read > 0) ? read : readNow;
+ return (has_read > 0) ? has_read : readNow;
}
}
- return read;
+ return has_read;
}
@@ -56,17 +56,17 @@ ssize_t
FastOS_Linux_File::readInternal(int fh, void *buffer, size_t length)
{
char * data = static_cast<char *>(buffer);
- ssize_t read(0);
- while (read < ssize_t(length)) {
- size_t lenNow = std::min(getChunkSize(), length - read);
- ssize_t readNow = File_RW_Ops::read(fh, data + read, lenNow);
+ ssize_t has_read(0);
+ while (has_read < ssize_t(length)) {
+ size_t lenNow = std::min(getChunkSize(), length - has_read);
+ ssize_t readNow = File_RW_Ops::read(fh, data + has_read, lenNow);
if (readNow > 0) {
- read += readNow;
+ has_read += readNow;
} else {
- return (read > 0) ? read : readNow;
+ return (has_read > 0) ? has_read : readNow;
}
}
- return read;
+ return has_read;
}
@@ -296,17 +296,6 @@ FastOS_Linux_File::AllocateDirectIOBuffer (size_t byteSize, void *&realPtr)
return align(realPtr, memoryAlignment);
}
-
-void *
-FastOS_Linux_File::
-allocateGenericDirectIOBuffer(size_t byteSize, void *&realPtr)
-{
- size_t memoryAlignment = _directIOMemAlign;
- realPtr = malloc(byteSize + memoryAlignment - 1);
- return align(realPtr, memoryAlignment);
-}
-
-
size_t
FastOS_Linux_File::getMaxDirectIOMemAlign()
{
@@ -317,18 +306,14 @@ FastOS_Linux_File::getMaxDirectIOMemAlign()
bool
FastOS_Linux_File::GetDirectIORestrictions (size_t &memoryAlignment, size_t &transferGranularity, size_t &transferMaximum)
{
- bool rc = false;
-
if (_directIOEnabled) {
memoryAlignment = _directIOMemAlign;
transferGranularity = _directIOFileAlign;
transferMaximum = 0x7FFFFFFF;
- rc = true;
+ return true;
} else {
- rc = FastOS_UNIX_File::GetDirectIORestrictions(memoryAlignment, transferGranularity, transferMaximum);
+ return FastOS_UNIX_File::GetDirectIORestrictions(memoryAlignment, transferGranularity, transferMaximum);
}
-
- return rc;
}
diff --git a/fastos/src/vespa/fastos/linux_file.h b/fastos/src/vespa/fastos/linux_file.h
index 7a8fc6245bb..92f0d0b923a 100644
--- a/fastos/src/vespa/fastos/linux_file.h
+++ b/fastos/src/vespa/fastos/linux_file.h
@@ -44,7 +44,6 @@ public:
static bool InitializeClass();
static size_t getMaxDirectIOMemAlign();
- static void *allocateGenericDirectIOBuffer(size_t byteSize, void *&realPtr);
static int count_open_files();
private:
ssize_t internalWrite2(const void *buffer, size_t len);