summaryrefslogtreecommitdiffstats
path: root/fastos
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-04-15 17:40:01 +0200
committerGitHub <noreply@github.com>2020-04-15 17:40:01 +0200
commit3af346b53ecb0acf0512636d84cfa66f3317a7dd (patch)
treec1610eab5dc3bce31cc7b37a37bcac2a76d66de1 /fastos
parentd6c1681204b71916e1aa346490fe32118965bd7a (diff)
parent42bd702bd35cdf39396121f66ae25f95fd867792 (diff)
Merge pull request #12916 from vespa-engine/toregge/extend-base-class-with-directio-methods
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);
/**