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 #-}
127 import Foreign.C.Types
129 import Control.Exception
132 data GuestfsS = GuestfsS -- represents the opaque C struct
133 type GuestfsP = Ptr GuestfsS -- guestfs_h *
134 type GuestfsH = ForeignPtr GuestfsS -- guestfs_h * with attached finalizer
136 -- XXX define properly later XXX
140 data IntBool = IntBool
142 data StatVFS = StatVFS
143 data Hashtable = Hashtable
145 foreign import ccall unsafe "guestfs_create" c_create
147 foreign import ccall unsafe "&guestfs_close" c_close
148 :: FunPtr (GuestfsP -> IO ())
149 foreign import ccall unsafe "guestfs_set_error_handler" c_set_error_handler
150 :: GuestfsP -> Ptr CInt -> Ptr CInt -> IO ()
152 create :: IO GuestfsH
155 c_set_error_handler p nullPtr nullPtr
156 h <- newForeignPtr c_close p
159 foreign import ccall unsafe "guestfs_last_error" c_last_error
160 :: GuestfsP -> IO CString
162 -- last_error :: GuestfsH -> IO (Maybe String)
164 -- str <- withForeignPtr h (\p -> c_last_error p)
165 -- maybePeek peekCString str
167 last_error :: GuestfsH -> IO (String)
169 str <- withForeignPtr h (\p -> c_last_error p)
171 then return "no error"
174 foreign import ccall unsafe "guestfs_test0" c_test0
175 :: GuestfsP -> CString -> CString -> Ptr CString -> CInt -> CInt -> CString -> CString -> IO (CInt)
177 test0 :: GuestfsH -> String -> Maybe String -> [String] -> Bool -> Int -> String -> String -> IO ()
178 test0 h str optstr strlist b integer filein fileout = do
179 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)
186 foreign import ccall unsafe "guestfs_test0rint" c_test0rint
187 :: GuestfsP -> CString -> IO (CInt)
189 test0rint :: GuestfsH -> String -> IO (Int)
191 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint p val)
196 else return (fromIntegral r)
198 foreign import ccall unsafe "guestfs_test0rinterr" c_test0rinterr
199 :: GuestfsP -> IO (CInt)
201 test0rinterr :: GuestfsH -> IO (Int)
203 r <- withForeignPtr h (\p -> c_test0rinterr p)
208 else return (fromIntegral r)
210 foreign import ccall unsafe "guestfs_test0rint64" c_test0rint64
211 :: GuestfsP -> CString -> IO (Int64)
213 test0rint64 :: GuestfsH -> String -> IO (Integer)
214 test0rint64 h val = do
215 r <- withCString val $ \val -> withForeignPtr h (\p -> c_test0rint64 p val)
220 else return (fromIntegral r)
222 foreign import ccall unsafe "guestfs_test0rint64err" c_test0rint64err
223 :: GuestfsP -> IO (Int64)
225 test0rint64err :: GuestfsH -> IO (Integer)
226 test0rint64err h = do
227 r <- withForeignPtr h (\p -> c_test0rint64err p)
232 else return (fromIntegral r)
234 foreign import ccall unsafe "guestfs_launch" c_launch
235 :: GuestfsP -> IO (CInt)
237 launch :: GuestfsH -> IO ()
239 r <- withForeignPtr h (\p -> c_launch p)
246 foreign import ccall unsafe "guestfs_wait_ready" c_wait_ready
247 :: GuestfsP -> IO (CInt)
249 wait_ready :: GuestfsH -> IO ()
251 r <- withForeignPtr h (\p -> c_wait_ready p)
258 foreign import ccall unsafe "guestfs_kill_subprocess" c_kill_subprocess
259 :: GuestfsP -> IO (CInt)
261 kill_subprocess :: GuestfsH -> IO ()
262 kill_subprocess h = do
263 r <- withForeignPtr h (\p -> c_kill_subprocess p)
270 foreign import ccall unsafe "guestfs_add_drive" c_add_drive
271 :: GuestfsP -> CString -> IO (CInt)
273 add_drive :: GuestfsH -> String -> IO ()
274 add_drive h filename = do
275 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive p filename)
282 foreign import ccall unsafe "guestfs_add_cdrom" c_add_cdrom
283 :: GuestfsP -> CString -> IO (CInt)
285 add_cdrom :: GuestfsH -> String -> IO ()
286 add_cdrom h filename = do
287 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_cdrom p filename)
294 foreign import ccall unsafe "guestfs_add_drive_ro" c_add_drive_ro
295 :: GuestfsP -> CString -> IO (CInt)
297 add_drive_ro :: GuestfsH -> String -> IO ()
298 add_drive_ro h filename = do
299 r <- withCString filename $ \filename -> withForeignPtr h (\p -> c_add_drive_ro p filename)
306 foreign import ccall unsafe "guestfs_config" c_config
307 :: GuestfsP -> CString -> CString -> IO (CInt)
309 config :: GuestfsH -> String -> Maybe String -> IO ()
310 config h qemuparam qemuvalue = do
311 r <- withCString qemuparam $ \qemuparam -> maybeWith withCString qemuvalue $ \qemuvalue -> withForeignPtr h (\p -> c_config p qemuparam qemuvalue)
318 foreign import ccall unsafe "guestfs_set_qemu" c_set_qemu
319 :: GuestfsP -> CString -> IO (CInt)
321 set_qemu :: GuestfsH -> String -> IO ()
323 r <- withCString qemu $ \qemu -> withForeignPtr h (\p -> c_set_qemu p qemu)
330 foreign import ccall unsafe "guestfs_set_path" c_set_path
331 :: GuestfsP -> CString -> IO (CInt)
333 set_path :: GuestfsH -> String -> IO ()
335 r <- withCString path $ \path -> withForeignPtr h (\p -> c_set_path p path)
342 foreign import ccall unsafe "guestfs_set_append" c_set_append
343 :: GuestfsP -> CString -> IO (CInt)
345 set_append :: GuestfsH -> String -> IO ()
346 set_append h append = do
347 r <- withCString append $ \append -> withForeignPtr h (\p -> c_set_append p append)
354 foreign import ccall unsafe "guestfs_set_autosync" c_set_autosync
355 :: GuestfsP -> CInt -> IO (CInt)
357 set_autosync :: GuestfsH -> Bool -> IO ()
358 set_autosync h autosync = do
359 r <- withForeignPtr h (\p -> c_set_autosync p (fromBool autosync))
366 foreign import ccall unsafe "guestfs_set_verbose" c_set_verbose
367 :: GuestfsP -> CInt -> IO (CInt)
369 set_verbose :: GuestfsH -> Bool -> IO ()
370 set_verbose h verbose = do
371 r <- withForeignPtr h (\p -> c_set_verbose p (fromBool verbose))
378 foreign import ccall unsafe "guestfs_get_state" c_get_state
379 :: GuestfsP -> IO (CInt)
381 get_state :: GuestfsH -> IO (Int)
383 r <- withForeignPtr h (\p -> c_get_state p)
388 else return (fromIntegral r)
390 foreign import ccall unsafe "guestfs_set_busy" c_set_busy
391 :: GuestfsP -> IO (CInt)
393 set_busy :: GuestfsH -> IO ()
395 r <- withForeignPtr h (\p -> c_set_busy p)
402 foreign import ccall unsafe "guestfs_set_ready" c_set_ready
403 :: GuestfsP -> IO (CInt)
405 set_ready :: GuestfsH -> IO ()
407 r <- withForeignPtr h (\p -> c_set_ready p)
414 foreign import ccall unsafe "guestfs_end_busy" c_end_busy
415 :: GuestfsP -> IO (CInt)
417 end_busy :: GuestfsH -> IO ()
419 r <- withForeignPtr h (\p -> c_end_busy p)
426 foreign import ccall unsafe "guestfs_mount" c_mount
427 :: GuestfsP -> CString -> CString -> IO (CInt)
429 mount :: GuestfsH -> String -> String -> IO ()
430 mount h device mountpoint = do
431 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount p device mountpoint)
438 foreign import ccall unsafe "guestfs_sync" c_sync
439 :: GuestfsP -> IO (CInt)
441 sync :: GuestfsH -> IO ()
443 r <- withForeignPtr h (\p -> c_sync p)
450 foreign import ccall unsafe "guestfs_touch" c_touch
451 :: GuestfsP -> CString -> IO (CInt)
453 touch :: GuestfsH -> String -> IO ()
455 r <- withCString path $ \path -> withForeignPtr h (\p -> c_touch p path)
462 foreign import ccall unsafe "guestfs_aug_init" c_aug_init
463 :: GuestfsP -> CString -> CInt -> IO (CInt)
465 aug_init :: GuestfsH -> String -> Int -> IO ()
466 aug_init h root flags = do
467 r <- withCString root $ \root -> withForeignPtr h (\p -> c_aug_init p root (fromIntegral flags))
474 foreign import ccall unsafe "guestfs_aug_close" c_aug_close
475 :: GuestfsP -> IO (CInt)
477 aug_close :: GuestfsH -> IO ()
479 r <- withForeignPtr h (\p -> c_aug_close p)
486 foreign import ccall unsafe "guestfs_aug_defvar" c_aug_defvar
487 :: GuestfsP -> CString -> CString -> IO (CInt)
489 aug_defvar :: GuestfsH -> String -> Maybe String -> IO (Int)
490 aug_defvar h name expr = do
491 r <- withCString name $ \name -> maybeWith withCString expr $ \expr -> withForeignPtr h (\p -> c_aug_defvar p name expr)
496 else return (fromIntegral r)
498 foreign import ccall unsafe "guestfs_aug_set" c_aug_set
499 :: GuestfsP -> CString -> CString -> IO (CInt)
501 aug_set :: GuestfsH -> String -> String -> IO ()
502 aug_set h path val = do
503 r <- withCString path $ \path -> withCString val $ \val -> withForeignPtr h (\p -> c_aug_set p path val)
510 foreign import ccall unsafe "guestfs_aug_insert" c_aug_insert
511 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
513 aug_insert :: GuestfsH -> String -> String -> Bool -> IO ()
514 aug_insert h path label before = do
515 r <- withCString path $ \path -> withCString label $ \label -> withForeignPtr h (\p -> c_aug_insert p path label (fromBool before))
522 foreign import ccall unsafe "guestfs_aug_rm" c_aug_rm
523 :: GuestfsP -> CString -> IO (CInt)
525 aug_rm :: GuestfsH -> String -> IO (Int)
527 r <- withCString path $ \path -> withForeignPtr h (\p -> c_aug_rm p path)
532 else return (fromIntegral r)
534 foreign import ccall unsafe "guestfs_aug_mv" c_aug_mv
535 :: GuestfsP -> CString -> CString -> IO (CInt)
537 aug_mv :: GuestfsH -> String -> String -> IO ()
538 aug_mv h src dest = do
539 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_aug_mv p src dest)
546 foreign import ccall unsafe "guestfs_aug_save" c_aug_save
547 :: GuestfsP -> IO (CInt)
549 aug_save :: GuestfsH -> IO ()
551 r <- withForeignPtr h (\p -> c_aug_save p)
558 foreign import ccall unsafe "guestfs_aug_load" c_aug_load
559 :: GuestfsP -> IO (CInt)
561 aug_load :: GuestfsH -> IO ()
563 r <- withForeignPtr h (\p -> c_aug_load p)
570 foreign import ccall unsafe "guestfs_rm" c_rm
571 :: GuestfsP -> CString -> IO (CInt)
573 rm :: GuestfsH -> String -> IO ()
575 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm p path)
582 foreign import ccall unsafe "guestfs_rmdir" c_rmdir
583 :: GuestfsP -> CString -> IO (CInt)
585 rmdir :: GuestfsH -> String -> IO ()
587 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rmdir p path)
594 foreign import ccall unsafe "guestfs_rm_rf" c_rm_rf
595 :: GuestfsP -> CString -> IO (CInt)
597 rm_rf :: GuestfsH -> String -> IO ()
599 r <- withCString path $ \path -> withForeignPtr h (\p -> c_rm_rf p path)
606 foreign import ccall unsafe "guestfs_mkdir" c_mkdir
607 :: GuestfsP -> CString -> IO (CInt)
609 mkdir :: GuestfsH -> String -> IO ()
611 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir p path)
618 foreign import ccall unsafe "guestfs_mkdir_p" c_mkdir_p
619 :: GuestfsP -> CString -> IO (CInt)
621 mkdir_p :: GuestfsH -> String -> IO ()
623 r <- withCString path $ \path -> withForeignPtr h (\p -> c_mkdir_p p path)
630 foreign import ccall unsafe "guestfs_chmod" c_chmod
631 :: GuestfsP -> CInt -> CString -> IO (CInt)
633 chmod :: GuestfsH -> Int -> String -> IO ()
634 chmod h mode path = do
635 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chmod p (fromIntegral mode) path)
642 foreign import ccall unsafe "guestfs_chown" c_chown
643 :: GuestfsP -> CInt -> CInt -> CString -> IO (CInt)
645 chown :: GuestfsH -> Int -> Int -> String -> IO ()
646 chown h owner group path = do
647 r <- withCString path $ \path -> withForeignPtr h (\p -> c_chown p (fromIntegral owner) (fromIntegral group) path)
654 foreign import ccall unsafe "guestfs_pvcreate" c_pvcreate
655 :: GuestfsP -> CString -> IO (CInt)
657 pvcreate :: GuestfsH -> String -> IO ()
658 pvcreate h device = do
659 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvcreate p device)
666 foreign import ccall unsafe "guestfs_vgcreate" c_vgcreate
667 :: GuestfsP -> CString -> Ptr CString -> IO (CInt)
669 vgcreate :: GuestfsH -> String -> [String] -> IO ()
670 vgcreate h volgroup physvols = do
671 r <- withCString volgroup $ \volgroup -> withMany withCString physvols $ \physvols -> withArray0 nullPtr physvols $ \physvols -> withForeignPtr h (\p -> c_vgcreate p volgroup physvols)
678 foreign import ccall unsafe "guestfs_lvcreate" c_lvcreate
679 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
681 lvcreate :: GuestfsH -> String -> String -> Int -> IO ()
682 lvcreate h logvol volgroup mbytes = do
683 r <- withCString logvol $ \logvol -> withCString volgroup $ \volgroup -> withForeignPtr h (\p -> c_lvcreate p logvol volgroup (fromIntegral mbytes))
690 foreign import ccall unsafe "guestfs_mkfs" c_mkfs
691 :: GuestfsP -> CString -> CString -> IO (CInt)
693 mkfs :: GuestfsH -> String -> String -> IO ()
694 mkfs h fstype device = do
695 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_mkfs p fstype device)
702 foreign import ccall unsafe "guestfs_sfdisk" c_sfdisk
703 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> Ptr CString -> IO (CInt)
705 sfdisk :: GuestfsH -> String -> Int -> Int -> Int -> [String] -> IO ()
706 sfdisk h device cyls heads sectors lines = do
707 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)
714 foreign import ccall unsafe "guestfs_write_file" c_write_file
715 :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
717 write_file :: GuestfsH -> String -> String -> Int -> IO ()
718 write_file h path content size = do
719 r <- withCString path $ \path -> withCString content $ \content -> withForeignPtr h (\p -> c_write_file p path content (fromIntegral size))
726 foreign import ccall unsafe "guestfs_umount" c_umount
727 :: GuestfsP -> CString -> IO (CInt)
729 umount :: GuestfsH -> String -> IO ()
730 umount h pathordevice = do
731 r <- withCString pathordevice $ \pathordevice -> withForeignPtr h (\p -> c_umount p pathordevice)
738 foreign import ccall unsafe "guestfs_umount_all" c_umount_all
739 :: GuestfsP -> IO (CInt)
741 umount_all :: GuestfsH -> IO ()
743 r <- withForeignPtr h (\p -> c_umount_all p)
750 foreign import ccall unsafe "guestfs_lvm_remove_all" c_lvm_remove_all
751 :: GuestfsP -> IO (CInt)
753 lvm_remove_all :: GuestfsH -> IO ()
754 lvm_remove_all h = do
755 r <- withForeignPtr h (\p -> c_lvm_remove_all p)
762 foreign import ccall unsafe "guestfs_blockdev_setro" c_blockdev_setro
763 :: GuestfsP -> CString -> IO (CInt)
765 blockdev_setro :: GuestfsH -> String -> IO ()
766 blockdev_setro h device = do
767 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setro p device)
774 foreign import ccall unsafe "guestfs_blockdev_setrw" c_blockdev_setrw
775 :: GuestfsP -> CString -> IO (CInt)
777 blockdev_setrw :: GuestfsH -> String -> IO ()
778 blockdev_setrw h device = do
779 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setrw p device)
786 foreign import ccall unsafe "guestfs_blockdev_getss" c_blockdev_getss
787 :: GuestfsP -> CString -> IO (CInt)
789 blockdev_getss :: GuestfsH -> String -> IO (Int)
790 blockdev_getss h device = do
791 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getss p device)
796 else return (fromIntegral r)
798 foreign import ccall unsafe "guestfs_blockdev_getbsz" c_blockdev_getbsz
799 :: GuestfsP -> CString -> IO (CInt)
801 blockdev_getbsz :: GuestfsH -> String -> IO (Int)
802 blockdev_getbsz h device = do
803 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getbsz p device)
808 else return (fromIntegral r)
810 foreign import ccall unsafe "guestfs_blockdev_setbsz" c_blockdev_setbsz
811 :: GuestfsP -> CString -> CInt -> IO (CInt)
813 blockdev_setbsz :: GuestfsH -> String -> Int -> IO ()
814 blockdev_setbsz h device blocksize = do
815 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setbsz p device (fromIntegral blocksize))
822 foreign import ccall unsafe "guestfs_blockdev_getsz" c_blockdev_getsz
823 :: GuestfsP -> CString -> IO (Int64)
825 blockdev_getsz :: GuestfsH -> String -> IO (Integer)
826 blockdev_getsz h device = do
827 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsz p device)
832 else return (fromIntegral r)
834 foreign import ccall unsafe "guestfs_blockdev_getsize64" c_blockdev_getsize64
835 :: GuestfsP -> CString -> IO (Int64)
837 blockdev_getsize64 :: GuestfsH -> String -> IO (Integer)
838 blockdev_getsize64 h device = do
839 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_getsize64 p device)
844 else return (fromIntegral r)
846 foreign import ccall unsafe "guestfs_blockdev_flushbufs" c_blockdev_flushbufs
847 :: GuestfsP -> CString -> IO (CInt)
849 blockdev_flushbufs :: GuestfsH -> String -> IO ()
850 blockdev_flushbufs h device = do
851 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_flushbufs p device)
858 foreign import ccall unsafe "guestfs_blockdev_rereadpt" c_blockdev_rereadpt
859 :: GuestfsP -> CString -> IO (CInt)
861 blockdev_rereadpt :: GuestfsH -> String -> IO ()
862 blockdev_rereadpt h device = do
863 r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_rereadpt p device)
870 foreign import ccall unsafe "guestfs_upload" c_upload
871 :: GuestfsP -> CString -> CString -> IO (CInt)
873 upload :: GuestfsH -> String -> String -> IO ()
874 upload h filename remotefilename = do
875 r <- withCString filename $ \filename -> withCString remotefilename $ \remotefilename -> withForeignPtr h (\p -> c_upload p filename remotefilename)
882 foreign import ccall unsafe "guestfs_download" c_download
883 :: GuestfsP -> CString -> CString -> IO (CInt)
885 download :: GuestfsH -> String -> String -> IO ()
886 download h remotefilename filename = do
887 r <- withCString remotefilename $ \remotefilename -> withCString filename $ \filename -> withForeignPtr h (\p -> c_download p remotefilename filename)
894 foreign import ccall unsafe "guestfs_tar_in" c_tar_in
895 :: GuestfsP -> CString -> CString -> IO (CInt)
897 tar_in :: GuestfsH -> String -> String -> IO ()
898 tar_in h tarfile directory = do
899 r <- withCString tarfile $ \tarfile -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tar_in p tarfile directory)
906 foreign import ccall unsafe "guestfs_tar_out" c_tar_out
907 :: GuestfsP -> CString -> CString -> IO (CInt)
909 tar_out :: GuestfsH -> String -> String -> IO ()
910 tar_out h directory tarfile = do
911 r <- withCString directory $ \directory -> withCString tarfile $ \tarfile -> withForeignPtr h (\p -> c_tar_out p directory tarfile)
918 foreign import ccall unsafe "guestfs_tgz_in" c_tgz_in
919 :: GuestfsP -> CString -> CString -> IO (CInt)
921 tgz_in :: GuestfsH -> String -> String -> IO ()
922 tgz_in h tarball directory = do
923 r <- withCString tarball $ \tarball -> withCString directory $ \directory -> withForeignPtr h (\p -> c_tgz_in p tarball directory)
930 foreign import ccall unsafe "guestfs_tgz_out" c_tgz_out
931 :: GuestfsP -> CString -> CString -> IO (CInt)
933 tgz_out :: GuestfsH -> String -> String -> IO ()
934 tgz_out h directory tarball = do
935 r <- withCString directory $ \directory -> withCString tarball $ \tarball -> withForeignPtr h (\p -> c_tgz_out p directory tarball)
942 foreign import ccall unsafe "guestfs_mount_ro" c_mount_ro
943 :: GuestfsP -> CString -> CString -> IO (CInt)
945 mount_ro :: GuestfsH -> String -> String -> IO ()
946 mount_ro h device mountpoint = do
947 r <- withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_ro p device mountpoint)
954 foreign import ccall unsafe "guestfs_mount_options" c_mount_options
955 :: GuestfsP -> CString -> CString -> CString -> IO (CInt)
957 mount_options :: GuestfsH -> String -> String -> String -> IO ()
958 mount_options h options device mountpoint = do
959 r <- withCString options $ \options -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_options p options device mountpoint)
966 foreign import ccall unsafe "guestfs_mount_vfs" c_mount_vfs
967 :: GuestfsP -> CString -> CString -> CString -> CString -> IO (CInt)
969 mount_vfs :: GuestfsH -> String -> String -> String -> String -> IO ()
970 mount_vfs h options vfstype device mountpoint = do
971 r <- withCString options $ \options -> withCString vfstype $ \vfstype -> withCString device $ \device -> withCString mountpoint $ \mountpoint -> withForeignPtr h (\p -> c_mount_vfs p options vfstype device mountpoint)
978 foreign import ccall unsafe "guestfs_lvremove" c_lvremove
979 :: GuestfsP -> CString -> IO (CInt)
981 lvremove :: GuestfsH -> String -> IO ()
982 lvremove h device = do
983 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvremove p device)
990 foreign import ccall unsafe "guestfs_vgremove" c_vgremove
991 :: GuestfsP -> CString -> IO (CInt)
993 vgremove :: GuestfsH -> String -> IO ()
994 vgremove h vgname = do
995 r <- withCString vgname $ \vgname -> withForeignPtr h (\p -> c_vgremove p vgname)
1002 foreign import ccall unsafe "guestfs_pvremove" c_pvremove
1003 :: GuestfsP -> CString -> IO (CInt)
1005 pvremove :: GuestfsH -> String -> IO ()
1006 pvremove h device = do
1007 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvremove p device)
1014 foreign import ccall unsafe "guestfs_set_e2label" c_set_e2label
1015 :: GuestfsP -> CString -> CString -> IO (CInt)
1017 set_e2label :: GuestfsH -> String -> String -> IO ()
1018 set_e2label h device label = do
1019 r <- withCString device $ \device -> withCString label $ \label -> withForeignPtr h (\p -> c_set_e2label p device label)
1026 foreign import ccall unsafe "guestfs_set_e2uuid" c_set_e2uuid
1027 :: GuestfsP -> CString -> CString -> IO (CInt)
1029 set_e2uuid :: GuestfsH -> String -> String -> IO ()
1030 set_e2uuid h device uuid = do
1031 r <- withCString device $ \device -> withCString uuid $ \uuid -> withForeignPtr h (\p -> c_set_e2uuid p device uuid)
1038 foreign import ccall unsafe "guestfs_fsck" c_fsck
1039 :: GuestfsP -> CString -> CString -> IO (CInt)
1041 fsck :: GuestfsH -> String -> String -> IO (Int)
1042 fsck h fstype device = do
1043 r <- withCString fstype $ \fstype -> withCString device $ \device -> withForeignPtr h (\p -> c_fsck p fstype device)
1048 else return (fromIntegral r)
1050 foreign import ccall unsafe "guestfs_zero" c_zero
1051 :: GuestfsP -> CString -> IO (CInt)
1053 zero :: GuestfsH -> String -> IO ()
1055 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zero p device)
1062 foreign import ccall unsafe "guestfs_grub_install" c_grub_install
1063 :: GuestfsP -> CString -> CString -> IO (CInt)
1065 grub_install :: GuestfsH -> String -> String -> IO ()
1066 grub_install h root device = do
1067 r <- withCString root $ \root -> withCString device $ \device -> withForeignPtr h (\p -> c_grub_install p root device)
1074 foreign import ccall unsafe "guestfs_cp" c_cp
1075 :: GuestfsP -> CString -> CString -> IO (CInt)
1077 cp :: GuestfsH -> String -> String -> IO ()
1079 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp p src dest)
1086 foreign import ccall unsafe "guestfs_cp_a" c_cp_a
1087 :: GuestfsP -> CString -> CString -> IO (CInt)
1089 cp_a :: GuestfsH -> String -> String -> IO ()
1090 cp_a h src dest = do
1091 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_cp_a p src dest)
1098 foreign import ccall unsafe "guestfs_mv" c_mv
1099 :: GuestfsP -> CString -> CString -> IO (CInt)
1101 mv :: GuestfsH -> String -> String -> IO ()
1103 r <- withCString src $ \src -> withCString dest $ \dest -> withForeignPtr h (\p -> c_mv p src dest)
1110 foreign import ccall unsafe "guestfs_drop_caches" c_drop_caches
1111 :: GuestfsP -> CInt -> IO (CInt)
1113 drop_caches :: GuestfsH -> Int -> IO ()
1114 drop_caches h whattodrop = do
1115 r <- withForeignPtr h (\p -> c_drop_caches p (fromIntegral whattodrop))
1122 foreign import ccall unsafe "guestfs_ping_daemon" c_ping_daemon
1123 :: GuestfsP -> IO (CInt)
1125 ping_daemon :: GuestfsH -> IO ()
1127 r <- withForeignPtr h (\p -> c_ping_daemon p)
1134 foreign import ccall unsafe "guestfs_zerofree" c_zerofree
1135 :: GuestfsP -> CString -> IO (CInt)
1137 zerofree :: GuestfsH -> String -> IO ()
1138 zerofree h device = do
1139 r <- withCString device $ \device -> withForeignPtr h (\p -> c_zerofree p device)
1146 foreign import ccall unsafe "guestfs_pvresize" c_pvresize
1147 :: GuestfsP -> CString -> IO (CInt)
1149 pvresize :: GuestfsH -> String -> IO ()
1150 pvresize h device = do
1151 r <- withCString device $ \device -> withForeignPtr h (\p -> c_pvresize p device)
1158 foreign import ccall unsafe "guestfs_sfdisk_N" c_sfdisk_N
1159 :: GuestfsP -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (CInt)
1161 sfdisk_N :: GuestfsH -> String -> Int -> Int -> Int -> Int -> String -> IO ()
1162 sfdisk_N h device partnum cyls heads sectors line = do
1163 r <- withCString device $ \device -> withCString line $ \line -> withForeignPtr h (\p -> c_sfdisk_N p device (fromIntegral partnum) (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) line)
1170 foreign import ccall unsafe "guestfs_vg_activate_all" c_vg_activate_all
1171 :: GuestfsP -> CInt -> IO (CInt)
1173 vg_activate_all :: GuestfsH -> Bool -> IO ()
1174 vg_activate_all h activate = do
1175 r <- withForeignPtr h (\p -> c_vg_activate_all p (fromBool activate))
1182 foreign import ccall unsafe "guestfs_vg_activate" c_vg_activate
1183 :: GuestfsP -> CInt -> Ptr CString -> IO (CInt)
1185 vg_activate :: GuestfsH -> Bool -> [String] -> IO ()
1186 vg_activate h activate volgroups = do
1187 r <- withMany withCString volgroups $ \volgroups -> withArray0 nullPtr volgroups $ \volgroups -> withForeignPtr h (\p -> c_vg_activate p (fromBool activate) volgroups)
1194 foreign import ccall unsafe "guestfs_lvresize" c_lvresize
1195 :: GuestfsP -> CString -> CInt -> IO (CInt)
1197 lvresize :: GuestfsH -> String -> Int -> IO ()
1198 lvresize h device mbytes = do
1199 r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvresize p device (fromIntegral mbytes))
1206 foreign import ccall unsafe "guestfs_resize2fs" c_resize2fs
1207 :: GuestfsP -> CString -> IO (CInt)
1209 resize2fs :: GuestfsH -> String -> IO ()
1210 resize2fs h device = do
1211 r <- withCString device $ \device -> withForeignPtr h (\p -> c_resize2fs p device)
1218 foreign import ccall unsafe "guestfs_e2fsck_f" c_e2fsck_f
1219 :: GuestfsP -> CString -> IO (CInt)
1221 e2fsck_f :: GuestfsH -> String -> IO ()
1222 e2fsck_f h device = do
1223 r <- withCString device $ \device -> withForeignPtr h (\p -> c_e2fsck_f p device)
1230 foreign import ccall unsafe "guestfs_sleep" c_sleep
1231 :: GuestfsP -> CInt -> IO (CInt)
1233 sleep :: GuestfsH -> Int -> IO ()
1235 r <- withForeignPtr h (\p -> c_sleep p (fromIntegral secs))
1242 foreign import ccall unsafe "guestfs_ntfs_3g_probe" c_ntfs_3g_probe
1243 :: GuestfsP -> CInt -> CString -> IO (CInt)
1245 ntfs_3g_probe :: GuestfsH -> Bool -> String -> IO (Int)
1246 ntfs_3g_probe h rw device = do
1247 r <- withCString device $ \device -> withForeignPtr h (\p -> c_ntfs_3g_probe p (fromBool rw) device)
1252 else return (fromIntegral r)
1254 foreign import ccall unsafe "guestfs_scrub_device" c_scrub_device
1255 :: GuestfsP -> CString -> IO (CInt)
1257 scrub_device :: GuestfsH -> String -> IO ()
1258 scrub_device h device = do
1259 r <- withCString device $ \device -> withForeignPtr h (\p -> c_scrub_device p device)
1266 foreign import ccall unsafe "guestfs_scrub_file" c_scrub_file
1267 :: GuestfsP -> CString -> IO (CInt)
1269 scrub_file :: GuestfsH -> String -> IO ()
1270 scrub_file h file = do
1271 r <- withCString file $ \file -> withForeignPtr h (\p -> c_scrub_file p file)
1278 foreign import ccall unsafe "guestfs_scrub_freespace" c_scrub_freespace
1279 :: GuestfsP -> CString -> IO (CInt)
1281 scrub_freespace :: GuestfsH -> String -> IO ()
1282 scrub_freespace h dir = do
1283 r <- withCString dir $ \dir -> withForeignPtr h (\p -> c_scrub_freespace p dir)
1290 foreign import ccall unsafe "guestfs_wc_l" c_wc_l
1291 :: GuestfsP -> CString -> IO (CInt)
1293 wc_l :: GuestfsH -> String -> IO (Int)
1295 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_l p path)
1300 else return (fromIntegral r)
1302 foreign import ccall unsafe "guestfs_wc_w" c_wc_w
1303 :: GuestfsP -> CString -> IO (CInt)
1305 wc_w :: GuestfsH -> String -> IO (Int)
1307 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_w p path)
1312 else return (fromIntegral r)
1314 foreign import ccall unsafe "guestfs_wc_c" c_wc_c
1315 :: GuestfsP -> CString -> IO (CInt)
1317 wc_c :: GuestfsH -> String -> IO (Int)
1319 r <- withCString path $ \path -> withForeignPtr h (\p -> c_wc_c p path)
1324 else return (fromIntegral r)
1326 foreign import ccall unsafe "guestfs_du" c_du
1327 :: GuestfsP -> CString -> IO (Int64)
1329 du :: GuestfsH -> String -> IO (Integer)
1331 r <- withCString path $ \path -> withForeignPtr h (\p -> c_du p path)
1336 else return (fromIntegral r)