diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-05-14 23:47:17 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-05-14 23:47:17 +0100 |
commit | d901cc916102f1aaccfb73396b48aa303e5b8cd7 (patch) | |
tree | 7c2fd470088874ab99b5922393327170e653cf01 /haskell/Guestfs.hs | |
parent | 4aa4ecc380edc509aba886417c67d9c39ab51c9a (diff) | |
download | libguestfs-d901cc916102f1aaccfb73396b48aa303e5b8cd7.tar.gz libguestfs-d901cc916102f1aaccfb73396b48aa303e5b8cd7.tar.xz libguestfs-d901cc916102f1aaccfb73396b48aa303e5b8cd7.zip |
Add support for zerofree command.
Diffstat (limited to 'haskell/Guestfs.hs')
-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 () + |