Add 'append', LIBGUESTFS_APPEND to set additional kernel options.
[libguestfs.git] / ruby / ext / guestfs / _guestfs.c
index 07b0228..0c20703 100644 (file)
 
 #include "extconf.h"
 
+/* For Ruby < 1.9 */
+#ifndef RARRAY_LEN
+#define RARRAY_LEN(r) (RARRAY((r))->len)
+#endif
+
 static VALUE m_guestfs;                        /* guestfs module */
 static VALUE c_guestfs;                        /* guestfs_h handle */
 static VALUE e_Error;                  /* used for all errors */
@@ -257,6 +262,44 @@ static VALUE ruby_guestfs_get_path (VALUE gv)
   return rb_str_new2 (r);
 }
 
+static VALUE ruby_guestfs_set_append (VALUE gv, VALUE appendv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "set_append");
+
+  const char *append = StringValueCStr (appendv);
+  if (!append)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "append", "set_append");
+
+  int r;
+
+  r = guestfs_set_append (g, append);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_get_append (VALUE gv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "get_append");
+
+
+  const char *r;
+
+  r = guestfs_get_append (g);
+  if (r == NULL)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return rb_str_new2 (r);
+}
+
 static VALUE ruby_guestfs_set_autosync (VALUE gv, VALUE autosyncv)
 {
   guestfs_h *g;
@@ -446,6 +489,23 @@ static VALUE ruby_guestfs_set_ready (VALUE gv)
   return Qnil;
 }
 
