Safe Haskell | None |
---|---|
Language | Haskell98 |
Data.Vhd
- create :: FilePath -> CreateParameters -> IO ()
- data CreateParameters = CreateParameters {
- createBlockSize :: BlockSize
- createDiskType :: DiskType
- createParentTimeStamp :: Maybe VhdDiffTime
- createParentUnicodeName :: Maybe ParentUnicodeName
- createParentUniqueId :: Maybe UniqueId
- createTimeStamp :: Maybe VhdDiffTime
- createUuid :: Maybe UniqueId
- createUseBatmap :: Bool
- createVirtualSize :: VirtualByteCount
- defaultCreateParameters :: CreateParameters
- getInfo :: FilePath -> IO (Either String (Header, Footer))
- snapshot :: Vhd -> FilePath -> IO ()
- readData :: Vhd -> IO ByteString
- readDataRange :: Vhd -> Word64 -> Word64 -> IO ByteString
- writeDataRange :: Vhd -> Word64 -> ByteString -> IO ()
- withVhd :: FilePath -> (Vhd -> IO a) -> IO a
- class Sized a where
- newtype BlockSize = BlockSize Word32
- newtype BlockByteAddress = BlockByteAddress Word32
- newtype BlockSectorAddress = BlockSectorAddress Word32
- newtype VirtualBlockAddress = VirtualBlockAddress Word32
- newtype VirtualByteAddress = VirtualByteAddress Word64
- type DiskGeometryCylinders = Word16
- type DiskGeometryHeads = Word8
- type DiskGeometrySectorsPerTrack = Word8
- type PhysicalByteAddress = Word64
- type PhysicalByteCount = Word64
- type PhysicalSectorAddress = Word32
- type PhysicalSectorCount = Word32
- type VirtualBlockCount = Word32
- type VirtualByteCount = Word64
- type VirtualSectorAddress = Word32
- type VirtualSectorCount = Word32
- vaddrPlus :: VirtualByteAddress -> Word64 -> VirtualByteAddress
- vaddrToBlock :: VirtualByteAddress -> BlockSize -> (VirtualBlockAddress, BlockByteAddress, Word32)
- vaddrNextBlock :: VirtualByteAddress -> BlockSize -> VirtualByteAddress
- addrToSector :: Word64 -> PhysicalSectorAddress
- data Version = Version VersionMajor VersionMinor
- type VersionMajor = Word16
- type VersionMinor = Word16
- data CreatorHostOs
- data DiskGeometry = DiskGeometry DiskGeometryCylinders DiskGeometryHeads DiskGeometrySectorsPerTrack
- data DiskType
- newtype Cookie = Cookie ByteString
- newtype CreatorApplication = CreatorApplication ByteString
- data ParentLocatorEntry = ParentLocatorEntry {}
- nullParentLocatorEntry :: ParentLocatorEntry
- newtype ParentUnicodeName = ParentUnicodeName String
- newtype ParentLocatorEntries = ParentLocatorEntries [ParentLocatorEntry]
- cookie :: ByteString -> Cookie
- creatorApplication :: ByteString -> CreatorApplication
- parentLocatorEntries :: [ParentLocatorEntry] -> ParentLocatorEntries
- parentUnicodeName :: [Char] -> ParentUnicodeName
- data Header = Header {
- headerCookie :: Cookie
- headerDataOffset :: PhysicalByteAddress
- headerTableOffset :: PhysicalByteAddress
- headerVersion :: Version
- headerMaxTableEntries :: VirtualBlockCount
- headerBlockSize :: BlockSize
- headerChecksum :: Checksum
- headerParentUniqueId :: UniqueId
- headerParentTimeStamp :: VhdDiffTime
- headerReserved1 :: ByteString
- headerParentUnicodeName :: ParentUnicodeName
- headerParentLocatorEntries :: ParentLocatorEntries
- newtype Checksum = Checksum Word32
- class Serialize a => CheckSumable a where
- checksumCalculate :: ByteString -> Checksum
- verifyChecksum :: CheckSumable a => a -> Bool
- adjustChecksum :: CheckSumable a => a -> a
- data Footer = Footer {
- footerCookie :: Cookie
- footerIsTemporaryDisk :: Bool
- footerFormatVersion :: Version
- footerDataOffset :: PhysicalByteAddress
- footerTimeStamp :: VhdDiffTime
- footerCreatorApplication :: CreatorApplication
- footerCreatorVersion :: Version
- footerCreatorHostOs :: CreatorHostOs
- footerOriginalSize :: VirtualByteCount
- footerCurrentSize :: VirtualByteCount
- footerDiskGeometry :: DiskGeometry
- footerDiskType :: DiskType
- footerChecksum :: Checksum
- footerUniqueId :: UniqueId
- footerIsSavedState :: Bool
- data UniqueId
- uniqueId :: ByteString -> UniqueId
- randomUniqueId :: IO UniqueId
Documentation
create :: FilePath -> CreateParameters -> IO () #
Creates an empty VHD file with the specified parameters.
data CreateParameters #
Constructors
Instances
getInfo :: FilePath -> IO (Either String (Header, Footer)) #
Retrieves the header and footer from a VHD file.
readData :: Vhd -> IO ByteString #
Reads data from the whole virtual address space of the given VHD.
Arguments
:: Vhd | Vhd chain to read from |
-> Word64 | offset address in the VHD |
-> Word64 | number of byte to read |
-> IO ByteString |
Reads data from the given virtual address range of the given VHD.
TODO: modify this function to read sub-blocks where appropriate.
Arguments
:: Vhd | Vhd chain to write to |
-> Word64 | offset address in the VHD |
-> ByteString | the data to write in the VHD |
-> IO () |
Writes data to the given virtual address of the given VHD.
Minimal complete definition
block size
newtype BlockByteAddress #
The offset from the beginning of a block in bytes
Constructors
BlockByteAddress Word32 |
Instances
newtype BlockSectorAddress #
The offset from the beginning of a block in sectors
Constructors
BlockSectorAddress Word32 |
newtype VirtualByteAddress #
An absolute address in byte in the vhd content space
Constructors
VirtualByteAddress Word64 |
type DiskGeometryCylinders = Word16 #
type DiskGeometryHeads = Word8 #
type DiskGeometrySectorsPerTrack = Word8 #
type PhysicalByteAddress = Word64 #
type PhysicalByteCount = Word64 #
type PhysicalSectorAddress = Word32 #
type PhysicalSectorCount = Word32 #
type VirtualBlockCount = Word32 #
type VirtualByteCount = Word64 #
type VirtualSectorAddress = Word32 #
type VirtualSectorCount = Word32 #
vaddrPlus :: VirtualByteAddress -> Word64 -> VirtualByteAddress #
vaddrToBlock :: VirtualByteAddress -> BlockSize -> (VirtualBlockAddress, BlockByteAddress, Word32) #
vaddrNextBlock :: VirtualByteAddress -> BlockSize -> VirtualByteAddress #
increment the virtual address to align to the next block
type VersionMajor = Word16 #
type VersionMinor = Word16 #
data CreatorHostOs #
Instances
data DiskGeometry #
Instances
Constructors
DiskTypeFixed | |
DiskTypeDynamic | |
DiskTypeDifferencing |
cookie :: ByteString -> Cookie #
smart constructor for Cookie
creatorApplication :: ByteString -> CreatorApplication #
smart constructor for CreatorApplication
parentLocatorEntries :: [ParentLocatorEntry] -> ParentLocatorEntries #
smart constructor for ParentLocatorEntries
parentUnicodeName :: [Char] -> ParentUnicodeName #
Constructors
class Serialize a => CheckSumable a where #
Minimal complete definition
Methods
calculateChecksum :: a -> Checksum #
getChecksum :: a -> Checksum #
setChecksum :: Checksum -> a -> a #
Instances
checksumCalculate :: ByteString -> Checksum #
verifyChecksum :: CheckSumable a => a -> Bool #
adjustChecksum :: CheckSumable a => a -> a #
Constructors
uniqueId :: ByteString -> UniqueId #
smart constructor for uniqueId