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 mount (g, device, mountpoint)
972 r = guestfs_mount (g, device, mountpoint);
974 croak ("mount: %s", guestfs_last_error (g));
982 r = guestfs_sync (g);
984 croak ("sync: %s", guestfs_last_error (g));
993 r = guestfs_touch (g, path);
995 croak ("touch: %s", guestfs_last_error (g));
1004 content = guestfs_cat (g, path);
1005 if (content == NULL)
1006 croak ("cat: %s", guestfs_last_error (g));
1007 RETVAL = newSVpv (content, 0);
1019 listing = guestfs_ll (g, directory);
1020 if (listing == NULL)
1021 croak ("ll: %s", guestfs_last_error (g));
1022 RETVAL = newSVpv (listing, 0);
1035 listing = guestfs_ls (g, directory);
1036 if (listing == NULL)
1037 croak ("ls: %s", guestfs_last_error (g));
1038 for (n = 0; listing[n] != NULL; ++n) /**/;
1040 for (i = 0; i < n; ++i) {
1041 PUSHs (sv_2mortal (newSVpv (listing[i], 0)));
1053 devices = guestfs_list_devices (g);
1054 if (devices == NULL)
1055 croak ("list_devices: %s", guestfs_last_error (g));
1056 for (n = 0; devices[n] != NULL; ++n) /**/;
1058 for (i = 0; i < n; ++i) {
1059 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1071 partitions = guestfs_list_partitions (g);
1072 if (partitions == NULL)
1073 croak ("list_partitions: %s", guestfs_last_error (g));
1074 for (n = 0; partitions[n] != NULL; ++n) /**/;
1076 for (i = 0; i < n; ++i) {
1077 PUSHs (sv_2mortal (newSVpv (partitions[i], 0)));
1078 free (partitions[i]);
1089 physvols = guestfs_pvs (g);
1090 if (physvols == NULL)
1091 croak ("pvs: %s", guestfs_last_error (g));
1092 for (n = 0; physvols[n] != NULL; ++n) /**/;
1094 for (i = 0; i < n; ++i) {
1095 PUSHs (sv_2mortal (newSVpv (physvols[i], 0)));
1107 volgroups = guestfs_vgs (g);
1108 if (volgroups == NULL)
1109 croak ("vgs: %s", guestfs_last_error (g));
1110 for (n = 0; volgroups[n] != NULL; ++n) /**/;
1112 for (i = 0; i < n; ++i) {
1113 PUSHs (sv_2mortal (newSVpv (volgroups[i], 0)));
1114 free (volgroups[i]);
1125 logvols = guestfs_lvs (g);
1126 if (logvols == NULL)
1127 croak ("lvs: %s", guestfs_last_error (g));
1128 for (n = 0; logvols[n] != NULL; ++n) /**/;
1130 for (i = 0; i < n; ++i) {
1131 PUSHs (sv_2mortal (newSVpv (logvols[i], 0)));
1140 struct guestfs_lvm_pv_list *physvols;
1144 physvols = guestfs_pvs_full (g);
1145 if (physvols == NULL)
1146 croak ("pvs_full: %s", guestfs_last_error (g));
1147 EXTEND (SP, physvols->len);
1148 for (i = 0; i < physvols->len; ++i) {
1150 (void) hv_store (hv, "pv_name", 7, newSVpv (physvols->val[i].pv_name, 0), 0);
1151 (void) hv_store (hv, "pv_uuid", 7, newSVpv (physvols->val[i].pv_uuid, 32), 0);
1152 (void) hv_store (hv, "pv_fmt", 6, newSVpv (physvols->val[i].pv_fmt, 0), 0);
1153 (void) hv_store (hv, "pv_size", 7, my_newSVull (physvols->val[i].pv_size), 0);
1154 (void) hv_store (hv, "dev_size", 8, my_newSVull (physvols->val[i].dev_size), 0);
1155 (void) hv_store (hv, "pv_free", 7, my_newSVull (physvols->val[i].pv_free), 0);
1156 (void) hv_store (hv, "pv_used", 7, my_newSVull (physvols->val[i].pv_used), 0);
1157 (void) hv_store (hv, "pv_attr", 7, newSVpv (physvols->val[i].pv_attr, 0), 0);
1158 (void) hv_store (hv, "pv_pe_count", 11, my_newSVll (physvols->val[i].pv_pe_count), 0);
1159 (void) hv_store (hv, "pv_pe_alloc_count", 17, my_newSVll (physvols->val[i].pv_pe_alloc_count), 0);
1160 (void) hv_store (hv, "pv_tags", 7, newSVpv (physvols->val[i].pv_tags, 0), 0);
1161 (void) hv_store (hv, "pe_start", 8, my_newSVull (physvols->val[i].pe_start), 0);
1162 (void) hv_store (hv, "pv_mda_count", 12, my_newSVll (physvols->val[i].pv_mda_count), 0);
1163 (void) hv_store (hv, "pv_mda_free", 11, my_newSVull (physvols->val[i].pv_mda_free), 0);
1164 PUSHs (sv_2mortal ((SV *) hv));
1166 guestfs_free_lvm_pv_list (physvols);
1172 struct guestfs_lvm_vg_list *volgroups;
1176 volgroups = guestfs_vgs_full (g);
1177 if (volgroups == NULL)
1178 croak ("vgs_full: %s", guestfs_last_error (g));
1179 EXTEND (SP, volgroups->len);
1180 for (i = 0; i < volgroups->len; ++i) {
1182 (void) hv_store (hv, "vg_name", 7, newSVpv (volgroups->val[i].vg_name, 0), 0);
1183 (void) hv_store (hv, "vg_uuid", 7, newSVpv (volgroups->val[i].vg_uuid, 32), 0);
1184 (void) hv_store (hv, "vg_fmt", 6, newSVpv (volgroups->val[i].vg_fmt, 0), 0);
1185 (void) hv_store (hv, "vg_attr", 7, newSVpv (volgroups->val[i].vg_attr, 0), 0);
1186 (void) hv_store (hv, "vg_size", 7, my_newSVull (volgroups->val[i].vg_size), 0);
1187 (void) hv_store (hv, "vg_free", 7, my_newSVull (volgroups->val[i].vg_free), 0);
1188 (void) hv_store (hv, "vg_sysid", 8, newSVpv (volgroups->val[i].vg_sysid, 0), 0);
1189 (void) hv_store (hv, "vg_extent_size", 14, my_newSVull (volgroups->val[i].vg_extent_size), 0);
1190 (void) hv_store (hv, "vg_extent_count", 15, my_newSVll (volgroups->val[i].vg_extent_count), 0);
1191 (void) hv_store (hv, "vg_free_count", 13, my_newSVll (volgroups->val[i].vg_free_count), 0);
1192 (void) hv_store (hv, "max_lv", 6, my_newSVll (volgroups->val[i].max_lv), 0);
1193 (void) hv_store (hv, "max_pv", 6, my_newSVll (volgroups->val[i].max_pv), 0);
1194 (void) hv_store (hv, "pv_count", 8, my_newSVll (volgroups->val[i].pv_count), 0);
1195 (void) hv_store (hv, "lv_count", 8, my_newSVll (volgroups->val[i].lv_count), 0);
1196 (void) hv_store (hv, "snap_count", 10, my_newSVll (volgroups->val[i].snap_count), 0);
1197 (void) hv_store (hv, "vg_seqno", 8, my_newSVll (volgroups->val[i].vg_seqno), 0);
1198 (void) hv_store (hv, "vg_tags", 7, newSVpv (volgroups->val[i].vg_tags, 0), 0);
1199 (void) hv_store (hv, "vg_mda_count", 12, my_newSVll (volgroups->val[i].vg_mda_count), 0);
1200 (void) hv_store (hv, "vg_mda_free", 11, my_newSVull (volgroups->val[i].vg_mda_free), 0);
1201 PUSHs (sv_2mortal ((SV *) hv));
1203 guestfs_free_lvm_vg_list (volgroups);
1209 struct guestfs_lvm_lv_list *logvols;
1213 logvols = guestfs_lvs_full (g);
1214 if (logvols == NULL)
1215 croak ("lvs_full: %s", guestfs_last_error (g));
1216 EXTEND (SP, logvols->len);
1217 for (i = 0; i < logvols->len; ++i) {
1219 (void) hv_store (hv, "lv_name", 7, newSVpv (logvols->val[i].lv_name, 0), 0);
1220 (void) hv_store (hv, "lv_uuid", 7, newSVpv (logvols->val[i].lv_uuid, 32), 0);
1221 (void) hv_store (hv, "lv_attr", 7, newSVpv (logvols->val[i].lv_attr, 0), 0);
1222 (void) hv_store (hv, "lv_major", 8, my_newSVll (logvols->val[i].lv_major), 0);
1223 (void) hv_store (hv, "lv_minor", 8, my_newSVll (logvols->val[i].lv_minor), 0);
1224 (void) hv_store (hv, "lv_kernel_major", 15, my_newSVll (logvols->val[i].lv_kernel_major), 0);
1225 (void) hv_store (hv, "lv_kernel_minor", 15, my_newSVll (logvols->val[i].lv_kernel_minor), 0);
1226 (void) hv_store (hv, "lv_size", 7, my_newSVull (logvols->val[i].lv_size), 0);
1227 (void) hv_store (hv, "seg_count", 9, my_newSVll (logvols->val[i].seg_count), 0);
1228 (void) hv_store (hv, "origin", 6, newSVpv (logvols->val[i].origin, 0), 0);
1229 (void) hv_store (hv, "snap_percent", 12, newSVnv (logvols->val[i].snap_percent), 0);
1230 (void) hv_store (hv, "copy_percent", 12, newSVnv (logvols->val[i].copy_percent), 0);
1231 (void) hv_store (hv, "move_pv", 7, newSVpv (logvols->val[i].move_pv, 0), 0);
1232 (void) hv_store (hv, "lv_tags", 7, newSVpv (logvols->val[i].lv_tags, 0), 0);
1233 (void) hv_store (hv, "mirror_log", 10, newSVpv (logvols->val[i].mirror_log, 0), 0);
1234 (void) hv_store (hv, "modules", 7, newSVpv (logvols->val[i].modules, 0), 0);
1235 PUSHs (sv_2mortal ((SV *) hv));
1237 guestfs_free_lvm_lv_list (logvols);
1240 read_lines (g, path)
1247 lines = guestfs_read_lines (g, path);
1249 croak ("read_lines: %s", guestfs_last_error (g));
1250 for (n = 0; lines[n] != NULL; ++n) /**/;
1252 for (i = 0; i < n; ++i) {
1253 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1259 aug_init (g, root, flags)
1266 r = guestfs_aug_init (g, root, flags);
1268 croak ("aug_init: %s", guestfs_last_error (g));
1276 r = guestfs_aug_close (g);
1278 croak ("aug_close: %s", guestfs_last_error (g));
1281 aug_defvar (g, name, expr)
1284 char *expr = SvOK(ST(2)) ? SvPV_nolen(ST(2)) : NULL;
1288 nrnodes = guestfs_aug_defvar (g, name, expr);
1290 croak ("aug_defvar: %s", guestfs_last_error (g));
1291 RETVAL = newSViv (nrnodes);
1296 aug_defnode (g, name, expr, val)
1302 struct guestfs_int_bool *r;
1304 r = guestfs_aug_defnode (g, name, expr, val);
1306 croak ("aug_defnode: %s", guestfs_last_error (g));
1308 PUSHs (sv_2mortal (newSViv (r->i)));
1309 PUSHs (sv_2mortal (newSViv (r->b)));
1310 guestfs_free_int_bool (r);
1319 val = guestfs_aug_get (g, path);
1321 croak ("aug_get: %s", guestfs_last_error (g));
1322 RETVAL = newSVpv (val, 0);
1328 aug_set (g, path, val)
1335 r = guestfs_aug_set (g, path, val);
1337 croak ("aug_set: %s", guestfs_last_error (g));
1340 aug_insert (g, path, label, before)
1348 r = guestfs_aug_insert (g, path, label, before);
1350 croak ("aug_insert: %s", guestfs_last_error (g));
1359 nrnodes = guestfs_aug_rm (g, path);
1361 croak ("aug_rm: %s", guestfs_last_error (g));
1362 RETVAL = newSViv (nrnodes);
1367 aug_mv (g, src, dest)
1374 r = guestfs_aug_mv (g, src, dest);
1376 croak ("aug_mv: %s", guestfs_last_error (g));
1386 matches = guestfs_aug_match (g, path);
1387 if (matches == NULL)
1388 croak ("aug_match: %s", guestfs_last_error (g));
1389 for (n = 0; matches[n] != NULL; ++n) /**/;
1391 for (i = 0; i < n; ++i) {
1392 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
1403 r = guestfs_aug_save (g);
1405 croak ("aug_save: %s", guestfs_last_error (g));
1413 r = guestfs_aug_load (g);
1415 croak ("aug_load: %s", guestfs_last_error (g));
1425 matches = guestfs_aug_ls (g, path);
1426 if (matches == NULL)
1427 croak ("aug_ls: %s", guestfs_last_error (g));
1428 for (n = 0; matches[n] != NULL; ++n) /**/;
1430 for (i = 0; i < n; ++i) {
1431 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
1443 r = guestfs_rm (g, path);
1445 croak ("rm: %s", guestfs_last_error (g));
1454 r = guestfs_rmdir (g, path);
1456 croak ("rmdir: %s", guestfs_last_error (g));
1465 r = guestfs_rm_rf (g, path);
1467 croak ("rm_rf: %s", guestfs_last_error (g));
1476 r = guestfs_mkdir (g, path);
1478 croak ("mkdir: %s", guestfs_last_error (g));
1487 r = guestfs_mkdir_p (g, path);
1489 croak ("mkdir_p: %s", guestfs_last_error (g));
1492 chmod (g, mode, path)
1499 r = guestfs_chmod (g, mode, path);
1501 croak ("chmod: %s", guestfs_last_error (g));
1504 chown (g, owner, group, path)
1512 r = guestfs_chown (g, owner, group, path);
1514 croak ("chown: %s", guestfs_last_error (g));
1523 existsflag = guestfs_exists (g, path);
1524 if (existsflag == -1)
1525 croak ("exists: %s", guestfs_last_error (g));
1526 RETVAL = newSViv (existsflag);
1537 fileflag = guestfs_is_file (g, path);
1539 croak ("is_file: %s", guestfs_last_error (g));
1540 RETVAL = newSViv (fileflag);
1551 dirflag = guestfs_is_dir (g, path);
1553 croak ("is_dir: %s", guestfs_last_error (g));
1554 RETVAL = newSViv (dirflag);
1559 pvcreate (g, device)
1565 r = guestfs_pvcreate (g, device);
1567 croak ("pvcreate: %s", guestfs_last_error (g));
1570 vgcreate (g, volgroup, physvols)
1577 r = guestfs_vgcreate (g, volgroup, physvols);
1580 croak ("vgcreate: %s", guestfs_last_error (g));
1583 lvcreate (g, logvol, volgroup, mbytes)
1591 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
1593 croak ("lvcreate: %s", guestfs_last_error (g));
1596 mkfs (g, fstype, device)
1603 r = guestfs_mkfs (g, fstype, device);
1605 croak ("mkfs: %s", guestfs_last_error (g));
1608 sfdisk (g, device, cyls, heads, sectors, lines)
1618 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1621 croak ("sfdisk: %s", guestfs_last_error (g));
1624 write_file (g, path, content, size)
1632 r = guestfs_write_file (g, path, content, size);
1634 croak ("write_file: %s", guestfs_last_error (g));
1637 umount (g, pathordevice)
1643 r = guestfs_umount (g, pathordevice);
1645 croak ("umount: %s", guestfs_last_error (g));
1654 devices = guestfs_mounts (g);
1655 if (devices == NULL)
1656 croak ("mounts: %s", guestfs_last_error (g));
1657 for (n = 0; devices[n] != NULL; ++n) /**/;
1659 for (i = 0; i < n; ++i) {
1660 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1671 r = guestfs_umount_all (g);
1673 croak ("umount_all: %s", guestfs_last_error (g));
1681 r = guestfs_lvm_remove_all (g);
1683 croak ("lvm_remove_all: %s", guestfs_last_error (g));
1692 description = guestfs_file (g, path);
1693 if (description == NULL)
1694 croak ("file: %s", guestfs_last_error (g));
1695 RETVAL = newSVpv (description, 0);
1701 command (g, arguments)
1707 output = guestfs_command (g, arguments);
1710 croak ("command: %s", guestfs_last_error (g));
1711 RETVAL = newSVpv (output, 0);
1717 command_lines (g, arguments)
1724 lines = guestfs_command_lines (g, arguments);
1727 croak ("command_lines: %s", guestfs_last_error (g));
1728 for (n = 0; lines[n] != NULL; ++n) /**/;
1730 for (i = 0; i < n; ++i) {
1731 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1741 struct guestfs_stat *statbuf;
1743 statbuf = guestfs_stat (g, path);
1744 if (statbuf == NULL)
1745 croak ("stat: %s", guestfs_last_error (g));
1747 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1748 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1749 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1750 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1751 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1752 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1753 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1754 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1755 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1756 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1757 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1758 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1759 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1767 struct guestfs_stat *statbuf;
1769 statbuf = guestfs_lstat (g, path);
1770 if (statbuf == NULL)
1771 croak ("lstat: %s", guestfs_last_error (g));
1773 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1774 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1775 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1776 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1777 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1778 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1779 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1780 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1781 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1782 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1783 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1784 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1785 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1793 struct guestfs_statvfs *statbuf;
1795 statbuf = guestfs_statvfs (g, path);
1796 if (statbuf == NULL)
1797 croak ("statvfs: %s", guestfs_last_error (g));
1799 PUSHs (sv_2mortal (my_newSVll (statbuf->bsize)));
1800 PUSHs (sv_2mortal (my_newSVll (statbuf->frsize)));
1801 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1802 PUSHs (sv_2mortal (my_newSVll (statbuf->bfree)));
1803 PUSHs (sv_2mortal (my_newSVll (statbuf->bavail)));
1804 PUSHs (sv_2mortal (my_newSVll (statbuf->files)));
1805 PUSHs (sv_2mortal (my_newSVll (statbuf->ffree)));
1806 PUSHs (sv_2mortal (my_newSVll (statbuf->favail)));
1807 PUSHs (sv_2mortal (my_newSVll (statbuf->fsid)));
1808 PUSHs (sv_2mortal (my_newSVll (statbuf->flag)));
1809 PUSHs (sv_2mortal (my_newSVll (statbuf->namemax)));
1813 tune2fs_l (g, device)
1820 superblock = guestfs_tune2fs_l (g, device);
1821 if (superblock == NULL)
1822 croak ("tune2fs_l: %s", guestfs_last_error (g));
1823 for (n = 0; superblock[n] != NULL; ++n) /**/;
1825 for (i = 0; i < n; ++i) {
1826 PUSHs (sv_2mortal (newSVpv (superblock[i], 0)));
1827 free (superblock[i]);
1832 blockdev_setro (g, device)
1838 r = guestfs_blockdev_setro (g, device);
1840 croak ("blockdev_setro: %s", guestfs_last_error (g));
1843 blockdev_setrw (g, device)
1849 r = guestfs_blockdev_setrw (g, device);
1851 croak ("blockdev_setrw: %s", guestfs_last_error (g));
1854 blockdev_getro (g, device)
1860 ro = guestfs_blockdev_getro (g, device);
1862 croak ("blockdev_getro: %s", guestfs_last_error (g));
1863 RETVAL = newSViv (ro);
1868 blockdev_getss (g, device)
1874 sectorsize = guestfs_blockdev_getss (g, device);
1875 if (sectorsize == -1)
1876 croak ("blockdev_getss: %s", guestfs_last_error (g));
1877 RETVAL = newSViv (sectorsize);
1882 blockdev_getbsz (g, device)
1888 blocksize = guestfs_blockdev_getbsz (g, device);
1889 if (blocksize == -1)
1890 croak ("blockdev_getbsz: %s", guestfs_last_error (g));
1891 RETVAL = newSViv (blocksize);
1896 blockdev_setbsz (g, device, blocksize)
1903 r = guestfs_blockdev_setbsz (g, device, blocksize);
1905 croak ("blockdev_setbsz: %s", guestfs_last_error (g));
1908 blockdev_getsz (g, device)
1912 int64_t sizeinsectors;
1914 sizeinsectors = guestfs_blockdev_getsz (g, device);
1915 if (sizeinsectors == -1)
1916 croak ("blockdev_getsz: %s", guestfs_last_error (g));
1917 RETVAL = my_newSVll (sizeinsectors);
1922 blockdev_getsize64 (g, device)
1926 int64_t sizeinbytes;
1928 sizeinbytes = guestfs_blockdev_getsize64 (g, device);
1929 if (sizeinbytes == -1)
1930 croak ("blockdev_getsize64: %s", guestfs_last_error (g));
1931 RETVAL = my_newSVll (sizeinbytes);
1936 blockdev_flushbufs (g, device)
1942 r = guestfs_blockdev_flushbufs (g, device);
1944 croak ("blockdev_flushbufs: %s", guestfs_last_error (g));
1947 blockdev_rereadpt (g, device)
1953 r = guestfs_blockdev_rereadpt (g, device);
1955 croak ("blockdev_rereadpt: %s", guestfs_last_error (g));
1958 upload (g, filename, remotefilename)
1961 char *remotefilename;
1965 r = guestfs_upload (g, filename, remotefilename);
1967 croak ("upload: %s", guestfs_last_error (g));
1970 download (g, remotefilename, filename)
1972 char *remotefilename;
1977 r = guestfs_download (g, remotefilename, filename);
1979 croak ("download: %s", guestfs_last_error (g));
1982 checksum (g, csumtype, path)
1989 checksum = guestfs_checksum (g, csumtype, path);
1990 if (checksum == NULL)
1991 croak ("checksum: %s", guestfs_last_error (g));
1992 RETVAL = newSVpv (checksum, 0);
1998 tar_in (g, tarfile, directory)
2005 r = guestfs_tar_in (g, tarfile, directory);
2007 croak ("tar_in: %s", guestfs_last_error (g));
2010 tar_out (g, directory, tarfile)
2017 r = guestfs_tar_out (g, directory, tarfile);
2019 croak ("tar_out: %s", guestfs_last_error (g));
2022 tgz_in (g, tarball, directory)
2029 r = guestfs_tgz_in (g, tarball, directory);
2031 croak ("tgz_in: %s", guestfs_last_error (g));
2034 tgz_out (g, directory, tarball)
2041 r = guestfs_tgz_out (g, directory, tarball);
2043 croak ("tgz_out: %s", guestfs_last_error (g));
2046 mount_ro (g, device, mountpoint)
2053 r = guestfs_mount_ro (g, device, mountpoint);
2055 croak ("mount_ro: %s", guestfs_last_error (g));
2058 mount_options (g, options, device, mountpoint)
2066 r = guestfs_mount_options (g, options, device, mountpoint);
2068 croak ("mount_options: %s", guestfs_last_error (g));
2071 mount_vfs (g, options, vfstype, device, mountpoint)
2080 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
2082 croak ("mount_vfs: %s", guestfs_last_error (g));
2085 debug (g, subcmd, extraargs)
2092 result = guestfs_debug (g, subcmd, extraargs);
2095 croak ("debug: %s", guestfs_last_error (g));
2096 RETVAL = newSVpv (result, 0);
2102 lvremove (g, device)
2108 r = guestfs_lvremove (g, device);
2110 croak ("lvremove: %s", guestfs_last_error (g));
2113 vgremove (g, vgname)
2119 r = guestfs_vgremove (g, vgname);
2121 croak ("vgremove: %s", guestfs_last_error (g));
2124 pvremove (g, device)
2130 r = guestfs_pvremove (g, device);
2132 croak ("pvremove: %s", guestfs_last_error (g));
2135 set_e2label (g, device, label)
2142 r = guestfs_set_e2label (g, device, label);
2144 croak ("set_e2label: %s", guestfs_last_error (g));
2147 get_e2label (g, device)
2153 label = guestfs_get_e2label (g, device);
2155 croak ("get_e2label: %s", guestfs_last_error (g));
2156 RETVAL = newSVpv (label, 0);
2162 set_e2uuid (g, device, uuid)
2169 r = guestfs_set_e2uuid (g, device, uuid);
2171 croak ("set_e2uuid: %s", guestfs_last_error (g));
2174 get_e2uuid (g, device)
2180 uuid = guestfs_get_e2uuid (g, device);
2182 croak ("get_e2uuid: %s", guestfs_last_error (g));
2183 RETVAL = newSVpv (uuid, 0);
2189 fsck (g, fstype, device)
2196 status = guestfs_fsck (g, fstype, device);
2198 croak ("fsck: %s", guestfs_last_error (g));
2199 RETVAL = newSViv (status);
2210 r = guestfs_zero (g, device);
2212 croak ("zero: %s", guestfs_last_error (g));
2215 grub_install (g, root, device)
2222 r = guestfs_grub_install (g, root, device);
2224 croak ("grub_install: %s", guestfs_last_error (g));
2234 r = guestfs_cp (g, src, dest);
2236 croak ("cp: %s", guestfs_last_error (g));
2246 r = guestfs_cp_a (g, src, dest);
2248 croak ("cp_a: %s", guestfs_last_error (g));
2258 r = guestfs_mv (g, src, dest);
2260 croak ("mv: %s", guestfs_last_error (g));
2263 drop_caches (g, whattodrop)
2269 r = guestfs_drop_caches (g, whattodrop);
2271 croak ("drop_caches: %s", guestfs_last_error (g));
2279 kmsgs = guestfs_dmesg (g);
2281 croak ("dmesg: %s", guestfs_last_error (g));
2282 RETVAL = newSVpv (kmsgs, 0);
2293 r = guestfs_ping_daemon (g);
2295 croak ("ping_daemon: %s", guestfs_last_error (g));
2298 equal (g, file1, file2)
2305 equality = guestfs_equal (g, file1, file2);
2307 croak ("equal: %s", guestfs_last_error (g));
2308 RETVAL = newSViv (equality);
2320 stringsout = guestfs_strings (g, path);
2321 if (stringsout == NULL)
2322 croak ("strings: %s", guestfs_last_error (g));
2323 for (n = 0; stringsout[n] != NULL; ++n) /**/;
2325 for (i = 0; i < n; ++i) {
2326 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
2327 free (stringsout[i]);
2332 strings_e (g, encoding, path)
2340 stringsout = guestfs_strings_e (g, encoding, path);
2341 if (stringsout == NULL)
2342 croak ("strings_e: %s", guestfs_last_error (g));
2343 for (n = 0; stringsout[n] != NULL; ++n) /**/;
2345 for (i = 0; i < n; ++i) {
2346 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
2347 free (stringsout[i]);
2358 dump = guestfs_hexdump (g, path);
2360 croak ("hexdump: %s", guestfs_last_error (g));
2361 RETVAL = newSVpv (dump, 0);
2367 zerofree (g, device)
2373 r = guestfs_zerofree (g, device);
2375 croak ("zerofree: %s", guestfs_last_error (g));
2378 pvresize (g, device)
2384 r = guestfs_pvresize (g, device);
2386 croak ("pvresize: %s", guestfs_last_error (g));
2389 sfdisk_N (g, device, partnum, cyls, heads, sectors, line)
2400 r = guestfs_sfdisk_N (g, device, partnum, cyls, heads, sectors, line);
2402 croak ("sfdisk_N: %s", guestfs_last_error (g));
2405 sfdisk_l (g, device)
2411 partitions = guestfs_sfdisk_l (g, device);
2412 if (partitions == NULL)
2413 croak ("sfdisk_l: %s", guestfs_last_error (g));
2414 RETVAL = newSVpv (partitions, 0);
2420 sfdisk_kernel_geometry (g, device)
2426 partitions = guestfs_sfdisk_kernel_geometry (g, device);
2427 if (partitions == NULL)
2428 croak ("sfdisk_kernel_geometry: %s", guestfs_last_error (g));
2429 RETVAL = newSVpv (partitions, 0);
2435 sfdisk_disk_geometry (g, device)
2441 partitions = guestfs_sfdisk_disk_geometry (g, device);
2442 if (partitions == NULL)
2443 croak ("sfdisk_disk_geometry: %s", guestfs_last_error (g));
2444 RETVAL = newSVpv (partitions, 0);
2450 vg_activate_all (g, activate)
2456 r = guestfs_vg_activate_all (g, activate);
2458 croak ("vg_activate_all: %s", guestfs_last_error (g));
2461 vg_activate (g, activate, volgroups)
2468 r = guestfs_vg_activate (g, activate, volgroups);
2471 croak ("vg_activate: %s", guestfs_last_error (g));
2474 lvresize (g, device, mbytes)
2481 r = guestfs_lvresize (g, device, mbytes);
2483 croak ("lvresize: %s", guestfs_last_error (g));
2486 resize2fs (g, device)
2492 r = guestfs_resize2fs (g, device);
2494 croak ("resize2fs: %s", guestfs_last_error (g));
2504 names = guestfs_find (g, directory);
2506 croak ("find: %s", guestfs_last_error (g));
2507 for (n = 0; names[n] != NULL; ++n) /**/;
2509 for (i = 0; i < n; ++i) {
2510 PUSHs (sv_2mortal (newSVpv (names[i], 0)));
2516 e2fsck_f (g, device)
2522 r = guestfs_e2fsck_f (g, device);
2524 croak ("e2fsck_f: %s", guestfs_last_error (g));
2533 r = guestfs_sleep (g, secs);
2535 croak ("sleep: %s", guestfs_last_error (g));
2538 ntfs_3g_probe (g, rw, device)
2545 status = guestfs_ntfs_3g_probe (g, rw, device);
2547 croak ("ntfs_3g_probe: %s", guestfs_last_error (g));
2548 RETVAL = newSViv (status);
2559 output = guestfs_sh (g, command);
2561 croak ("sh: %s", guestfs_last_error (g));
2562 RETVAL = newSVpv (output, 0);
2568 sh_lines (g, command)
2575 lines = guestfs_sh_lines (g, command);
2577 croak ("sh_lines: %s", guestfs_last_error (g));
2578 for (n = 0; lines[n] != NULL; ++n) /**/;
2580 for (i = 0; i < n; ++i) {
2581 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2587 glob_expand (g, pattern)
2594 paths = guestfs_glob_expand (g, pattern);
2596 croak ("glob_expand: %s", guestfs_last_error (g));
2597 for (n = 0; paths[n] != NULL; ++n) /**/;
2599 for (i = 0; i < n; ++i) {
2600 PUSHs (sv_2mortal (newSVpv (paths[i], 0)));
2606 scrub_device (g, device)
2612 r = guestfs_scrub_device (g, device);
2614 croak ("scrub_device: %s", guestfs_last_error (g));
2617 scrub_file (g, file)
2623 r = guestfs_scrub_file (g, file);
2625 croak ("scrub_file: %s", guestfs_last_error (g));
2628 scrub_freespace (g, dir)
2634 r = guestfs_scrub_freespace (g, dir);
2636 croak ("scrub_freespace: %s", guestfs_last_error (g));
2639 mkdtemp (g, template)
2645 dir = guestfs_mkdtemp (g, template);
2647 croak ("mkdtemp: %s", guestfs_last_error (g));
2648 RETVAL = newSVpv (dir, 0);
2660 lines = guestfs_wc_l (g, path);
2662 croak ("wc_l: %s", guestfs_last_error (g));
2663 RETVAL = newSViv (lines);
2674 words = guestfs_wc_w (g, path);
2676 croak ("wc_w: %s", guestfs_last_error (g));
2677 RETVAL = newSViv (words);
2688 chars = guestfs_wc_c (g, path);
2690 croak ("wc_c: %s", guestfs_last_error (g));
2691 RETVAL = newSViv (chars);
2703 lines = guestfs_head (g, path);
2705 croak ("head: %s", guestfs_last_error (g));
2706 for (n = 0; lines[n] != NULL; ++n) /**/;
2708 for (i = 0; i < n; ++i) {
2709 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2715 head_n (g, nrlines, path)
2723 lines = guestfs_head_n (g, nrlines, path);
2725 croak ("head_n: %s", guestfs_last_error (g));
2726 for (n = 0; lines[n] != NULL; ++n) /**/;
2728 for (i = 0; i < n; ++i) {
2729 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2742 lines = guestfs_tail (g, path);
2744 croak ("tail: %s", guestfs_last_error (g));
2745 for (n = 0; lines[n] != NULL; ++n) /**/;
2747 for (i = 0; i < n; ++i) {
2748 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2754 tail_n (g, nrlines, path)
2762 lines = guestfs_tail_n (g, nrlines, path);
2764 croak ("tail_n: %s", guestfs_last_error (g));
2765 for (n = 0; lines[n] != NULL; ++n) /**/;
2767 for (i = 0; i < n; ++i) {
2768 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
2779 output = guestfs_df (g);
2781 croak ("df: %s", guestfs_last_error (g));
2782 RETVAL = newSVpv (output, 0);
2793 output = guestfs_df_h (g);
2795 croak ("df_h: %s", guestfs_last_error (g));
2796 RETVAL = newSVpv (output, 0);