linux-file-extents 0.2.0.0 → 0.2.0.1
raw patch · 2 files changed
+11/−7 lines, 2 filesdep ~unix
Dependency ranges changed: unix
Files
System/Linux/FileExtents.hsc view
@@ -7,7 +7,7 @@ -- -- This module can be used to retrieve information about how a -- particular file is stored on disk (i.e. the file fragmentation).--- It accomplishes that by directly calling the FIEMAP ioctl provided by+-- It accomplishes that by calling the FIEMAP ioctl provided by -- recent versions of the Linux kernel. This ioctl is specific to Linux -- and therefore this module is not portable. --@@ -119,9 +119,13 @@ } deriving (Show, Eq) +#if __GLASGOW_HASKELL__ < 800+#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)+#endif+ instance Storable Extent where sizeOf _ = #size struct fiemap_extent- alignment _ = alignment (undefined :: Int)+ alignment _ = (#alignment struct fiemap_extent) peek ptr = do extLogical_ <- (#peek struct fiemap_extent, fe_logical ) ptr extPhysical_ <- (#peek struct fiemap_extent, fe_physical) ptr@@ -138,7 +142,7 @@ -------------------------------------------------------------------------------- -- request flags --- |Flags the modify the behavior of extent information requests.+-- |Flags that modify the behavior of extent information requests. data ReqFlags = ReqFlags { rfSync :: Bool -- ^ Sync the file before requesting its extents. , rfXattr :: Bool -- ^ Retrieve the extents of the inode's extended attribute lookup tree, instead of its data tree.@@ -182,7 +186,7 @@ -- file descriptors. getExtents :: ReqFlags -> FilePath -> Maybe (Word64, Word64) -> IO [Extent] getExtents flags path range =- bracket (openFd path ReadOnly Nothing defaultFileFlags) closeFd $ \fd ->+ bracket (openFd path ReadOnly defaultFileFlags) closeFd $ \fd -> getExtentsPathFd "getExtents" (Just path) flags fd range getExtentsPathFd :: String -> Maybe FilePath -> ReqFlags -> Fd -> Maybe (Word64, Word64) -> IO [Extent]@@ -228,7 +232,7 @@ -- instead of a list. getExtentCount :: ReqFlags -> FilePath -> Maybe (Word64, Word64) -> IO Word32 getExtentCount flags path range =- bracket (openFd path ReadOnly Nothing defaultFileFlags) closeFd $ \fd ->+ bracket (openFd path ReadOnly defaultFileFlags) closeFd $ \fd -> getExtentCountPathFd "getExtentCount" (Just path) flags fd range getExtentCountPathFd :: String -> Maybe FilePath -> ReqFlags -> Fd -> Maybe (Word64, Word64) -> IO Word32
linux-file-extents.cabal view
@@ -1,5 +1,5 @@ name: linux-file-extents-version: 0.2.0.0+version: 0.2.0.1 synopsis: Retrieve file fragmentation information under Linux description: This package provides a simple wrapper around the Linux FIEMAP ioctl.@@ -31,7 +31,7 @@ library exposed-modules: System.Linux.FileExtents include-dirs: include- build-depends: base >=4.6 && <5, unix >=2.6+ build-depends: base >=4.6 && <5, unix >=2.8 build-tools: hsc2hs default-language: Haskell2010 ghc-options: -Wall