Generated code for lvremove, vgremove, pvremove.
[libguestfs.git] / ruby / ext / guestfs / _guestfs.c
index 89eb6af..0429ae6 100644 (file)
@@ -1418,6 +1418,7 @@ static VALUE ruby_guestfs_vgcreate (VALUE gv, VALUE volgroupv, VALUE physvolsv)
       VALUE v = rb_ary_entry (physvolsv, i);
       physvols[i] = StringValueCStr (v);
     }
+    physvols[len] = NULL;
   }
 
   int r;
@@ -1503,6 +1504,7 @@ static VALUE ruby_guestfs_sfdisk (VALUE gv, VALUE devicev, VALUE cylsv, VALUE he
       VALUE v = rb_ary_entry (linesv, i);
       lines[i] = StringValueCStr (v);
     }
+    lines[len] = NULL;
   }
 
   int r;
@@ -1659,6 +1661,7 @@ static VALUE ruby_guestfs_command (VALUE gv, VALUE argumentsv)
       VALUE v = rb_ary_entry (argumentsv, i);
       arguments[i] = StringValueCStr (v);
     }
+    arguments[len] = NULL;
   }
 
   char *r;
@@ -1688,6 +1691,7 @@ static VALUE ruby_guestfs_command_lines (VALUE gv, VALUE argumentsv)
       VALUE v = rb_ary_entry (argumentsv, i);
       arguments[i] = StringValueCStr (v);
     }
+    arguments[len] = NULL;
   }
 
   char **r;
@@ -2318,6 +2322,103 @@ static VALUE ruby_guestfs_mount_vfs (VALUE gv, VALUE optionsv, VALUE vfstypev, V
   return Qnil;
 }
 
+static VALUE ruby_guestfs_debug (VALUE gv, VALUE subcmdv, VALUE extraargsv)
+{
+  guestfs_h *g;
+  Data_Get_Struct (gv, guestfs_h, g);
+  if (!g)
+    rb_raise (rb_eArgError, "%s: used handle after closing it", "debug");
+
+  const char *subcmd = StringValueCStr (subcmdv);
+  if (!subcmd)
+    rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
+              "subcmd", "debug");
+  char **extraargs;  {
+    int i, len;
+    len = RARRAY_LEN (extraargsv);
+    extraargs = malloc (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;
+
+  r = guestfs_debug (g, subcmd, extraargs);
+  free (extraargs);
+  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_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;
+}
+
 /* Initialize the module. */
 void Init__guestfs ()
 {
@@ -2520,4 +2621,12 @@ void Init__guestfs ()
         ruby_guestfs_mount_options, 3);
   rb_define_method (c_guestfs, "mount_vfs",
         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);
 }