+static VALUE ruby_guestfs_end_busy (VALUE gv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "end_busy");
+
+
+  int r;
+
+  r = guestfs_end_busy (g);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
 static VALUE ruby_guestfs_mount (VALUE gv, VALUE devicev, VALUE mountpointv)
 {
   guestfs_h *g;
@@ -1413,11 +1473,12 @@ static VALUE ruby_guestfs_vgcreate (VALUE gv, VALUE volgroupv, VALUE physvolsv)
   char **physvols;  {
     int i, len;
     len = RARRAY_LEN (physvolsv);
-    physvols = malloc (sizeof (char *) * (len+1));
+    physvols = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
     for (i = 0; i < len; ++i) {
       VALUE v = rb_ary_entry (physvolsv, i);
       physvols[i] = StringValueCStr (v);
     }
+    physvols[len] = NULL;
   }
 
   int r;
@@ -1498,11 +1559,12 @@ static VALUE ruby_guestfs_sfdisk (VALUE gv, VALUE devicev, VALUE cylsv, VALUE he
   char **lines;  {
     int i, len;
     len = RARRAY_LEN (linesv);
-    lines = malloc (sizeof (char *) * (len+1));
+    lines = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
     for (i = 0; i < len; ++i) {
       VALUE v = rb_ary_entry (linesv, i);
       lines[i] = StringValueCStr (v);
     }
+    lines[len] = NULL;
   }
 
   int r;
@@ -1654,11 +1716,12 @@ static VALUE ruby_guestfs_command (VALUE gv, VALUE argumentsv)
   char **arguments;  {
     int i, len;
     len = RARRAY_LEN (argumentsv);
-    arguments = malloc (sizeof (char *) * (len+1));
+    arguments = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
     for (i = 0; i < len; ++i) {
       VALUE v = rb_ary_entry (argumentsv, i);
       arguments[i] = StringValueCStr (v);
     }
+    arguments[len] = NULL;
   }
 
   char *r;
@@ -1683,11 +1746,12 @@ static VALUE ruby_guestfs_command_lines (VALUE gv, VALUE argumentsv)
   char **arguments;  {
     int i, len;
     len = RARRAY_LEN (argumentsv);
-    arguments = malloc (sizeof (char *) * (len+1));
+    arguments = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
     for (i = 0; i < len; ++i) {
       VALUE v = rb_ary_entry (argumentsv, i);
       arguments[i] = StringValueCStr (v);
     }
+    arguments[len] = NULL;
   }
 
   char **r;
@@ -2332,11 +2396,12 @@ static VALUE ruby_guestfs_debug (VALUE gv, VALUE subcmdv, VALUE extraargsv)
   char **extraargs;  {
     int i, len;
     len = RARRAY_LEN (extraargsv);
-    extraargs = malloc (sizeof (char *) * (len+1));
+    extraargs = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
     for (i = 0; i < len; ++i) {
       VALUE v = rb_ary_entry (extraargsv, i);
       extraargs[i] = StringValueCStr (v);
     }
+    extraargs[len] = NULL;
   }
 
   char *r;
@@ -2351,6 +2416,475 @@ static VALUE ruby_guestfs_debug (VALUE gv, VALUE subcmdv, VALUE extraargsv)
   return rv;
 }
 
+static VALUE ruby_guestfs_lvremove (VALUE gv, VALUE devicev)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "lvremove");
+
+  const char *device = StringValueCStr (devicev);
+  if (!device)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "device", "lvremove");
+
+  int r;
+
+  r = guestfs_lvremove (g, device);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_vgremove (VALUE gv, VALUE vgnamev)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "vgremove");
+
+  const char *vgname = StringValueCStr (vgnamev);
+  if (!vgname)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "vgname", "vgremove");
+
+  int r;
+
+  r = guestfs_vgremove (g, vgname);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_pvremove (VALUE gv, VALUE devicev)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "pvremove");
+
+  const char *device = StringValueCStr (devicev);
+  if (!device)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "device", "pvremove");
+
+  int r;
+
+  r = guestfs_pvremove (g, device);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_set_e2label (VALUE gv, VALUE devicev, VALUE labelv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "set_e2label");
+
+  const char *device = StringValueCStr (devicev);
+  if (!device)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "device", "set_e2label");
+  const char *label = StringValueCStr (labelv);
+  if (!label)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "label", "set_e2label");
+
+  int r;
+
+  r = guestfs_set_e2label (g, device, label);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_get_e2label (VALUE gv, VALUE devicev)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "get_e2label");
+
+  const char *device = StringValueCStr (devicev);
+  if (!device)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "device", "get_e2label");
+
+  char *r;
+
+  r = guestfs_get_e2label (g, device);
+  if (r == NULL)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  VALUE rv = rb_str_new2 (r);
+  free (r);
+  return rv;
+}
+
+static VALUE ruby_guestfs_set_e2uuid (VALUE gv, VALUE devicev, VALUE uuidv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "set_e2uuid");
+
+  const char *device = StringValueCStr (devicev);
+  if (!device)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "device", "set_e2uuid");
+  const char *uuid = StringValueCStr (uuidv);
+  if (!uuid)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "uuid", "set_e2uuid");
+
+  int r;
+
+  r = guestfs_set_e2uuid (g, device, uuid);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_get_e2uuid (VALUE gv, VALUE devicev)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "get_e2uuid");
+
+  const char *device = StringValueCStr (devicev);
+  if (!device)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "device", "get_e2uuid");
+
+  char *r;
+
+  r = guestfs_get_e2uuid (g, device);
+  if (r == NULL)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  VALUE rv = rb_str_new2 (r);
+  free (r);
+  return rv;
+}
+
+static VALUE ruby_guestfs_fsck (VALUE gv, VALUE fstypev, VALUE devicev)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "fsck");
+
+  const char *fstype = StringValueCStr (fstypev);
+  if (!fstype)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "fstype", "fsck");
+  const char *device = StringValueCStr (devicev);
+  if (!device)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "device", "fsck");
+
+  int r;
+
+  r = guestfs_fsck (g, fstype, device);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return INT2NUM (r);
+}
+
+static VALUE ruby_guestfs_zero (VALUE gv, VALUE devicev)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "zero");
+
+  const char *device = StringValueCStr (devicev);
+  if (!device)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "device", "zero");
+
+  int r;
+
+  r = guestfs_zero (g, device);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_grub_install (VALUE gv, VALUE rootv, VALUE devicev)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "grub_install");
+
+  const char *root = StringValueCStr (rootv);
+  if (!root)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "root", "grub_install");
+  const char *device = StringValueCStr (devicev);
+  if (!device)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "device", "grub_install");
+
+  int r;
+
+  r = guestfs_grub_install (g, root, device);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_cp (VALUE gv, VALUE srcv, VALUE destv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "cp");
+
+  const char *src = StringValueCStr (srcv);
+  if (!src)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "src", "cp");
+  const char *dest = StringValueCStr (destv);
+  if (!dest)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "dest", "cp");
+
+  int r;
+
+  r = guestfs_cp (g, src, dest);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_cp_a (VALUE gv, VALUE srcv, VALUE destv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "cp_a");
+
+  const char *src = StringValueCStr (srcv);
+  if (!src)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "src", "cp_a");
+  const char *dest = StringValueCStr (destv);
+  if (!dest)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "dest", "cp_a");
+
+  int r;
+
+  r = guestfs_cp_a (g, src, dest);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_mv (VALUE gv, VALUE srcv, VALUE destv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "mv");
+
+  const char *src = StringValueCStr (srcv);
+  if (!src)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "src", "mv");
+  const char *dest = StringValueCStr (destv);
+  if (!dest)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "dest", "mv");
+
+  int r;
+
+  r = guestfs_mv (g, src, dest);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_drop_caches (VALUE gv, VALUE whattodropv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "drop_caches");
+
+  int whattodrop = NUM2INT (whattodropv);
+
+  int r;
+
+  r = guestfs_drop_caches (g, whattodrop);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_dmesg (VALUE gv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "dmesg");
+
+
+  char *r;
+
+  r = guestfs_dmesg (g);
+  if (r == NULL)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  VALUE rv = rb_str_new2 (r);
+  free (r);
+  return rv;
+}
+
+static VALUE ruby_guestfs_ping_daemon (VALUE gv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "ping_daemon");
+
+
+  int r;
+
+  r = guestfs_ping_daemon (g);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return Qnil;
+}
+
+static VALUE ruby_guestfs_equal (VALUE gv, VALUE file1v, VALUE file2v)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "equal");
+
+  const char *file1 = StringValueCStr (file1v);
+  if (!file1)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "file1", "equal");
+  const char *file2 = StringValueCStr (file2v);
+  if (!file2)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "file2", "equal");
+
+  int r;
+
+  r = guestfs_equal (g, file1, file2);
+  if (r == -1)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  return INT2NUM (r);
+}
+
+static VALUE ruby_guestfs_strings (VALUE gv, VALUE pathv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "strings");
+
+  const char *path = StringValueCStr (pathv);
+  if (!path)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "path", "strings");
+
+  char **r;
+
+  r = guestfs_strings (g, path);
+  if (r == NULL)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  int i, len = 0;
+  for (i = 0; r[i] != NULL; ++i) len++;
+  VALUE rv = rb_ary_new2 (len);
+  for (i = 0; r[i] != NULL; ++i) {
+    rb_ary_push (rv, rb_str_new2 (r[i]));
+    free (r[i]);
+  }
+  free (r);
+  return rv;
+}
+
+static VALUE ruby_guestfs_strings_e (VALUE gv, VALUE encodingv, VALUE pathv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "strings_e");
+
+  const char *encoding = StringValueCStr (encodingv);
+  if (!encoding)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "encoding", "strings_e");
+  const char *path = StringValueCStr (pathv);
+  if (!path)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "path", "strings_e");
+
+  char **r;
+
+  r = guestfs_strings_e (g, encoding, path);
+  if (r == NULL)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  int i, len = 0;
+  for (i = 0; r[i] != NULL; ++i) len++;
+  VALUE rv = rb_ary_new2 (len);
+  for (i = 0; r[i] != NULL; ++i) {
+    rb_ary_push (rv, rb_str_new2 (r[i]));
+    free (r[i]);
+  }
+  free (r);
+  return rv;
+}
+
+static VALUE ruby_guestfs_hexdump (VALUE gv, VALUE pathv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "hexdump");
+
+  const char *path = StringValueCStr (pathv);
+  if (!path)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "path", "hexdump");
+
+  char *r;
+
+  r = guestfs_hexdump (g, path);
+  if (r == NULL)
+    rb_raise (e_Error, "%s", guestfs_last_error (g));
+
+  VALUE rv = rb_str_new2 (r);
+  free (r);
+  return rv;
+}
+
 /* Initialize the module. */
 void Init__guestfs ()
 {
@@ -2381,6 +2915,10 @@ void Init__guestfs ()
         ruby_guestfs_set_path, 1);
   rb_define_method (c_guestfs, "get_path",
         ruby_guestfs_get_path, 0);
