summaryrefslogtreecommitdiffstats
path: root/haskell
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-28 13:17:23 +0200
committerRichard W.M. Jones <rjones@redhat.com>2009-06-28 13:17:23 +0200
commitec34c2bfbfcc53eadf823536dc182710e19b48b2 (patch)
tree0201e435b3058a857863fe60128293a0c35f6184 /haskell
parent247225c4415b28d02a82b7fc4dfdd35728437711 (diff)
downloadlibguestfs-ec34c2bfbfcc53eadf823536dc182710e19b48b2.tar.gz
libguestfs-ec34c2bfbfcc53eadf823536dc182710e19b48b2.tar.xz
libguestfs-ec34c2bfbfcc53eadf823536dc182710e19b48b2.zip
Haskell bindings: Fix integer arguments.
Diffstat (limited to 'haskell')
-rw-r--r--haskell/Guestfs.hs144
1 files changed, 144 insertions, 0 deletions
diff --git a/haskell/Guestfs.hs b/haskell/Guestfs.hs
index ddbad469..4a0021e9 100644
--- a/haskell/Guestfs.hs
+++ b/haskell/Guestfs.hs
@@ -40,6 +40,7 @@ module Guestfs (
mount,
sync,
touch,
+ aug_init,
aug_close,
aug_set,
aug_mv,
@@ -50,14 +51,20 @@ module Guestfs (
rm_rf,
mkdir,
mkdir_p,
+ chmod,
+ chown,
pvcreate,
vgcreate,
+ lvcreate,
mkfs,
+ sfdisk,
+ write_file,
umount,
umount_all,
lvm_remove_all,
blockdev_setro,
blockdev_setrw,
+ blockdev_setbsz,
blockdev_flushbufs,
blockdev_rereadpt,
upload,
@@ -79,17 +86,22 @@ module Guestfs (
cp,
cp_a,
mv,
+ drop_caches,
ping_daemon,
zerofree,
pvresize,
+ sfdisk_N,
+ lvresize,
resize2fs,
e2fsck_f,
+ sleep,
scrub_device,
scrub_file,
scrub_freespace
) where
import Foreign
import Foreign.C
+import Foreign.C.Types
import IO
import Control.Exception
import Data.Typeable
@@ -328,6 +340,18 @@ touch h path = do
fail err
else return ()
+foreign import ccall unsafe "guestfs_aug_init" c_aug_init
+ :: GuestfsP -> CString -> CInt -> IO (CInt)
+
+aug_init :: GuestfsH -> String -> Int -> IO ()
+aug_init h root flags = do
+ r <- withCString root $ \root -> withForeignPtr h (\p -> c_aug_init p root (fromIntegral flags))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_aug_close" c_aug_close
:: GuestfsP -> IO (CInt)
@@ -448,6 +472,30 @@ mkdir_p h path = do
fail err
else return ()
+foreign import ccall unsafe "guestfs_chmod" c_chmod
+ :: GuestfsP -> CInt -> CString -> IO (CInt)
+
+chmod :: GuestfsH -> Int -> String -> IO ()
+chmod h mode path = do
+ r <- withCString path $ \path -> withForeignPtr h (\p -> c_chmod p (fromIntegral mode) path)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
+foreign import ccall unsafe "guestfs_chown" c_chown
+ :: GuestfsP -> CInt -> CInt -> CString -> IO (CInt)
+
+chown :: GuestfsH -> Int -> Int -> String -> IO ()
+chown h owner group path = do
+ r <- withCString path $ \path -> withForeignPtr h (\p -> c_chown p (fromIntegral owner) (fromIntegral group) path)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_pvcreate" c_pvcreate
:: GuestfsP -> CString -> IO (CInt)
@@ -472,6 +520,18 @@ vgcreate h volgroup physvols = do
fail err
else return ()
+foreign import ccall unsafe "guestfs_lvcreate" c_lvcreate
+ :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
+
+lvcreate :: GuestfsH -> String -> String -> Int -> IO ()
+lvcreate h logvol volgroup mbytes = do
+ r <- withCString logvol $ \logvol -> withCString volgroup $ \volgroup -> withForeignPtr h (\p -> c_lvcreate p logvol volgroup (fromIntegral mbytes))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_mkfs" c_mkfs
:: GuestfsP -> CString -> CString -> IO (CInt)
@@ -484,6 +544,30 @@ mkfs h fstype device = do
fail err
else return ()
+foreign import ccall unsafe "guestfs_sfdisk" c_sfdisk
+ :: GuestfsP -> CString -> CInt -> CInt -> CInt -> Ptr CString -> IO (CInt)
+
+sfdisk :: GuestfsH -> String -> Int -> Int -> Int -> [String] -> IO ()
+sfdisk h device cyls heads sectors lines = do
+ 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)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
+foreign import ccall unsafe "guestfs_write_file" c_write_file
+ :: GuestfsP -> CString -> CString -> CInt -> IO (CInt)
+
+write_file :: GuestfsH -> String -> String -> Int -> IO ()
+write_file h path content size = do
+ r <- withCString path $ \path -> withCString content $ \content -> withForeignPtr h (\p -> c_write_file p path content (fromIntegral size))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_umount" c_umount
:: GuestfsP -> CString -> IO (CInt)
@@ -544,6 +628,18 @@ blockdev_setrw h device = do
fail err
else return ()
+foreign import ccall unsafe "guestfs_blockdev_setbsz" c_blockdev_setbsz
+ :: GuestfsP -> CString -> CInt -> IO (CInt)
+
+blockdev_setbsz :: GuestfsH -> String -> Int -> IO ()
+blockdev_setbsz h device blocksize = do
+ r <- withCString device $ \device -> withForeignPtr h (\p -> c_blockdev_setbsz p device (fromIntegral blocksize))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_blockdev_flushbufs" c_blockdev_flushbufs
:: GuestfsP -> CString -> IO (CInt)
@@ -796,6 +892,18 @@ mv h src dest = do
fail err
else return ()
+foreign import ccall unsafe "guestfs_drop_caches" c_drop_caches
+ :: GuestfsP -> CInt -> IO (CInt)
+
+drop_caches :: GuestfsH -> Int -> IO ()
+drop_caches h whattodrop = do
+ r <- withForeignPtr h (\p -> c_drop_caches p (fromIntegral whattodrop))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_ping_daemon" c_ping_daemon
:: GuestfsP -> IO (CInt)
@@ -832,6 +940,30 @@ pvresize h device = do
fail err
else return ()
+foreign import ccall unsafe "guestfs_sfdisk_N" c_sfdisk_N
+ :: GuestfsP -> CString -> CInt -> CInt -> CInt -> CInt -> CString -> IO (CInt)
+
+sfdisk_N :: GuestfsH -> String -> Int -> Int -> Int -> Int -> String -> IO ()
+sfdisk_N h device n cyls heads sectors line = do
+ r <- withCString device $ \device -> withCString line $ \line -> withForeignPtr h (\p -> c_sfdisk_N p device (fromIntegral n) (fromIntegral cyls) (fromIntegral heads) (fromIntegral sectors) line)
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
+foreign import ccall unsafe "guestfs_lvresize" c_lvresize
+ :: GuestfsP -> CString -> CInt -> IO (CInt)
+
+lvresize :: GuestfsH -> String -> Int -> IO ()
+lvresize h device mbytes = do
+ r <- withCString device $ \device -> withForeignPtr h (\p -> c_lvresize p device (fromIntegral mbytes))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_resize2fs" c_resize2fs
:: GuestfsP -> CString -> IO (CInt)
@@ -856,6 +988,18 @@ e2fsck_f h device = do
fail err
else return ()
+foreign import ccall unsafe "guestfs_sleep" c_sleep
+ :: GuestfsP -> CInt -> IO (CInt)
+
+sleep :: GuestfsH -> Int -> IO ()
+sleep h secs = do
+ r <- withForeignPtr h (\p -> c_sleep p (fromIntegral secs))
+ if (r == -1)
+ then do
+ err <- last_error h
+ fail err
+ else return ()
+
foreign import ccall unsafe "guestfs_scrub_device" c_scrub_device
:: GuestfsP -> CString -> IO (CInt)