diff options
Diffstat (limited to 'haskell')
-rw-r--r-- | haskell/Guestfs.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/haskell/Guestfs.hs b/haskell/Guestfs.hs index 47213768..c061a7a6 100644 --- a/haskell/Guestfs.hs +++ b/haskell/Guestfs.hs @@ -78,7 +78,8 @@ module Guestfs ( cp, cp_a, mv, - ping_daemon + ping_daemon, + zerofree ) where import Foreign import Foreign.C @@ -788,3 +789,15 @@ ping_daemon h = do fail err else return () +foreign import ccall unsafe "guestfs_zerofree" c_zerofree + :: GuestfsP -> CString -> IO (CInt) + +zerofree :: GuestfsH -> String -> IO () +zerofree h device = do + r <- withCString device $ \device -> withForeignPtr h (\p -> c_zerofree p device) + if (r == -1) + then do + err <- last_error h + fail err + else return () + |