module Guestfs (
create,
+ test0,
launch,
wait_ready,
kill_subprocess,
set_qemu,
set_path,
set_append,
+ set_autosync,
+ set_verbose,
set_busy,
set_ready,
end_busy,
aug_init,
aug_close,
aug_set,
+ aug_insert,
aug_mv,
aug_save,
aug_load,
zerofree,
pvresize,
sfdisk_N,
+ vg_activate_all,
+ vg_activate,
lvresize,
resize2fs,
e2fsck_f,
then return "no error"
else peekCString str
+foreign import ccall unsafe "guestfs_test0" c_test0
+ :: GuestfsP -> CString -> CString -> Ptr CString -> CInt -> CInt -> CString -> CString -> IO (CInt)
+
+test0 :: GuestfsH -> String -> Maybe String -> [String] -> Bool -> Int -> String -> String -> IO ()
+test0 h str optstr strlist b integer filein fileout = do
+ r <- withCString str $ \str -> maybeWith withCString optstr $ \optstr -> withMany withCString strlist $ \strlist -> withArray0 nullPtr strlist $ \strlist -> withCString filein $ \filein -> withCString fileout $ \fileout -> withForeignPtr h (\p -> c_test0 p str optstr strlist (fromBool b) (fromIntegral integer) filein fileout)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_launch" c_launch
:: GuestfsP -> IO (CInt)
fail err
else return ()
+foreign import ccall unsafe "guestfs_set_autosync" c_set_autosync
+ :: GuestfsP -> CInt -> IO (CInt)
+
+set_autosync :: GuestfsH -> Bool -> IO ()
+set_autosync h autosync = do
+ r <- withForeignPtr h (\p -> c_set_autosync p (fromBool autosync))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
+foreign import ccall unsafe "guestfs_set_verbose" c_set_verbose
+ :: GuestfsP -> CInt -> IO (CInt)
+
+set_verbose :: GuestfsH -> Bool -> IO ()
+set_verbose h verbose = do
+ r <- withForeignPtr h (\p -> c_set_verbose p (fromBool verbose))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_set_busy" c_set_busy
:: GuestfsP -> IO (CInt)
fail err
else return ()
+foreign import ccall unsafe "guestfs_aug_insert" c_aug_insert
+ :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
+
+aug_insert :: GuestfsH -> String -> String -> Bool -> IO ()
+aug_insert h path label before = do
+ r <- withCString path $ \path -> withCString label $ \label -> withForeignPtr h (\p -> c_aug_insert p path label (fromBool before))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_aug_mv" c_aug_mv
:: GuestfsP -> CString -> CString -> IO (CInt)
fail err
else return ()
+foreign import ccall unsafe "guestfs_vg_activate_all" c_vg_activate_all
+ :: GuestfsP -> CInt -> IO (CInt)
+
+vg_activate_all :: GuestfsH -> Bool -> IO ()
+vg_activate_all h activate = do
+ r <- withForeignPtr h (\p -> c_vg_activate_all p (fromBool activate))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
+foreign import ccall unsafe "guestfs_vg_activate" c_vg_activate
+ :: GuestfsP -> CInt -> Ptr CString -> IO (CInt)
+
+vg_activate :: GuestfsH -> Bool -> [String] -> IO ()
+vg_activate h activate volgroups = do
+ r <- withMany withCString volgroups $ \volgroups -> withArray0 nullPtr volgroups $ \volgroups -> withForeignPtr h (\p -> c_vg_activate p (fromBool activate) volgroups)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_lvresize" c_lvresize
:: GuestfsP -> CString -> CInt -> IO (CInt)
* at the moment. Please help out!
*)
let can_generate style =
- let check_no_bad_args =
- List.for_all (function Bool _ -> false | _ -> true)
- in
match style with
- | RErr, args -> check_no_bad_args args
+ | RErr, _ -> true
| RBool _, _
| RInt _, _
| RInt64 _, _
let args =
List.map (
function
- | Bool n -> sprintf "(fromIntegral %s)" n
+ | Bool n -> sprintf "(fromBool %s)" n
| Int n -> sprintf "(fromIntegral %s)" n
| FileIn n | FileOut n | String n | OptString n | StringList n -> n
) (snd style) in