X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=haskell%2FGuestfs.hs;h=ddbad4696f44c1974567e3c64cdbdfcfc855bbb9;hp=4721376837ab067203db2ab0393519770be667e4;hb=5e332cc6c06532191f793a6789bafe818f726258;hpb=e8ecc08f663b44f3d79517affe52f137858dfe00 diff --git a/haskell/Guestfs.hs b/haskell/Guestfs.hs index 4721376..ddbad46 100644 --- a/haskell/Guestfs.hs +++ b/haskell/Guestfs.hs @@ -29,6 +29,7 @@ module Guestfs ( kill_subprocess, add_drive, add_cdrom, + add_drive_ro, config, set_qemu, set_path, @@ -78,7 +79,14 @@ module Guestfs ( cp, cp_a, mv, - ping_daemon + ping_daemon, + zerofree, + pvresize, + resize2fs, + e2fsck_f, + scrub_device, + scrub_file, + scrub_freespace ) where import Foreign import Foreign.C @@ -188,6 +196,18 @@ add_cdrom h filename = do fail err else return () +foreign import ccall unsafe "guestfs_add_drive_ro" c_add_drive_ro + :: GuestfsP -> CString -> IO (CInt) + +add_drive_ro :: GuestfsH -> String -> IO () +add_drive_ro h filename = do + r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive_ro p filename) + if (r == -1) + then do + err <- last_error h + fail err + else return () + foreign import ccall unsafe "guestfs_config" c_config :: GuestfsP -> CString -> CString -> IO (CInt) @@ -788,3 +808,87 @@ 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 () + +foreign import ccall unsafe "guestfs_pvresize" c_pvresize + :: GuestfsP -> CString -> IO (CInt) + +pvresize :: GuestfsH -> String -> IO () +pvresize h device = do + r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvresize p device) + if (r == -1) + then do + err <- last_error h + fail err + else return () + +foreign import ccall unsafe "guestfs_resize2fs" c_resize2fs + :: GuestfsP -> CString -> IO (CInt) + +resize2fs :: GuestfsH -> String -> IO () +resize2fs h device = do + r <- withCString device $ \device -> withForeignPtr h (\p -> c_resize2fs p device) + if (r == -1) + then do + err <- last_error h + fail err + else return () + +foreign import ccall unsafe "guestfs_e2fsck_f" c_e2fsck_f + :: GuestfsP -> CString -> IO (CInt) + +e2fsck_f :: GuestfsH -> String -> IO () +e2fsck_f h device = do + r <- withCString device $ \device -> withForeignPtr h (\p -> c_e2fsck_f p device) + if (r == -1) + then do + err <- last_error h + fail err + else return () + +foreign import ccall unsafe "guestfs_scrub_device" c_scrub_device + :: GuestfsP -> CString -> IO (CInt) + +scrub_device :: GuestfsH -> String -> IO () +scrub_device h device = do + r <- withCString device $ \device -> withForeignPtr h (\p -> c_scrub_device p device) + if (r == -1) + then do + err <- last_error h + fail err + else return () + +foreign import ccall unsafe "guestfs_scrub_file" c_scrub_file + :: GuestfsP -> CString -> IO (CInt) + +scrub_file :: GuestfsH -> String -> IO () +scrub_file h file = do + r <- withCString file $ \file -> withForeignPtr h (\p -> c_scrub_file p file) + if (r == -1) + then do + err <- last_error h + fail err + else return () + +foreign import ccall unsafe "guestfs_scrub_freespace" c_scrub_freespace + :: GuestfsP -> CString -> IO (CInt) + +scrub_freespace :: GuestfsH -> String -> IO () +scrub_freespace h dir = do + r <- withCString dir $ \dir -> withForeignPtr h (\p -> c_scrub_freespace p dir) + if (r == -1) + then do + err <- last_error h + fail err + else return () +