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 my_newSVll(long long val) {
39 len = snprintf(buf, 100, "%" PRId64, val);
40 return newSVpv(buf, len);
49 my_newSVull(unsigned long long val) {
55 len = snprintf(buf, 100, "%" PRIu64, val);
56 return newSVpv(buf, len);
60 /* http://www.perlmonks.org/?node_id=680842 */
62 XS_unpack_charPtrPtr (SV *arg) {
67 if (!arg || !SvOK (arg) || !SvROK (arg) || SvTYPE (SvRV (arg)) != SVt_PVAV)
68 croak ("array reference expected");
70 av = (AV *)SvRV (arg);
71 ret = malloc ((av_len (av) + 1 + 1) * sizeof (char *));
73 croak ("malloc failed");
75 for (i = 0; i <= av_len (av); i++) {
76 SV **elem = av_fetch (av, i, 0);
79 croak ("missing element in list");
81 ret[i] = SvPV_nolen (*elem);
89 MODULE = Sys::Guestfs PACKAGE = Sys::Guestfs
96 RETVAL = guestfs_create ();
98 croak ("could not create guestfs handle");
99 guestfs_set_error_handler (RETVAL, NULL, NULL);
110 test0 (g, str, optstr, strlist, b, integer, filein, fileout)
113 char *optstr = SvOK(ST(2)) ? SvPV_nolen(ST(2)) : NULL;
122 r = guestfs_test0 (g, str, optstr, strlist, b, integer, filein, fileout);
125 croak ("test0: %s", guestfs_last_error (g));
134 valout = guestfs_test0rint (g, val);
136 croak ("test0rint: %s", guestfs_last_error (g));
137 RETVAL = newSViv (valout);
147 valout = guestfs_test0rinterr (g);
149 croak ("test0rinterr: %s", guestfs_last_error (g));
150 RETVAL = newSViv (valout);
161 valout = guestfs_test0rint64 (g, val);
163 croak ("test0rint64: %s", guestfs_last_error (g));
164 RETVAL = my_newSVll (valout);
174 valout = guestfs_test0rint64err (g);
176 croak ("test0rint64err: %s", guestfs_last_error (g));
177 RETVAL = my_newSVll (valout);
188 valout = guestfs_test0rbool (g, val);
190 croak ("test0rbool: %s", guestfs_last_error (g));
191 RETVAL = newSViv (valout);
201 valout = guestfs_test0rboolerr (g);
203 croak ("test0rboolerr: %s", guestfs_last_error (g));
204 RETVAL = newSViv (valout);
209 test0rconststring (g, val)
215 valout = guestfs_test0rconststring (g, val);
217 croak ("test0rconststring: %s", guestfs_last_error (g));
218 RETVAL = newSVpv (valout, 0);
223 test0rconststringerr (g)
228 valout = guestfs_test0rconststringerr (g);
230 croak ("test0rconststringerr: %s", guestfs_last_error (g));
231 RETVAL = newSVpv (valout, 0);
236 test0rstring (g, val)
242 valout = guestfs_test0rstring (g, val);
244 croak ("test0rstring: %s", guestfs_last_error (g));
245 RETVAL = newSVpv (valout, 0);
256 valout = guestfs_test0rstringerr (g);
258 croak ("test0rstringerr: %s", guestfs_last_error (g));
259 RETVAL = newSVpv (valout, 0);
265 test0rstringlist (g, val)
272 valout = guestfs_test0rstringlist (g, val);
274 croak ("test0rstringlist: %s", guestfs_last_error (g));
275 for (n = 0; valout[n] != NULL; ++n) /**/;
277 for (i = 0; i < n; ++i) {
278 PUSHs (sv_2mortal (newSVpv (valout[i], 0)));
284 test0rstringlisterr (g)
290 valout = guestfs_test0rstringlisterr (g);
292 croak ("test0rstringlisterr: %s", guestfs_last_error (g));
293 for (n = 0; valout[n] != NULL; ++n) /**/;
295 for (i = 0; i < n; ++i) {
296 PUSHs (sv_2mortal (newSVpv (valout[i], 0)));
302 test0rintbool (g, val)
306 struct guestfs_int_bool *r;
308 r = guestfs_test0rintbool (g, val);
310 croak ("test0rintbool: %s", guestfs_last_error (g));
312 PUSHs (sv_2mortal (newSViv (r->i)));
313 PUSHs (sv_2mortal (newSViv (r->b)));
314 guestfs_free_int_bool (r);
320 struct guestfs_int_bool *r;
322 r = guestfs_test0rintboolerr (g);
324 croak ("test0rintboolerr: %s", guestfs_last_error (g));
326 PUSHs (sv_2mortal (newSViv (r->i)));
327 PUSHs (sv_2mortal (newSViv (r->b)));
328 guestfs_free_int_bool (r);
331 test0rpvlist (g, val)
335 struct guestfs_lvm_pv_list *valout;
339 valout = guestfs_test0rpvlist (g, val);
341 croak ("test0rpvlist: %s", guestfs_last_error (g));
342 EXTEND (SP, valout->len);
343 for (i = 0; i < valout->len; ++i) {
345 (void) hv_store (hv, "pv_name", 7, newSVpv (valout->val[i].pv_name, 0), 0);
346 (void) hv_store (hv, "pv_uuid", 7, newSVpv (valout->val[i].pv_uuid, 32), 0);
347 (void) hv_store (hv, "pv_fmt", 6, newSVpv (valout->val[i].pv_fmt, 0), 0);
348 (void) hv_store (hv, "pv_size", 7, my_newSVull (valout->val[i].pv_size), 0);
349 (void) hv_store (hv, "dev_size", 8, my_newSVull (valout->val[i].dev_size), 0);
350 (void) hv_store (hv, "pv_free", 7, my_newSVull (valout->val[i].pv_free), 0);
351 (void) hv_store (hv, "pv_used", 7, my_newSVull (valout->val[i].pv_used), 0);
352 (void) hv_store (hv, "pv_attr", 7, newSVpv (valout->val[i].pv_attr, 0), 0);
353 (void) hv_store (hv, "pv_pe_count", 11, my_newSVll (valout->val[i].pv_pe_count), 0);
354 (void) hv_store (hv, "pv_pe_alloc_count", 17, my_newSVll (valout->val[i].pv_pe_alloc_count), 0);
355 (void) hv_store (hv, "pv_tags", 7, newSVpv (valout->val[i].pv_tags, 0), 0);
356 (void) hv_store (hv, "pe_start", 8, my_newSVull (valout->val[i].pe_start), 0);
357 (void) hv_store (hv, "pv_mda_count", 12, my_newSVll (valout->val[i].pv_mda_count), 0);
358 (void) hv_store (hv, "pv_mda_free", 11, my_newSVull (valout->val[i].pv_mda_free), 0);
359 PUSHs (sv_2mortal ((SV *) hv));
361 guestfs_free_lvm_pv_list (valout);
367 struct guestfs_lvm_pv_list *valout;
371 valout = guestfs_test0rpvlisterr (g);
373 croak ("test0rpvlisterr: %s", guestfs_last_error (g));
374 EXTEND (SP, valout->len);
375 for (i = 0; i < valout->len; ++i) {
377 (void) hv_store (hv, "pv_name", 7, newSVpv (valout->val[i].pv_name, 0), 0);
378 (void) hv_store (hv, "pv_uuid", 7, newSVpv (valout->val[i].pv_uuid, 32), 0);
379 (void) hv_store (hv, "pv_fmt", 6, newSVpv (valout->val[i].pv_fmt, 0), 0);
380 (void) hv_store (hv, "pv_size", 7, my_newSVull (valout->val[i].pv_size), 0);
381 (void) hv_store (hv, "dev_size", 8, my_newSVull (valout->val[i].dev_size), 0);
382 (void) hv_store (hv, "pv_free", 7, my_newSVull (valout->val[i].pv_free), 0);
383 (void) hv_store (hv, "pv_used", 7, my_newSVull (valout->val[i].pv_used), 0);
384 (void) hv_store (hv, "pv_attr", 7, newSVpv (valout->val[i].pv_attr, 0), 0);
385 (void) hv_store (hv, "pv_pe_count", 11, my_newSVll (valout->val[i].pv_pe_count), 0);
386 (void) hv_store (hv, "pv_pe_alloc_count", 17, my_newSVll (valout->val[i].pv_pe_alloc_count), 0);
387 (void) hv_store (hv, "pv_tags", 7, newSVpv (valout->val[i].pv_tags, 0), 0);
388 (void) hv_store (hv, "pe_start", 8, my_newSVull (valout->val[i].pe_start), 0);
389 (void) hv_store (hv, "pv_mda_count", 12, my_newSVll (valout->val[i].pv_mda_count), 0);
390 (void) hv_store (hv, "pv_mda_free", 11, my_newSVull (valout->val[i].pv_mda_free), 0);
391 PUSHs (sv_2mortal ((SV *) hv));
393 guestfs_free_lvm_pv_list (valout);
396 test0rvglist (g, val)
400 struct guestfs_lvm_vg_list *valout;
404 valout = guestfs_test0rvglist (g, val);
406 croak ("test0rvglist: %s", guestfs_last_error (g));
407 EXTEND (SP, valout->len);
408 for (i = 0; i < valout->len; ++i) {
410 (void) hv_store (hv, "vg_name", 7, newSVpv (valout->val[i].vg_name, 0), 0);
411 (void) hv_store (hv, "vg_uuid", 7, newSVpv (valout->val[i].vg_uuid, 32), 0);
412 (void) hv_store (hv, "vg_fmt", 6, newSVpv (valout->val[i].vg_fmt, 0), 0);
413 (void) hv_store (hv, "vg_attr", 7, newSVpv (valout->val[i].vg_attr, 0), 0);
414 (void) hv_store (hv, "vg_size", 7, my_newSVull (valout->val[i].vg_size), 0);
415 (void) hv_store (hv, "vg_free", 7, my_newSVull (valout->val[i].vg_free), 0);
416 (void) hv_store (hv, "vg_sysid", 8, newSVpv (valout->val[i].vg_sysid, 0), 0);
417 (void) hv_store (hv, "vg_extent_size", 14, my_newSVull (valout->val[i].vg_extent_size), 0);
418 (void) hv_store (hv, "vg_extent_count", 15, my_newSVll (valout->val[i].vg_extent_count), 0);
419 (void) hv_store (hv, "vg_free_count", 13, my_newSVll (valout->val[i].vg_free_count), 0);
420 (void) hv_store (hv, "max_lv", 6, my_newSVll (valout->val[i].max_lv), 0);
421 (void) hv_store (hv, "max_pv", 6, my_newSVll (valout->val[i].max_pv), 0);
422 (void) hv_store (hv, "pv_count", 8, my_newSVll (valout->val[i].pv_count), 0);
423 (void) hv_store (hv, "lv_count", 8, my_newSVll (valout->val[i].lv_count), 0);
424 (void) hv_store (hv, "snap_count", 10, my_newSVll (valout->val[i].snap_count), 0);
425 (void) hv_store (hv, "vg_seqno", 8, my_newSVll (valout->val[i].vg_seqno), 0);
426 (void) hv_store (hv, "vg_tags", 7, newSVpv (valout->val[i].vg_tags, 0), 0);
427 (void) hv_store (hv, "vg_mda_count", 12, my_newSVll (valout->val[i].vg_mda_count), 0);
428 (void) hv_store (hv, "vg_mda_free", 11, my_newSVull (valout->val[i].vg_mda_free), 0);
429 PUSHs (sv_2mortal ((SV *) hv));
431 guestfs_free_lvm_vg_list (valout);
437 struct guestfs_lvm_vg_list *valout;
441 valout = guestfs_test0rvglisterr (g);
443 croak ("test0rvglisterr: %s", guestfs_last_error (g));
444 EXTEND (SP, valout->len);
445 for (i = 0; i < valout->len; ++i) {
447 (void) hv_store (hv, "vg_name", 7, newSVpv (valout->val[i].vg_name, 0), 0);
448 (void) hv_store (hv, "vg_uuid", 7, newSVpv (valout->val[i].vg_uuid, 32), 0);
449 (void) hv_store (hv, "vg_fmt", 6, newSVpv (valout->val[i].vg_fmt, 0), 0);
450 (void) hv_store (hv, "vg_attr", 7, newSVpv (valout->val[i].vg_attr, 0), 0);
451 (void) hv_store (hv, "vg_size", 7, my_newSVull (valout->val[i].vg_size), 0);
452 (void) hv_store (hv, "vg_free", 7, my_newSVull (valout->val[i].vg_free), 0);
453 (void) hv_store (hv, "vg_sysid", 8, newSVpv (valout->val[i].vg_sysid, 0), 0);
454 (void) hv_store (hv, "vg_extent_size", 14, my_newSVull (valout->val[i].vg_extent_size), 0);
455 (void) hv_store (hv, "vg_extent_count", 15, my_newSVll (valout->val[i].vg_extent_count), 0);
456 (void) hv_store (hv, "vg_free_count", 13, my_newSVll (valout->val[i].vg_free_count), 0);
457 (void) hv_store (hv, "max_lv", 6, my_newSVll (valout->val[i].max_lv), 0);
458 (void) hv_store (hv, "max_pv", 6, my_newSVll (valout->val[i].max_pv), 0);
459 (void) hv_store (hv, "pv_count", 8, my_newSVll (valout->val[i].pv_count), 0);
460 (void) hv_store (hv, "lv_count", 8, my_newSVll (valout->val[i].lv_count), 0);
461 (void) hv_store (hv, "snap_count", 10, my_newSVll (valout->val[i].snap_count), 0);
462 (void) hv_store (hv, "vg_seqno", 8, my_newSVll (valout->val[i].vg_seqno), 0);
463 (void) hv_store (hv, "vg_tags", 7, newSVpv (valout->val[i].vg_tags, 0), 0);
464 (void) hv_store (hv, "vg_mda_count", 12, my_newSVll (valout->val[i].vg_mda_count), 0);
465 (void) hv_store (hv, "vg_mda_free", 11, my_newSVull (valout->val[i].vg_mda_free), 0);
466 PUSHs (sv_2mortal ((SV *) hv));
468 guestfs_free_lvm_vg_list (valout);
471 test0rlvlist (g, val)
475 struct guestfs_lvm_lv_list *valout;
479 valout = guestfs_test0rlvlist (g, val);
481 croak ("test0rlvlist: %s", guestfs_last_error (g));
482 EXTEND (SP, valout->len);
483 for (i = 0; i < valout->len; ++i) {
485 (void) hv_store (hv, "lv_name", 7, newSVpv (valout->val[i].lv_name, 0), 0);
486 (void) hv_store (hv, "lv_uuid", 7, newSVpv (valout->val[i].lv_uuid, 32), 0);
487 (void) hv_store (hv, "lv_attr", 7, newSVpv (valout->val[i].lv_attr, 0), 0);
488 (void) hv_store (hv, "lv_major", 8, my_newSVll (valout->val[i].lv_major), 0);
489 (void) hv_store (hv, "lv_minor", 8, my_newSVll (valout->val[i].lv_minor), 0);
490 (void) hv_store (hv, "lv_kernel_major", 15, my_newSVll (valout->val[i].lv_kernel_major), 0);
491 (void) hv_store (hv, "lv_kernel_minor", 15, my_newSVll (valout->val[i].lv_kernel_minor), 0);
492 (void) hv_store (hv, "lv_size", 7, my_newSVull (valout->val[i].lv_size), 0);
493 (void) hv_store (hv, "seg_count", 9, my_newSVll (valout->val[i].seg_count), 0);
494 (void) hv_store (hv, "origin", 6, newSVpv (valout->val[i].origin, 0), 0);
495 (void) hv_store (hv, "snap_percent", 12, newSVnv (valout->val[i].snap_percent), 0);
496 (void) hv_store (hv, "copy_percent", 12, newSVnv (valout->val[i].copy_percent), 0);
497 (void) hv_store (hv, "move_pv", 7, newSVpv (valout->val[i].move_pv, 0), 0);
498 (void) hv_store (hv, "lv_tags", 7, newSVpv (valout->val[i].lv_tags, 0), 0);
499 (void) hv_store (hv, "mirror_log", 10, newSVpv (valout->val[i].mirror_log, 0), 0);
500 (void) hv_store (hv, "modules", 7, newSVpv (valout->val[i].modules, 0), 0);
501 PUSHs (sv_2mortal ((SV *) hv));
503 guestfs_free_lvm_lv_list (valout);
509 struct guestfs_lvm_lv_list *valout;
513 valout = guestfs_test0rlvlisterr (g);
515 croak ("test0rlvlisterr: %s", guestfs_last_error (g));
516 EXTEND (SP, valout->len);
517 for (i = 0; i < valout->len; ++i) {
519 (void) hv_store (hv, "lv_name", 7, newSVpv (valout->val[i].lv_name, 0), 0);
520 (void) hv_store (hv, "lv_uuid", 7, newSVpv (valout->val[i].lv_uuid, 32), 0);
521 (void) hv_store (hv, "lv_attr", 7, newSVpv (valout->val[i].lv_attr, 0), 0);
522 (void) hv_store (hv, "lv_major", 8, my_newSVll (valout->val[i].lv_major), 0);
523 (void) hv_store (hv, "lv_minor", 8, my_newSVll (valout->val[i].lv_minor), 0);
524 (void) hv_store (hv, "lv_kernel_major", 15, my_newSVll (valout->val[i].lv_kernel_major), 0);
525 (void) hv_store (hv, "lv_kernel_minor", 15, my_newSVll (valout->val[i].lv_kernel_minor), 0);
526 (void) hv_store (hv, "lv_size", 7, my_newSVull (valout->val[i].lv_size), 0);
527 (void) hv_store (hv, "seg_count", 9, my_newSVll (valout->val[i].seg_count), 0);
528 (void) hv_store (hv, "origin", 6, newSVpv (valout->val[i].origin, 0), 0);
529 (void) hv_store (hv, "snap_percent", 12, newSVnv (valout->val[i].snap_percent), 0);
530 (void) hv_store (hv, "copy_percent", 12, newSVnv (valout->val[i].copy_percent), 0);
531 (void) hv_store (hv, "move_pv", 7, newSVpv (valout->val[i].move_pv, 0), 0);
532 (void) hv_store (hv, "lv_tags", 7, newSVpv (valout->val[i].lv_tags, 0), 0);
533 (void) hv_store (hv, "mirror_log", 10, newSVpv (valout->val[i].mirror_log, 0), 0);
534 (void) hv_store (hv, "modules", 7, newSVpv (valout->val[i].modules, 0), 0);
535 PUSHs (sv_2mortal ((SV *) hv));
537 guestfs_free_lvm_lv_list (valout);
544 struct guestfs_stat *valout;
546 valout = guestfs_test0rstat (g, val);
548 croak ("test0rstat: %s", guestfs_last_error (g));
550 PUSHs (sv_2mortal (my_newSVll (valout->dev)));
551 PUSHs (sv_2mortal (my_newSVll (valout->ino)));
552 PUSHs (sv_2mortal (my_newSVll (valout->mode)));
553 PUSHs (sv_2mortal (my_newSVll (valout->nlink)));
554 PUSHs (sv_2mortal (my_newSVll (valout->uid)));
555 PUSHs (sv_2mortal (my_newSVll (valout->gid)));
556 PUSHs (sv_2mortal (my_newSVll (valout->rdev)));
557 PUSHs (sv_2mortal (my_newSVll (valout->size)));
558 PUSHs (sv_2mortal (my_newSVll (valout->blksize)));
559 PUSHs (sv_2mortal (my_newSVll (valout->blocks)));
560 PUSHs (sv_2mortal (my_newSVll (valout->atime)));
561 PUSHs (sv_2mortal (my_newSVll (valout->mtime)));
562 PUSHs (sv_2mortal (my_newSVll (valout->ctime)));
569 struct guestfs_stat *valout;
571 valout = guestfs_test0rstaterr (g);
573 croak ("test0rstaterr: %s", guestfs_last_error (g));
575 PUSHs (sv_2mortal (my_newSVll (valout->dev)));
576 PUSHs (sv_2mortal (my_newSVll (valout->ino)));
577 PUSHs (sv_2mortal (my_newSVll (valout->mode)));
578 PUSHs (sv_2mortal (my_newSVll (valout->nlink)));
579 PUSHs (sv_2mortal (my_newSVll (valout->uid)));
580 PUSHs (sv_2mortal (my_newSVll (valout->gid)));
581 PUSHs (sv_2mortal (my_newSVll (valout->rdev)));
582 PUSHs (sv_2mortal (my_newSVll (valout->size)));
583 PUSHs (sv_2mortal (my_newSVll (valout->blksize)));
584 PUSHs (sv_2mortal (my_newSVll (valout->blocks)));
585 PUSHs (sv_2mortal (my_newSVll (valout->atime)));
586 PUSHs (sv_2mortal (my_newSVll (valout->mtime)));
587 PUSHs (sv_2mortal (my_newSVll (valout->ctime)));
591 test0rstatvfs (g, val)
595 struct guestfs_statvfs *valout;
597 valout = guestfs_test0rstatvfs (g, val);
599 croak ("test0rstatvfs: %s", guestfs_last_error (g));
601 PUSHs (sv_2mortal (my_newSVll (valout->bsize)));
602 PUSHs (sv_2mortal (my_newSVll (valout->frsize)));
603 PUSHs (sv_2mortal (my_newSVll (valout->blocks)));
604 PUSHs (sv_2mortal (my_newSVll (valout->bfree)));
605 PUSHs (sv_2mortal (my_newSVll (valout->bavail)));
606 PUSHs (sv_2mortal (my_newSVll (valout->files)));
607 PUSHs (sv_2mortal (my_newSVll (valout->ffree)));
608 PUSHs (sv_2mortal (my_newSVll (valout->favail)));
609 PUSHs (sv_2mortal (my_newSVll (valout->fsid)));
610 PUSHs (sv_2mortal (my_newSVll (valout->flag)));
611 PUSHs (sv_2mortal (my_newSVll (valout->namemax)));
618 struct guestfs_statvfs *valout;
620 valout = guestfs_test0rstatvfserr (g);
622 croak ("test0rstatvfserr: %s", guestfs_last_error (g));
624 PUSHs (sv_2mortal (my_newSVll (valout->bsize)));
625 PUSHs (sv_2mortal (my_newSVll (valout->frsize)));
626 PUSHs (sv_2mortal (my_newSVll (valout->blocks)));
627 PUSHs (sv_2mortal (my_newSVll (valout->bfree)));
628 PUSHs (sv_2mortal (my_newSVll (valout->bavail)));
629 PUSHs (sv_2mortal (my_newSVll (valout->files)));
630 PUSHs (sv_2mortal (my_newSVll (valout->ffree)));
631 PUSHs (sv_2mortal (my_newSVll (valout->favail)));
632 PUSHs (sv_2mortal (my_newSVll (valout->fsid)));
633 PUSHs (sv_2mortal (my_newSVll (valout->flag)));
634 PUSHs (sv_2mortal (my_newSVll (valout->namemax)));
638 test0rhashtable (g, val)
645 valout = guestfs_test0rhashtable (g, val);
647 croak ("test0rhashtable: %s", guestfs_last_error (g));
648 for (n = 0; valout[n] != NULL; ++n) /**/;
650 for (i = 0; i < n; ++i) {
651 PUSHs (sv_2mortal (newSVpv (valout[i], 0)));
657 test0rhashtableerr (g)
663 valout = guestfs_test0rhashtableerr (g);
665 croak ("test0rhashtableerr: %s", guestfs_last_error (g));
666 for (n = 0; valout[n] != NULL; ++n) /**/;
668 for (i = 0; i < n; ++i) {
669 PUSHs (sv_2mortal (newSVpv (valout[i], 0)));
680 r = guestfs_launch (g);
682 croak ("launch: %s", guestfs_last_error (g));
690 r = guestfs_wait_ready (g);
692 croak ("wait_ready: %s", guestfs_last_error (g));
700 r = guestfs_kill_subprocess (g);
702 croak ("kill_subprocess: %s", guestfs_last_error (g));
705 add_drive (g, filename)
711 r = guestfs_add_drive (g, filename);
713 croak ("add_drive: %s", guestfs_last_error (g));
716 add_cdrom (g, filename)
722 r = guestfs_add_cdrom (g, filename);
724 croak ("add_cdrom: %s", guestfs_last_error (g));
727 add_drive_ro (g, filename)
733 r = guestfs_add_drive_ro (g, filename);
735 croak ("add_drive_ro: %s", guestfs_last_error (g));
738 config (g, qemuparam, qemuvalue)
741 char *qemuvalue = SvOK(ST(2)) ? SvPV_nolen(ST(2)) : NULL;
745 r = guestfs_config (g, qemuparam, qemuvalue);
747 croak ("config: %s", guestfs_last_error (g));
756 r = guestfs_set_qemu (g, qemu);
758 croak ("set_qemu: %s", guestfs_last_error (g));
766 qemu = guestfs_get_qemu (g);
768 croak ("get_qemu: %s", guestfs_last_error (g));
769 RETVAL = newSVpv (qemu, 0);
780 r = guestfs_set_path (g, path);
782 croak ("set_path: %s", guestfs_last_error (g));
790 path = guestfs_get_path (g);
792 croak ("get_path: %s", guestfs_last_error (g));
793 RETVAL = newSVpv (path, 0);
798 set_append (g, append)
804 r = guestfs_set_append (g, append);
806 croak ("set_append: %s", guestfs_last_error (g));
814 append = guestfs_get_append (g);
816 croak ("get_append: %s", guestfs_last_error (g));
817 RETVAL = newSVpv (append, 0);
822 set_autosync (g, autosync)
828 r = guestfs_set_autosync (g, autosync);
830 croak ("set_autosync: %s", guestfs_last_error (g));
838 autosync = guestfs_get_autosync (g);
840 croak ("get_autosync: %s", guestfs_last_error (g));
841 RETVAL = newSViv (autosync);
846 set_verbose (g, verbose)
852 r = guestfs_set_verbose (g, verbose);
854 croak ("set_verbose: %s", guestfs_last_error (g));
862 verbose = guestfs_get_verbose (g);
864 croak ("get_verbose: %s", guestfs_last_error (g));
865 RETVAL = newSViv (verbose);
875 ready = guestfs_is_ready (g);
877 croak ("is_ready: %s", guestfs_last_error (g));
878 RETVAL = newSViv (ready);
888 config = guestfs_is_config (g);
890 croak ("is_config: %s", guestfs_last_error (g));
891 RETVAL = newSViv (config);
901 launching = guestfs_is_launching (g);
903 croak ("is_launching: %s", guestfs_last_error (g));
904 RETVAL = newSViv (launching);
914 busy = guestfs_is_busy (g);
916 croak ("is_busy: %s", guestfs_last_error (g));
917 RETVAL = newSViv (busy);
927 state = guestfs_get_state (g);
929 croak ("get_state: %s", guestfs_last_error (g));
930 RETVAL = newSViv (state);
940 r = guestfs_set_busy (g);
942 croak ("set_busy: %s", guestfs_last_error (g));
950 r = guestfs_set_ready (g);
952 croak ("set_ready: %s", guestfs_last_error (g));
960 r = guestfs_end_busy (g);
962 croak ("end_busy: %s", guestfs_last_error (g));
965 set_memsize (g, memsize)
971 r = guestfs_set_memsize (g, memsize);
973 croak ("set_memsize: %s", guestfs_last_error (g));
981 memsize = guestfs_get_memsize (g);
983 croak ("get_memsize: %s", guestfs_last_error (g));
984 RETVAL = newSViv (memsize);
989 mount (g, device, mountpoint)
996 r = guestfs_mount (g, device, mountpoint);
998 croak ("mount: %s", guestfs_last_error (g));
1006 r = guestfs_sync (g);
1008 croak ("sync: %s", guestfs_last_error (g));
1017 r = guestfs_touch (g, path);
1019 croak ("touch: %s", guestfs_last_error (g));
1028 content = guestfs_cat (g, path);
1029 if (content == NULL)
1030 croak ("cat: %s", guestfs_last_error (g));
1031 RETVAL = newSVpv (content, 0);
1043 listing = guestfs_ll (g, directory);
1044 if (listing == NULL)
1045 croak ("ll: %s", guestfs_last_error (g));
1046 RETVAL = newSVpv (listing, 0);
1059 listing = guestfs_ls (g, directory);
1060 if (listing == NULL)
1061 croak ("ls: %s", guestfs_last_error (g));
1062 for (n = 0; listing[n] != NULL; ++n) /**/;
1064 for (i = 0; i < n; ++i) {
1065 PUSHs (sv_2mortal (newSVpv (listing[i], 0)));
1077 devices = guestfs_list_devices (g);
1078 if (devices == NULL)
1079 croak ("list_devices: %s", guestfs_last_error (g));
1080 for (n = 0; devices[n] != NULL; ++n) /**/;
1082 for (i = 0; i < n; ++i) {
1083 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1095 partitions = guestfs_list_partitions (g);
1096 if (partitions == NULL)
1097 croak ("list_partitions: %s", guestfs_last_error (g));
1098 for (n = 0; partitions[n] != NULL; ++n) /**/;
1100 for (i = 0; i < n; ++i) {
1101 PUSHs (sv_2mortal (newSVpv (partitions[i], 0)));
1102 free (partitions[i]);
1113 physvols = guestfs_pvs (g);
1114 if (physvols == NULL)
1115 croak ("pvs: %s", guestfs_last_error (g));
1116 for (n = 0; physvols[n] != NULL; ++n) /**/;
1118 for (i = 0; i < n; ++i) {
1119 PUSHs (sv_2mortal (newSVpv (physvols[i], 0)));
1131 volgroups = guestfs_vgs (g);
1132 if (volgroups == NULL)
1133 croak ("vgs: %s", guestfs_last_error (g));
1134 for (n = 0; volgroups[n] != NULL; ++n) /**/;
1136 for (i = 0; i < n; ++i) {
1137 PUSHs (sv_2mortal (newSVpv (volgroups[i], 0)));
1138 free (volgroups[i]);
1149 logvols = guestfs_lvs (g);
1150 if (logvols == NULL)
1151 croak ("lvs: %s", guestfs_last_error (g));
1152 for (n = 0; logvols[n] != NULL; ++n) /**/;
1154 for (i = 0; i < n; ++i) {
1155 PUSHs (sv_2mortal (newSVpv (logvols[i], 0)));
1164 struct guestfs_lvm_pv_list *physvols;
1168 physvols = guestfs_pvs_full (g);
1169 if (physvols == NULL)
1170 croak ("pvs_full: %s", guestfs_last_error (g));
1171 EXTEND (SP, physvols->len);
1172 for (i = 0; i < physvols->len; ++i) {
1174 (void) hv_store (hv, "pv_name", 7, newSVpv (physvols->val[i].pv_name, 0), 0);
1175 (void) hv_store (hv, "pv_uuid", 7, newSVpv (physvols->val[i].pv_uuid, 32), 0);
1176 (void) hv_store (hv, "pv_fmt", 6, newSVpv (physvols->val[i].pv_fmt, 0), 0);
1177 (void) hv_store (hv, "pv_size", 7, my_newSVull (physvols->val[i].pv_size), 0);
1178 (void) hv_store (hv, "dev_size", 8, my_newSVull (physvols->val[i].dev_size), 0);
1179 (void) hv_store (hv, "pv_free", 7, my_newSVull (physvols->val[i].pv_free), 0);
1180 (void) hv_store (hv, "pv_used", 7, my_newSVull (physvols->val[i].pv_used), 0);
1181 (void) hv_store (hv, "pv_attr", 7, newSVpv (physvols->val[i].pv_attr, 0), 0);
1182 (void) hv_store (hv, "pv_pe_count", 11, my_newSVll (physvols->val[i].pv_pe_count), 0);
1183 (void) hv_store (hv, "pv_pe_alloc_count", 17, my_newSVll (physvols->val[i].pv_pe_alloc_count), 0);
1184 (void) hv_store (hv, "pv_tags", 7, newSVpv (physvols->val[i].pv_tags, 0), 0);
1185 (void) hv_store (hv, "pe_start", 8, my_newSVull (physvols->val[i].pe_start), 0);
1186 (void) hv_store (hv, "pv_mda_count", 12, my_newSVll (physvols->val[i].pv_mda_count), 0);
1187 (void) hv_store (hv, "pv_mda_free", 11, my_newSVull (physvols->val[i].pv_mda_free), 0);
1188 PUSHs (sv_2mortal ((SV *) hv));
1190 guestfs_free_lvm_pv_list (physvols);
1196 struct guestfs_lvm_vg_list *volgroups;
1200 volgroups = guestfs_vgs_full (g);
1201 if (volgroups == NULL)
1202 croak ("vgs_full: %s", guestfs_last_error (g));
1203 EXTEND (SP, volgroups->len);
1204 for (i = 0; i < volgroups->len; ++i) {
1206 (void) hv_store (hv, "vg_name", 7, newSVpv (volgroups->val[i].vg_name, 0), 0);
1207 (void) hv_store (hv, "vg_uuid", 7, newSVpv (volgroups->val[i].vg_uuid, 32), 0);
1208 (void) hv_store (hv, "vg_fmt", 6, newSVpv (volgroups->val[i].vg_fmt, 0), 0);
1209 (void) hv_store (hv, "vg_attr", 7, newSVpv (volgroups->val[i].vg_attr, 0), 0);
1210 (void) hv_store (hv, "vg_size", 7, my_newSVull (volgroups->val[i].vg_size), 0);
1211 (void) hv_store (hv, "vg_free", 7, my_newSVull (volgroups->val[i].vg_free), 0);
1212 (void) hv_store (hv, "vg_sysid", 8, newSVpv (volgroups->val[i].vg_sysid, 0), 0);
1213 (void) hv_store (hv, "vg_extent_size", 14, my_newSVull (volgroups->val[i].vg_extent_size), 0);
1214 (void) hv_store (hv, "vg_extent_count", 15, my_newSVll (volgroups->val[i].vg_extent_count), 0);
1215 (void) hv_store (hv, "vg_free_count", 13, my_newSVll (volgroups->val[i].vg_free_count), 0);
1216 (void) hv_store (hv, "max_lv", 6, my_newSVll (volgroups->val[i].max_lv), 0);
1217 (void) hv_store (hv, "max_pv", 6, my_newSVll (volgroups->val[i].max_pv), 0);
1218 (void) hv_store (hv, "pv_count", 8, my_newSVll (volgroups->val[i].pv_count), 0);
1219 (void) hv_store (hv, "lv_count", 8, my_newSVll (volgroups->val[i].lv_count), 0);
1220 (void) hv_store (hv, "snap_count", 10, my_newSVll (volgroups->val[i].snap_count), 0);
1221 (void) hv_store (hv, "vg_seqno", 8, my_newSVll (volgroups->val[i].vg_seqno), 0);
1222 (void) hv_store (hv, "vg_tags", 7, newSVpv (volgroups->val[i].vg_tags, 0), 0);
1223 (void) hv_store (hv, "vg_mda_count", 12, my_newSVll (volgroups->val[i].vg_mda_count), 0);
1224 (void) hv_store (hv, "vg_mda_free", 11, my_newSVull (volgroups->val[i].vg_mda_free), 0);
1225 PUSHs (sv_2mortal ((SV *) hv));
1227 guestfs_free_lvm_vg_list (volgroups);
1233 struct guestfs_lvm_lv_list *logvols;
1237 logvols = guestfs_lvs_full (g);
1238 if (logvols == NULL)
1239 croak ("lvs_full: %s", guestfs_last_error (g));
1240 EXTEND (SP, logvols->len);
1241 for (i = 0; i < logvols->len; ++i) {
1243 (void) hv_store (hv, "lv_name", 7, newSVpv (logvols->val[i].lv_name, 0), 0);
1244 (void) hv_store (hv, "lv_uuid", 7, newSVpv (logvols->val[i].lv_uuid, 32), 0);
1245 (void) hv_store (hv, "lv_attr", 7, newSVpv (logvols->val[i].lv_attr, 0), 0);
1246 (void) hv_store (hv, "lv_major", 8, my_newSVll (logvols->val[i].lv_major), 0);
1247 (void) hv_store (hv, "lv_minor", 8, my_newSVll (logvols->val[i].lv_minor), 0);
1248 (void) hv_store (hv, "lv_kernel_major", 15, my_newSVll (logvols->val[i].lv_kernel_major), 0);
1249 (void) hv_store (hv, "lv_kernel_minor", 15, my_newSVll (logvols->val[i].lv_kernel_minor), 0);
1250 (void) hv_store (hv, "lv_size", 7, my_newSVull (logvols->val[i].lv_size), 0);
1251 (void) hv_store (hv, "seg_count", 9, my_newSVll (logvols->val[i].seg_count), 0);
1252 (void) hv_store (hv, "origin", 6, newSVpv (logvols->val[i].origin, 0), 0);
1253 (void) hv_store (hv, "snap_percent", 12, newSVnv (logvols->val[i].snap_percent), 0);
1254 (void) hv_store (hv, "copy_percent", 12, newSVnv (logvols->val[i].copy_percent), 0);
1255 (void) hv_store (hv, "move_pv", 7, newSVpv (logvols->val[i].move_pv, 0), 0);
1256 (void) hv_store (hv, "lv_tags", 7, newSVpv (logvols->val[i].lv_tags, 0), 0);
1257 (void) hv_store (hv, "mirror_log", 10, newSVpv (logvols->val[i].mirror_log, 0), 0);
1258 (void) hv_store (hv, "modules", 7, newSVpv (logvols->val[i].modules, 0), 0);
1259 PUSHs (sv_2mortal ((SV *) hv));
1261 guestfs_free_lvm_lv_list (logvols);
1264 read_lines (g, path)
1271 lines = guestfs_read_lines (g, path);
1273 croak ("read_lines: %s", guestfs_last_error (g));
1274 for (n = 0; lines[n] != NULL; ++n) /**/;
1276 for (i = 0; i < n; ++i) {
1277 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1283 aug_init (g, root, flags)
1290 r = guestfs_aug_init (g, root, flags);
1292 croak ("aug_init: %s", guestfs_last_error (g));
1300 r = guestfs_aug_close (g);
1302 croak ("aug_close: %s", guestfs_last_error (g));
1305 aug_defvar (g, name, expr)
1308 char *expr = SvOK(ST(2)) ? SvPV_nolen(ST(2)) : NULL;
1312 nrnodes = guestfs_aug_defvar (g, name, expr);
1314 croak ("aug_defvar: %s", guestfs_last_error (g));
1315 RETVAL = newSViv (nrnodes);
1320 aug_defnode (g, name, expr, val)
1326 struct guestfs_int_bool *r;
1328 r = guestfs_aug_defnode (g, name, expr, val);
1330 croak ("aug_defnode: %s", guestfs_last_error (g));
1332 PUSHs (sv_2mortal (newSViv (r->i)));
1333 PUSHs (sv_2mortal (newSViv (r->b)));
1334 guestfs_free_int_bool (r);
1343 val = guestfs_aug_get (g, path);
1345 croak ("aug_get: %s", guestfs_last_error (g));
1346 RETVAL = newSVpv (val, 0);
1352 aug_set (g, path, val)
1359 r = guestfs_aug_set (g, path, val);
1361 croak ("aug_set: %s", guestfs_last_error (g));
1364 aug_insert (g, path, label, before)
1372 r = guestfs_aug_insert (g, path, label, before);
1374 croak ("aug_insert: %s", guestfs_last_error (g));
1383 nrnodes = guestfs_aug_rm (g, path);
1385 croak ("aug_rm: %s", guestfs_last_error (g));
1386 RETVAL = newSViv (nrnodes);
1391 aug_mv (g, src, dest)
1398 r = guestfs_aug_mv (g, src, dest);
1400 croak ("aug_mv: %s", guestfs_last_error (g));
1410 matches = guestfs_aug_match (g, path);
1411 if (matches == NULL)
1412 croak ("aug_match: %s", guestfs_last_error (g));
1413 for (n = 0; matches[n] != NULL; ++n) /**/;
1415 for (i = 0; i < n; ++i) {
1416 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
1427 r = guestfs_aug_save (g);
1429 croak ("aug_save: %s", guestfs_last_error (g));
1437 r = guestfs_aug_load (g);
1439 croak ("aug_load: %s", guestfs_last_error (g));
1449 matches = guestfs_aug_ls (g, path);
1450 if (matches == NULL)
1451 croak ("aug_ls: %s", guestfs_last_error (g));
1452 for (n = 0; matches[n] != NULL; ++n) /**/;
1454 for (i = 0; i < n; ++i) {
1455 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
1467 r = guestfs_rm (g, path);
1469 croak ("rm: %s", guestfs_last_error (g));
1478 r = guestfs_rmdir (g, path);
1480 croak ("rmdir: %s", guestfs_last_error (g));
1489 r = guestfs_rm_rf (g, path);
1491 croak ("rm_rf: %s", guestfs_last_error (g));
1500 r = guestfs_mkdir (g, path);
1502 croak ("mkdir: %s", guestfs_last_error (g));
1511 r = guestfs_mkdir_p (g, path);
1513 croak ("mkdir_p: %s", guestfs_last_error (g));
1516 chmod (g, mode, path)
1523 r = guestfs_chmod (g, mode, path);
1525 croak ("chmod: %s", guestfs_last_error (g));
1528 chown (g, owner, group, path)
1536 r = guestfs_chown (g, owner, group, path);
1538 croak ("chown: %s", guestfs_last_error (g));
1547 existsflag = guestfs_exists (g, path);
1548 if (existsflag == -1)
1549 croak ("exists: %s", guestfs_last_error (g));
1550 RETVAL = newSViv (existsflag);
1561 fileflag = guestfs_is_file (g, path);
1563 croak ("is_file: %s", guestfs_last_error (g));
1564 RETVAL = newSViv (fileflag);
1575 dirflag = guestfs_is_dir (g, path);
1577 croak ("is_dir: %s", guestfs_last_error (g));
1578 RETVAL = newSViv (dirflag);
1583 pvcreate (g, device)
1589 r = guestfs_pvcreate (g, device);
1591 croak ("pvcreate: %s", guestfs_last_error (g));
1594 vgcreate (g, volgroup, physvols)
1601 r = guestfs_vgcreate (g, volgroup, physvols);
1604 croak ("vgcreate: %s", guestfs_last_error (g));
1607 lvcreate (g, logvol, volgroup, mbytes)
1615 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
1617 croak ("lvcreate: %s", guestfs_last_error (g));
1620 mkfs (g, fstype, device)
1627 r = guestfs_mkfs (g, fstype, device);
1629 croak ("mkfs: %s", guestfs_last_error (g));
1632 sfdisk (g, device, cyls, heads, sectors, lines)
1642 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1645 croak ("sfdisk: %s", guestfs_last_error (g));
1648 write_file (g, path, content, size)
1656 r = guestfs_write_file (g, path, content, size);
1658 croak ("write_file: %s", guestfs_last_error (g));
1661 umount (g, pathordevice)
1667 r = guestfs_umount (g, pathordevice);
1669 croak ("umount: %s", guestfs_last_error (g));
1678 devices = guestfs_mounts (g);
1679 if (devices == NULL)
1680 croak ("mounts: %s", guestfs_last_error (g));
1681 for (n = 0; devices[n] != NULL; ++n) /**/;
1683 for (i = 0; i < n; ++i) {
1684 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1695 r = guestfs_umount_all (g);
1697 croak ("umount_all: %s", guestfs_last_error (g));
1705 r = guestfs_lvm_remove_all (g);
1707 croak ("lvm_remove_all: %s", guestfs_last_error (g));
1716 description = guestfs_file (g, path);
1717 if (description == NULL)
1718 croak ("file: %s", guestfs_last_error (g));
1719 RETVAL = newSVpv (description, 0);
1725 command (g, arguments)
1731 output = guestfs_command (g, arguments);
1734 croak ("command: %s", guestfs_last_error (g));
1735 RETVAL = newSVpv (output, 0);
1741 command_lines (g, arguments)
1748 lines = guestfs_command_lines (g, arguments);
1751 croak ("command_lines: %s", guestfs_last_error (g));
1752 for (n = 0; lines[n] != NULL; ++n) /**/;
1754 for (i = 0; i < n; ++i) {
1755 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1765 struct guestfs_stat *statbuf;
1767 statbuf = guestfs_stat (g, path);
1768 if (statbuf == NULL)
1769 croak ("stat: %s", guestfs_last_error (g));
1771 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1772 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1773 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1774 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1775 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1776 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1777 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1778 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1779 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1780 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1781 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1782 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1783 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1791 struct guestfs_stat *statbuf;
1793 statbuf = guestfs_lstat (g, path);
1794 if (statbuf == NULL)
1795 croak ("lstat: %s", guestfs_last_error (g));
1797 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1798 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1799 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1800 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1801 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1802 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1803 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1804 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1805 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1806 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1807 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1808 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1809 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1817 struct guestfs_statvfs *statbuf;
1819 statbuf = guestfs_statvfs (g, path);
1820 if (statbuf == NULL)
1821 croak ("statvfs: %s", guestfs_last_error (g));
1823 PUSHs (sv_2mortal (my_newSVll (statbuf->bsize)));
1824 PUSHs (sv_2mortal (my_newSVll (statbuf->frsize)));
1825 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1826 PUSHs (sv_2mortal (my_newSVll (statbuf->bfree)));
1827 PUSHs (sv_2mortal (my_newSVll (statbuf->bavail)));
1828 PUSHs (sv_2mortal (my_newSVll (statbuf->files)));
1829 PUSHs (sv_2mortal (my_newSVll (statbuf->ffree)));
1830 PUSHs (sv_2mortal (my_newSVll (statbuf->favail)));
1831 PUSHs (sv_2mortal (my_newSVll (statbuf->fsid)));
1832 PUSHs (sv_2mortal (my_newSVll (statbuf->flag)));
1833 PUSHs (sv_2mortal (my_newSVll (statbuf->namemax)));
1837 tune2fs_l (g, device)
1844 superblock = guestfs_tune2fs_l (g, device);
1845 if (superblock == NULL)
1846 croak ("tune2fs_l: %s", guestfs_last_error (g));
1847 for (n = 0; superblock[n] != NULL; ++n) /**/;
1849 for (i = 0; i < n; ++i) {
1850 PUSHs (sv_2mortal (newSVpv (superblock[i], 0)));
1851 free (superblock[i]);
1856 blockdev_setro (g, device)
1862 r = guestfs_blockdev_setro (g, device);
1864 croak ("blockdev_setro: %s", guestfs_last_error (g));
1867 blockdev_setrw (g, device)
1873 r = guestfs_blockdev_setrw (g, device);
1875 croak ("blockdev_setrw: %s", guestfs_last_error (g));
1878 blockdev_getro (g, device)
1884 ro = guestfs_blockdev_getro (g, device);
1886 croak ("blockdev_getro: %s", guestfs_last_error (g));
1887 RETVAL = newSViv (ro);
1892 blockdev_getss (g, device)
1898 sectorsize = guestfs_blockdev_getss (g, device);
1899 if (sectorsize == -1)
1900 croak ("blockdev_getss: %s", guestfs_last_error (g));
1901 RETVAL = newSViv (sectorsize);
1906 blockdev_getbsz (g, device)
1912 blocksize = guestfs_blockdev_getbsz (g, device);
1913 if (blocksize == -1)
1914 croak ("blockdev_getbsz: %s", guestfs_last_error (g));
1915 RETVAL = newSViv (blocksize);
1920 blockdev_setbsz (g, device, blocksize)
1927 r = guestfs_blockdev_setbsz (g, device, blocksize);
1929 croak ("blockdev_setbsz: %s", guestfs_last_error (g));
1932 blockdev_getsz (g, device)
1936 int64_t sizeinsectors;
1938 sizeinsectors = guestfs_blockdev_getsz (g, device);
1939 if (sizeinsectors == -1)
1940 croak ("blockdev_getsz: %s", guestfs_last_error (g));
1941 RETVAL = my_newSVll (sizeinsectors);
1946 blockdev_getsize64 (g, device)
1950 int64_t sizeinbytes;
1952 sizeinbytes = guestfs_blockdev_getsize64 (g, device);
1953 if (sizeinbytes == -1)
1954 croak ("blockdev_getsize64: %s", guestfs_last_error (g));
1955 RETVAL = my_newSVll (sizeinbytes);
1960 blockdev_flushbufs (g, device)
1966 r = guestfs_blockdev_flushbufs (g, device);
1968 croak ("blockdev_flushbufs: %s", guestfs_last_error (g));
1971 blockdev_rereadpt (g, device)
1977 r = guestfs_blockdev_rereadpt (g, device);
1979 croak ("blockdev_rereadpt: %s", guestfs_last_error (g));
1982 upload (g, filename, remotefilename)
1985 char *remotefilename;
1989 r = guestfs_upload (g, filename, remotefilename);
1991 croak ("upload: %s", guestfs_last_error (g));
1994 download (g, remotefilename, filename)
1996 char *remotefilename;
2001 r = guestfs_download (g, remotefilename, filename);
2003 croak ("download: %s", guestfs_last_error (g));
2006 checksum (g, csumtype, path)
2013 checksum = guestfs_checksum (g, csumtype, path);
2014 if (checksum == NULL)
2015 croak ("checksum: %s", guestfs_last_error (g));
2016 RETVAL = newSVpv (checksum, 0);
2022 tar_in (g, tarfile, directory)
2029 r = guestfs_tar_in (g, tarfile, directory);
2031 croak ("tar_in: %s", guestfs_last_error (g));
2034 tar_out (g, directory, tarfile)
2041 r = guestfs_tar_out (g, directory, tarfile);
2043 croak ("tar_out: %s", guestfs_last_error (g));
2046 tgz_in (g, tarball, directory)
2053 r = guestfs_tgz_in (g, tarball, directory);
2055 croak ("tgz_in: %s", guestfs_last_error (g));
2058 tgz_out (g, directory, tarball)
2065 r = guestfs_tgz_out (g, directory, tarball);
2067 croak ("tgz_out: %s", guestfs_last_error (g));
2070 mount_ro (g, device, mountpoint)
2077 r = guestfs_mount_ro (g, device, mountpoint);
2079 croak ("mount_ro: %s", guestfs_last_error (g));
2082 mount_options (g, options, device, mountpoint)
2090 r = guestfs_mount_options (g, options, device, mountpoint);
2092 croak ("mount_options: %s", guestfs_last_error (g));
2095 mount_vfs (g, options, vfstype, device, mountpoint)
2104 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
2106 croak ("mount_vfs: %s", guestfs_last_error (g));
2109 debug (g, subcmd, extraargs)
2116 result = guestfs_debug (g, subcmd, extraargs);
2119 croak ("debug: %s", guestfs_last_error (g));
2120 RETVAL = newSVpv (result, 0);
2126 lvremove (g, device)
2132 r = guestfs_lvremove (g, device);
2134 croak ("lvremove: %s", guestfs_last_error (g));
2137 vgremove (g, vgname)
2143 r = guestfs_vgremove (g, vgname);
2145 croak ("vgremove: %s", guestfs_last_error (g));
2148 pvremove (g, device)
2154 r = guestfs_pvremove (g, device);
2156 croak ("pvremove: %s", guestfs_last_error (g));
2159 set_e2label (g, device, label)
2166 r = guestfs_set_e2label (g, device, label);
2168 croak ("set_e2label: %s", guestfs_last_error (g));
2171 get_e2label (g, device)
2177 label = guestfs_get_e2label (g, device);
2179 croak ("get_e2label: %s", guestfs_last_error (g));
2180 RETVAL = newSVpv (label, 0);
2186 set_e2uuid (g, device, uuid)
2193 r = guestfs_set_e2uuid (g, device, uuid);
2195 croak ("set_e2uuid: %s", guestfs_last_error (g));
2198 get_e2uuid (g, device)
2204 uuid = guestfs_get_e2uuid (g, device);
2206 croak ("get_e2uuid: %s", guestfs_last_error (g));
2207 RETVAL = newSVpv (uuid, 0);
2213 fsck (g, fstype, device)
2220 status = guestfs_fsck (g, fstype, device);
2222 croak ("fsck: %s", guestfs_last_error (g));
2223 RETVAL = newSViv (status);
2234 r = guestfs_zero (g, device);
2236 croak ("zero: %s", guestfs_last_error (g));
2239 grub_install (g, root, device)
2246 r = guestfs_grub_install (g, root, device);
2248 croak ("grub_install: %s", guestfs_last_error (g));
2258 r = guestfs_cp (g, src, dest);
2260 croak ("cp: %s", guestfs_last_error (g));
2270 r = guestfs_cp_a (g, src, dest);
2272 croak ("cp_a: %s", guestfs_last_error (g));
2282 r = guestfs_mv (g, src, dest);
2284 croak ("mv: %s", guestfs_last_error (g));
2287 drop_caches (g, whattodrop)
2293 r = guestfs_drop_caches (g, whattodrop);
2295 croak ("drop_caches: %s", guestfs_last_error (g));
2303 kmsgs = guestfs_dmesg (g);
2305 croak ("dmesg: %s", guestfs_last_error (g));
2306 RETVAL = newSVpv (kmsgs, 0);
2317 r = guestfs_ping_daemon (g);
2319 croak ("ping_daemon: %s", guestfs_last_error (g));
2322 equal (g, file1, file2)
2329 equality = guestfs_equal (g, file1, file2);
2331 croak ("equal: %s", guestfs_last_error (g));
2332 RETVAL = newSViv (equality);
2344 stringsout = guestfs_strings (g, path);
2345 if (stringsout == NULL)
2346 croak ("strings: %s", guestfs_last_error (g));
2347 for (n = 0; stringsout[n] != NULL; ++n) /**/;
2349 for (i = 0; i < n; ++i) {
2350 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
2351 free (stringsout[i]);
2356 strings_e (g, encoding, path)
2364 stringsout = guestfs_strings_e (g, encoding, path);
2365 if (stringsout == NULL)
2366 croak ("strings_e: %s", guestfs_last_error (g));
2367 for (n = 0; stringsout[n] != NULL; ++n) /**/;
2369 for (i = 0; i < n; ++i) {
2370 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
2371 free (stringsout[i]);
2382 dump = guestfs_hexdump (g, path);
2384 croak ("hexdump: %s", guestfs_last_error (g));
2385 RETVAL = newSVpv (dump, 0);
2391 zerofree (g, device)
2397 r = guestfs_zerofree (g, device);
2399 croak ("zerofree: %s", guestfs_last_error (g));
2402 pvresize (g, device)
2408 r = guestfs_pvresize (g, device);
2410 croak ("pvresize: %s", guestfs_last_error (g));
2413 sfdisk_N (g, device, partnum, cyls, heads, sectors, line)
2424 r = guestfs_sfdisk_N (g, device, partnum, cyls, heads, sectors, line);
2426 croak ("sfdisk_N: %s", guestfs_last_error (g));
2429 sfdisk_l (g, device)
2435 partitions = guestfs_sfdisk_l (g, device);
2436 if (partitions == NULL)
2437 croak ("sfdisk_l: %s", guestfs_last_error (g));
2438 RETVAL = newSVpv (partitions, 0);
2444 sfdisk_kernel_geometry (g, device)
2450 partitions = guestfs_sfdisk_kernel_geometry (g, device);
2451 if (partitions == NULL)
2452 croak ("sfdisk_kernel_geometry: %s", guestfs_last_error (g));
2453 RETVAL = newSVpv (partitions, 0);
2459 sfdisk_disk_geometry (g, device)
2465 partitions = guestfs_sfdisk_disk_geometry (g, device);
2466 if (partitions == NULL)
2467 croak ("sfdisk_disk_geometry: %s", guestfs_last_error (g));
2468 RETVAL = newSVpv (partitions, 0);
2474 vg_activate_all (g, activate)
2480 r = guestfs_vg_activate_all (g, activate);
2482 croak ("vg_activate_all: %s", guestfs_last_error (g));
2485 vg_activate (g, activate, volgroups)
2492 r = guestfs_vg_activate (g, activate, volgroups);
2495 croak ("vg_activate: %s", guestfs_last_error (g));
2498 lvresize (g, device, mbytes)
2505 r = guestfs_lvresize (g, device, mbytes);
2507 croak ("lvresize: %s", guestfs_last_error (g));
2510 resize2fs (g, device)
2516 r = guestfs_resize2fs (g, device);
2518 croak ("resize2fs: %s", guestfs_last_error (g));
2528 names = guestfs_find (g, directory);
2530 croak ("find: %s", guestfs_last_error (g));
2531 for (n = 0; names[n] != NULL; ++n) /**/;
2533 for (i = 0; i < n; ++i) {
2534 PUSHs (sv_2mortal (newSVpv (names[i], 0)));
2540 e2fsck_f (g, device)
2546 r = guestfs_e2fsck_f (g, device);
2548 croak ("e2fsck_f: %s", guestfs_last_error (g));
2557 r = guestfs_sleep (g, secs);
2559 croak ("sleep: %s", guestfs_last_error (g));
2562 ntfs_3g_probe (g, rw, device)
2569 status = guestfs_ntfs_3g_probe (g, rw, device);
2571 croak ("ntfs_3g_probe: %s", guestfs_last_error (g));
2572 RETVAL = newSViv (status);
2583 output = guestfs_sh (g, command);
2585 croak ("sh: %s", guestfs_last_error (g));
2586 RETVAL = newSVpv (output, 0);
2592 sh_lines (g, command)
2599 lines = guestfs_sh_lines (g, command);
2601 croak ("sh_lines: %s", guestfs_last_error (g));
2602 for (n = 0; lines[n] != NULL; ++n) /**/;
2604 for (i = 0; i < n; ++i) {
2605 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2611 glob_expand (g, pattern)
2618 paths = guestfs_glob_expand (g, pattern);
2620 croak ("glob_expand: %s", guestfs_last_error (g));
2621 for (n = 0; paths[n] != NULL; ++n) /**/;
2623 for (i = 0; i < n; ++i) {
2624 PUSHs (sv_2mortal (newSVpv (paths[i], 0)));
2630 scrub_device (g, device)
2636 r = guestfs_scrub_device (g, device);
2638 croak ("scrub_device: %s", guestfs_last_error (g));
2641 scrub_file (g, file)
2647 r = guestfs_scrub_file (g, file);
2649 croak ("scrub_file: %s", guestfs_last_error (g));
2652 scrub_freespace (g, dir)
2658 r = guestfs_scrub_freespace (g, dir);
2660 croak ("scrub_freespace: %s", guestfs_last_error (g));
2663 mkdtemp (g, template)
2669 dir = guestfs_mkdtemp (g, template);
2671 croak ("mkdtemp: %s", guestfs_last_error (g));
2672 RETVAL = newSVpv (dir, 0);
2684 lines = guestfs_wc_l (g, path);
2686 croak ("wc_l: %s", guestfs_last_error (g));
2687 RETVAL = newSViv (lines);
2698 words = guestfs_wc_w (g, path);
2700 croak ("wc_w: %s", guestfs_last_error (g));
2701 RETVAL = newSViv (words);
2712 chars = guestfs_wc_c (g, path);
2714 croak ("wc_c: %s", guestfs_last_error (g));
2715 RETVAL = newSViv (chars);
2727 lines = guestfs_head (g, path);
2729 croak ("head: %s", guestfs_last_error (g));
2730 for (n = 0; lines[n] != NULL; ++n) /**/;
2732 for (i = 0; i < n; ++i) {
2733 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2739 head_n (g, nrlines, path)
2747 lines = guestfs_head_n (g, nrlines, path);
2749 croak ("head_n: %s", guestfs_last_error (g));
2750 for (n = 0; lines[n] != NULL; ++n) /**/;
2752 for (i = 0; i < n; ++i) {
2753 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2766 lines = guestfs_tail (g, path);
2768 croak ("tail: %s", guestfs_last_error (g));
2769 for (n = 0; lines[n] != NULL; ++n) /**/;
2771 for (i = 0; i < n; ++i) {
2772 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2778 tail_n (g, nrlines, path)
2786 lines = guestfs_tail_n (g, nrlines, path);
2788 croak ("tail_n: %s", guestfs_last_error (g));
2789 for (n = 0; lines[n] != NULL; ++n) /**/;
2791 for (i = 0; i < n; ++i) {
2792 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2803 output = guestfs_df (g);
2805 croak ("df: %s", guestfs_last_error (g));
2806 RETVAL = newSVpv (output, 0);
2817 output = guestfs_df_h (g);
2819 croak ("df_h: %s", guestfs_last_error (g));
2820 RETVAL = newSVpv (output, 0);
2832 sizekb = guestfs_du (g, path);
2834 croak ("du: %s", guestfs_last_error (g));
2835 RETVAL = my_newSVll (sizekb);
2840 initrd_list (g, path)
2847 filenames = guestfs_initrd_list (g, path);
2848 if (filenames == NULL)
2849 croak ("initrd_list: %s", guestfs_last_error (g));
2850 for (n = 0; filenames[n] != NULL; ++n) /**/;
2852 for (i = 0; i < n; ++i) {
2853 PUSHs (sv_2mortal (newSVpv (filenames[i], 0)));
2854 free (filenames[i]);
2859 mount_loop (g, file, mountpoint)
2866 r = guestfs_mount_loop (g, file, mountpoint);
2868 croak ("mount_loop: %s", guestfs_last_error (g));
2877 r = guestfs_mkswap (g, device);
2879 croak ("mkswap: %s", guestfs_last_error (g));
2882 mkswap_L (g, label, device)
2889 r = guestfs_mkswap_L (g, label, device);
2891 croak ("mkswap_L: %s", guestfs_last_error (g));
2894 mkswap_U (g, uuid, device)
2901 r = guestfs_mkswap_U (g, uuid, device);
2903 croak ("mkswap_U: %s", guestfs_last_error (g));