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)
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 config (g, qemuparam, qemuvalue)
734 r = guestfs_config (g, qemuparam, qemuvalue);
736 croak ("config: %s", guestfs_last_error (g));
745 r = guestfs_set_qemu (g, qemu);
747 croak ("set_qemu: %s", guestfs_last_error (g));
755 qemu = guestfs_get_qemu (g);
757 croak ("get_qemu: %s", guestfs_last_error (g));
758 RETVAL = newSVpv (qemu, 0);
769 r = guestfs_set_path (g, path);
771 croak ("set_path: %s", guestfs_last_error (g));
779 path = guestfs_get_path (g);
781 croak ("get_path: %s", guestfs_last_error (g));
782 RETVAL = newSVpv (path, 0);
787 set_append (g, append)
793 r = guestfs_set_append (g, append);
795 croak ("set_append: %s", guestfs_last_error (g));
803 append = guestfs_get_append (g);
805 croak ("get_append: %s", guestfs_last_error (g));
806 RETVAL = newSVpv (append, 0);
811 set_autosync (g, autosync)
817 r = guestfs_set_autosync (g, autosync);
819 croak ("set_autosync: %s", guestfs_last_error (g));
827 autosync = guestfs_get_autosync (g);
829 croak ("get_autosync: %s", guestfs_last_error (g));
830 RETVAL = newSViv (autosync);
835 set_verbose (g, verbose)
841 r = guestfs_set_verbose (g, verbose);
843 croak ("set_verbose: %s", guestfs_last_error (g));
851 verbose = guestfs_get_verbose (g);
853 croak ("get_verbose: %s", guestfs_last_error (g));
854 RETVAL = newSViv (verbose);
864 ready = guestfs_is_ready (g);
866 croak ("is_ready: %s", guestfs_last_error (g));
867 RETVAL = newSViv (ready);
877 config = guestfs_is_config (g);
879 croak ("is_config: %s", guestfs_last_error (g));
880 RETVAL = newSViv (config);
890 launching = guestfs_is_launching (g);
892 croak ("is_launching: %s", guestfs_last_error (g));
893 RETVAL = newSViv (launching);
903 busy = guestfs_is_busy (g);
905 croak ("is_busy: %s", guestfs_last_error (g));
906 RETVAL = newSViv (busy);
916 state = guestfs_get_state (g);
918 croak ("get_state: %s", guestfs_last_error (g));
919 RETVAL = newSViv (state);
929 r = guestfs_set_busy (g);
931 croak ("set_busy: %s", guestfs_last_error (g));
939 r = guestfs_set_ready (g);
941 croak ("set_ready: %s", guestfs_last_error (g));
949 r = guestfs_end_busy (g);
951 croak ("end_busy: %s", guestfs_last_error (g));
954 mount (g, device, mountpoint)
961 r = guestfs_mount (g, device, mountpoint);
963 croak ("mount: %s", guestfs_last_error (g));
971 r = guestfs_sync (g);
973 croak ("sync: %s", guestfs_last_error (g));
982 r = guestfs_touch (g, path);
984 croak ("touch: %s", guestfs_last_error (g));
993 content = guestfs_cat (g, path);
995 croak ("cat: %s", guestfs_last_error (g));
996 RETVAL = newSVpv (content, 0);
1008 listing = guestfs_ll (g, directory);
1009 if (listing == NULL)
1010 croak ("ll: %s", guestfs_last_error (g));
1011 RETVAL = newSVpv (listing, 0);
1024 listing = guestfs_ls (g, directory);
1025 if (listing == NULL)
1026 croak ("ls: %s", guestfs_last_error (g));
1027 for (n = 0; listing[n] != NULL; ++n) /**/;
1029 for (i = 0; i < n; ++i) {
1030 PUSHs (sv_2mortal (newSVpv (listing[i], 0)));
1042 devices = guestfs_list_devices (g);
1043 if (devices == NULL)
1044 croak ("list_devices: %s", guestfs_last_error (g));
1045 for (n = 0; devices[n] != NULL; ++n) /**/;
1047 for (i = 0; i < n; ++i) {
1048 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1060 partitions = guestfs_list_partitions (g);
1061 if (partitions == NULL)
1062 croak ("list_partitions: %s", guestfs_last_error (g));
1063 for (n = 0; partitions[n] != NULL; ++n) /**/;
1065 for (i = 0; i < n; ++i) {
1066 PUSHs (sv_2mortal (newSVpv (partitions[i], 0)));
1067 free (partitions[i]);
1078 physvols = guestfs_pvs (g);
1079 if (physvols == NULL)
1080 croak ("pvs: %s", guestfs_last_error (g));
1081 for (n = 0; physvols[n] != NULL; ++n) /**/;
1083 for (i = 0; i < n; ++i) {
1084 PUSHs (sv_2mortal (newSVpv (physvols[i], 0)));
1096 volgroups = guestfs_vgs (g);
1097 if (volgroups == NULL)
1098 croak ("vgs: %s", guestfs_last_error (g));
1099 for (n = 0; volgroups[n] != NULL; ++n) /**/;
1101 for (i = 0; i < n; ++i) {
1102 PUSHs (sv_2mortal (newSVpv (volgroups[i], 0)));
1103 free (volgroups[i]);
1114 logvols = guestfs_lvs (g);
1115 if (logvols == NULL)
1116 croak ("lvs: %s", guestfs_last_error (g));
1117 for (n = 0; logvols[n] != NULL; ++n) /**/;
1119 for (i = 0; i < n; ++i) {
1120 PUSHs (sv_2mortal (newSVpv (logvols[i], 0)));
1129 struct guestfs_lvm_pv_list *physvols;
1133 physvols = guestfs_pvs_full (g);
1134 if (physvols == NULL)
1135 croak ("pvs_full: %s", guestfs_last_error (g));
1136 EXTEND (SP, physvols->len);
1137 for (i = 0; i < physvols->len; ++i) {
1139 (void) hv_store (hv, "pv_name", 7, newSVpv (physvols->val[i].pv_name, 0), 0);
1140 (void) hv_store (hv, "pv_uuid", 7, newSVpv (physvols->val[i].pv_uuid, 32), 0);
1141 (void) hv_store (hv, "pv_fmt", 6, newSVpv (physvols->val[i].pv_fmt, 0), 0);
1142 (void) hv_store (hv, "pv_size", 7, my_newSVull (physvols->val[i].pv_size), 0);
1143 (void) hv_store (hv, "dev_size", 8, my_newSVull (physvols->val[i].dev_size), 0);
1144 (void) hv_store (hv, "pv_free", 7, my_newSVull (physvols->val[i].pv_free), 0);
1145 (void) hv_store (hv, "pv_used", 7, my_newSVull (physvols->val[i].pv_used), 0);
1146 (void) hv_store (hv, "pv_attr", 7, newSVpv (physvols->val[i].pv_attr, 0), 0);
1147 (void) hv_store (hv, "pv_pe_count", 11, my_newSVll (physvols->val[i].pv_pe_count), 0);
1148 (void) hv_store (hv, "pv_pe_alloc_count", 17, my_newSVll (physvols->val[i].pv_pe_alloc_count), 0);
1149 (void) hv_store (hv, "pv_tags", 7, newSVpv (physvols->val[i].pv_tags, 0), 0);
1150 (void) hv_store (hv, "pe_start", 8, my_newSVull (physvols->val[i].pe_start), 0);
1151 (void) hv_store (hv, "pv_mda_count", 12, my_newSVll (physvols->val[i].pv_mda_count), 0);
1152 (void) hv_store (hv, "pv_mda_free", 11, my_newSVull (physvols->val[i].pv_mda_free), 0);
1153 PUSHs (sv_2mortal ((SV *) hv));
1155 guestfs_free_lvm_pv_list (physvols);
1161 struct guestfs_lvm_vg_list *volgroups;
1165 volgroups = guestfs_vgs_full (g);
1166 if (volgroups == NULL)
1167 croak ("vgs_full: %s", guestfs_last_error (g));
1168 EXTEND (SP, volgroups->len);
1169 for (i = 0; i < volgroups->len; ++i) {
1171 (void) hv_store (hv, "vg_name", 7, newSVpv (volgroups->val[i].vg_name, 0), 0);
1172 (void) hv_store (hv, "vg_uuid", 7, newSVpv (volgroups->val[i].vg_uuid, 32), 0);
1173 (void) hv_store (hv, "vg_fmt", 6, newSVpv (volgroups->val[i].vg_fmt, 0), 0);
1174 (void) hv_store (hv, "vg_attr", 7, newSVpv (volgroups->val[i].vg_attr, 0), 0);
1175 (void) hv_store (hv, "vg_size", 7, my_newSVull (volgroups->val[i].vg_size), 0);
1176 (void) hv_store (hv, "vg_free", 7, my_newSVull (volgroups->val[i].vg_free), 0);
1177 (void) hv_store (hv, "vg_sysid", 8, newSVpv (volgroups->val[i].vg_sysid, 0), 0);
1178 (void) hv_store (hv, "vg_extent_size", 14, my_newSVull (volgroups->val[i].vg_extent_size), 0);
1179 (void) hv_store (hv, "vg_extent_count", 15, my_newSVll (volgroups->val[i].vg_extent_count), 0);
1180 (void) hv_store (hv, "vg_free_count", 13, my_newSVll (volgroups->val[i].vg_free_count), 0);
1181 (void) hv_store (hv, "max_lv", 6, my_newSVll (volgroups->val[i].max_lv), 0);
1182 (void) hv_store (hv, "max_pv", 6, my_newSVll (volgroups->val[i].max_pv), 0);
1183 (void) hv_store (hv, "pv_count", 8, my_newSVll (volgroups->val[i].pv_count), 0);
1184 (void) hv_store (hv, "lv_count", 8, my_newSVll (volgroups->val[i].lv_count), 0);
1185 (void) hv_store (hv, "snap_count", 10, my_newSVll (volgroups->val[i].snap_count), 0);
1186 (void) hv_store (hv, "vg_seqno", 8, my_newSVll (volgroups->val[i].vg_seqno), 0);
1187 (void) hv_store (hv, "vg_tags", 7, newSVpv (volgroups->val[i].vg_tags, 0), 0);
1188 (void) hv_store (hv, "vg_mda_count", 12, my_newSVll (volgroups->val[i].vg_mda_count), 0);
1189 (void) hv_store (hv, "vg_mda_free", 11, my_newSVull (volgroups->val[i].vg_mda_free), 0);
1190 PUSHs (sv_2mortal ((SV *) hv));
1192 guestfs_free_lvm_vg_list (volgroups);
1198 struct guestfs_lvm_lv_list *logvols;
1202 logvols = guestfs_lvs_full (g);
1203 if (logvols == NULL)
1204 croak ("lvs_full: %s", guestfs_last_error (g));
1205 EXTEND (SP, logvols->len);
1206 for (i = 0; i < logvols->len; ++i) {
1208 (void) hv_store (hv, "lv_name", 7, newSVpv (logvols->val[i].lv_name, 0), 0);
1209 (void) hv_store (hv, "lv_uuid", 7, newSVpv (logvols->val[i].lv_uuid, 32), 0);
1210 (void) hv_store (hv, "lv_attr", 7, newSVpv (logvols->val[i].lv_attr, 0), 0);
1211 (void) hv_store (hv, "lv_major", 8, my_newSVll (logvols->val[i].lv_major), 0);
1212 (void) hv_store (hv, "lv_minor", 8, my_newSVll (logvols->val[i].lv_minor), 0);
1213 (void) hv_store (hv, "lv_kernel_major", 15, my_newSVll (logvols->val[i].lv_kernel_major), 0);
1214 (void) hv_store (hv, "lv_kernel_minor", 15, my_newSVll (logvols->val[i].lv_kernel_minor), 0);
1215 (void) hv_store (hv, "lv_size", 7, my_newSVull (logvols->val[i].lv_size), 0);
1216 (void) hv_store (hv, "seg_count", 9, my_newSVll (logvols->val[i].seg_count), 0);
1217 (void) hv_store (hv, "origin", 6, newSVpv (logvols->val[i].origin, 0), 0);
1218 (void) hv_store (hv, "snap_percent", 12, newSVnv (logvols->val[i].snap_percent), 0);
1219 (void) hv_store (hv, "copy_percent", 12, newSVnv (logvols->val[i].copy_percent), 0);
1220 (void) hv_store (hv, "move_pv", 7, newSVpv (logvols->val[i].move_pv, 0), 0);
1221 (void) hv_store (hv, "lv_tags", 7, newSVpv (logvols->val[i].lv_tags, 0), 0);
1222 (void) hv_store (hv, "mirror_log", 10, newSVpv (logvols->val[i].mirror_log, 0), 0);
1223 (void) hv_store (hv, "modules", 7, newSVpv (logvols->val[i].modules, 0), 0);
1224 PUSHs (sv_2mortal ((SV *) hv));
1226 guestfs_free_lvm_lv_list (logvols);
1229 read_lines (g, path)
1236 lines = guestfs_read_lines (g, path);
1238 croak ("read_lines: %s", guestfs_last_error (g));
1239 for (n = 0; lines[n] != NULL; ++n) /**/;
1241 for (i = 0; i < n; ++i) {
1242 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1248 aug_init (g, root, flags)
1255 r = guestfs_aug_init (g, root, flags);
1257 croak ("aug_init: %s", guestfs_last_error (g));
1265 r = guestfs_aug_close (g);
1267 croak ("aug_close: %s", guestfs_last_error (g));
1270 aug_defvar (g, name, expr)
1277 nrnodes = guestfs_aug_defvar (g, name, expr);
1279 croak ("aug_defvar: %s", guestfs_last_error (g));
1280 RETVAL = newSViv (nrnodes);
1285 aug_defnode (g, name, expr, val)
1291 struct guestfs_int_bool *r;
1293 r = guestfs_aug_defnode (g, name, expr, val);
1295 croak ("aug_defnode: %s", guestfs_last_error (g));
1297 PUSHs (sv_2mortal (newSViv (r->i)));
1298 PUSHs (sv_2mortal (newSViv (r->b)));
1299 guestfs_free_int_bool (r);
1308 val = guestfs_aug_get (g, path);
1310 croak ("aug_get: %s", guestfs_last_error (g));
1311 RETVAL = newSVpv (val, 0);
1317 aug_set (g, path, val)
1324 r = guestfs_aug_set (g, path, val);
1326 croak ("aug_set: %s", guestfs_last_error (g));
1329 aug_insert (g, path, label, before)
1337 r = guestfs_aug_insert (g, path, label, before);
1339 croak ("aug_insert: %s", guestfs_last_error (g));
1348 nrnodes = guestfs_aug_rm (g, path);
1350 croak ("aug_rm: %s", guestfs_last_error (g));
1351 RETVAL = newSViv (nrnodes);
1356 aug_mv (g, src, dest)
1363 r = guestfs_aug_mv (g, src, dest);
1365 croak ("aug_mv: %s", guestfs_last_error (g));
1375 matches = guestfs_aug_match (g, path);
1376 if (matches == NULL)
1377 croak ("aug_match: %s", guestfs_last_error (g));
1378 for (n = 0; matches[n] != NULL; ++n) /**/;
1380 for (i = 0; i < n; ++i) {
1381 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
1392 r = guestfs_aug_save (g);
1394 croak ("aug_save: %s", guestfs_last_error (g));
1402 r = guestfs_aug_load (g);
1404 croak ("aug_load: %s", guestfs_last_error (g));
1414 matches = guestfs_aug_ls (g, path);
1415 if (matches == NULL)
1416 croak ("aug_ls: %s", guestfs_last_error (g));
1417 for (n = 0; matches[n] != NULL; ++n) /**/;
1419 for (i = 0; i < n; ++i) {
1420 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
1432 r = guestfs_rm (g, path);
1434 croak ("rm: %s", guestfs_last_error (g));
1443 r = guestfs_rmdir (g, path);
1445 croak ("rmdir: %s", guestfs_last_error (g));
1454 r = guestfs_rm_rf (g, path);
1456 croak ("rm_rf: %s", guestfs_last_error (g));
1465 r = guestfs_mkdir (g, path);
1467 croak ("mkdir: %s", guestfs_last_error (g));
1476 r = guestfs_mkdir_p (g, path);
1478 croak ("mkdir_p: %s", guestfs_last_error (g));
1481 chmod (g, mode, path)
1488 r = guestfs_chmod (g, mode, path);
1490 croak ("chmod: %s", guestfs_last_error (g));
1493 chown (g, owner, group, path)
1501 r = guestfs_chown (g, owner, group, path);
1503 croak ("chown: %s", guestfs_last_error (g));
1512 existsflag = guestfs_exists (g, path);
1513 if (existsflag == -1)
1514 croak ("exists: %s", guestfs_last_error (g));
1515 RETVAL = newSViv (existsflag);
1526 fileflag = guestfs_is_file (g, path);
1528 croak ("is_file: %s", guestfs_last_error (g));
1529 RETVAL = newSViv (fileflag);
1540 dirflag = guestfs_is_dir (g, path);
1542 croak ("is_dir: %s", guestfs_last_error (g));
1543 RETVAL = newSViv (dirflag);
1548 pvcreate (g, device)
1554 r = guestfs_pvcreate (g, device);
1556 croak ("pvcreate: %s", guestfs_last_error (g));
1559 vgcreate (g, volgroup, physvols)
1566 r = guestfs_vgcreate (g, volgroup, physvols);
1569 croak ("vgcreate: %s", guestfs_last_error (g));
1572 lvcreate (g, logvol, volgroup, mbytes)
1580 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
1582 croak ("lvcreate: %s", guestfs_last_error (g));
1585 mkfs (g, fstype, device)
1592 r = guestfs_mkfs (g, fstype, device);
1594 croak ("mkfs: %s", guestfs_last_error (g));
1597 sfdisk (g, device, cyls, heads, sectors, lines)
1607 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1610 croak ("sfdisk: %s", guestfs_last_error (g));
1613 write_file (g, path, content, size)
1621 r = guestfs_write_file (g, path, content, size);
1623 croak ("write_file: %s", guestfs_last_error (g));
1626 umount (g, pathordevice)
1632 r = guestfs_umount (g, pathordevice);
1634 croak ("umount: %s", guestfs_last_error (g));
1643 devices = guestfs_mounts (g);
1644 if (devices == NULL)
1645 croak ("mounts: %s", guestfs_last_error (g));
1646 for (n = 0; devices[n] != NULL; ++n) /**/;
1648 for (i = 0; i < n; ++i) {
1649 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1660 r = guestfs_umount_all (g);
1662 croak ("umount_all: %s", guestfs_last_error (g));
1670 r = guestfs_lvm_remove_all (g);
1672 croak ("lvm_remove_all: %s", guestfs_last_error (g));
1681 description = guestfs_file (g, path);
1682 if (description == NULL)
1683 croak ("file: %s", guestfs_last_error (g));
1684 RETVAL = newSVpv (description, 0);
1690 command (g, arguments)
1696 output = guestfs_command (g, arguments);
1699 croak ("command: %s", guestfs_last_error (g));
1700 RETVAL = newSVpv (output, 0);
1706 command_lines (g, arguments)
1713 lines = guestfs_command_lines (g, arguments);
1716 croak ("command_lines: %s", guestfs_last_error (g));
1717 for (n = 0; lines[n] != NULL; ++n) /**/;
1719 for (i = 0; i < n; ++i) {
1720 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1730 struct guestfs_stat *statbuf;
1732 statbuf = guestfs_stat (g, path);
1733 if (statbuf == NULL)
1734 croak ("stat: %s", guestfs_last_error (g));
1736 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1737 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1738 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1739 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1740 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1741 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1742 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1743 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1744 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1745 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1746 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1747 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1748 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1756 struct guestfs_stat *statbuf;
1758 statbuf = guestfs_lstat (g, path);
1759 if (statbuf == NULL)
1760 croak ("lstat: %s", guestfs_last_error (g));
1762 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1763 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1764 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1765 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1766 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1767 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1768 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1769 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1770 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1771 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1772 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1773 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1774 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1782 struct guestfs_statvfs *statbuf;
1784 statbuf = guestfs_statvfs (g, path);
1785 if (statbuf == NULL)
1786 croak ("statvfs: %s", guestfs_last_error (g));
1788 PUSHs (sv_2mortal (my_newSVll (statbuf->bsize)));
1789 PUSHs (sv_2mortal (my_newSVll (statbuf->frsize)));
1790 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1791 PUSHs (sv_2mortal (my_newSVll (statbuf->bfree)));
1792 PUSHs (sv_2mortal (my_newSVll (statbuf->bavail)));
1793 PUSHs (sv_2mortal (my_newSVll (statbuf->files)));
1794 PUSHs (sv_2mortal (my_newSVll (statbuf->ffree)));
1795 PUSHs (sv_2mortal (my_newSVll (statbuf->favail)));
1796 PUSHs (sv_2mortal (my_newSVll (statbuf->fsid)));
1797 PUSHs (sv_2mortal (my_newSVll (statbuf->flag)));
1798 PUSHs (sv_2mortal (my_newSVll (statbuf->namemax)));
1802 tune2fs_l (g, device)
1809 superblock = guestfs_tune2fs_l (g, device);
1810 if (superblock == NULL)
1811 croak ("tune2fs_l: %s", guestfs_last_error (g));
1812 for (n = 0; superblock[n] != NULL; ++n) /**/;
1814 for (i = 0; i < n; ++i) {
1815 PUSHs (sv_2mortal (newSVpv (superblock[i], 0)));
1816 free (superblock[i]);
1821 blockdev_setro (g, device)
1827 r = guestfs_blockdev_setro (g, device);
1829 croak ("blockdev_setro: %s", guestfs_last_error (g));
1832 blockdev_setrw (g, device)
1838 r = guestfs_blockdev_setrw (g, device);
1840 croak ("blockdev_setrw: %s", guestfs_last_error (g));
1843 blockdev_getro (g, device)
1849 ro = guestfs_blockdev_getro (g, device);
1851 croak ("blockdev_getro: %s", guestfs_last_error (g));
1852 RETVAL = newSViv (ro);
1857 blockdev_getss (g, device)
1863 sectorsize = guestfs_blockdev_getss (g, device);
1864 if (sectorsize == -1)
1865 croak ("blockdev_getss: %s", guestfs_last_error (g));
1866 RETVAL = newSViv (sectorsize);
1871 blockdev_getbsz (g, device)
1877 blocksize = guestfs_blockdev_getbsz (g, device);
1878 if (blocksize == -1)
1879 croak ("blockdev_getbsz: %s", guestfs_last_error (g));
1880 RETVAL = newSViv (blocksize);
1885 blockdev_setbsz (g, device, blocksize)
1892 r = guestfs_blockdev_setbsz (g, device, blocksize);
1894 croak ("blockdev_setbsz: %s", guestfs_last_error (g));
1897 blockdev_getsz (g, device)
1901 int64_t sizeinsectors;
1903 sizeinsectors = guestfs_blockdev_getsz (g, device);
1904 if (sizeinsectors == -1)
1905 croak ("blockdev_getsz: %s", guestfs_last_error (g));
1906 RETVAL = my_newSVll (sizeinsectors);
1911 blockdev_getsize64 (g, device)
1915 int64_t sizeinbytes;
1917 sizeinbytes = guestfs_blockdev_getsize64 (g, device);
1918 if (sizeinbytes == -1)
1919 croak ("blockdev_getsize64: %s", guestfs_last_error (g));
1920 RETVAL = my_newSVll (sizeinbytes);
1925 blockdev_flushbufs (g, device)
1931 r = guestfs_blockdev_flushbufs (g, device);
1933 croak ("blockdev_flushbufs: %s", guestfs_last_error (g));
1936 blockdev_rereadpt (g, device)
1942 r = guestfs_blockdev_rereadpt (g, device);
1944 croak ("blockdev_rereadpt: %s", guestfs_last_error (g));
1947 upload (g, filename, remotefilename)
1950 char *remotefilename;
1954 r = guestfs_upload (g, filename, remotefilename);
1956 croak ("upload: %s", guestfs_last_error (g));
1959 download (g, remotefilename, filename)
1961 char *remotefilename;
1966 r = guestfs_download (g, remotefilename, filename);
1968 croak ("download: %s", guestfs_last_error (g));
1971 checksum (g, csumtype, path)
1978 checksum = guestfs_checksum (g, csumtype, path);
1979 if (checksum == NULL)
1980 croak ("checksum: %s", guestfs_last_error (g));
1981 RETVAL = newSVpv (checksum, 0);
1987 tar_in (g, tarfile, directory)
1994 r = guestfs_tar_in (g, tarfile, directory);
1996 croak ("tar_in: %s", guestfs_last_error (g));
1999 tar_out (g, directory, tarfile)
2006 r = guestfs_tar_out (g, directory, tarfile);
2008 croak ("tar_out: %s", guestfs_last_error (g));
2011 tgz_in (g, tarball, directory)
2018 r = guestfs_tgz_in (g, tarball, directory);
2020 croak ("tgz_in: %s", guestfs_last_error (g));
2023 tgz_out (g, directory, tarball)
2030 r = guestfs_tgz_out (g, directory, tarball);
2032 croak ("tgz_out: %s", guestfs_last_error (g));
2035 mount_ro (g, device, mountpoint)
2042 r = guestfs_mount_ro (g, device, mountpoint);
2044 croak ("mount_ro: %s", guestfs_last_error (g));
2047 mount_options (g, options, device, mountpoint)
2055 r = guestfs_mount_options (g, options, device, mountpoint);
2057 croak ("mount_options: %s", guestfs_last_error (g));
2060 mount_vfs (g, options, vfstype, device, mountpoint)
2069 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
2071 croak ("mount_vfs: %s", guestfs_last_error (g));
2074 debug (g, subcmd, extraargs)
2081 result = guestfs_debug (g, subcmd, extraargs);
2084 croak ("debug: %s", guestfs_last_error (g));
2085 RETVAL = newSVpv (result, 0);
2091 lvremove (g, device)
2097 r = guestfs_lvremove (g, device);
2099 croak ("lvremove: %s", guestfs_last_error (g));
2102 vgremove (g, vgname)
2108 r = guestfs_vgremove (g, vgname);
2110 croak ("vgremove: %s", guestfs_last_error (g));
2113 pvremove (g, device)
2119 r = guestfs_pvremove (g, device);
2121 croak ("pvremove: %s", guestfs_last_error (g));
2124 set_e2label (g, device, label)
2131 r = guestfs_set_e2label (g, device, label);
2133 croak ("set_e2label: %s", guestfs_last_error (g));
2136 get_e2label (g, device)
2142 label = guestfs_get_e2label (g, device);
2144 croak ("get_e2label: %s", guestfs_last_error (g));
2145 RETVAL = newSVpv (label, 0);
2151 set_e2uuid (g, device, uuid)
2158 r = guestfs_set_e2uuid (g, device, uuid);
2160 croak ("set_e2uuid: %s", guestfs_last_error (g));
2163 get_e2uuid (g, device)
2169 uuid = guestfs_get_e2uuid (g, device);
2171 croak ("get_e2uuid: %s", guestfs_last_error (g));
2172 RETVAL = newSVpv (uuid, 0);
2178 fsck (g, fstype, device)
2185 status = guestfs_fsck (g, fstype, device);
2187 croak ("fsck: %s", guestfs_last_error (g));
2188 RETVAL = newSViv (status);
2199 r = guestfs_zero (g, device);
2201 croak ("zero: %s", guestfs_last_error (g));
2204 grub_install (g, root, device)
2211 r = guestfs_grub_install (g, root, device);
2213 croak ("grub_install: %s", guestfs_last_error (g));
2223 r = guestfs_cp (g, src, dest);
2225 croak ("cp: %s", guestfs_last_error (g));
2235 r = guestfs_cp_a (g, src, dest);
2237 croak ("cp_a: %s", guestfs_last_error (g));
2247 r = guestfs_mv (g, src, dest);
2249 croak ("mv: %s", guestfs_last_error (g));
2252 drop_caches (g, whattodrop)
2258 r = guestfs_drop_caches (g, whattodrop);
2260 croak ("drop_caches: %s", guestfs_last_error (g));
2268 kmsgs = guestfs_dmesg (g);
2270 croak ("dmesg: %s", guestfs_last_error (g));
2271 RETVAL = newSVpv (kmsgs, 0);
2282 r = guestfs_ping_daemon (g);
2284 croak ("ping_daemon: %s", guestfs_last_error (g));
2287 equal (g, file1, file2)
2294 equality = guestfs_equal (g, file1, file2);
2296 croak ("equal: %s", guestfs_last_error (g));
2297 RETVAL = newSViv (equality);
2309 stringsout = guestfs_strings (g, path);
2310 if (stringsout == NULL)
2311 croak ("strings: %s", guestfs_last_error (g));
2312 for (n = 0; stringsout[n] != NULL; ++n) /**/;
2314 for (i = 0; i < n; ++i) {
2315 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
2316 free (stringsout[i]);
2321 strings_e (g, encoding, path)
2329 stringsout = guestfs_strings_e (g, encoding, path);
2330 if (stringsout == NULL)
2331 croak ("strings_e: %s", guestfs_last_error (g));
2332 for (n = 0; stringsout[n] != NULL; ++n) /**/;
2334 for (i = 0; i < n; ++i) {
2335 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
2336 free (stringsout[i]);
2347 dump = guestfs_hexdump (g, path);
2349 croak ("hexdump: %s", guestfs_last_error (g));
2350 RETVAL = newSVpv (dump, 0);
2356 zerofree (g, device)
2362 r = guestfs_zerofree (g, device);
2364 croak ("zerofree: %s", guestfs_last_error (g));
2367 pvresize (g, device)
2373 r = guestfs_pvresize (g, device);
2375 croak ("pvresize: %s", guestfs_last_error (g));
2378 sfdisk_N (g, device, n, cyls, heads, sectors, line)
2389 r = guestfs_sfdisk_N (g, device, n, cyls, heads, sectors, line);
2391 croak ("sfdisk_N: %s", guestfs_last_error (g));
2394 sfdisk_l (g, device)
2400 partitions = guestfs_sfdisk_l (g, device);
2401 if (partitions == NULL)
2402 croak ("sfdisk_l: %s", guestfs_last_error (g));
2403 RETVAL = newSVpv (partitions, 0);
2409 sfdisk_kernel_geometry (g, device)
2415 partitions = guestfs_sfdisk_kernel_geometry (g, device);
2416 if (partitions == NULL)
2417 croak ("sfdisk_kernel_geometry: %s", guestfs_last_error (g));
2418 RETVAL = newSVpv (partitions, 0);
2424 sfdisk_disk_geometry (g, device)
2430 partitions = guestfs_sfdisk_disk_geometry (g, device);
2431 if (partitions == NULL)
2432 croak ("sfdisk_disk_geometry: %s", guestfs_last_error (g));
2433 RETVAL = newSVpv (partitions, 0);
2439 vg_activate_all (g, activate)
2445 r = guestfs_vg_activate_all (g, activate);
2447 croak ("vg_activate_all: %s", guestfs_last_error (g));
2450 vg_activate (g, activate, volgroups)
2457 r = guestfs_vg_activate (g, activate, volgroups);
2460 croak ("vg_activate: %s", guestfs_last_error (g));
2463 lvresize (g, device, mbytes)
2470 r = guestfs_lvresize (g, device, mbytes);
2472 croak ("lvresize: %s", guestfs_last_error (g));
2475 resize2fs (g, device)
2481 r = guestfs_resize2fs (g, device);
2483 croak ("resize2fs: %s", guestfs_last_error (g));
2493 names = guestfs_find (g, directory);
2495 croak ("find: %s", guestfs_last_error (g));
2496 for (n = 0; names[n] != NULL; ++n) /**/;
2498 for (i = 0; i < n; ++i) {
2499 PUSHs (sv_2mortal (newSVpv (names[i], 0)));
2505 e2fsck_f (g, device)
2511 r = guestfs_e2fsck_f (g, device);
2513 croak ("e2fsck_f: %s", guestfs_last_error (g));