summaryrefslogtreecommitdiffstats
path: root/haskell/Guestfs.hs
diff options
context:
space:
mode:
Diffstat (limited to 'haskell/Guestfs.hs')
-rw-r--r--haskell/Guestfs.hs41
1 files changed, 40 insertions, 1 deletions
diff --git a/haskell/Guestfs.hs b/haskell/Guestfs.hs
index 32e7aedd..adf416f1 100644
--- a/haskell/Guestfs.hs
+++ b/haskell/Guestfs.hs
@@ -121,7 +121,10 @@ module Guestfs (
wc_w,
wc_c,
du,
- mount_loop
+ mount_loop,
+ mkswap,
+ mkswap_L,
+ mkswap_U
) where
import Foreign
import Foreign.C
@@ -1348,3 +1351,39 @@ mount_loop h file mountpoint = do
fail err
else return ()
+foreign import ccall unsafe "guestfs_mkswap" c_mkswap
+ :: GuestfsP -> CString -> IO (CInt)
+
+mkswap :: GuestfsH -> String -> IO ()
+mkswap h device = do
+ r <- withCString device $ \device -> withForeignPtr h (\p -> c_mkswap p device)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
+foreign import ccall unsafe "guestfs_mkswap_L" c_mkswap_L
+ :: GuestfsP -> CString -> CString -> IO (CInt)
+
+mkswap_L :: GuestfsH -> String -> String -> IO ()
+mkswap_L h label device = do
+ r <- withCString label $ \label -> withCString device $ \device -> withForeignPtr h (\p -> c_mkswap_L p label device)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
+foreign import ccall unsafe "guestfs_mkswap_U" c_mkswap_U
+ :: GuestfsP -> CString -> CString -> IO (CInt)
+
+mkswap_U :: GuestfsH -> String -> String -> IO ()
+mkswap_U h uuid device = do
+ r <- withCString uuid $ \uuid -> withCString device $ \device -> withForeignPtr h (\p -> c_mkswap_U p uuid device)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+