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_autosync (g, autosync)
228 r = guestfs_set_autosync (g, autosync);
230 croak ("set_autosync: %s", guestfs_last_error (g));
238 autosync = guestfs_get_autosync (g);
240 croak ("get_autosync: %s", guestfs_last_error (g));
241 RETVAL = newSViv (autosync);
246 set_verbose (g, verbose)
252 r = guestfs_set_verbose (g, verbose);
254 croak ("set_verbose: %s", guestfs_last_error (g));
262 verbose = guestfs_get_verbose (g);
264 croak ("get_verbose: %s", guestfs_last_error (g));
265 RETVAL = newSViv (verbose);
275 ready = guestfs_is_ready (g);
277 croak ("is_ready: %s", guestfs_last_error (g));
278 RETVAL = newSViv (ready);
288 config = guestfs_is_config (g);
290 croak ("is_config: %s", guestfs_last_error (g));
291 RETVAL = newSViv (config);
301 launching = guestfs_is_launching (g);
303 croak ("is_launching: %s", guestfs_last_error (g));
304 RETVAL = newSViv (launching);
314 busy = guestfs_is_busy (g);
316 croak ("is_busy: %s", guestfs_last_error (g));
317 RETVAL = newSViv (busy);
327 state = guestfs_get_state (g);
329 croak ("get_state: %s", guestfs_last_error (g));
330 RETVAL = newSViv (state);
340 r = guestfs_set_busy (g);
342 croak ("set_busy: %s", guestfs_last_error (g));
350 r = guestfs_set_ready (g);
352 croak ("set_ready: %s", guestfs_last_error (g));
360 r = guestfs_end_busy (g);
362 croak ("end_busy: %s", guestfs_last_error (g));
365 mount (g, device, mountpoint)
372 r = guestfs_mount (g, device, mountpoint);
374 croak ("mount: %s", guestfs_last_error (g));
382 r = guestfs_sync (g);
384 croak ("sync: %s", guestfs_last_error (g));
393 r = guestfs_touch (g, path);
395 croak ("touch: %s", guestfs_last_error (g));
404 content = guestfs_cat (g, path);
406 croak ("cat: %s", guestfs_last_error (g));
407 RETVAL = newSVpv (content, 0);
419 listing = guestfs_ll (g, directory);
421 croak ("ll: %s", guestfs_last_error (g));
422 RETVAL = newSVpv (listing, 0);
435 listing = guestfs_ls (g, directory);
437 croak ("ls: %s", guestfs_last_error (g));
438 for (n = 0; listing[n] != NULL; ++n) /**/;
440 for (i = 0; i < n; ++i) {
441 PUSHs (sv_2mortal (newSVpv (listing[i], 0)));
453 devices = guestfs_list_devices (g);
455 croak ("list_devices: %s", guestfs_last_error (g));
456 for (n = 0; devices[n] != NULL; ++n) /**/;
458 for (i = 0; i < n; ++i) {
459 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
471 partitions = guestfs_list_partitions (g);
472 if (partitions == NULL)
473 croak ("list_partitions: %s", guestfs_last_error (g));
474 for (n = 0; partitions[n] != NULL; ++n) /**/;
476 for (i = 0; i < n; ++i) {
477 PUSHs (sv_2mortal (newSVpv (partitions[i], 0)));
478 free (partitions[i]);
489 physvols = guestfs_pvs (g);
490 if (physvols == NULL)
491 croak ("pvs: %s", guestfs_last_error (g));
492 for (n = 0; physvols[n] != NULL; ++n) /**/;
494 for (i = 0; i < n; ++i) {
495 PUSHs (sv_2mortal (newSVpv (physvols[i], 0)));
507 volgroups = guestfs_vgs (g);
508 if (volgroups == NULL)
509 croak ("vgs: %s", guestfs_last_error (g));
510 for (n = 0; volgroups[n] != NULL; ++n) /**/;
512 for (i = 0; i < n; ++i) {
513 PUSHs (sv_2mortal (newSVpv (volgroups[i], 0)));
525 logvols = guestfs_lvs (g);
527 croak ("lvs: %s", guestfs_last_error (g));
528 for (n = 0; logvols[n] != NULL; ++n) /**/;
530 for (i = 0; i < n; ++i) {
531 PUSHs (sv_2mortal (newSVpv (logvols[i], 0)));
540 struct guestfs_lvm_pv_list *physvols;
544 physvols = guestfs_pvs_full (g);
545 if (physvols == NULL)
546 croak ("pvs_full: %s", guestfs_last_error (g));
547 EXTEND (SP, physvols->len);
548 for (i = 0; i < physvols->len; ++i) {
550 (void) hv_store (hv, "pv_name", 7, newSVpv (physvols->val[i].pv_name, 0), 0);
551 (void) hv_store (hv, "pv_uuid", 7, newSVpv (physvols->val[i].pv_uuid, 32), 0);
552 (void) hv_store (hv, "pv_fmt", 6, newSVpv (physvols->val[i].pv_fmt, 0), 0);
553 (void) hv_store (hv, "pv_size", 7, my_newSVull (physvols->val[i].pv_size), 0);
554 (void) hv_store (hv, "dev_size", 8, my_newSVull (physvols->val[i].dev_size), 0);
555 (void) hv_store (hv, "pv_free", 7, my_newSVull (physvols->val[i].pv_free), 0);
556 (void) hv_store (hv, "pv_used", 7, my_newSVull (physvols->val[i].pv_used), 0);
557 (void) hv_store (hv, "pv_attr", 7, newSVpv (physvols->val[i].pv_attr, 0), 0);
558 (void) hv_store (hv, "pv_pe_count", 11, my_newSVll (physvols->val[i].pv_pe_count), 0);
559 (void) hv_store (hv, "pv_pe_alloc_count", 17, my_newSVll (physvols->val[i].pv_pe_alloc_count), 0);
560 (void) hv_store (hv, "pv_tags", 7, newSVpv (physvols->val[i].pv_tags, 0), 0);
561 (void) hv_store (hv, "pe_start", 8, my_newSVull (physvols->val[i].pe_start), 0);
562 (void) hv_store (hv, "pv_mda_count", 12, my_newSVll (physvols->val[i].pv_mda_count), 0);
563 (void) hv_store (hv, "pv_mda_free", 11, my_newSVull (physvols->val[i].pv_mda_free), 0);
564 PUSHs (sv_2mortal ((SV *) hv));
566 guestfs_free_lvm_pv_list (physvols);
572 struct guestfs_lvm_vg_list *volgroups;
576 volgroups = guestfs_vgs_full (g);
577 if (volgroups == NULL)
578 croak ("vgs_full: %s", guestfs_last_error (g));
579 EXTEND (SP, volgroups->len);
580 for (i = 0; i < volgroups->len; ++i) {
582 (void) hv_store (hv, "vg_name", 7, newSVpv (volgroups->val[i].vg_name, 0), 0);
583 (void) hv_store (hv, "vg_uuid", 7, newSVpv (volgroups->val[i].vg_uuid, 32), 0);
584 (void) hv_store (hv, "vg_fmt", 6, newSVpv (volgroups->val[i].vg_fmt, 0), 0);
585 (void) hv_store (hv, "vg_attr", 7, newSVpv (volgroups->val[i].vg_attr, 0), 0);
586 (void) hv_store (hv, "vg_size", 7, my_newSVull (volgroups->val[i].vg_size), 0);
587 (void) hv_store (hv, "vg_free", 7, my_newSVull (volgroups->val[i].vg_free), 0);
588 (void) hv_store (hv, "vg_sysid", 8, newSVpv (volgroups->val[i].vg_sysid, 0), 0);
589 (void) hv_store (hv, "vg_extent_size", 14, my_newSVull (volgroups->val[i].vg_extent_size), 0);
590 (void) hv_store (hv, "vg_extent_count", 15, my_newSVll (volgroups->val[i].vg_extent_count), 0);
591 (void) hv_store (hv, "vg_free_count", 13, my_newSVll (volgroups->val[i].vg_free_count), 0);
592 (void) hv_store (hv, "max_lv", 6, my_newSVll (volgroups->val[i].max_lv), 0);
593 (void) hv_store (hv, "max_pv", 6, my_newSVll (volgroups->val[i].max_pv), 0);
594 (void) hv_store (hv, "pv_count", 8, my_newSVll (volgroups->val[i].pv_count), 0);
595 (void) hv_store (hv, "lv_count", 8, my_newSVll (volgroups->val[i].lv_count), 0);
596 (void) hv_store (hv, "snap_count", 10, my_newSVll (volgroups->val[i].snap_count), 0);
597 (void) hv_store (hv, "vg_seqno", 8, my_newSVll (volgroups->val[i].vg_seqno), 0);
598 (void) hv_store (hv, "vg_tags", 7, newSVpv (volgroups->val[i].vg_tags, 0), 0);
599 (void) hv_store (hv, "vg_mda_count", 12, my_newSVll (volgroups->val[i].vg_mda_count), 0);
600 (void) hv_store (hv, "vg_mda_free", 11, my_newSVull (volgroups->val[i].vg_mda_free), 0);
601 PUSHs (sv_2mortal ((SV *) hv));
603 guestfs_free_lvm_vg_list (volgroups);
609 struct guestfs_lvm_lv_list *logvols;
613 logvols = guestfs_lvs_full (g);
615 croak ("lvs_full: %s", guestfs_last_error (g));
616 EXTEND (SP, logvols->len);
617 for (i = 0; i < logvols->len; ++i) {
619 (void) hv_store (hv, "lv_name", 7, newSVpv (logvols->val[i].lv_name, 0), 0);
620 (void) hv_store (hv, "lv_uuid", 7, newSVpv (logvols->val[i].lv_uuid, 32), 0);
621 (void) hv_store (hv, "lv_attr", 7, newSVpv (logvols->val[i].lv_attr, 0), 0);
622 (void) hv_store (hv, "lv_major", 8, my_newSVll (logvols->val[i].lv_major), 0);
623 (void) hv_store (hv, "lv_minor", 8, my_newSVll (logvols->val[i].lv_minor), 0);
624 (void) hv_store (hv, "lv_kernel_major", 15, my_newSVll (logvols->val[i].lv_kernel_major), 0);
625 (void) hv_store (hv, "lv_kernel_minor", 15, my_newSVll (logvols->val[i].lv_kernel_minor), 0);
626 (void) hv_store (hv, "lv_size", 7, my_newSVull (logvols->val[i].lv_size), 0);
627 (void) hv_store (hv, "seg_count", 9, my_newSVll (logvols->val[i].seg_count), 0);
628 (void) hv_store (hv, "origin", 6, newSVpv (logvols->val[i].origin, 0), 0);
629 (void) hv_store (hv, "snap_percent", 12, newSVnv (logvols->val[i].snap_percent), 0);
630 (void) hv_store (hv, "copy_percent", 12, newSVnv (logvols->val[i].copy_percent), 0);
631 (void) hv_store (hv, "move_pv", 7, newSVpv (logvols->val[i].move_pv, 0), 0);
632 (void) hv_store (hv, "lv_tags", 7, newSVpv (logvols->val[i].lv_tags, 0), 0);
633 (void) hv_store (hv, "mirror_log", 10, newSVpv (logvols->val[i].mirror_log, 0), 0);
634 (void) hv_store (hv, "modules", 7, newSVpv (logvols->val[i].modules, 0), 0);
635 PUSHs (sv_2mortal ((SV *) hv));
637 guestfs_free_lvm_lv_list (logvols);
647 lines = guestfs_read_lines (g, path);
649 croak ("read_lines: %s", guestfs_last_error (g));
650 for (n = 0; lines[n] != NULL; ++n) /**/;
652 for (i = 0; i < n; ++i) {
653 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
659 aug_init (g, root, flags)
666 r = guestfs_aug_init (g, root, flags);
668 croak ("aug_init: %s", guestfs_last_error (g));
676 r = guestfs_aug_close (g);
678 croak ("aug_close: %s", guestfs_last_error (g));
681 aug_defvar (g, name, expr)
688 nrnodes = guestfs_aug_defvar (g, name, expr);
690 croak ("aug_defvar: %s", guestfs_last_error (g));
691 RETVAL = newSViv (nrnodes);
696 aug_defnode (g, name, expr, val)
702 struct guestfs_int_bool *r;
704 r = guestfs_aug_defnode (g, name, expr, val);
706 croak ("aug_defnode: %s", guestfs_last_error (g));
708 PUSHs (sv_2mortal (newSViv (r->i)));
709 PUSHs (sv_2mortal (newSViv (r->b)));
710 guestfs_free_int_bool (r);
719 val = guestfs_aug_get (g, path);
721 croak ("aug_get: %s", guestfs_last_error (g));
722 RETVAL = newSVpv (val, 0);
728 aug_set (g, path, val)
735 r = guestfs_aug_set (g, path, val);
737 croak ("aug_set: %s", guestfs_last_error (g));
740 aug_insert (g, path, label, before)
748 r = guestfs_aug_insert (g, path, label, before);
750 croak ("aug_insert: %s", guestfs_last_error (g));
759 nrnodes = guestfs_aug_rm (g, path);
761 croak ("aug_rm: %s", guestfs_last_error (g));
762 RETVAL = newSViv (nrnodes);
767 aug_mv (g, src, dest)
774 r = guestfs_aug_mv (g, src, dest);
776 croak ("aug_mv: %s", guestfs_last_error (g));
786 matches = guestfs_aug_match (g, path);
788 croak ("aug_match: %s", guestfs_last_error (g));
789 for (n = 0; matches[n] != NULL; ++n) /**/;
791 for (i = 0; i < n; ++i) {
792 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
803 r = guestfs_aug_save (g);
805 croak ("aug_save: %s", guestfs_last_error (g));
813 r = guestfs_aug_load (g);
815 croak ("aug_load: %s", guestfs_last_error (g));
825 matches = guestfs_aug_ls (g, path);
827 croak ("aug_ls: %s", guestfs_last_error (g));
828 for (n = 0; matches[n] != NULL; ++n) /**/;
830 for (i = 0; i < n; ++i) {
831 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
843 r = guestfs_rm (g, path);
845 croak ("rm: %s", guestfs_last_error (g));
854 r = guestfs_rmdir (g, path);
856 croak ("rmdir: %s", guestfs_last_error (g));
865 r = guestfs_rm_rf (g, path);
867 croak ("rm_rf: %s", guestfs_last_error (g));
876 r = guestfs_mkdir (g, path);
878 croak ("mkdir: %s", guestfs_last_error (g));
887 r = guestfs_mkdir_p (g, path);
889 croak ("mkdir_p: %s", guestfs_last_error (g));
892 chmod (g, mode, path)
899 r = guestfs_chmod (g, mode, path);
901 croak ("chmod: %s", guestfs_last_error (g));
904 chown (g, owner, group, path)
912 r = guestfs_chown (g, owner, group, path);
914 croak ("chown: %s", guestfs_last_error (g));
923 existsflag = guestfs_exists (g, path);
924 if (existsflag == -1)
925 croak ("exists: %s", guestfs_last_error (g));
926 RETVAL = newSViv (existsflag);
937 fileflag = guestfs_is_file (g, path);
939 croak ("is_file: %s", guestfs_last_error (g));
940 RETVAL = newSViv (fileflag);
951 dirflag = guestfs_is_dir (g, path);
953 croak ("is_dir: %s", guestfs_last_error (g));
954 RETVAL = newSViv (dirflag);
965 r = guestfs_pvcreate (g, device);
967 croak ("pvcreate: %s", guestfs_last_error (g));
970 vgcreate (g, volgroup, physvols)
977 r = guestfs_vgcreate (g, volgroup, physvols);
980 croak ("vgcreate: %s", guestfs_last_error (g));
983 lvcreate (g, logvol, volgroup, mbytes)
991 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
993 croak ("lvcreate: %s", guestfs_last_error (g));
996 mkfs (g, fstype, device)
1003 r = guestfs_mkfs (g, fstype, device);
1005 croak ("mkfs: %s", guestfs_last_error (g));
1008 sfdisk (g, device, cyls, heads, sectors, lines)
1018 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1021 croak ("sfdisk: %s", guestfs_last_error (g));
1024 write_file (g, path, content, size)
1032 r = guestfs_write_file (g, path, content, size);
1034 croak ("write_file: %s", guestfs_last_error (g));
1037 umount (g, pathordevice)
1043 r = guestfs_umount (g, pathordevice);
1045 croak ("umount: %s", guestfs_last_error (g));
1054 devices = guestfs_mounts (g);
1055 if (devices == NULL)
1056 croak ("mounts: %s", guestfs_last_error (g));
1057 for (n = 0; devices[n] != NULL; ++n) /**/;
1059 for (i = 0; i < n; ++i) {
1060 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1071 r = guestfs_umount_all (g);
1073 croak ("umount_all: %s", guestfs_last_error (g));
1081 r = guestfs_lvm_remove_all (g);
1083 croak ("lvm_remove_all: %s", guestfs_last_error (g));
1092 description = guestfs_file (g, path);
1093 if (description == NULL)
1094 croak ("file: %s", guestfs_last_error (g));
1095 RETVAL = newSVpv (description, 0);
1101 command (g, arguments)
1107 output = guestfs_command (g, arguments);
1110 croak ("command: %s", guestfs_last_error (g));
1111 RETVAL = newSVpv (output, 0);
1117 command_lines (g, arguments)
1124 lines = guestfs_command_lines (g, arguments);
1127 croak ("command_lines: %s", guestfs_last_error (g));
1128 for (n = 0; lines[n] != NULL; ++n) /**/;
1130 for (i = 0; i < n; ++i) {
1131 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1141 struct guestfs_stat *statbuf;
1143 statbuf = guestfs_stat (g, path);
1144 if (statbuf == NULL)
1145 croak ("stat: %s", guestfs_last_error (g));
1147 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1148 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1149 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1150 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1151 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1152 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1153 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1154 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1155 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1156 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1157 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1158 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1159 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1167 struct guestfs_stat *statbuf;
1169 statbuf = guestfs_lstat (g, path);
1170 if (statbuf == NULL)
1171 croak ("lstat: %s", guestfs_last_error (g));
1173 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1174 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1175 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1176 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1177 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1178 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1179 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1180 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1181 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1182 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1183 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1184 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1185 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1193 struct guestfs_statvfs *statbuf;
1195 statbuf = guestfs_statvfs (g, path);
1196 if (statbuf == NULL)
1197 croak ("statvfs: %s", guestfs_last_error (g));
1199 PUSHs (sv_2mortal (my_newSVll (statbuf->bsize)));
1200 PUSHs (sv_2mortal (my_newSVll (statbuf->frsize)));
1201 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1202 PUSHs (sv_2mortal (my_newSVll (statbuf->bfree)));
1203 PUSHs (sv_2mortal (my_newSVll (statbuf->bavail)));
1204 PUSHs (sv_2mortal (my_newSVll (statbuf->files)));
1205 PUSHs (sv_2mortal (my_newSVll (statbuf->ffree)));
1206 PUSHs (sv_2mortal (my_newSVll (statbuf->favail)));
1207 PUSHs (sv_2mortal (my_newSVll (statbuf->fsid)));
1208 PUSHs (sv_2mortal (my_newSVll (statbuf->flag)));
1209 PUSHs (sv_2mortal (my_newSVll (statbuf->namemax)));
1213 tune2fs_l (g, device)
1220 superblock = guestfs_tune2fs_l (g, device);
1221 if (superblock == NULL)
1222 croak ("tune2fs_l: %s", guestfs_last_error (g));
1223 for (n = 0; superblock[n] != NULL; ++n) /**/;
1225 for (i = 0; i < n; ++i) {
1226 PUSHs (sv_2mortal (newSVpv (superblock[i], 0)));
1227 free (superblock[i]);
1232 blockdev_setro (g, device)
1238 r = guestfs_blockdev_setro (g, device);
1240 croak ("blockdev_setro: %s", guestfs_last_error (g));
1243 blockdev_setrw (g, device)
1249 r = guestfs_blockdev_setrw (g, device);
1251 croak ("blockdev_setrw: %s", guestfs_last_error (g));
1254 blockdev_getro (g, device)
1260 ro = guestfs_blockdev_getro (g, device);
1262 croak ("blockdev_getro: %s", guestfs_last_error (g));
1263 RETVAL = newSViv (ro);
1268 blockdev_getss (g, device)
1274 sectorsize = guestfs_blockdev_getss (g, device);
1275 if (sectorsize == -1)
1276 croak ("blockdev_getss: %s", guestfs_last_error (g));
1277 RETVAL = newSViv (sectorsize);
1282 blockdev_getbsz (g, device)
1288 blocksize = guestfs_blockdev_getbsz (g, device);
1289 if (blocksize == -1)
1290 croak ("blockdev_getbsz: %s", guestfs_last_error (g));
1291 RETVAL = newSViv (blocksize);
1296 blockdev_setbsz (g, device, blocksize)
1303 r = guestfs_blockdev_setbsz (g, device, blocksize);
1305 croak ("blockdev_setbsz: %s", guestfs_last_error (g));
1308 blockdev_getsz (g, device)
1312 int64_t sizeinsectors;
1314 sizeinsectors = guestfs_blockdev_getsz (g, device);
1315 if (sizeinsectors == -1)
1316 croak ("blockdev_getsz: %s", guestfs_last_error (g));
1317 RETVAL = my_newSVll (sizeinsectors);
1322 blockdev_getsize64 (g, device)
1326 int64_t sizeinbytes;
1328 sizeinbytes = guestfs_blockdev_getsize64 (g, device);
1329 if (sizeinbytes == -1)
1330 croak ("blockdev_getsize64: %s", guestfs_last_error (g));
1331 RETVAL = my_newSVll (sizeinbytes);
1336 blockdev_flushbufs (g, device)
1342 r = guestfs_blockdev_flushbufs (g, device);
1344 croak ("blockdev_flushbufs: %s", guestfs_last_error (g));
1347 blockdev_rereadpt (g, device)
1353 r = guestfs_blockdev_rereadpt (g, device);
1355 croak ("blockdev_rereadpt: %s", guestfs_last_error (g));
1358 upload (g, filename, remotefilename)
1361 char *remotefilename;
1365 r = guestfs_upload (g, filename, remotefilename);
1367 croak ("upload: %s", guestfs_last_error (g));
1370 download (g, remotefilename, filename)
1372 char *remotefilename;
1377 r = guestfs_download (g, remotefilename, filename);
1379 croak ("download: %s", guestfs_last_error (g));
1382 checksum (g, csumtype, path)
1389 checksum = guestfs_checksum (g, csumtype, path);
1390 if (checksum == NULL)
1391 croak ("checksum: %s", guestfs_last_error (g));
1392 RETVAL = newSVpv (checksum, 0);
1398 tar_in (g, tarfile, directory)
1405 r = guestfs_tar_in (g, tarfile, directory);
1407 croak ("tar_in: %s", guestfs_last_error (g));
1410 tar_out (g, directory, tarfile)
1417 r = guestfs_tar_out (g, directory, tarfile);
1419 croak ("tar_out: %s", guestfs_last_error (g));
1422 tgz_in (g, tarball, directory)
1429 r = guestfs_tgz_in (g, tarball, directory);
1431 croak ("tgz_in: %s", guestfs_last_error (g));
1434 tgz_out (g, directory, tarball)
1441 r = guestfs_tgz_out (g, directory, tarball);
1443 croak ("tgz_out: %s", guestfs_last_error (g));
1446 mount_ro (g, device, mountpoint)
1453 r = guestfs_mount_ro (g, device, mountpoint);
1455 croak ("mount_ro: %s", guestfs_last_error (g));
1458 mount_options (g, options, device, mountpoint)
1466 r = guestfs_mount_options (g, options, device, mountpoint);
1468 croak ("mount_options: %s", guestfs_last_error (g));
1471 mount_vfs (g, options, vfstype, device, mountpoint)
1480 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
1482 croak ("mount_vfs: %s", guestfs_last_error (g));
1485 debug (g, subcmd, extraargs)
1492 result = guestfs_debug (g, subcmd, extraargs);
1495 croak ("debug: %s", guestfs_last_error (g));
1496 RETVAL = newSVpv (result, 0);
1502 lvremove (g, device)
1508 r = guestfs_lvremove (g, device);
1510 croak ("lvremove: %s", guestfs_last_error (g));
1513 vgremove (g, vgname)
1519 r = guestfs_vgremove (g, vgname);
1521 croak ("vgremove: %s", guestfs_last_error (g));
1524 pvremove (g, device)
1530 r = guestfs_pvremove (g, device);
1532 croak ("pvremove: %s", guestfs_last_error (g));
1535 set_e2label (g, device, label)
1542 r = guestfs_set_e2label (g, device, label);
1544 croak ("set_e2label: %s", guestfs_last_error (g));
1547 get_e2label (g, device)
1553 label = guestfs_get_e2label (g, device);
1555 croak ("get_e2label: %s", guestfs_last_error (g));
1556 RETVAL = newSVpv (label, 0);
1562 set_e2uuid (g, device, uuid)
1569 r = guestfs_set_e2uuid (g, device, uuid);
1571 croak ("set_e2uuid: %s", guestfs_last_error (g));
1574 get_e2uuid (g, device)
1580 uuid = guestfs_get_e2uuid (g, device);
1582 croak ("get_e2uuid: %s", guestfs_last_error (g));
1583 RETVAL = newSVpv (uuid, 0);
1589 fsck (g, fstype, device)
1596 status = guestfs_fsck (g, fstype, device);
1598 croak ("fsck: %s", guestfs_last_error (g));
1599 RETVAL = newSViv (status);
1610 r = guestfs_zero (g, device);
1612 croak ("zero: %s", guestfs_last_error (g));
1615 grub_install (g, root, device)
1622 r = guestfs_grub_install (g, root, device);
1624 croak ("grub_install: %s", guestfs_last_error (g));
1634 r = guestfs_cp (g, src, dest);
1636 croak ("cp: %s", guestfs_last_error (g));
1646 r = guestfs_cp_a (g, src, dest);
1648 croak ("cp_a: %s", guestfs_last_error (g));
1658 r = guestfs_mv (g, src, dest);
1660 croak ("mv: %s", guestfs_last_error (g));
1663 drop_caches (g, whattodrop)
1669 r = guestfs_drop_caches (g, whattodrop);
1671 croak ("drop_caches: %s", guestfs_last_error (g));
1679 kmsgs = guestfs_dmesg (g);
1681 croak ("dmesg: %s", guestfs_last_error (g));
1682 RETVAL = newSVpv (kmsgs, 0);
1693 r = guestfs_ping_daemon (g);
1695 croak ("ping_daemon: %s", guestfs_last_error (g));
1698 equal (g, file1, file2)
1705 equality = guestfs_equal (g, file1, file2);
1707 croak ("equal: %s", guestfs_last_error (g));
1708 RETVAL = newSViv (equality);
1720 stringsout = guestfs_strings (g, path);
1721 if (stringsout == NULL)
1722 croak ("strings: %s", guestfs_last_error (g));
1723 for (n = 0; stringsout[n] != NULL; ++n) /**/;
1725 for (i = 0; i < n; ++i) {
1726 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
1727 free (stringsout[i]);
1732 strings_e (g, encoding, path)
1740 stringsout = guestfs_strings_e (g, encoding, path);
1741 if (stringsout == NULL)
1742 croak ("strings_e: %s", guestfs_last_error (g));
1743 for (n = 0; stringsout[n] != NULL; ++n) /**/;
1745 for (i = 0; i < n; ++i) {
1746 PUSHs (sv_2mortal (newSVpv (stringsout[i], 0)));
1747 free (stringsout[i]);
1758 dump = guestfs_hexdump (g, path);
1760 croak ("hexdump: %s", guestfs_last_error (g));
1761 RETVAL = newSVpv (dump, 0);