X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=haskell%2FGuestfs.hs;h=9eefda11f9830aceb485ba90a80d706c0178e46b;hp=8101b526981091942707980db5566cc7acd47fbc;hb=107a76ad3680fda05cfd58136d62eeab4e77a8dc;hpb=f450ce75b754fb869b34433c0126f7bb592b141b diff --git a/haskell/Guestfs.hs b/haskell/Guestfs.hs index 8101b52..9eefda1 100644 --- a/haskell/Guestfs.hs +++ b/haskell/Guestfs.hs @@ -119,7 +119,8 @@ module Guestfs ( scrub_freespace, wc_l, wc_w, - wc_c + wc_c, + du ) where import Foreign import Foreign.C @@ -1158,8 +1159,8 @@ foreign import ccall unsafe "guestfs_sfdisk_N" c_sfdisk_N :: GuestfsP -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (CInt) sfdisk_N :: GuestfsH -> String -> Int -> Int -> Int -> Int -> String -> IO () -sfdisk_N h device n cyls heads sectors line = do - r <- withCString device $ \device -> withCString line $ \line -> withForeignPtr h (\p -> c_sfdisk_N p device (fromIntegral n) (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) line) +sfdisk_N h device partnum cyls heads sectors line = do + r <- withCString device $ \device -> withCString line $ \line -> withForeignPtr h (\p -> c_sfdisk_N p device (fromIntegral partnum) (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) line) if (r == -1) then do err <- last_error h @@ -1322,3 +1323,15 @@ wc_c h path = do fail err else return (fromIntegral r) +foreign import ccall unsafe "guestfs_du" c_du + :: GuestfsP -> CString -> IO (Int64) + +du :: GuestfsH -> String -> IO (Integer) +du h path = do + r <- withCString path $ \path -> withForeignPtr h (\p -> c_du p path) + if (r == -1) + then do + err <- last_error h + fail err + else return (fromIntegral r) +