aboutsummaryrefslogtreecommitdiffstats
path: root/fastos
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2020-04-15 11:55:43 +0200
committerTor Egge <Tor.Egge@broadpark.no>2020-04-15 11:59:16 +0200
commit42bd702bd35cdf39396121f66ae25f95fd867792 (patch)
tree3657e514ec30c5521f1c6577589158bddcd912e8 /fastos
parent1ee3a5aa8d674b1456b684c583a96092be91a344 (diff)
Restore missing portions of directio API for systems without directio
support.
Diffstat (limited to 'fastos')
-rw-r--r--fastos/src/vespa/fastos/file.cpp13
-rw-r--r--fastos/src/vespa/fastos/file.h18
2 files changed, 30 insertions, 1 deletions
diff --git a/fastos/src/vespa/fastos/file.cpp b/fastos/src/vespa/fastos/file.cpp
index 56f6addd743..861dd9f4259 100644
--- a/fastos/src/vespa/fastos/file.cpp
+++ b/fastos/src/vespa/fastos/file.cpp
@@ -184,12 +184,23 @@ FastOS_FileInterface::DirectIOPadding(int64_t offset,
void *
-FastOS_FileInterface::AllocateDirectIOBuffer(size_t byteSize, void *&realPtr)
+FastOS_FileInterface::allocateGenericDirectIOBuffer(size_t byteSize, void *&realPtr)
{
realPtr = malloc(byteSize); // Default - use malloc allignment
return realPtr;
}
+size_t
+FastOS_FileInterface::getMaxDirectIOMemAlign()
+{
+ return 1u;
+}
+
+void *
+FastOS_FileInterface::AllocateDirectIOBuffer(size_t byteSize, void *&realPtr)
+{
+ return allocateGenericDirectIOBuffer(byteSize, realPtr);
+}
void
FastOS_FileInterface::enableMemoryMap(int mmapFlags)
diff --git a/fastos/src/vespa/fastos/file.h b/fastos/src/vespa/fastos/file.h
index 15c4dfa33cd..3d2194229e7 100644
--- a/fastos/src/vespa/fastos/file.h
+++ b/fastos/src/vespa/fastos/file.h
@@ -559,6 +559,24 @@ public:
* This value is always set.
* @return Alligned pointer value or nullptr if out of memory
*/
+ static void *allocateGenericDirectIOBuffer(size_t byteSize, void *&realPtr);
+
+ /**
+ * Get maximum memory alignment for directio buffers.
+ * @return maximum memory alignment for directio buffers.
+ */
+ static size_t getMaxDirectIOMemAlign();
+
+ /**
+ * Allocate a buffer properly alligned with regards to direct io
+ * access restrictions.
+ * @param byteSize Number of bytes to be allocated
+ * @param realPtr Reference where the actual pointer returned
+ * from malloc will be saved. Use free() with
+ * this pointer to deallocate the buffer.
+ * This value is always set.
+ * @return Alligned pointer value or nullptr if out of memory
+ */
virtual void *AllocateDirectIOBuffer(size_t byteSize, void *&realPtr);
/**