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);
115 r = guestfs_launch (g);
117 croak ("launch: %s", guestfs_last_error (g));
125 r = guestfs_wait_ready (g);
127 croak ("wait_ready: %s", guestfs_last_error (g));
135 r = guestfs_kill_subprocess (g);
137 croak ("kill_subprocess: %s", guestfs_last_error (g));
140 add_drive (g, filename)
146 r = guestfs_add_drive (g, filename);
148 croak ("add_drive: %s", guestfs_last_error (g));
151 add_cdrom (g, filename)
157 r = guestfs_add_cdrom (g, filename);
159 croak ("add_cdrom: %s", guestfs_last_error (g));
162 config (g, qemuparam, qemuvalue)
169 r = guestfs_config (g, qemuparam, qemuvalue);
171 croak ("config: %s", guestfs_last_error (g));
180 r = guestfs_set_qemu (g, qemu);
182 croak ("set_qemu: %s", guestfs_last_error (g));
190 qemu = guestfs_get_qemu (g);
192 croak ("get_qemu: %s", guestfs_last_error (g));
193 RETVAL = newSVpv (qemu, 0);
204 r = guestfs_set_path (g, path);
206 croak ("set_path: %s", guestfs_last_error (g));
214 path = guestfs_get_path (g);
216 croak ("get_path: %s", guestfs_last_error (g));
217 RETVAL = newSVpv (path, 0);
222 set_append (g, append)
228 r = guestfs_set_append (g, append);
230 croak ("set_append: %s", guestfs_last_error (g));
238 append = guestfs_get_append (g);
240 croak ("get_append: %s", guestfs_last_error (g));
241 RETVAL = newSVpv (append, 0);
246 set_autosync (g, autosync)
252 r = guestfs_set_autosync (g, autosync);
254 croak ("set_autosync: %s", guestfs_last_error (g));
262 autosync = guestfs_get_autosync (g);
264 croak ("get_autosync: %s", guestfs_last_error (g));
265 RETVAL = newSViv (autosync);
270 set_verbose (g, verbose)
276 r = guestfs_set_verbose (g, verbose);
278 croak ("set_verbose: %s", guestfs_last_error (g));
286 verbose = guestfs_get_verbose (g);
288 croak ("get_verbose: %s", guestfs_last_error (g));
289 RETVAL = newSViv (verbose);
299 ready = guestfs_is_ready (g);
301 croak ("is_ready: %s", guestfs_last_error (g));
302 RETVAL = newSViv (ready);
312 config = guestfs_is_config (g);
314 croak ("is_config: %s", guestfs_last_error (g));
315 RETVAL = newSViv (config);
325 launching = guestfs_is_launching (g);
327 croak ("is_launching: %s", guestfs_last_error (g));
328 RETVAL = newSViv (launching);
338 busy = guestfs_is_busy (g);
340 croak ("is_busy: %s", guestfs_last_error (g));
341 RETVAL = newSViv (busy);
351 state = guestfs_get_state (g);
353 croak ("get_state: %s", guestfs_last_error (g));
354 RETVAL = newSViv (state);
364 r = guestfs_set_busy (g);
366 croak ("set_busy: %s", guestfs_last_error (g));
374 r = guestfs_set_ready (g);
376 croak ("set_ready: %s", guestfs_last_error (g));
384 r = guestfs_end_busy (g);
386 croak ("end_busy: %s", guestfs_last_error (g));
389 mount (g, device, mountpoint)
396 r = guestfs_mount (g, device, mountpoint);
398 croak ("mount: %s", guestfs_last_error (g));
406 r = guestfs_sync (g);
408 croak ("sync: %s", guestfs_last_error (g));
417 r = guestfs_touch (g, path);
419 croak ("touch: %s", guestfs_last_error (g));
428 content = guestfs_cat (g, path);
430 croak ("cat: %s", guestfs_last_error (g));
431 RETVAL = newSVpv (content, 0);
443 listing = guestfs_ll (g, directory);
445 croak ("ll: %s", guestfs_last_error (g));
446 RETVAL = newSVpv (listing, 0);
459 listing = guestfs_ls (g, directory);
461 croak ("ls: %s", guestfs_last_error (g));
462 for (n = 0; listing[n] != NULL; ++n) /**/;
464 for (i = 0; i < n; ++i) {
465 PUSHs (sv_2mortal (newSVpv (listing[i], 0)));
477 devices = guestfs_list_devices (g);
479 croak ("list_devices: %s", guestfs_last_error (g));
480 for (n = 0; devices[n] != NULL; ++n) /**/;
482 for (i = 0; i < n; ++i) {
483 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
495 partitions = guestfs_list_partitions (g);
496 if (partitions == NULL)
497 croak ("list_partitions: %s", guestfs_last_error (g));
498 for (n = 0; partitions[n] != NULL; ++n) /**/;
500 for (i = 0; i < n; ++i) {
501 PUSHs (sv_2mortal (newSVpv (partitions[i], 0)));
502 free (partitions[i]);
513 physvols = guestfs_pvs (g);
514 if (physvols == NULL)
515 croak ("pvs: %s", guestfs_last_error (g));
516 for (n = 0; physvols[n] != NULL; ++n) /**/;
518 for (i = 0; i < n; ++i) {
519 PUSHs (sv_2mortal (newSVpv (physvols[i], 0)));
531 volgroups = guestfs_vgs (g);
532 if (volgroups == NULL)
533 croak ("vgs: %s", guestfs_last_error (g));
534 for (n = 0; volgroups[n] != NULL; ++n) /**/;
536 for (i = 0; i < n; ++i) {
537 PUSHs (sv_2mortal (newSVpv (volgroups[i], 0)));
549 logvols = guestfs_lvs (g);
551 croak ("lvs: %s", guestfs_last_error (g));
552 for (n = 0; logvols[n] != NULL; ++n) /**/;
554 for (i = 0; i < n; ++i) {
555 PUSHs (sv_2mortal (newSVpv (logvols[i], 0)));
564 struct guestfs_lvm_pv_list *physvols;
568 physvols = guestfs_pvs_full (g);
569 if (physvols == NULL)
570 croak ("pvs_full: %s", guestfs_last_error (g));
571 EXTEND (SP, physvols->len);
572 for (i = 0; i < physvols->len; ++i) {
574 (void) hv_store (hv, "pv_name", 7, newSVpv (physvols->val[i].pv_name, 0), 0);
575 (void) hv_store (hv, "pv_uuid", 7, newSVpv (physvols->val[i].pv_uuid, 32), 0);
576 (void) hv_store (hv, "pv_fmt", 6, newSVpv (physvols->val[i].pv_fmt, 0), 0);
577 (void) hv_store (hv, "pv_size", 7, my_newSVull (physvols->val[i].pv_size), 0);
578 (void) hv_store (hv, "dev_size", 8, my_newSVull (physvols->val[i].dev_size), 0);
579 (void) hv_store (hv, "pv_free", 7, my_newSVull (physvols->val[i].pv_free), 0);
580 (void) hv_store (hv, "pv_used", 7, my_newSVull (physvols->val[i].pv_used), 0);
581 (void) hv_store (hv, "pv_attr", 7, newSVpv (physvols->val[i].pv_attr, 0), 0);
582 (void) hv_store (hv, "pv_pe_count", 11, my_newSVll (physvols->val[i].pv_pe_count), 0);
583 (void) hv_store (hv, "pv_pe_alloc_count", 17, my_newSVll (physvols->val[i].pv_pe_alloc_count), 0);
584 (void) hv_store (hv, "pv_tags", 7, newSVpv (physvols->val[i].pv_tags, 0), 0);
585 (void) hv_store (hv, "pe_start", 8, my_newSVull (physvols->val[i].pe_start), 0);
586 (void) hv_store (hv, "pv_mda_count", 12, my_newSVll (physvols->val[i].pv_mda_count), 0);
587 (void) hv_store (hv, "pv_mda_free", 11, my_newSVull (physvols->val[i].pv_mda_free), 0);
588 PUSHs (sv_2mortal ((SV *) hv));
590 guestfs_free_lvm_pv_list (physvols);
596 struct guestfs_lvm_vg_list *volgroups;
600 volgroups = guestfs_vgs_full (g);
601 if (volgroups == NULL)
602 croak ("vgs_full: %s", guestfs_last_error (g));
603 EXTEND (SP, volgroups->len);
604 for (i = 0; i < volgroups->len; ++i) {
606 (void) hv_store (hv, "vg_name", 7, newSVpv (volgroups->val[i].vg_name, 0), 0);
607 (void) hv_store (hv, "vg_uuid", 7, newSVpv (volgroups->val[i].vg_uuid, 32), 0);
608 (void) hv_store (hv, "vg_fmt", 6, newSVpv (volgroups->val[i].vg_fmt, 0), 0);
609 (void) hv_store (hv, "vg_attr", 7, newSVpv (volgroups->val[i].vg_attr, 0), 0);
610 (void) hv_store (hv, "vg_size", 7, my_newSVull (volgroups->val[i].vg_size), 0);
611 (void) hv_store (hv, "vg_free", 7, my_newSVull (volgroups->val[i].vg_free), 0);
612 (void) hv_store (hv, "vg_sysid", 8, newSVpv (volgroups->val[i].vg_sysid, 0), 0);
613 (void) hv_store (hv, "vg_extent_size", 14, my_newSVull (volgroups->val[i].vg_extent_size), 0);
614 (void) hv_store (hv, "vg_extent_count", 15, my_newSVll (volgroups->val[i].vg_extent_count), 0);
615 (void) hv_store (hv, "vg_free_count", 13, my_newSVll (volgroups->val[i].vg_free_count), 0);
616 (void) hv_store (hv, "max_lv", 6, my_newSVll (volgroups->val[i].max_lv), 0);
617 (void) hv_store (hv, "max_pv", 6, my_newSVll (volgroups->val[i].max_pv), 0);
618 (void) hv_store (hv, "pv_count", 8, my_newSVll (volgroups->val[i].pv_count), 0);
619 (void) hv_store (hv, "lv_count", 8, my_newSVll (volgroups->val[i].lv_count), 0);
620 (void) hv_store (hv, "snap_count", 10, my_newSVll (volgroups->val[i].snap_count), 0);
621 (void) hv_store (hv, "vg_seqno", 8, my_newSVll (volgroups->val[i].vg_seqno), 0);
622 (void) hv_store (hv, "vg_tags", 7, newSVpv (volgroups->val[i].vg_tags, 0), 0);
623 (void) hv_store (hv, "vg_mda_count", 12, my_newSVll (volgroups->val[i].vg_mda_count), 0);
624 (void) hv_store (hv, "vg_mda_free", 11, my_newSVull (volgroups->val[i].vg_mda_free), 0);
625 PUSHs (sv_2mortal ((SV *) hv));
627 guestfs_free_lvm_vg_list (volgroups);
633 struct guestfs_lvm_lv_list *logvols;
637 logvols = guestfs_lvs_full (g);
639 croak ("lvs_full: %s", guestfs_last_error (g));
640 EXTEND (SP, logvols->len);
641 for (i = 0; i < logvols->len; ++i) {
643 (void) hv_store (hv, "lv_name", 7, newSVpv (logvols->val[i].lv_name, 0), 0);
644 (void) hv_store (hv, "lv_uuid", 7, newSVpv (logvols->val[i].lv_uuid, 32), 0);
645 (void) hv_store (hv, "lv_attr", 7, newSVpv (logvols->val[i].lv_attr, 0), 0);
646 (void) hv_store (hv, "lv_major", 8, my_newSVll (logvols->val[i].lv_major), 0);
647 (void) hv_store (hv, "lv_minor", 8, my_newSVll (logvols->val[i].lv_minor), 0);
648 (void) hv_store (hv, "lv_kernel_major", 15, my_newSVll (logvols->val[i].lv_kernel_major), 0);
649 (void) hv_store (hv, "lv_kernel_minor", 15, my_newSVll (logvols->val[i].lv_kernel_minor), 0);
650 (void) hv_store (hv, "lv_size", 7, my_newSVull (logvols->val[i].lv_size), 0);
651 (void) hv_store (hv, "seg_count", 9, my_newSVll (logvols->val[i].seg_count), 0);
652 (void) hv_store (hv, "origin", 6, newSVpv (logvols->val[i].origin, 0), 0);
653 (void) hv_store (hv, "snap_percent", 12, newSVnv (logvols->val[i].snap_percent), 0);
654 (void) hv_store (hv, "copy_percent", 12, newSVnv (logvols->val[i].copy_percent), 0);
655 (void) hv_store (hv, "move_pv", 7, newSVpv (logvols->val[i].move_pv, 0), 0);
656 (void) hv_store (hv, "lv_tags", 7, newSVpv (logvols->val[i].lv_tags, 0), 0);
657 (void) hv_store (hv, "mirror_log", 10, newSVpv (logvols->val[i].mirror_log, 0), 0);
658 (void) hv_store (hv, "modules", 7, newSVpv (logvols->val[i].modules, 0), 0);
659 PUSHs (sv_2mortal ((SV *) hv));
661 guestfs_free_lvm_lv_list (logvols);
671 lines = guestfs_read_lines (g, path);
673 croak ("read_lines: %s", guestfs_last_error (g));
674 for (n = 0; lines[n] != NULL; ++n) /**/;
676 for (i = 0; i < n; ++i) {
677 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
683 aug_init (g, root, flags)
690 r = guestfs_aug_init (g, root, flags);
692 croak ("aug_init: %s", guestfs_last_error (g));
700 r = guestfs_aug_close (g);
702 croak ("aug_close: %s", guestfs_last_error (g));
705 aug_defvar (g, name, expr)
712 nrnodes = guestfs_aug_defvar (g, name, expr);
714 croak ("aug_defvar: %s", guestfs_last_error (g));
715 RETVAL = newSViv (nrnodes);
720 aug_defnode (g, name, expr, val)
726 struct guestfs_int_bool *r;
728 r = guestfs_aug_defnode (g, name, expr, val);
730 croak ("aug_defnode: %s", guestfs_last_error (g));
732 PUSHs (sv_2mortal (newSViv (r->i)));
733 PUSHs (sv_2mortal (newSViv (r->b)));
734 guestfs_free_int_bool (r);
743 val = guestfs_aug_get (g, path);
745 croak ("aug_get: %s", guestfs_last_error (g));
746 RETVAL = newSVpv (val, 0);
752 aug_set (g, path, val)
759 r = guestfs_aug_set (g, path, val);
761 croak ("aug_set: %s", guestfs_last_error (g));
764 aug_insert (g, path, label, before)
772 r = guestfs_aug_insert (g, path, label, before);
774 croak ("aug_insert: %s", guestfs_last_error (g));
783 nrnodes = guestfs_aug_rm (g, path);
785 croak ("aug_rm: %s", guestfs_last_error (g));
786 RETVAL = newSViv (nrnodes);
791 aug_mv (g, src, dest)
798 r = guestfs_aug_mv (g, src, dest);
800 croak ("aug_mv: %s", guestfs_last_error (g));
810 matches = guestfs_aug_match (g, path);
812 croak ("aug_match: %s", guestfs_last_error (g));
813 for (n = 0; matches[n] != NULL; ++n) /**/;
815 for (i = 0; i < n; ++i) {
816 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
827 r = guestfs_aug_save (g);
829 croak ("aug_save: %s", guestfs_last_error (g));
837 r = guestfs_aug_load (g);
839 croak ("aug_load: %s", guestfs_last_error (g));
849 matches = guestfs_aug_ls (g, path);
851 croak ("aug_ls: %s", guestfs_last_error (g));
852 for (n = 0; matches[n] != NULL; ++n) /**/;
854 for (i = 0; i < n; ++i) {
855 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
867 r = guestfs_rm (g, path);
869 croak ("rm: %s", guestfs_last_error (g));
878 r = guestfs_rmdir (g, path);
880 croak ("rmdir: %s", guestfs_last_error (g));
889 r = guestfs_rm_rf (g, path);
891 croak ("rm_rf: %s", guestfs_last_error (g));
900 r = guestfs_mkdir (g, path);
902 croak ("mkdir: %s", guestfs_last_error (g));
911 r = guestfs_mkdir_p (g, path);
913 croak ("mkdir_p: %s", guestfs_last_error (g));
916 chmod (g, mode, path)
923 r = guestfs_chmod (g, mode, path);
925 croak ("chmod: %s", guestfs_last_error (g));
928 chown (g, owner, group, path)
936 r = guestfs_chown (g, owner, group, path);
938 croak ("chown: %s", guestfs_last_error (g));
947 existsflag = guestfs_exists (g, path);
948 if (existsflag == -1)
949 croak ("exists: %s", guestfs_last_error (g));
950 RETVAL = newSViv (existsflag);
961 fileflag = guestfs_is_file (g, path);
963 croak ("is_file: %s", guestfs_last_error (g));
964 RETVAL = newSViv (fileflag);
975 dirflag = guestfs_is_dir (g, path);
977 croak ("is_dir: %s", guestfs_last_error (g));
978 RETVAL = newSViv (dirflag);
989 r = guestfs_pvcreate (g, device);
991 croak ("pvcreate: %s", guestfs_last_error (g));
994 vgcreate (g, volgroup, physvols)
1001 r = guestfs_vgcreate (g, volgroup, physvols);
1004 croak ("vgcreate: %s", guestfs_last_error (g));
1007 lvcreate (g, logvol, volgroup, mbytes)
1015 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
1017 croak ("lvcreate: %s", guestfs_last_error (g));
1020 mkfs (g, fstype, device)
1027 r = guestfs_mkfs (g, fstype, device);
1029 croak ("mkfs: %s", guestfs_last_error (g));
1032 sfdisk (g, device, cyls, heads, sectors, lines)
1042 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1045 croak ("sfdisk: %s", guestfs_last_error (g));
1048 write_file (g, path, content, size)
1056 r = guestfs_write_file (g, path, content, size);
1058 croak ("write_file: %s", guestfs_last_error (g));
1061 umount (g, pathordevice)
1067 r = guestfs_umount (g, pathordevice);
1069 croak ("umount: %s", guestfs_last_error (g));
1078 devices = guestfs_mounts (g);
1079 if (devices == NULL)
1080 croak ("mounts: %s", guestfs_last_error (g));
1081 for (n = 0; devices[n] != NULL; ++n) /**/;
1083 for (i = 0; i < n; ++i) {
1084 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1095 r = guestfs_umount_all (g);
1097 croak ("umount_all: %s", guestfs_last_error (g));
1105 r = guestfs_lvm_remove_all (g);
1107 croak ("lvm_remove_all: %s", guestfs_last_error (g));
1116 description = guestfs_file (g, path);
1117 if (description == NULL)
1118 croak ("file: %s", guestfs_last_error (g));
1119 RETVAL = newSVpv (description, 0);
1125 command (g, arguments)
1131 output = guestfs_command (g, arguments);
1134 croak ("command: %s", guestfs_last_error (g));
1135 RETVAL = newSVpv (output, 0);
1141 command_lines (g, arguments)
1148 lines = guestfs_command_lines (g, arguments);
1151 croak ("command_lines: %s", guestfs_last_error (g));
1152 for (n = 0; lines[n] != NULL; ++n) /**/;
1154 for (i = 0; i < n; ++i) {
1155 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1165 struct guestfs_stat *statbuf;
1167 statbuf = guestfs_stat (g, path);
1168 if (statbuf == NULL)
1169 croak ("stat: %s", guestfs_last_error (g));
1171 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1172 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1173 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1174 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1175 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1176 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1177 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1178 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1179 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1180 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1181 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1182 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1183 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1191 struct guestfs_stat *statbuf;
1193 statbuf = guestfs_lstat (g, path);
1194 if (statbuf == NULL)
1195 croak ("lstat: %s", guestfs_last_error (g));
1197 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1198 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1199 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1200 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1201 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1202 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1203 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1204 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1205 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1206 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1207 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1208 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1209 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1217 struct guestfs_statvfs *statbuf;
1219 statbuf = guestfs_statvfs (g, path);
1220 if (statbuf == NULL)
1221 croak ("statvfs: %s", guestfs_last_error (g));
1223 PUSHs (sv_2mortal (my_newSVll (statbuf->bsize)));
1224 PUSHs (sv_2mortal (my_newSVll (statbuf->frsize)));
1225 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1226 PUSHs (sv_2mortal (my_newSVll (statbuf->bfree)));
1227 PUSHs (sv_2mortal (my_newSVll (statbuf->bavail)));
1228 PUSHs (sv_2mortal (my_newSVll (statbuf->files)));
1229 PUSHs (sv_2mortal (my_newSVll (statbuf->ffree)));
1230 PUSHs (sv_2mortal (my_newSVll (statbuf->favail)));
1231 PUSHs (sv_2mortal (my_newSVll (statbuf->fsid)));
1232 PUSHs (sv_2mortal (my_newSVll (statbuf->flag)));
1233 PUSHs (sv_2mortal (my_newSVll (statbuf->namemax)));
1237 tune2fs_l (g, device)
1244 superblock = guestfs_tune2fs_l (g, device);
1245 if (superblock == NULL)
1246 croak ("tune2fs_l: %s", guestfs_last_error (g));
1247 for (n = 0; superblock[n] != NULL; ++n) /**/;
1249 for (i = 0; i < n; ++i) {
1250 PUSHs (sv_2mortal (newSVpv (superblock[i], 0)));
1251 free (superblock[i]);
1256 blockdev_setro (g, device)
1262 r = guestfs_blockdev_setro (g, device);
1264 croak ("blockdev_setro: %s", guestfs_last_error (g));
1267 blockdev_setrw (g, device)
1273 r = guestfs_blockdev_setrw (g, device);
1275 croak ("blockdev_setrw: %s", guestfs_last_error (g));
1278 blockdev_getro (g, device)
1284 ro = guestfs_blockdev_getro (g, device);
1286 croak ("blockdev_getro: %s", guestfs_last_error (g));
1287 RETVAL = newSViv (ro);
1292 blockdev_getss (g, device)
1298 sectorsize = guestfs_blockdev_getss (g, device);
1299 if (sectorsize == -1)
1300 croak ("blockdev_getss: %s", guestfs_last_error (g));
1301 RETVAL = newSViv (sectorsize);
1306 blockdev_getbsz (g, device)
1312 blocksize = guestfs_blockdev_getbsz (g, device);
1313 if (blocksize == -1)
1314 croak ("blockdev_getbsz: %s", guestfs_last_error (g));
1315 RETVAL = newSViv (blocksize);
1320 blockdev_setbsz (g, device, blocksize)
1327 r = guestfs_blockdev_setbsz (g, device, blocksize);
1329 croak ("blockdev_setbsz: %s", guestfs_last_error (g));
1332 blockdev_getsz (g, device)
1336 int64_t sizeinsectors;
1338 sizeinsectors = guestfs_blockdev_getsz (g, device);
1339 if (sizeinsectors == -1)
1340 croak ("blockdev_getsz: %s", guestfs_last_error (g));
1341 RETVAL = my_newSVll (sizeinsectors);
1346 blockdev_getsize64 (g, device)
1350 int64_t sizeinbytes;
1352 sizeinbytes = guestfs_blockdev_getsize64 (g, device);
1353 if (sizeinbytes == -1)
1354 croak ("blockdev_getsize64: %s", guestfs_last_error (g));
1355 RETVAL = my_newSVll (sizeinbytes);
1360 blockdev_flushbufs (g, device)
1366 r = guestfs_blockdev_flushbufs (g, device);
1368 croak ("blockdev_flushbufs: %s", guestfs_last_error (g));
1371 blockdev_rereadpt (g, device)
1377 r = guestfs_blockdev_rereadpt (g, device);
1379 croak ("blockdev_rereadpt: %s", guestfs_last_error (g));
1382 upload (g, filename, remotefilename)
1385 char *remotefilename;
1389 r = guestfs_upload (g, filename, remotefilename);
1391 croak ("upload: %s", guestfs_last_error (g));
1394 download (g, remotefilename, filename)
1396 char *remotefilename;
1401 r = guestfs_download (g, remotefilename, filename);
1403 croak ("download: %s", guestfs_last_error (g));
1406 checksum (g, csumtype, path)
1413 checksum = guestfs_checksum (g, csumtype, path);
1414 if (checksum == NULL)
1415 croak ("checksum: %s", guestfs_last_error (g));
1416 RETVAL = newSVpv (checksum, 0);
1422 tar_in (g, tarfile, directory)
1429 r = guestfs_tar_in (g, tarfile, directory);
1431 croak ("tar_in: %s", guestfs_last_error (g));
1434 tar_out (g, directory, tarfile)
1441 r = guestfs_tar_out (g, directory, tarfile);
1443 croak ("tar_out: %s", guestfs_last_error (g));
1446 tgz_in (g, tarball, directory)
1453 r = guestfs_tgz_in (g, tarball, directory);
1455 croak ("tgz_in: %s", guestfs_last_error (g));
1458 tgz_out (g, directory, tarball)
1465 r = guestfs_tgz_out (g, directory, tarball);
1467 croak ("tgz_out: %s", guestfs_last_error (g));
1470 mount_ro (g, device, mountpoint)
1477 r = guestfs_mount_ro (g, device, mountpoint);
1479 croak ("mount_ro: %s", guestfs_last_error (g));
1482 mount_options (g, options, device, mountpoint)
1490 r = guestfs_mount_options (g, options, device, mountpoint);
1492 croak ("mount_options: %s", guestfs_last_error (g));
1495 mount_vfs (g, options, vfstype, device, mountpoint)
1504 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
1506 croak ("mount_vfs: %s", guestfs_last_error (g));
1509 debug (g, subcmd, extraargs)
1516 result = guestfs_debug (g, subcmd, extraargs);
1519 croak ("debug: %s", guestfs_last_error (g));
1520 RETVAL = newSVpv (result, 0);
1526 lvremove (g, device)
1532 r = guestfs_lvremove (g, device);
1534 croak ("lvremove: %s", guestfs_last_error (g));
1537 vgremove (g, vgname)
1543 r = guestfs_vgremove (g, vgname);
1545 croak ("vgremove: %s", guestfs_last_error (g));
1548 pvremove (g, device)
1554 r = guestfs_pvremove (g, device);
1556 croak ("pvremove: %s", guestfs_last_error (g));
1559 set_e2label (g, device, label)
1566 r = guestfs_set_e2label (g, device, label);
1568 croak ("set_e2label: %s", guestfs_last_error (g));
1571 get_e2label (g, device)
1577 label = guestfs_get_e2label (g, device);
1579 croak ("get_e2label: %s", guestfs_last_error (g));
1580 RETVAL = newSVpv (label, 0);
1586 set_e2uuid (g, device, uuid)
1593 r = guestfs_set_e2uuid (g, device, uuid);
1595 croak ("set_e2uuid: %s", guestfs_last_error (g));
1598 get_e2uuid (g, device)
1604 uuid = guestfs_get_e2uuid (g, device);
1606 croak ("get_e2uuid: %s", guestfs_last_error (g));
1607 RETVAL = newSVpv (uuid, 0);
1613 fsck (g, fstype, device)
1620 status = guestfs_fsck (g, fstype, device);
1622 croak ("fsck: %s", guestfs_last_error (g));
1623 RETVAL = newSViv (status);
1634 r = guestfs_zero (g, device);
1636 croak ("zero: %s", guestfs_last_error (g));
1639 grub_install (g, root, device)
1646 r = guestfs_grub_install (g, root, device);
1648 croak ("grub_install: %s", guestfs_last_error (g));
1658 r = guestfs_cp (g, src, dest);
1660 croak ("cp: %s", guestfs_last_error (g));
1670 r = guestfs_cp_a (g, src, dest);
1672 croak ("cp_a: %s", guestfs_last_error (g));
1682 r = guestfs_mv (g, src, dest);
1684 croak ("mv: %s", guestfs_last_error (g));
1687 drop_caches (g, whattodrop)
1693 r = guestfs_drop_caches (g, whattodrop);
1695 croak ("drop_caches: %s", guestfs_last_error (g));
1703 kmsgs = guestfs_dmesg (g);
1705 croak ("dmesg: %s", guestfs_last_error (g));
1706 RETVAL = newSVpv (kmsgs, 0);
1717 r = guestfs_ping_daemon (g);
1719 croak ("ping_daemon: %s", guestfs_last_error (g));
1722 equal (g, file1, file2)
1729 equality = guestfs_equal (g, file1, file2);
1731 croak ("equal: %s", guestfs_last_error (g));
1732 RETVAL = newSViv (equality);
1744 stringsout = guestfs_strings (g, path);
1745 if (stringsout == NULL)
1746 croak ("strings: %s", guestfs_last_error (g));
1747 for (n = 0; stringsout[n] != NULL; ++n) /**/;
1749 for (i = 0; i < n; ++i) {
1750 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
1751 free (stringsout[i]);
1756 strings_e (g, encoding, path)
1764 stringsout = guestfs_strings_e (g, encoding, path);
1765 if (stringsout == NULL)
1766 croak ("strings_e: %s", guestfs_last_error (g));
1767 for (n = 0; stringsout[n] != NULL; ++n) /**/;
1769 for (i = 0; i < n; ++i) {
1770 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
1771 free (stringsout[i]);
1782 dump = guestfs_hexdump (g, path);
1784 croak ("hexdump: %s", guestfs_last_error (g));
1785 RETVAL = newSVpv (dump, 0);
1791 zerofree (g, device)
1797 r = guestfs_zerofree (g, device);
1799 croak ("zerofree: %s", guestfs_last_error (g));
1802 pvresize (g, device)
1808 r = guestfs_pvresize (g, device);
1810 croak ("pvresize: %s", guestfs_last_error (g));
1813 sfdisk_N (g, device, n, cyls, heads, sectors, line)
1824 r = guestfs_sfdisk_N (g, device, n, cyls, heads, sectors, line);
1826 croak ("sfdisk_N: %s", guestfs_last_error (g));
1829 sfdisk_l (g, device)
1835 partitions = guestfs_sfdisk_l (g, device);
1836 if (partitions == NULL)
1837 croak ("sfdisk_l: %s", guestfs_last_error (g));
1838 RETVAL = newSVpv (partitions, 0);
1844 sfdisk_kernel_geometry (g, device)
1850 partitions = guestfs_sfdisk_kernel_geometry (g, device);
1851 if (partitions == NULL)
1852 croak ("sfdisk_kernel_geometry: %s", guestfs_last_error (g));
1853 RETVAL = newSVpv (partitions, 0);
1859 sfdisk_disk_geometry (g, device)
1865 partitions = guestfs_sfdisk_disk_geometry (g, device);
1866 if (partitions == NULL)
1867 croak ("sfdisk_disk_geometry: %s", guestfs_last_error (g));
1868 RETVAL = newSVpv (partitions, 0);
1874 vg_activate_all (g, activate)
1880 r = guestfs_vg_activate_all (g, activate);
1882 croak ("vg_activate_all: %s", guestfs_last_error (g));
1885 vg_activate (g, activate, volgroups)
1892 r = guestfs_vg_activate (g, activate, volgroups);
1895 croak ("vg_activate: %s", guestfs_last_error (g));
1898 lvresize (g, device, mbytes)
1905 r = guestfs_lvresize (g, device, mbytes);
1907 croak ("lvresize: %s", guestfs_last_error (g));
1910 resize2fs (g, device)
1916 r = guestfs_resize2fs (g, device);
1918 croak ("resize2fs: %s", guestfs_last_error (g));
1928 names = guestfs_find (g, directory);
1930 croak ("find: %s", guestfs_last_error (g));
1931 for (n = 0; names[n] != NULL; ++n) /**/;
1933 for (i = 0; i < n; ++i) {
1934 PUSHs (sv_2mortal (newSVpv (names[i], 0)));
1940 e2fsck_f (g, device)
1946 r = guestfs_e2fsck_f (g, device);
1948 croak ("e2fsck_f: %s", guestfs_last_error (g));