+  rb_define_method (c_guestfs, "set_append",
+        ruby_guestfs_set_append, 1);
+  rb_define_method (c_guestfs, "get_append",
+        ruby_guestfs_get_append, 0);
   rb_define_method (c_guestfs, "set_autosync",
         ruby_guestfs_set_autosync, 1);
   rb_define_method (c_guestfs, "get_autosync",
@@ -2403,6 +2941,8 @@ void Init__guestfs ()
         ruby_guestfs_set_busy, 0);
   rb_define_method (c_guestfs, "set_ready",
         ruby_guestfs_set_ready, 0);
+  rb_define_method (c_guestfs, "end_busy",
+        ruby_guestfs_end_busy, 0);
   rb_define_method (c_guestfs, "mount",
         ruby_guestfs_mount, 2);
   rb_define_method (c_guestfs, "sync",
@@ -2555,4 +3095,44 @@ void Init__guestfs ()
         ruby_guestfs_mount_vfs, 4);
   rb_define_method (c_guestfs, "debug",
         ruby_guestfs_debug, 2);
+  rb_define_method (c_guestfs, "lvremove",
+        ruby_guestfs_lvremove, 1);
+  rb_define_method (c_guestfs, "vgremove",
+        ruby_guestfs_vgremove, 1);
+  rb_define_method (c_guestfs, "pvremove",
+        ruby_guestfs_pvremove, 1);
+  rb_define_method (c_guestfs, "set_e2label",
+        ruby_guestfs_set_e2label, 2);
+  rb_define_method (c_guestfs, "get_e2label",
+        ruby_guestfs_get_e2label, 1);
+  rb_define_method (c_guestfs, "set_e2uuid",
+        ruby_guestfs_set_e2uuid, 2);
+  rb_define_method (c_guestfs, "get_e2uuid",
+        ruby_guestfs_get_e2uuid, 1);
+  rb_define_method (c_guestfs, "fsck",
+        ruby_guestfs_fsck, 2);
+  rb_define_method (c_guestfs, "zero",
+        ruby_guestfs_zero, 1);
+  rb_define_method (c_guestfs, "grub_install",
+        ruby_guestfs_grub_install, 2);
+  rb_define_method (c_guestfs, "cp",
+        ruby_guestfs_cp, 2);
+  rb_define_method (c_guestfs, "cp_a",
+        ruby_guestfs_cp_a, 2);
+  rb_define_method (c_guestfs, "mv",
+        ruby_guestfs_mv, 2);
+  rb_define_method (c_guestfs, "drop_caches",
+        ruby_guestfs_drop_caches, 1);
+  rb_define_method (c_guestfs, "dmesg",
+        ruby_guestfs_dmesg, 0);
+  rb_define_method (c_guestfs, "ping_daemon",
+        ruby_guestfs_ping_daemon, 0);
+  rb_define_method (c_guestfs, "equal",
+        ruby_guestfs_equal, 2);
+  rb_define_method (c_guestfs, "strings",
+        ruby_guestfs_strings, 1);
+  rb_define_method (c_guestfs, "strings_e",
+        ruby_guestfs_strings_e, 2);
+  rb_define_method (c_guestfs, "hexdump",
+        ruby_guestfs_hexdump, 1);
 }