1 {- libguestfs generated file
2 WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3 ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
5 Copyright (C) 2009 Red Hat Inc.
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 {-# INCLUDE <guestfs.h> #-}
23 {-# LANGUAGE ForeignFunctionInterface #-}
131 import Foreign.C.Types
133 import Control.Exception
136 data GuestfsS = GuestfsS -- represents the opaque C struct
137 type GuestfsP = Ptr GuestfsS -- guestfs_h *
138 type GuestfsH = ForeignPtr GuestfsS -- guestfs_h * with attached finalizer
140 -- XXX define properly later XXX
144 data IntBool = IntBool
146 data StatVFS = StatVFS
147 data Hashtable = Hashtable
149 foreign import ccall unsafe "guestfs_create" c_create
151 foreign import ccall unsafe "&guestfs_close" c_close
152 :: FunPtr (GuestfsP -> IO ())
153 foreign import ccall unsafe "guestfs_set_error_handler" c_set_error_handler
154 :: GuestfsP -> Ptr CInt -> Ptr CInt -> IO ()
156 create :: IO GuestfsH
159 c_set_error_handler p nullPtr nullPtr
160 h <- newForeignPtr c_close p
163 foreign import ccall unsafe "guestfs_last_error" c_last_error
164 :: GuestfsP -> IO CString
166 -- last_error :: GuestfsH -> IO (Maybe String)
168 -- str <- withForeignPtr h (\p -> c_last_error p)
169 -- maybePeek peekCString str
171 last_error :: GuestfsH -> IO (String)
173 str <- withForeignPtr h (\p -> c_last_error p)
175 then return "no error"
178 foreign import ccall unsafe "guestfs_test0" c_test0
179 :: GuestfsP -> CString -> CString -> Ptr CString -> CInt -> CInt -> CString -> CString -> IO (CInt)
181 test0 :: GuestfsH -> String -> Maybe String -> [String] -> Bool -> Int -> String -> String -> IO ()
182 test0 h str optstr strlist b integer filein fileout = do
183 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)
190 foreign import ccall unsafe "guestfs_test0rint" c_test0rint
191 :: GuestfsP -> CString -> IO (CInt)
193 test0rint :: GuestfsH -> String -> IO (Int)
195 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint p val)
200 else return (fromIntegral r)
202 foreign import ccall unsafe "guestfs_test0rinterr" c_test0rinterr
203 :: GuestfsP -> IO (CInt)
205 test0rinterr :: GuestfsH -> IO (Int)
207 r <- withForeignPtr h (\p -> c_test0rinterr p)
212 else return (fromIntegral r)
214 foreign import ccall unsafe "guestfs_test0rint64" c_test0rint64
215 :: GuestfsP -> CString -> IO (Int64)
217 test0rint64 :: GuestfsH -> String -> IO (Integer)
218 test0rint64 h val = do
219 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint64 p val)
224 else return (fromIntegral r)
226 foreign import ccall unsafe "guestfs_test0rint64err" c_test0rint64err
227 :: GuestfsP -> IO (Int64)
229 test0rint64err :: GuestfsH -> IO (Integer)
230 test0rint64err h = do
231 r <- withForeignPtr h (\p -> c_test0rint64err p)
236 else return (fromIntegral r)
238 foreign import ccall unsafe "guestfs_launch" c_launch
239 :: GuestfsP -> IO (CInt)
241 launch :: GuestfsH -> IO ()
243 r <- withForeignPtr h (\p -> c_launch p)
250 foreign import ccall unsafe "guestfs_wait_ready" c_wait_ready
251 :: GuestfsP -> IO (CInt)
253 wait_ready :: GuestfsH -> IO ()
255 r <- withForeignPtr h (\p -> c_wait_ready p)
262 foreign import ccall unsafe "guestfs_kill_subprocess" c_kill_subprocess
263 :: GuestfsP -> IO (CInt)
265 kill_subprocess :: GuestfsH -> IO ()
266 kill_subprocess h = do
267 r <- withForeignPtr h (\p -> c_kill_subprocess p)
274 foreign import ccall unsafe "guestfs_add_drive" c_add_drive
275 :: GuestfsP -> CString -> IO (CInt)
277 add_drive :: GuestfsH -> String -> IO ()
278 add_drive h filename = do
279 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive p filename)
286 foreign import ccall unsafe "guestfs_add_cdrom" c_add_cdrom
287 :: GuestfsP -> CString -> IO (CInt)
289 add_cdrom :: GuestfsH -> String -> IO ()
290 add_cdrom h filename = do
291 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_cdrom p filename)
298 foreign import ccall unsafe "guestfs_add_drive_ro" c_add_drive_ro
299 :: GuestfsP -> CString -> IO (CInt)
301 add_drive_ro :: GuestfsH -> String -> IO ()
302 add_drive_ro h filename = do
303 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive_ro p filename)
310 foreign import ccall unsafe "guestfs_config" c_config
311 :: GuestfsP -> CString -> CString -> IO (CInt)
313 config :: GuestfsH -> String -> Maybe String -> IO ()
314 config h qemuparam qemuvalue = do
315 r <- withCString qemuparam $ \qemuparam -> maybeWith withCString qemuvalue $ \qemuvalue -> withForeignPtr h (\p -> c_config p qemuparam qemuvalue)
322 foreign import ccall unsafe "guestfs_set_qemu" c_set_qemu
323 :: GuestfsP -> CString -> IO (CInt)
325 set_qemu :: GuestfsH -> String -> IO ()
327 r <- withCString qemu $ \qemu -> withForeignPtr h (\p -> c_set_qemu p qemu)
334 foreign import ccall unsafe "guestfs_set_path" c_set_path
335 :: GuestfsP -> CString -> IO (CInt)
337 set_path :: GuestfsH -> String -> IO ()
339 r <- withCString path $ \path -> withForeignPtr h (\p -> c_set_path p path)
346 foreign import ccall unsafe "guestfs_set_append" c_set_append
347 :: GuestfsP -> CString -> IO (CInt)
349 set_append :: GuestfsH -> String -> IO ()
350 set_append h append = do
351 r <- withCString append $ \append -> withForeignPtr h (\p -> c_set_append p append)
358 foreign import ccall unsafe "guestfs_set_autosync" c_set_autosync
359 :: GuestfsP -> CInt -> IO (CInt)
361 set_autosync :: GuestfsH -> Bool -> IO ()
362 set_autosync h autosync = do
363 r <- withForeignPtr h (\p -> c_set_autosync p (fromBool autosync))
370 foreign import ccall unsafe "guestfs_set_verbose" c_set_verbose
371 :: GuestfsP -> CInt -> IO (CInt)
373 set_verbose :: GuestfsH -> Bool -> IO ()
374 set_verbose h verbose = do
375 r <- withForeignPtr h (\p -> c_set_verbose p (fromBool verbose))
382 foreign import ccall unsafe "guestfs_get_state" c_get_state
383 :: GuestfsP -> IO (CInt)
385 get_state :: GuestfsH -> IO (Int)
387 r <- withForeignPtr h (\p -> c_get_state p)
392 else return (fromIntegral r)
394 foreign import ccall unsafe "guestfs_set_busy" c_set_busy
395 :: GuestfsP -> IO (CInt)
397 set_busy :: GuestfsH -> IO ()
399 r <- withForeignPtr h (\p -> c_set_busy p)
406 foreign import ccall unsafe "guestfs_set_ready" c_set_ready
407 :: GuestfsP -> IO (CInt)
409 set_ready :: GuestfsH -> IO ()
411 r <- withForeignPtr h (\p -> c_set_ready p)
418 foreign import ccall unsafe "guestfs_end_busy" c_end_busy
419 :: GuestfsP -> IO (CInt)
421 end_busy :: GuestfsH -> IO ()
423 r <- withForeignPtr h (\p -> c_end_busy p)
430 foreign import ccall unsafe "guestfs_mount" c_mount
431 :: GuestfsP -> CString -> CString -> IO (CInt)
433 mount :: GuestfsH -> String -> String -> IO ()
434 mount h device mountpoint = do
435 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount p device mountpoint)
442 foreign import ccall unsafe "guestfs_sync" c_sync
443 :: GuestfsP -> IO (CInt)
445 sync :: GuestfsH -> IO ()
447 r <- withForeignPtr h (\p -> c_sync p)
454 foreign import ccall unsafe "guestfs_touch" c_touch
455 :: GuestfsP -> CString -> IO (CInt)
457 touch :: GuestfsH -> String -> IO ()
459 r <- withCString path $ \path -> withForeignPtr h (\p -> c_touch p path)
466 foreign import ccall unsafe "guestfs_aug_init" c_aug_init
467 :: GuestfsP -> CString -> CInt -> IO (CInt)
469 aug_init :: GuestfsH -> String -> Int -> IO ()
470 aug_init h root flags = do
471 r <- withCString root $ \root -> withForeignPtr h (\p -> c_aug_init p root (fromIntegral flags))
478 foreign import ccall unsafe "guestfs_aug_close" c_aug_close
479 :: GuestfsP -> IO (CInt)
481 aug_close :: GuestfsH -> IO ()
483 r <- withForeignPtr h (\p -> c_aug_close p)
490 foreign import ccall unsafe "guestfs_aug_defvar" c_aug_defvar
491 :: GuestfsP -> CString -> CString -> IO (CInt)
493 aug_defvar :: GuestfsH -> String -> Maybe String -> IO (Int)
494 aug_defvar h name expr = do
495 r <- withCString name $ \name -> maybeWith withCString expr $ \expr -> withForeignPtr h (\p -> c_aug_defvar p name expr)
500 else return (fromIntegral r)
502 foreign import ccall unsafe "guestfs_aug_set" c_aug_set
503 :: GuestfsP -> CString -> CString -> IO (CInt)
505 aug_set :: GuestfsH -> String -> String -> IO ()
506 aug_set h path val = do
507 r <- withCString path $ \path -> withCString val $ \val -> withForeignPtr h (\p -> c_aug_set p path val)
514 foreign import ccall unsafe "guestfs_aug_insert" c_aug_insert
515 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
517 aug_insert :: GuestfsH -> String -> String -> Bool -> IO ()
518 aug_insert h path label before = do
519 r <- withCString path $ \path -> withCString label $ \label -> withForeignPtr h (\p -> c_aug_insert p path label (fromBool before))
526 foreign import ccall unsafe "guestfs_aug_rm" c_aug_rm
527 :: GuestfsP -> CString -> IO (CInt)
529 aug_rm :: GuestfsH -> String -> IO (Int)
531 r <- withCString path $ \path -> withForeignPtr h (\p -> c_aug_rm p path)
536 else return (fromIntegral r)
538 foreign import ccall unsafe "guestfs_aug_mv" c_aug_mv
539 :: GuestfsP -> CString -> CString -> IO (CInt)
541 aug_mv :: GuestfsH -> String -> String -> IO ()
542 aug_mv h src dest = do
543 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_aug_mv p src dest)
550 foreign import ccall unsafe "guestfs_aug_save" c_aug_save
551 :: GuestfsP -> IO (CInt)
553 aug_save :: GuestfsH -> IO ()
555 r <- withForeignPtr h (\p -> c_aug_save p)
562 foreign import ccall unsafe "guestfs_aug_load" c_aug_load
563 :: GuestfsP -> IO (CInt)
565 aug_load :: GuestfsH -> IO ()
567 r <- withForeignPtr h (\p -> c_aug_load p)
574 foreign import ccall unsafe "guestfs_rm" c_rm
575 :: GuestfsP -> CString -> IO (CInt)
577 rm :: GuestfsH -> String -> IO ()
579 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm p path)
586 foreign import ccall unsafe "guestfs_rmdir" c_rmdir
587 :: GuestfsP -> CString -> IO (CInt)
589 rmdir :: GuestfsH -> String -> IO ()
591 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rmdir p path)
598 foreign import ccall unsafe "guestfs_rm_rf" c_rm_rf
599 :: GuestfsP -> CString -> IO (CInt)
601 rm_rf :: GuestfsH -> String -> IO ()
603 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm_rf p path)
610 foreign import ccall unsafe "guestfs_mkdir" c_mkdir
611 :: GuestfsP -> CString -> IO (CInt)
613 mkdir :: GuestfsH -> String -> IO ()
615 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir p path)
622 foreign import ccall unsafe "guestfs_mkdir_p" c_mkdir_p
623 :: GuestfsP -> CString -> IO (CInt)
625 mkdir_p :: GuestfsH -> String -> IO ()
627 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir_p p path)
634 foreign import ccall unsafe "guestfs_chmod" c_chmod
635 :: GuestfsP -> CInt -> CString -> IO (CInt)
637 chmod :: GuestfsH -> Int -> String -> IO ()
638 chmod h mode path = do
639 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chmod p (fromIntegral mode) path)
646 foreign import ccall unsafe "guestfs_chown" c_chown
647 :: GuestfsP -> CInt -> CInt -> CString -> IO (CInt)
649 chown :: GuestfsH -> Int -> Int -> String -> IO ()
650 chown h owner group path = do
651 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chown p (fromIntegral owner) (fromIntegral group) path)
658 foreign import ccall unsafe "guestfs_pvcreate" c_pvcreate
659 :: GuestfsP -> CString -> IO (CInt)
661 pvcreate :: GuestfsH -> String -> IO ()
662 pvcreate h device = do
663 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvcreate p device)
670 foreign import ccall unsafe "guestfs_vgcreate" c_vgcreate
671 :: GuestfsP -> CString -> Ptr CString -> IO (CInt)
673 vgcreate :: GuestfsH -> String -> [String] -> IO ()
674 vgcreate h volgroup physvols = do
675 r <- withCString volgroup $ \volgroup -> withMany withCString physvols $ \physvols -> withArray0 nullPtr physvols $ \physvols -> withForeignPtr h (\p -> c_vgcreate p volgroup physvols)
682 foreign import ccall unsafe "guestfs_lvcreate" c_lvcreate
683 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
685 lvcreate :: GuestfsH -> String -> String -> Int -> IO ()
686 lvcreate h logvol volgroup mbytes = do
687 r <- withCString logvol $ \logvol -> withCString volgroup $ \volgroup -> withForeignPtr h (\p -> c_lvcreate p logvol volgroup (fromIntegral mbytes))
694 foreign import ccall unsafe "guestfs_mkfs" c_mkfs
695 :: GuestfsP -> CString -> CString -> IO (CInt)
697 mkfs :: GuestfsH -> String -> String -> IO ()
698 mkfs h fstype device = do
699 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_mkfs p fstype device)
706 foreign import ccall unsafe "guestfs_sfdisk" c_sfdisk
707 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> Ptr CString -> IO (CInt)
709 sfdisk :: GuestfsH -> String -> Int -> Int -> Int -> [String] -> IO ()
710 sfdisk h device cyls heads sectors lines = do
711 r <- withCString device $ \device -> withMany withCString lines $ \lines -> withArray0 nullPtr lines $ \lines -> withForeignPtr h (\p -> c_sfdisk p device (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) lines)
718 foreign import ccall unsafe "guestfs_write_file" c_write_file
719 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
721 write_file :: GuestfsH -> String -> String -> Int -> IO ()
722 write_file h path content size = do
723 r <- withCString path $ \path -> withCString content $ \content -> withForeignPtr h (\p -> c_write_file p path content (fromIntegral size))
730 foreign import ccall unsafe "guestfs_umount" c_umount
731 :: GuestfsP -> CString -> IO (CInt)
733 umount :: GuestfsH -> String -> IO ()
734 umount h pathordevice = do
735 r <- withCString pathordevice $ \pathordevice -> withForeignPtr h (\p -> c_umount p pathordevice)
742 foreign import ccall unsafe "guestfs_umount_all" c_umount_all
743 :: GuestfsP -> IO (CInt)
745 umount_all :: GuestfsH -> IO ()
747 r <- withForeignPtr h (\p -> c_umount_all p)
754 foreign import ccall unsafe "guestfs_lvm_remove_all" c_lvm_remove_all
755 :: GuestfsP -> IO (CInt)
757 lvm_remove_all :: GuestfsH -> IO ()
758 lvm_remove_all h = do
759 r <- withForeignPtr h (\p -> c_lvm_remove_all p)
766 foreign import ccall unsafe "guestfs_blockdev_setro" c_blockdev_setro
767 :: GuestfsP -> CString -> IO (CInt)
769 blockdev_setro :: GuestfsH -> String -> IO ()
770 blockdev_setro h device = do
771 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setro p device)
778 foreign import ccall unsafe "guestfs_blockdev_setrw" c_blockdev_setrw
779 :: GuestfsP -> CString -> IO (CInt)
781 blockdev_setrw :: GuestfsH -> String -> IO ()
782 blockdev_setrw h device = do
783 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setrw p device)
790 foreign import ccall unsafe "guestfs_blockdev_getss" c_blockdev_getss
791 :: GuestfsP -> CString -> IO (CInt)
793 blockdev_getss :: GuestfsH -> String -> IO (Int)
794 blockdev_getss h device = do
795 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getss p device)
800 else return (fromIntegral r)
802 foreign import ccall unsafe "guestfs_blockdev_getbsz" c_blockdev_getbsz
803 :: GuestfsP -> CString -> IO (CInt)
805 blockdev_getbsz :: GuestfsH -> String -> IO (Int)
806 blockdev_getbsz h device = do
807 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getbsz p device)
812 else return (fromIntegral r)
814 foreign import ccall unsafe "guestfs_blockdev_setbsz" c_blockdev_setbsz
815 :: GuestfsP -> CString -> CInt -> IO (CInt)
817 blockdev_setbsz :: GuestfsH -> String -> Int -> IO ()
818 blockdev_setbsz h device blocksize = do
819 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setbsz p device (fromIntegral blocksize))
826 foreign import ccall unsafe "guestfs_blockdev_getsz" c_blockdev_getsz
827 :: GuestfsP -> CString -> IO (Int64)
829 blockdev_getsz :: GuestfsH -> String -> IO (Integer)
830 blockdev_getsz h device = do
831 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsz p device)
836 else return (fromIntegral r)
838 foreign import ccall unsafe "guestfs_blockdev_getsize64" c_blockdev_getsize64
839 :: GuestfsP -> CString -> IO (Int64)
841 blockdev_getsize64 :: GuestfsH -> String -> IO (Integer)
842 blockdev_getsize64 h device = do
843 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsize64 p device)
848 else return (fromIntegral r)
850 foreign import ccall unsafe "guestfs_blockdev_flushbufs" c_blockdev_flushbufs
851 :: GuestfsP -> CString -> IO (CInt)
853 blockdev_flushbufs :: GuestfsH -> String -> IO ()
854 blockdev_flushbufs h device = do
855 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_flushbufs p device)
862 foreign import ccall unsafe "guestfs_blockdev_rereadpt" c_blockdev_rereadpt
863 :: GuestfsP -> CString -> IO (CInt)
865 blockdev_rereadpt :: GuestfsH -> String -> IO ()
866 blockdev_rereadpt h device = do
867 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_rereadpt p device)
874 foreign import ccall unsafe "guestfs_upload" c_upload
875 :: GuestfsP -> CString -> CString -> IO (CInt)
877 upload :: GuestfsH -> String -> String -> IO ()
878 upload h filename remotefilename = do
879 r <- withCString filename $ \filename -> withCString remotefilename $ \remotefilename -> withForeignPtr h (\p -> c_upload p filename remotefilename)
886 foreign import ccall unsafe "guestfs_download" c_download
887 :: GuestfsP -> CString -> CString -> IO (CInt)
889 download :: GuestfsH -> String -> String -> IO ()
890 download h remotefilename filename = do
891 r <- withCString remotefilename $ \remotefilename -> withCString filename $ \filename -> withForeignPtr h (\p -> c_download p remotefilename filename)
898 foreign import ccall unsafe "guestfs_tar_in" c_tar_in
899 :: GuestfsP -> CString -> CString -> IO (CInt)
901 tar_in :: GuestfsH -> String -> String -> IO ()
902 tar_in h tarfile directory = do
903 r <- withCString tarfile $ \tarfile -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tar_in p tarfile directory)
910 foreign import ccall unsafe "guestfs_tar_out" c_tar_out
911 :: GuestfsP -> CString -> CString -> IO (CInt)
913 tar_out :: GuestfsH -> String -> String -> IO ()
914 tar_out h directory tarfile = do
915 r <- withCString directory $ \directory -> withCString tarfile $ \tarfile -> withForeignPtr h (\p -> c_tar_out p directory tarfile)
922 foreign import ccall unsafe "guestfs_tgz_in" c_tgz_in
923 :: GuestfsP -> CString -> CString -> IO (CInt)
925 tgz_in :: GuestfsH -> String -> String -> IO ()
926 tgz_in h tarball directory = do
927 r <- withCString tarball $ \tarball -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tgz_in p tarball directory)
934 foreign import ccall unsafe "guestfs_tgz_out" c_tgz_out
935 :: GuestfsP -> CString -> CString -> IO (CInt)
937 tgz_out :: GuestfsH -> String -> String -> IO ()
938 tgz_out h directory tarball = do
939 r <- withCString directory $ \directory -> withCString tarball $ \tarball -> withForeignPtr h (\p -> c_tgz_out p directory tarball)
946 foreign import ccall unsafe "guestfs_mount_ro" c_mount_ro
947 :: GuestfsP -> CString -> CString -> IO (CInt)
949 mount_ro :: GuestfsH -> String -> String -> IO ()
950 mount_ro h device mountpoint = do
951 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_ro p device mountpoint)
958 foreign import ccall unsafe "guestfs_mount_options" c_mount_options
959 :: GuestfsP -> CString -> CString -> CString -> IO (CInt)
961 mount_options :: GuestfsH -> String -> String -> String -> IO ()
962 mount_options h options device mountpoint = do
963 r <- withCString options $ \options -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_options p options device mountpoint)
970 foreign import ccall unsafe "guestfs_mount_vfs" c_mount_vfs
971 :: GuestfsP -> CString -> CString -> CString -> CString -> IO (CInt)
973 mount_vfs :: GuestfsH -> String -> String -> String -> String -> IO ()
974 mount_vfs h options vfstype device mountpoint = do
975 r <- withCString options $ \options -> withCString vfstype $ \vfstype -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_vfs p options vfstype device mountpoint)
982 foreign import ccall unsafe "guestfs_lvremove" c_lvremove
983 :: GuestfsP -> CString -> IO (CInt)
985 lvremove :: GuestfsH -> String -> IO ()
986 lvremove h device = do
987 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvremove p device)
994 foreign import ccall unsafe "guestfs_vgremove" c_vgremove
995 :: GuestfsP -> CString -> IO (CInt)
997 vgremove :: GuestfsH -> String -> IO ()
998 vgremove h vgname = do
999 r <- withCString vgname $ \vgname -> withForeignPtr h (\p -> c_vgremove p vgname)
1006 foreign import ccall unsafe "guestfs_pvremove" c_pvremove
1007 :: GuestfsP -> CString -> IO (CInt)
1009 pvremove :: GuestfsH -> String -> IO ()
1010 pvremove h device = do
1011 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvremove p device)
1018 foreign import ccall unsafe "guestfs_set_e2label" c_set_e2label
1019 :: GuestfsP -> CString -> CString -> IO (CInt)
1021 set_e2label :: GuestfsH -> String -> String -> IO ()
1022 set_e2label h device label = do
1023 r <- withCString device $ \device -> withCString label $ \label -> withForeignPtr h (\p -> c_set_e2label p device label)
1030 foreign import ccall unsafe "guestfs_set_e2uuid" c_set_e2uuid
1031 :: GuestfsP -> CString -> CString -> IO (CInt)
1033 set_e2uuid :: GuestfsH -> String -> String -> IO ()
1034 set_e2uuid h device uuid = do
1035 r <- withCString device $ \device -> withCString uuid $ \uuid -> withForeignPtr h (\p -> c_set_e2uuid p device uuid)
1042 foreign import ccall unsafe "guestfs_fsck" c_fsck
1043 :: GuestfsP -> CString -> CString -> IO (CInt)
1045 fsck :: GuestfsH -> String -> String -> IO (Int)
1046 fsck h fstype device = do
1047 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_fsck p fstype device)
1052 else return (fromIntegral r)
1054 foreign import ccall unsafe "guestfs_zero" c_zero
1055 :: GuestfsP -> CString -> IO (CInt)
1057 zero :: GuestfsH -> String -> IO ()
1059 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zero p device)
1066 foreign import ccall unsafe "guestfs_grub_install" c_grub_install
1067 :: GuestfsP -> CString -> CString -> IO (CInt)
1069 grub_install :: GuestfsH -> String -> String -> IO ()
1070 grub_install h root device = do
1071 r <- withCString root $ \root -> withCString device $ \device -> withForeignPtr h (\p -> c_grub_install p root device)
1078 foreign import ccall unsafe "guestfs_cp" c_cp
1079 :: GuestfsP -> CString -> CString -> IO (CInt)
1081 cp :: GuestfsH -> String -> String -> IO ()
1083 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp p src dest)
1090 foreign import ccall unsafe "guestfs_cp_a" c_cp_a
1091 :: GuestfsP -> CString -> CString -> IO (CInt)
1093 cp_a :: GuestfsH -> String -> String -> IO ()
1094 cp_a h src dest = do
1095 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp_a p src dest)
1102 foreign import ccall unsafe "guestfs_mv" c_mv
1103 :: GuestfsP -> CString -> CString -> IO (CInt)
1105 mv :: GuestfsH -> String -> String -> IO ()
1107 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_mv p src dest)
1114 foreign import ccall unsafe "guestfs_drop_caches" c_drop_caches
1115 :: GuestfsP -> CInt -> IO (CInt)
1117 drop_caches :: GuestfsH -> Int -> IO ()
1118 drop_caches h whattodrop = do
1119 r <- withForeignPtr h (\p -> c_drop_caches p (fromIntegral whattodrop))
1126 foreign import ccall unsafe "guestfs_ping_daemon" c_ping_daemon
1127 :: GuestfsP -> IO (CInt)
1129 ping_daemon :: GuestfsH -> IO ()
1131 r <- withForeignPtr h (\p -> c_ping_daemon p)
1138 foreign import ccall unsafe "guestfs_zerofree" c_zerofree
1139 :: GuestfsP -> CString -> IO (CInt)
1141 zerofree :: GuestfsH -> String -> IO ()
1142 zerofree h device = do
1143 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zerofree p device)
1150 foreign import ccall unsafe "guestfs_pvresize" c_pvresize
1151 :: GuestfsP -> CString -> IO (CInt)
1153 pvresize :: GuestfsH -> String -> IO ()
1154 pvresize h device = do
1155 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvresize p device)
1162 foreign import ccall unsafe "guestfs_sfdisk_N" c_sfdisk_N
1163 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (CInt)
1165 sfdisk_N :: GuestfsH -> String -> Int -> Int -> Int -> Int -> String -> IO ()
1166 sfdisk_N h device partnum cyls heads sectors line = do
1167 r <- withCString device $ \device -> withCString line $ \line -> withForeignPtr h (\p -> c_sfdisk_N p device (fromIntegral partnum) (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) line)
1174 foreign import ccall unsafe "guestfs_vg_activate_all" c_vg_activate_all
1175 :: GuestfsP -> CInt -> IO (CInt)
1177 vg_activate_all :: GuestfsH -> Bool -> IO ()
1178 vg_activate_all h activate = do
1179 r <- withForeignPtr h (\p -> c_vg_activate_all p (fromBool activate))
1186 foreign import ccall unsafe "guestfs_vg_activate" c_vg_activate
1187 :: GuestfsP -> CInt -> Ptr CString -> IO (CInt)
1189 vg_activate :: GuestfsH -> Bool -> [String] -> IO ()
1190 vg_activate h activate volgroups = do
1191 r <- withMany withCString volgroups $ \volgroups -> withArray0 nullPtr volgroups $ \volgroups -> withForeignPtr h (\p -> c_vg_activate p (fromBool activate) volgroups)
1198 foreign import ccall unsafe "guestfs_lvresize" c_lvresize
1199 :: GuestfsP -> CString -> CInt -> IO (CInt)
1201 lvresize :: GuestfsH -> String -> Int -> IO ()
1202 lvresize h device mbytes = do
1203 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvresize p device (fromIntegral mbytes))
1210 foreign import ccall unsafe "guestfs_resize2fs" c_resize2fs
1211 :: GuestfsP -> CString -> IO (CInt)
1213 resize2fs :: GuestfsH -> String -> IO ()
1214 resize2fs h device = do
1215 r <- withCString device $ \device -> withForeignPtr h (\p -> c_resize2fs p device)
1222 foreign import ccall unsafe "guestfs_e2fsck_f" c_e2fsck_f
1223 :: GuestfsP -> CString -> IO (CInt)
1225 e2fsck_f :: GuestfsH -> String -> IO ()
1226 e2fsck_f h device = do
1227 r <- withCString device $ \device -> withForeignPtr h (\p -> c_e2fsck_f p device)
1234 foreign import ccall unsafe "guestfs_sleep" c_sleep
1235 :: GuestfsP -> CInt -> IO (CInt)
1237 sleep :: GuestfsH -> Int -> IO ()
1239 r <- withForeignPtr h (\p -> c_sleep p (fromIntegral secs))
1246 foreign import ccall unsafe "guestfs_ntfs_3g_probe" c_ntfs_3g_probe
1247 :: GuestfsP -> CInt -> CString -> IO (CInt)
1249 ntfs_3g_probe :: GuestfsH -> Bool -> String -> IO (Int)
1250 ntfs_3g_probe h rw device = do
1251 r <- withCString device $ \device -> withForeignPtr h (\p -> c_ntfs_3g_probe p (fromBool rw) device)
1256 else return (fromIntegral r)
1258 foreign import ccall unsafe "guestfs_scrub_device" c_scrub_device
1259 :: GuestfsP -> CString -> IO (CInt)
1261 scrub_device :: GuestfsH -> String -> IO ()
1262 scrub_device h device = do
1263 r <- withCString device $ \device -> withForeignPtr h (\p -> c_scrub_device p device)
1270 foreign import ccall unsafe "guestfs_scrub_file" c_scrub_file
1271 :: GuestfsP -> CString -> IO (CInt)
1273 scrub_file :: GuestfsH -> String -> IO ()
1274 scrub_file h file = do
1275 r <- withCString file $ \file -> withForeignPtr h (\p -> c_scrub_file p file)
1282 foreign import ccall unsafe "guestfs_scrub_freespace" c_scrub_freespace
1283 :: GuestfsP -> CString -> IO (CInt)
1285 scrub_freespace :: GuestfsH -> String -> IO ()
1286 scrub_freespace h dir = do
1287 r <- withCString dir $ \dir -> withForeignPtr h (\p -> c_scrub_freespace p dir)
1294 foreign import ccall unsafe "guestfs_wc_l" c_wc_l
1295 :: GuestfsP -> CString -> IO (CInt)
1297 wc_l :: GuestfsH -> String -> IO (Int)
1299 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_l p path)
1304 else return (fromIntegral r)
1306 foreign import ccall unsafe "guestfs_wc_w" c_wc_w
1307 :: GuestfsP -> CString -> IO (CInt)
1309 wc_w :: GuestfsH -> String -> IO (Int)
1311 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_w p path)
1316 else return (fromIntegral r)
1318 foreign import ccall unsafe "guestfs_wc_c" c_wc_c
1319 :: GuestfsP -> CString -> IO (CInt)
1321 wc_c :: GuestfsH -> String -> IO (Int)
1323 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_c p path)
1328 else return (fromIntegral r)
1330 foreign import ccall unsafe "guestfs_du" c_du
1331 :: GuestfsP -> CString -> IO (Int64)
1333 du :: GuestfsH -> String -> IO (Integer)
1335 r <- withCString path $ \path -> withForeignPtr h (\p -> c_du p path)
1340 else return (fromIntegral r)
1342 foreign import ccall unsafe "guestfs_mount_loop" c_mount_loop
1343 :: GuestfsP -> CString -> CString -> IO (CInt)
1345 mount_loop :: GuestfsH -> String -> String -> IO ()
1346 mount_loop h file mountpoint = do
1347 r <- withCString file $ \file -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_loop p file mountpoint)
1354 foreign import ccall unsafe "guestfs_mkswap" c_mkswap
1355 :: GuestfsP -> CString -> IO (CInt)
1357 mkswap :: GuestfsH -> String -> IO ()
1358 mkswap h device = do
1359 r <- withCString device $ \device -> withForeignPtr h (\p -> c_mkswap p device)
1366 foreign import ccall unsafe "guestfs_mkswap_L" c_mkswap_L
1367 :: GuestfsP -> CString -> CString -> IO (CInt)
1369 mkswap_L :: GuestfsH -> String -> String -> IO ()
1370 mkswap_L h label device = do
1371 r <- withCString label $ \label -> withCString device $ \device -> withForeignPtr h (\p -> c_mkswap_L p label device)
1378 foreign import ccall unsafe "guestfs_mkswap_U" c_mkswap_U
1379 :: GuestfsP -> CString -> CString -> IO (CInt)
1381 mkswap_U :: GuestfsH -> String -> String -> IO ()
1382 mkswap_U h uuid device = do
1383 r <- withCString uuid $ \uuid -> withCString device $ \device -> withForeignPtr h (\p -> c_mkswap_U p uuid device)