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 #-}
123 import Foreign.C.Types
125 import Control.Exception
128 data GuestfsS = GuestfsS -- represents the opaque C struct
129 type GuestfsP = Ptr GuestfsS -- guestfs_h *
130 type GuestfsH = ForeignPtr GuestfsS -- guestfs_h * with attached finalizer
132 -- XXX define properly later XXX
136 data IntBool = IntBool
138 data StatVFS = StatVFS
139 data Hashtable = Hashtable
141 foreign import ccall unsafe "guestfs_create" c_create
143 foreign import ccall unsafe "&guestfs_close" c_close
144 :: FunPtr (GuestfsP -> IO ())
145 foreign import ccall unsafe "guestfs_set_error_handler" c_set_error_handler
146 :: GuestfsP -> Ptr CInt -> Ptr CInt -> IO ()
148 create :: IO GuestfsH
151 c_set_error_handler p nullPtr nullPtr
152 h <- newForeignPtr c_close p
155 foreign import ccall unsafe "guestfs_last_error" c_last_error
156 :: GuestfsP -> IO CString
158 -- last_error :: GuestfsH -> IO (Maybe String)
160 -- str <- withForeignPtr h (\p -> c_last_error p)
161 -- maybePeek peekCString str
163 last_error :: GuestfsH -> IO (String)
165 str <- withForeignPtr h (\p -> c_last_error p)
167 then return "no error"
170 foreign import ccall unsafe "guestfs_test0" c_test0
171 :: GuestfsP -> CString -> CString -> Ptr CString -> CInt -> CInt -> CString -> CString -> IO (CInt)
173 test0 :: GuestfsH -> String -> Maybe String -> [String] -> Bool -> Int -> String -> String -> IO ()
174 test0 h str optstr strlist b integer filein fileout = do
175 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)
182 foreign import ccall unsafe "guestfs_test0rint" c_test0rint
183 :: GuestfsP -> CString -> IO (CInt)
185 test0rint :: GuestfsH -> String -> IO (Int)
187 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint p val)
192 else return (fromIntegral r)
194 foreign import ccall unsafe "guestfs_test0rinterr" c_test0rinterr
195 :: GuestfsP -> IO (CInt)
197 test0rinterr :: GuestfsH -> IO (Int)
199 r <- withForeignPtr h (\p -> c_test0rinterr p)
204 else return (fromIntegral r)
206 foreign import ccall unsafe "guestfs_test0rint64" c_test0rint64
207 :: GuestfsP -> CString -> IO (Int64)
209 test0rint64 :: GuestfsH -> String -> IO (Integer)
210 test0rint64 h val = do
211 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint64 p val)
216 else return (fromIntegral r)
218 foreign import ccall unsafe "guestfs_test0rint64err" c_test0rint64err
219 :: GuestfsP -> IO (Int64)
221 test0rint64err :: GuestfsH -> IO (Integer)
222 test0rint64err h = do
223 r <- withForeignPtr h (\p -> c_test0rint64err p)
228 else return (fromIntegral r)
230 foreign import ccall unsafe "guestfs_launch" c_launch
231 :: GuestfsP -> IO (CInt)
233 launch :: GuestfsH -> IO ()
235 r <- withForeignPtr h (\p -> c_launch p)
242 foreign import ccall unsafe "guestfs_wait_ready" c_wait_ready
243 :: GuestfsP -> IO (CInt)
245 wait_ready :: GuestfsH -> IO ()
247 r <- withForeignPtr h (\p -> c_wait_ready p)
254 foreign import ccall unsafe "guestfs_kill_subprocess" c_kill_subprocess
255 :: GuestfsP -> IO (CInt)
257 kill_subprocess :: GuestfsH -> IO ()
258 kill_subprocess h = do
259 r <- withForeignPtr h (\p -> c_kill_subprocess p)
266 foreign import ccall unsafe "guestfs_add_drive" c_add_drive
267 :: GuestfsP -> CString -> IO (CInt)
269 add_drive :: GuestfsH -> String -> IO ()
270 add_drive h filename = do
271 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive p filename)
278 foreign import ccall unsafe "guestfs_add_cdrom" c_add_cdrom
279 :: GuestfsP -> CString -> IO (CInt)
281 add_cdrom :: GuestfsH -> String -> IO ()
282 add_cdrom h filename = do
283 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_cdrom p filename)
290 foreign import ccall unsafe "guestfs_add_drive_ro" c_add_drive_ro
291 :: GuestfsP -> CString -> IO (CInt)
293 add_drive_ro :: GuestfsH -> String -> IO ()
294 add_drive_ro h filename = do
295 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive_ro p filename)
302 foreign import ccall unsafe "guestfs_config" c_config
303 :: GuestfsP -> CString -> CString -> IO (CInt)
305 config :: GuestfsH -> String -> Maybe String -> IO ()
306 config h qemuparam qemuvalue = do
307 r <- withCString qemuparam $ \qemuparam -> maybeWith withCString qemuvalue $ \qemuvalue -> withForeignPtr h (\p -> c_config p qemuparam qemuvalue)
314 foreign import ccall unsafe "guestfs_set_qemu" c_set_qemu
315 :: GuestfsP -> CString -> IO (CInt)
317 set_qemu :: GuestfsH -> String -> IO ()
319 r <- withCString qemu $ \qemu -> withForeignPtr h (\p -> c_set_qemu p qemu)
326 foreign import ccall unsafe "guestfs_set_path" c_set_path
327 :: GuestfsP -> CString -> IO (CInt)
329 set_path :: GuestfsH -> String -> IO ()
331 r <- withCString path $ \path -> withForeignPtr h (\p -> c_set_path p path)
338 foreign import ccall unsafe "guestfs_set_append" c_set_append
339 :: GuestfsP -> CString -> IO (CInt)
341 set_append :: GuestfsH -> String -> IO ()
342 set_append h append = do
343 r <- withCString append $ \append -> withForeignPtr h (\p -> c_set_append p append)
350 foreign import ccall unsafe "guestfs_set_autosync" c_set_autosync
351 :: GuestfsP -> CInt -> IO (CInt)
353 set_autosync :: GuestfsH -> Bool -> IO ()
354 set_autosync h autosync = do
355 r <- withForeignPtr h (\p -> c_set_autosync p (fromBool autosync))
362 foreign import ccall unsafe "guestfs_set_verbose" c_set_verbose
363 :: GuestfsP -> CInt -> IO (CInt)
365 set_verbose :: GuestfsH -> Bool -> IO ()
366 set_verbose h verbose = do
367 r <- withForeignPtr h (\p -> c_set_verbose p (fromBool verbose))
374 foreign import ccall unsafe "guestfs_get_state" c_get_state
375 :: GuestfsP -> IO (CInt)
377 get_state :: GuestfsH -> IO (Int)
379 r <- withForeignPtr h (\p -> c_get_state p)
384 else return (fromIntegral r)
386 foreign import ccall unsafe "guestfs_set_busy" c_set_busy
387 :: GuestfsP -> IO (CInt)
389 set_busy :: GuestfsH -> IO ()
391 r <- withForeignPtr h (\p -> c_set_busy p)
398 foreign import ccall unsafe "guestfs_set_ready" c_set_ready
399 :: GuestfsP -> IO (CInt)
401 set_ready :: GuestfsH -> IO ()
403 r <- withForeignPtr h (\p -> c_set_ready p)
410 foreign import ccall unsafe "guestfs_end_busy" c_end_busy
411 :: GuestfsP -> IO (CInt)
413 end_busy :: GuestfsH -> IO ()
415 r <- withForeignPtr h (\p -> c_end_busy p)
422 foreign import ccall unsafe "guestfs_mount" c_mount
423 :: GuestfsP -> CString -> CString -> IO (CInt)
425 mount :: GuestfsH -> String -> String -> IO ()
426 mount h device mountpoint = do
427 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount p device mountpoint)
434 foreign import ccall unsafe "guestfs_sync" c_sync
435 :: GuestfsP -> IO (CInt)
437 sync :: GuestfsH -> IO ()
439 r <- withForeignPtr h (\p -> c_sync p)
446 foreign import ccall unsafe "guestfs_touch" c_touch
447 :: GuestfsP -> CString -> IO (CInt)
449 touch :: GuestfsH -> String -> IO ()
451 r <- withCString path $ \path -> withForeignPtr h (\p -> c_touch p path)
458 foreign import ccall unsafe "guestfs_aug_init" c_aug_init
459 :: GuestfsP -> CString -> CInt -> IO (CInt)
461 aug_init :: GuestfsH -> String -> Int -> IO ()
462 aug_init h root flags = do
463 r <- withCString root $ \root -> withForeignPtr h (\p -> c_aug_init p root (fromIntegral flags))
470 foreign import ccall unsafe "guestfs_aug_close" c_aug_close
471 :: GuestfsP -> IO (CInt)
473 aug_close :: GuestfsH -> IO ()
475 r <- withForeignPtr h (\p -> c_aug_close p)
482 foreign import ccall unsafe "guestfs_aug_defvar" c_aug_defvar
483 :: GuestfsP -> CString -> CString -> IO (CInt)
485 aug_defvar :: GuestfsH -> String -> Maybe String -> IO (Int)
486 aug_defvar h name expr = do
487 r <- withCString name $ \name -> maybeWith withCString expr $ \expr -> withForeignPtr h (\p -> c_aug_defvar p name expr)
492 else return (fromIntegral r)
494 foreign import ccall unsafe "guestfs_aug_set" c_aug_set
495 :: GuestfsP -> CString -> CString -> IO (CInt)
497 aug_set :: GuestfsH -> String -> String -> IO ()
498 aug_set h path val = do
499 r <- withCString path $ \path -> withCString val $ \val -> withForeignPtr h (\p -> c_aug_set p path val)
506 foreign import ccall unsafe "guestfs_aug_insert" c_aug_insert
507 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
509 aug_insert :: GuestfsH -> String -> String -> Bool -> IO ()
510 aug_insert h path label before = do
511 r <- withCString path $ \path -> withCString label $ \label -> withForeignPtr h (\p -> c_aug_insert p path label (fromBool before))
518 foreign import ccall unsafe "guestfs_aug_rm" c_aug_rm
519 :: GuestfsP -> CString -> IO (CInt)
521 aug_rm :: GuestfsH -> String -> IO (Int)
523 r <- withCString path $ \path -> withForeignPtr h (\p -> c_aug_rm p path)
528 else return (fromIntegral r)
530 foreign import ccall unsafe "guestfs_aug_mv" c_aug_mv
531 :: GuestfsP -> CString -> CString -> IO (CInt)
533 aug_mv :: GuestfsH -> String -> String -> IO ()
534 aug_mv h src dest = do
535 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_aug_mv p src dest)
542 foreign import ccall unsafe "guestfs_aug_save" c_aug_save
543 :: GuestfsP -> IO (CInt)
545 aug_save :: GuestfsH -> IO ()
547 r <- withForeignPtr h (\p -> c_aug_save p)
554 foreign import ccall unsafe "guestfs_aug_load" c_aug_load
555 :: GuestfsP -> IO (CInt)
557 aug_load :: GuestfsH -> IO ()
559 r <- withForeignPtr h (\p -> c_aug_load p)
566 foreign import ccall unsafe "guestfs_rm" c_rm
567 :: GuestfsP -> CString -> IO (CInt)
569 rm :: GuestfsH -> String -> IO ()
571 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm p path)
578 foreign import ccall unsafe "guestfs_rmdir" c_rmdir
579 :: GuestfsP -> CString -> IO (CInt)
581 rmdir :: GuestfsH -> String -> IO ()
583 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rmdir p path)
590 foreign import ccall unsafe "guestfs_rm_rf" c_rm_rf
591 :: GuestfsP -> CString -> IO (CInt)
593 rm_rf :: GuestfsH -> String -> IO ()
595 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm_rf p path)
602 foreign import ccall unsafe "guestfs_mkdir" c_mkdir
603 :: GuestfsP -> CString -> IO (CInt)
605 mkdir :: GuestfsH -> String -> IO ()
607 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir p path)
614 foreign import ccall unsafe "guestfs_mkdir_p" c_mkdir_p
615 :: GuestfsP -> CString -> IO (CInt)
617 mkdir_p :: GuestfsH -> String -> IO ()
619 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir_p p path)
626 foreign import ccall unsafe "guestfs_chmod" c_chmod
627 :: GuestfsP -> CInt -> CString -> IO (CInt)
629 chmod :: GuestfsH -> Int -> String -> IO ()
630 chmod h mode path = do
631 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chmod p (fromIntegral mode) path)
638 foreign import ccall unsafe "guestfs_chown" c_chown
639 :: GuestfsP -> CInt -> CInt -> CString -> IO (CInt)
641 chown :: GuestfsH -> Int -> Int -> String -> IO ()
642 chown h owner group path = do
643 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chown p (fromIntegral owner) (fromIntegral group) path)
650 foreign import ccall unsafe "guestfs_pvcreate" c_pvcreate
651 :: GuestfsP -> CString -> IO (CInt)
653 pvcreate :: GuestfsH -> String -> IO ()
654 pvcreate h device = do
655 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvcreate p device)
662 foreign import ccall unsafe "guestfs_vgcreate" c_vgcreate
663 :: GuestfsP -> CString -> Ptr CString -> IO (CInt)
665 vgcreate :: GuestfsH -> String -> [String] -> IO ()
666 vgcreate h volgroup physvols = do
667 r <- withCString volgroup $ \volgroup -> withMany withCString physvols $ \physvols -> withArray0 nullPtr physvols $ \physvols -> withForeignPtr h (\p -> c_vgcreate p volgroup physvols)
674 foreign import ccall unsafe "guestfs_lvcreate" c_lvcreate
675 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
677 lvcreate :: GuestfsH -> String -> String -> Int -> IO ()
678 lvcreate h logvol volgroup mbytes = do
679 r <- withCString logvol $ \logvol -> withCString volgroup $ \volgroup -> withForeignPtr h (\p -> c_lvcreate p logvol volgroup (fromIntegral mbytes))
686 foreign import ccall unsafe "guestfs_mkfs" c_mkfs
687 :: GuestfsP -> CString -> CString -> IO (CInt)
689 mkfs :: GuestfsH -> String -> String -> IO ()
690 mkfs h fstype device = do
691 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_mkfs p fstype device)
698 foreign import ccall unsafe "guestfs_sfdisk" c_sfdisk
699 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> Ptr CString -> IO (CInt)
701 sfdisk :: GuestfsH -> String -> Int -> Int -> Int -> [String] -> IO ()
702 sfdisk h device cyls heads sectors lines = do
703 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)
710 foreign import ccall unsafe "guestfs_write_file" c_write_file
711 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
713 write_file :: GuestfsH -> String -> String -> Int -> IO ()
714 write_file h path content size = do
715 r <- withCString path $ \path -> withCString content $ \content -> withForeignPtr h (\p -> c_write_file p path content (fromIntegral size))
722 foreign import ccall unsafe "guestfs_umount" c_umount
723 :: GuestfsP -> CString -> IO (CInt)
725 umount :: GuestfsH -> String -> IO ()
726 umount h pathordevice = do
727 r <- withCString pathordevice $ \pathordevice -> withForeignPtr h (\p -> c_umount p pathordevice)
734 foreign import ccall unsafe "guestfs_umount_all" c_umount_all
735 :: GuestfsP -> IO (CInt)
737 umount_all :: GuestfsH -> IO ()
739 r <- withForeignPtr h (\p -> c_umount_all p)
746 foreign import ccall unsafe "guestfs_lvm_remove_all" c_lvm_remove_all
747 :: GuestfsP -> IO (CInt)
749 lvm_remove_all :: GuestfsH -> IO ()
750 lvm_remove_all h = do
751 r <- withForeignPtr h (\p -> c_lvm_remove_all p)
758 foreign import ccall unsafe "guestfs_blockdev_setro" c_blockdev_setro
759 :: GuestfsP -> CString -> IO (CInt)
761 blockdev_setro :: GuestfsH -> String -> IO ()
762 blockdev_setro h device = do
763 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setro p device)
770 foreign import ccall unsafe "guestfs_blockdev_setrw" c_blockdev_setrw
771 :: GuestfsP -> CString -> IO (CInt)
773 blockdev_setrw :: GuestfsH -> String -> IO ()
774 blockdev_setrw h device = do
775 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setrw p device)
782 foreign import ccall unsafe "guestfs_blockdev_getss" c_blockdev_getss
783 :: GuestfsP -> CString -> IO (CInt)
785 blockdev_getss :: GuestfsH -> String -> IO (Int)
786 blockdev_getss h device = do
787 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getss p device)
792 else return (fromIntegral r)
794 foreign import ccall unsafe "guestfs_blockdev_getbsz" c_blockdev_getbsz
795 :: GuestfsP -> CString -> IO (CInt)
797 blockdev_getbsz :: GuestfsH -> String -> IO (Int)
798 blockdev_getbsz h device = do
799 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getbsz p device)
804 else return (fromIntegral r)
806 foreign import ccall unsafe "guestfs_blockdev_setbsz" c_blockdev_setbsz
807 :: GuestfsP -> CString -> CInt -> IO (CInt)
809 blockdev_setbsz :: GuestfsH -> String -> Int -> IO ()
810 blockdev_setbsz h device blocksize = do
811 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setbsz p device (fromIntegral blocksize))
818 foreign import ccall unsafe "guestfs_blockdev_getsz" c_blockdev_getsz
819 :: GuestfsP -> CString -> IO (Int64)
821 blockdev_getsz :: GuestfsH -> String -> IO (Integer)
822 blockdev_getsz h device = do
823 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsz p device)
828 else return (fromIntegral r)
830 foreign import ccall unsafe "guestfs_blockdev_getsize64" c_blockdev_getsize64
831 :: GuestfsP -> CString -> IO (Int64)
833 blockdev_getsize64 :: GuestfsH -> String -> IO (Integer)
834 blockdev_getsize64 h device = do
835 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsize64 p device)
840 else return (fromIntegral r)
842 foreign import ccall unsafe "guestfs_blockdev_flushbufs" c_blockdev_flushbufs
843 :: GuestfsP -> CString -> IO (CInt)
845 blockdev_flushbufs :: GuestfsH -> String -> IO ()
846 blockdev_flushbufs h device = do
847 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_flushbufs p device)
854 foreign import ccall unsafe "guestfs_blockdev_rereadpt" c_blockdev_rereadpt
855 :: GuestfsP -> CString -> IO (CInt)
857 blockdev_rereadpt :: GuestfsH -> String -> IO ()
858 blockdev_rereadpt h device = do
859 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_rereadpt p device)
866 foreign import ccall unsafe "guestfs_upload" c_upload
867 :: GuestfsP -> CString -> CString -> IO (CInt)
869 upload :: GuestfsH -> String -> String -> IO ()
870 upload h filename remotefilename = do
871 r <- withCString filename $ \filename -> withCString remotefilename $ \remotefilename -> withForeignPtr h (\p -> c_upload p filename remotefilename)
878 foreign import ccall unsafe "guestfs_download" c_download
879 :: GuestfsP -> CString -> CString -> IO (CInt)
881 download :: GuestfsH -> String -> String -> IO ()
882 download h remotefilename filename = do
883 r <- withCString remotefilename $ \remotefilename -> withCString filename $ \filename -> withForeignPtr h (\p -> c_download p remotefilename filename)
890 foreign import ccall unsafe "guestfs_tar_in" c_tar_in
891 :: GuestfsP -> CString -> CString -> IO (CInt)
893 tar_in :: GuestfsH -> String -> String -> IO ()
894 tar_in h tarfile directory = do
895 r <- withCString tarfile $ \tarfile -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tar_in p tarfile directory)
902 foreign import ccall unsafe "guestfs_tar_out" c_tar_out
903 :: GuestfsP -> CString -> CString -> IO (CInt)
905 tar_out :: GuestfsH -> String -> String -> IO ()
906 tar_out h directory tarfile = do
907 r <- withCString directory $ \directory -> withCString tarfile $ \tarfile -> withForeignPtr h (\p -> c_tar_out p directory tarfile)
914 foreign import ccall unsafe "guestfs_tgz_in" c_tgz_in
915 :: GuestfsP -> CString -> CString -> IO (CInt)
917 tgz_in :: GuestfsH -> String -> String -> IO ()
918 tgz_in h tarball directory = do
919 r <- withCString tarball $ \tarball -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tgz_in p tarball directory)
926 foreign import ccall unsafe "guestfs_tgz_out" c_tgz_out
927 :: GuestfsP -> CString -> CString -> IO (CInt)
929 tgz_out :: GuestfsH -> String -> String -> IO ()
930 tgz_out h directory tarball = do
931 r <- withCString directory $ \directory -> withCString tarball $ \tarball -> withForeignPtr h (\p -> c_tgz_out p directory tarball)
938 foreign import ccall unsafe "guestfs_mount_ro" c_mount_ro
939 :: GuestfsP -> CString -> CString -> IO (CInt)
941 mount_ro :: GuestfsH -> String -> String -> IO ()
942 mount_ro h device mountpoint = do
943 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_ro p device mountpoint)
950 foreign import ccall unsafe "guestfs_mount_options" c_mount_options
951 :: GuestfsP -> CString -> CString -> CString -> IO (CInt)
953 mount_options :: GuestfsH -> String -> String -> String -> IO ()
954 mount_options h options device mountpoint = do
955 r <- withCString options $ \options -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_options p options device mountpoint)
962 foreign import ccall unsafe "guestfs_mount_vfs" c_mount_vfs
963 :: GuestfsP -> CString -> CString -> CString -> CString -> IO (CInt)
965 mount_vfs :: GuestfsH -> String -> String -> String -> String -> IO ()
966 mount_vfs h options vfstype device mountpoint = do
967 r <- withCString options $ \options -> withCString vfstype $ \vfstype -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_vfs p options vfstype device mountpoint)
974 foreign import ccall unsafe "guestfs_lvremove" c_lvremove
975 :: GuestfsP -> CString -> IO (CInt)
977 lvremove :: GuestfsH -> String -> IO ()
978 lvremove h device = do
979 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvremove p device)
986 foreign import ccall unsafe "guestfs_vgremove" c_vgremove
987 :: GuestfsP -> CString -> IO (CInt)
989 vgremove :: GuestfsH -> String -> IO ()
990 vgremove h vgname = do
991 r <- withCString vgname $ \vgname -> withForeignPtr h (\p -> c_vgremove p vgname)
998 foreign import ccall unsafe "guestfs_pvremove" c_pvremove
999 :: GuestfsP -> CString -> IO (CInt)
1001 pvremove :: GuestfsH -> String -> IO ()
1002 pvremove h device = do
1003 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvremove p device)
1010 foreign import ccall unsafe "guestfs_set_e2label" c_set_e2label
1011 :: GuestfsP -> CString -> CString -> IO (CInt)
1013 set_e2label :: GuestfsH -> String -> String -> IO ()
1014 set_e2label h device label = do
1015 r <- withCString device $ \device -> withCString label $ \label -> withForeignPtr h (\p -> c_set_e2label p device label)
1022 foreign import ccall unsafe "guestfs_set_e2uuid" c_set_e2uuid
1023 :: GuestfsP -> CString -> CString -> IO (CInt)
1025 set_e2uuid :: GuestfsH -> String -> String -> IO ()
1026 set_e2uuid h device uuid = do
1027 r <- withCString device $ \device -> withCString uuid $ \uuid -> withForeignPtr h (\p -> c_set_e2uuid p device uuid)
1034 foreign import ccall unsafe "guestfs_fsck" c_fsck
1035 :: GuestfsP -> CString -> CString -> IO (CInt)
1037 fsck :: GuestfsH -> String -> String -> IO (Int)
1038 fsck h fstype device = do
1039 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_fsck p fstype device)
1044 else return (fromIntegral r)
1046 foreign import ccall unsafe "guestfs_zero" c_zero
1047 :: GuestfsP -> CString -> IO (CInt)
1049 zero :: GuestfsH -> String -> IO ()
1051 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zero p device)
1058 foreign import ccall unsafe "guestfs_grub_install" c_grub_install
1059 :: GuestfsP -> CString -> CString -> IO (CInt)
1061 grub_install :: GuestfsH -> String -> String -> IO ()
1062 grub_install h root device = do
1063 r <- withCString root $ \root -> withCString device $ \device -> withForeignPtr h (\p -> c_grub_install p root device)
1070 foreign import ccall unsafe "guestfs_cp" c_cp
1071 :: GuestfsP -> CString -> CString -> IO (CInt)
1073 cp :: GuestfsH -> String -> String -> IO ()
1075 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp p src dest)
1082 foreign import ccall unsafe "guestfs_cp_a" c_cp_a
1083 :: GuestfsP -> CString -> CString -> IO (CInt)
1085 cp_a :: GuestfsH -> String -> String -> IO ()
1086 cp_a h src dest = do
1087 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp_a p src dest)
1094 foreign import ccall unsafe "guestfs_mv" c_mv
1095 :: GuestfsP -> CString -> CString -> IO (CInt)
1097 mv :: GuestfsH -> String -> String -> IO ()
1099 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_mv p src dest)
1106 foreign import ccall unsafe "guestfs_drop_caches" c_drop_caches
1107 :: GuestfsP -> CInt -> IO (CInt)
1109 drop_caches :: GuestfsH -> Int -> IO ()
1110 drop_caches h whattodrop = do
1111 r <- withForeignPtr h (\p -> c_drop_caches p (fromIntegral whattodrop))
1118 foreign import ccall unsafe "guestfs_ping_daemon" c_ping_daemon
1119 :: GuestfsP -> IO (CInt)
1121 ping_daemon :: GuestfsH -> IO ()
1123 r <- withForeignPtr h (\p -> c_ping_daemon p)
1130 foreign import ccall unsafe "guestfs_zerofree" c_zerofree
1131 :: GuestfsP -> CString -> IO (CInt)
1133 zerofree :: GuestfsH -> String -> IO ()
1134 zerofree h device = do
1135 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zerofree p device)
1142 foreign import ccall unsafe "guestfs_pvresize" c_pvresize
1143 :: GuestfsP -> CString -> IO (CInt)
1145 pvresize :: GuestfsH -> String -> IO ()
1146 pvresize h device = do
1147 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvresize p device)
1154 foreign import ccall unsafe "guestfs_sfdisk_N" c_sfdisk_N
1155 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (CInt)
1157 sfdisk_N :: GuestfsH -> String -> Int -> Int -> Int -> Int -> String -> IO ()
1158 sfdisk_N h device n cyls heads sectors line = do
1159 r <- withCString device $ \device -> withCString line $ \line -> withForeignPtr h (\p -> c_sfdisk_N p device (fromIntegral n) (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) line)
1166 foreign import ccall unsafe "guestfs_vg_activate_all" c_vg_activate_all
1167 :: GuestfsP -> CInt -> IO (CInt)
1169 vg_activate_all :: GuestfsH -> Bool -> IO ()
1170 vg_activate_all h activate = do
1171 r <- withForeignPtr h (\p -> c_vg_activate_all p (fromBool activate))
1178 foreign import ccall unsafe "guestfs_vg_activate" c_vg_activate
1179 :: GuestfsP -> CInt -> Ptr CString -> IO (CInt)
1181 vg_activate :: GuestfsH -> Bool -> [String] -> IO ()
1182 vg_activate h activate volgroups = do
1183 r <- withMany withCString volgroups $ \volgroups -> withArray0 nullPtr volgroups $ \volgroups -> withForeignPtr h (\p -> c_vg_activate p (fromBool activate) volgroups)
1190 foreign import ccall unsafe "guestfs_lvresize" c_lvresize
1191 :: GuestfsP -> CString -> CInt -> IO (CInt)
1193 lvresize :: GuestfsH -> String -> Int -> IO ()
1194 lvresize h device mbytes = do
1195 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvresize p device (fromIntegral mbytes))
1202 foreign import ccall unsafe "guestfs_resize2fs" c_resize2fs
1203 :: GuestfsP -> CString -> IO (CInt)
1205 resize2fs :: GuestfsH -> String -> IO ()
1206 resize2fs h device = do
1207 r <- withCString device $ \device -> withForeignPtr h (\p -> c_resize2fs p device)
1214 foreign import ccall unsafe "guestfs_e2fsck_f" c_e2fsck_f
1215 :: GuestfsP -> CString -> IO (CInt)
1217 e2fsck_f :: GuestfsH -> String -> IO ()
1218 e2fsck_f h device = do
1219 r <- withCString device $ \device -> withForeignPtr h (\p -> c_e2fsck_f p device)
1226 foreign import ccall unsafe "guestfs_sleep" c_sleep
1227 :: GuestfsP -> CInt -> IO (CInt)
1229 sleep :: GuestfsH -> Int -> IO ()
1231 r <- withForeignPtr h (\p -> c_sleep p (fromIntegral secs))
1238 foreign import ccall unsafe "guestfs_ntfs_3g_probe" c_ntfs_3g_probe
1239 :: GuestfsP -> CInt -> CString -> IO (CInt)
1241 ntfs_3g_probe :: GuestfsH -> Bool -> String -> IO (Int)
1242 ntfs_3g_probe h rw device = do
1243 r <- withCString device $ \device -> withForeignPtr h (\p -> c_ntfs_3g_probe p (fromBool rw) device)
1248 else return (fromIntegral r)
1250 foreign import ccall unsafe "guestfs_scrub_device" c_scrub_device
1251 :: GuestfsP -> CString -> IO (CInt)
1253 scrub_device :: GuestfsH -> String -> IO ()
1254 scrub_device h device = do
1255 r <- withCString device $ \device -> withForeignPtr h (\p -> c_scrub_device p device)
1262 foreign import ccall unsafe "guestfs_scrub_file" c_scrub_file
1263 :: GuestfsP -> CString -> IO (CInt)
1265 scrub_file :: GuestfsH -> String -> IO ()
1266 scrub_file h file = do
1267 r <- withCString file $ \file -> withForeignPtr h (\p -> c_scrub_file p file)
1274 foreign import ccall unsafe "guestfs_scrub_freespace" c_scrub_freespace
1275 :: GuestfsP -> CString -> IO (CInt)
1277 scrub_freespace :: GuestfsH -> String -> IO ()
1278 scrub_freespace h dir = do
1279 r <- withCString dir $ \dir -> withForeignPtr h (\p -> c_scrub_freespace p dir)