module Foundation.Foreign.MemoryMap.Types
( FileMapping(..)
, fileMappingToFinalPtr
, FileMapReadF
) where
import GHC.Ptr
import Basement.FinalPtr
import Basement.Types.OffsetSize
import Basement.Compat.Base
import Foundation.VFS (FilePath)
data FileMapping = FileMapping
{ fileMappingPtr :: Ptr Word8
, fileMappingSize :: FileSize
, fileMappingUnmap :: IO ()
}
fileMappingToFinalPtr :: FileMapping -> IO (FinalPtr Word8)
fileMappingToFinalPtr (FileMapping ptr _ finalizer) =
toFinalPtr ptr (const finalizer)
type FileMapReadF = FilePath -> IO FileMapping