Added tar-in, tar-out, tgz-in, tgz-out commands.
[libguestfs.git] / ocaml / guestfs_c_actions.c
index 4d7b350..cfcf4e4 100644 (file)
@@ -711,6 +711,50 @@ ocaml_guestfs_get_state (value gv)
 }
 
 CAMLprim value
+ocaml_guestfs_set_busy (value gv)
+{
+  CAMLparam1 (gv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("set_busy: used handle after closing it");
+
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_set_busy (g);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "set_busy");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_set_ready (value gv)
+{
+  CAMLparam1 (gv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("set_ready: used handle after closing it");
+
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_set_ready (g);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "set_ready");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
 ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
 {
   CAMLparam3 (gv, devicev, mountpointv);
@@ -2323,3 +2367,124 @@ ocaml_guestfs_download (value gv, value remotefilenamev, value filenamev)
   CAMLreturn (rv);
 }
 
+CAMLprim value
+ocaml_guestfs_checksum (value gv, value csumtypev, value pathv)
+{
+  CAMLparam3 (gv, csumtypev, pathv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("checksum: used handle after closing it");
+
+  const char *csumtype = String_val (csumtypev);
+  const char *path = String_val (pathv);
+  char *r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_checksum (g, csumtype, path);
+  caml_leave_blocking_section ();
+  if (r == NULL)
+    ocaml_guestfs_raise_error (g, "checksum");
+
+  rv = caml_copy_string (r);
+  free (r);
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_tar_in (value gv, value tarfilev, value directoryv)
+{
+  CAMLparam3 (gv, tarfilev, directoryv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("tar_in: used handle after closing it");
+
+  const char *tarfile = String_val (tarfilev);
+  const char *directory = String_val (directoryv);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_tar_in (g, tarfile, directory);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "tar_in");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_tar_out (value gv, value directoryv, value tarfilev)
+{
+  CAMLparam3 (gv, directoryv, tarfilev);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("tar_out: used handle after closing it");
+
+  const char *directory = String_val (directoryv);
+  const char *tarfile = String_val (tarfilev);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_tar_out (g, directory, tarfile);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "tar_out");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_tgz_in (value gv, value tarballv, value directoryv)
+{
+  CAMLparam3 (gv, tarballv, directoryv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("tgz_in: used handle after closing it");
+
+  const char *tarball = String_val (tarballv);
+  const char *directory = String_val (directoryv);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_tgz_in (g, tarball, directory);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "tgz_in");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+
+CAMLprim value
+ocaml_guestfs_tgz_out (value gv, value directoryv, value tarballv)
+{
+  CAMLparam3 (gv, directoryv, tarballv);
+  CAMLlocal1 (rv);
+
+  guestfs_h *g = Guestfs_val (gv);
+  if (g == NULL)
+    caml_failwith ("tgz_out: used handle after closing it");
+
+  const char *directory = String_val (directoryv);
+  const char *tarball = String_val (tarballv);
+  int r;
+
+  caml_enter_blocking_section ();
+  r = guestfs_tgz_out (g, directory, tarball);
+  caml_leave_blocking_section ();
+  if (r == -1)
+    ocaml_guestfs_raise_error (g, "tgz_out");
+
+  rv = Val_unit;
+  CAMLreturn (rv);
+}
+