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 #-}
128 import Foreign.C.Types
130 import Control.Exception
133 data GuestfsS = GuestfsS -- represents the opaque C struct
134 type GuestfsP = Ptr GuestfsS -- guestfs_h *
135 type GuestfsH = ForeignPtr GuestfsS -- guestfs_h * with attached finalizer
137 -- XXX define properly later XXX
141 data IntBool = IntBool
143 data StatVFS = StatVFS
144 data Hashtable = Hashtable
146 foreign import ccall unsafe "guestfs_create" c_create
148 foreign import ccall unsafe "&guestfs_close" c_close
149 :: FunPtr (GuestfsP -> IO ())
150 foreign import ccall unsafe "guestfs_set_error_handler" c_set_error_handler
151 :: GuestfsP -> Ptr CInt -> Ptr CInt -> IO ()
153 create :: IO GuestfsH
156 c_set_error_handler p nullPtr nullPtr
157 h <- newForeignPtr c_close p
160 foreign import ccall unsafe "guestfs_last_error" c_last_error
161 :: GuestfsP -> IO CString
163 -- last_error :: GuestfsH -> IO (Maybe String)
165 -- str <- withForeignPtr h (\p -> c_last_error p)
166 -- maybePeek peekCString str
168 last_error :: GuestfsH -> IO (String)
170 str <- withForeignPtr h (\p -> c_last_error p)
172 then return "no error"
175 foreign import ccall unsafe "guestfs_test0" c_test0
176 :: GuestfsP -> CString -> CString -> Ptr CString -> CInt -> CInt -> CString -> CString -> IO (CInt)
178 test0 :: GuestfsH -> String -> Maybe String -> [String] -> Bool -> Int -> String -> String -> IO ()
179 test0 h str optstr strlist b integer filein fileout = do
180 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)
187 foreign import ccall unsafe "guestfs_test0rint" c_test0rint
188 :: GuestfsP -> CString -> IO (CInt)
190 test0rint :: GuestfsH -> String -> IO (Int)
192 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint p val)
197 else return (fromIntegral r)
199 foreign import ccall unsafe "guestfs_test0rinterr" c_test0rinterr
200 :: GuestfsP -> IO (CInt)
202 test0rinterr :: GuestfsH -> IO (Int)
204 r <- withForeignPtr h (\p -> c_test0rinterr p)
209 else return (fromIntegral r)
211 foreign import ccall unsafe "guestfs_test0rint64" c_test0rint64
212 :: GuestfsP -> CString -> IO (Int64)
214 test0rint64 :: GuestfsH -> String -> IO (Integer)
215 test0rint64 h val = do
216 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint64 p val)
221 else return (fromIntegral r)
223 foreign import ccall unsafe "guestfs_test0rint64err" c_test0rint64err
224 :: GuestfsP -> IO (Int64)
226 test0rint64err :: GuestfsH -> IO (Integer)
227 test0rint64err h = do
228 r <- withForeignPtr h (\p -> c_test0rint64err p)
233 else return (fromIntegral r)
235 foreign import ccall unsafe "guestfs_launch" c_launch
236 :: GuestfsP -> IO (CInt)
238 launch :: GuestfsH -> IO ()
240 r <- withForeignPtr h (\p -> c_launch p)
247 foreign import ccall unsafe "guestfs_wait_ready" c_wait_ready
248 :: GuestfsP -> IO (CInt)
250 wait_ready :: GuestfsH -> IO ()
252 r <- withForeignPtr h (\p -> c_wait_ready p)
259 foreign import ccall unsafe "guestfs_kill_subprocess" c_kill_subprocess
260 :: GuestfsP -> IO (CInt)
262 kill_subprocess :: GuestfsH -> IO ()
263 kill_subprocess h = do
264 r <- withForeignPtr h (\p -> c_kill_subprocess p)
271 foreign import ccall unsafe "guestfs_add_drive" c_add_drive
272 :: GuestfsP -> CString -> IO (CInt)
274 add_drive :: GuestfsH -> String -> IO ()
275 add_drive h filename = do
276 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive p filename)
283 foreign import ccall unsafe "guestfs_add_cdrom" c_add_cdrom
284 :: GuestfsP -> CString -> IO (CInt)
286 add_cdrom :: GuestfsH -> String -> IO ()
287 add_cdrom h filename = do
288 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_cdrom p filename)
295 foreign import ccall unsafe "guestfs_add_drive_ro" c_add_drive_ro
296 :: GuestfsP -> CString -> IO (CInt)
298 add_drive_ro :: GuestfsH -> String -> IO ()
299 add_drive_ro h filename = do
300 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive_ro p filename)
307 foreign import ccall unsafe "guestfs_config" c_config
308 :: GuestfsP -> CString -> CString -> IO (CInt)
310 config :: GuestfsH -> String -> Maybe String -> IO ()
311 config h qemuparam qemuvalue = do
312 r <- withCString qemuparam $ \qemuparam -> maybeWith withCString qemuvalue $ \qemuvalue -> withForeignPtr h (\p -> c_config p qemuparam qemuvalue)
319 foreign import ccall unsafe "guestfs_set_qemu" c_set_qemu
320 :: GuestfsP -> CString -> IO (CInt)
322 set_qemu :: GuestfsH -> String -> IO ()
324 r <- withCString qemu $ \qemu -> withForeignPtr h (\p -> c_set_qemu p qemu)
331 foreign import ccall unsafe "guestfs_set_path" c_set_path
332 :: GuestfsP -> CString -> IO (CInt)
334 set_path :: GuestfsH -> String -> IO ()
336 r <- withCString path $ \path -> withForeignPtr h (\p -> c_set_path p path)
343 foreign import ccall unsafe "guestfs_set_append" c_set_append
344 :: GuestfsP -> CString -> IO (CInt)
346 set_append :: GuestfsH -> String -> IO ()
347 set_append h append = do
348 r <- withCString append $ \append -> withForeignPtr h (\p -> c_set_append p append)
355 foreign import ccall unsafe "guestfs_set_autosync" c_set_autosync
356 :: GuestfsP -> CInt -> IO (CInt)
358 set_autosync :: GuestfsH -> Bool -> IO ()
359 set_autosync h autosync = do
360 r <- withForeignPtr h (\p -> c_set_autosync p (fromBool autosync))
367 foreign import ccall unsafe "guestfs_set_verbose" c_set_verbose
368 :: GuestfsP -> CInt -> IO (CInt)
370 set_verbose :: GuestfsH -> Bool -> IO ()
371 set_verbose h verbose = do
372 r <- withForeignPtr h (\p -> c_set_verbose p (fromBool verbose))
379 foreign import ccall unsafe "guestfs_get_state" c_get_state
380 :: GuestfsP -> IO (CInt)
382 get_state :: GuestfsH -> IO (Int)
384 r <- withForeignPtr h (\p -> c_get_state p)
389 else return (fromIntegral r)
391 foreign import ccall unsafe "guestfs_set_busy" c_set_busy
392 :: GuestfsP -> IO (CInt)
394 set_busy :: GuestfsH -> IO ()
396 r <- withForeignPtr h (\p -> c_set_busy p)
403 foreign import ccall unsafe "guestfs_set_ready" c_set_ready
404 :: GuestfsP -> IO (CInt)
406 set_ready :: GuestfsH -> IO ()
408 r <- withForeignPtr h (\p -> c_set_ready p)
415 foreign import ccall unsafe "guestfs_end_busy" c_end_busy
416 :: GuestfsP -> IO (CInt)
418 end_busy :: GuestfsH -> IO ()
420 r <- withForeignPtr h (\p -> c_end_busy p)
427 foreign import ccall unsafe "guestfs_mount" c_mount
428 :: GuestfsP -> CString -> CString -> IO (CInt)
430 mount :: GuestfsH -> String -> String -> IO ()
431 mount h device mountpoint = do
432 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount p device mountpoint)
439 foreign import ccall unsafe "guestfs_sync" c_sync
440 :: GuestfsP -> IO (CInt)
442 sync :: GuestfsH -> IO ()
444 r <- withForeignPtr h (\p -> c_sync p)
451 foreign import ccall unsafe "guestfs_touch" c_touch
452 :: GuestfsP -> CString -> IO (CInt)
454 touch :: GuestfsH -> String -> IO ()
456 r <- withCString path $ \path -> withForeignPtr h (\p -> c_touch p path)
463 foreign import ccall unsafe "guestfs_aug_init" c_aug_init
464 :: GuestfsP -> CString -> CInt -> IO (CInt)
466 aug_init :: GuestfsH -> String -> Int -> IO ()
467 aug_init h root flags = do
468 r <- withCString root $ \root -> withForeignPtr h (\p -> c_aug_init p root (fromIntegral flags))
475 foreign import ccall unsafe "guestfs_aug_close" c_aug_close
476 :: GuestfsP -> IO (CInt)
478 aug_close :: GuestfsH -> IO ()
480 r <- withForeignPtr h (\p -> c_aug_close p)
487 foreign import ccall unsafe "guestfs_aug_defvar" c_aug_defvar
488 :: GuestfsP -> CString -> CString -> IO (CInt)
490 aug_defvar :: GuestfsH -> String -> Maybe String -> IO (Int)
491 aug_defvar h name expr = do
492 r <- withCString name $ \name -> maybeWith withCString expr $ \expr -> withForeignPtr h (\p -> c_aug_defvar p name expr)
497 else return (fromIntegral r)
499 foreign import ccall unsafe "guestfs_aug_set" c_aug_set
500 :: GuestfsP -> CString -> CString -> IO (CInt)
502 aug_set :: GuestfsH -> String -> String -> IO ()
503 aug_set h path val = do
504 r <- withCString path $ \path -> withCString val $ \val -> withForeignPtr h (\p -> c_aug_set p path val)
511 foreign import ccall unsafe "guestfs_aug_insert" c_aug_insert
512 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
514 aug_insert :: GuestfsH -> String -> String -> Bool -> IO ()
515 aug_insert h path label before = do
516 r <- withCString path $ \path -> withCString label $ \label -> withForeignPtr h (\p -> c_aug_insert p path label (fromBool before))
523 foreign import ccall unsafe "guestfs_aug_rm" c_aug_rm
524 :: GuestfsP -> CString -> IO (CInt)
526 aug_rm :: GuestfsH -> String -> IO (Int)
528 r <- withCString path $ \path -> withForeignPtr h (\p -> c_aug_rm p path)
533 else return (fromIntegral r)
535 foreign import ccall unsafe "guestfs_aug_mv" c_aug_mv
536 :: GuestfsP -> CString -> CString -> IO (CInt)
538 aug_mv :: GuestfsH -> String -> String -> IO ()
539 aug_mv h src dest = do
540 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_aug_mv p src dest)
547 foreign import ccall unsafe "guestfs_aug_save" c_aug_save
548 :: GuestfsP -> IO (CInt)
550 aug_save :: GuestfsH -> IO ()
552 r <- withForeignPtr h (\p -> c_aug_save p)
559 foreign import ccall unsafe "guestfs_aug_load" c_aug_load
560 :: GuestfsP -> IO (CInt)
562 aug_load :: GuestfsH -> IO ()
564 r <- withForeignPtr h (\p -> c_aug_load p)
571 foreign import ccall unsafe "guestfs_rm" c_rm
572 :: GuestfsP -> CString -> IO (CInt)
574 rm :: GuestfsH -> String -> IO ()
576 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm p path)
583 foreign import ccall unsafe "guestfs_rmdir" c_rmdir
584 :: GuestfsP -> CString -> IO (CInt)
586 rmdir :: GuestfsH -> String -> IO ()
588 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rmdir p path)
595 foreign import ccall unsafe "guestfs_rm_rf" c_rm_rf
596 :: GuestfsP -> CString -> IO (CInt)
598 rm_rf :: GuestfsH -> String -> IO ()
600 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm_rf p path)
607 foreign import ccall unsafe "guestfs_mkdir" c_mkdir
608 :: GuestfsP -> CString -> IO (CInt)
610 mkdir :: GuestfsH -> String -> IO ()
612 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir p path)
619 foreign import ccall unsafe "guestfs_mkdir_p" c_mkdir_p
620 :: GuestfsP -> CString -> IO (CInt)
622 mkdir_p :: GuestfsH -> String -> IO ()
624 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir_p p path)
631 foreign import ccall unsafe "guestfs_chmod" c_chmod
632 :: GuestfsP -> CInt -> CString -> IO (CInt)
634 chmod :: GuestfsH -> Int -> String -> IO ()
635 chmod h mode path = do
636 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chmod p (fromIntegral mode) path)
643 foreign import ccall unsafe "guestfs_chown" c_chown
644 :: GuestfsP -> CInt -> CInt -> CString -> IO (CInt)
646 chown :: GuestfsH -> Int -> Int -> String -> IO ()
647 chown h owner group path = do
648 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chown p (fromIntegral owner) (fromIntegral group) path)
655 foreign import ccall unsafe "guestfs_pvcreate" c_pvcreate
656 :: GuestfsP -> CString -> IO (CInt)
658 pvcreate :: GuestfsH -> String -> IO ()
659 pvcreate h device = do
660 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvcreate p device)
667 foreign import ccall unsafe "guestfs_vgcreate" c_vgcreate
668 :: GuestfsP -> CString -> Ptr CString -> IO (CInt)
670 vgcreate :: GuestfsH -> String -> [String] -> IO ()
671 vgcreate h volgroup physvols = do
672 r <- withCString volgroup $ \volgroup -> withMany withCString physvols $ \physvols -> withArray0 nullPtr physvols $ \physvols -> withForeignPtr h (\p -> c_vgcreate p volgroup physvols)
679 foreign import ccall unsafe "guestfs_lvcreate" c_lvcreate
680 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
682 lvcreate :: GuestfsH -> String -> String -> Int -> IO ()
683 lvcreate h logvol volgroup mbytes = do
684 r <- withCString logvol $ \logvol -> withCString volgroup $ \volgroup -> withForeignPtr h (\p -> c_lvcreate p logvol volgroup (fromIntegral mbytes))
691 foreign import ccall unsafe "guestfs_mkfs" c_mkfs
692 :: GuestfsP -> CString -> CString -> IO (CInt)
694 mkfs :: GuestfsH -> String -> String -> IO ()
695 mkfs h fstype device = do
696 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_mkfs p fstype device)
703 foreign import ccall unsafe "guestfs_sfdisk" c_sfdisk
704 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> Ptr CString -> IO (CInt)
706 sfdisk :: GuestfsH -> String -> Int -> Int -> Int -> [String] -> IO ()
707 sfdisk h device cyls heads sectors lines = do
708 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)
715 foreign import ccall unsafe "guestfs_write_file" c_write_file
716 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
718 write_file :: GuestfsH -> String -> String -> Int -> IO ()
719 write_file h path content size = do
720 r <- withCString path $ \path -> withCString content $ \content -> withForeignPtr h (\p -> c_write_file p path content (fromIntegral size))
727 foreign import ccall unsafe "guestfs_umount" c_umount
728 :: GuestfsP -> CString -> IO (CInt)
730 umount :: GuestfsH -> String -> IO ()
731 umount h pathordevice = do
732 r <- withCString pathordevice $ \pathordevice -> withForeignPtr h (\p -> c_umount p pathordevice)
739 foreign import ccall unsafe "guestfs_umount_all" c_umount_all
740 :: GuestfsP -> IO (CInt)
742 umount_all :: GuestfsH -> IO ()
744 r <- withForeignPtr h (\p -> c_umount_all p)
751 foreign import ccall unsafe "guestfs_lvm_remove_all" c_lvm_remove_all
752 :: GuestfsP -> IO (CInt)
754 lvm_remove_all :: GuestfsH -> IO ()
755 lvm_remove_all h = do
756 r <- withForeignPtr h (\p -> c_lvm_remove_all p)
763 foreign import ccall unsafe "guestfs_blockdev_setro" c_blockdev_setro
764 :: GuestfsP -> CString -> IO (CInt)
766 blockdev_setro :: GuestfsH -> String -> IO ()
767 blockdev_setro h device = do
768 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setro p device)
775 foreign import ccall unsafe "guestfs_blockdev_setrw" c_blockdev_setrw
776 :: GuestfsP -> CString -> IO (CInt)
778 blockdev_setrw :: GuestfsH -> String -> IO ()
779 blockdev_setrw h device = do
780 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setrw p device)
787 foreign import ccall unsafe "guestfs_blockdev_getss" c_blockdev_getss
788 :: GuestfsP -> CString -> IO (CInt)
790 blockdev_getss :: GuestfsH -> String -> IO (Int)
791 blockdev_getss h device = do
792 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getss p device)
797 else return (fromIntegral r)
799 foreign import ccall unsafe "guestfs_blockdev_getbsz" c_blockdev_getbsz
800 :: GuestfsP -> CString -> IO (CInt)
802 blockdev_getbsz :: GuestfsH -> String -> IO (Int)
803 blockdev_getbsz h device = do
804 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getbsz p device)
809 else return (fromIntegral r)
811 foreign import ccall unsafe "guestfs_blockdev_setbsz" c_blockdev_setbsz
812 :: GuestfsP -> CString -> CInt -> IO (CInt)
814 blockdev_setbsz :: GuestfsH -> String -> Int -> IO ()
815 blockdev_setbsz h device blocksize = do
816 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setbsz p device (fromIntegral blocksize))
823 foreign import ccall unsafe "guestfs_blockdev_getsz" c_blockdev_getsz
824 :: GuestfsP -> CString -> IO (Int64)
826 blockdev_getsz :: GuestfsH -> String -> IO (Integer)
827 blockdev_getsz h device = do
828 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsz p device)
833 else return (fromIntegral r)
835 foreign import ccall unsafe "guestfs_blockdev_getsize64" c_blockdev_getsize64
836 :: GuestfsP -> CString -> IO (Int64)
838 blockdev_getsize64 :: GuestfsH -> String -> IO (Integer)
839 blockdev_getsize64 h device = do
840 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsize64 p device)
845 else return (fromIntegral r)
847 foreign import ccall unsafe "guestfs_blockdev_flushbufs" c_blockdev_flushbufs
848 :: GuestfsP -> CString -> IO (CInt)
850 blockdev_flushbufs :: GuestfsH -> String -> IO ()
851 blockdev_flushbufs h device = do
852 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_flushbufs p device)
859 foreign import ccall unsafe "guestfs_blockdev_rereadpt" c_blockdev_rereadpt
860 :: GuestfsP -> CString -> IO (CInt)
862 blockdev_rereadpt :: GuestfsH -> String -> IO ()
863 blockdev_rereadpt h device = do
864 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_rereadpt p device)
871 foreign import ccall unsafe "guestfs_upload" c_upload
872 :: GuestfsP -> CString -> CString -> IO (CInt)
874 upload :: GuestfsH -> String -> String -> IO ()
875 upload h filename remotefilename = do
876 r <- withCString filename $ \filename -> withCString remotefilename $ \remotefilename -> withForeignPtr h (\p -> c_upload p filename remotefilename)
883 foreign import ccall unsafe "guestfs_download" c_download
884 :: GuestfsP -> CString -> CString -> IO (CInt)
886 download :: GuestfsH -> String -> String -> IO ()
887 download h remotefilename filename = do
888 r <- withCString remotefilename $ \remotefilename -> withCString filename $ \filename -> withForeignPtr h (\p -> c_download p remotefilename filename)
895 foreign import ccall unsafe "guestfs_tar_in" c_tar_in
896 :: GuestfsP -> CString -> CString -> IO (CInt)
898 tar_in :: GuestfsH -> String -> String -> IO ()
899 tar_in h tarfile directory = do
900 r <- withCString tarfile $ \tarfile -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tar_in p tarfile directory)
907 foreign import ccall unsafe "guestfs_tar_out" c_tar_out
908 :: GuestfsP -> CString -> CString -> IO (CInt)
910 tar_out :: GuestfsH -> String -> String -> IO ()
911 tar_out h directory tarfile = do
912 r <- withCString directory $ \directory -> withCString tarfile $ \tarfile -> withForeignPtr h (\p -> c_tar_out p directory tarfile)
919 foreign import ccall unsafe "guestfs_tgz_in" c_tgz_in
920 :: GuestfsP -> CString -> CString -> IO (CInt)
922 tgz_in :: GuestfsH -> String -> String -> IO ()
923 tgz_in h tarball directory = do
924 r <- withCString tarball $ \tarball -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tgz_in p tarball directory)
931 foreign import ccall unsafe "guestfs_tgz_out" c_tgz_out
932 :: GuestfsP -> CString -> CString -> IO (CInt)
934 tgz_out :: GuestfsH -> String -> String -> IO ()
935 tgz_out h directory tarball = do
936 r <- withCString directory $ \directory -> withCString tarball $ \tarball -> withForeignPtr h (\p -> c_tgz_out p directory tarball)
943 foreign import ccall unsafe "guestfs_mount_ro" c_mount_ro
944 :: GuestfsP -> CString -> CString -> IO (CInt)
946 mount_ro :: GuestfsH -> String -> String -> IO ()
947 mount_ro h device mountpoint = do
948 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_ro p device mountpoint)
955 foreign import ccall unsafe "guestfs_mount_options" c_mount_options
956 :: GuestfsP -> CString -> CString -> CString -> IO (CInt)
958 mount_options :: GuestfsH -> String -> String -> String -> IO ()
959 mount_options h options device mountpoint = do
960 r <- withCString options $ \options -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_options p options device mountpoint)
967 foreign import ccall unsafe "guestfs_mount_vfs" c_mount_vfs
968 :: GuestfsP -> CString -> CString -> CString -> CString -> IO (CInt)
970 mount_vfs :: GuestfsH -> String -> String -> String -> String -> IO ()
971 mount_vfs h options vfstype device mountpoint = do
972 r <- withCString options $ \options -> withCString vfstype $ \vfstype -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_vfs p options vfstype device mountpoint)
979 foreign import ccall unsafe "guestfs_lvremove" c_lvremove
980 :: GuestfsP -> CString -> IO (CInt)
982 lvremove :: GuestfsH -> String -> IO ()
983 lvremove h device = do
984 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvremove p device)
991 foreign import ccall unsafe "guestfs_vgremove" c_vgremove
992 :: GuestfsP -> CString -> IO (CInt)
994 vgremove :: GuestfsH -> String -> IO ()
995 vgremove h vgname = do
996 r <- withCString vgname $ \vgname -> withForeignPtr h (\p -> c_vgremove p vgname)
1003 foreign import ccall unsafe "guestfs_pvremove" c_pvremove
1004 :: GuestfsP -> CString -> IO (CInt)
1006 pvremove :: GuestfsH -> String -> IO ()
1007 pvremove h device = do
1008 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvremove p device)
1015 foreign import ccall unsafe "guestfs_set_e2label" c_set_e2label
1016 :: GuestfsP -> CString -> CString -> IO (CInt)
1018 set_e2label :: GuestfsH -> String -> String -> IO ()
1019 set_e2label h device label = do
1020 r <- withCString device $ \device -> withCString label $ \label -> withForeignPtr h (\p -> c_set_e2label p device label)
1027 foreign import ccall unsafe "guestfs_set_e2uuid" c_set_e2uuid
1028 :: GuestfsP -> CString -> CString -> IO (CInt)
1030 set_e2uuid :: GuestfsH -> String -> String -> IO ()
1031 set_e2uuid h device uuid = do
1032 r <- withCString device $ \device -> withCString uuid $ \uuid -> withForeignPtr h (\p -> c_set_e2uuid p device uuid)
1039 foreign import ccall unsafe "guestfs_fsck" c_fsck
1040 :: GuestfsP -> CString -> CString -> IO (CInt)
1042 fsck :: GuestfsH -> String -> String -> IO (Int)
1043 fsck h fstype device = do
1044 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_fsck p fstype device)
1049 else return (fromIntegral r)
1051 foreign import ccall unsafe "guestfs_zero" c_zero
1052 :: GuestfsP -> CString -> IO (CInt)
1054 zero :: GuestfsH -> String -> IO ()
1056 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zero p device)
1063 foreign import ccall unsafe "guestfs_grub_install" c_grub_install
1064 :: GuestfsP -> CString -> CString -> IO (CInt)
1066 grub_install :: GuestfsH -> String -> String -> IO ()
1067 grub_install h root device = do
1068 r <- withCString root $ \root -> withCString device $ \device -> withForeignPtr h (\p -> c_grub_install p root device)
1075 foreign import ccall unsafe "guestfs_cp" c_cp
1076 :: GuestfsP -> CString -> CString -> IO (CInt)
1078 cp :: GuestfsH -> String -> String -> IO ()
1080 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp p src dest)
1087 foreign import ccall unsafe "guestfs_cp_a" c_cp_a
1088 :: GuestfsP -> CString -> CString -> IO (CInt)
1090 cp_a :: GuestfsH -> String -> String -> IO ()
1091 cp_a h src dest = do
1092 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp_a p src dest)
1099 foreign import ccall unsafe "guestfs_mv" c_mv
1100 :: GuestfsP -> CString -> CString -> IO (CInt)
1102 mv :: GuestfsH -> String -> String -> IO ()
1104 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_mv p src dest)
1111 foreign import ccall unsafe "guestfs_drop_caches" c_drop_caches
1112 :: GuestfsP -> CInt -> IO (CInt)
1114 drop_caches :: GuestfsH -> Int -> IO ()
1115 drop_caches h whattodrop = do
1116 r <- withForeignPtr h (\p -> c_drop_caches p (fromIntegral whattodrop))
1123 foreign import ccall unsafe "guestfs_ping_daemon" c_ping_daemon
1124 :: GuestfsP -> IO (CInt)
1126 ping_daemon :: GuestfsH -> IO ()
1128 r <- withForeignPtr h (\p -> c_ping_daemon p)
1135 foreign import ccall unsafe "guestfs_zerofree" c_zerofree
1136 :: GuestfsP -> CString -> IO (CInt)
1138 zerofree :: GuestfsH -> String -> IO ()
1139 zerofree h device = do
1140 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zerofree p device)
1147 foreign import ccall unsafe "guestfs_pvresize" c_pvresize
1148 :: GuestfsP -> CString -> IO (CInt)
1150 pvresize :: GuestfsH -> String -> IO ()
1151 pvresize h device = do
1152 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvresize p device)
1159 foreign import ccall unsafe "guestfs_sfdisk_N" c_sfdisk_N
1160 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (CInt)
1162 sfdisk_N :: GuestfsH -> String -> Int -> Int -> Int -> Int -> String -> IO ()
1163 sfdisk_N h device partnum cyls heads sectors line = do
1164 r <- withCString device $ \device -> withCString line $ \line -> withForeignPtr h (\p -> c_sfdisk_N p device (fromIntegral partnum) (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) line)
1171 foreign import ccall unsafe "guestfs_vg_activate_all" c_vg_activate_all
1172 :: GuestfsP -> CInt -> IO (CInt)
1174 vg_activate_all :: GuestfsH -> Bool -> IO ()
1175 vg_activate_all h activate = do
1176 r <- withForeignPtr h (\p -> c_vg_activate_all p (fromBool activate))
1183 foreign import ccall unsafe "guestfs_vg_activate" c_vg_activate
1184 :: GuestfsP -> CInt -> Ptr CString -> IO (CInt)
1186 vg_activate :: GuestfsH -> Bool -> [String] -> IO ()
1187 vg_activate h activate volgroups = do
1188 r <- withMany withCString volgroups $ \volgroups -> withArray0 nullPtr volgroups $ \volgroups -> withForeignPtr h (\p -> c_vg_activate p (fromBool activate) volgroups)
1195 foreign import ccall unsafe "guestfs_lvresize" c_lvresize
1196 :: GuestfsP -> CString -> CInt -> IO (CInt)
1198 lvresize :: GuestfsH -> String -> Int -> IO ()
1199 lvresize h device mbytes = do
1200 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvresize p device (fromIntegral mbytes))
1207 foreign import ccall unsafe "guestfs_resize2fs" c_resize2fs
1208 :: GuestfsP -> CString -> IO (CInt)
1210 resize2fs :: GuestfsH -> String -> IO ()
1211 resize2fs h device = do
1212 r <- withCString device $ \device -> withForeignPtr h (\p -> c_resize2fs p device)
1219 foreign import ccall unsafe "guestfs_e2fsck_f" c_e2fsck_f
1220 :: GuestfsP -> CString -> IO (CInt)
1222 e2fsck_f :: GuestfsH -> String -> IO ()
1223 e2fsck_f h device = do
1224 r <- withCString device $ \device -> withForeignPtr h (\p -> c_e2fsck_f p device)
1231 foreign import ccall unsafe "guestfs_sleep" c_sleep
1232 :: GuestfsP -> CInt -> IO (CInt)
1234 sleep :: GuestfsH -> Int -> IO ()
1236 r <- withForeignPtr h (\p -> c_sleep p (fromIntegral secs))
1243 foreign import ccall unsafe "guestfs_ntfs_3g_probe" c_ntfs_3g_probe
1244 :: GuestfsP -> CInt -> CString -> IO (CInt)
1246 ntfs_3g_probe :: GuestfsH -> Bool -> String -> IO (Int)
1247 ntfs_3g_probe h rw device = do
1248 r <- withCString device $ \device -> withForeignPtr h (\p -> c_ntfs_3g_probe p (fromBool rw) device)
1253 else return (fromIntegral r)
1255 foreign import ccall unsafe "guestfs_scrub_device" c_scrub_device
1256 :: GuestfsP -> CString -> IO (CInt)
1258 scrub_device :: GuestfsH -> String -> IO ()
1259 scrub_device h device = do
1260 r <- withCString device $ \device -> withForeignPtr h (\p -> c_scrub_device p device)
1267 foreign import ccall unsafe "guestfs_scrub_file" c_scrub_file
1268 :: GuestfsP -> CString -> IO (CInt)
1270 scrub_file :: GuestfsH -> String -> IO ()
1271 scrub_file h file = do
1272 r <- withCString file $ \file -> withForeignPtr h (\p -> c_scrub_file p file)
1279 foreign import ccall unsafe "guestfs_scrub_freespace" c_scrub_freespace
1280 :: GuestfsP -> CString -> IO (CInt)
1282 scrub_freespace :: GuestfsH -> String -> IO ()
1283 scrub_freespace h dir = do
1284 r <- withCString dir $ \dir -> withForeignPtr h (\p -> c_scrub_freespace p dir)
1291 foreign import ccall unsafe "guestfs_wc_l" c_wc_l
1292 :: GuestfsP -> CString -> IO (CInt)
1294 wc_l :: GuestfsH -> String -> IO (Int)
1296 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_l p path)
1301 else return (fromIntegral r)
1303 foreign import ccall unsafe "guestfs_wc_w" c_wc_w
1304 :: GuestfsP -> CString -> IO (CInt)
1306 wc_w :: GuestfsH -> String -> IO (Int)
1308 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_w p path)
1313 else return (fromIntegral r)
1315 foreign import ccall unsafe "guestfs_wc_c" c_wc_c
1316 :: GuestfsP -> CString -> IO (CInt)
1318 wc_c :: GuestfsH -> String -> IO (Int)
1320 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_c p path)
1325 else return (fromIntegral r)
1327 foreign import ccall unsafe "guestfs_du" c_du
1328 :: GuestfsP -> CString -> IO (Int64)
1330 du :: GuestfsH -> String -> IO (Integer)
1332 r <- withCString path $ \path -> withForeignPtr h (\p -> c_du p path)
1337 else return (fromIntegral r)
1339 foreign import ccall unsafe "guestfs_mount_loop" c_mount_loop
1340 :: GuestfsP -> CString -> CString -> IO (CInt)
1342 mount_loop :: GuestfsH -> String -> String -> IO ()
1343 mount_loop h file mountpoint = do
1344 r <- withCString file $ \file -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_loop p file mountpoint)