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 nv, 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 n = NUM2INT (nv);
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, n, 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 /* Initialize the module. */
4337 void Init__guestfs ()
4339 m_guestfs = rb_define_module ("Guestfs");
4340 c_guestfs = rb_define_class_under (m_guestfs, "Guestfs", rb_cObject);
4341 e_Error = rb_define_class_under (m_guestfs, "Error", rb_eStandardError);
4343 rb_define_module_function (m_guestfs, "create", ruby_guestfs_create, 0);
4344 rb_define_method (c_guestfs, "close", ruby_guestfs_close, 0);
4346 rb_define_method (c_guestfs, "test0",
4347 ruby_guestfs_test0, 7);
4348 rb_define_method (c_guestfs, "test0rint",
4349 ruby_guestfs_test0rint, 1);
4350 rb_define_method (c_guestfs, "test0rinterr",
4351 ruby_guestfs_test0rinterr, 0);
4352 rb_define_method (c_guestfs, "test0rint64",
4353 ruby_guestfs_test0rint64, 1);
4354 rb_define_method (c_guestfs, "test0rint64err",
4355 ruby_guestfs_test0rint64err, 0);
4356 rb_define_method (c_guestfs, "test0rbool",
4357 ruby_guestfs_test0rbool, 1);
4358 rb_define_method (c_guestfs, "test0rboolerr",
4359 ruby_guestfs_test0rboolerr, 0);
4360 rb_define_method (c_guestfs, "test0rconststring",
4361 ruby_guestfs_test0rconststring, 1);
4362 rb_define_method (c_guestfs, "test0rconststringerr",
4363 ruby_guestfs_test0rconststringerr, 0);
4364 rb_define_method (c_guestfs, "test0rstring",
4365 ruby_guestfs_test0rstring, 1);
4366 rb_define_method (c_guestfs, "test0rstringerr",
4367 ruby_guestfs_test0rstringerr, 0);
4368 rb_define_method (c_guestfs, "test0rstringlist",
4369 ruby_guestfs_test0rstringlist, 1);
4370 rb_define_method (c_guestfs, "test0rstringlisterr",
4371 ruby_guestfs_test0rstringlisterr, 0);
4372 rb_define_method (c_guestfs, "test0rintbool",
4373 ruby_guestfs_test0rintbool, 1);
4374 rb_define_method (c_guestfs, "test0rintboolerr",
4375 ruby_guestfs_test0rintboolerr, 0);
4376 rb_define_method (c_guestfs, "test0rpvlist",
4377 ruby_guestfs_test0rpvlist, 1);
4378 rb_define_method (c_guestfs, "test0rpvlisterr",
4379 ruby_guestfs_test0rpvlisterr, 0);
4380 rb_define_method (c_guestfs, "test0rvglist",
4381 ruby_guestfs_test0rvglist, 1);
4382 rb_define_method (c_guestfs, "test0rvglisterr",
4383 ruby_guestfs_test0rvglisterr, 0);
4384 rb_define_method (c_guestfs, "test0rlvlist",
4385 ruby_guestfs_test0rlvlist, 1);
4386 rb_define_method (c_guestfs, "test0rlvlisterr",
4387 ruby_guestfs_test0rlvlisterr, 0);
4388 rb_define_method (c_guestfs, "test0rstat",
4389 ruby_guestfs_test0rstat, 1);
4390 rb_define_method (c_guestfs, "test0rstaterr",
4391 ruby_guestfs_test0rstaterr, 0);
4392 rb_define_method (c_guestfs, "test0rstatvfs",
4393 ruby_guestfs_test0rstatvfs, 1);
4394 rb_define_method (c_guestfs, "test0rstatvfserr",
4395 ruby_guestfs_test0rstatvfserr, 0);
4396 rb_define_method (c_guestfs, "test0rhashtable",
4397 ruby_guestfs_test0rhashtable, 1);
4398 rb_define_method (c_guestfs, "test0rhashtableerr",
4399 ruby_guestfs_test0rhashtableerr, 0);
4400 rb_define_method (c_guestfs, "launch",
4401 ruby_guestfs_launch, 0);
4402 rb_define_method (c_guestfs, "wait_ready",
4403 ruby_guestfs_wait_ready, 0);
4404 rb_define_method (c_guestfs, "kill_subprocess",
4405 ruby_guestfs_kill_subprocess, 0);
4406 rb_define_method (c_guestfs, "add_drive",
4407 ruby_guestfs_add_drive, 1);
4408 rb_define_method (c_guestfs, "add_cdrom",
4409 ruby_guestfs_add_cdrom, 1);
4410 rb_define_method (c_guestfs, "add_drive_ro",
4411 ruby_guestfs_add_drive_ro, 1);
4412 rb_define_method (c_guestfs, "config",
4413 ruby_guestfs_config, 2);
4414 rb_define_method (c_guestfs, "set_qemu",
4415 ruby_guestfs_set_qemu, 1);
4416 rb_define_method (c_guestfs, "get_qemu",
4417 ruby_guestfs_get_qemu, 0);
4418 rb_define_method (c_guestfs, "set_path",
4419 ruby_guestfs_set_path, 1);
4420 rb_define_method (c_guestfs, "get_path",
4421 ruby_guestfs_get_path, 0);
4422 rb_define_method (c_guestfs, "set_append",
4423 ruby_guestfs_set_append, 1);
4424 rb_define_method (c_guestfs, "get_append",
4425 ruby_guestfs_get_append, 0);
4426 rb_define_method (c_guestfs, "set_autosync",
4427 ruby_guestfs_set_autosync, 1);
4428 rb_define_method (c_guestfs, "get_autosync",
4429 ruby_guestfs_get_autosync, 0);
4430 rb_define_method (c_guestfs, "set_verbose",
4431 ruby_guestfs_set_verbose, 1);
4432 rb_define_method (c_guestfs, "get_verbose",
4433 ruby_guestfs_get_verbose, 0);
4434 rb_define_method (c_guestfs, "is_ready",
4435 ruby_guestfs_is_ready, 0);
4436 rb_define_method (c_guestfs, "is_config",
4437 ruby_guestfs_is_config, 0);
4438 rb_define_method (c_guestfs, "is_launching",
4439 ruby_guestfs_is_launching, 0);
4440 rb_define_method (c_guestfs, "is_busy",
4441 ruby_guestfs_is_busy, 0);
4442 rb_define_method (c_guestfs, "get_state",
4443 ruby_guestfs_get_state, 0);
4444 rb_define_method (c_guestfs, "set_busy",
4445 ruby_guestfs_set_busy, 0);
4446 rb_define_method (c_guestfs, "set_ready",
4447 ruby_guestfs_set_ready, 0);
4448 rb_define_method (c_guestfs, "end_busy",
4449 ruby_guestfs_end_busy, 0);
4450 rb_define_method (c_guestfs, "mount",
4451 ruby_guestfs_mount, 2);
4452 rb_define_method (c_guestfs, "sync",
4453 ruby_guestfs_sync, 0);
4454 rb_define_method (c_guestfs, "touch",
4455 ruby_guestfs_touch, 1);
4456 rb_define_method (c_guestfs, "cat",
4457 ruby_guestfs_cat, 1);
4458 rb_define_method (c_guestfs, "ll",
4459 ruby_guestfs_ll, 1);
4460 rb_define_method (c_guestfs, "ls",
4461 ruby_guestfs_ls, 1);
4462 rb_define_method (c_guestfs, "list_devices",
4463 ruby_guestfs_list_devices, 0);
4464 rb_define_method (c_guestfs, "list_partitions",
4465 ruby_guestfs_list_partitions, 0);
4466 rb_define_method (c_guestfs, "pvs",
4467 ruby_guestfs_pvs, 0);
4468 rb_define_method (c_guestfs, "vgs",
4469 ruby_guestfs_vgs, 0);
4470 rb_define_method (c_guestfs, "lvs",
4471 ruby_guestfs_lvs, 0);
4472 rb_define_method (c_guestfs, "pvs_full",
4473 ruby_guestfs_pvs_full, 0);
4474 rb_define_method (c_guestfs, "vgs_full",
4475 ruby_guestfs_vgs_full, 0);
4476 rb_define_method (c_guestfs, "lvs_full",
4477 ruby_guestfs_lvs_full, 0);
4478 rb_define_method (c_guestfs, "read_lines",
4479 ruby_guestfs_read_lines, 1);
4480 rb_define_method (c_guestfs, "aug_init",
4481 ruby_guestfs_aug_init, 2);
4482 rb_define_method (c_guestfs, "aug_close",
4483 ruby_guestfs_aug_close, 0);
4484 rb_define_method (c_guestfs, "aug_defvar",
4485 ruby_guestfs_aug_defvar, 2);
4486 rb_define_method (c_guestfs, "aug_defnode",
4487 ruby_guestfs_aug_defnode, 3);
4488 rb_define_method (c_guestfs, "aug_get",
4489 ruby_guestfs_aug_get, 1);
4490 rb_define_method (c_guestfs, "aug_set",
4491 ruby_guestfs_aug_set, 2);
4492 rb_define_method (c_guestfs, "aug_insert",
4493 ruby_guestfs_aug_insert, 3);
4494 rb_define_method (c_guestfs, "aug_rm",
4495 ruby_guestfs_aug_rm, 1);
4496 rb_define_method (c_guestfs, "aug_mv",
4497 ruby_guestfs_aug_mv, 2);
4498 rb_define_method (c_guestfs, "aug_match",
4499 ruby_guestfs_aug_match, 1);
4500 rb_define_method (c_guestfs, "aug_save",
4501 ruby_guestfs_aug_save, 0);
4502 rb_define_method (c_guestfs, "aug_load",
4503 ruby_guestfs_aug_load, 0);
4504 rb_define_method (c_guestfs, "aug_ls",
4505 ruby_guestfs_aug_ls, 1);
4506 rb_define_method (c_guestfs, "rm",
4507 ruby_guestfs_rm, 1);
4508 rb_define_method (c_guestfs, "rmdir",
4509 ruby_guestfs_rmdir, 1);
4510 rb_define_method (c_guestfs, "rm_rf",
4511 ruby_guestfs_rm_rf, 1);
4512 rb_define_method (c_guestfs, "mkdir",
4513 ruby_guestfs_mkdir, 1);
4514 rb_define_method (c_guestfs, "mkdir_p",
4515 ruby_guestfs_mkdir_p, 1);
4516 rb_define_method (c_guestfs, "chmod",
4517 ruby_guestfs_chmod, 2);
4518 rb_define_method (c_guestfs, "chown",
4519 ruby_guestfs_chown, 3);
4520 rb_define_method (c_guestfs, "exists",
4521 ruby_guestfs_exists, 1);
4522 rb_define_method (c_guestfs, "is_file",
4523 ruby_guestfs_is_file, 1);
4524 rb_define_method (c_guestfs, "is_dir",
4525 ruby_guestfs_is_dir, 1);
4526 rb_define_method (c_guestfs, "pvcreate",
4527 ruby_guestfs_pvcreate, 1);
4528 rb_define_method (c_guestfs, "vgcreate",
4529 ruby_guestfs_vgcreate, 2);
4530 rb_define_method (c_guestfs, "lvcreate",
4531 ruby_guestfs_lvcreate, 3);
4532 rb_define_method (c_guestfs, "mkfs",
4533 ruby_guestfs_mkfs, 2);
4534 rb_define_method (c_guestfs, "sfdisk",
4535 ruby_guestfs_sfdisk, 5);
4536 rb_define_method (c_guestfs, "write_file",
4537 ruby_guestfs_write_file, 3);
4538 rb_define_method (c_guestfs, "umount",
4539 ruby_guestfs_umount, 1);
4540 rb_define_method (c_guestfs, "mounts",
4541 ruby_guestfs_mounts, 0);
4542 rb_define_method (c_guestfs, "umount_all",
4543 ruby_guestfs_umount_all, 0);
4544 rb_define_method (c_guestfs, "lvm_remove_all",
4545 ruby_guestfs_lvm_remove_all, 0);
4546 rb_define_method (c_guestfs, "file",
4547 ruby_guestfs_file, 1);
4548 rb_define_method (c_guestfs, "command",
4549 ruby_guestfs_command, 1);
4550 rb_define_method (c_guestfs, "command_lines",
4551 ruby_guestfs_command_lines, 1);
4552 rb_define_method (c_guestfs, "stat",
4553 ruby_guestfs_stat, 1);
4554 rb_define_method (c_guestfs, "lstat",
4555 ruby_guestfs_lstat, 1);
4556 rb_define_method (c_guestfs, "statvfs",
4557 ruby_guestfs_statvfs, 1);
4558 rb_define_method (c_guestfs, "tune2fs_l",
4559 ruby_guestfs_tune2fs_l, 1);
4560 rb_define_method (c_guestfs, "blockdev_setro",
4561 ruby_guestfs_blockdev_setro, 1);
4562 rb_define_method (c_guestfs, "blockdev_setrw",
4563 ruby_guestfs_blockdev_setrw, 1);
4564 rb_define_method (c_guestfs, "blockdev_getro",
4565 ruby_guestfs_blockdev_getro, 1);
4566 rb_define_method (c_guestfs, "blockdev_getss",
4567 ruby_guestfs_blockdev_getss, 1);
4568 rb_define_method (c_guestfs, "blockdev_getbsz",
4569 ruby_guestfs_blockdev_getbsz, 1);
4570 rb_define_method (c_guestfs, "blockdev_setbsz",
4571 ruby_guestfs_blockdev_setbsz, 2);
4572 rb_define_method (c_guestfs, "blockdev_getsz",
4573 ruby_guestfs_blockdev_getsz, 1);
4574 rb_define_method (c_guestfs, "blockdev_getsize64",
4575 ruby_guestfs_blockdev_getsize64, 1);
4576 rb_define_method (c_guestfs, "blockdev_flushbufs",
4577 ruby_guestfs_blockdev_flushbufs, 1);
4578 rb_define_method (c_guestfs, "blockdev_rereadpt",
4579 ruby_guestfs_blockdev_rereadpt, 1);
4580 rb_define_method (c_guestfs, "upload",
4581 ruby_guestfs_upload, 2);
4582 rb_define_method (c_guestfs, "download",
4583 ruby_guestfs_download, 2);
4584 rb_define_method (c_guestfs, "checksum",
4585 ruby_guestfs_checksum, 2);
4586 rb_define_method (c_guestfs, "tar_in",
4587 ruby_guestfs_tar_in, 2);
4588 rb_define_method (c_guestfs, "tar_out",
4589 ruby_guestfs_tar_out, 2);
4590 rb_define_method (c_guestfs, "tgz_in",
4591 ruby_guestfs_tgz_in, 2);
4592 rb_define_method (c_guestfs, "tgz_out",
4593 ruby_guestfs_tgz_out, 2);
4594 rb_define_method (c_guestfs, "mount_ro",
4595 ruby_guestfs_mount_ro, 2);
4596 rb_define_method (c_guestfs, "mount_options",
4597 ruby_guestfs_mount_options, 3);
4598 rb_define_method (c_guestfs, "mount_vfs",
4599 ruby_guestfs_mount_vfs, 4);
4600 rb_define_method (c_guestfs, "debug",
4601 ruby_guestfs_debug, 2);
4602 rb_define_method (c_guestfs, "lvremove",
4603 ruby_guestfs_lvremove, 1);
4604 rb_define_method (c_guestfs, "vgremove",
4605 ruby_guestfs_vgremove, 1);
4606 rb_define_method (c_guestfs, "pvremove",
4607 ruby_guestfs_pvremove, 1);
4608 rb_define_method (c_guestfs, "set_e2label",
4609 ruby_guestfs_set_e2label, 2);
4610 rb_define_method (c_guestfs, "get_e2label",
4611 ruby_guestfs_get_e2label, 1);
4612 rb_define_method (c_guestfs, "set_e2uuid",
4613 ruby_guestfs_set_e2uuid, 2);
4614 rb_define_method (c_guestfs, "get_e2uuid",
4615 ruby_guestfs_get_e2uuid, 1);
4616 rb_define_method (c_guestfs, "fsck",
4617 ruby_guestfs_fsck, 2);
4618 rb_define_method (c_guestfs, "zero",
4619 ruby_guestfs_zero, 1);
4620 rb_define_method (c_guestfs, "grub_install",
4621 ruby_guestfs_grub_install, 2);
4622 rb_define_method (c_guestfs, "cp",
4623 ruby_guestfs_cp, 2);
4624 rb_define_method (c_guestfs, "cp_a",
4625 ruby_guestfs_cp_a, 2);
4626 rb_define_method (c_guestfs, "mv",
4627 ruby_guestfs_mv, 2);
4628 rb_define_method (c_guestfs, "drop_caches",
4629 ruby_guestfs_drop_caches, 1);
4630 rb_define_method (c_guestfs, "dmesg",
4631 ruby_guestfs_dmesg, 0);
4632 rb_define_method (c_guestfs, "ping_daemon",
4633 ruby_guestfs_ping_daemon, 0);
4634 rb_define_method (c_guestfs, "equal",
4635 ruby_guestfs_equal, 2);
4636 rb_define_method (c_guestfs, "strings",
4637 ruby_guestfs_strings, 1);
4638 rb_define_method (c_guestfs, "strings_e",
4639 ruby_guestfs_strings_e, 2);
4640 rb_define_method (c_guestfs, "hexdump",
4641 ruby_guestfs_hexdump, 1);
4642 rb_define_method (c_guestfs, "zerofree",
4643 ruby_guestfs_zerofree, 1);
4644 rb_define_method (c_guestfs, "pvresize",
4645 ruby_guestfs_pvresize, 1);
4646 rb_define_method (c_guestfs, "sfdisk_N",
4647 ruby_guestfs_sfdisk_N, 6);
4648 rb_define_method (c_guestfs, "sfdisk_l",
4649 ruby_guestfs_sfdisk_l, 1);
4650 rb_define_method (c_guestfs, "sfdisk_kernel_geometry",
4651 ruby_guestfs_sfdisk_kernel_geometry, 1);
4652 rb_define_method (c_guestfs, "sfdisk_disk_geometry",
4653 ruby_guestfs_sfdisk_disk_geometry, 1);
4654 rb_define_method (c_guestfs, "vg_activate_all",
4655 ruby_guestfs_vg_activate_all, 1);
4656 rb_define_method (c_guestfs, "vg_activate",
4657 ruby_guestfs_vg_activate, 2);
4658 rb_define_method (c_guestfs, "lvresize",
4659 ruby_guestfs_lvresize, 2);
4660 rb_define_method (c_guestfs, "resize2fs",
4661 ruby_guestfs_resize2fs, 1);
4662 rb_define_method (c_guestfs, "find",
4663 ruby_guestfs_find, 1);
4664 rb_define_method (c_guestfs, "e2fsck_f",
4665 ruby_guestfs_e2fsck_f, 1);
4666 rb_define_method (c_guestfs, "sleep",
4667 ruby_guestfs_sleep, 1);
4668 rb_define_method (c_guestfs, "ntfs_3g_probe",
4669 ruby_guestfs_ntfs_3g_probe, 2);
4670 rb_define_method (c_guestfs, "sh",
4671 ruby_guestfs_sh, 1);
4672 rb_define_method (c_guestfs, "sh_lines",
4673 ruby_guestfs_sh_lines, 1);
4674 rb_define_method (c_guestfs, "glob_expand",
4675 ruby_guestfs_glob_expand, 1);
4676 rb_define_method (c_guestfs, "scrub_device",
4677 ruby_guestfs_scrub_device, 1);
4678 rb_define_method (c_guestfs, "scrub_file",
4679 ruby_guestfs_scrub_file, 1);
4680 rb_define_method (c_guestfs, "scrub_freespace",
4681 ruby_guestfs_scrub_freespace, 1);
4682 rb_define_method (c_guestfs, "mkdtemp",
4683 ruby_guestfs_mkdtemp, 1);