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
33 #define RARRAY_LEN(r) (RARRAY((r))->len)
36 static VALUE m_guestfs; /* guestfs module */
37 static VALUE c_guestfs; /* guestfs_h handle */
38 static VALUE e_Error; /* used for all errors */
40 static void ruby_guestfs_free (void *p)
43 guestfs_close ((guestfs_h *) p);
46 static VALUE ruby_guestfs_create (VALUE m)
50 g = guestfs_create ();
52 rb_raise (e_Error, "failed to create guestfs handle");
54 /* Don't print error messages to stderr by default. */
55 guestfs_set_error_handler (g, NULL, NULL);
57 /* Wrap it, and make sure the close function is called when the
60 return Data_Wrap_Struct (c_guestfs, NULL, ruby_guestfs_free, g);
63 static VALUE ruby_guestfs_close (VALUE gv)
66 Data_Get_Struct (gv, guestfs_h, g);
68 ruby_guestfs_free (g);
74 static VALUE ruby_guestfs_test0 (VALUE gv, VALUE strv, VALUE optstrv, VALUE strlistv, VALUE bv, VALUE integerv, VALUE fileinv, VALUE fileoutv)
77 Data_Get_Struct (gv, guestfs_h, g);
79 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0");
81 Check_Type (strv, T_STRING);
82 const char *str = StringValueCStr (strv);
84 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
86 const char *optstr = !NIL_P (optstrv) ? StringValueCStr (optstrv) : NULL;
88 Check_Type (strlistv, T_ARRAY);
91 len = RARRAY_LEN (strlistv);
92 strlist = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
93 for (i = 0; i < len; ++i) {
94 VALUE v = rb_ary_entry (strlistv, i);
95 strlist[i] = StringValueCStr (v);
100 int integer = NUM2INT (integerv);
101 Check_Type (fileinv, T_STRING);
102 const char *filein = StringValueCStr (fileinv);
104 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
106 Check_Type (fileoutv, T_STRING);
107 const char *fileout = StringValueCStr (fileoutv);
109 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
114 r = guestfs_test0 (g, str, optstr, strlist, b, integer, filein, fileout);
117 rb_raise (e_Error, "%s", guestfs_last_error (g));
122 static VALUE ruby_guestfs_test0rint (VALUE gv, VALUE valv)
125 Data_Get_Struct (gv, guestfs_h, g);
127 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rint");
129 Check_Type (valv, T_STRING);
130 const char *val = StringValueCStr (valv);
132 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
137 r = guestfs_test0rint (g, val);
139 rb_raise (e_Error, "%s", guestfs_last_error (g));
144 static VALUE ruby_guestfs_test0rinterr (VALUE gv)
147 Data_Get_Struct (gv, guestfs_h, g);
149 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rinterr");
154 r = guestfs_test0rinterr (g);
156 rb_raise (e_Error, "%s", guestfs_last_error (g));
161 static VALUE ruby_guestfs_test0rint64 (VALUE gv, VALUE valv)
164 Data_Get_Struct (gv, guestfs_h, g);
166 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rint64");
168 Check_Type (valv, T_STRING);
169 const char *val = StringValueCStr (valv);
171 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
172 "val", "test0rint64");
176 r = guestfs_test0rint64 (g, val);
178 rb_raise (e_Error, "%s", guestfs_last_error (g));
183 static VALUE ruby_guestfs_test0rint64err (VALUE gv)
186 Data_Get_Struct (gv, guestfs_h, g);
188 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rint64err");
193 r = guestfs_test0rint64err (g);
195 rb_raise (e_Error, "%s", guestfs_last_error (g));
200 static VALUE ruby_guestfs_test0rbool (VALUE gv, VALUE valv)
203 Data_Get_Struct (gv, guestfs_h, g);
205 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rbool");
207 Check_Type (valv, T_STRING);
208 const char *val = StringValueCStr (valv);
210 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
211 "val", "test0rbool");
215 r = guestfs_test0rbool (g, val);
217 rb_raise (e_Error, "%s", guestfs_last_error (g));
222 static VALUE ruby_guestfs_test0rboolerr (VALUE gv)
225 Data_Get_Struct (gv, guestfs_h, g);
227 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rboolerr");
232 r = guestfs_test0rboolerr (g);
234 rb_raise (e_Error, "%s", guestfs_last_error (g));
239 static VALUE ruby_guestfs_test0rconststring (VALUE gv, VALUE valv)
242 Data_Get_Struct (gv, guestfs_h, g);
244 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rconststring");
246 Check_Type (valv, T_STRING);
247 const char *val = StringValueCStr (valv);
249 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
250 "val", "test0rconststring");
254 r = guestfs_test0rconststring (g, val);
256 rb_raise (e_Error, "%s", guestfs_last_error (g));
258 return rb_str_new2 (r);
261 static VALUE ruby_guestfs_test0rconststringerr (VALUE gv)
264 Data_Get_Struct (gv, guestfs_h, g);
266 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rconststringerr");
271 r = guestfs_test0rconststringerr (g);
273 rb_raise (e_Error, "%s", guestfs_last_error (g));
275 return rb_str_new2 (r);
278 static VALUE ruby_guestfs_test0rstring (VALUE gv, VALUE valv)
281 Data_Get_Struct (gv, guestfs_h, g);
283 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstring");
285 Check_Type (valv, T_STRING);
286 const char *val = StringValueCStr (valv);
288 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
289 "val", "test0rstring");
293 r = guestfs_test0rstring (g, val);
295 rb_raise (e_Error, "%s", guestfs_last_error (g));
297 VALUE rv = rb_str_new2 (r);
302 static VALUE ruby_guestfs_test0rstringerr (VALUE gv)
305 Data_Get_Struct (gv, guestfs_h, g);
307 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstringerr");
312 r = guestfs_test0rstringerr (g);
314 rb_raise (e_Error, "%s", guestfs_last_error (g));
316 VALUE rv = rb_str_new2 (r);
321 static VALUE ruby_guestfs_test0rstringlist (VALUE gv, VALUE valv)
324 Data_Get_Struct (gv, guestfs_h, g);
326 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstringlist");
328 Check_Type (valv, T_STRING);
329 const char *val = StringValueCStr (valv);
331 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
332 "val", "test0rstringlist");
336 r = guestfs_test0rstringlist (g, val);
338 rb_raise (e_Error, "%s", guestfs_last_error (g));
341 for (i = 0; r[i] != NULL; ++i) len++;
342 VALUE rv = rb_ary_new2 (len);
343 for (i = 0; r[i] != NULL; ++i) {
344 rb_ary_push (rv, rb_str_new2 (r[i]));
351 static VALUE ruby_guestfs_test0rstringlisterr (VALUE gv)
354 Data_Get_Struct (gv, guestfs_h, g);
356 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstringlisterr");
361 r = guestfs_test0rstringlisterr (g);
363 rb_raise (e_Error, "%s", guestfs_last_error (g));
366 for (i = 0; r[i] != NULL; ++i) len++;
367 VALUE rv = rb_ary_new2 (len);
368 for (i = 0; r[i] != NULL; ++i) {
369 rb_ary_push (rv, rb_str_new2 (r[i]));
376 static VALUE ruby_guestfs_test0rintbool (VALUE gv, VALUE valv)
379 Data_Get_Struct (gv, guestfs_h, g);
381 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rintbool");
383 Check_Type (valv, T_STRING);
384 const char *val = StringValueCStr (valv);
386 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
387 "val", "test0rintbool");
389 struct guestfs_int_bool *r;
391 r = guestfs_test0rintbool (g, val);
393 rb_raise (e_Error, "%s", guestfs_last_error (g));
395 VALUE rv = rb_ary_new2 (2);
396 rb_ary_push (rv, INT2NUM (r->i));
397 rb_ary_push (rv, INT2NUM (r->b));
398 guestfs_free_int_bool (r);
402 static VALUE ruby_guestfs_test0rintboolerr (VALUE gv)
405 Data_Get_Struct (gv, guestfs_h, g);
407 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rintboolerr");
410 struct guestfs_int_bool *r;
412 r = guestfs_test0rintboolerr (g);
414 rb_raise (e_Error, "%s", guestfs_last_error (g));
416 VALUE rv = rb_ary_new2 (2);
417 rb_ary_push (rv, INT2NUM (r->i));
418 rb_ary_push (rv, INT2NUM (r->b));
419 guestfs_free_int_bool (r);
423 static VALUE ruby_guestfs_test0rpvlist (VALUE gv, VALUE valv)
426 Data_Get_Struct (gv, guestfs_h, g);
428 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rpvlist");
430 Check_Type (valv, T_STRING);
431 const char *val = StringValueCStr (valv);
433 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
434 "val", "test0rpvlist");
436 struct guestfs_lvm_pv_list *r;
438 r = guestfs_test0rpvlist (g, val);
440 rb_raise (e_Error, "%s", guestfs_last_error (g));
442 VALUE rv = rb_ary_new2 (r->len);
444 for (i = 0; i < r->len; ++i) {
445 VALUE hv = rb_hash_new ();
446 rb_hash_aset (rv, rb_str_new2 ("pv_name"), rb_str_new2 (r->val[i].pv_name));
447 rb_hash_aset (rv, rb_str_new2 ("pv_uuid"), rb_str_new (r->val[i].pv_uuid, 32));
448 rb_hash_aset (rv, rb_str_new2 ("pv_fmt"), rb_str_new2 (r->val[i].pv_fmt));
449 rb_hash_aset (rv, rb_str_new2 ("pv_size"), ULL2NUM (r->val[i].pv_size));
450 rb_hash_aset (rv, rb_str_new2 ("dev_size"), ULL2NUM (r->val[i].dev_size));
451 rb_hash_aset (rv, rb_str_new2 ("pv_free"), ULL2NUM (r->val[i].pv_free));
452 rb_hash_aset (rv, rb_str_new2 ("pv_used"), ULL2NUM (r->val[i].pv_used));
453 rb_hash_aset (rv, rb_str_new2 ("pv_attr"), rb_str_new2 (r->val[i].pv_attr));
454 rb_hash_aset (rv, rb_str_new2 ("pv_pe_count"), ULL2NUM (r->val[i].pv_pe_count));
455 rb_hash_aset (rv, rb_str_new2 ("pv_pe_alloc_count"), ULL2NUM (r->val[i].pv_pe_alloc_count));
456 rb_hash_aset (rv, rb_str_new2 ("pv_tags"), rb_str_new2 (r->val[i].pv_tags));
457 rb_hash_aset (rv, rb_str_new2 ("pe_start"), ULL2NUM (r->val[i].pe_start));
458 rb_hash_aset (rv, rb_str_new2 ("pv_mda_count"), ULL2NUM (r->val[i].pv_mda_count));
459 rb_hash_aset (rv, rb_str_new2 ("pv_mda_free"), ULL2NUM (r->val[i].pv_mda_free));
460 rb_ary_push (rv, hv);
462 guestfs_free_lvm_pv_list (r);
466 static VALUE ruby_guestfs_test0rpvlisterr (VALUE gv)
469 Data_Get_Struct (gv, guestfs_h, g);
471 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rpvlisterr");
474 struct guestfs_lvm_pv_list *r;
476 r = guestfs_test0rpvlisterr (g);
478 rb_raise (e_Error, "%s", guestfs_last_error (g));
480 VALUE rv = rb_ary_new2 (r->len);
482 for (i = 0; i < r->len; ++i) {
483 VALUE hv = rb_hash_new ();
484 rb_hash_aset (rv, rb_str_new2 ("pv_name"), rb_str_new2 (r->val[i].pv_name));
485 rb_hash_aset (rv, rb_str_new2 ("pv_uuid"), rb_str_new (r->val[i].pv_uuid, 32));
486 rb_hash_aset (rv, rb_str_new2 ("pv_fmt"), rb_str_new2 (r->val[i].pv_fmt));
487 rb_hash_aset (rv, rb_str_new2 ("pv_size"), ULL2NUM (r->val[i].pv_size));
488 rb_hash_aset (rv, rb_str_new2 ("dev_size"), ULL2NUM (r->val[i].dev_size));
489 rb_hash_aset (rv, rb_str_new2 ("pv_free"), ULL2NUM (r->val[i].pv_free));
490 rb_hash_aset (rv, rb_str_new2 ("pv_used"), ULL2NUM (r->val[i].pv_used));
491 rb_hash_aset (rv, rb_str_new2 ("pv_attr"), rb_str_new2 (r->val[i].pv_attr));
492 rb_hash_aset (rv, rb_str_new2 ("pv_pe_count"), ULL2NUM (r->val[i].pv_pe_count));
493 rb_hash_aset (rv, rb_str_new2 ("pv_pe_alloc_count"), ULL2NUM (r->val[i].pv_pe_alloc_count));
494 rb_hash_aset (rv, rb_str_new2 ("pv_tags"), rb_str_new2 (r->val[i].pv_tags));
495 rb_hash_aset (rv, rb_str_new2 ("pe_start"), ULL2NUM (r->val[i].pe_start));
496 rb_hash_aset (rv, rb_str_new2 ("pv_mda_count"), ULL2NUM (r->val[i].pv_mda_count));
497 rb_hash_aset (rv, rb_str_new2 ("pv_mda_free"), ULL2NUM (r->val[i].pv_mda_free));
498 rb_ary_push (rv, hv);
500 guestfs_free_lvm_pv_list (r);
504 static VALUE ruby_guestfs_test0rvglist (VALUE gv, VALUE valv)
507 Data_Get_Struct (gv, guestfs_h, g);
509 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rvglist");
511 Check_Type (valv, T_STRING);
512 const char *val = StringValueCStr (valv);
514 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
515 "val", "test0rvglist");
517 struct guestfs_lvm_vg_list *r;
519 r = guestfs_test0rvglist (g, val);
521 rb_raise (e_Error, "%s", guestfs_last_error (g));
523 VALUE rv = rb_ary_new2 (r->len);
525 for (i = 0; i < r->len; ++i) {
526 VALUE hv = rb_hash_new ();
527 rb_hash_aset (rv, rb_str_new2 ("vg_name"), rb_str_new2 (r->val[i].vg_name));
528 rb_hash_aset (rv, rb_str_new2 ("vg_uuid"), rb_str_new (r->val[i].vg_uuid, 32));
529 rb_hash_aset (rv, rb_str_new2 ("vg_fmt"), rb_str_new2 (r->val[i].vg_fmt));
530 rb_hash_aset (rv, rb_str_new2 ("vg_attr"), rb_str_new2 (r->val[i].vg_attr));
531 rb_hash_aset (rv, rb_str_new2 ("vg_size"), ULL2NUM (r->val[i].vg_size));
532 rb_hash_aset (rv, rb_str_new2 ("vg_free"), ULL2NUM (r->val[i].vg_free));
533 rb_hash_aset (rv, rb_str_new2 ("vg_sysid"), rb_str_new2 (r->val[i].vg_sysid));
534 rb_hash_aset (rv, rb_str_new2 ("vg_extent_size"), ULL2NUM (r->val[i].vg_extent_size));
535 rb_hash_aset (rv, rb_str_new2 ("vg_extent_count"), ULL2NUM (r->val[i].vg_extent_count));
536 rb_hash_aset (rv, rb_str_new2 ("vg_free_count"), ULL2NUM (r->val[i].vg_free_count));
537 rb_hash_aset (rv, rb_str_new2 ("max_lv"), ULL2NUM (r->val[i].max_lv));
538 rb_hash_aset (rv, rb_str_new2 ("max_pv"), ULL2NUM (r->val[i].max_pv));
539 rb_hash_aset (rv, rb_str_new2 ("pv_count"), ULL2NUM (r->val[i].pv_count));
540 rb_hash_aset (rv, rb_str_new2 ("lv_count"), ULL2NUM (r->val[i].lv_count));
541 rb_hash_aset (rv, rb_str_new2 ("snap_count"), ULL2NUM (r->val[i].snap_count));
542 rb_hash_aset (rv, rb_str_new2 ("vg_seqno"), ULL2NUM (r->val[i].vg_seqno));
543 rb_hash_aset (rv, rb_str_new2 ("vg_tags"), rb_str_new2 (r->val[i].vg_tags));
544 rb_hash_aset (rv, rb_str_new2 ("vg_mda_count"), ULL2NUM (r->val[i].vg_mda_count));
545 rb_hash_aset (rv, rb_str_new2 ("vg_mda_free"), ULL2NUM (r->val[i].vg_mda_free));
546 rb_ary_push (rv, hv);
548 guestfs_free_lvm_vg_list (r);
552 static VALUE ruby_guestfs_test0rvglisterr (VALUE gv)
555 Data_Get_Struct (gv, guestfs_h, g);
557 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rvglisterr");
560 struct guestfs_lvm_vg_list *r;
562 r = guestfs_test0rvglisterr (g);
564 rb_raise (e_Error, "%s", guestfs_last_error (g));
566 VALUE rv = rb_ary_new2 (r->len);
568 for (i = 0; i < r->len; ++i) {
569 VALUE hv = rb_hash_new ();
570 rb_hash_aset (rv, rb_str_new2 ("vg_name"), rb_str_new2 (r->val[i].vg_name));
571 rb_hash_aset (rv, rb_str_new2 ("vg_uuid"), rb_str_new (r->val[i].vg_uuid, 32));
572 rb_hash_aset (rv, rb_str_new2 ("vg_fmt"), rb_str_new2 (r->val[i].vg_fmt));
573 rb_hash_aset (rv, rb_str_new2 ("vg_attr"), rb_str_new2 (r->val[i].vg_attr));
574 rb_hash_aset (rv, rb_str_new2 ("vg_size"), ULL2NUM (r->val[i].vg_size));
575 rb_hash_aset (rv, rb_str_new2 ("vg_free"), ULL2NUM (r->val[i].vg_free));
576 rb_hash_aset (rv, rb_str_new2 ("vg_sysid"), rb_str_new2 (r->val[i].vg_sysid));
577 rb_hash_aset (rv, rb_str_new2 ("vg_extent_size"), ULL2NUM (r->val[i].vg_extent_size));
578 rb_hash_aset (rv, rb_str_new2 ("vg_extent_count"), ULL2NUM (r->val[i].vg_extent_count));
579 rb_hash_aset (rv, rb_str_new2 ("vg_free_count"), ULL2NUM (r->val[i].vg_free_count));
580 rb_hash_aset (rv, rb_str_new2 ("max_lv"), ULL2NUM (r->val[i].max_lv));
581 rb_hash_aset (rv, rb_str_new2 ("max_pv"), ULL2NUM (r->val[i].max_pv));
582 rb_hash_aset (rv, rb_str_new2 ("pv_count"), ULL2NUM (r->val[i].pv_count));
583 rb_hash_aset (rv, rb_str_new2 ("lv_count"), ULL2NUM (r->val[i].lv_count));
584 rb_hash_aset (rv, rb_str_new2 ("snap_count"), ULL2NUM (r->val[i].snap_count));
585 rb_hash_aset (rv, rb_str_new2 ("vg_seqno"), ULL2NUM (r->val[i].vg_seqno));
586 rb_hash_aset (rv, rb_str_new2 ("vg_tags"), rb_str_new2 (r->val[i].vg_tags));
587 rb_hash_aset (rv, rb_str_new2 ("vg_mda_count"), ULL2NUM (r->val[i].vg_mda_count));
588 rb_hash_aset (rv, rb_str_new2 ("vg_mda_free"), ULL2NUM (r->val[i].vg_mda_free));
589 rb_ary_push (rv, hv);
591 guestfs_free_lvm_vg_list (r);
595 static VALUE ruby_guestfs_test0rlvlist (VALUE gv, VALUE valv)
598 Data_Get_Struct (gv, guestfs_h, g);
600 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rlvlist");
602 Check_Type (valv, T_STRING);
603 const char *val = StringValueCStr (valv);
605 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
606 "val", "test0rlvlist");
608 struct guestfs_lvm_lv_list *r;
610 r = guestfs_test0rlvlist (g, val);
612 rb_raise (e_Error, "%s", guestfs_last_error (g));
614 VALUE rv = rb_ary_new2 (r->len);
616 for (i = 0; i < r->len; ++i) {
617 VALUE hv = rb_hash_new ();
618 rb_hash_aset (rv, rb_str_new2 ("lv_name"), rb_str_new2 (r->val[i].lv_name));
619 rb_hash_aset (rv, rb_str_new2 ("lv_uuid"), rb_str_new (r->val[i].lv_uuid, 32));
620 rb_hash_aset (rv, rb_str_new2 ("lv_attr"), rb_str_new2 (r->val[i].lv_attr));
621 rb_hash_aset (rv, rb_str_new2 ("lv_major"), ULL2NUM (r->val[i].lv_major));
622 rb_hash_aset (rv, rb_str_new2 ("lv_minor"), ULL2NUM (r->val[i].lv_minor));
623 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_major"), ULL2NUM (r->val[i].lv_kernel_major));
624 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_minor"), ULL2NUM (r->val[i].lv_kernel_minor));
625 rb_hash_aset (rv, rb_str_new2 ("lv_size"), ULL2NUM (r->val[i].lv_size));
626 rb_hash_aset (rv, rb_str_new2 ("seg_count"), ULL2NUM (r->val[i].seg_count));
627 rb_hash_aset (rv, rb_str_new2 ("origin"), rb_str_new2 (r->val[i].origin));
628 rb_hash_aset (rv, rb_str_new2 ("snap_percent"), rb_dbl2big (r->val[i].snap_percent));
629 rb_hash_aset (rv, rb_str_new2 ("copy_percent"), rb_dbl2big (r->val[i].copy_percent));
630 rb_hash_aset (rv, rb_str_new2 ("move_pv"), rb_str_new2 (r->val[i].move_pv));
631 rb_hash_aset (rv, rb_str_new2 ("lv_tags"), rb_str_new2 (r->val[i].lv_tags));
632 rb_hash_aset (rv, rb_str_new2 ("mirror_log"), rb_str_new2 (r->val[i].mirror_log));
633 rb_hash_aset (rv, rb_str_new2 ("modules"), rb_str_new2 (r->val[i].modules));
634 rb_ary_push (rv, hv);
636 guestfs_free_lvm_lv_list (r);
640 static VALUE ruby_guestfs_test0rlvlisterr (VALUE gv)
643 Data_Get_Struct (gv, guestfs_h, g);
645 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rlvlisterr");
648 struct guestfs_lvm_lv_list *r;
650 r = guestfs_test0rlvlisterr (g);
652 rb_raise (e_Error, "%s", guestfs_last_error (g));
654 VALUE rv = rb_ary_new2 (r->len);
656 for (i = 0; i < r->len; ++i) {
657 VALUE hv = rb_hash_new ();
658 rb_hash_aset (rv, rb_str_new2 ("lv_name"), rb_str_new2 (r->val[i].lv_name));
659 rb_hash_aset (rv, rb_str_new2 ("lv_uuid"), rb_str_new (r->val[i].lv_uuid, 32));
660 rb_hash_aset (rv, rb_str_new2 ("lv_attr"), rb_str_new2 (r->val[i].lv_attr));
661 rb_hash_aset (rv, rb_str_new2 ("lv_major"), ULL2NUM (r->val[i].lv_major));
662 rb_hash_aset (rv, rb_str_new2 ("lv_minor"), ULL2NUM (r->val[i].lv_minor));
663 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_major"), ULL2NUM (r->val[i].lv_kernel_major));
664 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_minor"), ULL2NUM (r->val[i].lv_kernel_minor));
665 rb_hash_aset (rv, rb_str_new2 ("lv_size"), ULL2NUM (r->val[i].lv_size));
666 rb_hash_aset (rv, rb_str_new2 ("seg_count"), ULL2NUM (r->val[i].seg_count));
667 rb_hash_aset (rv, rb_str_new2 ("origin"), rb_str_new2 (r->val[i].origin));
668 rb_hash_aset (rv, rb_str_new2 ("snap_percent"), rb_dbl2big (r->val[i].snap_percent));
669 rb_hash_aset (rv, rb_str_new2 ("copy_percent"), rb_dbl2big (r->val[i].copy_percent));
670 rb_hash_aset (rv, rb_str_new2 ("move_pv"), rb_str_new2 (r->val[i].move_pv));
671 rb_hash_aset (rv, rb_str_new2 ("lv_tags"), rb_str_new2 (r->val[i].lv_tags));
672 rb_hash_aset (rv, rb_str_new2 ("mirror_log"), rb_str_new2 (r->val[i].mirror_log));
673 rb_hash_aset (rv, rb_str_new2 ("modules"), rb_str_new2 (r->val[i].modules));
674 rb_ary_push (rv, hv);
676 guestfs_free_lvm_lv_list (r);
680 static VALUE ruby_guestfs_test0rstat (VALUE gv, VALUE valv)
683 Data_Get_Struct (gv, guestfs_h, g);
685 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstat");
687 Check_Type (valv, T_STRING);
688 const char *val = StringValueCStr (valv);
690 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
691 "val", "test0rstat");
693 struct guestfs_stat *r;
695 r = guestfs_test0rstat (g, val);
697 rb_raise (e_Error, "%s", guestfs_last_error (g));
699 VALUE rv = rb_hash_new ();
700 rb_hash_aset (rv, rb_str_new2 ("dev"), ULL2NUM (r->dev));
701 rb_hash_aset (rv, rb_str_new2 ("ino"), ULL2NUM (r->ino));
702 rb_hash_aset (rv, rb_str_new2 ("mode"), ULL2NUM (r->mode));
703 rb_hash_aset (rv, rb_str_new2 ("nlink"), ULL2NUM (r->nlink));
704 rb_hash_aset (rv, rb_str_new2 ("uid"), ULL2NUM (r->uid));
705 rb_hash_aset (rv, rb_str_new2 ("gid"), ULL2NUM (r->gid));
706 rb_hash_aset (rv, rb_str_new2 ("rdev"), ULL2NUM (r->rdev));
707 rb_hash_aset (rv, rb_str_new2 ("size"), ULL2NUM (r->size));
708 rb_hash_aset (rv, rb_str_new2 ("blksize"), ULL2NUM (r->blksize));
709 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
710 rb_hash_aset (rv, rb_str_new2 ("atime"), ULL2NUM (r->atime));
711 rb_hash_aset (rv, rb_str_new2 ("mtime"), ULL2NUM (r->mtime));
712 rb_hash_aset (rv, rb_str_new2 ("ctime"), ULL2NUM (r->ctime));
717 static VALUE ruby_guestfs_test0rstaterr (VALUE gv)
720 Data_Get_Struct (gv, guestfs_h, g);
722 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstaterr");
725 struct guestfs_stat *r;
727 r = guestfs_test0rstaterr (g);
729 rb_raise (e_Error, "%s", guestfs_last_error (g));
731 VALUE rv = rb_hash_new ();
732 rb_hash_aset (rv, rb_str_new2 ("dev"), ULL2NUM (r->dev));
733 rb_hash_aset (rv, rb_str_new2 ("ino"), ULL2NUM (r->ino));
734 rb_hash_aset (rv, rb_str_new2 ("mode"), ULL2NUM (r->mode));
735 rb_hash_aset (rv, rb_str_new2 ("nlink"), ULL2NUM (r->nlink));
736 rb_hash_aset (rv, rb_str_new2 ("uid"), ULL2NUM (r->uid));
737 rb_hash_aset (rv, rb_str_new2 ("gid"), ULL2NUM (r->gid));
738 rb_hash_aset (rv, rb_str_new2 ("rdev"), ULL2NUM (r->rdev));
739 rb_hash_aset (rv, rb_str_new2 ("size"), ULL2NUM (r->size));
740 rb_hash_aset (rv, rb_str_new2 ("blksize"), ULL2NUM (r->blksize));
741 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
742 rb_hash_aset (rv, rb_str_new2 ("atime"), ULL2NUM (r->atime));
743 rb_hash_aset (rv, rb_str_new2 ("mtime"), ULL2NUM (r->mtime));
744 rb_hash_aset (rv, rb_str_new2 ("ctime"), ULL2NUM (r->ctime));
749 static VALUE ruby_guestfs_test0rstatvfs (VALUE gv, VALUE valv)
752 Data_Get_Struct (gv, guestfs_h, g);
754 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstatvfs");
756 Check_Type (valv, T_STRING);
757 const char *val = StringValueCStr (valv);
759 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
760 "val", "test0rstatvfs");
762 struct guestfs_statvfs *r;
764 r = guestfs_test0rstatvfs (g, val);
766 rb_raise (e_Error, "%s", guestfs_last_error (g));
768 VALUE rv = rb_hash_new ();
769 rb_hash_aset (rv, rb_str_new2 ("bsize"), ULL2NUM (r->bsize));
770 rb_hash_aset (rv, rb_str_new2 ("frsize"), ULL2NUM (r->frsize));
771 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
772 rb_hash_aset (rv, rb_str_new2 ("bfree"), ULL2NUM (r->bfree));
773 rb_hash_aset (rv, rb_str_new2 ("bavail"), ULL2NUM (r->bavail));
774 rb_hash_aset (rv, rb_str_new2 ("files"), ULL2NUM (r->files));
775 rb_hash_aset (rv, rb_str_new2 ("ffree"), ULL2NUM (r->ffree));
776 rb_hash_aset (rv, rb_str_new2 ("favail"), ULL2NUM (r->favail));
777 rb_hash_aset (rv, rb_str_new2 ("fsid"), ULL2NUM (r->fsid));
778 rb_hash_aset (rv, rb_str_new2 ("flag"), ULL2NUM (r->flag));
779 rb_hash_aset (rv, rb_str_new2 ("namemax"), ULL2NUM (r->namemax));
784 static VALUE ruby_guestfs_test0rstatvfserr (VALUE gv)
787 Data_Get_Struct (gv, guestfs_h, g);
789 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstatvfserr");
792 struct guestfs_statvfs *r;
794 r = guestfs_test0rstatvfserr (g);
796 rb_raise (e_Error, "%s", guestfs_last_error (g));
798 VALUE rv = rb_hash_new ();
799 rb_hash_aset (rv, rb_str_new2 ("bsize"), ULL2NUM (r->bsize));
800 rb_hash_aset (rv, rb_str_new2 ("frsize"), ULL2NUM (r->frsize));
801 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
802 rb_hash_aset (rv, rb_str_new2 ("bfree"), ULL2NUM (r->bfree));
803 rb_hash_aset (rv, rb_str_new2 ("bavail"), ULL2NUM (r->bavail));
804 rb_hash_aset (rv, rb_str_new2 ("files"), ULL2NUM (r->files));
805 rb_hash_aset (rv, rb_str_new2 ("ffree"), ULL2NUM (r->ffree));
806 rb_hash_aset (rv, rb_str_new2 ("favail"), ULL2NUM (r->favail));
807 rb_hash_aset (rv, rb_str_new2 ("fsid"), ULL2NUM (r->fsid));
808 rb_hash_aset (rv, rb_str_new2 ("flag"), ULL2NUM (r->flag));
809 rb_hash_aset (rv, rb_str_new2 ("namemax"), ULL2NUM (r->namemax));
814 static VALUE ruby_guestfs_test0rhashtable (VALUE gv, VALUE valv)
817 Data_Get_Struct (gv, guestfs_h, g);
819 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rhashtable");
821 Check_Type (valv, T_STRING);
822 const char *val = StringValueCStr (valv);
824 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
825 "val", "test0rhashtable");
829 r = guestfs_test0rhashtable (g, val);
831 rb_raise (e_Error, "%s", guestfs_last_error (g));
833 VALUE rv = rb_hash_new ();
835 for (i = 0; r[i] != NULL; i+=2) {
836 rb_hash_aset (rv, rb_str_new2 (r[i]), rb_str_new2 (r[i+1]));
844 static VALUE ruby_guestfs_test0rhashtableerr (VALUE gv)
847 Data_Get_Struct (gv, guestfs_h, g);
849 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rhashtableerr");
854 r = guestfs_test0rhashtableerr (g);
856 rb_raise (e_Error, "%s", guestfs_last_error (g));
858 VALUE rv = rb_hash_new ();
860 for (i = 0; r[i] != NULL; i+=2) {
861 rb_hash_aset (rv, rb_str_new2 (r[i]), rb_str_new2 (r[i+1]));
869 static VALUE ruby_guestfs_launch (VALUE gv)
872 Data_Get_Struct (gv, guestfs_h, g);
874 rb_raise (rb_eArgError, "%s: used handle after closing it", "launch");
879 r = guestfs_launch (g);
881 rb_raise (e_Error, "%s", guestfs_last_error (g));
886 static VALUE ruby_guestfs_wait_ready (VALUE gv)
889 Data_Get_Struct (gv, guestfs_h, g);
891 rb_raise (rb_eArgError, "%s: used handle after closing it", "wait_ready");
896 r = guestfs_wait_ready (g);
898 rb_raise (e_Error, "%s", guestfs_last_error (g));
903 static VALUE ruby_guestfs_kill_subprocess (VALUE gv)
906 Data_Get_Struct (gv, guestfs_h, g);
908 rb_raise (rb_eArgError, "%s: used handle after closing it", "kill_subprocess");
913 r = guestfs_kill_subprocess (g);
915 rb_raise (e_Error, "%s", guestfs_last_error (g));
920 static VALUE ruby_guestfs_add_drive (VALUE gv, VALUE filenamev)
923 Data_Get_Struct (gv, guestfs_h, g);
925 rb_raise (rb_eArgError, "%s: used handle after closing it", "add_drive");
927 Check_Type (filenamev, T_STRING);
928 const char *filename = StringValueCStr (filenamev);
930 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
931 "filename", "add_drive");
935 r = guestfs_add_drive (g, filename);
937 rb_raise (e_Error, "%s", guestfs_last_error (g));
942 static VALUE ruby_guestfs_add_cdrom (VALUE gv, VALUE filenamev)
945 Data_Get_Struct (gv, guestfs_h, g);
947 rb_raise (rb_eArgError, "%s: used handle after closing it", "add_cdrom");
949 Check_Type (filenamev, T_STRING);
950 const char *filename = StringValueCStr (filenamev);
952 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
953 "filename", "add_cdrom");
957 r = guestfs_add_cdrom (g, filename);
959 rb_raise (e_Error, "%s", guestfs_last_error (g));
964 static VALUE ruby_guestfs_add_drive_ro (VALUE gv, VALUE filenamev)
967 Data_Get_Struct (gv, guestfs_h, g);
969 rb_raise (rb_eArgError, "%s: used handle after closing it", "add_drive_ro");
971 Check_Type (filenamev, T_STRING);
972 const char *filename = StringValueCStr (filenamev);
974 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
975 "filename", "add_drive_ro");
979 r = guestfs_add_drive_ro (g, filename);
981 rb_raise (e_Error, "%s", guestfs_last_error (g));
986 static VALUE ruby_guestfs_config (VALUE gv, VALUE qemuparamv, VALUE qemuvaluev)
989 Data_Get_Struct (gv, guestfs_h, g);
991 rb_raise (rb_eArgError, "%s: used handle after closing it", "config");
993 Check_Type (qemuparamv, T_STRING);
994 const char *qemuparam = StringValueCStr (qemuparamv);
996 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
997 "qemuparam", "config");
998 const char *qemuvalue = !NIL_P (qemuvaluev) ? StringValueCStr (qemuvaluev) : NULL;
1002 r = guestfs_config (g, qemuparam, qemuvalue);
1004 rb_raise (e_Error, "%s", guestfs_last_error (g));
1009 static VALUE ruby_guestfs_set_qemu (VALUE gv, VALUE qemuv)
1012 Data_Get_Struct (gv, guestfs_h, g);
1014 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_qemu");
1016 Check_Type (qemuv, T_STRING);
1017 const char *qemu = StringValueCStr (qemuv);
1019 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1020 "qemu", "set_qemu");
1024 r = guestfs_set_qemu (g, qemu);
1026 rb_raise (e_Error, "%s", guestfs_last_error (g));
1031 static VALUE ruby_guestfs_get_qemu (VALUE gv)
1034 Data_Get_Struct (gv, guestfs_h, g);
1036 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_qemu");
1041 r = guestfs_get_qemu (g);
1043 rb_raise (e_Error, "%s", guestfs_last_error (g));
1045 return rb_str_new2 (r);
1048 static VALUE ruby_guestfs_set_path (VALUE gv, VALUE pathv)
1051 Data_Get_Struct (gv, guestfs_h, g);
1053 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_path");
1055 Check_Type (pathv, T_STRING);
1056 const char *path = StringValueCStr (pathv);
1058 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1059 "path", "set_path");
1063 r = guestfs_set_path (g, path);
1065 rb_raise (e_Error, "%s", guestfs_last_error (g));
1070 static VALUE ruby_guestfs_get_path (VALUE gv)
1073 Data_Get_Struct (gv, guestfs_h, g);
1075 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_path");
1080 r = guestfs_get_path (g);
1082 rb_raise (e_Error, "%s", guestfs_last_error (g));
1084 return rb_str_new2 (r);
1087 static VALUE ruby_guestfs_set_append (VALUE gv, VALUE appendv)
1090 Data_Get_Struct (gv, guestfs_h, g);
1092 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_append");
1094 Check_Type (appendv, T_STRING);
1095 const char *append = StringValueCStr (appendv);
1097 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1098 "append", "set_append");
1102 r = guestfs_set_append (g, append);
1104 rb_raise (e_Error, "%s", guestfs_last_error (g));
1109 static VALUE ruby_guestfs_get_append (VALUE gv)
1112 Data_Get_Struct (gv, guestfs_h, g);
1114 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_append");
1119 r = guestfs_get_append (g);
1121 rb_raise (e_Error, "%s", guestfs_last_error (g));
1123 return rb_str_new2 (r);
1126 static VALUE ruby_guestfs_set_autosync (VALUE gv, VALUE autosyncv)
1129 Data_Get_Struct (gv, guestfs_h, g);
1131 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_autosync");
1133 int autosync = RTEST (autosyncv);
1137 r = guestfs_set_autosync (g, autosync);
1139 rb_raise (e_Error, "%s", guestfs_last_error (g));
1144 static VALUE ruby_guestfs_get_autosync (VALUE gv)
1147 Data_Get_Struct (gv, guestfs_h, g);
1149 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_autosync");
1154 r = guestfs_get_autosync (g);
1156 rb_raise (e_Error, "%s", guestfs_last_error (g));
1161 static VALUE ruby_guestfs_set_verbose (VALUE gv, VALUE verbosev)
1164 Data_Get_Struct (gv, guestfs_h, g);
1166 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_verbose");
1168 int verbose = RTEST (verbosev);
1172 r = guestfs_set_verbose (g, verbose);
1174 rb_raise (e_Error, "%s", guestfs_last_error (g));
1179 static VALUE ruby_guestfs_get_verbose (VALUE gv)
1182 Data_Get_Struct (gv, guestfs_h, g);
1184 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_verbose");
1189 r = guestfs_get_verbose (g);
1191 rb_raise (e_Error, "%s", guestfs_last_error (g));
1196 static VALUE ruby_guestfs_is_ready (VALUE gv)
1199 Data_Get_Struct (gv, guestfs_h, g);
1201 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_ready");
1206 r = guestfs_is_ready (g);
1208 rb_raise (e_Error, "%s", guestfs_last_error (g));
1213 static VALUE ruby_guestfs_is_config (VALUE gv)
1216 Data_Get_Struct (gv, guestfs_h, g);
1218 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_config");
1223 r = guestfs_is_config (g);
1225 rb_raise (e_Error, "%s", guestfs_last_error (g));
1230 static VALUE ruby_guestfs_is_launching (VALUE gv)
1233 Data_Get_Struct (gv, guestfs_h, g);
1235 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_launching");
1240 r = guestfs_is_launching (g);
1242 rb_raise (e_Error, "%s", guestfs_last_error (g));
1247 static VALUE ruby_guestfs_is_busy (VALUE gv)
1250 Data_Get_Struct (gv, guestfs_h, g);
1252 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_busy");
1257 r = guestfs_is_busy (g);
1259 rb_raise (e_Error, "%s", guestfs_last_error (g));
1264 static VALUE ruby_guestfs_get_state (VALUE gv)
1267 Data_Get_Struct (gv, guestfs_h, g);
1269 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_state");
1274 r = guestfs_get_state (g);
1276 rb_raise (e_Error, "%s", guestfs_last_error (g));
1281 static VALUE ruby_guestfs_set_busy (VALUE gv)
1284 Data_Get_Struct (gv, guestfs_h, g);
1286 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_busy");
1291 r = guestfs_set_busy (g);
1293 rb_raise (e_Error, "%s", guestfs_last_error (g));
1298 static VALUE ruby_guestfs_set_ready (VALUE gv)
1301 Data_Get_Struct (gv, guestfs_h, g);
1303 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_ready");
1308 r = guestfs_set_ready (g);
1310 rb_raise (e_Error, "%s", guestfs_last_error (g));
1315 static VALUE ruby_guestfs_end_busy (VALUE gv)
1318 Data_Get_Struct (gv, guestfs_h, g);
1320 rb_raise (rb_eArgError, "%s: used handle after closing it", "end_busy");
1325 r = guestfs_end_busy (g);
1327 rb_raise (e_Error, "%s", guestfs_last_error (g));
1332 static VALUE ruby_guestfs_mount (VALUE gv, VALUE devicev, VALUE mountpointv)
1335 Data_Get_Struct (gv, guestfs_h, g);
1337 rb_raise (rb_eArgError, "%s: used handle after closing it", "mount");
1339 Check_Type (devicev, T_STRING);
1340 const char *device = StringValueCStr (devicev);
1342 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1344 Check_Type (mountpointv, T_STRING);
1345 const char *mountpoint = StringValueCStr (mountpointv);
1347 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1348 "mountpoint", "mount");
1352 r = guestfs_mount (g, device, mountpoint);
1354 rb_raise (e_Error, "%s", guestfs_last_error (g));
1359 static VALUE ruby_guestfs_sync (VALUE gv)
1362 Data_Get_Struct (gv, guestfs_h, g);
1364 rb_raise (rb_eArgError, "%s: used handle after closing it", "sync");
1369 r = guestfs_sync (g);
1371 rb_raise (e_Error, "%s", guestfs_last_error (g));
1376 static VALUE ruby_guestfs_touch (VALUE gv, VALUE pathv)
1379 Data_Get_Struct (gv, guestfs_h, g);
1381 rb_raise (rb_eArgError, "%s: used handle after closing it", "touch");
1383 Check_Type (pathv, T_STRING);
1384 const char *path = StringValueCStr (pathv);
1386 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1391 r = guestfs_touch (g, path);
1393 rb_raise (e_Error, "%s", guestfs_last_error (g));
1398 static VALUE ruby_guestfs_cat (VALUE gv, VALUE pathv)
1401 Data_Get_Struct (gv, guestfs_h, g);
1403 rb_raise (rb_eArgError, "%s: used handle after closing it", "cat");
1405 Check_Type (pathv, T_STRING);
1406 const char *path = StringValueCStr (pathv);
1408 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1413 r = guestfs_cat (g, path);
1415 rb_raise (e_Error, "%s", guestfs_last_error (g));
1417 VALUE rv = rb_str_new2 (r);
1422 static VALUE ruby_guestfs_ll (VALUE gv, VALUE directoryv)
1425 Data_Get_Struct (gv, guestfs_h, g);
1427 rb_raise (rb_eArgError, "%s: used handle after closing it", "ll");
1429 Check_Type (directoryv, T_STRING);
1430 const char *directory = StringValueCStr (directoryv);
1432 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1437 r = guestfs_ll (g, directory);
1439 rb_raise (e_Error, "%s", guestfs_last_error (g));
1441 VALUE rv = rb_str_new2 (r);
1446 static VALUE ruby_guestfs_ls (VALUE gv, VALUE directoryv)
1449 Data_Get_Struct (gv, guestfs_h, g);
1451 rb_raise (rb_eArgError, "%s: used handle after closing it", "ls");
1453 Check_Type (directoryv, T_STRING);
1454 const char *directory = StringValueCStr (directoryv);
1456 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1461 r = guestfs_ls (g, directory);
1463 rb_raise (e_Error, "%s", guestfs_last_error (g));
1466 for (i = 0; r[i] != NULL; ++i) len++;
1467 VALUE rv = rb_ary_new2 (len);
1468 for (i = 0; r[i] != NULL; ++i) {
1469 rb_ary_push (rv, rb_str_new2 (r[i]));
1476 static VALUE ruby_guestfs_list_devices (VALUE gv)
1479 Data_Get_Struct (gv, guestfs_h, g);
1481 rb_raise (rb_eArgError, "%s: used handle after closing it", "list_devices");
1486 r = guestfs_list_devices (g);
1488 rb_raise (e_Error, "%s", guestfs_last_error (g));
1491 for (i = 0; r[i] != NULL; ++i) len++;
1492 VALUE rv = rb_ary_new2 (len);
1493 for (i = 0; r[i] != NULL; ++i) {
1494 rb_ary_push (rv, rb_str_new2 (r[i]));
1501 static VALUE ruby_guestfs_list_partitions (VALUE gv)
1504 Data_Get_Struct (gv, guestfs_h, g);
1506 rb_raise (rb_eArgError, "%s: used handle after closing it", "list_partitions");
1511 r = guestfs_list_partitions (g);
1513 rb_raise (e_Error, "%s", guestfs_last_error (g));
1516 for (i = 0; r[i] != NULL; ++i) len++;
1517 VALUE rv = rb_ary_new2 (len);
1518 for (i = 0; r[i] != NULL; ++i) {
1519 rb_ary_push (rv, rb_str_new2 (r[i]));
1526 static VALUE ruby_guestfs_pvs (VALUE gv)
1529 Data_Get_Struct (gv, guestfs_h, g);
1531 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvs");
1536 r = guestfs_pvs (g);
1538 rb_raise (e_Error, "%s", guestfs_last_error (g));
1541 for (i = 0; r[i] != NULL; ++i) len++;
1542 VALUE rv = rb_ary_new2 (len);
1543 for (i = 0; r[i] != NULL; ++i) {
1544 rb_ary_push (rv, rb_str_new2 (r[i]));
1551 static VALUE ruby_guestfs_vgs (VALUE gv)
1554 Data_Get_Struct (gv, guestfs_h, g);
1556 rb_raise (rb_eArgError, "%s: used handle after closing it", "vgs");
1561 r = guestfs_vgs (g);
1563 rb_raise (e_Error, "%s", guestfs_last_error (g));
1566 for (i = 0; r[i] != NULL; ++i) len++;
1567 VALUE rv = rb_ary_new2 (len);
1568 for (i = 0; r[i] != NULL; ++i) {
1569 rb_ary_push (rv, rb_str_new2 (r[i]));
1576 static VALUE ruby_guestfs_lvs (VALUE gv)
1579 Data_Get_Struct (gv, guestfs_h, g);
1581 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvs");
1586 r = guestfs_lvs (g);
1588 rb_raise (e_Error, "%s", guestfs_last_error (g));
1591 for (i = 0; r[i] != NULL; ++i) len++;
1592 VALUE rv = rb_ary_new2 (len);
1593 for (i = 0; r[i] != NULL; ++i) {
1594 rb_ary_push (rv, rb_str_new2 (r[i]));
1601 static VALUE ruby_guestfs_pvs_full (VALUE gv)
1604 Data_Get_Struct (gv, guestfs_h, g);
1606 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvs_full");
1609 struct guestfs_lvm_pv_list *r;
1611 r = guestfs_pvs_full (g);
1613 rb_raise (e_Error, "%s", guestfs_last_error (g));
1615 VALUE rv = rb_ary_new2 (r->len);
1617 for (i = 0; i < r->len; ++i) {
1618 VALUE hv = rb_hash_new ();
1619 rb_hash_aset (rv, rb_str_new2 ("pv_name"), rb_str_new2 (r->val[i].pv_name));
1620 rb_hash_aset (rv, rb_str_new2 ("pv_uuid"), rb_str_new (r->val[i].pv_uuid, 32));
1621 rb_hash_aset (rv, rb_str_new2 ("pv_fmt"), rb_str_new2 (r->val[i].pv_fmt));
1622 rb_hash_aset (rv, rb_str_new2 ("pv_size"), ULL2NUM (r->val[i].pv_size));
1623 rb_hash_aset (rv, rb_str_new2 ("dev_size"), ULL2NUM (r->val[i].dev_size));
1624 rb_hash_aset (rv, rb_str_new2 ("pv_free"), ULL2NUM (r->val[i].pv_free));
1625 rb_hash_aset (rv, rb_str_new2 ("pv_used"), ULL2NUM (r->val[i].pv_used));
1626 rb_hash_aset (rv, rb_str_new2 ("pv_attr"), rb_str_new2 (r->val[i].pv_attr));
1627 rb_hash_aset (rv, rb_str_new2 ("pv_pe_count"), ULL2NUM (r->val[i].pv_pe_count));
1628 rb_hash_aset (rv, rb_str_new2 ("pv_pe_alloc_count"), ULL2NUM (r->val[i].pv_pe_alloc_count));
1629 rb_hash_aset (rv, rb_str_new2 ("pv_tags"), rb_str_new2 (r->val[i].pv_tags));
1630 rb_hash_aset (rv, rb_str_new2 ("pe_start"), ULL2NUM (r->val[i].pe_start));
1631 rb_hash_aset (rv, rb_str_new2 ("pv_mda_count"), ULL2NUM (r->val[i].pv_mda_count));
1632 rb_hash_aset (rv, rb_str_new2 ("pv_mda_free"), ULL2NUM (r->val[i].pv_mda_free));
1633 rb_ary_push (rv, hv);
1635 guestfs_free_lvm_pv_list (r);
1639 static VALUE ruby_guestfs_vgs_full (VALUE gv)
1642 Data_Get_Struct (gv, guestfs_h, g);
1644 rb_raise (rb_eArgError, "%s: used handle after closing it", "vgs_full");
1647 struct guestfs_lvm_vg_list *r;
1649 r = guestfs_vgs_full (g);
1651 rb_raise (e_Error, "%s", guestfs_last_error (g));
1653 VALUE rv = rb_ary_new2 (r->len);
1655 for (i = 0; i < r->len; ++i) {
1656 VALUE hv = rb_hash_new ();
1657 rb_hash_aset (rv, rb_str_new2 ("vg_name"), rb_str_new2 (r->val[i].vg_name));
1658 rb_hash_aset (rv, rb_str_new2 ("vg_uuid"), rb_str_new (r->val[i].vg_uuid, 32));
1659 rb_hash_aset (rv, rb_str_new2 ("vg_fmt"), rb_str_new2 (r->val[i].vg_fmt));
1660 rb_hash_aset (rv, rb_str_new2 ("vg_attr"), rb_str_new2 (r->val[i].vg_attr));
1661 rb_hash_aset (rv, rb_str_new2 ("vg_size"), ULL2NUM (r->val[i].vg_size));
1662 rb_hash_aset (rv, rb_str_new2 ("vg_free"), ULL2NUM (r->val[i].vg_free));
1663 rb_hash_aset (rv, rb_str_new2 ("vg_sysid"), rb_str_new2 (r->val[i].vg_sysid));
1664 rb_hash_aset (rv, rb_str_new2 ("vg_extent_size"), ULL2NUM (r->val[i].vg_extent_size));
1665 rb_hash_aset (rv, rb_str_new2 ("vg_extent_count"), ULL2NUM (r->val[i].vg_extent_count));
1666 rb_hash_aset (rv, rb_str_new2 ("vg_free_count"), ULL2NUM (r->val[i].vg_free_count));
1667 rb_hash_aset (rv, rb_str_new2 ("max_lv"), ULL2NUM (r->val[i].max_lv));
1668 rb_hash_aset (rv, rb_str_new2 ("max_pv"), ULL2NUM (r->val[i].max_pv));
1669 rb_hash_aset (rv, rb_str_new2 ("pv_count"), ULL2NUM (r->val[i].pv_count));
1670 rb_hash_aset (rv, rb_str_new2 ("lv_count"), ULL2NUM (r->val[i].lv_count));
1671 rb_hash_aset (rv, rb_str_new2 ("snap_count"), ULL2NUM (r->val[i].snap_count));
1672 rb_hash_aset (rv, rb_str_new2 ("vg_seqno"), ULL2NUM (r->val[i].vg_seqno));
1673 rb_hash_aset (rv, rb_str_new2 ("vg_tags"), rb_str_new2 (r->val[i].vg_tags));
1674 rb_hash_aset (rv, rb_str_new2 ("vg_mda_count"), ULL2NUM (r->val[i].vg_mda_count));
1675 rb_hash_aset (rv, rb_str_new2 ("vg_mda_free"), ULL2NUM (r->val[i].vg_mda_free));
1676 rb_ary_push (rv, hv);
1678 guestfs_free_lvm_vg_list (r);
1682 static VALUE ruby_guestfs_lvs_full (VALUE gv)
1685 Data_Get_Struct (gv, guestfs_h, g);
1687 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvs_full");
1690 struct guestfs_lvm_lv_list *r;
1692 r = guestfs_lvs_full (g);
1694 rb_raise (e_Error, "%s", guestfs_last_error (g));
1696 VALUE rv = rb_ary_new2 (r->len);
1698 for (i = 0; i < r->len; ++i) {
1699 VALUE hv = rb_hash_new ();
1700 rb_hash_aset (rv, rb_str_new2 ("lv_name"), rb_str_new2 (r->val[i].lv_name));
1701 rb_hash_aset (rv, rb_str_new2 ("lv_uuid"), rb_str_new (r->val[i].lv_uuid, 32));
1702 rb_hash_aset (rv, rb_str_new2 ("lv_attr"), rb_str_new2 (r->val[i].lv_attr));
1703 rb_hash_aset (rv, rb_str_new2 ("lv_major"), ULL2NUM (r->val[i].lv_major));
1704 rb_hash_aset (rv, rb_str_new2 ("lv_minor"), ULL2NUM (r->val[i].lv_minor));
1705 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_major"), ULL2NUM (r->val[i].lv_kernel_major));
1706 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_minor"), ULL2NUM (r->val[i].lv_kernel_minor));
1707 rb_hash_aset (rv, rb_str_new2 ("lv_size"), ULL2NUM (r->val[i].lv_size));
1708 rb_hash_aset (rv, rb_str_new2 ("seg_count"), ULL2NUM (r->val[i].seg_count));
1709 rb_hash_aset (rv, rb_str_new2 ("origin"), rb_str_new2 (r->val[i].origin));
1710 rb_hash_aset (rv, rb_str_new2 ("snap_percent"), rb_dbl2big (r->val[i].snap_percent));
1711 rb_hash_aset (rv, rb_str_new2 ("copy_percent"), rb_dbl2big (r->val[i].copy_percent));
1712 rb_hash_aset (rv, rb_str_new2 ("move_pv"), rb_str_new2 (r->val[i].move_pv));
1713 rb_hash_aset (rv, rb_str_new2 ("lv_tags"), rb_str_new2 (r->val[i].lv_tags));
1714 rb_hash_aset (rv, rb_str_new2 ("mirror_log"), rb_str_new2 (r->val[i].mirror_log));
1715 rb_hash_aset (rv, rb_str_new2 ("modules"), rb_str_new2 (r->val[i].modules));
1716 rb_ary_push (rv, hv);
1718 guestfs_free_lvm_lv_list (r);
1722 static VALUE ruby_guestfs_read_lines (VALUE gv, VALUE pathv)
1725 Data_Get_Struct (gv, guestfs_h, g);
1727 rb_raise (rb_eArgError, "%s: used handle after closing it", "read_lines");
1729 Check_Type (pathv, T_STRING);
1730 const char *path = StringValueCStr (pathv);
1732 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1733 "path", "read_lines");
1737 r = guestfs_read_lines (g, path);
1739 rb_raise (e_Error, "%s", guestfs_last_error (g));
1742 for (i = 0; r[i] != NULL; ++i) len++;
1743 VALUE rv = rb_ary_new2 (len);
1744 for (i = 0; r[i] != NULL; ++i) {
1745 rb_ary_push (rv, rb_str_new2 (r[i]));
1752 static VALUE ruby_guestfs_aug_init (VALUE gv, VALUE rootv, VALUE flagsv)
1755 Data_Get_Struct (gv, guestfs_h, g);
1757 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_init");
1759 Check_Type (rootv, T_STRING);
1760 const char *root = StringValueCStr (rootv);
1762 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1763 "root", "aug_init");
1764 int flags = NUM2INT (flagsv);
1768 r = guestfs_aug_init (g, root, flags);
1770 rb_raise (e_Error, "%s", guestfs_last_error (g));
1775 static VALUE ruby_guestfs_aug_close (VALUE gv)
1778 Data_Get_Struct (gv, guestfs_h, g);
1780 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_close");
1785 r = guestfs_aug_close (g);
1787 rb_raise (e_Error, "%s", guestfs_last_error (g));
1792 static VALUE ruby_guestfs_aug_defvar (VALUE gv, VALUE namev, VALUE exprv)
1795 Data_Get_Struct (gv, guestfs_h, g);
1797 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_defvar");
1799 Check_Type (namev, T_STRING);
1800 const char *name = StringValueCStr (namev);
1802 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1803 "name", "aug_defvar");
1804 const char *expr = !NIL_P (exprv) ? StringValueCStr (exprv) : NULL;
1808 r = guestfs_aug_defvar (g, name, expr);
1810 rb_raise (e_Error, "%s", guestfs_last_error (g));
1815 static VALUE ruby_guestfs_aug_defnode (VALUE gv, VALUE namev, VALUE exprv, VALUE valv)
1818 Data_Get_Struct (gv, guestfs_h, g);
1820 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_defnode");
1822 Check_Type (namev, T_STRING);
1823 const char *name = StringValueCStr (namev);
1825 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1826 "name", "aug_defnode");
1827 Check_Type (exprv, T_STRING);
1828 const char *expr = StringValueCStr (exprv);
1830 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1831 "expr", "aug_defnode");
1832 Check_Type (valv, T_STRING);
1833 const char *val = StringValueCStr (valv);
1835 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1836 "val", "aug_defnode");
1838 struct guestfs_int_bool *r;
1840 r = guestfs_aug_defnode (g, name, expr, val);
1842 rb_raise (e_Error, "%s", guestfs_last_error (g));
1844 VALUE rv = rb_ary_new2 (2);
1845 rb_ary_push (rv, INT2NUM (r->i));
1846 rb_ary_push (rv, INT2NUM (r->b));
1847 guestfs_free_int_bool (r);
1851 static VALUE ruby_guestfs_aug_get (VALUE gv, VALUE pathv)
1854 Data_Get_Struct (gv, guestfs_h, g);
1856 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_get");
1858 Check_Type (pathv, T_STRING);
1859 const char *path = StringValueCStr (pathv);
1861 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1866 r = guestfs_aug_get (g, path);
1868 rb_raise (e_Error, "%s", guestfs_last_error (g));
1870 VALUE rv = rb_str_new2 (r);
1875 static VALUE ruby_guestfs_aug_set (VALUE gv, VALUE pathv, VALUE valv)
1878 Data_Get_Struct (gv, guestfs_h, g);
1880 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_set");
1882 Check_Type (pathv, T_STRING);
1883 const char *path = StringValueCStr (pathv);
1885 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1887 Check_Type (valv, T_STRING);
1888 const char *val = StringValueCStr (valv);
1890 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1895 r = guestfs_aug_set (g, path, val);
1897 rb_raise (e_Error, "%s", guestfs_last_error (g));
1902 static VALUE ruby_guestfs_aug_insert (VALUE gv, VALUE pathv, VALUE labelv, VALUE beforev)
1905 Data_Get_Struct (gv, guestfs_h, g);
1907 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_insert");
1909 Check_Type (pathv, T_STRING);
1910 const char *path = StringValueCStr (pathv);
1912 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1913 "path", "aug_insert");
1914 Check_Type (labelv, T_STRING);
1915 const char *label = StringValueCStr (labelv);
1917 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1918 "label", "aug_insert");
1919 int before = RTEST (beforev);
1923 r = guestfs_aug_insert (g, path, label, before);
1925 rb_raise (e_Error, "%s", guestfs_last_error (g));
1930 static VALUE ruby_guestfs_aug_rm (VALUE gv, VALUE pathv)
1933 Data_Get_Struct (gv, guestfs_h, g);
1935 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_rm");
1937 Check_Type (pathv, T_STRING);
1938 const char *path = StringValueCStr (pathv);
1940 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1945 r = guestfs_aug_rm (g, path);
1947 rb_raise (e_Error, "%s", guestfs_last_error (g));
1952 static VALUE ruby_guestfs_aug_mv (VALUE gv, VALUE srcv, VALUE destv)
1955 Data_Get_Struct (gv, guestfs_h, g);
1957 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_mv");
1959 Check_Type (srcv, T_STRING);
1960 const char *src = StringValueCStr (srcv);
1962 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1964 Check_Type (destv, T_STRING);
1965 const char *dest = StringValueCStr (destv);
1967 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1972 r = guestfs_aug_mv (g, src, dest);
1974 rb_raise (e_Error, "%s", guestfs_last_error (g));
1979 static VALUE ruby_guestfs_aug_match (VALUE gv, VALUE pathv)
1982 Data_Get_Struct (gv, guestfs_h, g);
1984 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_match");
1986 Check_Type (pathv, T_STRING);
1987 const char *path = StringValueCStr (pathv);
1989 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1990 "path", "aug_match");
1994 r = guestfs_aug_match (g, path);
1996 rb_raise (e_Error, "%s", guestfs_last_error (g));
1999 for (i = 0; r[i] != NULL; ++i) len++;
2000 VALUE rv = rb_ary_new2 (len);
2001 for (i = 0; r[i] != NULL; ++i) {
2002 rb_ary_push (rv, rb_str_new2 (r[i]));
2009 static VALUE ruby_guestfs_aug_save (VALUE gv)
2012 Data_Get_Struct (gv, guestfs_h, g);
2014 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_save");
2019 r = guestfs_aug_save (g);
2021 rb_raise (e_Error, "%s", guestfs_last_error (g));
2026 static VALUE ruby_guestfs_aug_load (VALUE gv)
2029 Data_Get_Struct (gv, guestfs_h, g);
2031 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_load");
2036 r = guestfs_aug_load (g);
2038 rb_raise (e_Error, "%s", guestfs_last_error (g));
2043 static VALUE ruby_guestfs_aug_ls (VALUE gv, VALUE pathv)
2046 Data_Get_Struct (gv, guestfs_h, g);
2048 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_ls");
2050 Check_Type (pathv, T_STRING);
2051 const char *path = StringValueCStr (pathv);
2053 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2058 r = guestfs_aug_ls (g, path);
2060 rb_raise (e_Error, "%s", guestfs_last_error (g));
2063 for (i = 0; r[i] != NULL; ++i) len++;
2064 VALUE rv = rb_ary_new2 (len);
2065 for (i = 0; r[i] != NULL; ++i) {
2066 rb_ary_push (rv, rb_str_new2 (r[i]));
2073 static VALUE ruby_guestfs_rm (VALUE gv, VALUE pathv)
2076 Data_Get_Struct (gv, guestfs_h, g);
2078 rb_raise (rb_eArgError, "%s: used handle after closing it", "rm");
2080 Check_Type (pathv, T_STRING);
2081 const char *path = StringValueCStr (pathv);
2083 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2088 r = guestfs_rm (g, path);
2090 rb_raise (e_Error, "%s", guestfs_last_error (g));
2095 static VALUE ruby_guestfs_rmdir (VALUE gv, VALUE pathv)
2098 Data_Get_Struct (gv, guestfs_h, g);
2100 rb_raise (rb_eArgError, "%s: used handle after closing it", "rmdir");
2102 Check_Type (pathv, T_STRING);
2103 const char *path = StringValueCStr (pathv);
2105 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2110 r = guestfs_rmdir (g, path);
2112 rb_raise (e_Error, "%s", guestfs_last_error (g));
2117 static VALUE ruby_guestfs_rm_rf (VALUE gv, VALUE pathv)
2120 Data_Get_Struct (gv, guestfs_h, g);
2122 rb_raise (rb_eArgError, "%s: used handle after closing it", "rm_rf");
2124 Check_Type (pathv, T_STRING);
2125 const char *path = StringValueCStr (pathv);
2127 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2132 r = guestfs_rm_rf (g, path);
2134 rb_raise (e_Error, "%s", guestfs_last_error (g));
2139 static VALUE ruby_guestfs_mkdir (VALUE gv, VALUE pathv)
2142 Data_Get_Struct (gv, guestfs_h, g);
2144 rb_raise (rb_eArgError, "%s: used handle after closing it", "mkdir");
2146 Check_Type (pathv, T_STRING);
2147 const char *path = StringValueCStr (pathv);
2149 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2154 r = guestfs_mkdir (g, path);
2156 rb_raise (e_Error, "%s", guestfs_last_error (g));
2161 static VALUE ruby_guestfs_mkdir_p (VALUE gv, VALUE pathv)
2164 Data_Get_Struct (gv, guestfs_h, g);
2166 rb_raise (rb_eArgError, "%s: used handle after closing it", "mkdir_p");
2168 Check_Type (pathv, T_STRING);
2169 const char *path = StringValueCStr (pathv);
2171 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2176 r = guestfs_mkdir_p (g, path);
2178 rb_raise (e_Error, "%s", guestfs_last_error (g));
2183 static VALUE ruby_guestfs_chmod (VALUE gv, VALUE modev, VALUE pathv)
2186 Data_Get_Struct (gv, guestfs_h, g);
2188 rb_raise (rb_eArgError, "%s: used handle after closing it", "chmod");
2190 int mode = NUM2INT (modev);
2191 Check_Type (pathv, T_STRING);
2192 const char *path = StringValueCStr (pathv);
2194 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2199 r = guestfs_chmod (g, mode, path);
2201 rb_raise (e_Error, "%s", guestfs_last_error (g));
2206 static VALUE ruby_guestfs_chown (VALUE gv, VALUE ownerv, VALUE groupv, VALUE pathv)
2209 Data_Get_Struct (gv, guestfs_h, g);
2211 rb_raise (rb_eArgError, "%s: used handle after closing it", "chown");
2213 int owner = NUM2INT (ownerv);
2214 int group = NUM2INT (groupv);
2215 Check_Type (pathv, T_STRING);
2216 const char *path = StringValueCStr (pathv);
2218 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2223 r = guestfs_chown (g, owner, group, path);
2225 rb_raise (e_Error, "%s", guestfs_last_error (g));
2230 static VALUE ruby_guestfs_exists (VALUE gv, VALUE pathv)
2233 Data_Get_Struct (gv, guestfs_h, g);
2235 rb_raise (rb_eArgError, "%s: used handle after closing it", "exists");
2237 Check_Type (pathv, T_STRING);
2238 const char *path = StringValueCStr (pathv);
2240 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2245 r = guestfs_exists (g, path);
2247 rb_raise (e_Error, "%s", guestfs_last_error (g));
2252 static VALUE ruby_guestfs_is_file (VALUE gv, VALUE pathv)
2255 Data_Get_Struct (gv, guestfs_h, g);
2257 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_file");
2259 Check_Type (pathv, T_STRING);
2260 const char *path = StringValueCStr (pathv);
2262 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2267 r = guestfs_is_file (g, path);
2269 rb_raise (e_Error, "%s", guestfs_last_error (g));
2274 static VALUE ruby_guestfs_is_dir (VALUE gv, VALUE pathv)
2277 Data_Get_Struct (gv, guestfs_h, g);
2279 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_dir");
2281 Check_Type (pathv, T_STRING);
2282 const char *path = StringValueCStr (pathv);
2284 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2289 r = guestfs_is_dir (g, path);
2291 rb_raise (e_Error, "%s", guestfs_last_error (g));
2296 static VALUE ruby_guestfs_pvcreate (VALUE gv, VALUE devicev)
2299 Data_Get_Struct (gv, guestfs_h, g);
2301 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvcreate");
2303 Check_Type (devicev, T_STRING);
2304 const char *device = StringValueCStr (devicev);
2306 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2307 "device", "pvcreate");
2311 r = guestfs_pvcreate (g, device);
2313 rb_raise (e_Error, "%s", guestfs_last_error (g));
2318 static VALUE ruby_guestfs_vgcreate (VALUE gv, VALUE volgroupv, VALUE physvolsv)
2321 Data_Get_Struct (gv, guestfs_h, g);
2323 rb_raise (rb_eArgError, "%s: used handle after closing it", "vgcreate");
2325 Check_Type (volgroupv, T_STRING);
2326 const char *volgroup = StringValueCStr (volgroupv);
2328 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2329 "volgroup", "vgcreate");
2331 Check_Type (physvolsv, T_ARRAY);
2334 len = RARRAY_LEN (physvolsv);
2335 physvols = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
2336 for (i = 0; i < len; ++i) {
2337 VALUE v = rb_ary_entry (physvolsv, i);
2338 physvols[i] = StringValueCStr (v);
2340 physvols[len] = NULL;
2345 r = guestfs_vgcreate (g, volgroup, physvols);
2348 rb_raise (e_Error, "%s", guestfs_last_error (g));
2353 static VALUE ruby_guestfs_lvcreate (VALUE gv, VALUE logvolv, VALUE volgroupv, VALUE mbytesv)
2356 Data_Get_Struct (gv, guestfs_h, g);
2358 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvcreate");
2360 Check_Type (logvolv, T_STRING);
2361 const char *logvol = StringValueCStr (logvolv);
2363 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2364 "logvol", "lvcreate");
2365 Check_Type (volgroupv, T_STRING);
2366 const char *volgroup = StringValueCStr (volgroupv);
2368 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2369 "volgroup", "lvcreate");
2370 int mbytes = NUM2INT (mbytesv);
2374 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
2376 rb_raise (e_Error, "%s", guestfs_last_error (g));
2381 static VALUE ruby_guestfs_mkfs (VALUE gv, VALUE fstypev, VALUE devicev)
2384 Data_Get_Struct (gv, guestfs_h, g);
2386 rb_raise (rb_eArgError, "%s: used handle after closing it", "mkfs");
2388 Check_Type (fstypev, T_STRING);
2389 const char *fstype = StringValueCStr (fstypev);
2391 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2393 Check_Type (devicev, T_STRING);
2394 const char *device = StringValueCStr (devicev);
2396 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2401 r = guestfs_mkfs (g, fstype, device);
2403 rb_raise (e_Error, "%s", guestfs_last_error (g));
2408 static VALUE ruby_guestfs_sfdisk (VALUE gv, VALUE devicev, VALUE cylsv, VALUE headsv, VALUE sectorsv, VALUE linesv)
2411 Data_Get_Struct (gv, guestfs_h, g);
2413 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk");
2415 Check_Type (devicev, T_STRING);
2416 const char *device = StringValueCStr (devicev);
2418 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2419 "device", "sfdisk");
2420 int cyls = NUM2INT (cylsv);
2421 int heads = NUM2INT (headsv);
2422 int sectors = NUM2INT (sectorsv);
2424 Check_Type (linesv, T_ARRAY);
2427 len = RARRAY_LEN (linesv);
2428 lines = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
2429 for (i = 0; i < len; ++i) {
2430 VALUE v = rb_ary_entry (linesv, i);
2431 lines[i] = StringValueCStr (v);
2438 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
2441 rb_raise (e_Error, "%s", guestfs_last_error (g));
2446 static VALUE ruby_guestfs_write_file (VALUE gv, VALUE pathv, VALUE contentv, VALUE sizev)
2449 Data_Get_Struct (gv, guestfs_h, g);
2451 rb_raise (rb_eArgError, "%s: used handle after closing it", "write_file");
2453 Check_Type (pathv, T_STRING);
2454 const char *path = StringValueCStr (pathv);
2456 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2457 "path", "write_file");
2458 Check_Type (contentv, T_STRING);
2459 const char *content = StringValueCStr (contentv);
2461 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2462 "content", "write_file");
2463 int size = NUM2INT (sizev);
2467 r = guestfs_write_file (g, path, content, size);
2469 rb_raise (e_Error, "%s", guestfs_last_error (g));
2474 static VALUE ruby_guestfs_umount (VALUE gv, VALUE pathordevicev)
2477 Data_Get_Struct (gv, guestfs_h, g);
2479 rb_raise (rb_eArgError, "%s: used handle after closing it", "umount");
2481 Check_Type (pathordevicev, T_STRING);
2482 const char *pathordevice = StringValueCStr (pathordevicev);
2484 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2485 "pathordevice", "umount");
2489 r = guestfs_umount (g, pathordevice);
2491 rb_raise (e_Error, "%s", guestfs_last_error (g));
2496 static VALUE ruby_guestfs_mounts (VALUE gv)
2499 Data_Get_Struct (gv, guestfs_h, g);
2501 rb_raise (rb_eArgError, "%s: used handle after closing it", "mounts");
2506 r = guestfs_mounts (g);
2508 rb_raise (e_Error, "%s", guestfs_last_error (g));
2511 for (i = 0; r[i] != NULL; ++i) len++;
2512 VALUE rv = rb_ary_new2 (len);
2513 for (i = 0; r[i] != NULL; ++i) {
2514 rb_ary_push (rv, rb_str_new2 (r[i]));
2521 static VALUE ruby_guestfs_umount_all (VALUE gv)
2524 Data_Get_Struct (gv, guestfs_h, g);
2526 rb_raise (rb_eArgError, "%s: used handle after closing it", "umount_all");
2531 r = guestfs_umount_all (g);
2533 rb_raise (e_Error, "%s", guestfs_last_error (g));
2538 static VALUE ruby_guestfs_lvm_remove_all (VALUE gv)
2541 Data_Get_Struct (gv, guestfs_h, g);
2543 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvm_remove_all");
2548 r = guestfs_lvm_remove_all (g);
2550 rb_raise (e_Error, "%s", guestfs_last_error (g));
2555 static VALUE ruby_guestfs_file (VALUE gv, VALUE pathv)
2558 Data_Get_Struct (gv, guestfs_h, g);
2560 rb_raise (rb_eArgError, "%s: used handle after closing it", "file");
2562 Check_Type (pathv, T_STRING);
2563 const char *path = StringValueCStr (pathv);
2565 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2570 r = guestfs_file (g, path);
2572 rb_raise (e_Error, "%s", guestfs_last_error (g));
2574 VALUE rv = rb_str_new2 (r);
2579 static VALUE ruby_guestfs_command (VALUE gv, VALUE argumentsv)
2582 Data_Get_Struct (gv, guestfs_h, g);
2584 rb_raise (rb_eArgError, "%s: used handle after closing it", "command");
2587 Check_Type (argumentsv, T_ARRAY);
2590 len = RARRAY_LEN (argumentsv);
2591 arguments = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
2592 for (i = 0; i < len; ++i) {
2593 VALUE v = rb_ary_entry (argumentsv, i);
2594 arguments[i] = StringValueCStr (v);
2596 arguments[len] = NULL;
2601 r = guestfs_command (g, arguments);
2604 rb_raise (e_Error, "%s", guestfs_last_error (g));
2606 VALUE rv = rb_str_new2 (r);
2611 static VALUE ruby_guestfs_command_lines (VALUE gv, VALUE argumentsv)
2614 Data_Get_Struct (gv, guestfs_h, g);
2616 rb_raise (rb_eArgError, "%s: used handle after closing it", "command_lines");
2619 Check_Type (argumentsv, T_ARRAY);
2622 len = RARRAY_LEN (argumentsv);
2623 arguments = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
2624 for (i = 0; i < len; ++i) {
2625 VALUE v = rb_ary_entry (argumentsv, i);
2626 arguments[i] = StringValueCStr (v);
2628 arguments[len] = NULL;
2633 r = guestfs_command_lines (g, arguments);
2636 rb_raise (e_Error, "%s", guestfs_last_error (g));
2639 for (i = 0; r[i] != NULL; ++i) len++;
2640 VALUE rv = rb_ary_new2 (len);
2641 for (i = 0; r[i] != NULL; ++i) {
2642 rb_ary_push (rv, rb_str_new2 (r[i]));
2649 static VALUE ruby_guestfs_stat (VALUE gv, VALUE pathv)
2652 Data_Get_Struct (gv, guestfs_h, g);
2654 rb_raise (rb_eArgError, "%s: used handle after closing it", "stat");
2656 Check_Type (pathv, T_STRING);
2657 const char *path = StringValueCStr (pathv);
2659 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2662 struct guestfs_stat *r;
2664 r = guestfs_stat (g, path);
2666 rb_raise (e_Error, "%s", guestfs_last_error (g));
2668 VALUE rv = rb_hash_new ();
2669 rb_hash_aset (rv, rb_str_new2 ("dev"), ULL2NUM (r->dev));
2670 rb_hash_aset (rv, rb_str_new2 ("ino"), ULL2NUM (r->ino));
2671 rb_hash_aset (rv, rb_str_new2 ("mode"), ULL2NUM (r->mode));
2672 rb_hash_aset (rv, rb_str_new2 ("nlink"), ULL2NUM (r->nlink));
2673 rb_hash_aset (rv, rb_str_new2 ("uid"), ULL2NUM (r->uid));
2674 rb_hash_aset (rv, rb_str_new2 ("gid"), ULL2NUM (r->gid));
2675 rb_hash_aset (rv, rb_str_new2 ("rdev"), ULL2NUM (r->rdev));
2676 rb_hash_aset (rv, rb_str_new2 ("size"), ULL2NUM (r->size));
2677 rb_hash_aset (rv, rb_str_new2 ("blksize"), ULL2NUM (r->blksize));
2678 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
2679 rb_hash_aset (rv, rb_str_new2 ("atime"), ULL2NUM (r->atime));
2680 rb_hash_aset (rv, rb_str_new2 ("mtime"), ULL2NUM (r->mtime));
2681 rb_hash_aset (rv, rb_str_new2 ("ctime"), ULL2NUM (r->ctime));
2686 static VALUE ruby_guestfs_lstat (VALUE gv, VALUE pathv)
2689 Data_Get_Struct (gv, guestfs_h, g);
2691 rb_raise (rb_eArgError, "%s: used handle after closing it", "lstat");
2693 Check_Type (pathv, T_STRING);
2694 const char *path = StringValueCStr (pathv);
2696 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2699 struct guestfs_stat *r;
2701 r = guestfs_lstat (g, path);
2703 rb_raise (e_Error, "%s", guestfs_last_error (g));
2705 VALUE rv = rb_hash_new ();
2706 rb_hash_aset (rv, rb_str_new2 ("dev"), ULL2NUM (r->dev));
2707 rb_hash_aset (rv, rb_str_new2 ("ino"), ULL2NUM (r->ino));
2708 rb_hash_aset (rv, rb_str_new2 ("mode"), ULL2NUM (r->mode));
2709 rb_hash_aset (rv, rb_str_new2 ("nlink"), ULL2NUM (r->nlink));
2710 rb_hash_aset (rv, rb_str_new2 ("uid"), ULL2NUM (r->uid));
2711 rb_hash_aset (rv, rb_str_new2 ("gid"), ULL2NUM (r->gid));
2712 rb_hash_aset (rv, rb_str_new2 ("rdev"), ULL2NUM (r->rdev));
2713 rb_hash_aset (rv, rb_str_new2 ("size"), ULL2NUM (r->size));
2714 rb_hash_aset (rv, rb_str_new2 ("blksize"), ULL2NUM (r->blksize));
2715 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
2716 rb_hash_aset (rv, rb_str_new2 ("atime"), ULL2NUM (r->atime));
2717 rb_hash_aset (rv, rb_str_new2 ("mtime"), ULL2NUM (r->mtime));
2718 rb_hash_aset (rv, rb_str_new2 ("ctime"), ULL2NUM (r->ctime));
2723 static VALUE ruby_guestfs_statvfs (VALUE gv, VALUE pathv)
2726 Data_Get_Struct (gv, guestfs_h, g);
2728 rb_raise (rb_eArgError, "%s: used handle after closing it", "statvfs");
2730 Check_Type (pathv, T_STRING);
2731 const char *path = StringValueCStr (pathv);
2733 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2736 struct guestfs_statvfs *r;
2738 r = guestfs_statvfs (g, path);
2740 rb_raise (e_Error, "%s", guestfs_last_error (g));
2742 VALUE rv = rb_hash_new ();
2743 rb_hash_aset (rv, rb_str_new2 ("bsize"), ULL2NUM (r->bsize));
2744 rb_hash_aset (rv, rb_str_new2 ("frsize"), ULL2NUM (r->frsize));
2745 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
2746 rb_hash_aset (rv, rb_str_new2 ("bfree"), ULL2NUM (r->bfree));
2747 rb_hash_aset (rv, rb_str_new2 ("bavail"), ULL2NUM (r->bavail));
2748 rb_hash_aset (rv, rb_str_new2 ("files"), ULL2NUM (r->files));
2749 rb_hash_aset (rv, rb_str_new2 ("ffree"), ULL2NUM (r->ffree));
2750 rb_hash_aset (rv, rb_str_new2 ("favail"), ULL2NUM (r->favail));
2751 rb_hash_aset (rv, rb_str_new2 ("fsid"), ULL2NUM (r->fsid));
2752 rb_hash_aset (rv, rb_str_new2 ("flag"), ULL2NUM (r->flag));
2753 rb_hash_aset (rv, rb_str_new2 ("namemax"), ULL2NUM (r->namemax));
2758 static VALUE ruby_guestfs_tune2fs_l (VALUE gv, VALUE devicev)
2761 Data_Get_Struct (gv, guestfs_h, g);
2763 rb_raise (rb_eArgError, "%s: used handle after closing it", "tune2fs_l");
2765 Check_Type (devicev, T_STRING);
2766 const char *device = StringValueCStr (devicev);
2768 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2769 "device", "tune2fs_l");
2773 r = guestfs_tune2fs_l (g, device);
2775 rb_raise (e_Error, "%s", guestfs_last_error (g));
2777 VALUE rv = rb_hash_new ();
2779 for (i = 0; r[i] != NULL; i+=2) {
2780 rb_hash_aset (rv, rb_str_new2 (r[i]), rb_str_new2 (r[i+1]));
2788 static VALUE ruby_guestfs_blockdev_setro (VALUE gv, VALUE devicev)
2791 Data_Get_Struct (gv, guestfs_h, g);
2793 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_setro");
2795 Check_Type (devicev, T_STRING);
2796 const char *device = StringValueCStr (devicev);
2798 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2799 "device", "blockdev_setro");
2803 r = guestfs_blockdev_setro (g, device);
2805 rb_raise (e_Error, "%s", guestfs_last_error (g));
2810 static VALUE ruby_guestfs_blockdev_setrw (VALUE gv, VALUE devicev)
2813 Data_Get_Struct (gv, guestfs_h, g);
2815 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_setrw");
2817 Check_Type (devicev, T_STRING);
2818 const char *device = StringValueCStr (devicev);
2820 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2821 "device", "blockdev_setrw");
2825 r = guestfs_blockdev_setrw (g, device);
2827 rb_raise (e_Error, "%s", guestfs_last_error (g));
2832 static VALUE ruby_guestfs_blockdev_getro (VALUE gv, VALUE devicev)
2835 Data_Get_Struct (gv, guestfs_h, g);
2837 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getro");
2839 Check_Type (devicev, T_STRING);
2840 const char *device = StringValueCStr (devicev);
2842 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2843 "device", "blockdev_getro");
2847 r = guestfs_blockdev_getro (g, device);
2849 rb_raise (e_Error, "%s", guestfs_last_error (g));
2854 static VALUE ruby_guestfs_blockdev_getss (VALUE gv, VALUE devicev)
2857 Data_Get_Struct (gv, guestfs_h, g);
2859 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getss");
2861 Check_Type (devicev, T_STRING);
2862 const char *device = StringValueCStr (devicev);
2864 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2865 "device", "blockdev_getss");
2869 r = guestfs_blockdev_getss (g, device);
2871 rb_raise (e_Error, "%s", guestfs_last_error (g));
2876 static VALUE ruby_guestfs_blockdev_getbsz (VALUE gv, VALUE devicev)
2879 Data_Get_Struct (gv, guestfs_h, g);
2881 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getbsz");
2883 Check_Type (devicev, T_STRING);
2884 const char *device = StringValueCStr (devicev);
2886 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2887 "device", "blockdev_getbsz");
2891 r = guestfs_blockdev_getbsz (g, device);
2893 rb_raise (e_Error, "%s", guestfs_last_error (g));
2898 static VALUE ruby_guestfs_blockdev_setbsz (VALUE gv, VALUE devicev, VALUE blocksizev)
2901 Data_Get_Struct (gv, guestfs_h, g);
2903 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_setbsz");
2905 Check_Type (devicev, T_STRING);
2906 const char *device = StringValueCStr (devicev);
2908 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2909 "device", "blockdev_setbsz");
2910 int blocksize = NUM2INT (blocksizev);
2914 r = guestfs_blockdev_setbsz (g, device, blocksize);
2916 rb_raise (e_Error, "%s", guestfs_last_error (g));
2921 static VALUE ruby_guestfs_blockdev_getsz (VALUE gv, VALUE devicev)
2924 Data_Get_Struct (gv, guestfs_h, g);
2926 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getsz");
2928 Check_Type (devicev, T_STRING);
2929 const char *device = StringValueCStr (devicev);
2931 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2932 "device", "blockdev_getsz");
2936 r = guestfs_blockdev_getsz (g, device);
2938 rb_raise (e_Error, "%s", guestfs_last_error (g));
2943 static VALUE ruby_guestfs_blockdev_getsize64 (VALUE gv, VALUE devicev)
2946 Data_Get_Struct (gv, guestfs_h, g);
2948 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getsize64");
2950 Check_Type (devicev, T_STRING);
2951 const char *device = StringValueCStr (devicev);
2953 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2954 "device", "blockdev_getsize64");
2958 r = guestfs_blockdev_getsize64 (g, device);
2960 rb_raise (e_Error, "%s", guestfs_last_error (g));
2965 static VALUE ruby_guestfs_blockdev_flushbufs (VALUE gv, VALUE devicev)
2968 Data_Get_Struct (gv, guestfs_h, g);
2970 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_flushbufs");
2972 Check_Type (devicev, T_STRING);
2973 const char *device = StringValueCStr (devicev);
2975 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2976 "device", "blockdev_flushbufs");
2980 r = guestfs_blockdev_flushbufs (g, device);
2982 rb_raise (e_Error, "%s", guestfs_last_error (g));
2987 static VALUE ruby_guestfs_blockdev_rereadpt (VALUE gv, VALUE devicev)
2990 Data_Get_Struct (gv, guestfs_h, g);
2992 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_rereadpt");
2994 Check_Type (devicev, T_STRING);
2995 const char *device = StringValueCStr (devicev);
2997 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2998 "device", "blockdev_rereadpt");
3002 r = guestfs_blockdev_rereadpt (g, device);
3004 rb_raise (e_Error, "%s", guestfs_last_error (g));
3009 static VALUE ruby_guestfs_upload (VALUE gv, VALUE filenamev, VALUE remotefilenamev)
3012 Data_Get_Struct (gv, guestfs_h, g);
3014 rb_raise (rb_eArgError, "%s: used handle after closing it", "upload");
3016 Check_Type (filenamev, T_STRING);
3017 const char *filename = StringValueCStr (filenamev);
3019 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3020 "filename", "upload");
3021 Check_Type (remotefilenamev, T_STRING);
3022 const char *remotefilename = StringValueCStr (remotefilenamev);
3023 if (!remotefilename)
3024 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3025 "remotefilename", "upload");
3029 r = guestfs_upload (g, filename, remotefilename);
3031 rb_raise (e_Error, "%s", guestfs_last_error (g));
3036 static VALUE ruby_guestfs_download (VALUE gv, VALUE remotefilenamev, VALUE filenamev)
3039 Data_Get_Struct (gv, guestfs_h, g);
3041 rb_raise (rb_eArgError, "%s: used handle after closing it", "download");
3043 Check_Type (remotefilenamev, T_STRING);
3044 const char *remotefilename = StringValueCStr (remotefilenamev);
3045 if (!remotefilename)
3046 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3047 "remotefilename", "download");
3048 Check_Type (filenamev, T_STRING);
3049 const char *filename = StringValueCStr (filenamev);
3051 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3052 "filename", "download");
3056 r = guestfs_download (g, remotefilename, filename);
3058 rb_raise (e_Error, "%s", guestfs_last_error (g));
3063 static VALUE ruby_guestfs_checksum (VALUE gv, VALUE csumtypev, VALUE pathv)
3066 Data_Get_Struct (gv, guestfs_h, g);
3068 rb_raise (rb_eArgError, "%s: used handle after closing it", "checksum");
3070 Check_Type (csumtypev, T_STRING);
3071 const char *csumtype = StringValueCStr (csumtypev);
3073 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3074 "csumtype", "checksum");
3075 Check_Type (pathv, T_STRING);
3076 const char *path = StringValueCStr (pathv);
3078 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3079 "path", "checksum");
3083 r = guestfs_checksum (g, csumtype, path);
3085 rb_raise (e_Error, "%s", guestfs_last_error (g));
3087 VALUE rv = rb_str_new2 (r);
3092 static VALUE ruby_guestfs_tar_in (VALUE gv, VALUE tarfilev, VALUE directoryv)
3095 Data_Get_Struct (gv, guestfs_h, g);
3097 rb_raise (rb_eArgError, "%s: used handle after closing it", "tar_in");
3099 Check_Type (tarfilev, T_STRING);
3100 const char *tarfile = StringValueCStr (tarfilev);
3102 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3103 "tarfile", "tar_in");
3104 Check_Type (directoryv, T_STRING);
3105 const char *directory = StringValueCStr (directoryv);
3107 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3108 "directory", "tar_in");
3112 r = guestfs_tar_in (g, tarfile, directory);
3114 rb_raise (e_Error, "%s", guestfs_last_error (g));
3119 static VALUE ruby_guestfs_tar_out (VALUE gv, VALUE directoryv, VALUE tarfilev)
3122 Data_Get_Struct (gv, guestfs_h, g);
3124 rb_raise (rb_eArgError, "%s: used handle after closing it", "tar_out");
3126 Check_Type (directoryv, T_STRING);
3127 const char *directory = StringValueCStr (directoryv);
3129 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3130 "directory", "tar_out");
3131 Check_Type (tarfilev, T_STRING);
3132 const char *tarfile = StringValueCStr (tarfilev);
3134 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3135 "tarfile", "tar_out");
3139 r = guestfs_tar_out (g, directory, tarfile);
3141 rb_raise (e_Error, "%s", guestfs_last_error (g));
3146 static VALUE ruby_guestfs_tgz_in (VALUE gv, VALUE tarballv, VALUE directoryv)
3149 Data_Get_Struct (gv, guestfs_h, g);
3151 rb_raise (rb_eArgError, "%s: used handle after closing it", "tgz_in");
3153 Check_Type (tarballv, T_STRING);
3154 const char *tarball = StringValueCStr (tarballv);
3156 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3157 "tarball", "tgz_in");
3158 Check_Type (directoryv, T_STRING);
3159 const char *directory = StringValueCStr (directoryv);
3161 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3162 "directory", "tgz_in");
3166 r = guestfs_tgz_in (g, tarball, directory);
3168 rb_raise (e_Error, "%s", guestfs_last_error (g));
3173 static VALUE ruby_guestfs_tgz_out (VALUE gv, VALUE directoryv, VALUE tarballv)
3176 Data_Get_Struct (gv, guestfs_h, g);
3178 rb_raise (rb_eArgError, "%s: used handle after closing it", "tgz_out");
3180 Check_Type (directoryv, T_STRING);
3181 const char *directory = StringValueCStr (directoryv);
3183 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3184 "directory", "tgz_out");
3185 Check_Type (tarballv, T_STRING);
3186 const char *tarball = StringValueCStr (tarballv);
3188 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3189 "tarball", "tgz_out");
3193 r = guestfs_tgz_out (g, directory, tarball);
3195 rb_raise (e_Error, "%s", guestfs_last_error (g));
3200 static VALUE ruby_guestfs_mount_ro (VALUE gv, VALUE devicev, VALUE mountpointv)
3203 Data_Get_Struct (gv, guestfs_h, g);
3205 rb_raise (rb_eArgError, "%s: used handle after closing it", "mount_ro");
3207 Check_Type (devicev, T_STRING);
3208 const char *device = StringValueCStr (devicev);
3210 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3211 "device", "mount_ro");
3212 Check_Type (mountpointv, T_STRING);
3213 const char *mountpoint = StringValueCStr (mountpointv);
3215 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3216 "mountpoint", "mount_ro");
3220 r = guestfs_mount_ro (g, device, mountpoint);
3222 rb_raise (e_Error, "%s", guestfs_last_error (g));
3227 static VALUE ruby_guestfs_mount_options (VALUE gv, VALUE optionsv, VALUE devicev, VALUE mountpointv)
3230 Data_Get_Struct (gv, guestfs_h, g);
3232 rb_raise (rb_eArgError, "%s: used handle after closing it", "mount_options");
3234 Check_Type (optionsv, T_STRING);
3235 const char *options = StringValueCStr (optionsv);
3237 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3238 "options", "mount_options");
3239 Check_Type (devicev, T_STRING);
3240 const char *device = StringValueCStr (devicev);
3242 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3243 "device", "mount_options");
3244 Check_Type (mountpointv, T_STRING);
3245 const char *mountpoint = StringValueCStr (mountpointv);
3247 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3248 "mountpoint", "mount_options");
3252 r = guestfs_mount_options (g, options, device, mountpoint);
3254 rb_raise (e_Error, "%s", guestfs_last_error (g));
3259 static VALUE ruby_guestfs_mount_vfs (VALUE gv, VALUE optionsv, VALUE vfstypev, VALUE devicev, VALUE mountpointv)
3262 Data_Get_Struct (gv, guestfs_h, g);
3264 rb_raise (rb_eArgError, "%s: used handle after closing it", "mount_vfs");
3266 Check_Type (optionsv, T_STRING);
3267 const char *options = StringValueCStr (optionsv);
3269 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3270 "options", "mount_vfs");
3271 Check_Type (vfstypev, T_STRING);
3272 const char *vfstype = StringValueCStr (vfstypev);
3274 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3275 "vfstype", "mount_vfs");
3276 Check_Type (devicev, T_STRING);
3277 const char *device = StringValueCStr (devicev);
3279 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3280 "device", "mount_vfs");
3281 Check_Type (mountpointv, T_STRING);
3282 const char *mountpoint = StringValueCStr (mountpointv);
3284 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3285 "mountpoint", "mount_vfs");
3289 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
3291 rb_raise (e_Error, "%s", guestfs_last_error (g));
3296 static VALUE ruby_guestfs_debug (VALUE gv, VALUE subcmdv, VALUE extraargsv)
3299 Data_Get_Struct (gv, guestfs_h, g);
3301 rb_raise (rb_eArgError, "%s: used handle after closing it", "debug");
3303 Check_Type (subcmdv, T_STRING);
3304 const char *subcmd = StringValueCStr (subcmdv);
3306 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3309 Check_Type (extraargsv, T_ARRAY);
3312 len = RARRAY_LEN (extraargsv);
3313 extraargs = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
3314 for (i = 0; i < len; ++i) {
3315 VALUE v = rb_ary_entry (extraargsv, i);
3316 extraargs[i] = StringValueCStr (v);
3318 extraargs[len] = NULL;
3323 r = guestfs_debug (g, subcmd, extraargs);
3326 rb_raise (e_Error, "%s", guestfs_last_error (g));
3328 VALUE rv = rb_str_new2 (r);
3333 static VALUE ruby_guestfs_lvremove (VALUE gv, VALUE devicev)
3336 Data_Get_Struct (gv, guestfs_h, g);
3338 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvremove");
3340 Check_Type (devicev, T_STRING);
3341 const char *device = StringValueCStr (devicev);
3343 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3344 "device", "lvremove");
3348 r = guestfs_lvremove (g, device);
3350 rb_raise (e_Error, "%s", guestfs_last_error (g));
3355 static VALUE ruby_guestfs_vgremove (VALUE gv, VALUE vgnamev)
3358 Data_Get_Struct (gv, guestfs_h, g);
3360 rb_raise (rb_eArgError, "%s: used handle after closing it", "vgremove");
3362 Check_Type (vgnamev, T_STRING);
3363 const char *vgname = StringValueCStr (vgnamev);
3365 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3366 "vgname", "vgremove");
3370 r = guestfs_vgremove (g, vgname);
3372 rb_raise (e_Error, "%s", guestfs_last_error (g));
3377 static VALUE ruby_guestfs_pvremove (VALUE gv, VALUE devicev)
3380 Data_Get_Struct (gv, guestfs_h, g);
3382 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvremove");
3384 Check_Type (devicev, T_STRING);
3385 const char *device = StringValueCStr (devicev);
3387 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3388 "device", "pvremove");
3392 r = guestfs_pvremove (g, device);
3394 rb_raise (e_Error, "%s", guestfs_last_error (g));
3399 static VALUE ruby_guestfs_set_e2label (VALUE gv, VALUE devicev, VALUE labelv)
3402 Data_Get_Struct (gv, guestfs_h, g);
3404 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_e2label");
3406 Check_Type (devicev, T_STRING);
3407 const char *device = StringValueCStr (devicev);
3409 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3410 "device", "set_e2label");
3411 Check_Type (labelv, T_STRING);
3412 const char *label = StringValueCStr (labelv);
3414 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3415 "label", "set_e2label");
3419 r = guestfs_set_e2label (g, device, label);
3421 rb_raise (e_Error, "%s", guestfs_last_error (g));
3426 static VALUE ruby_guestfs_get_e2label (VALUE gv, VALUE devicev)
3429 Data_Get_Struct (gv, guestfs_h, g);
3431 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_e2label");
3433 Check_Type (devicev, T_STRING);
3434 const char *device = StringValueCStr (devicev);
3436 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3437 "device", "get_e2label");
3441 r = guestfs_get_e2label (g, device);
3443 rb_raise (e_Error, "%s", guestfs_last_error (g));
3445 VALUE rv = rb_str_new2 (r);
3450 static VALUE ruby_guestfs_set_e2uuid (VALUE gv, VALUE devicev, VALUE uuidv)
3453 Data_Get_Struct (gv, guestfs_h, g);
3455 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_e2uuid");
3457 Check_Type (devicev, T_STRING);
3458 const char *device = StringValueCStr (devicev);
3460 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3461 "device", "set_e2uuid");
3462 Check_Type (uuidv, T_STRING);
3463 const char *uuid = StringValueCStr (uuidv);
3465 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3466 "uuid", "set_e2uuid");
3470 r = guestfs_set_e2uuid (g, device, uuid);
3472 rb_raise (e_Error, "%s", guestfs_last_error (g));
3477 static VALUE ruby_guestfs_get_e2uuid (VALUE gv, VALUE devicev)
3480 Data_Get_Struct (gv, guestfs_h, g);
3482 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_e2uuid");
3484 Check_Type (devicev, T_STRING);
3485 const char *device = StringValueCStr (devicev);
3487 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3488 "device", "get_e2uuid");
3492 r = guestfs_get_e2uuid (g, device);
3494 rb_raise (e_Error, "%s", guestfs_last_error (g));
3496 VALUE rv = rb_str_new2 (r);
3501 static VALUE ruby_guestfs_fsck (VALUE gv, VALUE fstypev, VALUE devicev)
3504 Data_Get_Struct (gv, guestfs_h, g);
3506 rb_raise (rb_eArgError, "%s: used handle after closing it", "fsck");
3508 Check_Type (fstypev, T_STRING);
3509 const char *fstype = StringValueCStr (fstypev);
3511 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3513 Check_Type (devicev, T_STRING);
3514 const char *device = StringValueCStr (devicev);
3516 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3521 r = guestfs_fsck (g, fstype, device);
3523 rb_raise (e_Error, "%s", guestfs_last_error (g));
3528 static VALUE ruby_guestfs_zero (VALUE gv, VALUE devicev)
3531 Data_Get_Struct (gv, guestfs_h, g);
3533 rb_raise (rb_eArgError, "%s: used handle after closing it", "zero");
3535 Check_Type (devicev, T_STRING);
3536 const char *device = StringValueCStr (devicev);
3538 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3543 r = guestfs_zero (g, device);
3545 rb_raise (e_Error, "%s", guestfs_last_error (g));
3550 static VALUE ruby_guestfs_grub_install (VALUE gv, VALUE rootv, VALUE devicev)
3553 Data_Get_Struct (gv, guestfs_h, g);
3555 rb_raise (rb_eArgError, "%s: used handle after closing it", "grub_install");
3557 Check_Type (rootv, T_STRING);
3558 const char *root = StringValueCStr (rootv);
3560 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3561 "root", "grub_install");
3562 Check_Type (devicev, T_STRING);
3563 const char *device = StringValueCStr (devicev);
3565 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3566 "device", "grub_install");
3570 r = guestfs_grub_install (g, root, device);
3572 rb_raise (e_Error, "%s", guestfs_last_error (g));
3577 static VALUE ruby_guestfs_cp (VALUE gv, VALUE srcv, VALUE destv)
3580 Data_Get_Struct (gv, guestfs_h, g);
3582 rb_raise (rb_eArgError, "%s: used handle after closing it", "cp");
3584 Check_Type (srcv, T_STRING);
3585 const char *src = StringValueCStr (srcv);
3587 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3589 Check_Type (destv, T_STRING);
3590 const char *dest = StringValueCStr (destv);
3592 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3597 r = guestfs_cp (g, src, dest);
3599 rb_raise (e_Error, "%s", guestfs_last_error (g));
3604 static VALUE ruby_guestfs_cp_a (VALUE gv, VALUE srcv, VALUE destv)
3607 Data_Get_Struct (gv, guestfs_h, g);
3609 rb_raise (rb_eArgError, "%s: used handle after closing it", "cp_a");
3611 Check_Type (srcv, T_STRING);
3612 const char *src = StringValueCStr (srcv);
3614 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3616 Check_Type (destv, T_STRING);
3617 const char *dest = StringValueCStr (destv);
3619 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3624 r = guestfs_cp_a (g, src, dest);
3626 rb_raise (e_Error, "%s", guestfs_last_error (g));
3631 static VALUE ruby_guestfs_mv (VALUE gv, VALUE srcv, VALUE destv)
3634 Data_Get_Struct (gv, guestfs_h, g);
3636 rb_raise (rb_eArgError, "%s: used handle after closing it", "mv");
3638 Check_Type (srcv, T_STRING);
3639 const char *src = StringValueCStr (srcv);
3641 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3643 Check_Type (destv, T_STRING);
3644 const char *dest = StringValueCStr (destv);
3646 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3651 r = guestfs_mv (g, src, dest);
3653 rb_raise (e_Error, "%s", guestfs_last_error (g));
3658 static VALUE ruby_guestfs_drop_caches (VALUE gv, VALUE whattodropv)
3661 Data_Get_Struct (gv, guestfs_h, g);
3663 rb_raise (rb_eArgError, "%s: used handle after closing it", "drop_caches");
3665 int whattodrop = NUM2INT (whattodropv);
3669 r = guestfs_drop_caches (g, whattodrop);
3671 rb_raise (e_Error, "%s", guestfs_last_error (g));
3676 static VALUE ruby_guestfs_dmesg (VALUE gv)
3679 Data_Get_Struct (gv, guestfs_h, g);
3681 rb_raise (rb_eArgError, "%s: used handle after closing it", "dmesg");
3686 r = guestfs_dmesg (g);
3688 rb_raise (e_Error, "%s", guestfs_last_error (g));
3690 VALUE rv = rb_str_new2 (r);
3695 static VALUE ruby_guestfs_ping_daemon (VALUE gv)
3698 Data_Get_Struct (gv, guestfs_h, g);
3700 rb_raise (rb_eArgError, "%s: used handle after closing it", "ping_daemon");
3705 r = guestfs_ping_daemon (g);
3707 rb_raise (e_Error, "%s", guestfs_last_error (g));
3712 static VALUE ruby_guestfs_equal (VALUE gv, VALUE file1v, VALUE file2v)
3715 Data_Get_Struct (gv, guestfs_h, g);
3717 rb_raise (rb_eArgError, "%s: used handle after closing it", "equal");
3719 Check_Type (file1v, T_STRING);
3720 const char *file1 = StringValueCStr (file1v);
3722 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3724 Check_Type (file2v, T_STRING);
3725 const char *file2 = StringValueCStr (file2v);
3727 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3732 r = guestfs_equal (g, file1, file2);
3734 rb_raise (e_Error, "%s", guestfs_last_error (g));
3739 static VALUE ruby_guestfs_strings (VALUE gv, VALUE pathv)
3742 Data_Get_Struct (gv, guestfs_h, g);
3744 rb_raise (rb_eArgError, "%s: used handle after closing it", "strings");
3746 Check_Type (pathv, T_STRING);
3747 const char *path = StringValueCStr (pathv);
3749 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3754 r = guestfs_strings (g, path);
3756 rb_raise (e_Error, "%s", guestfs_last_error (g));
3759 for (i = 0; r[i] != NULL; ++i) len++;
3760 VALUE rv = rb_ary_new2 (len);
3761 for (i = 0; r[i] != NULL; ++i) {
3762 rb_ary_push (rv, rb_str_new2 (r[i]));
3769 static VALUE ruby_guestfs_strings_e (VALUE gv, VALUE encodingv, VALUE pathv)
3772 Data_Get_Struct (gv, guestfs_h, g);
3774 rb_raise (rb_eArgError, "%s: used handle after closing it", "strings_e");
3776 Check_Type (encodingv, T_STRING);
3777 const char *encoding = StringValueCStr (encodingv);
3779 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3780 "encoding", "strings_e");
3781 Check_Type (pathv, T_STRING);
3782 const char *path = StringValueCStr (pathv);
3784 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3785 "path", "strings_e");
3789 r = guestfs_strings_e (g, encoding, path);
3791 rb_raise (e_Error, "%s", guestfs_last_error (g));
3794 for (i = 0; r[i] != NULL; ++i) len++;
3795 VALUE rv = rb_ary_new2 (len);
3796 for (i = 0; r[i] != NULL; ++i) {
3797 rb_ary_push (rv, rb_str_new2 (r[i]));
3804 static VALUE ruby_guestfs_hexdump (VALUE gv, VALUE pathv)
3807 Data_Get_Struct (gv, guestfs_h, g);
3809 rb_raise (rb_eArgError, "%s: used handle after closing it", "hexdump");
3811 Check_Type (pathv, T_STRING);
3812 const char *path = StringValueCStr (pathv);
3814 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3819 r = guestfs_hexdump (g, path);
3821 rb_raise (e_Error, "%s", guestfs_last_error (g));
3823 VALUE rv = rb_str_new2 (r);
3828 static VALUE ruby_guestfs_zerofree (VALUE gv, VALUE devicev)
3831 Data_Get_Struct (gv, guestfs_h, g);
3833 rb_raise (rb_eArgError, "%s: used handle after closing it", "zerofree");
3835 Check_Type (devicev, T_STRING);
3836 const char *device = StringValueCStr (devicev);
3838 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3839 "device", "zerofree");
3843 r = guestfs_zerofree (g, device);
3845 rb_raise (e_Error, "%s", guestfs_last_error (g));
3850 static VALUE ruby_guestfs_pvresize (VALUE gv, VALUE devicev)
3853 Data_Get_Struct (gv, guestfs_h, g);
3855 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvresize");
3857 Check_Type (devicev, T_STRING);
3858 const char *device = StringValueCStr (devicev);
3860 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3861 "device", "pvresize");
3865 r = guestfs_pvresize (g, device);
3867 rb_raise (e_Error, "%s", guestfs_last_error (g));
3872 static VALUE ruby_guestfs_sfdisk_N (VALUE gv, VALUE devicev, VALUE partnumv, VALUE cylsv, VALUE headsv, VALUE sectorsv, VALUE linev)
3875 Data_Get_Struct (gv, guestfs_h, g);
3877 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk_N");
3879 Check_Type (devicev, T_STRING);
3880 const char *device = StringValueCStr (devicev);
3882 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3883 "device", "sfdisk_N");
3884 int partnum = NUM2INT (partnumv);
3885 int cyls = NUM2INT (cylsv);
3886 int heads = NUM2INT (headsv);
3887 int sectors = NUM2INT (sectorsv);
3888 Check_Type (linev, T_STRING);
3889 const char *line = StringValueCStr (linev);
3891 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3892 "line", "sfdisk_N");
3896 r = guestfs_sfdisk_N (g, device, partnum, cyls, heads, sectors, line);
3898 rb_raise (e_Error, "%s", guestfs_last_error (g));
3903 static VALUE ruby_guestfs_sfdisk_l (VALUE gv, VALUE devicev)
3906 Data_Get_Struct (gv, guestfs_h, g);
3908 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk_l");
3910 Check_Type (devicev, T_STRING);
3911 const char *device = StringValueCStr (devicev);
3913 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3914 "device", "sfdisk_l");
3918 r = guestfs_sfdisk_l (g, device);
3920 rb_raise (e_Error, "%s", guestfs_last_error (g));
3922 VALUE rv = rb_str_new2 (r);
3927 static VALUE ruby_guestfs_sfdisk_kernel_geometry (VALUE gv, VALUE devicev)
3930 Data_Get_Struct (gv, guestfs_h, g);
3932 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk_kernel_geometry");
3934 Check_Type (devicev, T_STRING);
3935 const char *device = StringValueCStr (devicev);
3937 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3938 "device", "sfdisk_kernel_geometry");
3942 r = guestfs_sfdisk_kernel_geometry (g, device);
3944 rb_raise (e_Error, "%s", guestfs_last_error (g));
3946 VALUE rv = rb_str_new2 (r);
3951 static VALUE ruby_guestfs_sfdisk_disk_geometry (VALUE gv, VALUE devicev)
3954 Data_Get_Struct (gv, guestfs_h, g);
3956 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk_disk_geometry");
3958 Check_Type (devicev, T_STRING);
3959 const char *device = StringValueCStr (devicev);
3961 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3962 "device", "sfdisk_disk_geometry");
3966 r = guestfs_sfdisk_disk_geometry (g, device);
3968 rb_raise (e_Error, "%s", guestfs_last_error (g));
3970 VALUE rv = rb_str_new2 (r);
3975 static VALUE ruby_guestfs_vg_activate_all (VALUE gv, VALUE activatev)
3978 Data_Get_Struct (gv, guestfs_h, g);
3980 rb_raise (rb_eArgError, "%s: used handle after closing it", "vg_activate_all");
3982 int activate = RTEST (activatev);
3986 r = guestfs_vg_activate_all (g, activate);
3988 rb_raise (e_Error, "%s", guestfs_last_error (g));
3993 static VALUE ruby_guestfs_vg_activate (VALUE gv, VALUE activatev, VALUE volgroupsv)
3996 Data_Get_Struct (gv, guestfs_h, g);
3998 rb_raise (rb_eArgError, "%s: used handle after closing it", "vg_activate");
4000 int activate = RTEST (activatev);
4002 Check_Type (volgroupsv, T_ARRAY);
4005 len = RARRAY_LEN (volgroupsv);
4006 volgroups = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
4007 for (i = 0; i < len; ++i) {
4008 VALUE v = rb_ary_entry (volgroupsv, i);
4009 volgroups[i] = StringValueCStr (v);
4011 volgroups[len] = NULL;
4016 r = guestfs_vg_activate (g, activate, volgroups);
4019 rb_raise (e_Error, "%s", guestfs_last_error (g));
4024 static VALUE ruby_guestfs_lvresize (VALUE gv, VALUE devicev, VALUE mbytesv)
4027 Data_Get_Struct (gv, guestfs_h, g);
4029 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvresize");
4031 Check_Type (devicev, T_STRING);
4032 const char *device = StringValueCStr (devicev);
4034 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4035 "device", "lvresize");
4036 int mbytes = NUM2INT (mbytesv);
4040 r = guestfs_lvresize (g, device, mbytes);
4042 rb_raise (e_Error, "%s", guestfs_last_error (g));
4047 static VALUE ruby_guestfs_resize2fs (VALUE gv, VALUE devicev)
4050 Data_Get_Struct (gv, guestfs_h, g);
4052 rb_raise (rb_eArgError, "%s: used handle after closing it", "resize2fs");
4054 Check_Type (devicev, T_STRING);
4055 const char *device = StringValueCStr (devicev);
4057 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4058 "device", "resize2fs");
4062 r = guestfs_resize2fs (g, device);
4064 rb_raise (e_Error, "%s", guestfs_last_error (g));
4069 static VALUE ruby_guestfs_find (VALUE gv, VALUE directoryv)
4072 Data_Get_Struct (gv, guestfs_h, g);
4074 rb_raise (rb_eArgError, "%s: used handle after closing it", "find");
4076 Check_Type (directoryv, T_STRING);
4077 const char *directory = StringValueCStr (directoryv);
4079 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4080 "directory", "find");
4084 r = guestfs_find (g, directory);
4086 rb_raise (e_Error, "%s", guestfs_last_error (g));
4089 for (i = 0; r[i] != NULL; ++i) len++;
4090 VALUE rv = rb_ary_new2 (len);
4091 for (i = 0; r[i] != NULL; ++i) {
4092 rb_ary_push (rv, rb_str_new2 (r[i]));
4099 static VALUE ruby_guestfs_e2fsck_f (VALUE gv, VALUE devicev)
4102 Data_Get_Struct (gv, guestfs_h, g);
4104 rb_raise (rb_eArgError, "%s: used handle after closing it", "e2fsck_f");
4106 Check_Type (devicev, T_STRING);
4107 const char *device = StringValueCStr (devicev);
4109 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4110 "device", "e2fsck_f");
4114 r = guestfs_e2fsck_f (g, device);
4116 rb_raise (e_Error, "%s", guestfs_last_error (g));
4121 static VALUE ruby_guestfs_sleep (VALUE gv, VALUE secsv)
4124 Data_Get_Struct (gv, guestfs_h, g);
4126 rb_raise (rb_eArgError, "%s: used handle after closing it", "sleep");
4128 int secs = NUM2INT (secsv);
4132 r = guestfs_sleep (g, secs);
4134 rb_raise (e_Error, "%s", guestfs_last_error (g));
4139 static VALUE ruby_guestfs_ntfs_3g_probe (VALUE gv, VALUE rwv, VALUE devicev)
4142 Data_Get_Struct (gv, guestfs_h, g);
4144 rb_raise (rb_eArgError, "%s: used handle after closing it", "ntfs_3g_probe");
4146 int rw = RTEST (rwv);
4147 Check_Type (devicev, T_STRING);
4148 const char *device = StringValueCStr (devicev);
4150 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4151 "device", "ntfs_3g_probe");
4155 r = guestfs_ntfs_3g_probe (g, rw, device);
4157 rb_raise (e_Error, "%s", guestfs_last_error (g));
4162 static VALUE ruby_guestfs_sh (VALUE gv, VALUE commandv)
4165 Data_Get_Struct (gv, guestfs_h, g);
4167 rb_raise (rb_eArgError, "%s: used handle after closing it", "sh");
4169 Check_Type (commandv, T_STRING);
4170 const char *command = StringValueCStr (commandv);
4172 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4177 r = guestfs_sh (g, command);
4179 rb_raise (e_Error, "%s", guestfs_last_error (g));
4181 VALUE rv = rb_str_new2 (r);
4186 static VALUE ruby_guestfs_sh_lines (VALUE gv, VALUE commandv)
4189 Data_Get_Struct (gv, guestfs_h, g);
4191 rb_raise (rb_eArgError, "%s: used handle after closing it", "sh_lines");
4193 Check_Type (commandv, T_STRING);
4194 const char *command = StringValueCStr (commandv);
4196 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4197 "command", "sh_lines");
4201 r = guestfs_sh_lines (g, command);
4203 rb_raise (e_Error, "%s", guestfs_last_error (g));
4206 for (i = 0; r[i] != NULL; ++i) len++;
4207 VALUE rv = rb_ary_new2 (len);
4208 for (i = 0; r[i] != NULL; ++i) {
4209 rb_ary_push (rv, rb_str_new2 (r[i]));
4216 static VALUE ruby_guestfs_glob_expand (VALUE gv, VALUE patternv)
4219 Data_Get_Struct (gv, guestfs_h, g);
4221 rb_raise (rb_eArgError, "%s: used handle after closing it", "glob_expand");
4223 Check_Type (patternv, T_STRING);
4224 const char *pattern = StringValueCStr (patternv);
4226 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4227 "pattern", "glob_expand");
4231 r = guestfs_glob_expand (g, pattern);
4233 rb_raise (e_Error, "%s", guestfs_last_error (g));
4236 for (i = 0; r[i] != NULL; ++i) len++;
4237 VALUE rv = rb_ary_new2 (len);
4238 for (i = 0; r[i] != NULL; ++i) {
4239 rb_ary_push (rv, rb_str_new2 (r[i]));
4246 static VALUE ruby_guestfs_scrub_device (VALUE gv, VALUE devicev)
4249 Data_Get_Struct (gv, guestfs_h, g);
4251 rb_raise (rb_eArgError, "%s: used handle after closing it", "scrub_device");
4253 Check_Type (devicev, T_STRING);
4254 const char *device = StringValueCStr (devicev);
4256 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4257 "device", "scrub_device");
4261 r = guestfs_scrub_device (g, device);
4263 rb_raise (e_Error, "%s", guestfs_last_error (g));
4268 static VALUE ruby_guestfs_scrub_file (VALUE gv, VALUE filev)
4271 Data_Get_Struct (gv, guestfs_h, g);
4273 rb_raise (rb_eArgError, "%s: used handle after closing it", "scrub_file");
4275 Check_Type (filev, T_STRING);
4276 const char *file = StringValueCStr (filev);
4278 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4279 "file", "scrub_file");
4283 r = guestfs_scrub_file (g, file);
4285 rb_raise (e_Error, "%s", guestfs_last_error (g));
4290 static VALUE ruby_guestfs_scrub_freespace (VALUE gv, VALUE dirv)
4293 Data_Get_Struct (gv, guestfs_h, g);
4295 rb_raise (rb_eArgError, "%s: used handle after closing it", "scrub_freespace");
4297 Check_Type (dirv, T_STRING);
4298 const char *dir = StringValueCStr (dirv);
4300 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4301 "dir", "scrub_freespace");
4305 r = guestfs_scrub_freespace (g, dir);
4307 rb_raise (e_Error, "%s", guestfs_last_error (g));
4312 static VALUE ruby_guestfs_mkdtemp (VALUE gv, VALUE templatev)
4315 Data_Get_Struct (gv, guestfs_h, g);
4317 rb_raise (rb_eArgError, "%s: used handle after closing it", "mkdtemp");
4319 Check_Type (templatev, T_STRING);
4320 const char *template = StringValueCStr (templatev);
4322 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4323 "template", "mkdtemp");
4327 r = guestfs_mkdtemp (g, template);
4329 rb_raise (e_Error, "%s", guestfs_last_error (g));
4331 VALUE rv = rb_str_new2 (r);
4336 static VALUE ruby_guestfs_wc_l (VALUE gv, VALUE pathv)
4339 Data_Get_Struct (gv, guestfs_h, g);
4341 rb_raise (rb_eArgError, "%s: used handle after closing it", "wc_l");
4343 Check_Type (pathv, T_STRING);
4344 const char *path = StringValueCStr (pathv);
4346 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4351 r = guestfs_wc_l (g, path);
4353 rb_raise (e_Error, "%s", guestfs_last_error (g));
4358 static VALUE ruby_guestfs_wc_w (VALUE gv, VALUE pathv)
4361 Data_Get_Struct (gv, guestfs_h, g);
4363 rb_raise (rb_eArgError, "%s: used handle after closing it", "wc_w");
4365 Check_Type (pathv, T_STRING);
4366 const char *path = StringValueCStr (pathv);
4368 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4373 r = guestfs_wc_w (g, path);
4375 rb_raise (e_Error, "%s", guestfs_last_error (g));
4380 static VALUE ruby_guestfs_wc_c (VALUE gv, VALUE pathv)
4383 Data_Get_Struct (gv, guestfs_h, g);
4385 rb_raise (rb_eArgError, "%s: used handle after closing it", "wc_c");
4387 Check_Type (pathv, T_STRING);
4388 const char *path = StringValueCStr (pathv);
4390 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4395 r = guestfs_wc_c (g, path);
4397 rb_raise (e_Error, "%s", guestfs_last_error (g));
4402 static VALUE ruby_guestfs_head (VALUE gv, VALUE pathv)
4405 Data_Get_Struct (gv, guestfs_h, g);
4407 rb_raise (rb_eArgError, "%s: used handle after closing it", "head");
4409 Check_Type (pathv, T_STRING);
4410 const char *path = StringValueCStr (pathv);
4412 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4417 r = guestfs_head (g, path);
4419 rb_raise (e_Error, "%s", guestfs_last_error (g));
4422 for (i = 0; r[i] != NULL; ++i) len++;
4423 VALUE rv = rb_ary_new2 (len);
4424 for (i = 0; r[i] != NULL; ++i) {
4425 rb_ary_push (rv, rb_str_new2 (r[i]));
4432 static VALUE ruby_guestfs_head_n (VALUE gv, VALUE nrlinesv, VALUE pathv)
4435 Data_Get_Struct (gv, guestfs_h, g);
4437 rb_raise (rb_eArgError, "%s: used handle after closing it", "head_n");
4439 int nrlines = NUM2INT (nrlinesv);
4440 Check_Type (pathv, T_STRING);
4441 const char *path = StringValueCStr (pathv);
4443 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4448 r = guestfs_head_n (g, nrlines, path);
4450 rb_raise (e_Error, "%s", guestfs_last_error (g));
4453 for (i = 0; r[i] != NULL; ++i) len++;
4454 VALUE rv = rb_ary_new2 (len);
4455 for (i = 0; r[i] != NULL; ++i) {
4456 rb_ary_push (rv, rb_str_new2 (r[i]));
4463 static VALUE ruby_guestfs_tail (VALUE gv, VALUE pathv)
4466 Data_Get_Struct (gv, guestfs_h, g);
4468 rb_raise (rb_eArgError, "%s: used handle after closing it", "tail");
4470 Check_Type (pathv, T_STRING);
4471 const char *path = StringValueCStr (pathv);
4473 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4478 r = guestfs_tail (g, path);
4480 rb_raise (e_Error, "%s", guestfs_last_error (g));
4483 for (i = 0; r[i] != NULL; ++i) len++;
4484 VALUE rv = rb_ary_new2 (len);
4485 for (i = 0; r[i] != NULL; ++i) {
4486 rb_ary_push (rv, rb_str_new2 (r[i]));
4493 static VALUE ruby_guestfs_tail_n (VALUE gv, VALUE nrlinesv, VALUE pathv)
4496 Data_Get_Struct (gv, guestfs_h, g);
4498 rb_raise (rb_eArgError, "%s: used handle after closing it", "tail_n");
4500 int nrlines = NUM2INT (nrlinesv);
4501 Check_Type (pathv, T_STRING);
4502 const char *path = StringValueCStr (pathv);
4504 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4509 r = guestfs_tail_n (g, nrlines, path);
4511 rb_raise (e_Error, "%s", guestfs_last_error (g));
4514 for (i = 0; r[i] != NULL; ++i) len++;
4515 VALUE rv = rb_ary_new2 (len);
4516 for (i = 0; r[i] != NULL; ++i) {
4517 rb_ary_push (rv, rb_str_new2 (r[i]));
4524 static VALUE ruby_guestfs_df (VALUE gv)
4527 Data_Get_Struct (gv, guestfs_h, g);
4529 rb_raise (rb_eArgError, "%s: used handle after closing it", "df");
4536 rb_raise (e_Error, "%s", guestfs_last_error (g));
4538 VALUE rv = rb_str_new2 (r);
4543 static VALUE ruby_guestfs_df_h (VALUE gv)
4546 Data_Get_Struct (gv, guestfs_h, g);
4548 rb_raise (rb_eArgError, "%s: used handle after closing it", "df_h");
4553 r = guestfs_df_h (g);
4555 rb_raise (e_Error, "%s", guestfs_last_error (g));
4557 VALUE rv = rb_str_new2 (r);
4562 static VALUE ruby_guestfs_du (VALUE gv, VALUE pathv)
4565 Data_Get_Struct (gv, guestfs_h, g);
4567 rb_raise (rb_eArgError, "%s: used handle after closing it", "du");
4569 Check_Type (pathv, T_STRING);
4570 const char *path = StringValueCStr (pathv);
4572 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4577 r = guestfs_du (g, path);
4579 rb_raise (e_Error, "%s", guestfs_last_error (g));
4584 static VALUE ruby_guestfs_initrd_list (VALUE gv, VALUE pathv)
4587 Data_Get_Struct (gv, guestfs_h, g);
4589 rb_raise (rb_eArgError, "%s: used handle after closing it", "initrd_list");
4591 Check_Type (pathv, T_STRING);
4592 const char *path = StringValueCStr (pathv);
4594 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4595 "path", "initrd_list");
4599 r = guestfs_initrd_list (g, path);
4601 rb_raise (e_Error, "%s", guestfs_last_error (g));
4604 for (i = 0; r[i] != NULL; ++i) len++;
4605 VALUE rv = rb_ary_new2 (len);
4606 for (i = 0; r[i] != NULL; ++i) {
4607 rb_ary_push (rv, rb_str_new2 (r[i]));
4614 static VALUE ruby_guestfs_mount_loop (VALUE gv, VALUE filev, VALUE mountpointv)
4617 Data_Get_Struct (gv, guestfs_h, g);
4619 rb_raise (rb_eArgError, "%s: used handle after closing it", "mount_loop");
4621 Check_Type (filev, T_STRING);
4622 const char *file = StringValueCStr (filev);
4624 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4625 "file", "mount_loop");
4626 Check_Type (mountpointv, T_STRING);
4627 const char *mountpoint = StringValueCStr (mountpointv);
4629 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
4630 "mountpoint", "mount_loop");
4634 r = guestfs_mount_loop (g, file, mountpoint);
4636 rb_raise (e_Error, "%s", guestfs_last_error (g));
4641 /* Initialize the module. */
4642 void Init__guestfs ()
4644 m_guestfs = rb_define_module ("Guestfs");
4645 c_guestfs = rb_define_class_under (m_guestfs, "Guestfs", rb_cObject);
4646 e_Error = rb_define_class_under (m_guestfs, "Error", rb_eStandardError);
4648 rb_define_module_function (m_guestfs, "create", ruby_guestfs_create, 0);
4649 rb_define_method (c_guestfs, "close", ruby_guestfs_close, 0);
4651 rb_define_method (c_guestfs, "test0",
4652 ruby_guestfs_test0, 7);
4653 rb_define_method (c_guestfs, "test0rint",
4654 ruby_guestfs_test0rint, 1);
4655 rb_define_method (c_guestfs, "test0rinterr",
4656 ruby_guestfs_test0rinterr, 0);
4657 rb_define_method (c_guestfs, "test0rint64",
4658 ruby_guestfs_test0rint64, 1);
4659 rb_define_method (c_guestfs, "test0rint64err",
4660 ruby_guestfs_test0rint64err, 0);
4661 rb_define_method (c_guestfs, "test0rbool",
4662 ruby_guestfs_test0rbool, 1);
4663 rb_define_method (c_guestfs, "test0rboolerr",
4664 ruby_guestfs_test0rboolerr, 0);
4665 rb_define_method (c_guestfs, "test0rconststring",
4666 ruby_guestfs_test0rconststring, 1);
4667 rb_define_method (c_guestfs, "test0rconststringerr",
4668 ruby_guestfs_test0rconststringerr, 0);
4669 rb_define_method (c_guestfs, "test0rstring",
4670 ruby_guestfs_test0rstring, 1);
4671 rb_define_method (c_guestfs, "test0rstringerr",
4672 ruby_guestfs_test0rstringerr, 0);
4673 rb_define_method (c_guestfs, "test0rstringlist",
4674 ruby_guestfs_test0rstringlist, 1);
4675 rb_define_method (c_guestfs, "test0rstringlisterr",
4676 ruby_guestfs_test0rstringlisterr, 0);
4677 rb_define_method (c_guestfs, "test0rintbool",
4678 ruby_guestfs_test0rintbool, 1);
4679 rb_define_method (c_guestfs, "test0rintboolerr",
4680 ruby_guestfs_test0rintboolerr, 0);
4681 rb_define_method (c_guestfs, "test0rpvlist",
4682 ruby_guestfs_test0rpvlist, 1);
4683 rb_define_method (c_guestfs, "test0rpvlisterr",
4684 ruby_guestfs_test0rpvlisterr, 0);
4685 rb_define_method (c_guestfs, "test0rvglist",
4686 ruby_guestfs_test0rvglist, 1);
4687 rb_define_method (c_guestfs, "test0rvglisterr",
4688 ruby_guestfs_test0rvglisterr, 0);
4689 rb_define_method (c_guestfs, "test0rlvlist",
4690 ruby_guestfs_test0rlvlist, 1);
4691 rb_define_method (c_guestfs, "test0rlvlisterr",
4692 ruby_guestfs_test0rlvlisterr, 0);
4693 rb_define_method (c_guestfs, "test0rstat",
4694 ruby_guestfs_test0rstat, 1);
4695 rb_define_method (c_guestfs, "test0rstaterr",
4696 ruby_guestfs_test0rstaterr, 0);
4697 rb_define_method (c_guestfs, "test0rstatvfs",
4698 ruby_guestfs_test0rstatvfs, 1);
4699 rb_define_method (c_guestfs, "test0rstatvfserr",
4700 ruby_guestfs_test0rstatvfserr, 0);
4701 rb_define_method (c_guestfs, "test0rhashtable",
4702 ruby_guestfs_test0rhashtable, 1);
4703 rb_define_method (c_guestfs, "test0rhashtableerr",
4704 ruby_guestfs_test0rhashtableerr, 0);
4705 rb_define_method (c_guestfs, "launch",
4706 ruby_guestfs_launch, 0);
4707 rb_define_method (c_guestfs, "wait_ready",
4708 ruby_guestfs_wait_ready, 0);
4709 rb_define_method (c_guestfs, "kill_subprocess",
4710 ruby_guestfs_kill_subprocess, 0);
4711 rb_define_method (c_guestfs, "add_drive",
4712 ruby_guestfs_add_drive, 1);
4713 rb_define_method (c_guestfs, "add_cdrom",
4714 ruby_guestfs_add_cdrom, 1);
4715 rb_define_method (c_guestfs, "add_drive_ro",
4716 ruby_guestfs_add_drive_ro, 1);
4717 rb_define_method (c_guestfs, "config",
4718 ruby_guestfs_config, 2);
4719 rb_define_method (c_guestfs, "set_qemu",
4720 ruby_guestfs_set_qemu, 1);
4721 rb_define_method (c_guestfs, "get_qemu",
4722 ruby_guestfs_get_qemu, 0);
4723 rb_define_method (c_guestfs, "set_path",
4724 ruby_guestfs_set_path, 1);
4725 rb_define_method (c_guestfs, "get_path",
4726 ruby_guestfs_get_path, 0);
4727 rb_define_method (c_guestfs, "set_append",
4728 ruby_guestfs_set_append, 1);
4729 rb_define_method (c_guestfs, "get_append",
4730 ruby_guestfs_get_append, 0);
4731 rb_define_method (c_guestfs, "set_autosync",
4732 ruby_guestfs_set_autosync, 1);
4733 rb_define_method (c_guestfs, "get_autosync",
4734 ruby_guestfs_get_autosync, 0);
4735 rb_define_method (c_guestfs, "set_verbose",
4736 ruby_guestfs_set_verbose, 1);
4737 rb_define_method (c_guestfs, "get_verbose",
4738 ruby_guestfs_get_verbose, 0);
4739 rb_define_method (c_guestfs, "is_ready",
4740 ruby_guestfs_is_ready, 0);
4741 rb_define_method (c_guestfs, "is_config",
4742 ruby_guestfs_is_config, 0);
4743 rb_define_method (c_guestfs, "is_launching",
4744 ruby_guestfs_is_launching, 0);
4745 rb_define_method (c_guestfs, "is_busy",
4746 ruby_guestfs_is_busy, 0);
4747 rb_define_method (c_guestfs, "get_state",
4748 ruby_guestfs_get_state, 0);
4749 rb_define_method (c_guestfs, "set_busy",
4750 ruby_guestfs_set_busy, 0);
4751 rb_define_method (c_guestfs, "set_ready",
4752 ruby_guestfs_set_ready, 0);
4753 rb_define_method (c_guestfs, "end_busy",
4754 ruby_guestfs_end_busy, 0);
4755 rb_define_method (c_guestfs, "mount",
4756 ruby_guestfs_mount, 2);
4757 rb_define_method (c_guestfs, "sync",
4758 ruby_guestfs_sync, 0);
4759 rb_define_method (c_guestfs, "touch",
4760 ruby_guestfs_touch, 1);
4761 rb_define_method (c_guestfs, "cat",
4762 ruby_guestfs_cat, 1);
4763 rb_define_method (c_guestfs, "ll",
4764 ruby_guestfs_ll, 1);
4765 rb_define_method (c_guestfs, "ls",
4766 ruby_guestfs_ls, 1);
4767 rb_define_method (c_guestfs, "list_devices",
4768 ruby_guestfs_list_devices, 0);
4769 rb_define_method (c_guestfs, "list_partitions",
4770 ruby_guestfs_list_partitions, 0);
4771 rb_define_method (c_guestfs, "pvs",
4772 ruby_guestfs_pvs, 0);
4773 rb_define_method (c_guestfs, "vgs",
4774 ruby_guestfs_vgs, 0);
4775 rb_define_method (c_guestfs, "lvs",
4776 ruby_guestfs_lvs, 0);
4777 rb_define_method (c_guestfs, "pvs_full",
4778 ruby_guestfs_pvs_full, 0);
4779 rb_define_method (c_guestfs, "vgs_full",
4780 ruby_guestfs_vgs_full, 0);
4781 rb_define_method (c_guestfs, "lvs_full",
4782 ruby_guestfs_lvs_full, 0);
4783 rb_define_method (c_guestfs, "read_lines",
4784 ruby_guestfs_read_lines, 1);
4785 rb_define_method (c_guestfs, "aug_init",
4786 ruby_guestfs_aug_init, 2);
4787 rb_define_method (c_guestfs, "aug_close",
4788 ruby_guestfs_aug_close, 0);
4789 rb_define_method (c_guestfs, "aug_defvar",
4790 ruby_guestfs_aug_defvar, 2);
4791 rb_define_method (c_guestfs, "aug_defnode",
4792 ruby_guestfs_aug_defnode, 3);
4793 rb_define_method (c_guestfs, "aug_get",
4794 ruby_guestfs_aug_get, 1);
4795 rb_define_method (c_guestfs, "aug_set",
4796 ruby_guestfs_aug_set, 2);
4797 rb_define_method (c_guestfs, "aug_insert",
4798 ruby_guestfs_aug_insert, 3);
4799 rb_define_method (c_guestfs, "aug_rm",
4800 ruby_guestfs_aug_rm, 1);
4801 rb_define_method (c_guestfs, "aug_mv",
4802 ruby_guestfs_aug_mv, 2);
4803 rb_define_method (c_guestfs, "aug_match",
4804 ruby_guestfs_aug_match, 1);
4805 rb_define_method (c_guestfs, "aug_save",
4806 ruby_guestfs_aug_save, 0);
4807 rb_define_method (c_guestfs, "aug_load",
4808 ruby_guestfs_aug_load, 0);
4809 rb_define_method (c_guestfs, "aug_ls",
4810 ruby_guestfs_aug_ls, 1);
4811 rb_define_method (c_guestfs, "rm",
4812 ruby_guestfs_rm, 1);
4813 rb_define_method (c_guestfs, "rmdir",
4814 ruby_guestfs_rmdir, 1);
4815 rb_define_method (c_guestfs, "rm_rf",
4816 ruby_guestfs_rm_rf, 1);
4817 rb_define_method (c_guestfs, "mkdir",
4818 ruby_guestfs_mkdir, 1);
4819 rb_define_method (c_guestfs, "mkdir_p",
4820 ruby_guestfs_mkdir_p, 1);
4821 rb_define_method (c_guestfs, "chmod",
4822 ruby_guestfs_chmod, 2);
4823 rb_define_method (c_guestfs, "chown",
4824 ruby_guestfs_chown, 3);
4825 rb_define_method (c_guestfs, "exists",
4826 ruby_guestfs_exists, 1);
4827 rb_define_method (c_guestfs, "is_file",
4828 ruby_guestfs_is_file, 1);
4829 rb_define_method (c_guestfs, "is_dir",
4830 ruby_guestfs_is_dir, 1);
4831 rb_define_method (c_guestfs, "pvcreate",
4832 ruby_guestfs_pvcreate, 1);
4833 rb_define_method (c_guestfs, "vgcreate",
4834 ruby_guestfs_vgcreate, 2);
4835 rb_define_method (c_guestfs, "lvcreate",
4836 ruby_guestfs_lvcreate, 3);
4837 rb_define_method (c_guestfs, "mkfs",
4838 ruby_guestfs_mkfs, 2);
4839 rb_define_method (c_guestfs, "sfdisk",
4840 ruby_guestfs_sfdisk, 5);
4841 rb_define_method (c_guestfs, "write_file",
4842 ruby_guestfs_write_file, 3);
4843 rb_define_method (c_guestfs, "umount",
4844 ruby_guestfs_umount, 1);
4845 rb_define_method (c_guestfs, "mounts",
4846 ruby_guestfs_mounts, 0);
4847 rb_define_method (c_guestfs, "umount_all",
4848 ruby_guestfs_umount_all, 0);
4849 rb_define_method (c_guestfs, "lvm_remove_all",
4850 ruby_guestfs_lvm_remove_all, 0);
4851 rb_define_method (c_guestfs, "file",
4852 ruby_guestfs_file, 1);
4853 rb_define_method (c_guestfs, "command",
4854 ruby_guestfs_command, 1);
4855 rb_define_method (c_guestfs, "command_lines",
4856 ruby_guestfs_command_lines, 1);
4857 rb_define_method (c_guestfs, "stat",
4858 ruby_guestfs_stat, 1);
4859 rb_define_method (c_guestfs, "lstat",
4860 ruby_guestfs_lstat, 1);
4861 rb_define_method (c_guestfs, "statvfs",
4862 ruby_guestfs_statvfs, 1);
4863 rb_define_method (c_guestfs, "tune2fs_l",
4864 ruby_guestfs_tune2fs_l, 1);
4865 rb_define_method (c_guestfs, "blockdev_setro",
4866 ruby_guestfs_blockdev_setro, 1);
4867 rb_define_method (c_guestfs, "blockdev_setrw",
4868 ruby_guestfs_blockdev_setrw, 1);
4869 rb_define_method (c_guestfs, "blockdev_getro",
4870 ruby_guestfs_blockdev_getro, 1);
4871 rb_define_method (c_guestfs, "blockdev_getss",
4872 ruby_guestfs_blockdev_getss, 1);
4873 rb_define_method (c_guestfs, "blockdev_getbsz",
4874 ruby_guestfs_blockdev_getbsz, 1);
4875 rb_define_method (c_guestfs, "blockdev_setbsz",
4876 ruby_guestfs_blockdev_setbsz, 2);
4877 rb_define_method (c_guestfs, "blockdev_getsz",
4878 ruby_guestfs_blockdev_getsz, 1);
4879 rb_define_method (c_guestfs, "blockdev_getsize64",
4880 ruby_guestfs_blockdev_getsize64, 1);
4881 rb_define_method (c_guestfs, "blockdev_flushbufs",
4882 ruby_guestfs_blockdev_flushbufs, 1);
4883 rb_define_method (c_guestfs, "blockdev_rereadpt",
4884 ruby_guestfs_blockdev_rereadpt, 1);
4885 rb_define_method (c_guestfs, "upload",
4886 ruby_guestfs_upload, 2);
4887 rb_define_method (c_guestfs, "download",
4888 ruby_guestfs_download, 2);
4889 rb_define_method (c_guestfs, "checksum",
4890 ruby_guestfs_checksum, 2);
4891 rb_define_method (c_guestfs, "tar_in",
4892 ruby_guestfs_tar_in, 2);
4893 rb_define_method (c_guestfs, "tar_out",
4894 ruby_guestfs_tar_out, 2);
4895 rb_define_method (c_guestfs, "tgz_in",
4896 ruby_guestfs_tgz_in, 2);
4897 rb_define_method (c_guestfs, "tgz_out",
4898 ruby_guestfs_tgz_out, 2);
4899 rb_define_method (c_guestfs, "mount_ro",
4900 ruby_guestfs_mount_ro, 2);
4901 rb_define_method (c_guestfs, "mount_options",
4902 ruby_guestfs_mount_options, 3);
4903 rb_define_method (c_guestfs, "mount_vfs",
4904 ruby_guestfs_mount_vfs, 4);
4905 rb_define_method (c_guestfs, "debug",
4906 ruby_guestfs_debug, 2);
4907 rb_define_method (c_guestfs, "lvremove",
4908 ruby_guestfs_lvremove, 1);
4909 rb_define_method (c_guestfs, "vgremove",
4910 ruby_guestfs_vgremove, 1);
4911 rb_define_method (c_guestfs, "pvremove",
4912 ruby_guestfs_pvremove, 1);
4913 rb_define_method (c_guestfs, "set_e2label",
4914 ruby_guestfs_set_e2label, 2);
4915 rb_define_method (c_guestfs, "get_e2label",
4916 ruby_guestfs_get_e2label, 1);
4917 rb_define_method (c_guestfs, "set_e2uuid",
4918 ruby_guestfs_set_e2uuid, 2);
4919 rb_define_method (c_guestfs, "get_e2uuid",
4920 ruby_guestfs_get_e2uuid, 1);
4921 rb_define_method (c_guestfs, "fsck",
4922 ruby_guestfs_fsck, 2);
4923 rb_define_method (c_guestfs, "zero",
4924 ruby_guestfs_zero, 1);
4925 rb_define_method (c_guestfs, "grub_install",
4926 ruby_guestfs_grub_install, 2);
4927 rb_define_method (c_guestfs, "cp",
4928 ruby_guestfs_cp, 2);
4929 rb_define_method (c_guestfs, "cp_a",
4930 ruby_guestfs_cp_a, 2);
4931 rb_define_method (c_guestfs, "mv",
4932 ruby_guestfs_mv, 2);
4933 rb_define_method (c_guestfs, "drop_caches",
4934 ruby_guestfs_drop_caches, 1);
4935 rb_define_method (c_guestfs, "dmesg",
4936 ruby_guestfs_dmesg, 0);
4937 rb_define_method (c_guestfs, "ping_daemon",
4938 ruby_guestfs_ping_daemon, 0);
4939 rb_define_method (c_guestfs, "equal",
4940 ruby_guestfs_equal, 2);
4941 rb_define_method (c_guestfs, "strings",
4942 ruby_guestfs_strings, 1);
4943 rb_define_method (c_guestfs, "strings_e",
4944 ruby_guestfs_strings_e, 2);
4945 rb_define_method (c_guestfs, "hexdump",
4946 ruby_guestfs_hexdump, 1);
4947 rb_define_method (c_guestfs, "zerofree",
4948 ruby_guestfs_zerofree, 1);
4949 rb_define_method (c_guestfs, "pvresize",
4950 ruby_guestfs_pvresize, 1);
4951 rb_define_method (c_guestfs, "sfdisk_N",
4952 ruby_guestfs_sfdisk_N, 6);
4953 rb_define_method (c_guestfs, "sfdisk_l",
4954 ruby_guestfs_sfdisk_l, 1);
4955 rb_define_method (c_guestfs, "sfdisk_kernel_geometry",
4956 ruby_guestfs_sfdisk_kernel_geometry, 1);
4957 rb_define_method (c_guestfs, "sfdisk_disk_geometry",
4958 ruby_guestfs_sfdisk_disk_geometry, 1);
4959 rb_define_method (c_guestfs, "vg_activate_all",
4960 ruby_guestfs_vg_activate_all, 1);
4961 rb_define_method (c_guestfs, "vg_activate",
4962 ruby_guestfs_vg_activate, 2);
4963 rb_define_method (c_guestfs, "lvresize",
4964 ruby_guestfs_lvresize, 2);
4965 rb_define_method (c_guestfs, "resize2fs",
4966 ruby_guestfs_resize2fs, 1);
4967 rb_define_method (c_guestfs, "find",
4968 ruby_guestfs_find, 1);
4969 rb_define_method (c_guestfs, "e2fsck_f",
4970 ruby_guestfs_e2fsck_f, 1);
4971 rb_define_method (c_guestfs, "sleep",
4972 ruby_guestfs_sleep, 1);
4973 rb_define_method (c_guestfs, "ntfs_3g_probe",
4974 ruby_guestfs_ntfs_3g_probe, 2);
4975 rb_define_method (c_guestfs, "sh",
4976 ruby_guestfs_sh, 1);
4977 rb_define_method (c_guestfs, "sh_lines",
4978 ruby_guestfs_sh_lines, 1);
4979 rb_define_method (c_guestfs, "glob_expand",
4980 ruby_guestfs_glob_expand, 1);
4981 rb_define_method (c_guestfs, "scrub_device",
4982 ruby_guestfs_scrub_device, 1);
4983 rb_define_method (c_guestfs, "scrub_file",
4984 ruby_guestfs_scrub_file, 1);
4985 rb_define_method (c_guestfs, "scrub_freespace",
4986 ruby_guestfs_scrub_freespace, 1);
4987 rb_define_method (c_guestfs, "mkdtemp",
4988 ruby_guestfs_mkdtemp, 1);
4989 rb_define_method (c_guestfs, "wc_l",
4990 ruby_guestfs_wc_l, 1);
4991 rb_define_method (c_guestfs, "wc_w",
4992 ruby_guestfs_wc_w, 1);
4993 rb_define_method (c_guestfs, "wc_c",
4994 ruby_guestfs_wc_c, 1);
4995 rb_define_method (c_guestfs, "head",
4996 ruby_guestfs_head, 1);
4997 rb_define_method (c_guestfs, "head_n",
4998 ruby_guestfs_head_n, 2);
4999 rb_define_method (c_guestfs, "tail",
5000 ruby_guestfs_tail, 1);
5001 rb_define_method (c_guestfs, "tail_n",
5002 ruby_guestfs_tail_n, 2);
5003 rb_define_method (c_guestfs, "df",
5004 ruby_guestfs_df, 0);
5005 rb_define_method (c_guestfs, "df_h",
5006 ruby_guestfs_df_h, 0);
5007 rb_define_method (c_guestfs, "du",
5008 ruby_guestfs_du, 1);
5009 rb_define_method (c_guestfs, "initrd_list",
5010 ruby_guestfs_initrd_list, 1);
5011 rb_define_method (c_guestfs, "mount_loop",
5012 ruby_guestfs_mount_loop, 2);