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 #-}
133 import Foreign.C.Types
135 import Control.Exception
138 data GuestfsS = GuestfsS -- represents the opaque C struct
139 type GuestfsP = Ptr GuestfsS -- guestfs_h *
140 type GuestfsH = ForeignPtr GuestfsS -- guestfs_h * with attached finalizer
142 -- XXX define properly later XXX
146 data IntBool = IntBool
148 data StatVFS = StatVFS
149 data Hashtable = Hashtable
151 foreign import ccall unsafe "guestfs_create" c_create
153 foreign import ccall unsafe "&guestfs_close" c_close
154 :: FunPtr (GuestfsP -> IO ())
155 foreign import ccall unsafe "guestfs_set_error_handler" c_set_error_handler
156 :: GuestfsP -> Ptr CInt -> Ptr CInt -> IO ()
158 create :: IO GuestfsH
161 c_set_error_handler p nullPtr nullPtr
162 h <- newForeignPtr c_close p
165 foreign import ccall unsafe "guestfs_last_error" c_last_error
166 :: GuestfsP -> IO CString
168 -- last_error :: GuestfsH -> IO (Maybe String)
170 -- str <- withForeignPtr h (\p -> c_last_error p)
171 -- maybePeek peekCString str
173 last_error :: GuestfsH -> IO (String)
175 str <- withForeignPtr h (\p -> c_last_error p)
177 then return "no error"
180 foreign import ccall unsafe "guestfs_test0" c_test0
181 :: GuestfsP -> CString -> CString -> Ptr CString -> CInt -> CInt -> CString -> CString -> IO (CInt)
183 test0 :: GuestfsH -> String -> Maybe String -> [String] -> Bool -> Int -> String -> String -> IO ()
184 test0 h str optstr strlist b integer filein fileout = do
185 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)
192 foreign import ccall unsafe "guestfs_test0rint" c_test0rint
193 :: GuestfsP -> CString -> IO (CInt)
195 test0rint :: GuestfsH -> String -> IO (Int)
197 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint p val)
202 else return (fromIntegral r)
204 foreign import ccall unsafe "guestfs_test0rinterr" c_test0rinterr
205 :: GuestfsP -> IO (CInt)
207 test0rinterr :: GuestfsH -> IO (Int)
209 r <- withForeignPtr h (\p -> c_test0rinterr p)
214 else return (fromIntegral r)
216 foreign import ccall unsafe "guestfs_test0rint64" c_test0rint64
217 :: GuestfsP -> CString -> IO (Int64)
219 test0rint64 :: GuestfsH -> String -> IO (Integer)
220 test0rint64 h val = do
221 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint64 p val)
226 else return (fromIntegral r)
228 foreign import ccall unsafe "guestfs_test0rint64err" c_test0rint64err
229 :: GuestfsP -> IO (Int64)
231 test0rint64err :: GuestfsH -> IO (Integer)
232 test0rint64err h = do
233 r <- withForeignPtr h (\p -> c_test0rint64err p)
238 else return (fromIntegral r)
240 foreign import ccall unsafe "guestfs_launch" c_launch
241 :: GuestfsP -> IO (CInt)
243 launch :: GuestfsH -> IO ()
245 r <- withForeignPtr h (\p -> c_launch p)
252 foreign import ccall unsafe "guestfs_wait_ready" c_wait_ready
253 :: GuestfsP -> IO (CInt)
255 wait_ready :: GuestfsH -> IO ()
257 r <- withForeignPtr h (\p -> c_wait_ready p)
264 foreign import ccall unsafe "guestfs_kill_subprocess" c_kill_subprocess
265 :: GuestfsP -> IO (CInt)
267 kill_subprocess :: GuestfsH -> IO ()
268 kill_subprocess h = do
269 r <- withForeignPtr h (\p -> c_kill_subprocess p)
276 foreign import ccall unsafe "guestfs_add_drive" c_add_drive
277 :: GuestfsP -> CString -> IO (CInt)
279 add_drive :: GuestfsH -> String -> IO ()
280 add_drive h filename = do
281 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive p filename)
288 foreign import ccall unsafe "guestfs_add_cdrom" c_add_cdrom
289 :: GuestfsP -> CString -> IO (CInt)
291 add_cdrom :: GuestfsH -> String -> IO ()
292 add_cdrom h filename = do
293 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_cdrom p filename)
300 foreign import ccall unsafe "guestfs_add_drive_ro" c_add_drive_ro
301 :: GuestfsP -> CString -> IO (CInt)
303 add_drive_ro :: GuestfsH -> String -> IO ()
304 add_drive_ro h filename = do
305 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive_ro p filename)
312 foreign import ccall unsafe "guestfs_config" c_config
313 :: GuestfsP -> CString -> CString -> IO (CInt)
315 config :: GuestfsH -> String -> Maybe String -> IO ()
316 config h qemuparam qemuvalue = do
317 r <- withCString qemuparam $ \qemuparam -> maybeWith withCString qemuvalue $ \qemuvalue -> withForeignPtr h (\p -> c_config p qemuparam qemuvalue)
324 foreign import ccall unsafe "guestfs_set_qemu" c_set_qemu
325 :: GuestfsP -> CString -> IO (CInt)
327 set_qemu :: GuestfsH -> String -> IO ()
329 r <- withCString qemu $ \qemu -> withForeignPtr h (\p -> c_set_qemu p qemu)
336 foreign import ccall unsafe "guestfs_set_path" c_set_path
337 :: GuestfsP -> CString -> IO (CInt)
339 set_path :: GuestfsH -> String -> IO ()
341 r <- withCString path $ \path -> withForeignPtr h (\p -> c_set_path p path)
348 foreign import ccall unsafe "guestfs_set_append" c_set_append
349 :: GuestfsP -> CString -> IO (CInt)
351 set_append :: GuestfsH -> String -> IO ()
352 set_append h append = do
353 r <- withCString append $ \append -> withForeignPtr h (\p -> c_set_append p append)
360 foreign import ccall unsafe "guestfs_set_autosync" c_set_autosync
361 :: GuestfsP -> CInt -> IO (CInt)
363 set_autosync :: GuestfsH -> Bool -> IO ()
364 set_autosync h autosync = do
365 r <- withForeignPtr h (\p -> c_set_autosync p (fromBool autosync))
372 foreign import ccall unsafe "guestfs_set_verbose" c_set_verbose
373 :: GuestfsP -> CInt -> IO (CInt)
375 set_verbose :: GuestfsH -> Bool -> IO ()
376 set_verbose h verbose = do
377 r <- withForeignPtr h (\p -> c_set_verbose p (fromBool verbose))
384 foreign import ccall unsafe "guestfs_get_state" c_get_state
385 :: GuestfsP -> IO (CInt)
387 get_state :: GuestfsH -> IO (Int)
389 r <- withForeignPtr h (\p -> c_get_state p)
394 else return (fromIntegral r)
396 foreign import ccall unsafe "guestfs_set_busy" c_set_busy
397 :: GuestfsP -> IO (CInt)
399 set_busy :: GuestfsH -> IO ()
401 r <- withForeignPtr h (\p -> c_set_busy p)
408 foreign import ccall unsafe "guestfs_set_ready" c_set_ready
409 :: GuestfsP -> IO (CInt)
411 set_ready :: GuestfsH -> IO ()
413 r <- withForeignPtr h (\p -> c_set_ready p)
420 foreign import ccall unsafe "guestfs_end_busy" c_end_busy
421 :: GuestfsP -> IO (CInt)
423 end_busy :: GuestfsH -> IO ()
425 r <- withForeignPtr h (\p -> c_end_busy p)
432 foreign import ccall unsafe "guestfs_set_memsize" c_set_memsize
433 :: GuestfsP -> CInt -> IO (CInt)
435 set_memsize :: GuestfsH -> Int -> IO ()
436 set_memsize h memsize = do
437 r <- withForeignPtr h (\p -> c_set_memsize p (fromIntegral memsize))
444 foreign import ccall unsafe "guestfs_get_memsize" c_get_memsize
445 :: GuestfsP -> IO (CInt)
447 get_memsize :: GuestfsH -> IO (Int)
449 r <- withForeignPtr h (\p -> c_get_memsize p)
454 else return (fromIntegral r)
456 foreign import ccall unsafe "guestfs_mount" c_mount
457 :: GuestfsP -> CString -> CString -> IO (CInt)
459 mount :: GuestfsH -> String -> String -> IO ()
460 mount h device mountpoint = do
461 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount p device mountpoint)
468 foreign import ccall unsafe "guestfs_sync" c_sync
469 :: GuestfsP -> IO (CInt)
471 sync :: GuestfsH -> IO ()
473 r <- withForeignPtr h (\p -> c_sync p)
480 foreign import ccall unsafe "guestfs_touch" c_touch
481 :: GuestfsP -> CString -> IO (CInt)
483 touch :: GuestfsH -> String -> IO ()
485 r <- withCString path $ \path -> withForeignPtr h (\p -> c_touch p path)
492 foreign import ccall unsafe "guestfs_aug_init" c_aug_init
493 :: GuestfsP -> CString -> CInt -> IO (CInt)
495 aug_init :: GuestfsH -> String -> Int -> IO ()
496 aug_init h root flags = do
497 r <- withCString root $ \root -> withForeignPtr h (\p -> c_aug_init p root (fromIntegral flags))
504 foreign import ccall unsafe "guestfs_aug_close" c_aug_close
505 :: GuestfsP -> IO (CInt)
507 aug_close :: GuestfsH -> IO ()
509 r <- withForeignPtr h (\p -> c_aug_close p)
516 foreign import ccall unsafe "guestfs_aug_defvar" c_aug_defvar
517 :: GuestfsP -> CString -> CString -> IO (CInt)
519 aug_defvar :: GuestfsH -> String -> Maybe String -> IO (Int)
520 aug_defvar h name expr = do
521 r <- withCString name $ \name -> maybeWith withCString expr $ \expr -> withForeignPtr h (\p -> c_aug_defvar p name expr)
526 else return (fromIntegral r)
528 foreign import ccall unsafe "guestfs_aug_set" c_aug_set
529 :: GuestfsP -> CString -> CString -> IO (CInt)
531 aug_set :: GuestfsH -> String -> String -> IO ()
532 aug_set h path val = do
533 r <- withCString path $ \path -> withCString val $ \val -> withForeignPtr h (\p -> c_aug_set p path val)
540 foreign import ccall unsafe "guestfs_aug_insert" c_aug_insert
541 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
543 aug_insert :: GuestfsH -> String -> String -> Bool -> IO ()
544 aug_insert h path label before = do
545 r <- withCString path $ \path -> withCString label $ \label -> withForeignPtr h (\p -> c_aug_insert p path label (fromBool before))
552 foreign import ccall unsafe "guestfs_aug_rm" c_aug_rm
553 :: GuestfsP -> CString -> IO (CInt)
555 aug_rm :: GuestfsH -> String -> IO (Int)
557 r <- withCString path $ \path -> withForeignPtr h (\p -> c_aug_rm p path)
562 else return (fromIntegral r)
564 foreign import ccall unsafe "guestfs_aug_mv" c_aug_mv
565 :: GuestfsP -> CString -> CString -> IO (CInt)
567 aug_mv :: GuestfsH -> String -> String -> IO ()
568 aug_mv h src dest = do
569 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_aug_mv p src dest)
576 foreign import ccall unsafe "guestfs_aug_save" c_aug_save
577 :: GuestfsP -> IO (CInt)
579 aug_save :: GuestfsH -> IO ()
581 r <- withForeignPtr h (\p -> c_aug_save p)
588 foreign import ccall unsafe "guestfs_aug_load" c_aug_load
589 :: GuestfsP -> IO (CInt)
591 aug_load :: GuestfsH -> IO ()
593 r <- withForeignPtr h (\p -> c_aug_load p)
600 foreign import ccall unsafe "guestfs_rm" c_rm
601 :: GuestfsP -> CString -> IO (CInt)
603 rm :: GuestfsH -> String -> IO ()
605 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm p path)
612 foreign import ccall unsafe "guestfs_rmdir" c_rmdir
613 :: GuestfsP -> CString -> IO (CInt)
615 rmdir :: GuestfsH -> String -> IO ()
617 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rmdir p path)
624 foreign import ccall unsafe "guestfs_rm_rf" c_rm_rf
625 :: GuestfsP -> CString -> IO (CInt)
627 rm_rf :: GuestfsH -> String -> IO ()
629 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm_rf p path)
636 foreign import ccall unsafe "guestfs_mkdir" c_mkdir
637 :: GuestfsP -> CString -> IO (CInt)
639 mkdir :: GuestfsH -> String -> IO ()
641 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir p path)
648 foreign import ccall unsafe "guestfs_mkdir_p" c_mkdir_p
649 :: GuestfsP -> CString -> IO (CInt)
651 mkdir_p :: GuestfsH -> String -> IO ()
653 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir_p p path)
660 foreign import ccall unsafe "guestfs_chmod" c_chmod
661 :: GuestfsP -> CInt -> CString -> IO (CInt)
663 chmod :: GuestfsH -> Int -> String -> IO ()
664 chmod h mode path = do
665 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chmod p (fromIntegral mode) path)
672 foreign import ccall unsafe "guestfs_chown" c_chown
673 :: GuestfsP -> CInt -> CInt -> CString -> IO (CInt)
675 chown :: GuestfsH -> Int -> Int -> String -> IO ()
676 chown h owner group path = do
677 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chown p (fromIntegral owner) (fromIntegral group) path)
684 foreign import ccall unsafe "guestfs_pvcreate" c_pvcreate
685 :: GuestfsP -> CString -> IO (CInt)
687 pvcreate :: GuestfsH -> String -> IO ()
688 pvcreate h device = do
689 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvcreate p device)
696 foreign import ccall unsafe "guestfs_vgcreate" c_vgcreate
697 :: GuestfsP -> CString -> Ptr CString -> IO (CInt)
699 vgcreate :: GuestfsH -> String -> [String] -> IO ()
700 vgcreate h volgroup physvols = do
701 r <- withCString volgroup $ \volgroup -> withMany withCString physvols $ \physvols -> withArray0 nullPtr physvols $ \physvols -> withForeignPtr h (\p -> c_vgcreate p volgroup physvols)
708 foreign import ccall unsafe "guestfs_lvcreate" c_lvcreate
709 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
711 lvcreate :: GuestfsH -> String -> String -> Int -> IO ()
712 lvcreate h logvol volgroup mbytes = do
713 r <- withCString logvol $ \logvol -> withCString volgroup $ \volgroup -> withForeignPtr h (\p -> c_lvcreate p logvol volgroup (fromIntegral mbytes))
720 foreign import ccall unsafe "guestfs_mkfs" c_mkfs
721 :: GuestfsP -> CString -> CString -> IO (CInt)
723 mkfs :: GuestfsH -> String -> String -> IO ()
724 mkfs h fstype device = do
725 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_mkfs p fstype device)
732 foreign import ccall unsafe "guestfs_sfdisk" c_sfdisk
733 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> Ptr CString -> IO (CInt)
735 sfdisk :: GuestfsH -> String -> Int -> Int -> Int -> [String] -> IO ()
736 sfdisk h device cyls heads sectors lines = do
737 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)
744 foreign import ccall unsafe "guestfs_write_file" c_write_file
745 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
747 write_file :: GuestfsH -> String -> String -> Int -> IO ()
748 write_file h path content size = do
749 r <- withCString path $ \path -> withCString content $ \content -> withForeignPtr h (\p -> c_write_file p path content (fromIntegral size))
756 foreign import ccall unsafe "guestfs_umount" c_umount
757 :: GuestfsP -> CString -> IO (CInt)
759 umount :: GuestfsH -> String -> IO ()
760 umount h pathordevice = do
761 r <- withCString pathordevice $ \pathordevice -> withForeignPtr h (\p -> c_umount p pathordevice)
768 foreign import ccall unsafe "guestfs_umount_all" c_umount_all
769 :: GuestfsP -> IO (CInt)
771 umount_all :: GuestfsH -> IO ()
773 r <- withForeignPtr h (\p -> c_umount_all p)
780 foreign import ccall unsafe "guestfs_lvm_remove_all" c_lvm_remove_all
781 :: GuestfsP -> IO (CInt)
783 lvm_remove_all :: GuestfsH -> IO ()
784 lvm_remove_all h = do
785 r <- withForeignPtr h (\p -> c_lvm_remove_all p)
792 foreign import ccall unsafe "guestfs_blockdev_setro" c_blockdev_setro
793 :: GuestfsP -> CString -> IO (CInt)
795 blockdev_setro :: GuestfsH -> String -> IO ()
796 blockdev_setro h device = do
797 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setro p device)
804 foreign import ccall unsafe "guestfs_blockdev_setrw" c_blockdev_setrw
805 :: GuestfsP -> CString -> IO (CInt)
807 blockdev_setrw :: GuestfsH -> String -> IO ()
808 blockdev_setrw h device = do
809 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setrw p device)
816 foreign import ccall unsafe "guestfs_blockdev_getss" c_blockdev_getss
817 :: GuestfsP -> CString -> IO (CInt)
819 blockdev_getss :: GuestfsH -> String -> IO (Int)
820 blockdev_getss h device = do
821 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getss p device)
826 else return (fromIntegral r)
828 foreign import ccall unsafe "guestfs_blockdev_getbsz" c_blockdev_getbsz
829 :: GuestfsP -> CString -> IO (CInt)
831 blockdev_getbsz :: GuestfsH -> String -> IO (Int)
832 blockdev_getbsz h device = do
833 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getbsz p device)
838 else return (fromIntegral r)
840 foreign import ccall unsafe "guestfs_blockdev_setbsz" c_blockdev_setbsz
841 :: GuestfsP -> CString -> CInt -> IO (CInt)
843 blockdev_setbsz :: GuestfsH -> String -> Int -> IO ()
844 blockdev_setbsz h device blocksize = do
845 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setbsz p device (fromIntegral blocksize))
852 foreign import ccall unsafe "guestfs_blockdev_getsz" c_blockdev_getsz
853 :: GuestfsP -> CString -> IO (Int64)
855 blockdev_getsz :: GuestfsH -> String -> IO (Integer)
856 blockdev_getsz h device = do
857 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsz p device)
862 else return (fromIntegral r)
864 foreign import ccall unsafe "guestfs_blockdev_getsize64" c_blockdev_getsize64
865 :: GuestfsP -> CString -> IO (Int64)
867 blockdev_getsize64 :: GuestfsH -> String -> IO (Integer)
868 blockdev_getsize64 h device = do
869 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsize64 p device)
874 else return (fromIntegral r)
876 foreign import ccall unsafe "guestfs_blockdev_flushbufs" c_blockdev_flushbufs
877 :: GuestfsP -> CString -> IO (CInt)
879 blockdev_flushbufs :: GuestfsH -> String -> IO ()
880 blockdev_flushbufs h device = do
881 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_flushbufs p device)
888 foreign import ccall unsafe "guestfs_blockdev_rereadpt" c_blockdev_rereadpt
889 :: GuestfsP -> CString -> IO (CInt)
891 blockdev_rereadpt :: GuestfsH -> String -> IO ()
892 blockdev_rereadpt h device = do
893 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_rereadpt p device)
900 foreign import ccall unsafe "guestfs_upload" c_upload
901 :: GuestfsP -> CString -> CString -> IO (CInt)
903 upload :: GuestfsH -> String -> String -> IO ()
904 upload h filename remotefilename = do
905 r <- withCString filename $ \filename -> withCString remotefilename $ \remotefilename -> withForeignPtr h (\p -> c_upload p filename remotefilename)
912 foreign import ccall unsafe "guestfs_download" c_download
913 :: GuestfsP -> CString -> CString -> IO (CInt)
915 download :: GuestfsH -> String -> String -> IO ()
916 download h remotefilename filename = do
917 r <- withCString remotefilename $ \remotefilename -> withCString filename $ \filename -> withForeignPtr h (\p -> c_download p remotefilename filename)
924 foreign import ccall unsafe "guestfs_tar_in" c_tar_in
925 :: GuestfsP -> CString -> CString -> IO (CInt)
927 tar_in :: GuestfsH -> String -> String -> IO ()
928 tar_in h tarfile directory = do
929 r <- withCString tarfile $ \tarfile -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tar_in p tarfile directory)
936 foreign import ccall unsafe "guestfs_tar_out" c_tar_out
937 :: GuestfsP -> CString -> CString -> IO (CInt)
939 tar_out :: GuestfsH -> String -> String -> IO ()
940 tar_out h directory tarfile = do
941 r <- withCString directory $ \directory -> withCString tarfile $ \tarfile -> withForeignPtr h (\p -> c_tar_out p directory tarfile)
948 foreign import ccall unsafe "guestfs_tgz_in" c_tgz_in
949 :: GuestfsP -> CString -> CString -> IO (CInt)
951 tgz_in :: GuestfsH -> String -> String -> IO ()
952 tgz_in h tarball directory = do
953 r <- withCString tarball $ \tarball -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tgz_in p tarball directory)
960 foreign import ccall unsafe "guestfs_tgz_out" c_tgz_out
961 :: GuestfsP -> CString -> CString -> IO (CInt)
963 tgz_out :: GuestfsH -> String -> String -> IO ()
964 tgz_out h directory tarball = do
965 r <- withCString directory $ \directory -> withCString tarball $ \tarball -> withForeignPtr h (\p -> c_tgz_out p directory tarball)
972 foreign import ccall unsafe "guestfs_mount_ro" c_mount_ro
973 :: GuestfsP -> CString -> CString -> IO (CInt)
975 mount_ro :: GuestfsH -> String -> String -> IO ()
976 mount_ro h device mountpoint = do
977 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_ro p device mountpoint)
984 foreign import ccall unsafe "guestfs_mount_options" c_mount_options
985 :: GuestfsP -> CString -> CString -> CString -> IO (CInt)
987 mount_options :: GuestfsH -> String -> String -> String -> IO ()
988 mount_options h options device mountpoint = do
989 r <- withCString options $ \options -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_options p options device mountpoint)
996 foreign import ccall unsafe "guestfs_mount_vfs" c_mount_vfs
997 :: GuestfsP -> CString -> CString -> CString -> CString -> IO (CInt)
999 mount_vfs :: GuestfsH -> String -> String -> String -> String -> IO ()
1000 mount_vfs h options vfstype device mountpoint = do
1001 r <- withCString options $ \options -> withCString vfstype $ \vfstype -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_vfs p options vfstype device mountpoint)
1008 foreign import ccall unsafe "guestfs_lvremove" c_lvremove
1009 :: GuestfsP -> CString -> IO (CInt)
1011 lvremove :: GuestfsH -> String -> IO ()
1012 lvremove h device = do
1013 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvremove p device)
1020 foreign import ccall unsafe "guestfs_vgremove" c_vgremove
1021 :: GuestfsP -> CString -> IO (CInt)
1023 vgremove :: GuestfsH -> String -> IO ()
1024 vgremove h vgname = do
1025 r <- withCString vgname $ \vgname -> withForeignPtr h (\p -> c_vgremove p vgname)
1032 foreign import ccall unsafe "guestfs_pvremove" c_pvremove
1033 :: GuestfsP -> CString -> IO (CInt)
1035 pvremove :: GuestfsH -> String -> IO ()
1036 pvremove h device = do
1037 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvremove p device)
1044 foreign import ccall unsafe "guestfs_set_e2label" c_set_e2label
1045 :: GuestfsP -> CString -> CString -> IO (CInt)
1047 set_e2label :: GuestfsH -> String -> String -> IO ()
1048 set_e2label h device label = do
1049 r <- withCString device $ \device -> withCString label $ \label -> withForeignPtr h (\p -> c_set_e2label p device label)
1056 foreign import ccall unsafe "guestfs_set_e2uuid" c_set_e2uuid
1057 :: GuestfsP -> CString -> CString -> IO (CInt)
1059 set_e2uuid :: GuestfsH -> String -> String -> IO ()
1060 set_e2uuid h device uuid = do
1061 r <- withCString device $ \device -> withCString uuid $ \uuid -> withForeignPtr h (\p -> c_set_e2uuid p device uuid)
1068 foreign import ccall unsafe "guestfs_fsck" c_fsck
1069 :: GuestfsP -> CString -> CString -> IO (CInt)
1071 fsck :: GuestfsH -> String -> String -> IO (Int)
1072 fsck h fstype device = do
1073 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_fsck p fstype device)
1078 else return (fromIntegral r)
1080 foreign import ccall unsafe "guestfs_zero" c_zero
1081 :: GuestfsP -> CString -> IO (CInt)
1083 zero :: GuestfsH -> String -> IO ()
1085 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zero p device)
1092 foreign import ccall unsafe "guestfs_grub_install" c_grub_install
1093 :: GuestfsP -> CString -> CString -> IO (CInt)
1095 grub_install :: GuestfsH -> String -> String -> IO ()
1096 grub_install h root device = do
1097 r <- withCString root $ \root -> withCString device $ \device -> withForeignPtr h (\p -> c_grub_install p root device)
1104 foreign import ccall unsafe "guestfs_cp" c_cp
1105 :: GuestfsP -> CString -> CString -> IO (CInt)
1107 cp :: GuestfsH -> String -> String -> IO ()
1109 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp p src dest)
1116 foreign import ccall unsafe "guestfs_cp_a" c_cp_a
1117 :: GuestfsP -> CString -> CString -> IO (CInt)
1119 cp_a :: GuestfsH -> String -> String -> IO ()
1120 cp_a h src dest = do
1121 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp_a p src dest)
1128 foreign import ccall unsafe "guestfs_mv" c_mv
1129 :: GuestfsP -> CString -> CString -> IO (CInt)
1131 mv :: GuestfsH -> String -> String -> IO ()
1133 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_mv p src dest)
1140 foreign import ccall unsafe "guestfs_drop_caches" c_drop_caches
1141 :: GuestfsP -> CInt -> IO (CInt)
1143 drop_caches :: GuestfsH -> Int -> IO ()
1144 drop_caches h whattodrop = do
1145 r <- withForeignPtr h (\p -> c_drop_caches p (fromIntegral whattodrop))
1152 foreign import ccall unsafe "guestfs_ping_daemon" c_ping_daemon
1153 :: GuestfsP -> IO (CInt)
1155 ping_daemon :: GuestfsH -> IO ()
1157 r <- withForeignPtr h (\p -> c_ping_daemon p)
1164 foreign import ccall unsafe "guestfs_zerofree" c_zerofree
1165 :: GuestfsP -> CString -> IO (CInt)
1167 zerofree :: GuestfsH -> String -> IO ()
1168 zerofree h device = do
1169 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zerofree p device)
1176 foreign import ccall unsafe "guestfs_pvresize" c_pvresize
1177 :: GuestfsP -> CString -> IO (CInt)
1179 pvresize :: GuestfsH -> String -> IO ()
1180 pvresize h device = do
1181 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvresize p device)
1188 foreign import ccall unsafe "guestfs_sfdisk_N" c_sfdisk_N
1189 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (CInt)
1191 sfdisk_N :: GuestfsH -> String -> Int -> Int -> Int -> Int -> String -> IO ()
1192 sfdisk_N h device partnum cyls heads sectors line = do
1193 r <- withCString device $ \device -> withCString line $ \line -> withForeignPtr h (\p -> c_sfdisk_N p device (fromIntegral partnum) (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) line)
1200 foreign import ccall unsafe "guestfs_vg_activate_all" c_vg_activate_all
1201 :: GuestfsP -> CInt -> IO (CInt)
1203 vg_activate_all :: GuestfsH -> Bool -> IO ()
1204 vg_activate_all h activate = do
1205 r <- withForeignPtr h (\p -> c_vg_activate_all p (fromBool activate))
1212 foreign import ccall unsafe "guestfs_vg_activate" c_vg_activate
1213 :: GuestfsP -> CInt -> Ptr CString -> IO (CInt)
1215 vg_activate :: GuestfsH -> Bool -> [String] -> IO ()
1216 vg_activate h activate volgroups = do
1217 r <- withMany withCString volgroups $ \volgroups -> withArray0 nullPtr volgroups $ \volgroups -> withForeignPtr h (\p -> c_vg_activate p (fromBool activate) volgroups)
1224 foreign import ccall unsafe "guestfs_lvresize" c_lvresize
1225 :: GuestfsP -> CString -> CInt -> IO (CInt)
1227 lvresize :: GuestfsH -> String -> Int -> IO ()
1228 lvresize h device mbytes = do
1229 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvresize p device (fromIntegral mbytes))
1236 foreign import ccall unsafe "guestfs_resize2fs" c_resize2fs
1237 :: GuestfsP -> CString -> IO (CInt)
1239 resize2fs :: GuestfsH -> String -> IO ()
1240 resize2fs h device = do
1241 r <- withCString device $ \device -> withForeignPtr h (\p -> c_resize2fs p device)
1248 foreign import ccall unsafe "guestfs_e2fsck_f" c_e2fsck_f
1249 :: GuestfsP -> CString -> IO (CInt)
1251 e2fsck_f :: GuestfsH -> String -> IO ()
1252 e2fsck_f h device = do
1253 r <- withCString device $ \device -> withForeignPtr h (\p -> c_e2fsck_f p device)
1260 foreign import ccall unsafe "guestfs_sleep" c_sleep
1261 :: GuestfsP -> CInt -> IO (CInt)
1263 sleep :: GuestfsH -> Int -> IO ()
1265 r <- withForeignPtr h (\p -> c_sleep p (fromIntegral secs))
1272 foreign import ccall unsafe "guestfs_ntfs_3g_probe" c_ntfs_3g_probe
1273 :: GuestfsP -> CInt -> CString -> IO (CInt)
1275 ntfs_3g_probe :: GuestfsH -> Bool -> String -> IO (Int)
1276 ntfs_3g_probe h rw device = do
1277 r <- withCString device $ \device -> withForeignPtr h (\p -> c_ntfs_3g_probe p (fromBool rw) device)
1282 else return (fromIntegral r)
1284 foreign import ccall unsafe "guestfs_scrub_device" c_scrub_device
1285 :: GuestfsP -> CString -> IO (CInt)
1287 scrub_device :: GuestfsH -> String -> IO ()
1288 scrub_device h device = do
1289 r <- withCString device $ \device -> withForeignPtr h (\p -> c_scrub_device p device)
1296 foreign import ccall unsafe "guestfs_scrub_file" c_scrub_file
1297 :: GuestfsP -> CString -> IO (CInt)
1299 scrub_file :: GuestfsH -> String -> IO ()
1300 scrub_file h file = do
1301 r <- withCString file $ \file -> withForeignPtr h (\p -> c_scrub_file p file)
1308 foreign import ccall unsafe "guestfs_scrub_freespace" c_scrub_freespace
1309 :: GuestfsP -> CString -> IO (CInt)
1311 scrub_freespace :: GuestfsH -> String -> IO ()
1312 scrub_freespace h dir = do
1313 r <- withCString dir $ \dir -> withForeignPtr h (\p -> c_scrub_freespace p dir)
1320 foreign import ccall unsafe "guestfs_wc_l" c_wc_l
1321 :: GuestfsP -> CString -> IO (CInt)
1323 wc_l :: GuestfsH -> String -> IO (Int)
1325 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_l p path)
1330 else return (fromIntegral r)
1332 foreign import ccall unsafe "guestfs_wc_w" c_wc_w
1333 :: GuestfsP -> CString -> IO (CInt)
1335 wc_w :: GuestfsH -> String -> IO (Int)
1337 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_w p path)
1342 else return (fromIntegral r)
1344 foreign import ccall unsafe "guestfs_wc_c" c_wc_c
1345 :: GuestfsP -> CString -> IO (CInt)
1347 wc_c :: GuestfsH -> String -> IO (Int)
1349 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_c p path)
1354 else return (fromIntegral r)
1356 foreign import ccall unsafe "guestfs_du" c_du
1357 :: GuestfsP -> CString -> IO (Int64)
1359 du :: GuestfsH -> String -> IO (Integer)
1361 r <- withCString path $ \path -> withForeignPtr h (\p -> c_du p path)
1366 else return (fromIntegral r)
1368 foreign import ccall unsafe "guestfs_mount_loop" c_mount_loop
1369 :: GuestfsP -> CString -> CString -> IO (CInt)
1371 mount_loop :: GuestfsH -> String -> String -> IO ()
1372 mount_loop h file mountpoint = do
1373 r <- withCString file $ \file -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_loop p file mountpoint)
1380 foreign import ccall unsafe "guestfs_mkswap" c_mkswap
1381 :: GuestfsP -> CString -> IO (CInt)
1383 mkswap :: GuestfsH -> String -> IO ()
1384 mkswap h device = do
1385 r <- withCString device $ \device -> withForeignPtr h (\p -> c_mkswap p device)
1392 foreign import ccall unsafe "guestfs_mkswap_L" c_mkswap_L
1393 :: GuestfsP -> CString -> CString -> IO (CInt)
1395 mkswap_L :: GuestfsH -> String -> String -> IO ()
1396 mkswap_L h label device = do
1397 r <- withCString label $ \label -> withCString device $ \device -> withForeignPtr h (\p -> c_mkswap_L p label device)
1404 foreign import ccall unsafe "guestfs_mkswap_U" c_mkswap_U
1405 :: GuestfsP -> CString -> CString -> IO (CInt)
1407 mkswap_U :: GuestfsH -> String -> String -> IO ()
1408 mkswap_U h uuid device = do
1409 r <- withCString uuid $ \uuid -> withCString device $ \device -> withForeignPtr h (\p -> c_mkswap_U p uuid device)