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");
71 av = (AV *)SvRV (arg);
72 ret = (char **)malloc (av_len (av) + 1 + 1);
74 for (i = 0; i <= av_len (av); i++) {
75 SV **elem = av_fetch (av, i, 0);
78 croak ("missing element in list");
80 ret[i] = SvPV_nolen (*elem);
88 MODULE = Sys::Guestfs PACKAGE = Sys::Guestfs
93 RETVAL = guestfs_create ();
95 croak ("could not create guestfs handle");
96 guestfs_set_error_handler (RETVAL, NULL, NULL);
112 r = guestfs_launch (g);
114 croak ("launch: %s", guestfs_last_error (g));
122 r = guestfs_wait_ready (g);
124 croak ("wait_ready: %s", guestfs_last_error (g));
132 r = guestfs_kill_subprocess (g);
134 croak ("kill_subprocess: %s", guestfs_last_error (g));
137 add_drive (g, filename)
143 r = guestfs_add_drive (g, filename);
145 croak ("add_drive: %s", guestfs_last_error (g));
148 add_cdrom (g, filename)
154 r = guestfs_add_cdrom (g, filename);
156 croak ("add_cdrom: %s", guestfs_last_error (g));
159 config (g, qemuparam, qemuvalue)
166 r = guestfs_config (g, qemuparam, qemuvalue);
168 croak ("config: %s", guestfs_last_error (g));
177 r = guestfs_set_path (g, path);
179 croak ("set_path: %s", guestfs_last_error (g));
187 path = guestfs_get_path (g);
189 croak ("get_path: %s", guestfs_last_error (g));
190 RETVAL = newSVpv (path, 0);
195 set_autosync (g, autosync)
201 r = guestfs_set_autosync (g, autosync);
203 croak ("set_autosync: %s", guestfs_last_error (g));
211 autosync = guestfs_get_autosync (g);
213 croak ("get_autosync: %s", guestfs_last_error (g));
214 RETVAL = newSViv (autosync);
219 set_verbose (g, verbose)
225 r = guestfs_set_verbose (g, verbose);
227 croak ("set_verbose: %s", guestfs_last_error (g));
235 verbose = guestfs_get_verbose (g);
237 croak ("get_verbose: %s", guestfs_last_error (g));
238 RETVAL = newSViv (verbose);
248 ready = guestfs_is_ready (g);
250 croak ("is_ready: %s", guestfs_last_error (g));
251 RETVAL = newSViv (ready);
261 config = guestfs_is_config (g);
263 croak ("is_config: %s", guestfs_last_error (g));
264 RETVAL = newSViv (config);
274 launching = guestfs_is_launching (g);
276 croak ("is_launching: %s", guestfs_last_error (g));
277 RETVAL = newSViv (launching);
287 busy = guestfs_is_busy (g);
289 croak ("is_busy: %s", guestfs_last_error (g));
290 RETVAL = newSViv (busy);
300 state = guestfs_get_state (g);
302 croak ("get_state: %s", guestfs_last_error (g));
303 RETVAL = newSViv (state);
308 mount (g, device, mountpoint)
315 r = guestfs_mount (g, device, mountpoint);
317 croak ("mount: %s", guestfs_last_error (g));
325 r = guestfs_sync (g);
327 croak ("sync: %s", guestfs_last_error (g));
336 r = guestfs_touch (g, path);
338 croak ("touch: %s", guestfs_last_error (g));
347 content = guestfs_cat (g, path);
349 croak ("cat: %s", guestfs_last_error (g));
350 RETVAL = newSVpv (content, 0);
362 listing = guestfs_ll (g, directory);
364 croak ("ll: %s", guestfs_last_error (g));
365 RETVAL = newSVpv (listing, 0);
378 listing = guestfs_ls (g, directory);
380 croak ("ls: %s", guestfs_last_error (g));
381 for (n = 0; listing[n] != NULL; ++n) /**/;
383 for (i = 0; i < n; ++i) {
384 PUSHs (sv_2mortal (newSVpv (listing[i], 0)));
396 devices = guestfs_list_devices (g);
398 croak ("list_devices: %s", guestfs_last_error (g));
399 for (n = 0; devices[n] != NULL; ++n) /**/;
401 for (i = 0; i < n; ++i) {
402 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
414 partitions = guestfs_list_partitions (g);
415 if (partitions == NULL)
416 croak ("list_partitions: %s", guestfs_last_error (g));
417 for (n = 0; partitions[n] != NULL; ++n) /**/;
419 for (i = 0; i < n; ++i) {
420 PUSHs (sv_2mortal (newSVpv (partitions[i], 0)));
421 free (partitions[i]);
432 physvols = guestfs_pvs (g);
433 if (physvols == NULL)
434 croak ("pvs: %s", guestfs_last_error (g));
435 for (n = 0; physvols[n] != NULL; ++n) /**/;
437 for (i = 0; i < n; ++i) {
438 PUSHs (sv_2mortal (newSVpv (physvols[i], 0)));
450 volgroups = guestfs_vgs (g);
451 if (volgroups == NULL)
452 croak ("vgs: %s", guestfs_last_error (g));
453 for (n = 0; volgroups[n] != NULL; ++n) /**/;
455 for (i = 0; i < n; ++i) {
456 PUSHs (sv_2mortal (newSVpv (volgroups[i], 0)));
468 logvols = guestfs_lvs (g);
470 croak ("lvs: %s", guestfs_last_error (g));
471 for (n = 0; logvols[n] != NULL; ++n) /**/;
473 for (i = 0; i < n; ++i) {
474 PUSHs (sv_2mortal (newSVpv (logvols[i], 0)));
483 struct guestfs_lvm_pv_list *physvols;
487 physvols = guestfs_pvs_full (g);
488 if (physvols == NULL)
489 croak ("pvs_full: %s", guestfs_last_error (g));
490 EXTEND (SP, physvols->len);
491 for (i = 0; i < physvols->len; ++i) {
493 (void) hv_store (hv, "pv_name", 7, newSVpv (physvols->val[i].pv_name, 0), 0);
494 (void) hv_store (hv, "pv_uuid", 7, newSVpv (physvols->val[i].pv_uuid, 32), 0);
495 (void) hv_store (hv, "pv_fmt", 6, newSVpv (physvols->val[i].pv_fmt, 0), 0);
496 (void) hv_store (hv, "pv_size", 7, my_newSVull (physvols->val[i].pv_size), 0);
497 (void) hv_store (hv, "dev_size", 8, my_newSVull (physvols->val[i].dev_size), 0);
498 (void) hv_store (hv, "pv_free", 7, my_newSVull (physvols->val[i].pv_free), 0);
499 (void) hv_store (hv, "pv_used", 7, my_newSVull (physvols->val[i].pv_used), 0);
500 (void) hv_store (hv, "pv_attr", 7, newSVpv (physvols->val[i].pv_attr, 0), 0);
501 (void) hv_store (hv, "pv_pe_count", 11, my_newSVll (physvols->val[i].pv_pe_count), 0);
502 (void) hv_store (hv, "pv_pe_alloc_count", 17, my_newSVll (physvols->val[i].pv_pe_alloc_count), 0);
503 (void) hv_store (hv, "pv_tags", 7, newSVpv (physvols->val[i].pv_tags, 0), 0);
504 (void) hv_store (hv, "pe_start", 8, my_newSVull (physvols->val[i].pe_start), 0);
505 (void) hv_store (hv, "pv_mda_count", 12, my_newSVll (physvols->val[i].pv_mda_count), 0);
506 (void) hv_store (hv, "pv_mda_free", 11, my_newSVull (physvols->val[i].pv_mda_free), 0);
507 PUSHs (sv_2mortal ((SV *) hv));
509 guestfs_free_lvm_pv_list (physvols);
515 struct guestfs_lvm_vg_list *volgroups;
519 volgroups = guestfs_vgs_full (g);
520 if (volgroups == NULL)
521 croak ("vgs_full: %s", guestfs_last_error (g));
522 EXTEND (SP, volgroups->len);
523 for (i = 0; i < volgroups->len; ++i) {
525 (void) hv_store (hv, "vg_name", 7, newSVpv (volgroups->val[i].vg_name, 0), 0);
526 (void) hv_store (hv, "vg_uuid", 7, newSVpv (volgroups->val[i].vg_uuid, 32), 0);
527 (void) hv_store (hv, "vg_fmt", 6, newSVpv (volgroups->val[i].vg_fmt, 0), 0);
528 (void) hv_store (hv, "vg_attr", 7, newSVpv (volgroups->val[i].vg_attr, 0), 0);
529 (void) hv_store (hv, "vg_size", 7, my_newSVull (volgroups->val[i].vg_size), 0);
530 (void) hv_store (hv, "vg_free", 7, my_newSVull (volgroups->val[i].vg_free), 0);
531 (void) hv_store (hv, "vg_sysid", 8, newSVpv (volgroups->val[i].vg_sysid, 0), 0);
532 (void) hv_store (hv, "vg_extent_size", 14, my_newSVull (volgroups->val[i].vg_extent_size), 0);
533 (void) hv_store (hv, "vg_extent_count", 15, my_newSVll (volgroups->val[i].vg_extent_count), 0);
534 (void) hv_store (hv, "vg_free_count", 13, my_newSVll (volgroups->val[i].vg_free_count), 0);
535 (void) hv_store (hv, "max_lv", 6, my_newSVll (volgroups->val[i].max_lv), 0);
536 (void) hv_store (hv, "max_pv", 6, my_newSVll (volgroups->val[i].max_pv), 0);
537 (void) hv_store (hv, "pv_count", 8, my_newSVll (volgroups->val[i].pv_count), 0);
538 (void) hv_store (hv, "lv_count", 8, my_newSVll (volgroups->val[i].lv_count), 0);
539 (void) hv_store (hv, "snap_count", 10, my_newSVll (volgroups->val[i].snap_count), 0);
540 (void) hv_store (hv, "vg_seqno", 8, my_newSVll (volgroups->val[i].vg_seqno), 0);
541 (void) hv_store (hv, "vg_tags", 7, newSVpv (volgroups->val[i].vg_tags, 0), 0);
542 (void) hv_store (hv, "vg_mda_count", 12, my_newSVll (volgroups->val[i].vg_mda_count), 0);
543 (void) hv_store (hv, "vg_mda_free", 11, my_newSVull (volgroups->val[i].vg_mda_free), 0);
544 PUSHs (sv_2mortal ((SV *) hv));
546 guestfs_free_lvm_vg_list (volgroups);
552 struct guestfs_lvm_lv_list *logvols;
556 logvols = guestfs_lvs_full (g);
558 croak ("lvs_full: %s", guestfs_last_error (g));
559 EXTEND (SP, logvols->len);
560 for (i = 0; i < logvols->len; ++i) {
562 (void) hv_store (hv, "lv_name", 7, newSVpv (logvols->val[i].lv_name, 0), 0);
563 (void) hv_store (hv, "lv_uuid", 7, newSVpv (logvols->val[i].lv_uuid, 32), 0);
564 (void) hv_store (hv, "lv_attr", 7, newSVpv (logvols->val[i].lv_attr, 0), 0);
565 (void) hv_store (hv, "lv_major", 8, my_newSVll (logvols->val[i].lv_major), 0);
566 (void) hv_store (hv, "lv_minor", 8, my_newSVll (logvols->val[i].lv_minor), 0);
567 (void) hv_store (hv, "lv_kernel_major", 15, my_newSVll (logvols->val[i].lv_kernel_major), 0);
568 (void) hv_store (hv, "lv_kernel_minor", 15, my_newSVll (logvols->val[i].lv_kernel_minor), 0);
569 (void) hv_store (hv, "lv_size", 7, my_newSVull (logvols->val[i].lv_size), 0);
570 (void) hv_store (hv, "seg_count", 9, my_newSVll (logvols->val[i].seg_count), 0);
571 (void) hv_store (hv, "origin", 6, newSVpv (logvols->val[i].origin, 0), 0);
572 (void) hv_store (hv, "snap_percent", 12, newSVnv (logvols->val[i].snap_percent), 0);
573 (void) hv_store (hv, "copy_percent", 12, newSVnv (logvols->val[i].copy_percent), 0);
574 (void) hv_store (hv, "move_pv", 7, newSVpv (logvols->val[i].move_pv, 0), 0);
575 (void) hv_store (hv, "lv_tags", 7, newSVpv (logvols->val[i].lv_tags, 0), 0);
576 (void) hv_store (hv, "mirror_log", 10, newSVpv (logvols->val[i].mirror_log, 0), 0);
577 (void) hv_store (hv, "modules", 7, newSVpv (logvols->val[i].modules, 0), 0);
578 PUSHs (sv_2mortal ((SV *) hv));
580 guestfs_free_lvm_lv_list (logvols);
590 lines = guestfs_read_lines (g, path);
592 croak ("read_lines: %s", guestfs_last_error (g));
593 for (n = 0; lines[n] != NULL; ++n) /**/;
595 for (i = 0; i < n; ++i) {
596 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
602 aug_init (g, root, flags)
609 r = guestfs_aug_init (g, root, flags);
611 croak ("aug_init: %s", guestfs_last_error (g));
619 r = guestfs_aug_close (g);
621 croak ("aug_close: %s", guestfs_last_error (g));
624 aug_defvar (g, name, expr)
631 nrnodes = guestfs_aug_defvar (g, name, expr);
633 croak ("aug_defvar: %s", guestfs_last_error (g));
634 RETVAL = newSViv (nrnodes);
639 aug_defnode (g, name, expr, val)
645 struct guestfs_int_bool *r;
647 r = guestfs_aug_defnode (g, name, expr, val);
649 croak ("aug_defnode: %s", guestfs_last_error (g));
651 PUSHs (sv_2mortal (newSViv (r->i)));
652 PUSHs (sv_2mortal (newSViv (r->b)));
653 guestfs_free_int_bool (r);
662 val = guestfs_aug_get (g, path);
664 croak ("aug_get: %s", guestfs_last_error (g));
665 RETVAL = newSVpv (val, 0);
671 aug_set (g, path, val)
678 r = guestfs_aug_set (g, path, val);
680 croak ("aug_set: %s", guestfs_last_error (g));
683 aug_insert (g, path, label, before)
691 r = guestfs_aug_insert (g, path, label, before);
693 croak ("aug_insert: %s", guestfs_last_error (g));
702 nrnodes = guestfs_aug_rm (g, path);
704 croak ("aug_rm: %s", guestfs_last_error (g));
705 RETVAL = newSViv (nrnodes);
710 aug_mv (g, src, dest)
717 r = guestfs_aug_mv (g, src, dest);
719 croak ("aug_mv: %s", guestfs_last_error (g));
729 matches = guestfs_aug_match (g, path);
731 croak ("aug_match: %s", guestfs_last_error (g));
732 for (n = 0; matches[n] != NULL; ++n) /**/;
734 for (i = 0; i < n; ++i) {
735 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
746 r = guestfs_aug_save (g);
748 croak ("aug_save: %s", guestfs_last_error (g));
756 r = guestfs_aug_load (g);
758 croak ("aug_load: %s", guestfs_last_error (g));
768 matches = guestfs_aug_ls (g, path);
770 croak ("aug_ls: %s", guestfs_last_error (g));
771 for (n = 0; matches[n] != NULL; ++n) /**/;
773 for (i = 0; i < n; ++i) {
774 PUSHs (sv_2mortal (newSVpv (matches[i], 0)));
786 r = guestfs_rm (g, path);
788 croak ("rm: %s", guestfs_last_error (g));
797 r = guestfs_rmdir (g, path);
799 croak ("rmdir: %s", guestfs_last_error (g));
808 r = guestfs_rm_rf (g, path);
810 croak ("rm_rf: %s", guestfs_last_error (g));
819 r = guestfs_mkdir (g, path);
821 croak ("mkdir: %s", guestfs_last_error (g));
830 r = guestfs_mkdir_p (g, path);
832 croak ("mkdir_p: %s", guestfs_last_error (g));
835 chmod (g, mode, path)
842 r = guestfs_chmod (g, mode, path);
844 croak ("chmod: %s", guestfs_last_error (g));
847 chown (g, owner, group, path)
855 r = guestfs_chown (g, owner, group, path);
857 croak ("chown: %s", guestfs_last_error (g));
866 existsflag = guestfs_exists (g, path);
867 if (existsflag == -1)
868 croak ("exists: %s", guestfs_last_error (g));
869 RETVAL = newSViv (existsflag);
880 fileflag = guestfs_is_file (g, path);
882 croak ("is_file: %s", guestfs_last_error (g));
883 RETVAL = newSViv (fileflag);
894 dirflag = guestfs_is_dir (g, path);
896 croak ("is_dir: %s", guestfs_last_error (g));
897 RETVAL = newSViv (dirflag);
908 r = guestfs_pvcreate (g, device);
910 croak ("pvcreate: %s", guestfs_last_error (g));
913 vgcreate (g, volgroup, physvols)
920 r = guestfs_vgcreate (g, volgroup, physvols);
923 croak ("vgcreate: %s", guestfs_last_error (g));
926 lvcreate (g, logvol, volgroup, mbytes)
934 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
936 croak ("lvcreate: %s", guestfs_last_error (g));
939 mkfs (g, fstype, device)
946 r = guestfs_mkfs (g, fstype, device);
948 croak ("mkfs: %s", guestfs_last_error (g));
951 sfdisk (g, device, cyls, heads, sectors, lines)
961 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
964 croak ("sfdisk: %s", guestfs_last_error (g));
967 write_file (g, path, content, size)
975 r = guestfs_write_file (g, path, content, size);
977 croak ("write_file: %s", guestfs_last_error (g));
980 umount (g, pathordevice)
986 r = guestfs_umount (g, pathordevice);
988 croak ("umount: %s", guestfs_last_error (g));
997 devices = guestfs_mounts (g);
999 croak ("mounts: %s", guestfs_last_error (g));
1000 for (n = 0; devices[n] != NULL; ++n) /**/;
1002 for (i = 0; i < n; ++i) {
1003 PUSHs (sv_2mortal (newSVpv (devices[i], 0)));
1014 r = guestfs_umount_all (g);
1016 croak ("umount_all: %s", guestfs_last_error (g));
1024 r = guestfs_lvm_remove_all (g);
1026 croak ("lvm_remove_all: %s", guestfs_last_error (g));
1035 description = guestfs_file (g, path);
1036 if (description == NULL)
1037 croak ("file: %s", guestfs_last_error (g));
1038 RETVAL = newSVpv (description, 0);
1044 command (g, arguments)
1050 output = guestfs_command (g, arguments);
1053 croak ("command: %s", guestfs_last_error (g));
1054 RETVAL = newSVpv (output, 0);
1060 command_lines (g, arguments)
1067 lines = guestfs_command_lines (g, arguments);
1070 croak ("command_lines: %s", guestfs_last_error (g));
1071 for (n = 0; lines[n] != NULL; ++n) /**/;
1073 for (i = 0; i < n; ++i) {
1074 PUSHs (sv_2mortal (newSVpv (lines[i], 0)));
1084 struct guestfs_stat *statbuf;
1086 statbuf = guestfs_stat (g, path);
1087 if (statbuf == NULL)
1088 croak ("stat: %s", guestfs_last_error (g));
1090 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1091 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1092 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1093 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1094 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1095 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1096 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1097 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1098 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1099 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1100 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1101 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1102 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1110 struct guestfs_stat *statbuf;
1112 statbuf = guestfs_lstat (g, path);
1113 if (statbuf == NULL)
1114 croak ("lstat: %s", guestfs_last_error (g));
1116 PUSHs (sv_2mortal (my_newSVll (statbuf->dev)));
1117 PUSHs (sv_2mortal (my_newSVll (statbuf->ino)));
1118 PUSHs (sv_2mortal (my_newSVll (statbuf->mode)));
1119 PUSHs (sv_2mortal (my_newSVll (statbuf->nlink)));
1120 PUSHs (sv_2mortal (my_newSVll (statbuf->uid)));
1121 PUSHs (sv_2mortal (my_newSVll (statbuf->gid)));
1122 PUSHs (sv_2mortal (my_newSVll (statbuf->rdev)));
1123 PUSHs (sv_2mortal (my_newSVll (statbuf->size)));
1124 PUSHs (sv_2mortal (my_newSVll (statbuf->blksize)));
1125 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1126 PUSHs (sv_2mortal (my_newSVll (statbuf->atime)));
1127 PUSHs (sv_2mortal (my_newSVll (statbuf->mtime)));
1128 PUSHs (sv_2mortal (my_newSVll (statbuf->ctime)));
1136 struct guestfs_statvfs *statbuf;
1138 statbuf = guestfs_statvfs (g, path);
1139 if (statbuf == NULL)
1140 croak ("statvfs: %s", guestfs_last_error (g));
1142 PUSHs (sv_2mortal (my_newSVll (statbuf->bsize)));
1143 PUSHs (sv_2mortal (my_newSVll (statbuf->frsize)));
1144 PUSHs (sv_2mortal (my_newSVll (statbuf->blocks)));
1145 PUSHs (sv_2mortal (my_newSVll (statbuf->bfree)));
1146 PUSHs (sv_2mortal (my_newSVll (statbuf->bavail)));
1147 PUSHs (sv_2mortal (my_newSVll (statbuf->files)));
1148 PUSHs (sv_2mortal (my_newSVll (statbuf->ffree)));
1149 PUSHs (sv_2mortal (my_newSVll (statbuf->favail)));
1150 PUSHs (sv_2mortal (my_newSVll (statbuf->fsid)));
1151 PUSHs (sv_2mortal (my_newSVll (statbuf->flag)));
1152 PUSHs (sv_2mortal (my_newSVll (statbuf->namemax)));
1156 tune2fs_l (g, device)
1163 superblock = guestfs_tune2fs_l (g, device);
1164 if (superblock == NULL)
1165 croak ("tune2fs_l: %s", guestfs_last_error (g));
1166 for (n = 0; superblock[n] != NULL; ++n) /**/;
1168 for (i = 0; i < n; ++i) {
1169 PUSHs (sv_2mortal (newSVpv (superblock[i], 0)));
1170 free (superblock[i]);
1175 blockdev_setro (g, device)
1181 r = guestfs_blockdev_setro (g, device);
1183 croak ("blockdev_setro: %s", guestfs_last_error (g));
1186 blockdev_setrw (g, device)
1192 r = guestfs_blockdev_setrw (g, device);
1194 croak ("blockdev_setrw: %s", guestfs_last_error (g));
1197 blockdev_getro (g, device)
1203 ro = guestfs_blockdev_getro (g, device);
1205 croak ("blockdev_getro: %s", guestfs_last_error (g));
1206 RETVAL = newSViv (ro);
1211 blockdev_getss (g, device)
1217 sectorsize = guestfs_blockdev_getss (g, device);
1218 if (sectorsize == -1)
1219 croak ("blockdev_getss: %s", guestfs_last_error (g));
1220 RETVAL = newSViv (sectorsize);
1225 blockdev_getbsz (g, device)
1231 blocksize = guestfs_blockdev_getbsz (g, device);
1232 if (blocksize == -1)
1233 croak ("blockdev_getbsz: %s", guestfs_last_error (g));
1234 RETVAL = newSViv (blocksize);
1239 blockdev_setbsz (g, device, blocksize)
1246 r = guestfs_blockdev_setbsz (g, device, blocksize);
1248 croak ("blockdev_setbsz: %s", guestfs_last_error (g));
1251 blockdev_getsz (g, device)
1255 int64_t sizeinsectors;
1257 sizeinsectors = guestfs_blockdev_getsz (g, device);
1258 if (sizeinsectors == -1)
1259 croak ("blockdev_getsz: %s", guestfs_last_error (g));
1260 RETVAL = my_newSVll (sizeinsectors);
1265 blockdev_getsize64 (g, device)
1269 int64_t sizeinbytes;
1271 sizeinbytes = guestfs_blockdev_getsize64 (g, device);
1272 if (sizeinbytes == -1)
1273 croak ("blockdev_getsize64: %s", guestfs_last_error (g));
1274 RETVAL = my_newSVll (sizeinbytes);
1279 blockdev_flushbufs (g, device)
1285 r = guestfs_blockdev_flushbufs (g, device);
1287 croak ("blockdev_flushbufs: %s", guestfs_last_error (g));
1290 blockdev_rereadpt (g, device)
1296 r = guestfs_blockdev_rereadpt (g, device);
1298 croak ("blockdev_rereadpt: %s", guestfs_last_error (g));