set_busy,
set_ready,
end_busy,
+ set_memsize,
+ get_memsize,
mount,
sync,
touch,
ntfs_3g_probe,
scrub_device,
scrub_file,
- scrub_freespace
+ scrub_freespace,
+ wc_l,
+ wc_w,
+ wc_c,
+ du,
+ mount_loop,
+ mkswap,
+ mkswap_L,
+ mkswap_U
) where
import Foreign
import Foreign.C
fail err
else return ()
+foreign import ccall unsafe "guestfs_set_memsize" c_set_memsize
+ :: GuestfsP -> CInt -> IO (CInt)
+
+set_memsize :: GuestfsH -> Int -> IO ()
+set_memsize h memsize = do
+ r <- withForeignPtr h (\p -> c_set_memsize p (fromIntegral memsize))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
+foreign import ccall unsafe "guestfs_get_memsize" c_get_memsize
+ :: GuestfsP -> IO (CInt)
+
+get_memsize :: GuestfsH -> IO (Int)
+get_memsize h = do
+ r <- withForeignPtr h (\p -> c_get_memsize p)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return (fromIntegral r)
+
foreign import ccall unsafe "guestfs_mount" c_mount
:: GuestfsP -> CString -> CString -> IO (CInt)
:: 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
fail err
else return ()
+foreign import ccall unsafe "guestfs_wc_l" c_wc_l
+ :: GuestfsP -> CString -> IO (CInt)
+
+wc_l :: GuestfsH -> String -> IO (Int)
+wc_l h path = do
+ r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_l p path)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return (fromIntegral r)
+
+foreign import ccall unsafe "guestfs_wc_w" c_wc_w
+ :: GuestfsP -> CString -> IO (CInt)
+
+wc_w :: GuestfsH -> String -> IO (Int)
+wc_w h path = do
+ r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_w p path)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return (fromIntegral r)
+
+foreign import ccall unsafe "guestfs_wc_c" c_wc_c
+ :: GuestfsP -> CString -> IO (CInt)
+
+wc_c :: GuestfsH -> String -> IO (Int)
+wc_c h path = do
+ r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_c p path)
+ if (r == -1)
+ then do
+ err <- last_error h
+ 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)
+
+foreign import ccall unsafe "guestfs_mount_loop" c_mount_loop
+ :: GuestfsP -> CString -> CString -> IO (CInt)
+
+mount_loop :: GuestfsH -> String -> String -> IO ()
+mount_loop h file mountpoint = do
+ r <- withCString file $ \file -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_loop p file mountpoint)
+ if (r == -1)
+ then do
+ err <- last_error h
+ 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 ()
+