module Foundation.Foreign.MemoryMap.Types
( FileMapping(..)
, fileMappingToFinalPtr
, FileMapReadF
) where
import GHC.Ptr
import Foundation.Primitive.FinalPtr
import Foundation.Primitive.Types.OffsetSize
import Foundation.Internal.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 (\_ -> finalizer)
type FileMapReadF = FilePath -> IO FileMapping