diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-04-15 11:55:43 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-04-15 11:59:16 +0200 |
commit | 42bd702bd35cdf39396121f66ae25f95fd867792 (patch) | |
tree | 3657e514ec30c5521f1c6577589158bddcd912e8 /fastos | |
parent | 1ee3a5aa8d674b1456b684c583a96092be91a344 (diff) |
Restore missing portions of directio API for systems without directio
support.
Diffstat (limited to 'fastos')
-rw-r--r-- | fastos/src/vespa/fastos/file.cpp | 13 | ||||
-rw-r--r-- | fastos/src/vespa/fastos/file.h | 18 |
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); /** |