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 #-}
138 import Foreign.C.Types
140 import Control.Exception
143 data GuestfsS = GuestfsS -- represents the opaque C struct
144 type GuestfsP = Ptr GuestfsS -- guestfs_h *
145 type GuestfsH = ForeignPtr GuestfsS -- guestfs_h * with attached finalizer
147 -- XXX define properly later XXX
151 data IntBool = IntBool
153 data StatVFS = StatVFS
154 data Hashtable = Hashtable
156 foreign import ccall unsafe "guestfs_create" c_create
158 foreign import ccall unsafe "&guestfs_close" c_close
159 :: FunPtr (GuestfsP -> IO ())
160 foreign import ccall unsafe "guestfs_set_error_handler" c_set_error_handler
161 :: GuestfsP -> Ptr CInt -> Ptr CInt -> IO ()
163 create :: IO GuestfsH
166 c_set_error_handler p nullPtr nullPtr
167 h <- newForeignPtr c_close p
170 foreign import ccall unsafe "guestfs_last_error" c_last_error
171 :: GuestfsP -> IO CString
173 -- last_error :: GuestfsH -> IO (Maybe String)
175 -- str <- withForeignPtr h (\p -> c_last_error p)
176 -- maybePeek peekCString str
178 last_error :: GuestfsH -> IO (String)
180 str <- withForeignPtr h (\p -> c_last_error p)
182 then return "no error"
185 foreign import ccall unsafe "guestfs_test0" c_test0
186 :: GuestfsP -> CString -> CString -> Ptr CString -> CInt -> CInt -> CString -> CString -> IO (CInt)
188 test0 :: GuestfsH -> String -> Maybe String -> [String] -> Bool -> Int -> String -> String -> IO ()
189 test0 h str optstr strlist b integer filein fileout = do
190 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)
197 foreign import ccall unsafe "guestfs_test0rint" c_test0rint
198 :: GuestfsP -> CString -> IO (CInt)
200 test0rint :: GuestfsH -> String -> IO (Int)
202 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint p val)
207 else return (fromIntegral r)
209 foreign import ccall unsafe "guestfs_test0rinterr" c_test0rinterr
210 :: GuestfsP -> IO (CInt)
212 test0rinterr :: GuestfsH -> IO (Int)
214 r <- withForeignPtr h (\p -> c_test0rinterr p)
219 else return (fromIntegral r)
221 foreign import ccall unsafe "guestfs_test0rint64" c_test0rint64
222 :: GuestfsP -> CString -> IO (Int64)
224 test0rint64 :: GuestfsH -> String -> IO (Integer)
225 test0rint64 h val = do
226 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint64 p val)
231 else return (fromIntegral r)
233 foreign import ccall unsafe "guestfs_test0rint64err" c_test0rint64err
234 :: GuestfsP -> IO (Int64)
236 test0rint64err :: GuestfsH -> IO (Integer)
237 test0rint64err h = do
238 r <- withForeignPtr h (\p -> c_test0rint64err p)
243 else return (fromIntegral r)
245 foreign import ccall unsafe "guestfs_launch" c_launch
246 :: GuestfsP -> IO (CInt)
248 launch :: GuestfsH -> IO ()
250 r <- withForeignPtr h (\p -> c_launch p)
257 foreign import ccall unsafe "guestfs_wait_ready" c_wait_ready
258 :: GuestfsP -> IO (CInt)
260 wait_ready :: GuestfsH -> IO ()
262 r <- withForeignPtr h (\p -> c_wait_ready p)
269 foreign import ccall unsafe "guestfs_kill_subprocess" c_kill_subprocess
270 :: GuestfsP -> IO (CInt)
272 kill_subprocess :: GuestfsH -> IO ()
273 kill_subprocess h = do
274 r <- withForeignPtr h (\p -> c_kill_subprocess p)
281 foreign import ccall unsafe "guestfs_add_drive" c_add_drive
282 :: GuestfsP -> CString -> IO (CInt)
284 add_drive :: GuestfsH -> String -> IO ()
285 add_drive h filename = do
286 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive p filename)
293 foreign import ccall unsafe "guestfs_add_cdrom" c_add_cdrom
294 :: GuestfsP -> CString -> IO (CInt)
296 add_cdrom :: GuestfsH -> String -> IO ()
297 add_cdrom h filename = do
298 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_cdrom p filename)
305 foreign import ccall unsafe "guestfs_add_drive_ro" c_add_drive_ro
306 :: GuestfsP -> CString -> IO (CInt)
308 add_drive_ro :: GuestfsH -> String -> IO ()
309 add_drive_ro h filename = do
310 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive_ro p filename)
317 foreign import ccall unsafe "guestfs_config" c_config
318 :: GuestfsP -> CString -> CString -> IO (CInt)
320 config :: GuestfsH -> String -> Maybe String -> IO ()
321 config h qemuparam qemuvalue = do
322 r <- withCString qemuparam $ \qemuparam -> maybeWith withCString qemuvalue $ \qemuvalue -> withForeignPtr h (\p -> c_config p qemuparam qemuvalue)
329 foreign import ccall unsafe "guestfs_set_qemu" c_set_qemu
330 :: GuestfsP -> CString -> IO (CInt)
332 set_qemu :: GuestfsH -> String -> IO ()
334 r <- withCString qemu $ \qemu -> withForeignPtr h (\p -> c_set_qemu p qemu)
341 foreign import ccall unsafe "guestfs_set_path" c_set_path
342 :: GuestfsP -> CString -> IO (CInt)
344 set_path :: GuestfsH -> String -> IO ()
346 r <- withCString path $ \path -> withForeignPtr h (\p -> c_set_path p path)
353 foreign import ccall unsafe "guestfs_set_append" c_set_append
354 :: GuestfsP -> CString -> IO (CInt)
356 set_append :: GuestfsH -> String -> IO ()
357 set_append h append = do
358 r <- withCString append $ \append -> withForeignPtr h (\p -> c_set_append p append)
365 foreign import ccall unsafe "guestfs_set_autosync" c_set_autosync
366 :: GuestfsP -> CInt -> IO (CInt)
368 set_autosync :: GuestfsH -> Bool -> IO ()
369 set_autosync h autosync = do
370 r <- withForeignPtr h (\p -> c_set_autosync p (fromBool autosync))
377 foreign import ccall unsafe "guestfs_set_verbose" c_set_verbose
378 :: GuestfsP -> CInt -> IO (CInt)
380 set_verbose :: GuestfsH -> Bool -> IO ()
381 set_verbose h verbose = do
382 r <- withForeignPtr h (\p -> c_set_verbose p (fromBool verbose))
389 foreign import ccall unsafe "guestfs_get_state" c_get_state
390 :: GuestfsP -> IO (CInt)
392 get_state :: GuestfsH -> IO (Int)
394 r <- withForeignPtr h (\p -> c_get_state p)
399 else return (fromIntegral r)
401 foreign import ccall unsafe "guestfs_set_busy" c_set_busy
402 :: GuestfsP -> IO (CInt)
404 set_busy :: GuestfsH -> IO ()
406 r <- withForeignPtr h (\p -> c_set_busy p)
413 foreign import ccall unsafe "guestfs_set_ready" c_set_ready
414 :: GuestfsP -> IO (CInt)
416 set_ready :: GuestfsH -> IO ()
418 r <- withForeignPtr h (\p -> c_set_ready p)
425 foreign import ccall unsafe "guestfs_end_busy" c_end_busy
426 :: GuestfsP -> IO (CInt)
428 end_busy :: GuestfsH -> IO ()
430 r <- withForeignPtr h (\p -> c_end_busy p)
437 foreign import ccall unsafe "guestfs_set_memsize" c_set_memsize
438 :: GuestfsP -> CInt -> IO (CInt)
440 set_memsize :: GuestfsH -> Int -> IO ()
441 set_memsize h memsize = do
442 r <- withForeignPtr h (\p -> c_set_memsize p (fromIntegral memsize))
449 foreign import ccall unsafe "guestfs_get_memsize" c_get_memsize
450 :: GuestfsP -> IO (CInt)
452 get_memsize :: GuestfsH -> IO (Int)
454 r <- withForeignPtr h (\p -> c_get_memsize p)
459 else return (fromIntegral r)
461 foreign import ccall unsafe "guestfs_mount" c_mount
462 :: GuestfsP -> CString -> CString -> IO (CInt)
464 mount :: GuestfsH -> String -> String -> IO ()
465 mount h device mountpoint = do
466 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount p device mountpoint)
473 foreign import ccall unsafe "guestfs_sync" c_sync
474 :: GuestfsP -> IO (CInt)
476 sync :: GuestfsH -> IO ()
478 r <- withForeignPtr h (\p -> c_sync p)
485 foreign import ccall unsafe "guestfs_touch" c_touch
486 :: GuestfsP -> CString -> IO (CInt)
488 touch :: GuestfsH -> String -> IO ()
490 r <- withCString path $ \path -> withForeignPtr h (\p -> c_touch p path)
497 foreign import ccall unsafe "guestfs_aug_init" c_aug_init
498 :: GuestfsP -> CString -> CInt -> IO (CInt)
500 aug_init :: GuestfsH -> String -> Int -> IO ()
501 aug_init h root flags = do
502 r <- withCString root $ \root -> withForeignPtr h (\p -> c_aug_init p root (fromIntegral flags))
509 foreign import ccall unsafe "guestfs_aug_close" c_aug_close
510 :: GuestfsP -> IO (CInt)
512 aug_close :: GuestfsH -> IO ()
514 r <- withForeignPtr h (\p -> c_aug_close p)
521 foreign import ccall unsafe "guestfs_aug_defvar" c_aug_defvar
522 :: GuestfsP -> CString -> CString -> IO (CInt)
524 aug_defvar :: GuestfsH -> String -> Maybe String -> IO (Int)
525 aug_defvar h name expr = do
526 r <- withCString name $ \name -> maybeWith withCString expr $ \expr -> withForeignPtr h (\p -> c_aug_defvar p name expr)
531 else return (fromIntegral r)
533 foreign import ccall unsafe "guestfs_aug_set" c_aug_set
534 :: GuestfsP -> CString -> CString -> IO (CInt)
536 aug_set :: GuestfsH -> String -> String -> IO ()
537 aug_set h path val = do
538 r <- withCString path $ \path -> withCString val $ \val -> withForeignPtr h (\p -> c_aug_set p path val)
545 foreign import ccall unsafe "guestfs_aug_insert" c_aug_insert
546 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
548 aug_insert :: GuestfsH -> String -> String -> Bool -> IO ()
549 aug_insert h path label before = do
550 r <- withCString path $ \path -> withCString label $ \label -> withForeignPtr h (\p -> c_aug_insert p path label (fromBool before))
557 foreign import ccall unsafe "guestfs_aug_rm" c_aug_rm
558 :: GuestfsP -> CString -> IO (CInt)
560 aug_rm :: GuestfsH -> String -> IO (Int)
562 r <- withCString path $ \path -> withForeignPtr h (\p -> c_aug_rm p path)
567 else return (fromIntegral r)
569 foreign import ccall unsafe "guestfs_aug_mv" c_aug_mv
570 :: GuestfsP -> CString -> CString -> IO (CInt)
572 aug_mv :: GuestfsH -> String -> String -> IO ()
573 aug_mv h src dest = do
574 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_aug_mv p src dest)
581 foreign import ccall unsafe "guestfs_aug_save" c_aug_save
582 :: GuestfsP -> IO (CInt)
584 aug_save :: GuestfsH -> IO ()
586 r <- withForeignPtr h (\p -> c_aug_save p)
593 foreign import ccall unsafe "guestfs_aug_load" c_aug_load
594 :: GuestfsP -> IO (CInt)
596 aug_load :: GuestfsH -> IO ()
598 r <- withForeignPtr h (\p -> c_aug_load p)
605 foreign import ccall unsafe "guestfs_rm" c_rm
606 :: GuestfsP -> CString -> IO (CInt)
608 rm :: GuestfsH -> String -> IO ()
610 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm p path)
617 foreign import ccall unsafe "guestfs_rmdir" c_rmdir
618 :: GuestfsP -> CString -> IO (CInt)
620 rmdir :: GuestfsH -> String -> IO ()
622 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rmdir p path)
629 foreign import ccall unsafe "guestfs_rm_rf" c_rm_rf
630 :: GuestfsP -> CString -> IO (CInt)
632 rm_rf :: GuestfsH -> String -> IO ()
634 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm_rf p path)
641 foreign import ccall unsafe "guestfs_mkdir" c_mkdir
642 :: GuestfsP -> CString -> IO (CInt)
644 mkdir :: GuestfsH -> String -> IO ()
646 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir p path)
653 foreign import ccall unsafe "guestfs_mkdir_p" c_mkdir_p
654 :: GuestfsP -> CString -> IO (CInt)
656 mkdir_p :: GuestfsH -> String -> IO ()
658 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir_p p path)
665 foreign import ccall unsafe "guestfs_chmod" c_chmod
666 :: GuestfsP -> CInt -> CString -> IO (CInt)
668 chmod :: GuestfsH -> Int -> String -> IO ()
669 chmod h mode path = do
670 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chmod p (fromIntegral mode) path)
677 foreign import ccall unsafe "guestfs_chown" c_chown
678 :: GuestfsP -> CInt -> CInt -> CString -> IO (CInt)
680 chown :: GuestfsH -> Int -> Int -> String -> IO ()
681 chown h owner group path = do
682 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chown p (fromIntegral owner) (fromIntegral group) path)
689 foreign import ccall unsafe "guestfs_pvcreate" c_pvcreate
690 :: GuestfsP -> CString -> IO (CInt)
692 pvcreate :: GuestfsH -> String -> IO ()
693 pvcreate h device = do
694 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvcreate p device)
701 foreign import ccall unsafe "guestfs_vgcreate" c_vgcreate
702 :: GuestfsP -> CString -> Ptr CString -> IO (CInt)
704 vgcreate :: GuestfsH -> String -> [String] -> IO ()
705 vgcreate h volgroup physvols = do
706 r <- withCString volgroup $ \volgroup -> withMany withCString physvols $ \physvols -> withArray0 nullPtr physvols $ \physvols -> withForeignPtr h (\p -> c_vgcreate p volgroup physvols)
713 foreign import ccall unsafe "guestfs_lvcreate" c_lvcreate
714 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
716 lvcreate :: GuestfsH -> String -> String -> Int -> IO ()
717 lvcreate h logvol volgroup mbytes = do
718 r <- withCString logvol $ \logvol -> withCString volgroup $ \volgroup -> withForeignPtr h (\p -> c_lvcreate p logvol volgroup (fromIntegral mbytes))
725 foreign import ccall unsafe "guestfs_mkfs" c_mkfs
726 :: GuestfsP -> CString -> CString -> IO (CInt)
728 mkfs :: GuestfsH -> String -> String -> IO ()
729 mkfs h fstype device = do
730 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_mkfs p fstype device)
737 foreign import ccall unsafe "guestfs_sfdisk" c_sfdisk
738 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> Ptr CString -> IO (CInt)
740 sfdisk :: GuestfsH -> String -> Int -> Int -> Int -> [String] -> IO ()
741 sfdisk h device cyls heads sectors lines = do
742 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)
749 foreign import ccall unsafe "guestfs_write_file" c_write_file
750 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
752 write_file :: GuestfsH -> String -> String -> Int -> IO ()
753 write_file h path content size = do
754 r <- withCString path $ \path -> withCString content $ \content -> withForeignPtr h (\p -> c_write_file p path content (fromIntegral size))
761 foreign import ccall unsafe "guestfs_umount" c_umount
762 :: GuestfsP -> CString -> IO (CInt)
764 umount :: GuestfsH -> String -> IO ()
765 umount h pathordevice = do
766 r <- withCString pathordevice $ \pathordevice -> withForeignPtr h (\p -> c_umount p pathordevice)
773 foreign import ccall unsafe "guestfs_umount_all" c_umount_all
774 :: GuestfsP -> IO (CInt)
776 umount_all :: GuestfsH -> IO ()
778 r <- withForeignPtr h (\p -> c_umount_all p)
785 foreign import ccall unsafe "guestfs_lvm_remove_all" c_lvm_remove_all
786 :: GuestfsP -> IO (CInt)
788 lvm_remove_all :: GuestfsH -> IO ()
789 lvm_remove_all h = do
790 r <- withForeignPtr h (\p -> c_lvm_remove_all p)
797 foreign import ccall unsafe "guestfs_blockdev_setro" c_blockdev_setro
798 :: GuestfsP -> CString -> IO (CInt)
800 blockdev_setro :: GuestfsH -> String -> IO ()
801 blockdev_setro h device = do
802 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setro p device)
809 foreign import ccall unsafe "guestfs_blockdev_setrw" c_blockdev_setrw
810 :: GuestfsP -> CString -> IO (CInt)
812 blockdev_setrw :: GuestfsH -> String -> IO ()
813 blockdev_setrw h device = do
814 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setrw p device)
821 foreign import ccall unsafe "guestfs_blockdev_getss" c_blockdev_getss
822 :: GuestfsP -> CString -> IO (CInt)
824 blockdev_getss :: GuestfsH -> String -> IO (Int)
825 blockdev_getss h device = do
826 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getss p device)
831 else return (fromIntegral r)
833 foreign import ccall unsafe "guestfs_blockdev_getbsz" c_blockdev_getbsz
834 :: GuestfsP -> CString -> IO (CInt)
836 blockdev_getbsz :: GuestfsH -> String -> IO (Int)
837 blockdev_getbsz h device = do
838 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getbsz p device)
843 else return (fromIntegral r)
845 foreign import ccall unsafe "guestfs_blockdev_setbsz" c_blockdev_setbsz
846 :: GuestfsP -> CString -> CInt -> IO (CInt)
848 blockdev_setbsz :: GuestfsH -> String -> Int -> IO ()
849 blockdev_setbsz h device blocksize = do
850 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setbsz p device (fromIntegral blocksize))
857 foreign import ccall unsafe "guestfs_blockdev_getsz" c_blockdev_getsz
858 :: GuestfsP -> CString -> IO (Int64)
860 blockdev_getsz :: GuestfsH -> String -> IO (Integer)
861 blockdev_getsz h device = do
862 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsz p device)
867 else return (fromIntegral r)
869 foreign import ccall unsafe "guestfs_blockdev_getsize64" c_blockdev_getsize64
870 :: GuestfsP -> CString -> IO (Int64)
872 blockdev_getsize64 :: GuestfsH -> String -> IO (Integer)
873 blockdev_getsize64 h device = do
874 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsize64 p device)
879 else return (fromIntegral r)
881 foreign import ccall unsafe "guestfs_blockdev_flushbufs" c_blockdev_flushbufs
882 :: GuestfsP -> CString -> IO (CInt)
884 blockdev_flushbufs :: GuestfsH -> String -> IO ()
885 blockdev_flushbufs h device = do
886 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_flushbufs p device)
893 foreign import ccall unsafe "guestfs_blockdev_rereadpt" c_blockdev_rereadpt
894 :: GuestfsP -> CString -> IO (CInt)
896 blockdev_rereadpt :: GuestfsH -> String -> IO ()
897 blockdev_rereadpt h device = do
898 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_rereadpt p device)
905 foreign import ccall unsafe "guestfs_upload" c_upload
906 :: GuestfsP -> CString -> CString -> IO (CInt)
908 upload :: GuestfsH -> String -> String -> IO ()
909 upload h filename remotefilename = do
910 r <- withCString filename $ \filename -> withCString remotefilename $ \remotefilename -> withForeignPtr h (\p -> c_upload p filename remotefilename)
917 foreign import ccall unsafe "guestfs_download" c_download
918 :: GuestfsP -> CString -> CString -> IO (CInt)
920 download :: GuestfsH -> String -> String -> IO ()
921 download h remotefilename filename = do
922 r <- withCString remotefilename $ \remotefilename -> withCString filename $ \filename -> withForeignPtr h (\p -> c_download p remotefilename filename)
929 foreign import ccall unsafe "guestfs_tar_in" c_tar_in
930 :: GuestfsP -> CString -> CString -> IO (CInt)
932 tar_in :: GuestfsH -> String -> String -> IO ()
933 tar_in h tarfile directory = do
934 r <- withCString tarfile $ \tarfile -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tar_in p tarfile directory)
941 foreign import ccall unsafe "guestfs_tar_out" c_tar_out
942 :: GuestfsP -> CString -> CString -> IO (CInt)
944 tar_out :: GuestfsH -> String -> String -> IO ()
945 tar_out h directory tarfile = do
946 r <- withCString directory $ \directory -> withCString tarfile $ \tarfile -> withForeignPtr h (\p -> c_tar_out p directory tarfile)
953 foreign import ccall unsafe "guestfs_tgz_in" c_tgz_in
954 :: GuestfsP -> CString -> CString -> IO (CInt)
956 tgz_in :: GuestfsH -> String -> String -> IO ()
957 tgz_in h tarball directory = do
958 r <- withCString tarball $ \tarball -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tgz_in p tarball directory)
965 foreign import ccall unsafe "guestfs_tgz_out" c_tgz_out
966 :: GuestfsP -> CString -> CString -> IO (CInt)
968 tgz_out :: GuestfsH -> String -> String -> IO ()
969 tgz_out h directory tarball = do
970 r <- withCString directory $ \directory -> withCString tarball $ \tarball -> withForeignPtr h (\p -> c_tgz_out p directory tarball)
977 foreign import ccall unsafe "guestfs_mount_ro" c_mount_ro
978 :: GuestfsP -> CString -> CString -> IO (CInt)
980 mount_ro :: GuestfsH -> String -> String -> IO ()
981 mount_ro h device mountpoint = do
982 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_ro p device mountpoint)
989 foreign import ccall unsafe "guestfs_mount_options" c_mount_options
990 :: GuestfsP -> CString -> CString -> CString -> IO (CInt)
992 mount_options :: GuestfsH -> String -> String -> String -> IO ()
993 mount_options h options device mountpoint = do
994 r <- withCString options $ \options -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_options p options device mountpoint)
1001 foreign import ccall unsafe "guestfs_mount_vfs" c_mount_vfs
1002 :: GuestfsP -> CString -> CString -> CString -> CString -> IO (CInt)
1004 mount_vfs :: GuestfsH -> String -> String -> String -> String -> IO ()
1005 mount_vfs h options vfstype device mountpoint = do
1006 r <- withCString options $ \options -> withCString vfstype $ \vfstype -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_vfs p options vfstype device mountpoint)
1013 foreign import ccall unsafe "guestfs_lvremove" c_lvremove
1014 :: GuestfsP -> CString -> IO (CInt)
1016 lvremove :: GuestfsH -> String -> IO ()
1017 lvremove h device = do
1018 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvremove p device)
1025 foreign import ccall unsafe "guestfs_vgremove" c_vgremove
1026 :: GuestfsP -> CString -> IO (CInt)
1028 vgremove :: GuestfsH -> String -> IO ()
1029 vgremove h vgname = do
1030 r <- withCString vgname $ \vgname -> withForeignPtr h (\p -> c_vgremove p vgname)
1037 foreign import ccall unsafe "guestfs_pvremove" c_pvremove
1038 :: GuestfsP -> CString -> IO (CInt)
1040 pvremove :: GuestfsH -> String -> IO ()
1041 pvremove h device = do
1042 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvremove p device)
1049 foreign import ccall unsafe "guestfs_set_e2label" c_set_e2label
1050 :: GuestfsP -> CString -> CString -> IO (CInt)
1052 set_e2label :: GuestfsH -> String -> String -> IO ()
1053 set_e2label h device label = do
1054 r <- withCString device $ \device -> withCString label $ \label -> withForeignPtr h (\p -> c_set_e2label p device label)
1061 foreign import ccall unsafe "guestfs_set_e2uuid" c_set_e2uuid
1062 :: GuestfsP -> CString -> CString -> IO (CInt)
1064 set_e2uuid :: GuestfsH -> String -> String -> IO ()
1065 set_e2uuid h device uuid = do
1066 r <- withCString device $ \device -> withCString uuid $ \uuid -> withForeignPtr h (\p -> c_set_e2uuid p device uuid)
1073 foreign import ccall unsafe "guestfs_fsck" c_fsck
1074 :: GuestfsP -> CString -> CString -> IO (CInt)
1076 fsck :: GuestfsH -> String -> String -> IO (Int)
1077 fsck h fstype device = do
1078 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_fsck p fstype device)
1083 else return (fromIntegral r)
1085 foreign import ccall unsafe "guestfs_zero" c_zero
1086 :: GuestfsP -> CString -> IO (CInt)
1088 zero :: GuestfsH -> String -> IO ()
1090 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zero p device)
1097 foreign import ccall unsafe "guestfs_grub_install" c_grub_install
1098 :: GuestfsP -> CString -> CString -> IO (CInt)
1100 grub_install :: GuestfsH -> String -> String -> IO ()
1101 grub_install h root device = do
1102 r <- withCString root $ \root -> withCString device $ \device -> withForeignPtr h (\p -> c_grub_install p root device)
1109 foreign import ccall unsafe "guestfs_cp" c_cp
1110 :: GuestfsP -> CString -> CString -> IO (CInt)
1112 cp :: GuestfsH -> String -> String -> IO ()
1114 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp p src dest)
1121 foreign import ccall unsafe "guestfs_cp_a" c_cp_a
1122 :: GuestfsP -> CString -> CString -> IO (CInt)
1124 cp_a :: GuestfsH -> String -> String -> IO ()
1125 cp_a h src dest = do
1126 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp_a p src dest)
1133 foreign import ccall unsafe "guestfs_mv" c_mv
1134 :: GuestfsP -> CString -> CString -> IO (CInt)
1136 mv :: GuestfsH -> String -> String -> IO ()
1138 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_mv p src dest)
1145 foreign import ccall unsafe "guestfs_drop_caches" c_drop_caches
1146 :: GuestfsP -> CInt -> IO (CInt)
1148 drop_caches :: GuestfsH -> Int -> IO ()
1149 drop_caches h whattodrop = do
1150 r <- withForeignPtr h (\p -> c_drop_caches p (fromIntegral whattodrop))
1157 foreign import ccall unsafe "guestfs_ping_daemon" c_ping_daemon
1158 :: GuestfsP -> IO (CInt)
1160 ping_daemon :: GuestfsH -> IO ()
1162 r <- withForeignPtr h (\p -> c_ping_daemon p)
1169 foreign import ccall unsafe "guestfs_zerofree" c_zerofree
1170 :: GuestfsP -> CString -> IO (CInt)
1172 zerofree :: GuestfsH -> String -> IO ()
1173 zerofree h device = do
1174 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zerofree p device)
1181 foreign import ccall unsafe "guestfs_pvresize" c_pvresize
1182 :: GuestfsP -> CString -> IO (CInt)
1184 pvresize :: GuestfsH -> String -> IO ()
1185 pvresize h device = do
1186 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvresize p device)
1193 foreign import ccall unsafe "guestfs_sfdisk_N" c_sfdisk_N
1194 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (CInt)
1196 sfdisk_N :: GuestfsH -> String -> Int -> Int -> Int -> Int -> String -> IO ()
1197 sfdisk_N h device partnum cyls heads sectors line = do
1198 r <- withCString device $ \device -> withCString line $ \line -> withForeignPtr h (\p -> c_sfdisk_N p device (fromIntegral partnum) (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) line)
1205 foreign import ccall unsafe "guestfs_vg_activate_all" c_vg_activate_all
1206 :: GuestfsP -> CInt -> IO (CInt)
1208 vg_activate_all :: GuestfsH -> Bool -> IO ()
1209 vg_activate_all h activate = do
1210 r <- withForeignPtr h (\p -> c_vg_activate_all p (fromBool activate))
1217 foreign import ccall unsafe "guestfs_vg_activate" c_vg_activate
1218 :: GuestfsP -> CInt -> Ptr CString -> IO (CInt)
1220 vg_activate :: GuestfsH -> Bool -> [String] -> IO ()
1221 vg_activate h activate volgroups = do
1222 r <- withMany withCString volgroups $ \volgroups -> withArray0 nullPtr volgroups $ \volgroups -> withForeignPtr h (\p -> c_vg_activate p (fromBool activate) volgroups)
1229 foreign import ccall unsafe "guestfs_lvresize" c_lvresize
1230 :: GuestfsP -> CString -> CInt -> IO (CInt)
1232 lvresize :: GuestfsH -> String -> Int -> IO ()
1233 lvresize h device mbytes = do
1234 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvresize p device (fromIntegral mbytes))
1241 foreign import ccall unsafe "guestfs_resize2fs" c_resize2fs
1242 :: GuestfsP -> CString -> IO (CInt)
1244 resize2fs :: GuestfsH -> String -> IO ()
1245 resize2fs h device = do
1246 r <- withCString device $ \device -> withForeignPtr h (\p -> c_resize2fs p device)
1253 foreign import ccall unsafe "guestfs_e2fsck_f" c_e2fsck_f
1254 :: GuestfsP -> CString -> IO (CInt)
1256 e2fsck_f :: GuestfsH -> String -> IO ()
1257 e2fsck_f h device = do
1258 r <- withCString device $ \device -> withForeignPtr h (\p -> c_e2fsck_f p device)
1265 foreign import ccall unsafe "guestfs_sleep" c_sleep
1266 :: GuestfsP -> CInt -> IO (CInt)
1268 sleep :: GuestfsH -> Int -> IO ()
1270 r <- withForeignPtr h (\p -> c_sleep p (fromIntegral secs))
1277 foreign import ccall unsafe "guestfs_ntfs_3g_probe" c_ntfs_3g_probe
1278 :: GuestfsP -> CInt -> CString -> IO (CInt)
1280 ntfs_3g_probe :: GuestfsH -> Bool -> String -> IO (Int)
1281 ntfs_3g_probe h rw device = do
1282 r <- withCString device $ \device -> withForeignPtr h (\p -> c_ntfs_3g_probe p (fromBool rw) device)
1287 else return (fromIntegral r)
1289 foreign import ccall unsafe "guestfs_scrub_device" c_scrub_device
1290 :: GuestfsP -> CString -> IO (CInt)
1292 scrub_device :: GuestfsH -> String -> IO ()
1293 scrub_device h device = do
1294 r <- withCString device $ \device -> withForeignPtr h (\p -> c_scrub_device p device)
1301 foreign import ccall unsafe "guestfs_scrub_file" c_scrub_file
1302 :: GuestfsP -> CString -> IO (CInt)
1304 scrub_file :: GuestfsH -> String -> IO ()
1305 scrub_file h file = do
1306 r <- withCString file $ \file -> withForeignPtr h (\p -> c_scrub_file p file)
1313 foreign import ccall unsafe "guestfs_scrub_freespace" c_scrub_freespace
1314 :: GuestfsP -> CString -> IO (CInt)
1316 scrub_freespace :: GuestfsH -> String -> IO ()
1317 scrub_freespace h dir = do
1318 r <- withCString dir $ \dir -> withForeignPtr h (\p -> c_scrub_freespace p dir)
1325 foreign import ccall unsafe "guestfs_wc_l" c_wc_l
1326 :: GuestfsP -> CString -> IO (CInt)
1328 wc_l :: GuestfsH -> String -> IO (Int)
1330 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_l p path)
1335 else return (fromIntegral r)
1337 foreign import ccall unsafe "guestfs_wc_w" c_wc_w
1338 :: GuestfsP -> CString -> IO (CInt)
1340 wc_w :: GuestfsH -> String -> IO (Int)
1342 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_w p path)
1347 else return (fromIntegral r)
1349 foreign import ccall unsafe "guestfs_wc_c" c_wc_c
1350 :: GuestfsP -> CString -> IO (CInt)
1352 wc_c :: GuestfsH -> String -> IO (Int)
1354 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_c p path)
1359 else return (fromIntegral r)
1361 foreign import ccall unsafe "guestfs_du" c_du
1362 :: GuestfsP -> CString -> IO (Int64)
1364 du :: GuestfsH -> String -> IO (Integer)
1366 r <- withCString path $ \path -> withForeignPtr h (\p -> c_du p path)
1371 else return (fromIntegral r)
1373 foreign import ccall unsafe "guestfs_mount_loop" c_mount_loop
1374 :: GuestfsP -> CString -> CString -> IO (CInt)
1376 mount_loop :: GuestfsH -> String -> String -> IO ()
1377 mount_loop h file mountpoint = do
1378 r <- withCString file $ \file -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_loop p file mountpoint)
1385 foreign import ccall unsafe "guestfs_mkswap" c_mkswap
1386 :: GuestfsP -> CString -> IO (CInt)
1388 mkswap :: GuestfsH -> String -> IO ()
1389 mkswap h device = do
1390 r <- withCString device $ \device -> withForeignPtr h (\p -> c_mkswap p device)
1397 foreign import ccall unsafe "guestfs_mkswap_L" c_mkswap_L
1398 :: GuestfsP -> CString -> CString -> IO (CInt)
1400 mkswap_L :: GuestfsH -> String -> String -> IO ()
1401 mkswap_L h label device = do
1402 r <- withCString label $ \label -> withCString device $ \device -> withForeignPtr h (\p -> c_mkswap_L p label device)
1409 foreign import ccall unsafe "guestfs_mkswap_U" c_mkswap_U
1410 :: GuestfsP -> CString -> CString -> IO (CInt)
1412 mkswap_U :: GuestfsH -> String -> String -> IO ()
1413 mkswap_U h uuid device = do
1414 r <- withCString uuid $ \uuid -> withCString device $ \device -> withForeignPtr h (\p -> c_mkswap_U p uuid device)
1421 foreign import ccall unsafe "guestfs_mknod" c_mknod
1422 :: GuestfsP -> CInt -> CInt -> CInt -> CString -> IO (CInt)
1424 mknod :: GuestfsH -> Int -> Int -> Int -> String -> IO ()
1425 mknod h mode devmajor devminor path = do
1426 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mknod p (fromIntegral mode) (fromIntegral devmajor) (fromIntegral devminor) path)
1433 foreign import ccall unsafe "guestfs_mkfifo" c_mkfifo
1434 :: GuestfsP -> CInt -> CString -> IO (CInt)
1436 mkfifo :: GuestfsH -> Int -> String -> IO ()
1437 mkfifo h mode path = do
1438 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkfifo p (fromIntegral mode) path)
1445 foreign import ccall unsafe "guestfs_mknod_b" c_mknod_b
1446 :: GuestfsP -> CInt -> CInt -> CInt -> CString -> IO (CInt)
1448 mknod_b :: GuestfsH -> Int -> Int -> Int -> String -> IO ()
1449 mknod_b h mode devmajor devminor path = do
1450 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mknod_b p (fromIntegral mode) (fromIntegral devmajor) (fromIntegral devminor) path)
1457 foreign import ccall unsafe "guestfs_mknod_c" c_mknod_c
1458 :: GuestfsP -> CInt -> CInt -> CInt -> CString -> IO (CInt)
1460 mknod_c :: GuestfsH -> Int -> Int -> Int -> String -> IO ()
1461 mknod_c h mode devmajor devminor path = do
1462 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mknod_c p (fromIntegral mode) (fromIntegral devmajor) (fromIntegral devminor) path)
1469 foreign import ccall unsafe "guestfs_umask" c_umask
1470 :: GuestfsP -> CInt -> IO (CInt)
1472 umask :: GuestfsH -> Int -> IO (Int)
1474 r <- withForeignPtr h (\p -> c_umask p (fromIntegral mask))
1479 else return (fromIntegral r)