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