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 const char *str = StringValueCStr (strv);
83 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
85 const char *optstr = !NIL_P (optstrv) ? StringValueCStr (optstrv) : NULL;
88 len = RARRAY_LEN (strlistv);
89 strlist = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
90 for (i = 0; i < len; ++i) {
91 VALUE v = rb_ary_entry (strlistv, i);
92 strlist[i] = StringValueCStr (v);
97 int integer = NUM2INT (integerv);
98 const char *filein = StringValueCStr (fileinv);
100 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
102 const char *fileout = StringValueCStr (fileoutv);
104 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
109 r = guestfs_test0 (g, str, optstr, strlist, b, integer, filein, fileout);
112 rb_raise (e_Error, "%s", guestfs_last_error (g));
117 static VALUE ruby_guestfs_test0rint (VALUE gv, VALUE valv)
120 Data_Get_Struct (gv, guestfs_h, g);
122 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rint");
124 const char *val = StringValueCStr (valv);
126 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
131 r = guestfs_test0rint (g, val);
133 rb_raise (e_Error, "%s", guestfs_last_error (g));
138 static VALUE ruby_guestfs_test0rinterr (VALUE gv)
141 Data_Get_Struct (gv, guestfs_h, g);
143 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rinterr");
148 r = guestfs_test0rinterr (g);
150 rb_raise (e_Error, "%s", guestfs_last_error (g));
155 static VALUE ruby_guestfs_test0rint64 (VALUE gv, VALUE valv)
158 Data_Get_Struct (gv, guestfs_h, g);
160 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rint64");
162 const char *val = StringValueCStr (valv);
164 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
165 "val", "test0rint64");
169 r = guestfs_test0rint64 (g, val);
171 rb_raise (e_Error, "%s", guestfs_last_error (g));
176 static VALUE ruby_guestfs_test0rint64err (VALUE gv)
179 Data_Get_Struct (gv, guestfs_h, g);
181 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rint64err");
186 r = guestfs_test0rint64err (g);
188 rb_raise (e_Error, "%s", guestfs_last_error (g));
193 static VALUE ruby_guestfs_test0rbool (VALUE gv, VALUE valv)
196 Data_Get_Struct (gv, guestfs_h, g);
198 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rbool");
200 const char *val = StringValueCStr (valv);
202 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
203 "val", "test0rbool");
207 r = guestfs_test0rbool (g, val);
209 rb_raise (e_Error, "%s", guestfs_last_error (g));
214 static VALUE ruby_guestfs_test0rboolerr (VALUE gv)
217 Data_Get_Struct (gv, guestfs_h, g);
219 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rboolerr");
224 r = guestfs_test0rboolerr (g);
226 rb_raise (e_Error, "%s", guestfs_last_error (g));
231 static VALUE ruby_guestfs_test0rconststring (VALUE gv, VALUE valv)
234 Data_Get_Struct (gv, guestfs_h, g);
236 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rconststring");
238 const char *val = StringValueCStr (valv);
240 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
241 "val", "test0rconststring");
245 r = guestfs_test0rconststring (g, val);
247 rb_raise (e_Error, "%s", guestfs_last_error (g));
249 return rb_str_new2 (r);
252 static VALUE ruby_guestfs_test0rconststringerr (VALUE gv)
255 Data_Get_Struct (gv, guestfs_h, g);
257 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rconststringerr");
262 r = guestfs_test0rconststringerr (g);
264 rb_raise (e_Error, "%s", guestfs_last_error (g));
266 return rb_str_new2 (r);
269 static VALUE ruby_guestfs_test0rstring (VALUE gv, VALUE valv)
272 Data_Get_Struct (gv, guestfs_h, g);
274 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstring");
276 const char *val = StringValueCStr (valv);
278 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
279 "val", "test0rstring");
283 r = guestfs_test0rstring (g, val);
285 rb_raise (e_Error, "%s", guestfs_last_error (g));
287 VALUE rv = rb_str_new2 (r);
292 static VALUE ruby_guestfs_test0rstringerr (VALUE gv)
295 Data_Get_Struct (gv, guestfs_h, g);
297 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstringerr");
302 r = guestfs_test0rstringerr (g);
304 rb_raise (e_Error, "%s", guestfs_last_error (g));
306 VALUE rv = rb_str_new2 (r);
311 static VALUE ruby_guestfs_test0rstringlist (VALUE gv, VALUE valv)
314 Data_Get_Struct (gv, guestfs_h, g);
316 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstringlist");
318 const char *val = StringValueCStr (valv);
320 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
321 "val", "test0rstringlist");
325 r = guestfs_test0rstringlist (g, val);
327 rb_raise (e_Error, "%s", guestfs_last_error (g));
330 for (i = 0; r[i] != NULL; ++i) len++;
331 VALUE rv = rb_ary_new2 (len);
332 for (i = 0; r[i] != NULL; ++i) {
333 rb_ary_push (rv, rb_str_new2 (r[i]));
340 static VALUE ruby_guestfs_test0rstringlisterr (VALUE gv)
343 Data_Get_Struct (gv, guestfs_h, g);
345 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstringlisterr");
350 r = guestfs_test0rstringlisterr (g);
352 rb_raise (e_Error, "%s", guestfs_last_error (g));
355 for (i = 0; r[i] != NULL; ++i) len++;
356 VALUE rv = rb_ary_new2 (len);
357 for (i = 0; r[i] != NULL; ++i) {
358 rb_ary_push (rv, rb_str_new2 (r[i]));
365 static VALUE ruby_guestfs_test0rintbool (VALUE gv, VALUE valv)
368 Data_Get_Struct (gv, guestfs_h, g);
370 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rintbool");
372 const char *val = StringValueCStr (valv);
374 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
375 "val", "test0rintbool");
377 struct guestfs_int_bool *r;
379 r = guestfs_test0rintbool (g, val);
381 rb_raise (e_Error, "%s", guestfs_last_error (g));
383 VALUE rv = rb_ary_new2 (2);
384 rb_ary_push (rv, INT2NUM (r->i));
385 rb_ary_push (rv, INT2NUM (r->b));
386 guestfs_free_int_bool (r);
390 static VALUE ruby_guestfs_test0rintboolerr (VALUE gv)
393 Data_Get_Struct (gv, guestfs_h, g);
395 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rintboolerr");
398 struct guestfs_int_bool *r;
400 r = guestfs_test0rintboolerr (g);
402 rb_raise (e_Error, "%s", guestfs_last_error (g));
404 VALUE rv = rb_ary_new2 (2);
405 rb_ary_push (rv, INT2NUM (r->i));
406 rb_ary_push (rv, INT2NUM (r->b));
407 guestfs_free_int_bool (r);
411 static VALUE ruby_guestfs_test0rpvlist (VALUE gv, VALUE valv)
414 Data_Get_Struct (gv, guestfs_h, g);
416 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rpvlist");
418 const char *val = StringValueCStr (valv);
420 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
421 "val", "test0rpvlist");
423 struct guestfs_lvm_pv_list *r;
425 r = guestfs_test0rpvlist (g, val);
427 rb_raise (e_Error, "%s", guestfs_last_error (g));
429 VALUE rv = rb_ary_new2 (r->len);
431 for (i = 0; i < r->len; ++i) {
432 VALUE hv = rb_hash_new ();
433 rb_hash_aset (rv, rb_str_new2 ("pv_name"), rb_str_new2 (r->val[i].pv_name));
434 rb_hash_aset (rv, rb_str_new2 ("pv_uuid"), rb_str_new (r->val[i].pv_uuid, 32));
435 rb_hash_aset (rv, rb_str_new2 ("pv_fmt"), rb_str_new2 (r->val[i].pv_fmt));
436 rb_hash_aset (rv, rb_str_new2 ("pv_size"), ULL2NUM (r->val[i].pv_size));
437 rb_hash_aset (rv, rb_str_new2 ("dev_size"), ULL2NUM (r->val[i].dev_size));
438 rb_hash_aset (rv, rb_str_new2 ("pv_free"), ULL2NUM (r->val[i].pv_free));
439 rb_hash_aset (rv, rb_str_new2 ("pv_used"), ULL2NUM (r->val[i].pv_used));
440 rb_hash_aset (rv, rb_str_new2 ("pv_attr"), rb_str_new2 (r->val[i].pv_attr));
441 rb_hash_aset (rv, rb_str_new2 ("pv_pe_count"), ULL2NUM (r->val[i].pv_pe_count));
442 rb_hash_aset (rv, rb_str_new2 ("pv_pe_alloc_count"), ULL2NUM (r->val[i].pv_pe_alloc_count));
443 rb_hash_aset (rv, rb_str_new2 ("pv_tags"), rb_str_new2 (r->val[i].pv_tags));
444 rb_hash_aset (rv, rb_str_new2 ("pe_start"), ULL2NUM (r->val[i].pe_start));
445 rb_hash_aset (rv, rb_str_new2 ("pv_mda_count"), ULL2NUM (r->val[i].pv_mda_count));
446 rb_hash_aset (rv, rb_str_new2 ("pv_mda_free"), ULL2NUM (r->val[i].pv_mda_free));
447 rb_ary_push (rv, hv);
449 guestfs_free_lvm_pv_list (r);
453 static VALUE ruby_guestfs_test0rpvlisterr (VALUE gv)
456 Data_Get_Struct (gv, guestfs_h, g);
458 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rpvlisterr");
461 struct guestfs_lvm_pv_list *r;
463 r = guestfs_test0rpvlisterr (g);
465 rb_raise (e_Error, "%s", guestfs_last_error (g));
467 VALUE rv = rb_ary_new2 (r->len);
469 for (i = 0; i < r->len; ++i) {
470 VALUE hv = rb_hash_new ();
471 rb_hash_aset (rv, rb_str_new2 ("pv_name"), rb_str_new2 (r->val[i].pv_name));
472 rb_hash_aset (rv, rb_str_new2 ("pv_uuid"), rb_str_new (r->val[i].pv_uuid, 32));
473 rb_hash_aset (rv, rb_str_new2 ("pv_fmt"), rb_str_new2 (r->val[i].pv_fmt));
474 rb_hash_aset (rv, rb_str_new2 ("pv_size"), ULL2NUM (r->val[i].pv_size));
475 rb_hash_aset (rv, rb_str_new2 ("dev_size"), ULL2NUM (r->val[i].dev_size));
476 rb_hash_aset (rv, rb_str_new2 ("pv_free"), ULL2NUM (r->val[i].pv_free));
477 rb_hash_aset (rv, rb_str_new2 ("pv_used"), ULL2NUM (r->val[i].pv_used));
478 rb_hash_aset (rv, rb_str_new2 ("pv_attr"), rb_str_new2 (r->val[i].pv_attr));
479 rb_hash_aset (rv, rb_str_new2 ("pv_pe_count"), ULL2NUM (r->val[i].pv_pe_count));
480 rb_hash_aset (rv, rb_str_new2 ("pv_pe_alloc_count"), ULL2NUM (r->val[i].pv_pe_alloc_count));
481 rb_hash_aset (rv, rb_str_new2 ("pv_tags"), rb_str_new2 (r->val[i].pv_tags));
482 rb_hash_aset (rv, rb_str_new2 ("pe_start"), ULL2NUM (r->val[i].pe_start));
483 rb_hash_aset (rv, rb_str_new2 ("pv_mda_count"), ULL2NUM (r->val[i].pv_mda_count));
484 rb_hash_aset (rv, rb_str_new2 ("pv_mda_free"), ULL2NUM (r->val[i].pv_mda_free));
485 rb_ary_push (rv, hv);
487 guestfs_free_lvm_pv_list (r);
491 static VALUE ruby_guestfs_test0rvglist (VALUE gv, VALUE valv)
494 Data_Get_Struct (gv, guestfs_h, g);
496 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rvglist");
498 const char *val = StringValueCStr (valv);
500 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
501 "val", "test0rvglist");
503 struct guestfs_lvm_vg_list *r;
505 r = guestfs_test0rvglist (g, val);
507 rb_raise (e_Error, "%s", guestfs_last_error (g));
509 VALUE rv = rb_ary_new2 (r->len);
511 for (i = 0; i < r->len; ++i) {
512 VALUE hv = rb_hash_new ();
513 rb_hash_aset (rv, rb_str_new2 ("vg_name"), rb_str_new2 (r->val[i].vg_name));
514 rb_hash_aset (rv, rb_str_new2 ("vg_uuid"), rb_str_new (r->val[i].vg_uuid, 32));
515 rb_hash_aset (rv, rb_str_new2 ("vg_fmt"), rb_str_new2 (r->val[i].vg_fmt));
516 rb_hash_aset (rv, rb_str_new2 ("vg_attr"), rb_str_new2 (r->val[i].vg_attr));
517 rb_hash_aset (rv, rb_str_new2 ("vg_size"), ULL2NUM (r->val[i].vg_size));
518 rb_hash_aset (rv, rb_str_new2 ("vg_free"), ULL2NUM (r->val[i].vg_free));
519 rb_hash_aset (rv, rb_str_new2 ("vg_sysid"), rb_str_new2 (r->val[i].vg_sysid));
520 rb_hash_aset (rv, rb_str_new2 ("vg_extent_size"), ULL2NUM (r->val[i].vg_extent_size));
521 rb_hash_aset (rv, rb_str_new2 ("vg_extent_count"), ULL2NUM (r->val[i].vg_extent_count));
522 rb_hash_aset (rv, rb_str_new2 ("vg_free_count"), ULL2NUM (r->val[i].vg_free_count));
523 rb_hash_aset (rv, rb_str_new2 ("max_lv"), ULL2NUM (r->val[i].max_lv));
524 rb_hash_aset (rv, rb_str_new2 ("max_pv"), ULL2NUM (r->val[i].max_pv));
525 rb_hash_aset (rv, rb_str_new2 ("pv_count"), ULL2NUM (r->val[i].pv_count));
526 rb_hash_aset (rv, rb_str_new2 ("lv_count"), ULL2NUM (r->val[i].lv_count));
527 rb_hash_aset (rv, rb_str_new2 ("snap_count"), ULL2NUM (r->val[i].snap_count));
528 rb_hash_aset (rv, rb_str_new2 ("vg_seqno"), ULL2NUM (r->val[i].vg_seqno));
529 rb_hash_aset (rv, rb_str_new2 ("vg_tags"), rb_str_new2 (r->val[i].vg_tags));
530 rb_hash_aset (rv, rb_str_new2 ("vg_mda_count"), ULL2NUM (r->val[i].vg_mda_count));
531 rb_hash_aset (rv, rb_str_new2 ("vg_mda_free"), ULL2NUM (r->val[i].vg_mda_free));
532 rb_ary_push (rv, hv);
534 guestfs_free_lvm_vg_list (r);
538 static VALUE ruby_guestfs_test0rvglisterr (VALUE gv)
541 Data_Get_Struct (gv, guestfs_h, g);
543 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rvglisterr");
546 struct guestfs_lvm_vg_list *r;
548 r = guestfs_test0rvglisterr (g);
550 rb_raise (e_Error, "%s", guestfs_last_error (g));
552 VALUE rv = rb_ary_new2 (r->len);
554 for (i = 0; i < r->len; ++i) {
555 VALUE hv = rb_hash_new ();
556 rb_hash_aset (rv, rb_str_new2 ("vg_name"), rb_str_new2 (r->val[i].vg_name));
557 rb_hash_aset (rv, rb_str_new2 ("vg_uuid"), rb_str_new (r->val[i].vg_uuid, 32));
558 rb_hash_aset (rv, rb_str_new2 ("vg_fmt"), rb_str_new2 (r->val[i].vg_fmt));
559 rb_hash_aset (rv, rb_str_new2 ("vg_attr"), rb_str_new2 (r->val[i].vg_attr));
560 rb_hash_aset (rv, rb_str_new2 ("vg_size"), ULL2NUM (r->val[i].vg_size));
561 rb_hash_aset (rv, rb_str_new2 ("vg_free"), ULL2NUM (r->val[i].vg_free));
562 rb_hash_aset (rv, rb_str_new2 ("vg_sysid"), rb_str_new2 (r->val[i].vg_sysid));
563 rb_hash_aset (rv, rb_str_new2 ("vg_extent_size"), ULL2NUM (r->val[i].vg_extent_size));
564 rb_hash_aset (rv, rb_str_new2 ("vg_extent_count"), ULL2NUM (r->val[i].vg_extent_count));
565 rb_hash_aset (rv, rb_str_new2 ("vg_free_count"), ULL2NUM (r->val[i].vg_free_count));
566 rb_hash_aset (rv, rb_str_new2 ("max_lv"), ULL2NUM (r->val[i].max_lv));
567 rb_hash_aset (rv, rb_str_new2 ("max_pv"), ULL2NUM (r->val[i].max_pv));
568 rb_hash_aset (rv, rb_str_new2 ("pv_count"), ULL2NUM (r->val[i].pv_count));
569 rb_hash_aset (rv, rb_str_new2 ("lv_count"), ULL2NUM (r->val[i].lv_count));
570 rb_hash_aset (rv, rb_str_new2 ("snap_count"), ULL2NUM (r->val[i].snap_count));
571 rb_hash_aset (rv, rb_str_new2 ("vg_seqno"), ULL2NUM (r->val[i].vg_seqno));
572 rb_hash_aset (rv, rb_str_new2 ("vg_tags"), rb_str_new2 (r->val[i].vg_tags));
573 rb_hash_aset (rv, rb_str_new2 ("vg_mda_count"), ULL2NUM (r->val[i].vg_mda_count));
574 rb_hash_aset (rv, rb_str_new2 ("vg_mda_free"), ULL2NUM (r->val[i].vg_mda_free));
575 rb_ary_push (rv, hv);
577 guestfs_free_lvm_vg_list (r);
581 static VALUE ruby_guestfs_test0rlvlist (VALUE gv, VALUE valv)
584 Data_Get_Struct (gv, guestfs_h, g);
586 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rlvlist");
588 const char *val = StringValueCStr (valv);
590 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
591 "val", "test0rlvlist");
593 struct guestfs_lvm_lv_list *r;
595 r = guestfs_test0rlvlist (g, val);
597 rb_raise (e_Error, "%s", guestfs_last_error (g));
599 VALUE rv = rb_ary_new2 (r->len);
601 for (i = 0; i < r->len; ++i) {
602 VALUE hv = rb_hash_new ();
603 rb_hash_aset (rv, rb_str_new2 ("lv_name"), rb_str_new2 (r->val[i].lv_name));
604 rb_hash_aset (rv, rb_str_new2 ("lv_uuid"), rb_str_new (r->val[i].lv_uuid, 32));
605 rb_hash_aset (rv, rb_str_new2 ("lv_attr"), rb_str_new2 (r->val[i].lv_attr));
606 rb_hash_aset (rv, rb_str_new2 ("lv_major"), ULL2NUM (r->val[i].lv_major));
607 rb_hash_aset (rv, rb_str_new2 ("lv_minor"), ULL2NUM (r->val[i].lv_minor));
608 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_major"), ULL2NUM (r->val[i].lv_kernel_major));
609 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_minor"), ULL2NUM (r->val[i].lv_kernel_minor));
610 rb_hash_aset (rv, rb_str_new2 ("lv_size"), ULL2NUM (r->val[i].lv_size));
611 rb_hash_aset (rv, rb_str_new2 ("seg_count"), ULL2NUM (r->val[i].seg_count));
612 rb_hash_aset (rv, rb_str_new2 ("origin"), rb_str_new2 (r->val[i].origin));
613 rb_hash_aset (rv, rb_str_new2 ("snap_percent"), rb_dbl2big (r->val[i].snap_percent));
614 rb_hash_aset (rv, rb_str_new2 ("copy_percent"), rb_dbl2big (r->val[i].copy_percent));
615 rb_hash_aset (rv, rb_str_new2 ("move_pv"), rb_str_new2 (r->val[i].move_pv));
616 rb_hash_aset (rv, rb_str_new2 ("lv_tags"), rb_str_new2 (r->val[i].lv_tags));
617 rb_hash_aset (rv, rb_str_new2 ("mirror_log"), rb_str_new2 (r->val[i].mirror_log));
618 rb_hash_aset (rv, rb_str_new2 ("modules"), rb_str_new2 (r->val[i].modules));
619 rb_ary_push (rv, hv);
621 guestfs_free_lvm_lv_list (r);
625 static VALUE ruby_guestfs_test0rlvlisterr (VALUE gv)
628 Data_Get_Struct (gv, guestfs_h, g);
630 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rlvlisterr");
633 struct guestfs_lvm_lv_list *r;
635 r = guestfs_test0rlvlisterr (g);
637 rb_raise (e_Error, "%s", guestfs_last_error (g));
639 VALUE rv = rb_ary_new2 (r->len);
641 for (i = 0; i < r->len; ++i) {
642 VALUE hv = rb_hash_new ();
643 rb_hash_aset (rv, rb_str_new2 ("lv_name"), rb_str_new2 (r->val[i].lv_name));
644 rb_hash_aset (rv, rb_str_new2 ("lv_uuid"), rb_str_new (r->val[i].lv_uuid, 32));
645 rb_hash_aset (rv, rb_str_new2 ("lv_attr"), rb_str_new2 (r->val[i].lv_attr));
646 rb_hash_aset (rv, rb_str_new2 ("lv_major"), ULL2NUM (r->val[i].lv_major));
647 rb_hash_aset (rv, rb_str_new2 ("lv_minor"), ULL2NUM (r->val[i].lv_minor));
648 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_major"), ULL2NUM (r->val[i].lv_kernel_major));
649 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_minor"), ULL2NUM (r->val[i].lv_kernel_minor));
650 rb_hash_aset (rv, rb_str_new2 ("lv_size"), ULL2NUM (r->val[i].lv_size));
651 rb_hash_aset (rv, rb_str_new2 ("seg_count"), ULL2NUM (r->val[i].seg_count));
652 rb_hash_aset (rv, rb_str_new2 ("origin"), rb_str_new2 (r->val[i].origin));
653 rb_hash_aset (rv, rb_str_new2 ("snap_percent"), rb_dbl2big (r->val[i].snap_percent));
654 rb_hash_aset (rv, rb_str_new2 ("copy_percent"), rb_dbl2big (r->val[i].copy_percent));
655 rb_hash_aset (rv, rb_str_new2 ("move_pv"), rb_str_new2 (r->val[i].move_pv));
656 rb_hash_aset (rv, rb_str_new2 ("lv_tags"), rb_str_new2 (r->val[i].lv_tags));
657 rb_hash_aset (rv, rb_str_new2 ("mirror_log"), rb_str_new2 (r->val[i].mirror_log));
658 rb_hash_aset (rv, rb_str_new2 ("modules"), rb_str_new2 (r->val[i].modules));
659 rb_ary_push (rv, hv);
661 guestfs_free_lvm_lv_list (r);
665 static VALUE ruby_guestfs_test0rstat (VALUE gv, VALUE valv)
668 Data_Get_Struct (gv, guestfs_h, g);
670 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstat");
672 const char *val = StringValueCStr (valv);
674 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
675 "val", "test0rstat");
677 struct guestfs_stat *r;
679 r = guestfs_test0rstat (g, val);
681 rb_raise (e_Error, "%s", guestfs_last_error (g));
683 VALUE rv = rb_hash_new ();
684 rb_hash_aset (rv, rb_str_new2 ("dev"), ULL2NUM (r->dev));
685 rb_hash_aset (rv, rb_str_new2 ("ino"), ULL2NUM (r->ino));
686 rb_hash_aset (rv, rb_str_new2 ("mode"), ULL2NUM (r->mode));
687 rb_hash_aset (rv, rb_str_new2 ("nlink"), ULL2NUM (r->nlink));
688 rb_hash_aset (rv, rb_str_new2 ("uid"), ULL2NUM (r->uid));
689 rb_hash_aset (rv, rb_str_new2 ("gid"), ULL2NUM (r->gid));
690 rb_hash_aset (rv, rb_str_new2 ("rdev"), ULL2NUM (r->rdev));
691 rb_hash_aset (rv, rb_str_new2 ("size"), ULL2NUM (r->size));
692 rb_hash_aset (rv, rb_str_new2 ("blksize"), ULL2NUM (r->blksize));
693 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
694 rb_hash_aset (rv, rb_str_new2 ("atime"), ULL2NUM (r->atime));
695 rb_hash_aset (rv, rb_str_new2 ("mtime"), ULL2NUM (r->mtime));
696 rb_hash_aset (rv, rb_str_new2 ("ctime"), ULL2NUM (r->ctime));
701 static VALUE ruby_guestfs_test0rstaterr (VALUE gv)
704 Data_Get_Struct (gv, guestfs_h, g);
706 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstaterr");
709 struct guestfs_stat *r;
711 r = guestfs_test0rstaterr (g);
713 rb_raise (e_Error, "%s", guestfs_last_error (g));
715 VALUE rv = rb_hash_new ();
716 rb_hash_aset (rv, rb_str_new2 ("dev"), ULL2NUM (r->dev));
717 rb_hash_aset (rv, rb_str_new2 ("ino"), ULL2NUM (r->ino));
718 rb_hash_aset (rv, rb_str_new2 ("mode"), ULL2NUM (r->mode));
719 rb_hash_aset (rv, rb_str_new2 ("nlink"), ULL2NUM (r->nlink));
720 rb_hash_aset (rv, rb_str_new2 ("uid"), ULL2NUM (r->uid));
721 rb_hash_aset (rv, rb_str_new2 ("gid"), ULL2NUM (r->gid));
722 rb_hash_aset (rv, rb_str_new2 ("rdev"), ULL2NUM (r->rdev));
723 rb_hash_aset (rv, rb_str_new2 ("size"), ULL2NUM (r->size));
724 rb_hash_aset (rv, rb_str_new2 ("blksize"), ULL2NUM (r->blksize));
725 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
726 rb_hash_aset (rv, rb_str_new2 ("atime"), ULL2NUM (r->atime));
727 rb_hash_aset (rv, rb_str_new2 ("mtime"), ULL2NUM (r->mtime));
728 rb_hash_aset (rv, rb_str_new2 ("ctime"), ULL2NUM (r->ctime));
733 static VALUE ruby_guestfs_test0rstatvfs (VALUE gv, VALUE valv)
736 Data_Get_Struct (gv, guestfs_h, g);
738 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstatvfs");
740 const char *val = StringValueCStr (valv);
742 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
743 "val", "test0rstatvfs");
745 struct guestfs_statvfs *r;
747 r = guestfs_test0rstatvfs (g, val);
749 rb_raise (e_Error, "%s", guestfs_last_error (g));
751 VALUE rv = rb_hash_new ();
752 rb_hash_aset (rv, rb_str_new2 ("bsize"), ULL2NUM (r->bsize));
753 rb_hash_aset (rv, rb_str_new2 ("frsize"), ULL2NUM (r->frsize));
754 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
755 rb_hash_aset (rv, rb_str_new2 ("bfree"), ULL2NUM (r->bfree));
756 rb_hash_aset (rv, rb_str_new2 ("bavail"), ULL2NUM (r->bavail));
757 rb_hash_aset (rv, rb_str_new2 ("files"), ULL2NUM (r->files));
758 rb_hash_aset (rv, rb_str_new2 ("ffree"), ULL2NUM (r->ffree));
759 rb_hash_aset (rv, rb_str_new2 ("favail"), ULL2NUM (r->favail));
760 rb_hash_aset (rv, rb_str_new2 ("fsid"), ULL2NUM (r->fsid));
761 rb_hash_aset (rv, rb_str_new2 ("flag"), ULL2NUM (r->flag));
762 rb_hash_aset (rv, rb_str_new2 ("namemax"), ULL2NUM (r->namemax));
767 static VALUE ruby_guestfs_test0rstatvfserr (VALUE gv)
770 Data_Get_Struct (gv, guestfs_h, g);
772 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rstatvfserr");
775 struct guestfs_statvfs *r;
777 r = guestfs_test0rstatvfserr (g);
779 rb_raise (e_Error, "%s", guestfs_last_error (g));
781 VALUE rv = rb_hash_new ();
782 rb_hash_aset (rv, rb_str_new2 ("bsize"), ULL2NUM (r->bsize));
783 rb_hash_aset (rv, rb_str_new2 ("frsize"), ULL2NUM (r->frsize));
784 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
785 rb_hash_aset (rv, rb_str_new2 ("bfree"), ULL2NUM (r->bfree));
786 rb_hash_aset (rv, rb_str_new2 ("bavail"), ULL2NUM (r->bavail));
787 rb_hash_aset (rv, rb_str_new2 ("files"), ULL2NUM (r->files));
788 rb_hash_aset (rv, rb_str_new2 ("ffree"), ULL2NUM (r->ffree));
789 rb_hash_aset (rv, rb_str_new2 ("favail"), ULL2NUM (r->favail));
790 rb_hash_aset (rv, rb_str_new2 ("fsid"), ULL2NUM (r->fsid));
791 rb_hash_aset (rv, rb_str_new2 ("flag"), ULL2NUM (r->flag));
792 rb_hash_aset (rv, rb_str_new2 ("namemax"), ULL2NUM (r->namemax));
797 static VALUE ruby_guestfs_test0rhashtable (VALUE gv, VALUE valv)
800 Data_Get_Struct (gv, guestfs_h, g);
802 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rhashtable");
804 const char *val = StringValueCStr (valv);
806 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
807 "val", "test0rhashtable");
811 r = guestfs_test0rhashtable (g, val);
813 rb_raise (e_Error, "%s", guestfs_last_error (g));
815 VALUE rv = rb_hash_new ();
817 for (i = 0; r[i] != NULL; i+=2) {
818 rb_hash_aset (rv, rb_str_new2 (r[i]), rb_str_new2 (r[i+1]));
826 static VALUE ruby_guestfs_test0rhashtableerr (VALUE gv)
829 Data_Get_Struct (gv, guestfs_h, g);
831 rb_raise (rb_eArgError, "%s: used handle after closing it", "test0rhashtableerr");
836 r = guestfs_test0rhashtableerr (g);
838 rb_raise (e_Error, "%s", guestfs_last_error (g));
840 VALUE rv = rb_hash_new ();
842 for (i = 0; r[i] != NULL; i+=2) {
843 rb_hash_aset (rv, rb_str_new2 (r[i]), rb_str_new2 (r[i+1]));
851 static VALUE ruby_guestfs_launch (VALUE gv)
854 Data_Get_Struct (gv, guestfs_h, g);
856 rb_raise (rb_eArgError, "%s: used handle after closing it", "launch");
861 r = guestfs_launch (g);
863 rb_raise (e_Error, "%s", guestfs_last_error (g));
868 static VALUE ruby_guestfs_wait_ready (VALUE gv)
871 Data_Get_Struct (gv, guestfs_h, g);
873 rb_raise (rb_eArgError, "%s: used handle after closing it", "wait_ready");
878 r = guestfs_wait_ready (g);
880 rb_raise (e_Error, "%s", guestfs_last_error (g));
885 static VALUE ruby_guestfs_kill_subprocess (VALUE gv)
888 Data_Get_Struct (gv, guestfs_h, g);
890 rb_raise (rb_eArgError, "%s: used handle after closing it", "kill_subprocess");
895 r = guestfs_kill_subprocess (g);
897 rb_raise (e_Error, "%s", guestfs_last_error (g));
902 static VALUE ruby_guestfs_add_drive (VALUE gv, VALUE filenamev)
905 Data_Get_Struct (gv, guestfs_h, g);
907 rb_raise (rb_eArgError, "%s: used handle after closing it", "add_drive");
909 const char *filename = StringValueCStr (filenamev);
911 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
912 "filename", "add_drive");
916 r = guestfs_add_drive (g, filename);
918 rb_raise (e_Error, "%s", guestfs_last_error (g));
923 static VALUE ruby_guestfs_add_cdrom (VALUE gv, VALUE filenamev)
926 Data_Get_Struct (gv, guestfs_h, g);
928 rb_raise (rb_eArgError, "%s: used handle after closing it", "add_cdrom");
930 const char *filename = StringValueCStr (filenamev);
932 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
933 "filename", "add_cdrom");
937 r = guestfs_add_cdrom (g, filename);
939 rb_raise (e_Error, "%s", guestfs_last_error (g));
944 static VALUE ruby_guestfs_add_drive_ro (VALUE gv, VALUE filenamev)
947 Data_Get_Struct (gv, guestfs_h, g);
949 rb_raise (rb_eArgError, "%s: used handle after closing it", "add_drive_ro");
951 const char *filename = StringValueCStr (filenamev);
953 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
954 "filename", "add_drive_ro");
958 r = guestfs_add_drive_ro (g, filename);
960 rb_raise (e_Error, "%s", guestfs_last_error (g));
965 static VALUE ruby_guestfs_config (VALUE gv, VALUE qemuparamv, VALUE qemuvaluev)
968 Data_Get_Struct (gv, guestfs_h, g);
970 rb_raise (rb_eArgError, "%s: used handle after closing it", "config");
972 const char *qemuparam = StringValueCStr (qemuparamv);
974 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
975 "qemuparam", "config");
976 const char *qemuvalue = !NIL_P (qemuvaluev) ? StringValueCStr (qemuvaluev) : NULL;
980 r = guestfs_config (g, qemuparam, qemuvalue);
982 rb_raise (e_Error, "%s", guestfs_last_error (g));
987 static VALUE ruby_guestfs_set_qemu (VALUE gv, VALUE qemuv)
990 Data_Get_Struct (gv, guestfs_h, g);
992 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_qemu");
994 const char *qemu = StringValueCStr (qemuv);
996 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1001 r = guestfs_set_qemu (g, qemu);
1003 rb_raise (e_Error, "%s", guestfs_last_error (g));
1008 static VALUE ruby_guestfs_get_qemu (VALUE gv)
1011 Data_Get_Struct (gv, guestfs_h, g);
1013 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_qemu");
1018 r = guestfs_get_qemu (g);
1020 rb_raise (e_Error, "%s", guestfs_last_error (g));
1022 return rb_str_new2 (r);
1025 static VALUE ruby_guestfs_set_path (VALUE gv, VALUE pathv)
1028 Data_Get_Struct (gv, guestfs_h, g);
1030 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_path");
1032 const char *path = StringValueCStr (pathv);
1034 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1035 "path", "set_path");
1039 r = guestfs_set_path (g, path);
1041 rb_raise (e_Error, "%s", guestfs_last_error (g));
1046 static VALUE ruby_guestfs_get_path (VALUE gv)
1049 Data_Get_Struct (gv, guestfs_h, g);
1051 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_path");
1056 r = guestfs_get_path (g);
1058 rb_raise (e_Error, "%s", guestfs_last_error (g));
1060 return rb_str_new2 (r);
1063 static VALUE ruby_guestfs_set_append (VALUE gv, VALUE appendv)
1066 Data_Get_Struct (gv, guestfs_h, g);
1068 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_append");
1070 const char *append = StringValueCStr (appendv);
1072 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1073 "append", "set_append");
1077 r = guestfs_set_append (g, append);
1079 rb_raise (e_Error, "%s", guestfs_last_error (g));
1084 static VALUE ruby_guestfs_get_append (VALUE gv)
1087 Data_Get_Struct (gv, guestfs_h, g);
1089 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_append");
1094 r = guestfs_get_append (g);
1096 rb_raise (e_Error, "%s", guestfs_last_error (g));
1098 return rb_str_new2 (r);
1101 static VALUE ruby_guestfs_set_autosync (VALUE gv, VALUE autosyncv)
1104 Data_Get_Struct (gv, guestfs_h, g);
1106 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_autosync");
1108 int autosync = RTEST (autosyncv);
1112 r = guestfs_set_autosync (g, autosync);
1114 rb_raise (e_Error, "%s", guestfs_last_error (g));
1119 static VALUE ruby_guestfs_get_autosync (VALUE gv)
1122 Data_Get_Struct (gv, guestfs_h, g);
1124 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_autosync");
1129 r = guestfs_get_autosync (g);
1131 rb_raise (e_Error, "%s", guestfs_last_error (g));
1136 static VALUE ruby_guestfs_set_verbose (VALUE gv, VALUE verbosev)
1139 Data_Get_Struct (gv, guestfs_h, g);
1141 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_verbose");
1143 int verbose = RTEST (verbosev);
1147 r = guestfs_set_verbose (g, verbose);
1149 rb_raise (e_Error, "%s", guestfs_last_error (g));
1154 static VALUE ruby_guestfs_get_verbose (VALUE gv)
1157 Data_Get_Struct (gv, guestfs_h, g);
1159 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_verbose");
1164 r = guestfs_get_verbose (g);
1166 rb_raise (e_Error, "%s", guestfs_last_error (g));
1171 static VALUE ruby_guestfs_is_ready (VALUE gv)
1174 Data_Get_Struct (gv, guestfs_h, g);
1176 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_ready");
1181 r = guestfs_is_ready (g);
1183 rb_raise (e_Error, "%s", guestfs_last_error (g));
1188 static VALUE ruby_guestfs_is_config (VALUE gv)
1191 Data_Get_Struct (gv, guestfs_h, g);
1193 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_config");
1198 r = guestfs_is_config (g);
1200 rb_raise (e_Error, "%s", guestfs_last_error (g));
1205 static VALUE ruby_guestfs_is_launching (VALUE gv)
1208 Data_Get_Struct (gv, guestfs_h, g);
1210 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_launching");
1215 r = guestfs_is_launching (g);
1217 rb_raise (e_Error, "%s", guestfs_last_error (g));
1222 static VALUE ruby_guestfs_is_busy (VALUE gv)
1225 Data_Get_Struct (gv, guestfs_h, g);
1227 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_busy");
1232 r = guestfs_is_busy (g);
1234 rb_raise (e_Error, "%s", guestfs_last_error (g));
1239 static VALUE ruby_guestfs_get_state (VALUE gv)
1242 Data_Get_Struct (gv, guestfs_h, g);
1244 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_state");
1249 r = guestfs_get_state (g);
1251 rb_raise (e_Error, "%s", guestfs_last_error (g));
1256 static VALUE ruby_guestfs_set_busy (VALUE gv)
1259 Data_Get_Struct (gv, guestfs_h, g);
1261 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_busy");
1266 r = guestfs_set_busy (g);
1268 rb_raise (e_Error, "%s", guestfs_last_error (g));
1273 static VALUE ruby_guestfs_set_ready (VALUE gv)
1276 Data_Get_Struct (gv, guestfs_h, g);
1278 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_ready");
1283 r = guestfs_set_ready (g);
1285 rb_raise (e_Error, "%s", guestfs_last_error (g));
1290 static VALUE ruby_guestfs_end_busy (VALUE gv)
1293 Data_Get_Struct (gv, guestfs_h, g);
1295 rb_raise (rb_eArgError, "%s: used handle after closing it", "end_busy");
1300 r = guestfs_end_busy (g);
1302 rb_raise (e_Error, "%s", guestfs_last_error (g));
1307 static VALUE ruby_guestfs_mount (VALUE gv, VALUE devicev, VALUE mountpointv)
1310 Data_Get_Struct (gv, guestfs_h, g);
1312 rb_raise (rb_eArgError, "%s: used handle after closing it", "mount");
1314 const char *device = StringValueCStr (devicev);
1316 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1318 const char *mountpoint = StringValueCStr (mountpointv);
1320 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1321 "mountpoint", "mount");
1325 r = guestfs_mount (g, device, mountpoint);
1327 rb_raise (e_Error, "%s", guestfs_last_error (g));
1332 static VALUE ruby_guestfs_sync (VALUE gv)
1335 Data_Get_Struct (gv, guestfs_h, g);
1337 rb_raise (rb_eArgError, "%s: used handle after closing it", "sync");
1342 r = guestfs_sync (g);
1344 rb_raise (e_Error, "%s", guestfs_last_error (g));
1349 static VALUE ruby_guestfs_touch (VALUE gv, VALUE pathv)
1352 Data_Get_Struct (gv, guestfs_h, g);
1354 rb_raise (rb_eArgError, "%s: used handle after closing it", "touch");
1356 const char *path = StringValueCStr (pathv);
1358 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1363 r = guestfs_touch (g, path);
1365 rb_raise (e_Error, "%s", guestfs_last_error (g));
1370 static VALUE ruby_guestfs_cat (VALUE gv, VALUE pathv)
1373 Data_Get_Struct (gv, guestfs_h, g);
1375 rb_raise (rb_eArgError, "%s: used handle after closing it", "cat");
1377 const char *path = StringValueCStr (pathv);
1379 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1384 r = guestfs_cat (g, path);
1386 rb_raise (e_Error, "%s", guestfs_last_error (g));
1388 VALUE rv = rb_str_new2 (r);
1393 static VALUE ruby_guestfs_ll (VALUE gv, VALUE directoryv)
1396 Data_Get_Struct (gv, guestfs_h, g);
1398 rb_raise (rb_eArgError, "%s: used handle after closing it", "ll");
1400 const char *directory = StringValueCStr (directoryv);
1402 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1407 r = guestfs_ll (g, directory);
1409 rb_raise (e_Error, "%s", guestfs_last_error (g));
1411 VALUE rv = rb_str_new2 (r);
1416 static VALUE ruby_guestfs_ls (VALUE gv, VALUE directoryv)
1419 Data_Get_Struct (gv, guestfs_h, g);
1421 rb_raise (rb_eArgError, "%s: used handle after closing it", "ls");
1423 const char *directory = StringValueCStr (directoryv);
1425 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1430 r = guestfs_ls (g, directory);
1432 rb_raise (e_Error, "%s", guestfs_last_error (g));
1435 for (i = 0; r[i] != NULL; ++i) len++;
1436 VALUE rv = rb_ary_new2 (len);
1437 for (i = 0; r[i] != NULL; ++i) {
1438 rb_ary_push (rv, rb_str_new2 (r[i]));
1445 static VALUE ruby_guestfs_list_devices (VALUE gv)
1448 Data_Get_Struct (gv, guestfs_h, g);
1450 rb_raise (rb_eArgError, "%s: used handle after closing it", "list_devices");
1455 r = guestfs_list_devices (g);
1457 rb_raise (e_Error, "%s", guestfs_last_error (g));
1460 for (i = 0; r[i] != NULL; ++i) len++;
1461 VALUE rv = rb_ary_new2 (len);
1462 for (i = 0; r[i] != NULL; ++i) {
1463 rb_ary_push (rv, rb_str_new2 (r[i]));
1470 static VALUE ruby_guestfs_list_partitions (VALUE gv)
1473 Data_Get_Struct (gv, guestfs_h, g);
1475 rb_raise (rb_eArgError, "%s: used handle after closing it", "list_partitions");
1480 r = guestfs_list_partitions (g);
1482 rb_raise (e_Error, "%s", guestfs_last_error (g));
1485 for (i = 0; r[i] != NULL; ++i) len++;
1486 VALUE rv = rb_ary_new2 (len);
1487 for (i = 0; r[i] != NULL; ++i) {
1488 rb_ary_push (rv, rb_str_new2 (r[i]));
1495 static VALUE ruby_guestfs_pvs (VALUE gv)
1498 Data_Get_Struct (gv, guestfs_h, g);
1500 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvs");
1505 r = guestfs_pvs (g);
1507 rb_raise (e_Error, "%s", guestfs_last_error (g));
1510 for (i = 0; r[i] != NULL; ++i) len++;
1511 VALUE rv = rb_ary_new2 (len);
1512 for (i = 0; r[i] != NULL; ++i) {
1513 rb_ary_push (rv, rb_str_new2 (r[i]));
1520 static VALUE ruby_guestfs_vgs (VALUE gv)
1523 Data_Get_Struct (gv, guestfs_h, g);
1525 rb_raise (rb_eArgError, "%s: used handle after closing it", "vgs");
1530 r = guestfs_vgs (g);
1532 rb_raise (e_Error, "%s", guestfs_last_error (g));
1535 for (i = 0; r[i] != NULL; ++i) len++;
1536 VALUE rv = rb_ary_new2 (len);
1537 for (i = 0; r[i] != NULL; ++i) {
1538 rb_ary_push (rv, rb_str_new2 (r[i]));
1545 static VALUE ruby_guestfs_lvs (VALUE gv)
1548 Data_Get_Struct (gv, guestfs_h, g);
1550 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvs");
1555 r = guestfs_lvs (g);
1557 rb_raise (e_Error, "%s", guestfs_last_error (g));
1560 for (i = 0; r[i] != NULL; ++i) len++;
1561 VALUE rv = rb_ary_new2 (len);
1562 for (i = 0; r[i] != NULL; ++i) {
1563 rb_ary_push (rv, rb_str_new2 (r[i]));
1570 static VALUE ruby_guestfs_pvs_full (VALUE gv)
1573 Data_Get_Struct (gv, guestfs_h, g);
1575 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvs_full");
1578 struct guestfs_lvm_pv_list *r;
1580 r = guestfs_pvs_full (g);
1582 rb_raise (e_Error, "%s", guestfs_last_error (g));
1584 VALUE rv = rb_ary_new2 (r->len);
1586 for (i = 0; i < r->len; ++i) {
1587 VALUE hv = rb_hash_new ();
1588 rb_hash_aset (rv, rb_str_new2 ("pv_name"), rb_str_new2 (r->val[i].pv_name));
1589 rb_hash_aset (rv, rb_str_new2 ("pv_uuid"), rb_str_new (r->val[i].pv_uuid, 32));
1590 rb_hash_aset (rv, rb_str_new2 ("pv_fmt"), rb_str_new2 (r->val[i].pv_fmt));
1591 rb_hash_aset (rv, rb_str_new2 ("pv_size"), ULL2NUM (r->val[i].pv_size));
1592 rb_hash_aset (rv, rb_str_new2 ("dev_size"), ULL2NUM (r->val[i].dev_size));
1593 rb_hash_aset (rv, rb_str_new2 ("pv_free"), ULL2NUM (r->val[i].pv_free));
1594 rb_hash_aset (rv, rb_str_new2 ("pv_used"), ULL2NUM (r->val[i].pv_used));
1595 rb_hash_aset (rv, rb_str_new2 ("pv_attr"), rb_str_new2 (r->val[i].pv_attr));
1596 rb_hash_aset (rv, rb_str_new2 ("pv_pe_count"), ULL2NUM (r->val[i].pv_pe_count));
1597 rb_hash_aset (rv, rb_str_new2 ("pv_pe_alloc_count"), ULL2NUM (r->val[i].pv_pe_alloc_count));
1598 rb_hash_aset (rv, rb_str_new2 ("pv_tags"), rb_str_new2 (r->val[i].pv_tags));
1599 rb_hash_aset (rv, rb_str_new2 ("pe_start"), ULL2NUM (r->val[i].pe_start));
1600 rb_hash_aset (rv, rb_str_new2 ("pv_mda_count"), ULL2NUM (r->val[i].pv_mda_count));
1601 rb_hash_aset (rv, rb_str_new2 ("pv_mda_free"), ULL2NUM (r->val[i].pv_mda_free));
1602 rb_ary_push (rv, hv);
1604 guestfs_free_lvm_pv_list (r);
1608 static VALUE ruby_guestfs_vgs_full (VALUE gv)
1611 Data_Get_Struct (gv, guestfs_h, g);
1613 rb_raise (rb_eArgError, "%s: used handle after closing it", "vgs_full");
1616 struct guestfs_lvm_vg_list *r;
1618 r = guestfs_vgs_full (g);
1620 rb_raise (e_Error, "%s", guestfs_last_error (g));
1622 VALUE rv = rb_ary_new2 (r->len);
1624 for (i = 0; i < r->len; ++i) {
1625 VALUE hv = rb_hash_new ();
1626 rb_hash_aset (rv, rb_str_new2 ("vg_name"), rb_str_new2 (r->val[i].vg_name));
1627 rb_hash_aset (rv, rb_str_new2 ("vg_uuid"), rb_str_new (r->val[i].vg_uuid, 32));
1628 rb_hash_aset (rv, rb_str_new2 ("vg_fmt"), rb_str_new2 (r->val[i].vg_fmt));
1629 rb_hash_aset (rv, rb_str_new2 ("vg_attr"), rb_str_new2 (r->val[i].vg_attr));
1630 rb_hash_aset (rv, rb_str_new2 ("vg_size"), ULL2NUM (r->val[i].vg_size));
1631 rb_hash_aset (rv, rb_str_new2 ("vg_free"), ULL2NUM (r->val[i].vg_free));
1632 rb_hash_aset (rv, rb_str_new2 ("vg_sysid"), rb_str_new2 (r->val[i].vg_sysid));
1633 rb_hash_aset (rv, rb_str_new2 ("vg_extent_size"), ULL2NUM (r->val[i].vg_extent_size));
1634 rb_hash_aset (rv, rb_str_new2 ("vg_extent_count"), ULL2NUM (r->val[i].vg_extent_count));
1635 rb_hash_aset (rv, rb_str_new2 ("vg_free_count"), ULL2NUM (r->val[i].vg_free_count));
1636 rb_hash_aset (rv, rb_str_new2 ("max_lv"), ULL2NUM (r->val[i].max_lv));
1637 rb_hash_aset (rv, rb_str_new2 ("max_pv"), ULL2NUM (r->val[i].max_pv));
1638 rb_hash_aset (rv, rb_str_new2 ("pv_count"), ULL2NUM (r->val[i].pv_count));
1639 rb_hash_aset (rv, rb_str_new2 ("lv_count"), ULL2NUM (r->val[i].lv_count));
1640 rb_hash_aset (rv, rb_str_new2 ("snap_count"), ULL2NUM (r->val[i].snap_count));
1641 rb_hash_aset (rv, rb_str_new2 ("vg_seqno"), ULL2NUM (r->val[i].vg_seqno));
1642 rb_hash_aset (rv, rb_str_new2 ("vg_tags"), rb_str_new2 (r->val[i].vg_tags));
1643 rb_hash_aset (rv, rb_str_new2 ("vg_mda_count"), ULL2NUM (r->val[i].vg_mda_count));
1644 rb_hash_aset (rv, rb_str_new2 ("vg_mda_free"), ULL2NUM (r->val[i].vg_mda_free));
1645 rb_ary_push (rv, hv);
1647 guestfs_free_lvm_vg_list (r);
1651 static VALUE ruby_guestfs_lvs_full (VALUE gv)
1654 Data_Get_Struct (gv, guestfs_h, g);
1656 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvs_full");
1659 struct guestfs_lvm_lv_list *r;
1661 r = guestfs_lvs_full (g);
1663 rb_raise (e_Error, "%s", guestfs_last_error (g));
1665 VALUE rv = rb_ary_new2 (r->len);
1667 for (i = 0; i < r->len; ++i) {
1668 VALUE hv = rb_hash_new ();
1669 rb_hash_aset (rv, rb_str_new2 ("lv_name"), rb_str_new2 (r->val[i].lv_name));
1670 rb_hash_aset (rv, rb_str_new2 ("lv_uuid"), rb_str_new (r->val[i].lv_uuid, 32));
1671 rb_hash_aset (rv, rb_str_new2 ("lv_attr"), rb_str_new2 (r->val[i].lv_attr));
1672 rb_hash_aset (rv, rb_str_new2 ("lv_major"), ULL2NUM (r->val[i].lv_major));
1673 rb_hash_aset (rv, rb_str_new2 ("lv_minor"), ULL2NUM (r->val[i].lv_minor));
1674 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_major"), ULL2NUM (r->val[i].lv_kernel_major));
1675 rb_hash_aset (rv, rb_str_new2 ("lv_kernel_minor"), ULL2NUM (r->val[i].lv_kernel_minor));
1676 rb_hash_aset (rv, rb_str_new2 ("lv_size"), ULL2NUM (r->val[i].lv_size));
1677 rb_hash_aset (rv, rb_str_new2 ("seg_count"), ULL2NUM (r->val[i].seg_count));
1678 rb_hash_aset (rv, rb_str_new2 ("origin"), rb_str_new2 (r->val[i].origin));
1679 rb_hash_aset (rv, rb_str_new2 ("snap_percent"), rb_dbl2big (r->val[i].snap_percent));
1680 rb_hash_aset (rv, rb_str_new2 ("copy_percent"), rb_dbl2big (r->val[i].copy_percent));
1681 rb_hash_aset (rv, rb_str_new2 ("move_pv"), rb_str_new2 (r->val[i].move_pv));
1682 rb_hash_aset (rv, rb_str_new2 ("lv_tags"), rb_str_new2 (r->val[i].lv_tags));
1683 rb_hash_aset (rv, rb_str_new2 ("mirror_log"), rb_str_new2 (r->val[i].mirror_log));
1684 rb_hash_aset (rv, rb_str_new2 ("modules"), rb_str_new2 (r->val[i].modules));
1685 rb_ary_push (rv, hv);
1687 guestfs_free_lvm_lv_list (r);
1691 static VALUE ruby_guestfs_read_lines (VALUE gv, VALUE pathv)
1694 Data_Get_Struct (gv, guestfs_h, g);
1696 rb_raise (rb_eArgError, "%s: used handle after closing it", "read_lines");
1698 const char *path = StringValueCStr (pathv);
1700 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1701 "path", "read_lines");
1705 r = guestfs_read_lines (g, path);
1707 rb_raise (e_Error, "%s", guestfs_last_error (g));
1710 for (i = 0; r[i] != NULL; ++i) len++;
1711 VALUE rv = rb_ary_new2 (len);
1712 for (i = 0; r[i] != NULL; ++i) {
1713 rb_ary_push (rv, rb_str_new2 (r[i]));
1720 static VALUE ruby_guestfs_aug_init (VALUE gv, VALUE rootv, VALUE flagsv)
1723 Data_Get_Struct (gv, guestfs_h, g);
1725 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_init");
1727 const char *root = StringValueCStr (rootv);
1729 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1730 "root", "aug_init");
1731 int flags = NUM2INT (flagsv);
1735 r = guestfs_aug_init (g, root, flags);
1737 rb_raise (e_Error, "%s", guestfs_last_error (g));
1742 static VALUE ruby_guestfs_aug_close (VALUE gv)
1745 Data_Get_Struct (gv, guestfs_h, g);
1747 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_close");
1752 r = guestfs_aug_close (g);
1754 rb_raise (e_Error, "%s", guestfs_last_error (g));
1759 static VALUE ruby_guestfs_aug_defvar (VALUE gv, VALUE namev, VALUE exprv)
1762 Data_Get_Struct (gv, guestfs_h, g);
1764 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_defvar");
1766 const char *name = StringValueCStr (namev);
1768 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1769 "name", "aug_defvar");
1770 const char *expr = !NIL_P (exprv) ? StringValueCStr (exprv) : NULL;
1774 r = guestfs_aug_defvar (g, name, expr);
1776 rb_raise (e_Error, "%s", guestfs_last_error (g));
1781 static VALUE ruby_guestfs_aug_defnode (VALUE gv, VALUE namev, VALUE exprv, VALUE valv)
1784 Data_Get_Struct (gv, guestfs_h, g);
1786 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_defnode");
1788 const char *name = StringValueCStr (namev);
1790 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1791 "name", "aug_defnode");
1792 const char *expr = StringValueCStr (exprv);
1794 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1795 "expr", "aug_defnode");
1796 const char *val = StringValueCStr (valv);
1798 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1799 "val", "aug_defnode");
1801 struct guestfs_int_bool *r;
1803 r = guestfs_aug_defnode (g, name, expr, val);
1805 rb_raise (e_Error, "%s", guestfs_last_error (g));
1807 VALUE rv = rb_ary_new2 (2);
1808 rb_ary_push (rv, INT2NUM (r->i));
1809 rb_ary_push (rv, INT2NUM (r->b));
1810 guestfs_free_int_bool (r);
1814 static VALUE ruby_guestfs_aug_get (VALUE gv, VALUE pathv)
1817 Data_Get_Struct (gv, guestfs_h, g);
1819 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_get");
1821 const char *path = StringValueCStr (pathv);
1823 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1828 r = guestfs_aug_get (g, path);
1830 rb_raise (e_Error, "%s", guestfs_last_error (g));
1832 VALUE rv = rb_str_new2 (r);
1837 static VALUE ruby_guestfs_aug_set (VALUE gv, VALUE pathv, VALUE valv)
1840 Data_Get_Struct (gv, guestfs_h, g);
1842 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_set");
1844 const char *path = StringValueCStr (pathv);
1846 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1848 const char *val = StringValueCStr (valv);
1850 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1855 r = guestfs_aug_set (g, path, val);
1857 rb_raise (e_Error, "%s", guestfs_last_error (g));
1862 static VALUE ruby_guestfs_aug_insert (VALUE gv, VALUE pathv, VALUE labelv, VALUE beforev)
1865 Data_Get_Struct (gv, guestfs_h, g);
1867 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_insert");
1869 const char *path = StringValueCStr (pathv);
1871 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1872 "path", "aug_insert");
1873 const char *label = StringValueCStr (labelv);
1875 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1876 "label", "aug_insert");
1877 int before = RTEST (beforev);
1881 r = guestfs_aug_insert (g, path, label, before);
1883 rb_raise (e_Error, "%s", guestfs_last_error (g));
1888 static VALUE ruby_guestfs_aug_rm (VALUE gv, VALUE pathv)
1891 Data_Get_Struct (gv, guestfs_h, g);
1893 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_rm");
1895 const char *path = StringValueCStr (pathv);
1897 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1902 r = guestfs_aug_rm (g, path);
1904 rb_raise (e_Error, "%s", guestfs_last_error (g));
1909 static VALUE ruby_guestfs_aug_mv (VALUE gv, VALUE srcv, VALUE destv)
1912 Data_Get_Struct (gv, guestfs_h, g);
1914 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_mv");
1916 const char *src = StringValueCStr (srcv);
1918 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1920 const char *dest = StringValueCStr (destv);
1922 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1927 r = guestfs_aug_mv (g, src, dest);
1929 rb_raise (e_Error, "%s", guestfs_last_error (g));
1934 static VALUE ruby_guestfs_aug_match (VALUE gv, VALUE pathv)
1937 Data_Get_Struct (gv, guestfs_h, g);
1939 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_match");
1941 const char *path = StringValueCStr (pathv);
1943 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
1944 "path", "aug_match");
1948 r = guestfs_aug_match (g, path);
1950 rb_raise (e_Error, "%s", guestfs_last_error (g));
1953 for (i = 0; r[i] != NULL; ++i) len++;
1954 VALUE rv = rb_ary_new2 (len);
1955 for (i = 0; r[i] != NULL; ++i) {
1956 rb_ary_push (rv, rb_str_new2 (r[i]));
1963 static VALUE ruby_guestfs_aug_save (VALUE gv)
1966 Data_Get_Struct (gv, guestfs_h, g);
1968 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_save");
1973 r = guestfs_aug_save (g);
1975 rb_raise (e_Error, "%s", guestfs_last_error (g));
1980 static VALUE ruby_guestfs_aug_load (VALUE gv)
1983 Data_Get_Struct (gv, guestfs_h, g);
1985 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_load");
1990 r = guestfs_aug_load (g);
1992 rb_raise (e_Error, "%s", guestfs_last_error (g));
1997 static VALUE ruby_guestfs_aug_ls (VALUE gv, VALUE pathv)
2000 Data_Get_Struct (gv, guestfs_h, g);
2002 rb_raise (rb_eArgError, "%s: used handle after closing it", "aug_ls");
2004 const char *path = StringValueCStr (pathv);
2006 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2011 r = guestfs_aug_ls (g, path);
2013 rb_raise (e_Error, "%s", guestfs_last_error (g));
2016 for (i = 0; r[i] != NULL; ++i) len++;
2017 VALUE rv = rb_ary_new2 (len);
2018 for (i = 0; r[i] != NULL; ++i) {
2019 rb_ary_push (rv, rb_str_new2 (r[i]));
2026 static VALUE ruby_guestfs_rm (VALUE gv, VALUE pathv)
2029 Data_Get_Struct (gv, guestfs_h, g);
2031 rb_raise (rb_eArgError, "%s: used handle after closing it", "rm");
2033 const char *path = StringValueCStr (pathv);
2035 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2040 r = guestfs_rm (g, path);
2042 rb_raise (e_Error, "%s", guestfs_last_error (g));
2047 static VALUE ruby_guestfs_rmdir (VALUE gv, VALUE pathv)
2050 Data_Get_Struct (gv, guestfs_h, g);
2052 rb_raise (rb_eArgError, "%s: used handle after closing it", "rmdir");
2054 const char *path = StringValueCStr (pathv);
2056 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2061 r = guestfs_rmdir (g, path);
2063 rb_raise (e_Error, "%s", guestfs_last_error (g));
2068 static VALUE ruby_guestfs_rm_rf (VALUE gv, VALUE pathv)
2071 Data_Get_Struct (gv, guestfs_h, g);
2073 rb_raise (rb_eArgError, "%s: used handle after closing it", "rm_rf");
2075 const char *path = StringValueCStr (pathv);
2077 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2082 r = guestfs_rm_rf (g, path);
2084 rb_raise (e_Error, "%s", guestfs_last_error (g));
2089 static VALUE ruby_guestfs_mkdir (VALUE gv, VALUE pathv)
2092 Data_Get_Struct (gv, guestfs_h, g);
2094 rb_raise (rb_eArgError, "%s: used handle after closing it", "mkdir");
2096 const char *path = StringValueCStr (pathv);
2098 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2103 r = guestfs_mkdir (g, path);
2105 rb_raise (e_Error, "%s", guestfs_last_error (g));
2110 static VALUE ruby_guestfs_mkdir_p (VALUE gv, VALUE pathv)
2113 Data_Get_Struct (gv, guestfs_h, g);
2115 rb_raise (rb_eArgError, "%s: used handle after closing it", "mkdir_p");
2117 const char *path = StringValueCStr (pathv);
2119 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2124 r = guestfs_mkdir_p (g, path);
2126 rb_raise (e_Error, "%s", guestfs_last_error (g));
2131 static VALUE ruby_guestfs_chmod (VALUE gv, VALUE modev, VALUE pathv)
2134 Data_Get_Struct (gv, guestfs_h, g);
2136 rb_raise (rb_eArgError, "%s: used handle after closing it", "chmod");
2138 int mode = NUM2INT (modev);
2139 const char *path = StringValueCStr (pathv);
2141 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2146 r = guestfs_chmod (g, mode, path);
2148 rb_raise (e_Error, "%s", guestfs_last_error (g));
2153 static VALUE ruby_guestfs_chown (VALUE gv, VALUE ownerv, VALUE groupv, VALUE pathv)
2156 Data_Get_Struct (gv, guestfs_h, g);
2158 rb_raise (rb_eArgError, "%s: used handle after closing it", "chown");
2160 int owner = NUM2INT (ownerv);
2161 int group = NUM2INT (groupv);
2162 const char *path = StringValueCStr (pathv);
2164 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2169 r = guestfs_chown (g, owner, group, path);
2171 rb_raise (e_Error, "%s", guestfs_last_error (g));
2176 static VALUE ruby_guestfs_exists (VALUE gv, VALUE pathv)
2179 Data_Get_Struct (gv, guestfs_h, g);
2181 rb_raise (rb_eArgError, "%s: used handle after closing it", "exists");
2183 const char *path = StringValueCStr (pathv);
2185 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2190 r = guestfs_exists (g, path);
2192 rb_raise (e_Error, "%s", guestfs_last_error (g));
2197 static VALUE ruby_guestfs_is_file (VALUE gv, VALUE pathv)
2200 Data_Get_Struct (gv, guestfs_h, g);
2202 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_file");
2204 const char *path = StringValueCStr (pathv);
2206 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2211 r = guestfs_is_file (g, path);
2213 rb_raise (e_Error, "%s", guestfs_last_error (g));
2218 static VALUE ruby_guestfs_is_dir (VALUE gv, VALUE pathv)
2221 Data_Get_Struct (gv, guestfs_h, g);
2223 rb_raise (rb_eArgError, "%s: used handle after closing it", "is_dir");
2225 const char *path = StringValueCStr (pathv);
2227 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2232 r = guestfs_is_dir (g, path);
2234 rb_raise (e_Error, "%s", guestfs_last_error (g));
2239 static VALUE ruby_guestfs_pvcreate (VALUE gv, VALUE devicev)
2242 Data_Get_Struct (gv, guestfs_h, g);
2244 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvcreate");
2246 const char *device = StringValueCStr (devicev);
2248 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2249 "device", "pvcreate");
2253 r = guestfs_pvcreate (g, device);
2255 rb_raise (e_Error, "%s", guestfs_last_error (g));
2260 static VALUE ruby_guestfs_vgcreate (VALUE gv, VALUE volgroupv, VALUE physvolsv)
2263 Data_Get_Struct (gv, guestfs_h, g);
2265 rb_raise (rb_eArgError, "%s: used handle after closing it", "vgcreate");
2267 const char *volgroup = StringValueCStr (volgroupv);
2269 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2270 "volgroup", "vgcreate");
2273 len = RARRAY_LEN (physvolsv);
2274 physvols = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
2275 for (i = 0; i < len; ++i) {
2276 VALUE v = rb_ary_entry (physvolsv, i);
2277 physvols[i] = StringValueCStr (v);
2279 physvols[len] = NULL;
2284 r = guestfs_vgcreate (g, volgroup, physvols);
2287 rb_raise (e_Error, "%s", guestfs_last_error (g));
2292 static VALUE ruby_guestfs_lvcreate (VALUE gv, VALUE logvolv, VALUE volgroupv, VALUE mbytesv)
2295 Data_Get_Struct (gv, guestfs_h, g);
2297 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvcreate");
2299 const char *logvol = StringValueCStr (logvolv);
2301 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2302 "logvol", "lvcreate");
2303 const char *volgroup = StringValueCStr (volgroupv);
2305 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2306 "volgroup", "lvcreate");
2307 int mbytes = NUM2INT (mbytesv);
2311 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
2313 rb_raise (e_Error, "%s", guestfs_last_error (g));
2318 static VALUE ruby_guestfs_mkfs (VALUE gv, VALUE fstypev, VALUE devicev)
2321 Data_Get_Struct (gv, guestfs_h, g);
2323 rb_raise (rb_eArgError, "%s: used handle after closing it", "mkfs");
2325 const char *fstype = StringValueCStr (fstypev);
2327 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2329 const char *device = StringValueCStr (devicev);
2331 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2336 r = guestfs_mkfs (g, fstype, device);
2338 rb_raise (e_Error, "%s", guestfs_last_error (g));
2343 static VALUE ruby_guestfs_sfdisk (VALUE gv, VALUE devicev, VALUE cylsv, VALUE headsv, VALUE sectorsv, VALUE linesv)
2346 Data_Get_Struct (gv, guestfs_h, g);
2348 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk");
2350 const char *device = StringValueCStr (devicev);
2352 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2353 "device", "sfdisk");
2354 int cyls = NUM2INT (cylsv);
2355 int heads = NUM2INT (headsv);
2356 int sectors = NUM2INT (sectorsv);
2359 len = RARRAY_LEN (linesv);
2360 lines = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
2361 for (i = 0; i < len; ++i) {
2362 VALUE v = rb_ary_entry (linesv, i);
2363 lines[i] = StringValueCStr (v);
2370 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
2373 rb_raise (e_Error, "%s", guestfs_last_error (g));
2378 static VALUE ruby_guestfs_write_file (VALUE gv, VALUE pathv, VALUE contentv, VALUE sizev)
2381 Data_Get_Struct (gv, guestfs_h, g);
2383 rb_raise (rb_eArgError, "%s: used handle after closing it", "write_file");
2385 const char *path = StringValueCStr (pathv);
2387 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2388 "path", "write_file");
2389 const char *content = StringValueCStr (contentv);
2391 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2392 "content", "write_file");
2393 int size = NUM2INT (sizev);
2397 r = guestfs_write_file (g, path, content, size);
2399 rb_raise (e_Error, "%s", guestfs_last_error (g));
2404 static VALUE ruby_guestfs_umount (VALUE gv, VALUE pathordevicev)
2407 Data_Get_Struct (gv, guestfs_h, g);
2409 rb_raise (rb_eArgError, "%s: used handle after closing it", "umount");
2411 const char *pathordevice = StringValueCStr (pathordevicev);
2413 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2414 "pathordevice", "umount");
2418 r = guestfs_umount (g, pathordevice);
2420 rb_raise (e_Error, "%s", guestfs_last_error (g));
2425 static VALUE ruby_guestfs_mounts (VALUE gv)
2428 Data_Get_Struct (gv, guestfs_h, g);
2430 rb_raise (rb_eArgError, "%s: used handle after closing it", "mounts");
2435 r = guestfs_mounts (g);
2437 rb_raise (e_Error, "%s", guestfs_last_error (g));
2440 for (i = 0; r[i] != NULL; ++i) len++;
2441 VALUE rv = rb_ary_new2 (len);
2442 for (i = 0; r[i] != NULL; ++i) {
2443 rb_ary_push (rv, rb_str_new2 (r[i]));
2450 static VALUE ruby_guestfs_umount_all (VALUE gv)
2453 Data_Get_Struct (gv, guestfs_h, g);
2455 rb_raise (rb_eArgError, "%s: used handle after closing it", "umount_all");
2460 r = guestfs_umount_all (g);
2462 rb_raise (e_Error, "%s", guestfs_last_error (g));
2467 static VALUE ruby_guestfs_lvm_remove_all (VALUE gv)
2470 Data_Get_Struct (gv, guestfs_h, g);
2472 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvm_remove_all");
2477 r = guestfs_lvm_remove_all (g);
2479 rb_raise (e_Error, "%s", guestfs_last_error (g));
2484 static VALUE ruby_guestfs_file (VALUE gv, VALUE pathv)
2487 Data_Get_Struct (gv, guestfs_h, g);
2489 rb_raise (rb_eArgError, "%s: used handle after closing it", "file");
2491 const char *path = StringValueCStr (pathv);
2493 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2498 r = guestfs_file (g, path);
2500 rb_raise (e_Error, "%s", guestfs_last_error (g));
2502 VALUE rv = rb_str_new2 (r);
2507 static VALUE ruby_guestfs_command (VALUE gv, VALUE argumentsv)
2510 Data_Get_Struct (gv, guestfs_h, g);
2512 rb_raise (rb_eArgError, "%s: used handle after closing it", "command");
2516 len = RARRAY_LEN (argumentsv);
2517 arguments = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
2518 for (i = 0; i < len; ++i) {
2519 VALUE v = rb_ary_entry (argumentsv, i);
2520 arguments[i] = StringValueCStr (v);
2522 arguments[len] = NULL;
2527 r = guestfs_command (g, arguments);
2530 rb_raise (e_Error, "%s", guestfs_last_error (g));
2532 VALUE rv = rb_str_new2 (r);
2537 static VALUE ruby_guestfs_command_lines (VALUE gv, VALUE argumentsv)
2540 Data_Get_Struct (gv, guestfs_h, g);
2542 rb_raise (rb_eArgError, "%s: used handle after closing it", "command_lines");
2546 len = RARRAY_LEN (argumentsv);
2547 arguments = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
2548 for (i = 0; i < len; ++i) {
2549 VALUE v = rb_ary_entry (argumentsv, i);
2550 arguments[i] = StringValueCStr (v);
2552 arguments[len] = NULL;
2557 r = guestfs_command_lines (g, arguments);
2560 rb_raise (e_Error, "%s", guestfs_last_error (g));
2563 for (i = 0; r[i] != NULL; ++i) len++;
2564 VALUE rv = rb_ary_new2 (len);
2565 for (i = 0; r[i] != NULL; ++i) {
2566 rb_ary_push (rv, rb_str_new2 (r[i]));
2573 static VALUE ruby_guestfs_stat (VALUE gv, VALUE pathv)
2576 Data_Get_Struct (gv, guestfs_h, g);
2578 rb_raise (rb_eArgError, "%s: used handle after closing it", "stat");
2580 const char *path = StringValueCStr (pathv);
2582 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2585 struct guestfs_stat *r;
2587 r = guestfs_stat (g, path);
2589 rb_raise (e_Error, "%s", guestfs_last_error (g));
2591 VALUE rv = rb_hash_new ();
2592 rb_hash_aset (rv, rb_str_new2 ("dev"), ULL2NUM (r->dev));
2593 rb_hash_aset (rv, rb_str_new2 ("ino"), ULL2NUM (r->ino));
2594 rb_hash_aset (rv, rb_str_new2 ("mode"), ULL2NUM (r->mode));
2595 rb_hash_aset (rv, rb_str_new2 ("nlink"), ULL2NUM (r->nlink));
2596 rb_hash_aset (rv, rb_str_new2 ("uid"), ULL2NUM (r->uid));
2597 rb_hash_aset (rv, rb_str_new2 ("gid"), ULL2NUM (r->gid));
2598 rb_hash_aset (rv, rb_str_new2 ("rdev"), ULL2NUM (r->rdev));
2599 rb_hash_aset (rv, rb_str_new2 ("size"), ULL2NUM (r->size));
2600 rb_hash_aset (rv, rb_str_new2 ("blksize"), ULL2NUM (r->blksize));
2601 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
2602 rb_hash_aset (rv, rb_str_new2 ("atime"), ULL2NUM (r->atime));
2603 rb_hash_aset (rv, rb_str_new2 ("mtime"), ULL2NUM (r->mtime));
2604 rb_hash_aset (rv, rb_str_new2 ("ctime"), ULL2NUM (r->ctime));
2609 static VALUE ruby_guestfs_lstat (VALUE gv, VALUE pathv)
2612 Data_Get_Struct (gv, guestfs_h, g);
2614 rb_raise (rb_eArgError, "%s: used handle after closing it", "lstat");
2616 const char *path = StringValueCStr (pathv);
2618 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2621 struct guestfs_stat *r;
2623 r = guestfs_lstat (g, path);
2625 rb_raise (e_Error, "%s", guestfs_last_error (g));
2627 VALUE rv = rb_hash_new ();
2628 rb_hash_aset (rv, rb_str_new2 ("dev"), ULL2NUM (r->dev));
2629 rb_hash_aset (rv, rb_str_new2 ("ino"), ULL2NUM (r->ino));
2630 rb_hash_aset (rv, rb_str_new2 ("mode"), ULL2NUM (r->mode));
2631 rb_hash_aset (rv, rb_str_new2 ("nlink"), ULL2NUM (r->nlink));
2632 rb_hash_aset (rv, rb_str_new2 ("uid"), ULL2NUM (r->uid));
2633 rb_hash_aset (rv, rb_str_new2 ("gid"), ULL2NUM (r->gid));
2634 rb_hash_aset (rv, rb_str_new2 ("rdev"), ULL2NUM (r->rdev));
2635 rb_hash_aset (rv, rb_str_new2 ("size"), ULL2NUM (r->size));
2636 rb_hash_aset (rv, rb_str_new2 ("blksize"), ULL2NUM (r->blksize));
2637 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
2638 rb_hash_aset (rv, rb_str_new2 ("atime"), ULL2NUM (r->atime));
2639 rb_hash_aset (rv, rb_str_new2 ("mtime"), ULL2NUM (r->mtime));
2640 rb_hash_aset (rv, rb_str_new2 ("ctime"), ULL2NUM (r->ctime));
2645 static VALUE ruby_guestfs_statvfs (VALUE gv, VALUE pathv)
2648 Data_Get_Struct (gv, guestfs_h, g);
2650 rb_raise (rb_eArgError, "%s: used handle after closing it", "statvfs");
2652 const char *path = StringValueCStr (pathv);
2654 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2657 struct guestfs_statvfs *r;
2659 r = guestfs_statvfs (g, path);
2661 rb_raise (e_Error, "%s", guestfs_last_error (g));
2663 VALUE rv = rb_hash_new ();
2664 rb_hash_aset (rv, rb_str_new2 ("bsize"), ULL2NUM (r->bsize));
2665 rb_hash_aset (rv, rb_str_new2 ("frsize"), ULL2NUM (r->frsize));
2666 rb_hash_aset (rv, rb_str_new2 ("blocks"), ULL2NUM (r->blocks));
2667 rb_hash_aset (rv, rb_str_new2 ("bfree"), ULL2NUM (r->bfree));
2668 rb_hash_aset (rv, rb_str_new2 ("bavail"), ULL2NUM (r->bavail));
2669 rb_hash_aset (rv, rb_str_new2 ("files"), ULL2NUM (r->files));
2670 rb_hash_aset (rv, rb_str_new2 ("ffree"), ULL2NUM (r->ffree));
2671 rb_hash_aset (rv, rb_str_new2 ("favail"), ULL2NUM (r->favail));
2672 rb_hash_aset (rv, rb_str_new2 ("fsid"), ULL2NUM (r->fsid));
2673 rb_hash_aset (rv, rb_str_new2 ("flag"), ULL2NUM (r->flag));
2674 rb_hash_aset (rv, rb_str_new2 ("namemax"), ULL2NUM (r->namemax));
2679 static VALUE ruby_guestfs_tune2fs_l (VALUE gv, VALUE devicev)
2682 Data_Get_Struct (gv, guestfs_h, g);
2684 rb_raise (rb_eArgError, "%s: used handle after closing it", "tune2fs_l");
2686 const char *device = StringValueCStr (devicev);
2688 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2689 "device", "tune2fs_l");
2693 r = guestfs_tune2fs_l (g, device);
2695 rb_raise (e_Error, "%s", guestfs_last_error (g));
2697 VALUE rv = rb_hash_new ();
2699 for (i = 0; r[i] != NULL; i+=2) {
2700 rb_hash_aset (rv, rb_str_new2 (r[i]), rb_str_new2 (r[i+1]));
2708 static VALUE ruby_guestfs_blockdev_setro (VALUE gv, VALUE devicev)
2711 Data_Get_Struct (gv, guestfs_h, g);
2713 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_setro");
2715 const char *device = StringValueCStr (devicev);
2717 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2718 "device", "blockdev_setro");
2722 r = guestfs_blockdev_setro (g, device);
2724 rb_raise (e_Error, "%s", guestfs_last_error (g));
2729 static VALUE ruby_guestfs_blockdev_setrw (VALUE gv, VALUE devicev)
2732 Data_Get_Struct (gv, guestfs_h, g);
2734 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_setrw");
2736 const char *device = StringValueCStr (devicev);
2738 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2739 "device", "blockdev_setrw");
2743 r = guestfs_blockdev_setrw (g, device);
2745 rb_raise (e_Error, "%s", guestfs_last_error (g));
2750 static VALUE ruby_guestfs_blockdev_getro (VALUE gv, VALUE devicev)
2753 Data_Get_Struct (gv, guestfs_h, g);
2755 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getro");
2757 const char *device = StringValueCStr (devicev);
2759 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2760 "device", "blockdev_getro");
2764 r = guestfs_blockdev_getro (g, device);
2766 rb_raise (e_Error, "%s", guestfs_last_error (g));
2771 static VALUE ruby_guestfs_blockdev_getss (VALUE gv, VALUE devicev)
2774 Data_Get_Struct (gv, guestfs_h, g);
2776 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getss");
2778 const char *device = StringValueCStr (devicev);
2780 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2781 "device", "blockdev_getss");
2785 r = guestfs_blockdev_getss (g, device);
2787 rb_raise (e_Error, "%s", guestfs_last_error (g));
2792 static VALUE ruby_guestfs_blockdev_getbsz (VALUE gv, VALUE devicev)
2795 Data_Get_Struct (gv, guestfs_h, g);
2797 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getbsz");
2799 const char *device = StringValueCStr (devicev);
2801 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2802 "device", "blockdev_getbsz");
2806 r = guestfs_blockdev_getbsz (g, device);
2808 rb_raise (e_Error, "%s", guestfs_last_error (g));
2813 static VALUE ruby_guestfs_blockdev_setbsz (VALUE gv, VALUE devicev, VALUE blocksizev)
2816 Data_Get_Struct (gv, guestfs_h, g);
2818 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_setbsz");
2820 const char *device = StringValueCStr (devicev);
2822 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2823 "device", "blockdev_setbsz");
2824 int blocksize = NUM2INT (blocksizev);
2828 r = guestfs_blockdev_setbsz (g, device, blocksize);
2830 rb_raise (e_Error, "%s", guestfs_last_error (g));
2835 static VALUE ruby_guestfs_blockdev_getsz (VALUE gv, VALUE devicev)
2838 Data_Get_Struct (gv, guestfs_h, g);
2840 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getsz");
2842 const char *device = StringValueCStr (devicev);
2844 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2845 "device", "blockdev_getsz");
2849 r = guestfs_blockdev_getsz (g, device);
2851 rb_raise (e_Error, "%s", guestfs_last_error (g));
2856 static VALUE ruby_guestfs_blockdev_getsize64 (VALUE gv, VALUE devicev)
2859 Data_Get_Struct (gv, guestfs_h, g);
2861 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_getsize64");
2863 const char *device = StringValueCStr (devicev);
2865 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2866 "device", "blockdev_getsize64");
2870 r = guestfs_blockdev_getsize64 (g, device);
2872 rb_raise (e_Error, "%s", guestfs_last_error (g));
2877 static VALUE ruby_guestfs_blockdev_flushbufs (VALUE gv, VALUE devicev)
2880 Data_Get_Struct (gv, guestfs_h, g);
2882 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_flushbufs");
2884 const char *device = StringValueCStr (devicev);
2886 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2887 "device", "blockdev_flushbufs");
2891 r = guestfs_blockdev_flushbufs (g, device);
2893 rb_raise (e_Error, "%s", guestfs_last_error (g));
2898 static VALUE ruby_guestfs_blockdev_rereadpt (VALUE gv, VALUE devicev)
2901 Data_Get_Struct (gv, guestfs_h, g);
2903 rb_raise (rb_eArgError, "%s: used handle after closing it", "blockdev_rereadpt");
2905 const char *device = StringValueCStr (devicev);
2907 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2908 "device", "blockdev_rereadpt");
2912 r = guestfs_blockdev_rereadpt (g, device);
2914 rb_raise (e_Error, "%s", guestfs_last_error (g));
2919 static VALUE ruby_guestfs_upload (VALUE gv, VALUE filenamev, VALUE remotefilenamev)
2922 Data_Get_Struct (gv, guestfs_h, g);
2924 rb_raise (rb_eArgError, "%s: used handle after closing it", "upload");
2926 const char *filename = StringValueCStr (filenamev);
2928 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2929 "filename", "upload");
2930 const char *remotefilename = StringValueCStr (remotefilenamev);
2931 if (!remotefilename)
2932 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2933 "remotefilename", "upload");
2937 r = guestfs_upload (g, filename, remotefilename);
2939 rb_raise (e_Error, "%s", guestfs_last_error (g));
2944 static VALUE ruby_guestfs_download (VALUE gv, VALUE remotefilenamev, VALUE filenamev)
2947 Data_Get_Struct (gv, guestfs_h, g);
2949 rb_raise (rb_eArgError, "%s: used handle after closing it", "download");
2951 const char *remotefilename = StringValueCStr (remotefilenamev);
2952 if (!remotefilename)
2953 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2954 "remotefilename", "download");
2955 const char *filename = StringValueCStr (filenamev);
2957 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2958 "filename", "download");
2962 r = guestfs_download (g, remotefilename, filename);
2964 rb_raise (e_Error, "%s", guestfs_last_error (g));
2969 static VALUE ruby_guestfs_checksum (VALUE gv, VALUE csumtypev, VALUE pathv)
2972 Data_Get_Struct (gv, guestfs_h, g);
2974 rb_raise (rb_eArgError, "%s: used handle after closing it", "checksum");
2976 const char *csumtype = StringValueCStr (csumtypev);
2978 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2979 "csumtype", "checksum");
2980 const char *path = StringValueCStr (pathv);
2982 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
2983 "path", "checksum");
2987 r = guestfs_checksum (g, csumtype, path);
2989 rb_raise (e_Error, "%s", guestfs_last_error (g));
2991 VALUE rv = rb_str_new2 (r);
2996 static VALUE ruby_guestfs_tar_in (VALUE gv, VALUE tarfilev, VALUE directoryv)
2999 Data_Get_Struct (gv, guestfs_h, g);
3001 rb_raise (rb_eArgError, "%s: used handle after closing it", "tar_in");
3003 const char *tarfile = StringValueCStr (tarfilev);
3005 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3006 "tarfile", "tar_in");
3007 const char *directory = StringValueCStr (directoryv);
3009 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3010 "directory", "tar_in");
3014 r = guestfs_tar_in (g, tarfile, directory);
3016 rb_raise (e_Error, "%s", guestfs_last_error (g));
3021 static VALUE ruby_guestfs_tar_out (VALUE gv, VALUE directoryv, VALUE tarfilev)
3024 Data_Get_Struct (gv, guestfs_h, g);
3026 rb_raise (rb_eArgError, "%s: used handle after closing it", "tar_out");
3028 const char *directory = StringValueCStr (directoryv);
3030 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3031 "directory", "tar_out");
3032 const char *tarfile = StringValueCStr (tarfilev);
3034 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3035 "tarfile", "tar_out");
3039 r = guestfs_tar_out (g, directory, tarfile);
3041 rb_raise (e_Error, "%s", guestfs_last_error (g));
3046 static VALUE ruby_guestfs_tgz_in (VALUE gv, VALUE tarballv, VALUE directoryv)
3049 Data_Get_Struct (gv, guestfs_h, g);
3051 rb_raise (rb_eArgError, "%s: used handle after closing it", "tgz_in");
3053 const char *tarball = StringValueCStr (tarballv);
3055 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3056 "tarball", "tgz_in");
3057 const char *directory = StringValueCStr (directoryv);
3059 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3060 "directory", "tgz_in");
3064 r = guestfs_tgz_in (g, tarball, directory);
3066 rb_raise (e_Error, "%s", guestfs_last_error (g));
3071 static VALUE ruby_guestfs_tgz_out (VALUE gv, VALUE directoryv, VALUE tarballv)
3074 Data_Get_Struct (gv, guestfs_h, g);
3076 rb_raise (rb_eArgError, "%s: used handle after closing it", "tgz_out");
3078 const char *directory = StringValueCStr (directoryv);
3080 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3081 "directory", "tgz_out");
3082 const char *tarball = StringValueCStr (tarballv);
3084 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3085 "tarball", "tgz_out");
3089 r = guestfs_tgz_out (g, directory, tarball);
3091 rb_raise (e_Error, "%s", guestfs_last_error (g));
3096 static VALUE ruby_guestfs_mount_ro (VALUE gv, VALUE devicev, VALUE mountpointv)
3099 Data_Get_Struct (gv, guestfs_h, g);
3101 rb_raise (rb_eArgError, "%s: used handle after closing it", "mount_ro");
3103 const char *device = StringValueCStr (devicev);
3105 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3106 "device", "mount_ro");
3107 const char *mountpoint = StringValueCStr (mountpointv);
3109 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3110 "mountpoint", "mount_ro");
3114 r = guestfs_mount_ro (g, device, mountpoint);
3116 rb_raise (e_Error, "%s", guestfs_last_error (g));
3121 static VALUE ruby_guestfs_mount_options (VALUE gv, VALUE optionsv, VALUE devicev, VALUE mountpointv)
3124 Data_Get_Struct (gv, guestfs_h, g);
3126 rb_raise (rb_eArgError, "%s: used handle after closing it", "mount_options");
3128 const char *options = StringValueCStr (optionsv);
3130 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3131 "options", "mount_options");
3132 const char *device = StringValueCStr (devicev);
3134 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3135 "device", "mount_options");
3136 const char *mountpoint = StringValueCStr (mountpointv);
3138 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3139 "mountpoint", "mount_options");
3143 r = guestfs_mount_options (g, options, device, mountpoint);
3145 rb_raise (e_Error, "%s", guestfs_last_error (g));
3150 static VALUE ruby_guestfs_mount_vfs (VALUE gv, VALUE optionsv, VALUE vfstypev, VALUE devicev, VALUE mountpointv)
3153 Data_Get_Struct (gv, guestfs_h, g);
3155 rb_raise (rb_eArgError, "%s: used handle after closing it", "mount_vfs");
3157 const char *options = StringValueCStr (optionsv);
3159 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3160 "options", "mount_vfs");
3161 const char *vfstype = StringValueCStr (vfstypev);
3163 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3164 "vfstype", "mount_vfs");
3165 const char *device = StringValueCStr (devicev);
3167 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3168 "device", "mount_vfs");
3169 const char *mountpoint = StringValueCStr (mountpointv);
3171 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3172 "mountpoint", "mount_vfs");
3176 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
3178 rb_raise (e_Error, "%s", guestfs_last_error (g));
3183 static VALUE ruby_guestfs_debug (VALUE gv, VALUE subcmdv, VALUE extraargsv)
3186 Data_Get_Struct (gv, guestfs_h, g);
3188 rb_raise (rb_eArgError, "%s: used handle after closing it", "debug");
3190 const char *subcmd = StringValueCStr (subcmdv);
3192 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3196 len = RARRAY_LEN (extraargsv);
3197 extraargs = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
3198 for (i = 0; i < len; ++i) {
3199 VALUE v = rb_ary_entry (extraargsv, i);
3200 extraargs[i] = StringValueCStr (v);
3202 extraargs[len] = NULL;
3207 r = guestfs_debug (g, subcmd, extraargs);
3210 rb_raise (e_Error, "%s", guestfs_last_error (g));
3212 VALUE rv = rb_str_new2 (r);
3217 static VALUE ruby_guestfs_lvremove (VALUE gv, VALUE devicev)
3220 Data_Get_Struct (gv, guestfs_h, g);
3222 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvremove");
3224 const char *device = StringValueCStr (devicev);
3226 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3227 "device", "lvremove");
3231 r = guestfs_lvremove (g, device);
3233 rb_raise (e_Error, "%s", guestfs_last_error (g));
3238 static VALUE ruby_guestfs_vgremove (VALUE gv, VALUE vgnamev)
3241 Data_Get_Struct (gv, guestfs_h, g);
3243 rb_raise (rb_eArgError, "%s: used handle after closing it", "vgremove");
3245 const char *vgname = StringValueCStr (vgnamev);
3247 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3248 "vgname", "vgremove");
3252 r = guestfs_vgremove (g, vgname);
3254 rb_raise (e_Error, "%s", guestfs_last_error (g));
3259 static VALUE ruby_guestfs_pvremove (VALUE gv, VALUE devicev)
3262 Data_Get_Struct (gv, guestfs_h, g);
3264 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvremove");
3266 const char *device = StringValueCStr (devicev);
3268 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3269 "device", "pvremove");
3273 r = guestfs_pvremove (g, device);
3275 rb_raise (e_Error, "%s", guestfs_last_error (g));
3280 static VALUE ruby_guestfs_set_e2label (VALUE gv, VALUE devicev, VALUE labelv)
3283 Data_Get_Struct (gv, guestfs_h, g);
3285 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_e2label");
3287 const char *device = StringValueCStr (devicev);
3289 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3290 "device", "set_e2label");
3291 const char *label = StringValueCStr (labelv);
3293 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3294 "label", "set_e2label");
3298 r = guestfs_set_e2label (g, device, label);
3300 rb_raise (e_Error, "%s", guestfs_last_error (g));
3305 static VALUE ruby_guestfs_get_e2label (VALUE gv, VALUE devicev)
3308 Data_Get_Struct (gv, guestfs_h, g);
3310 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_e2label");
3312 const char *device = StringValueCStr (devicev);
3314 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3315 "device", "get_e2label");
3319 r = guestfs_get_e2label (g, device);
3321 rb_raise (e_Error, "%s", guestfs_last_error (g));
3323 VALUE rv = rb_str_new2 (r);
3328 static VALUE ruby_guestfs_set_e2uuid (VALUE gv, VALUE devicev, VALUE uuidv)
3331 Data_Get_Struct (gv, guestfs_h, g);
3333 rb_raise (rb_eArgError, "%s: used handle after closing it", "set_e2uuid");
3335 const char *device = StringValueCStr (devicev);
3337 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3338 "device", "set_e2uuid");
3339 const char *uuid = StringValueCStr (uuidv);
3341 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3342 "uuid", "set_e2uuid");
3346 r = guestfs_set_e2uuid (g, device, uuid);
3348 rb_raise (e_Error, "%s", guestfs_last_error (g));
3353 static VALUE ruby_guestfs_get_e2uuid (VALUE gv, VALUE devicev)
3356 Data_Get_Struct (gv, guestfs_h, g);
3358 rb_raise (rb_eArgError, "%s: used handle after closing it", "get_e2uuid");
3360 const char *device = StringValueCStr (devicev);
3362 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3363 "device", "get_e2uuid");
3367 r = guestfs_get_e2uuid (g, device);
3369 rb_raise (e_Error, "%s", guestfs_last_error (g));
3371 VALUE rv = rb_str_new2 (r);
3376 static VALUE ruby_guestfs_fsck (VALUE gv, VALUE fstypev, VALUE devicev)
3379 Data_Get_Struct (gv, guestfs_h, g);
3381 rb_raise (rb_eArgError, "%s: used handle after closing it", "fsck");
3383 const char *fstype = StringValueCStr (fstypev);
3385 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3387 const char *device = StringValueCStr (devicev);
3389 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3394 r = guestfs_fsck (g, fstype, device);
3396 rb_raise (e_Error, "%s", guestfs_last_error (g));
3401 static VALUE ruby_guestfs_zero (VALUE gv, VALUE devicev)
3404 Data_Get_Struct (gv, guestfs_h, g);
3406 rb_raise (rb_eArgError, "%s: used handle after closing it", "zero");
3408 const char *device = StringValueCStr (devicev);
3410 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3415 r = guestfs_zero (g, device);
3417 rb_raise (e_Error, "%s", guestfs_last_error (g));
3422 static VALUE ruby_guestfs_grub_install (VALUE gv, VALUE rootv, VALUE devicev)
3425 Data_Get_Struct (gv, guestfs_h, g);
3427 rb_raise (rb_eArgError, "%s: used handle after closing it", "grub_install");
3429 const char *root = StringValueCStr (rootv);
3431 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3432 "root", "grub_install");
3433 const char *device = StringValueCStr (devicev);
3435 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3436 "device", "grub_install");
3440 r = guestfs_grub_install (g, root, device);
3442 rb_raise (e_Error, "%s", guestfs_last_error (g));
3447 static VALUE ruby_guestfs_cp (VALUE gv, VALUE srcv, VALUE destv)
3450 Data_Get_Struct (gv, guestfs_h, g);
3452 rb_raise (rb_eArgError, "%s: used handle after closing it", "cp");
3454 const char *src = StringValueCStr (srcv);
3456 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3458 const char *dest = StringValueCStr (destv);
3460 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3465 r = guestfs_cp (g, src, dest);
3467 rb_raise (e_Error, "%s", guestfs_last_error (g));
3472 static VALUE ruby_guestfs_cp_a (VALUE gv, VALUE srcv, VALUE destv)
3475 Data_Get_Struct (gv, guestfs_h, g);
3477 rb_raise (rb_eArgError, "%s: used handle after closing it", "cp_a");
3479 const char *src = StringValueCStr (srcv);
3481 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3483 const char *dest = StringValueCStr (destv);
3485 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3490 r = guestfs_cp_a (g, src, dest);
3492 rb_raise (e_Error, "%s", guestfs_last_error (g));
3497 static VALUE ruby_guestfs_mv (VALUE gv, VALUE srcv, VALUE destv)
3500 Data_Get_Struct (gv, guestfs_h, g);
3502 rb_raise (rb_eArgError, "%s: used handle after closing it", "mv");
3504 const char *src = StringValueCStr (srcv);
3506 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3508 const char *dest = StringValueCStr (destv);
3510 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3515 r = guestfs_mv (g, src, dest);
3517 rb_raise (e_Error, "%s", guestfs_last_error (g));
3522 static VALUE ruby_guestfs_drop_caches (VALUE gv, VALUE whattodropv)
3525 Data_Get_Struct (gv, guestfs_h, g);
3527 rb_raise (rb_eArgError, "%s: used handle after closing it", "drop_caches");
3529 int whattodrop = NUM2INT (whattodropv);
3533 r = guestfs_drop_caches (g, whattodrop);
3535 rb_raise (e_Error, "%s", guestfs_last_error (g));
3540 static VALUE ruby_guestfs_dmesg (VALUE gv)
3543 Data_Get_Struct (gv, guestfs_h, g);
3545 rb_raise (rb_eArgError, "%s: used handle after closing it", "dmesg");
3550 r = guestfs_dmesg (g);
3552 rb_raise (e_Error, "%s", guestfs_last_error (g));
3554 VALUE rv = rb_str_new2 (r);
3559 static VALUE ruby_guestfs_ping_daemon (VALUE gv)
3562 Data_Get_Struct (gv, guestfs_h, g);
3564 rb_raise (rb_eArgError, "%s: used handle after closing it", "ping_daemon");
3569 r = guestfs_ping_daemon (g);
3571 rb_raise (e_Error, "%s", guestfs_last_error (g));
3576 static VALUE ruby_guestfs_equal (VALUE gv, VALUE file1v, VALUE file2v)
3579 Data_Get_Struct (gv, guestfs_h, g);
3581 rb_raise (rb_eArgError, "%s: used handle after closing it", "equal");
3583 const char *file1 = StringValueCStr (file1v);
3585 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3587 const char *file2 = StringValueCStr (file2v);
3589 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3594 r = guestfs_equal (g, file1, file2);
3596 rb_raise (e_Error, "%s", guestfs_last_error (g));
3601 static VALUE ruby_guestfs_strings (VALUE gv, VALUE pathv)
3604 Data_Get_Struct (gv, guestfs_h, g);
3606 rb_raise (rb_eArgError, "%s: used handle after closing it", "strings");
3608 const char *path = StringValueCStr (pathv);
3610 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3615 r = guestfs_strings (g, path);
3617 rb_raise (e_Error, "%s", guestfs_last_error (g));
3620 for (i = 0; r[i] != NULL; ++i) len++;
3621 VALUE rv = rb_ary_new2 (len);
3622 for (i = 0; r[i] != NULL; ++i) {
3623 rb_ary_push (rv, rb_str_new2 (r[i]));
3630 static VALUE ruby_guestfs_strings_e (VALUE gv, VALUE encodingv, VALUE pathv)
3633 Data_Get_Struct (gv, guestfs_h, g);
3635 rb_raise (rb_eArgError, "%s: used handle after closing it", "strings_e");
3637 const char *encoding = StringValueCStr (encodingv);
3639 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3640 "encoding", "strings_e");
3641 const char *path = StringValueCStr (pathv);
3643 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3644 "path", "strings_e");
3648 r = guestfs_strings_e (g, encoding, path);
3650 rb_raise (e_Error, "%s", guestfs_last_error (g));
3653 for (i = 0; r[i] != NULL; ++i) len++;
3654 VALUE rv = rb_ary_new2 (len);
3655 for (i = 0; r[i] != NULL; ++i) {
3656 rb_ary_push (rv, rb_str_new2 (r[i]));
3663 static VALUE ruby_guestfs_hexdump (VALUE gv, VALUE pathv)
3666 Data_Get_Struct (gv, guestfs_h, g);
3668 rb_raise (rb_eArgError, "%s: used handle after closing it", "hexdump");
3670 const char *path = StringValueCStr (pathv);
3672 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3677 r = guestfs_hexdump (g, path);
3679 rb_raise (e_Error, "%s", guestfs_last_error (g));
3681 VALUE rv = rb_str_new2 (r);
3686 static VALUE ruby_guestfs_zerofree (VALUE gv, VALUE devicev)
3689 Data_Get_Struct (gv, guestfs_h, g);
3691 rb_raise (rb_eArgError, "%s: used handle after closing it", "zerofree");
3693 const char *device = StringValueCStr (devicev);
3695 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3696 "device", "zerofree");
3700 r = guestfs_zerofree (g, device);
3702 rb_raise (e_Error, "%s", guestfs_last_error (g));
3707 static VALUE ruby_guestfs_pvresize (VALUE gv, VALUE devicev)
3710 Data_Get_Struct (gv, guestfs_h, g);
3712 rb_raise (rb_eArgError, "%s: used handle after closing it", "pvresize");
3714 const char *device = StringValueCStr (devicev);
3716 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3717 "device", "pvresize");
3721 r = guestfs_pvresize (g, device);
3723 rb_raise (e_Error, "%s", guestfs_last_error (g));
3728 static VALUE ruby_guestfs_sfdisk_N (VALUE gv, VALUE devicev, VALUE nv, VALUE cylsv, VALUE headsv, VALUE sectorsv, VALUE linev)
3731 Data_Get_Struct (gv, guestfs_h, g);
3733 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk_N");
3735 const char *device = StringValueCStr (devicev);
3737 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3738 "device", "sfdisk_N");
3739 int n = NUM2INT (nv);
3740 int cyls = NUM2INT (cylsv);
3741 int heads = NUM2INT (headsv);
3742 int sectors = NUM2INT (sectorsv);
3743 const char *line = StringValueCStr (linev);
3745 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3746 "line", "sfdisk_N");
3750 r = guestfs_sfdisk_N (g, device, n, cyls, heads, sectors, line);
3752 rb_raise (e_Error, "%s", guestfs_last_error (g));
3757 static VALUE ruby_guestfs_sfdisk_l (VALUE gv, VALUE devicev)
3760 Data_Get_Struct (gv, guestfs_h, g);
3762 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk_l");
3764 const char *device = StringValueCStr (devicev);
3766 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3767 "device", "sfdisk_l");
3771 r = guestfs_sfdisk_l (g, device);
3773 rb_raise (e_Error, "%s", guestfs_last_error (g));
3775 VALUE rv = rb_str_new2 (r);
3780 static VALUE ruby_guestfs_sfdisk_kernel_geometry (VALUE gv, VALUE devicev)
3783 Data_Get_Struct (gv, guestfs_h, g);
3785 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk_kernel_geometry");
3787 const char *device = StringValueCStr (devicev);
3789 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3790 "device", "sfdisk_kernel_geometry");
3794 r = guestfs_sfdisk_kernel_geometry (g, device);
3796 rb_raise (e_Error, "%s", guestfs_last_error (g));
3798 VALUE rv = rb_str_new2 (r);
3803 static VALUE ruby_guestfs_sfdisk_disk_geometry (VALUE gv, VALUE devicev)
3806 Data_Get_Struct (gv, guestfs_h, g);
3808 rb_raise (rb_eArgError, "%s: used handle after closing it", "sfdisk_disk_geometry");
3810 const char *device = StringValueCStr (devicev);
3812 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3813 "device", "sfdisk_disk_geometry");
3817 r = guestfs_sfdisk_disk_geometry (g, device);
3819 rb_raise (e_Error, "%s", guestfs_last_error (g));
3821 VALUE rv = rb_str_new2 (r);
3826 static VALUE ruby_guestfs_vg_activate_all (VALUE gv, VALUE activatev)
3829 Data_Get_Struct (gv, guestfs_h, g);
3831 rb_raise (rb_eArgError, "%s: used handle after closing it", "vg_activate_all");
3833 int activate = RTEST (activatev);
3837 r = guestfs_vg_activate_all (g, activate);
3839 rb_raise (e_Error, "%s", guestfs_last_error (g));
3844 static VALUE ruby_guestfs_vg_activate (VALUE gv, VALUE activatev, VALUE volgroupsv)
3847 Data_Get_Struct (gv, guestfs_h, g);
3849 rb_raise (rb_eArgError, "%s: used handle after closing it", "vg_activate");
3851 int activate = RTEST (activatev);
3854 len = RARRAY_LEN (volgroupsv);
3855 volgroups = guestfs_safe_malloc (g, sizeof (char *) * (len+1));
3856 for (i = 0; i < len; ++i) {
3857 VALUE v = rb_ary_entry (volgroupsv, i);
3858 volgroups[i] = StringValueCStr (v);
3860 volgroups[len] = NULL;
3865 r = guestfs_vg_activate (g, activate, volgroups);
3868 rb_raise (e_Error, "%s", guestfs_last_error (g));
3873 static VALUE ruby_guestfs_lvresize (VALUE gv, VALUE devicev, VALUE mbytesv)
3876 Data_Get_Struct (gv, guestfs_h, g);
3878 rb_raise (rb_eArgError, "%s: used handle after closing it", "lvresize");
3880 const char *device = StringValueCStr (devicev);
3882 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3883 "device", "lvresize");
3884 int mbytes = NUM2INT (mbytesv);
3888 r = guestfs_lvresize (g, device, mbytes);
3890 rb_raise (e_Error, "%s", guestfs_last_error (g));
3895 static VALUE ruby_guestfs_resize2fs (VALUE gv, VALUE devicev)
3898 Data_Get_Struct (gv, guestfs_h, g);
3900 rb_raise (rb_eArgError, "%s: used handle after closing it", "resize2fs");
3902 const char *device = StringValueCStr (devicev);
3904 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3905 "device", "resize2fs");
3909 r = guestfs_resize2fs (g, device);
3911 rb_raise (e_Error, "%s", guestfs_last_error (g));
3916 static VALUE ruby_guestfs_find (VALUE gv, VALUE directoryv)
3919 Data_Get_Struct (gv, guestfs_h, g);
3921 rb_raise (rb_eArgError, "%s: used handle after closing it", "find");
3923 const char *directory = StringValueCStr (directoryv);
3925 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3926 "directory", "find");
3930 r = guestfs_find (g, directory);
3932 rb_raise (e_Error, "%s", guestfs_last_error (g));
3935 for (i = 0; r[i] != NULL; ++i) len++;
3936 VALUE rv = rb_ary_new2 (len);
3937 for (i = 0; r[i] != NULL; ++i) {
3938 rb_ary_push (rv, rb_str_new2 (r[i]));
3945 static VALUE ruby_guestfs_e2fsck_f (VALUE gv, VALUE devicev)
3948 Data_Get_Struct (gv, guestfs_h, g);
3950 rb_raise (rb_eArgError, "%s: used handle after closing it", "e2fsck_f");
3952 const char *device = StringValueCStr (devicev);
3954 rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
3955 "device", "e2fsck_f");
3959 r = guestfs_e2fsck_f (g, device);
3961 rb_raise (e_Error, "%s", guestfs_last_error (g));
3966 /* Initialize the module. */
3967 void Init__guestfs ()
3969 m_guestfs = rb_define_module ("Guestfs");
3970 c_guestfs = rb_define_class_under (m_guestfs, "Guestfs", rb_cObject);
3971 e_Error = rb_define_class_under (m_guestfs, "Error", rb_eStandardError);
3973 rb_define_module_function (m_guestfs, "create", ruby_guestfs_create, 0);
3974 rb_define_method (c_guestfs, "close", ruby_guestfs_close, 0);
3976 rb_define_method (c_guestfs, "test0",
3977 ruby_guestfs_test0, 7);
3978 rb_define_method (c_guestfs, "test0rint",
3979 ruby_guestfs_test0rint, 1);
3980 rb_define_method (c_guestfs, "test0rinterr",
3981 ruby_guestfs_test0rinterr, 0);
3982 rb_define_method (c_guestfs, "test0rint64",
3983 ruby_guestfs_test0rint64, 1);
3984 rb_define_method (c_guestfs, "test0rint64err",
3985 ruby_guestfs_test0rint64err, 0);
3986 rb_define_method (c_guestfs, "test0rbool",
3987 ruby_guestfs_test0rbool, 1);
3988 rb_define_method (c_guestfs, "test0rboolerr",
3989 ruby_guestfs_test0rboolerr, 0);
3990 rb_define_method (c_guestfs, "test0rconststring",
3991 ruby_guestfs_test0rconststring, 1);
3992 rb_define_method (c_guestfs, "test0rconststringerr",
3993 ruby_guestfs_test0rconststringerr, 0);
3994 rb_define_method (c_guestfs, "test0rstring",
3995 ruby_guestfs_test0rstring, 1);
3996 rb_define_method (c_guestfs, "test0rstringerr",
3997 ruby_guestfs_test0rstringerr, 0);
3998 rb_define_method (c_guestfs, "test0rstringlist",
3999 ruby_guestfs_test0rstringlist, 1);
4000 rb_define_method (c_guestfs, "test0rstringlisterr",
4001 ruby_guestfs_test0rstringlisterr, 0);
4002 rb_define_method (c_guestfs, "test0rintbool",
4003 ruby_guestfs_test0rintbool, 1);
4004 rb_define_method (c_guestfs, "test0rintboolerr",
4005 ruby_guestfs_test0rintboolerr, 0);
4006 rb_define_method (c_guestfs, "test0rpvlist",
4007 ruby_guestfs_test0rpvlist, 1);
4008 rb_define_method (c_guestfs, "test0rpvlisterr",
4009 ruby_guestfs_test0rpvlisterr, 0);
4010 rb_define_method (c_guestfs, "test0rvglist",
4011 ruby_guestfs_test0rvglist, 1);
4012 rb_define_method (c_guestfs, "test0rvglisterr",
4013 ruby_guestfs_test0rvglisterr, 0);
4014 rb_define_method (c_guestfs, "test0rlvlist",
4015 ruby_guestfs_test0rlvlist, 1);
4016 rb_define_method (c_guestfs, "test0rlvlisterr",
4017 ruby_guestfs_test0rlvlisterr, 0);
4018 rb_define_method (c_guestfs, "test0rstat",
4019 ruby_guestfs_test0rstat, 1);
4020 rb_define_method (c_guestfs, "test0rstaterr",
4021 ruby_guestfs_test0rstaterr, 0);
4022 rb_define_method (c_guestfs, "test0rstatvfs",
4023 ruby_guestfs_test0rstatvfs, 1);
4024 rb_define_method (c_guestfs, "test0rstatvfserr",
4025 ruby_guestfs_test0rstatvfserr, 0);
4026 rb_define_method (c_guestfs, "test0rhashtable",
4027 ruby_guestfs_test0rhashtable, 1);
4028 rb_define_method (c_guestfs, "test0rhashtableerr",
4029 ruby_guestfs_test0rhashtableerr, 0);
4030 rb_define_method (c_guestfs, "launch",
4031 ruby_guestfs_launch, 0);
4032 rb_define_method (c_guestfs, "wait_ready",
4033 ruby_guestfs_wait_ready, 0);
4034 rb_define_method (c_guestfs, "kill_subprocess",
4035 ruby_guestfs_kill_subprocess, 0);
4036 rb_define_method (c_guestfs, "add_drive",
4037 ruby_guestfs_add_drive, 1);
4038 rb_define_method (c_guestfs, "add_cdrom",
4039 ruby_guestfs_add_cdrom, 1);
4040 rb_define_method (c_guestfs, "add_drive_ro",
4041 ruby_guestfs_add_drive_ro, 1);
4042 rb_define_method (c_guestfs, "config",
4043 ruby_guestfs_config, 2);
4044 rb_define_method (c_guestfs, "set_qemu",
4045 ruby_guestfs_set_qemu, 1);
4046 rb_define_method (c_guestfs, "get_qemu",
4047 ruby_guestfs_get_qemu, 0);
4048 rb_define_method (c_guestfs, "set_path",
4049 ruby_guestfs_set_path, 1);
4050 rb_define_method (c_guestfs, "get_path",
4051 ruby_guestfs_get_path, 0);
4052 rb_define_method (c_guestfs, "set_append",
4053 ruby_guestfs_set_append, 1);
4054 rb_define_method (c_guestfs, "get_append",
4055 ruby_guestfs_get_append, 0);
4056 rb_define_method (c_guestfs, "set_autosync",
4057 ruby_guestfs_set_autosync, 1);
4058 rb_define_method (c_guestfs, "get_autosync",
4059 ruby_guestfs_get_autosync, 0);
4060 rb_define_method (c_guestfs, "set_verbose",
4061 ruby_guestfs_set_verbose, 1);
4062 rb_define_method (c_guestfs, "get_verbose",
4063 ruby_guestfs_get_verbose, 0);
4064 rb_define_method (c_guestfs, "is_ready",
4065 ruby_guestfs_is_ready, 0);
4066 rb_define_method (c_guestfs, "is_config",
4067 ruby_guestfs_is_config, 0);
4068 rb_define_method (c_guestfs, "is_launching",
4069 ruby_guestfs_is_launching, 0);
4070 rb_define_method (c_guestfs, "is_busy",
4071 ruby_guestfs_is_busy, 0);
4072 rb_define_method (c_guestfs, "get_state",
4073 ruby_guestfs_get_state, 0);
4074 rb_define_method (c_guestfs, "set_busy",
4075 ruby_guestfs_set_busy, 0);
4076 rb_define_method (c_guestfs, "set_ready",
4077 ruby_guestfs_set_ready, 0);
4078 rb_define_method (c_guestfs, "end_busy",
4079 ruby_guestfs_end_busy, 0);
4080 rb_define_method (c_guestfs, "mount",
4081 ruby_guestfs_mount, 2);
4082 rb_define_method (c_guestfs, "sync",
4083 ruby_guestfs_sync, 0);
4084 rb_define_method (c_guestfs, "touch",
4085 ruby_guestfs_touch, 1);
4086 rb_define_method (c_guestfs, "cat",
4087 ruby_guestfs_cat, 1);
4088 rb_define_method (c_guestfs, "ll",
4089 ruby_guestfs_ll, 1);
4090 rb_define_method (c_guestfs, "ls",
4091 ruby_guestfs_ls, 1);
4092 rb_define_method (c_guestfs, "list_devices",
4093 ruby_guestfs_list_devices, 0);
4094 rb_define_method (c_guestfs, "list_partitions",
4095 ruby_guestfs_list_partitions, 0);
4096 rb_define_method (c_guestfs, "pvs",
4097 ruby_guestfs_pvs, 0);
4098 rb_define_method (c_guestfs, "vgs",
4099 ruby_guestfs_vgs, 0);
4100 rb_define_method (c_guestfs, "lvs",
4101 ruby_guestfs_lvs, 0);
4102 rb_define_method (c_guestfs, "pvs_full",
4103 ruby_guestfs_pvs_full, 0);
4104 rb_define_method (c_guestfs, "vgs_full",
4105 ruby_guestfs_vgs_full, 0);
4106 rb_define_method (c_guestfs, "lvs_full",
4107 ruby_guestfs_lvs_full, 0);
4108 rb_define_method (c_guestfs, "read_lines",
4109 ruby_guestfs_read_lines, 1);
4110 rb_define_method (c_guestfs, "aug_init",
4111 ruby_guestfs_aug_init, 2);
4112 rb_define_method (c_guestfs, "aug_close",
4113 ruby_guestfs_aug_close, 0);
4114 rb_define_method (c_guestfs, "aug_defvar",
4115 ruby_guestfs_aug_defvar, 2);
4116 rb_define_method (c_guestfs, "aug_defnode",
4117 ruby_guestfs_aug_defnode, 3);
4118 rb_define_method (c_guestfs, "aug_get",
4119 ruby_guestfs_aug_get, 1);
4120 rb_define_method (c_guestfs, "aug_set",
4121 ruby_guestfs_aug_set, 2);
4122 rb_define_method (c_guestfs, "aug_insert",
4123 ruby_guestfs_aug_insert, 3);
4124 rb_define_method (c_guestfs, "aug_rm",
4125 ruby_guestfs_aug_rm, 1);
4126 rb_define_method (c_guestfs, "aug_mv",
4127 ruby_guestfs_aug_mv, 2);
4128 rb_define_method (c_guestfs, "aug_match",
4129 ruby_guestfs_aug_match, 1);
4130 rb_define_method (c_guestfs, "aug_save",
4131 ruby_guestfs_aug_save, 0);
4132 rb_define_method (c_guestfs, "aug_load",
4133 ruby_guestfs_aug_load, 0);
4134 rb_define_method (c_guestfs, "aug_ls",
4135 ruby_guestfs_aug_ls, 1);
4136 rb_define_method (c_guestfs, "rm",
4137 ruby_guestfs_rm, 1);
4138 rb_define_method (c_guestfs, "rmdir",
4139 ruby_guestfs_rmdir, 1);
4140 rb_define_method (c_guestfs, "rm_rf",
4141 ruby_guestfs_rm_rf, 1);
4142 rb_define_method (c_guestfs, "mkdir",
4143 ruby_guestfs_mkdir, 1);
4144 rb_define_method (c_guestfs, "mkdir_p",
4145 ruby_guestfs_mkdir_p, 1);
4146 rb_define_method (c_guestfs, "chmod",
4147 ruby_guestfs_chmod, 2);
4148 rb_define_method (c_guestfs, "chown",
4149 ruby_guestfs_chown, 3);
4150 rb_define_method (c_guestfs, "exists",
4151 ruby_guestfs_exists, 1);
4152 rb_define_method (c_guestfs, "is_file",
4153 ruby_guestfs_is_file, 1);
4154 rb_define_method (c_guestfs, "is_dir",
4155 ruby_guestfs_is_dir, 1);
4156 rb_define_method (c_guestfs, "pvcreate",
4157 ruby_guestfs_pvcreate, 1);
4158 rb_define_method (c_guestfs, "vgcreate",
4159 ruby_guestfs_vgcreate, 2);
4160 rb_define_method (c_guestfs, "lvcreate",
4161 ruby_guestfs_lvcreate, 3);
4162 rb_define_method (c_guestfs, "mkfs",
4163 ruby_guestfs_mkfs, 2);
4164 rb_define_method (c_guestfs, "sfdisk",
4165 ruby_guestfs_sfdisk, 5);
4166 rb_define_method (c_guestfs, "write_file",
4167 ruby_guestfs_write_file, 3);
4168 rb_define_method (c_guestfs, "umount",
4169 ruby_guestfs_umount, 1);
4170 rb_define_method (c_guestfs, "mounts",
4171 ruby_guestfs_mounts, 0);
4172 rb_define_method (c_guestfs, "umount_all",
4173 ruby_guestfs_umount_all, 0);
4174 rb_define_method (c_guestfs, "lvm_remove_all",
4175 ruby_guestfs_lvm_remove_all, 0);
4176 rb_define_method (c_guestfs, "file",
4177 ruby_guestfs_file, 1);
4178 rb_define_method (c_guestfs, "command",
4179 ruby_guestfs_command, 1);
4180 rb_define_method (c_guestfs, "command_lines",
4181 ruby_guestfs_command_lines, 1);
4182 rb_define_method (c_guestfs, "stat",
4183 ruby_guestfs_stat, 1);
4184 rb_define_method (c_guestfs, "lstat",
4185 ruby_guestfs_lstat, 1);
4186 rb_define_method (c_guestfs, "statvfs",
4187 ruby_guestfs_statvfs, 1);
4188 rb_define_method (c_guestfs, "tune2fs_l",
4189 ruby_guestfs_tune2fs_l, 1);
4190 rb_define_method (c_guestfs, "blockdev_setro",
4191 ruby_guestfs_blockdev_setro, 1);
4192 rb_define_method (c_guestfs, "blockdev_setrw",
4193 ruby_guestfs_blockdev_setrw, 1);
4194 rb_define_method (c_guestfs, "blockdev_getro",
4195 ruby_guestfs_blockdev_getro, 1);
4196 rb_define_method (c_guestfs, "blockdev_getss",
4197 ruby_guestfs_blockdev_getss, 1);
4198 rb_define_method (c_guestfs, "blockdev_getbsz",
4199 ruby_guestfs_blockdev_getbsz, 1);
4200 rb_define_method (c_guestfs, "blockdev_setbsz",
4201 ruby_guestfs_blockdev_setbsz, 2);
4202 rb_define_method (c_guestfs, "blockdev_getsz",
4203 ruby_guestfs_blockdev_getsz, 1);
4204 rb_define_method (c_guestfs, "blockdev_getsize64",
4205 ruby_guestfs_blockdev_getsize64, 1);
4206 rb_define_method (c_guestfs, "blockdev_flushbufs",
4207 ruby_guestfs_blockdev_flushbufs, 1);
4208 rb_define_method (c_guestfs, "blockdev_rereadpt",
4209 ruby_guestfs_blockdev_rereadpt, 1);
4210 rb_define_method (c_guestfs, "upload",
4211 ruby_guestfs_upload, 2);
4212 rb_define_method (c_guestfs, "download",
4213 ruby_guestfs_download, 2);
4214 rb_define_method (c_guestfs, "checksum",
4215 ruby_guestfs_checksum, 2);
4216 rb_define_method (c_guestfs, "tar_in",
4217 ruby_guestfs_tar_in, 2);
4218 rb_define_method (c_guestfs, "tar_out",
4219 ruby_guestfs_tar_out, 2);
4220 rb_define_method (c_guestfs, "tgz_in",
4221 ruby_guestfs_tgz_in, 2);
4222 rb_define_method (c_guestfs, "tgz_out",
4223 ruby_guestfs_tgz_out, 2);
4224 rb_define_method (c_guestfs, "mount_ro",
4225 ruby_guestfs_mount_ro, 2);
4226 rb_define_method (c_guestfs, "mount_options",
4227 ruby_guestfs_mount_options, 3);
4228 rb_define_method (c_guestfs, "mount_vfs",
4229 ruby_guestfs_mount_vfs, 4);
4230 rb_define_method (c_guestfs, "debug",
4231 ruby_guestfs_debug, 2);
4232 rb_define_method (c_guestfs, "lvremove",
4233 ruby_guestfs_lvremove, 1);
4234 rb_define_method (c_guestfs, "vgremove",
4235 ruby_guestfs_vgremove, 1);
4236 rb_define_method (c_guestfs, "pvremove",
4237 ruby_guestfs_pvremove, 1);
4238 rb_define_method (c_guestfs, "set_e2label",
4239 ruby_guestfs_set_e2label, 2);
4240 rb_define_method (c_guestfs, "get_e2label",
4241 ruby_guestfs_get_e2label, 1);
4242 rb_define_method (c_guestfs, "set_e2uuid",
4243 ruby_guestfs_set_e2uuid, 2);
4244 rb_define_method (c_guestfs, "get_e2uuid",
4245 ruby_guestfs_get_e2uuid, 1);
4246 rb_define_method (c_guestfs, "fsck",
4247 ruby_guestfs_fsck, 2);
4248 rb_define_method (c_guestfs, "zero",
4249 ruby_guestfs_zero, 1);
4250 rb_define_method (c_guestfs, "grub_install",
4251 ruby_guestfs_grub_install, 2);
4252 rb_define_method (c_guestfs, "cp",
4253 ruby_guestfs_cp, 2);
4254 rb_define_method (c_guestfs, "cp_a",
4255 ruby_guestfs_cp_a, 2);
4256 rb_define_method (c_guestfs, "mv",
4257 ruby_guestfs_mv, 2);
4258 rb_define_method (c_guestfs, "drop_caches",
4259 ruby_guestfs_drop_caches, 1);
4260 rb_define_method (c_guestfs, "dmesg",
4261 ruby_guestfs_dmesg, 0);
4262 rb_define_method (c_guestfs, "ping_daemon",
4263 ruby_guestfs_ping_daemon, 0);
4264 rb_define_method (c_guestfs, "equal",
4265 ruby_guestfs_equal, 2);
4266 rb_define_method (c_guestfs, "strings",
4267 ruby_guestfs_strings, 1);
4268 rb_define_method (c_guestfs, "strings_e",
4269 ruby_guestfs_strings_e, 2);
4270 rb_define_method (c_guestfs, "hexdump",
4271 ruby_guestfs_hexdump, 1);
4272 rb_define_method (c_guestfs, "zerofree",
4273 ruby_guestfs_zerofree, 1);
4274 rb_define_method (c_guestfs, "pvresize",
4275 ruby_guestfs_pvresize, 1);
4276 rb_define_method (c_guestfs, "sfdisk_N",
4277 ruby_guestfs_sfdisk_N, 6);
4278 rb_define_method (c_guestfs, "sfdisk_l",
4279 ruby_guestfs_sfdisk_l, 1);
4280 rb_define_method (c_guestfs, "sfdisk_kernel_geometry",
4281 ruby_guestfs_sfdisk_kernel_geometry, 1);
4282 rb_define_method (c_guestfs, "sfdisk_disk_geometry",
4283 ruby_guestfs_sfdisk_disk_geometry, 1);
4284 rb_define_method (c_guestfs, "vg_activate_all",
4285 ruby_guestfs_vg_activate_all, 1);
4286 rb_define_method (c_guestfs, "vg_activate",
4287 ruby_guestfs_vg_activate, 2);
4288 rb_define_method (c_guestfs, "lvresize",
4289 ruby_guestfs_lvresize, 2);
4290 rb_define_method (c_guestfs, "resize2fs",
4291 ruby_guestfs_resize2fs, 1);
4292 rb_define_method (c_guestfs, "find",
4293 ruby_guestfs_find, 1);
4294 rb_define_method (c_guestfs, "e2fsck_f",
4295 ruby_guestfs_e2fsck_f, 1);