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
26 #include <caml/config.h>
27 #include <caml/alloc.h>
28 #include <caml/callback.h>
29 #include <caml/fail.h>
30 #include <caml/memory.h>
31 #include <caml/mlvalues.h>
32 #include <caml/signals.h>
36 #include "guestfs_c.h"
38 /* Copy a hashtable of string pairs into an assoc-list. We return
39 * the list in reverse order, but hashtables aren't supposed to be
43 copy_table (char * const * argv)
46 CAMLlocal5 (rv, pairv, kv, vv, cons);
50 for (i = 0; argv[i] != NULL; i += 2) {
51 kv = caml_copy_string (argv[i]);
52 vv = caml_copy_string (argv[i+1]);
53 pairv = caml_alloc (2, 0);
54 Store_field (pairv, 0, kv);
55 Store_field (pairv, 1, vv);
56 cons = caml_alloc (2, 0);
57 Store_field (cons, 1, rv);
59 Store_field (cons, 0, pairv);
66 copy_lvm_pv (const struct guestfs_lvm_pv *pv)
71 rv = caml_alloc (14, 0);
72 v = caml_copy_string (pv->pv_name);
73 Store_field (rv, 0, v);
74 v = caml_alloc_string (32);
75 memcpy (String_val (v), pv->pv_uuid, 32);
76 Store_field (rv, 1, v);
77 v = caml_copy_string (pv->pv_fmt);
78 Store_field (rv, 2, v);
79 v = caml_copy_int64 (pv->pv_size);
80 Store_field (rv, 3, v);
81 v = caml_copy_int64 (pv->dev_size);
82 Store_field (rv, 4, v);
83 v = caml_copy_int64 (pv->pv_free);
84 Store_field (rv, 5, v);
85 v = caml_copy_int64 (pv->pv_used);
86 Store_field (rv, 6, v);
87 v = caml_copy_string (pv->pv_attr);
88 Store_field (rv, 7, v);
89 v = caml_copy_int64 (pv->pv_pe_count);
90 Store_field (rv, 8, v);
91 v = caml_copy_int64 (pv->pv_pe_alloc_count);
92 Store_field (rv, 9, v);
93 v = caml_copy_string (pv->pv_tags);
94 Store_field (rv, 10, v);
95 v = caml_copy_int64 (pv->pe_start);
96 Store_field (rv, 11, v);
97 v = caml_copy_int64 (pv->pv_mda_count);
98 Store_field (rv, 12, v);
99 v = caml_copy_int64 (pv->pv_mda_free);
100 Store_field (rv, 13, v);
104 static CAMLprim value
105 copy_lvm_pv_list (const struct guestfs_lvm_pv_list *pvs)
112 CAMLreturn (Atom (0));
114 rv = caml_alloc (pvs->len, 0);
115 for (i = 0; i < pvs->len; ++i) {
116 v = copy_lvm_pv (&pvs->val[i]);
117 caml_modify (&Field (rv, i), v);
123 static CAMLprim value
124 copy_lvm_vg (const struct guestfs_lvm_vg *vg)
129 rv = caml_alloc (19, 0);
130 v = caml_copy_string (vg->vg_name);
131 Store_field (rv, 0, v);
132 v = caml_alloc_string (32);
133 memcpy (String_val (v), vg->vg_uuid, 32);
134 Store_field (rv, 1, v);
135 v = caml_copy_string (vg->vg_fmt);
136 Store_field (rv, 2, v);
137 v = caml_copy_string (vg->vg_attr);
138 Store_field (rv, 3, v);
139 v = caml_copy_int64 (vg->vg_size);
140 Store_field (rv, 4, v);
141 v = caml_copy_int64 (vg->vg_free);
142 Store_field (rv, 5, v);
143 v = caml_copy_string (vg->vg_sysid);
144 Store_field (rv, 6, v);
145 v = caml_copy_int64 (vg->vg_extent_size);
146 Store_field (rv, 7, v);
147 v = caml_copy_int64 (vg->vg_extent_count);
148 Store_field (rv, 8, v);
149 v = caml_copy_int64 (vg->vg_free_count);
150 Store_field (rv, 9, v);
151 v = caml_copy_int64 (vg->max_lv);
152 Store_field (rv, 10, v);
153 v = caml_copy_int64 (vg->max_pv);
154 Store_field (rv, 11, v);
155 v = caml_copy_int64 (vg->pv_count);
156 Store_field (rv, 12, v);
157 v = caml_copy_int64 (vg->lv_count);
158 Store_field (rv, 13, v);
159 v = caml_copy_int64 (vg->snap_count);
160 Store_field (rv, 14, v);
161 v = caml_copy_int64 (vg->vg_seqno);
162 Store_field (rv, 15, v);
163 v = caml_copy_string (vg->vg_tags);
164 Store_field (rv, 16, v);
165 v = caml_copy_int64 (vg->vg_mda_count);
166 Store_field (rv, 17, v);
167 v = caml_copy_int64 (vg->vg_mda_free);
168 Store_field (rv, 18, v);
172 static CAMLprim value
173 copy_lvm_vg_list (const struct guestfs_lvm_vg_list *vgs)
180 CAMLreturn (Atom (0));
182 rv = caml_alloc (vgs->len, 0);
183 for (i = 0; i < vgs->len; ++i) {
184 v = copy_lvm_vg (&vgs->val[i]);
185 caml_modify (&Field (rv, i), v);
191 static CAMLprim value
192 copy_lvm_lv (const struct guestfs_lvm_lv *lv)
195 CAMLlocal3 (rv, v, v2);
197 rv = caml_alloc (16, 0);
198 v = caml_copy_string (lv->lv_name);
199 Store_field (rv, 0, v);
200 v = caml_alloc_string (32);
201 memcpy (String_val (v), lv->lv_uuid, 32);
202 Store_field (rv, 1, v);
203 v = caml_copy_string (lv->lv_attr);
204 Store_field (rv, 2, v);
205 v = caml_copy_int64 (lv->lv_major);
206 Store_field (rv, 3, v);
207 v = caml_copy_int64 (lv->lv_minor);
208 Store_field (rv, 4, v);
209 v = caml_copy_int64 (lv->lv_kernel_major);
210 Store_field (rv, 5, v);
211 v = caml_copy_int64 (lv->lv_kernel_minor);
212 Store_field (rv, 6, v);
213 v = caml_copy_int64 (lv->lv_size);
214 Store_field (rv, 7, v);
215 v = caml_copy_int64 (lv->seg_count);
216 Store_field (rv, 8, v);
217 v = caml_copy_string (lv->origin);
218 Store_field (rv, 9, v);
219 if (lv->snap_percent >= 0) { /* Some snap_percent */
220 v2 = caml_copy_double (lv->snap_percent);
221 v = caml_alloc (1, 0);
222 Store_field (v, 0, v2);
225 Store_field (rv, 10, v);
226 if (lv->copy_percent >= 0) { /* Some copy_percent */
227 v2 = caml_copy_double (lv->copy_percent);
228 v = caml_alloc (1, 0);
229 Store_field (v, 0, v2);
232 Store_field (rv, 11, v);
233 v = caml_copy_string (lv->move_pv);
234 Store_field (rv, 12, v);
235 v = caml_copy_string (lv->lv_tags);
236 Store_field (rv, 13, v);
237 v = caml_copy_string (lv->mirror_log);
238 Store_field (rv, 14, v);
239 v = caml_copy_string (lv->modules);
240 Store_field (rv, 15, v);
244 static CAMLprim value
245 copy_lvm_lv_list (const struct guestfs_lvm_lv_list *lvs)
252 CAMLreturn (Atom (0));
254 rv = caml_alloc (lvs->len, 0);
255 for (i = 0; i < lvs->len; ++i) {
256 v = copy_lvm_lv (&lvs->val[i]);
257 caml_modify (&Field (rv, i), v);
263 static CAMLprim value
264 copy_stat (const struct guestfs_stat *stat)
269 rv = caml_alloc (13, 0);
270 v = caml_copy_int64 (stat->dev);
271 Store_field (rv, 0, v);
272 v = caml_copy_int64 (stat->ino);
273 Store_field (rv, 1, v);
274 v = caml_copy_int64 (stat->mode);
275 Store_field (rv, 2, v);
276 v = caml_copy_int64 (stat->nlink);
277 Store_field (rv, 3, v);
278 v = caml_copy_int64 (stat->uid);
279 Store_field (rv, 4, v);
280 v = caml_copy_int64 (stat->gid);
281 Store_field (rv, 5, v);
282 v = caml_copy_int64 (stat->rdev);
283 Store_field (rv, 6, v);
284 v = caml_copy_int64 (stat->size);
285 Store_field (rv, 7, v);
286 v = caml_copy_int64 (stat->blksize);
287 Store_field (rv, 8, v);
288 v = caml_copy_int64 (stat->blocks);
289 Store_field (rv, 9, v);
290 v = caml_copy_int64 (stat->atime);
291 Store_field (rv, 10, v);
292 v = caml_copy_int64 (stat->mtime);
293 Store_field (rv, 11, v);
294 v = caml_copy_int64 (stat->ctime);
295 Store_field (rv, 12, v);
299 static CAMLprim value
300 copy_statvfs (const struct guestfs_statvfs *statvfs)
305 rv = caml_alloc (11, 0);
306 v = caml_copy_int64 (statvfs->bsize);
307 Store_field (rv, 0, v);
308 v = caml_copy_int64 (statvfs->frsize);
309 Store_field (rv, 1, v);
310 v = caml_copy_int64 (statvfs->blocks);
311 Store_field (rv, 2, v);
312 v = caml_copy_int64 (statvfs->bfree);
313 Store_field (rv, 3, v);
314 v = caml_copy_int64 (statvfs->bavail);
315 Store_field (rv, 4, v);
316 v = caml_copy_int64 (statvfs->files);
317 Store_field (rv, 5, v);
318 v = caml_copy_int64 (statvfs->ffree);
319 Store_field (rv, 6, v);
320 v = caml_copy_int64 (statvfs->favail);
321 Store_field (rv, 7, v);
322 v = caml_copy_int64 (statvfs->fsid);
323 Store_field (rv, 8, v);
324 v = caml_copy_int64 (statvfs->flag);
325 Store_field (rv, 9, v);
326 v = caml_copy_int64 (statvfs->namemax);
327 Store_field (rv, 10, v);
332 ocaml_guestfs_launch (value gv)
337 guestfs_h *g = Guestfs_val (gv);
339 caml_failwith ("launch: used handle after closing it");
343 caml_enter_blocking_section ();
344 r = guestfs_launch (g);
345 caml_leave_blocking_section ();
347 ocaml_guestfs_raise_error (g, "launch");
354 ocaml_guestfs_wait_ready (value gv)
359 guestfs_h *g = Guestfs_val (gv);
361 caml_failwith ("wait_ready: used handle after closing it");
365 caml_enter_blocking_section ();
366 r = guestfs_wait_ready (g);
367 caml_leave_blocking_section ();
369 ocaml_guestfs_raise_error (g, "wait_ready");
376 ocaml_guestfs_kill_subprocess (value gv)
381 guestfs_h *g = Guestfs_val (gv);
383 caml_failwith ("kill_subprocess: used handle after closing it");
387 caml_enter_blocking_section ();
388 r = guestfs_kill_subprocess (g);
389 caml_leave_blocking_section ();
391 ocaml_guestfs_raise_error (g, "kill_subprocess");
398 ocaml_guestfs_add_drive (value gv, value filenamev)
400 CAMLparam2 (gv, filenamev);
403 guestfs_h *g = Guestfs_val (gv);
405 caml_failwith ("add_drive: used handle after closing it");
407 const char *filename = String_val (filenamev);
410 caml_enter_blocking_section ();
411 r = guestfs_add_drive (g, filename);
412 caml_leave_blocking_section ();
414 ocaml_guestfs_raise_error (g, "add_drive");
421 ocaml_guestfs_add_cdrom (value gv, value filenamev)
423 CAMLparam2 (gv, filenamev);
426 guestfs_h *g = Guestfs_val (gv);
428 caml_failwith ("add_cdrom: used handle after closing it");
430 const char *filename = String_val (filenamev);
433 caml_enter_blocking_section ();
434 r = guestfs_add_cdrom (g, filename);
435 caml_leave_blocking_section ();
437 ocaml_guestfs_raise_error (g, "add_cdrom");
444 ocaml_guestfs_config (value gv, value qemuparamv, value qemuvaluev)
446 CAMLparam3 (gv, qemuparamv, qemuvaluev);
449 guestfs_h *g = Guestfs_val (gv);
451 caml_failwith ("config: used handle after closing it");
453 const char *qemuparam = String_val (qemuparamv);
454 const char *qemuvalue =
455 qemuvaluev != Val_int (0) ? String_val (Field (qemuvaluev, 0)) : NULL;
458 caml_enter_blocking_section ();
459 r = guestfs_config (g, qemuparam, qemuvalue);
460 caml_leave_blocking_section ();
462 ocaml_guestfs_raise_error (g, "config");
469 ocaml_guestfs_set_path (value gv, value pathv)
471 CAMLparam2 (gv, pathv);
474 guestfs_h *g = Guestfs_val (gv);
476 caml_failwith ("set_path: used handle after closing it");
478 const char *path = String_val (pathv);
481 caml_enter_blocking_section ();
482 r = guestfs_set_path (g, path);
483 caml_leave_blocking_section ();
485 ocaml_guestfs_raise_error (g, "set_path");
492 ocaml_guestfs_get_path (value gv)
497 guestfs_h *g = Guestfs_val (gv);
499 caml_failwith ("get_path: used handle after closing it");
503 caml_enter_blocking_section ();
504 r = guestfs_get_path (g);
505 caml_leave_blocking_section ();
507 ocaml_guestfs_raise_error (g, "get_path");
509 rv = caml_copy_string (r);
514 ocaml_guestfs_set_autosync (value gv, value autosyncv)
516 CAMLparam2 (gv, autosyncv);
519 guestfs_h *g = Guestfs_val (gv);
521 caml_failwith ("set_autosync: used handle after closing it");
523 int autosync = Bool_val (autosyncv);
526 caml_enter_blocking_section ();
527 r = guestfs_set_autosync (g, autosync);
528 caml_leave_blocking_section ();
530 ocaml_guestfs_raise_error (g, "set_autosync");
537 ocaml_guestfs_get_autosync (value gv)
542 guestfs_h *g = Guestfs_val (gv);
544 caml_failwith ("get_autosync: used handle after closing it");
548 caml_enter_blocking_section ();
549 r = guestfs_get_autosync (g);
550 caml_leave_blocking_section ();
552 ocaml_guestfs_raise_error (g, "get_autosync");
559 ocaml_guestfs_set_verbose (value gv, value verbosev)
561 CAMLparam2 (gv, verbosev);
564 guestfs_h *g = Guestfs_val (gv);
566 caml_failwith ("set_verbose: used handle after closing it");
568 int verbose = Bool_val (verbosev);
571 caml_enter_blocking_section ();
572 r = guestfs_set_verbose (g, verbose);
573 caml_leave_blocking_section ();
575 ocaml_guestfs_raise_error (g, "set_verbose");
582 ocaml_guestfs_get_verbose (value gv)
587 guestfs_h *g = Guestfs_val (gv);
589 caml_failwith ("get_verbose: used handle after closing it");
593 caml_enter_blocking_section ();
594 r = guestfs_get_verbose (g);
595 caml_leave_blocking_section ();
597 ocaml_guestfs_raise_error (g, "get_verbose");
604 ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
606 CAMLparam3 (gv, devicev, mountpointv);
609 guestfs_h *g = Guestfs_val (gv);
611 caml_failwith ("mount: used handle after closing it");
613 const char *device = String_val (devicev);
614 const char *mountpoint = String_val (mountpointv);
617 caml_enter_blocking_section ();
618 r = guestfs_mount (g, device, mountpoint);
619 caml_leave_blocking_section ();
621 ocaml_guestfs_raise_error (g, "mount");
628 ocaml_guestfs_sync (value gv)
633 guestfs_h *g = Guestfs_val (gv);
635 caml_failwith ("sync: used handle after closing it");
639 caml_enter_blocking_section ();
640 r = guestfs_sync (g);
641 caml_leave_blocking_section ();
643 ocaml_guestfs_raise_error (g, "sync");
650 ocaml_guestfs_touch (value gv, value pathv)
652 CAMLparam2 (gv, pathv);
655 guestfs_h *g = Guestfs_val (gv);
657 caml_failwith ("touch: used handle after closing it");
659 const char *path = String_val (pathv);
662 caml_enter_blocking_section ();
663 r = guestfs_touch (g, path);
664 caml_leave_blocking_section ();
666 ocaml_guestfs_raise_error (g, "touch");
673 ocaml_guestfs_cat (value gv, value pathv)
675 CAMLparam2 (gv, pathv);
678 guestfs_h *g = Guestfs_val (gv);
680 caml_failwith ("cat: used handle after closing it");
682 const char *path = String_val (pathv);
685 caml_enter_blocking_section ();
686 r = guestfs_cat (g, path);
687 caml_leave_blocking_section ();
689 ocaml_guestfs_raise_error (g, "cat");
691 rv = caml_copy_string (r);
697 ocaml_guestfs_ll (value gv, value directoryv)
699 CAMLparam2 (gv, directoryv);
702 guestfs_h *g = Guestfs_val (gv);
704 caml_failwith ("ll: used handle after closing it");
706 const char *directory = String_val (directoryv);
709 caml_enter_blocking_section ();
710 r = guestfs_ll (g, directory);
711 caml_leave_blocking_section ();
713 ocaml_guestfs_raise_error (g, "ll");
715 rv = caml_copy_string (r);
721 ocaml_guestfs_ls (value gv, value directoryv)
723 CAMLparam2 (gv, directoryv);
726 guestfs_h *g = Guestfs_val (gv);
728 caml_failwith ("ls: used handle after closing it");
730 const char *directory = String_val (directoryv);
734 caml_enter_blocking_section ();
735 r = guestfs_ls (g, directory);
736 caml_leave_blocking_section ();
738 ocaml_guestfs_raise_error (g, "ls");
740 rv = caml_copy_string_array ((const char **) r);
741 for (i = 0; r[i] != NULL; ++i) free (r[i]);
747 ocaml_guestfs_list_devices (value gv)
752 guestfs_h *g = Guestfs_val (gv);
754 caml_failwith ("list_devices: used handle after closing it");
759 caml_enter_blocking_section ();
760 r = guestfs_list_devices (g);
761 caml_leave_blocking_section ();
763 ocaml_guestfs_raise_error (g, "list_devices");
765 rv = caml_copy_string_array ((const char **) r);
766 for (i = 0; r[i] != NULL; ++i) free (r[i]);
772 ocaml_guestfs_list_partitions (value gv)
777 guestfs_h *g = Guestfs_val (gv);
779 caml_failwith ("list_partitions: used handle after closing it");
784 caml_enter_blocking_section ();
785 r = guestfs_list_partitions (g);
786 caml_leave_blocking_section ();
788 ocaml_guestfs_raise_error (g, "list_partitions");
790 rv = caml_copy_string_array ((const char **) r);
791 for (i = 0; r[i] != NULL; ++i) free (r[i]);
797 ocaml_guestfs_pvs (value gv)
802 guestfs_h *g = Guestfs_val (gv);
804 caml_failwith ("pvs: used handle after closing it");
809 caml_enter_blocking_section ();
811 caml_leave_blocking_section ();
813 ocaml_guestfs_raise_error (g, "pvs");
815 rv = caml_copy_string_array ((const char **) r);
816 for (i = 0; r[i] != NULL; ++i) free (r[i]);
822 ocaml_guestfs_vgs (value gv)
827 guestfs_h *g = Guestfs_val (gv);
829 caml_failwith ("vgs: used handle after closing it");
834 caml_enter_blocking_section ();
836 caml_leave_blocking_section ();
838 ocaml_guestfs_raise_error (g, "vgs");
840 rv = caml_copy_string_array ((const char **) r);
841 for (i = 0; r[i] != NULL; ++i) free (r[i]);
847 ocaml_guestfs_lvs (value gv)
852 guestfs_h *g = Guestfs_val (gv);
854 caml_failwith ("lvs: used handle after closing it");
859 caml_enter_blocking_section ();
861 caml_leave_blocking_section ();
863 ocaml_guestfs_raise_error (g, "lvs");
865 rv = caml_copy_string_array ((const char **) r);
866 for (i = 0; r[i] != NULL; ++i) free (r[i]);
872 ocaml_guestfs_pvs_full (value gv)
877 guestfs_h *g = Guestfs_val (gv);
879 caml_failwith ("pvs_full: used handle after closing it");
881 struct guestfs_lvm_pv_list *r;
883 caml_enter_blocking_section ();
884 r = guestfs_pvs_full (g);
885 caml_leave_blocking_section ();
887 ocaml_guestfs_raise_error (g, "pvs_full");
889 rv = copy_lvm_pv_list (r);
890 guestfs_free_lvm_pv_list (r);
895 ocaml_guestfs_vgs_full (value gv)
900 guestfs_h *g = Guestfs_val (gv);
902 caml_failwith ("vgs_full: used handle after closing it");
904 struct guestfs_lvm_vg_list *r;
906 caml_enter_blocking_section ();
907 r = guestfs_vgs_full (g);
908 caml_leave_blocking_section ();
910 ocaml_guestfs_raise_error (g, "vgs_full");
912 rv = copy_lvm_vg_list (r);
913 guestfs_free_lvm_vg_list (r);
918 ocaml_guestfs_lvs_full (value gv)
923 guestfs_h *g = Guestfs_val (gv);
925 caml_failwith ("lvs_full: used handle after closing it");
927 struct guestfs_lvm_lv_list *r;
929 caml_enter_blocking_section ();
930 r = guestfs_lvs_full (g);
931 caml_leave_blocking_section ();
933 ocaml_guestfs_raise_error (g, "lvs_full");
935 rv = copy_lvm_lv_list (r);
936 guestfs_free_lvm_lv_list (r);
941 ocaml_guestfs_read_lines (value gv, value pathv)
943 CAMLparam2 (gv, pathv);
946 guestfs_h *g = Guestfs_val (gv);
948 caml_failwith ("read_lines: used handle after closing it");
950 const char *path = String_val (pathv);
954 caml_enter_blocking_section ();
955 r = guestfs_read_lines (g, path);
956 caml_leave_blocking_section ();
958 ocaml_guestfs_raise_error (g, "read_lines");
960 rv = caml_copy_string_array ((const char **) r);
961 for (i = 0; r[i] != NULL; ++i) free (r[i]);
967 ocaml_guestfs_aug_init (value gv, value rootv, value flagsv)
969 CAMLparam3 (gv, rootv, flagsv);
972 guestfs_h *g = Guestfs_val (gv);
974 caml_failwith ("aug_init: used handle after closing it");
976 const char *root = String_val (rootv);
977 int flags = Int_val (flagsv);
980 caml_enter_blocking_section ();
981 r = guestfs_aug_init (g, root, flags);
982 caml_leave_blocking_section ();
984 ocaml_guestfs_raise_error (g, "aug_init");
991 ocaml_guestfs_aug_close (value gv)
996 guestfs_h *g = Guestfs_val (gv);
998 caml_failwith ("aug_close: used handle after closing it");
1002 caml_enter_blocking_section ();
1003 r = guestfs_aug_close (g);
1004 caml_leave_blocking_section ();
1006 ocaml_guestfs_raise_error (g, "aug_close");
1013 ocaml_guestfs_aug_defvar (value gv, value namev, value exprv)
1015 CAMLparam3 (gv, namev, exprv);
1018 guestfs_h *g = Guestfs_val (gv);
1020 caml_failwith ("aug_defvar: used handle after closing it");
1022 const char *name = String_val (namev);
1024 exprv != Val_int (0) ? String_val (Field (exprv, 0)) : NULL;
1027 caml_enter_blocking_section ();
1028 r = guestfs_aug_defvar (g, name, expr);
1029 caml_leave_blocking_section ();
1031 ocaml_guestfs_raise_error (g, "aug_defvar");
1038 ocaml_guestfs_aug_defnode (value gv, value namev, value exprv, value valv)
1040 CAMLparam4 (gv, namev, exprv, valv);
1043 guestfs_h *g = Guestfs_val (gv);
1045 caml_failwith ("aug_defnode: used handle after closing it");
1047 const char *name = String_val (namev);
1048 const char *expr = String_val (exprv);
1049 const char *val = String_val (valv);
1050 struct guestfs_int_bool *r;
1052 caml_enter_blocking_section ();
1053 r = guestfs_aug_defnode (g, name, expr, val);
1054 caml_leave_blocking_section ();
1056 ocaml_guestfs_raise_error (g, "aug_defnode");
1058 rv = caml_alloc (2, 0);
1059 Store_field (rv, 0, Val_int (r->i));
1060 Store_field (rv, 1, Val_bool (r->b));
1061 guestfs_free_int_bool (r);
1066 ocaml_guestfs_aug_get (value gv, value pathv)
1068 CAMLparam2 (gv, pathv);
1071 guestfs_h *g = Guestfs_val (gv);
1073 caml_failwith ("aug_get: used handle after closing it");
1075 const char *path = String_val (pathv);
1078 caml_enter_blocking_section ();
1079 r = guestfs_aug_get (g, path);
1080 caml_leave_blocking_section ();
1082 ocaml_guestfs_raise_error (g, "aug_get");
1084 rv = caml_copy_string (r);
1090 ocaml_guestfs_aug_set (value gv, value pathv, value valv)
1092 CAMLparam3 (gv, pathv, valv);
1095 guestfs_h *g = Guestfs_val (gv);
1097 caml_failwith ("aug_set: used handle after closing it");
1099 const char *path = String_val (pathv);
1100 const char *val = String_val (valv);
1103 caml_enter_blocking_section ();
1104 r = guestfs_aug_set (g, path, val);
1105 caml_leave_blocking_section ();
1107 ocaml_guestfs_raise_error (g, "aug_set");
1114 ocaml_guestfs_aug_insert (value gv, value pathv, value labelv, value beforev)
1116 CAMLparam4 (gv, pathv, labelv, beforev);
1119 guestfs_h *g = Guestfs_val (gv);
1121 caml_failwith ("aug_insert: used handle after closing it");
1123 const char *path = String_val (pathv);
1124 const char *label = String_val (labelv);
1125 int before = Bool_val (beforev);
1128 caml_enter_blocking_section ();
1129 r = guestfs_aug_insert (g, path, label, before);
1130 caml_leave_blocking_section ();
1132 ocaml_guestfs_raise_error (g, "aug_insert");
1139 ocaml_guestfs_aug_rm (value gv, value pathv)
1141 CAMLparam2 (gv, pathv);
1144 guestfs_h *g = Guestfs_val (gv);
1146 caml_failwith ("aug_rm: used handle after closing it");
1148 const char *path = String_val (pathv);
1151 caml_enter_blocking_section ();
1152 r = guestfs_aug_rm (g, path);
1153 caml_leave_blocking_section ();
1155 ocaml_guestfs_raise_error (g, "aug_rm");
1162 ocaml_guestfs_aug_mv (value gv, value srcv, value destv)
1164 CAMLparam3 (gv, srcv, destv);
1167 guestfs_h *g = Guestfs_val (gv);
1169 caml_failwith ("aug_mv: used handle after closing it");
1171 const char *src = String_val (srcv);
1172 const char *dest = String_val (destv);
1175 caml_enter_blocking_section ();
1176 r = guestfs_aug_mv (g, src, dest);
1177 caml_leave_blocking_section ();
1179 ocaml_guestfs_raise_error (g, "aug_mv");
1186 ocaml_guestfs_aug_match (value gv, value pathv)
1188 CAMLparam2 (gv, pathv);
1191 guestfs_h *g = Guestfs_val (gv);
1193 caml_failwith ("aug_match: used handle after closing it");
1195 const char *path = String_val (pathv);
1199 caml_enter_blocking_section ();
1200 r = guestfs_aug_match (g, path);
1201 caml_leave_blocking_section ();
1203 ocaml_guestfs_raise_error (g, "aug_match");
1205 rv = caml_copy_string_array ((const char **) r);
1206 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1212 ocaml_guestfs_aug_save (value gv)
1217 guestfs_h *g = Guestfs_val (gv);
1219 caml_failwith ("aug_save: used handle after closing it");
1223 caml_enter_blocking_section ();
1224 r = guestfs_aug_save (g);
1225 caml_leave_blocking_section ();
1227 ocaml_guestfs_raise_error (g, "aug_save");
1234 ocaml_guestfs_aug_load (value gv)
1239 guestfs_h *g = Guestfs_val (gv);
1241 caml_failwith ("aug_load: used handle after closing it");
1245 caml_enter_blocking_section ();
1246 r = guestfs_aug_load (g);
1247 caml_leave_blocking_section ();
1249 ocaml_guestfs_raise_error (g, "aug_load");
1256 ocaml_guestfs_aug_ls (value gv, value pathv)
1258 CAMLparam2 (gv, pathv);
1261 guestfs_h *g = Guestfs_val (gv);
1263 caml_failwith ("aug_ls: used handle after closing it");
1265 const char *path = String_val (pathv);
1269 caml_enter_blocking_section ();
1270 r = guestfs_aug_ls (g, path);
1271 caml_leave_blocking_section ();
1273 ocaml_guestfs_raise_error (g, "aug_ls");
1275 rv = caml_copy_string_array ((const char **) r);
1276 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1282 ocaml_guestfs_rm (value gv, value pathv)
1284 CAMLparam2 (gv, pathv);
1287 guestfs_h *g = Guestfs_val (gv);
1289 caml_failwith ("rm: used handle after closing it");
1291 const char *path = String_val (pathv);
1294 caml_enter_blocking_section ();
1295 r = guestfs_rm (g, path);
1296 caml_leave_blocking_section ();
1298 ocaml_guestfs_raise_error (g, "rm");
1305 ocaml_guestfs_rmdir (value gv, value pathv)
1307 CAMLparam2 (gv, pathv);
1310 guestfs_h *g = Guestfs_val (gv);
1312 caml_failwith ("rmdir: used handle after closing it");
1314 const char *path = String_val (pathv);
1317 caml_enter_blocking_section ();
1318 r = guestfs_rmdir (g, path);
1319 caml_leave_blocking_section ();
1321 ocaml_guestfs_raise_error (g, "rmdir");
1328 ocaml_guestfs_rm_rf (value gv, value pathv)
1330 CAMLparam2 (gv, pathv);
1333 guestfs_h *g = Guestfs_val (gv);
1335 caml_failwith ("rm_rf: used handle after closing it");
1337 const char *path = String_val (pathv);
1340 caml_enter_blocking_section ();
1341 r = guestfs_rm_rf (g, path);
1342 caml_leave_blocking_section ();
1344 ocaml_guestfs_raise_error (g, "rm_rf");
1351 ocaml_guestfs_mkdir (value gv, value pathv)
1353 CAMLparam2 (gv, pathv);
1356 guestfs_h *g = Guestfs_val (gv);
1358 caml_failwith ("mkdir: used handle after closing it");
1360 const char *path = String_val (pathv);
1363 caml_enter_blocking_section ();
1364 r = guestfs_mkdir (g, path);
1365 caml_leave_blocking_section ();
1367 ocaml_guestfs_raise_error (g, "mkdir");
1374 ocaml_guestfs_mkdir_p (value gv, value pathv)
1376 CAMLparam2 (gv, pathv);
1379 guestfs_h *g = Guestfs_val (gv);
1381 caml_failwith ("mkdir_p: used handle after closing it");
1383 const char *path = String_val (pathv);
1386 caml_enter_blocking_section ();
1387 r = guestfs_mkdir_p (g, path);
1388 caml_leave_blocking_section ();
1390 ocaml_guestfs_raise_error (g, "mkdir_p");
1397 ocaml_guestfs_chmod (value gv, value modev, value pathv)
1399 CAMLparam3 (gv, modev, pathv);
1402 guestfs_h *g = Guestfs_val (gv);
1404 caml_failwith ("chmod: used handle after closing it");
1406 int mode = Int_val (modev);
1407 const char *path = String_val (pathv);
1410 caml_enter_blocking_section ();
1411 r = guestfs_chmod (g, mode, path);
1412 caml_leave_blocking_section ();
1414 ocaml_guestfs_raise_error (g, "chmod");
1421 ocaml_guestfs_chown (value gv, value ownerv, value groupv, value pathv)
1423 CAMLparam4 (gv, ownerv, groupv, pathv);
1426 guestfs_h *g = Guestfs_val (gv);
1428 caml_failwith ("chown: used handle after closing it");
1430 int owner = Int_val (ownerv);
1431 int group = Int_val (groupv);
1432 const char *path = String_val (pathv);
1435 caml_enter_blocking_section ();
1436 r = guestfs_chown (g, owner, group, path);
1437 caml_leave_blocking_section ();
1439 ocaml_guestfs_raise_error (g, "chown");
1446 ocaml_guestfs_exists (value gv, value pathv)
1448 CAMLparam2 (gv, pathv);
1451 guestfs_h *g = Guestfs_val (gv);
1453 caml_failwith ("exists: used handle after closing it");
1455 const char *path = String_val (pathv);
1458 caml_enter_blocking_section ();
1459 r = guestfs_exists (g, path);
1460 caml_leave_blocking_section ();
1462 ocaml_guestfs_raise_error (g, "exists");
1469 ocaml_guestfs_is_file (value gv, value pathv)
1471 CAMLparam2 (gv, pathv);
1474 guestfs_h *g = Guestfs_val (gv);
1476 caml_failwith ("is_file: used handle after closing it");
1478 const char *path = String_val (pathv);
1481 caml_enter_blocking_section ();
1482 r = guestfs_is_file (g, path);
1483 caml_leave_blocking_section ();
1485 ocaml_guestfs_raise_error (g, "is_file");
1492 ocaml_guestfs_is_dir (value gv, value pathv)
1494 CAMLparam2 (gv, pathv);
1497 guestfs_h *g = Guestfs_val (gv);
1499 caml_failwith ("is_dir: used handle after closing it");
1501 const char *path = String_val (pathv);
1504 caml_enter_blocking_section ();
1505 r = guestfs_is_dir (g, path);
1506 caml_leave_blocking_section ();
1508 ocaml_guestfs_raise_error (g, "is_dir");
1515 ocaml_guestfs_pvcreate (value gv, value devicev)
1517 CAMLparam2 (gv, devicev);
1520 guestfs_h *g = Guestfs_val (gv);
1522 caml_failwith ("pvcreate: used handle after closing it");
1524 const char *device = String_val (devicev);
1527 caml_enter_blocking_section ();
1528 r = guestfs_pvcreate (g, device);
1529 caml_leave_blocking_section ();
1531 ocaml_guestfs_raise_error (g, "pvcreate");
1538 ocaml_guestfs_vgcreate (value gv, value volgroupv, value physvolsv)
1540 CAMLparam3 (gv, volgroupv, physvolsv);
1543 guestfs_h *g = Guestfs_val (gv);
1545 caml_failwith ("vgcreate: used handle after closing it");
1547 const char *volgroup = String_val (volgroupv);
1548 char **physvols = ocaml_guestfs_strings_val (physvolsv);
1551 caml_enter_blocking_section ();
1552 r = guestfs_vgcreate (g, volgroup, physvols);
1553 caml_leave_blocking_section ();
1554 ocaml_guestfs_free_strings (physvols);
1556 ocaml_guestfs_raise_error (g, "vgcreate");
1563 ocaml_guestfs_lvcreate (value gv, value logvolv, value volgroupv, value mbytesv)
1565 CAMLparam4 (gv, logvolv, volgroupv, mbytesv);
1568 guestfs_h *g = Guestfs_val (gv);
1570 caml_failwith ("lvcreate: used handle after closing it");
1572 const char *logvol = String_val (logvolv);
1573 const char *volgroup = String_val (volgroupv);
1574 int mbytes = Int_val (mbytesv);
1577 caml_enter_blocking_section ();
1578 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
1579 caml_leave_blocking_section ();
1581 ocaml_guestfs_raise_error (g, "lvcreate");
1588 ocaml_guestfs_mkfs (value gv, value fstypev, value devicev)
1590 CAMLparam3 (gv, fstypev, devicev);
1593 guestfs_h *g = Guestfs_val (gv);
1595 caml_failwith ("mkfs: used handle after closing it");
1597 const char *fstype = String_val (fstypev);
1598 const char *device = String_val (devicev);
1601 caml_enter_blocking_section ();
1602 r = guestfs_mkfs (g, fstype, device);
1603 caml_leave_blocking_section ();
1605 ocaml_guestfs_raise_error (g, "mkfs");
1612 ocaml_guestfs_sfdisk (value gv, value devicev, value cylsv, value headsv, value sectorsv, value linesv)
1614 CAMLparam5 (gv, devicev, cylsv, headsv, sectorsv);
1615 CAMLxparam1 (linesv);
1618 guestfs_h *g = Guestfs_val (gv);
1620 caml_failwith ("sfdisk: used handle after closing it");
1622 const char *device = String_val (devicev);
1623 int cyls = Int_val (cylsv);
1624 int heads = Int_val (headsv);
1625 int sectors = Int_val (sectorsv);
1626 char **lines = ocaml_guestfs_strings_val (linesv);
1629 caml_enter_blocking_section ();
1630 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1631 caml_leave_blocking_section ();
1632 ocaml_guestfs_free_strings (lines);
1634 ocaml_guestfs_raise_error (g, "sfdisk");
1641 ocaml_guestfs_sfdisk_byte (value *argv, int argn)
1643 return ocaml_guestfs_sfdisk (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4]);
1647 ocaml_guestfs_write_file (value gv, value pathv, value contentv, value sizev)
1649 CAMLparam4 (gv, pathv, contentv, sizev);
1652 guestfs_h *g = Guestfs_val (gv);
1654 caml_failwith ("write_file: used handle after closing it");
1656 const char *path = String_val (pathv);
1657 const char *content = String_val (contentv);
1658 int size = Int_val (sizev);
1661 caml_enter_blocking_section ();
1662 r = guestfs_write_file (g, path, content, size);
1663 caml_leave_blocking_section ();
1665 ocaml_guestfs_raise_error (g, "write_file");
1672 ocaml_guestfs_umount (value gv, value pathordevicev)
1674 CAMLparam2 (gv, pathordevicev);
1677 guestfs_h *g = Guestfs_val (gv);
1679 caml_failwith ("umount: used handle after closing it");
1681 const char *pathordevice = String_val (pathordevicev);
1684 caml_enter_blocking_section ();
1685 r = guestfs_umount (g, pathordevice);
1686 caml_leave_blocking_section ();
1688 ocaml_guestfs_raise_error (g, "umount");
1695 ocaml_guestfs_mounts (value gv)
1700 guestfs_h *g = Guestfs_val (gv);
1702 caml_failwith ("mounts: used handle after closing it");
1707 caml_enter_blocking_section ();
1708 r = guestfs_mounts (g);
1709 caml_leave_blocking_section ();
1711 ocaml_guestfs_raise_error (g, "mounts");
1713 rv = caml_copy_string_array ((const char **) r);
1714 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1720 ocaml_guestfs_umount_all (value gv)
1725 guestfs_h *g = Guestfs_val (gv);
1727 caml_failwith ("umount_all: used handle after closing it");
1731 caml_enter_blocking_section ();
1732 r = guestfs_umount_all (g);
1733 caml_leave_blocking_section ();
1735 ocaml_guestfs_raise_error (g, "umount_all");
1742 ocaml_guestfs_lvm_remove_all (value gv)
1747 guestfs_h *g = Guestfs_val (gv);
1749 caml_failwith ("lvm_remove_all: used handle after closing it");
1753 caml_enter_blocking_section ();
1754 r = guestfs_lvm_remove_all (g);
1755 caml_leave_blocking_section ();
1757 ocaml_guestfs_raise_error (g, "lvm_remove_all");
1764 ocaml_guestfs_file (value gv, value pathv)
1766 CAMLparam2 (gv, pathv);
1769 guestfs_h *g = Guestfs_val (gv);
1771 caml_failwith ("file: used handle after closing it");
1773 const char *path = String_val (pathv);
1776 caml_enter_blocking_section ();
1777 r = guestfs_file (g, path);
1778 caml_leave_blocking_section ();
1780 ocaml_guestfs_raise_error (g, "file");
1782 rv = caml_copy_string (r);
1788 ocaml_guestfs_command (value gv, value argumentsv)
1790 CAMLparam2 (gv, argumentsv);
1793 guestfs_h *g = Guestfs_val (gv);
1795 caml_failwith ("command: used handle after closing it");
1797 char **arguments = ocaml_guestfs_strings_val (argumentsv);
1800 caml_enter_blocking_section ();
1801 r = guestfs_command (g, arguments);
1802 caml_leave_blocking_section ();
1803 ocaml_guestfs_free_strings (arguments);
1805 ocaml_guestfs_raise_error (g, "command");
1807 rv = caml_copy_string (r);
1813 ocaml_guestfs_command_lines (value gv, value argumentsv)
1815 CAMLparam2 (gv, argumentsv);
1818 guestfs_h *g = Guestfs_val (gv);
1820 caml_failwith ("command_lines: used handle after closing it");
1822 char **arguments = ocaml_guestfs_strings_val (argumentsv);
1826 caml_enter_blocking_section ();
1827 r = guestfs_command_lines (g, arguments);
1828 caml_leave_blocking_section ();
1829 ocaml_guestfs_free_strings (arguments);
1831 ocaml_guestfs_raise_error (g, "command_lines");
1833 rv = caml_copy_string_array ((const char **) r);
1834 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1840 ocaml_guestfs_stat (value gv, value pathv)
1842 CAMLparam2 (gv, pathv);
1845 guestfs_h *g = Guestfs_val (gv);
1847 caml_failwith ("stat: used handle after closing it");
1849 const char *path = String_val (pathv);
1850 struct guestfs_stat *r;
1852 caml_enter_blocking_section ();
1853 r = guestfs_stat (g, path);
1854 caml_leave_blocking_section ();
1856 ocaml_guestfs_raise_error (g, "stat");
1864 ocaml_guestfs_lstat (value gv, value pathv)
1866 CAMLparam2 (gv, pathv);
1869 guestfs_h *g = Guestfs_val (gv);
1871 caml_failwith ("lstat: used handle after closing it");
1873 const char *path = String_val (pathv);
1874 struct guestfs_stat *r;
1876 caml_enter_blocking_section ();
1877 r = guestfs_lstat (g, path);
1878 caml_leave_blocking_section ();
1880 ocaml_guestfs_raise_error (g, "lstat");
1888 ocaml_guestfs_statvfs (value gv, value pathv)
1890 CAMLparam2 (gv, pathv);
1893 guestfs_h *g = Guestfs_val (gv);
1895 caml_failwith ("statvfs: used handle after closing it");
1897 const char *path = String_val (pathv);
1898 struct guestfs_statvfs *r;
1900 caml_enter_blocking_section ();
1901 r = guestfs_statvfs (g, path);
1902 caml_leave_blocking_section ();
1904 ocaml_guestfs_raise_error (g, "statvfs");
1906 rv = copy_statvfs (r);
1912 ocaml_guestfs_tune2fs_l (value gv, value devicev)
1914 CAMLparam2 (gv, devicev);
1917 guestfs_h *g = Guestfs_val (gv);
1919 caml_failwith ("tune2fs_l: used handle after closing it");
1921 const char *device = String_val (devicev);
1925 caml_enter_blocking_section ();
1926 r = guestfs_tune2fs_l (g, device);
1927 caml_leave_blocking_section ();
1929 ocaml_guestfs_raise_error (g, "tune2fs_l");
1931 rv = copy_table (r);
1932 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1938 ocaml_guestfs_blockdev_setro (value gv, value devicev)
1940 CAMLparam2 (gv, devicev);
1943 guestfs_h *g = Guestfs_val (gv);
1945 caml_failwith ("blockdev_setro: used handle after closing it");
1947 const char *device = String_val (devicev);
1950 caml_enter_blocking_section ();
1951 r = guestfs_blockdev_setro (g, device);
1952 caml_leave_blocking_section ();
1954 ocaml_guestfs_raise_error (g, "blockdev_setro");
1961 ocaml_guestfs_blockdev_setrw (value gv, value devicev)
1963 CAMLparam2 (gv, devicev);
1966 guestfs_h *g = Guestfs_val (gv);
1968 caml_failwith ("blockdev_setrw: used handle after closing it");
1970 const char *device = String_val (devicev);
1973 caml_enter_blocking_section ();
1974 r = guestfs_blockdev_setrw (g, device);
1975 caml_leave_blocking_section ();
1977 ocaml_guestfs_raise_error (g, "blockdev_setrw");
1984 ocaml_guestfs_blockdev_getro (value gv, value devicev)
1986 CAMLparam2 (gv, devicev);
1989 guestfs_h *g = Guestfs_val (gv);
1991 caml_failwith ("blockdev_getro: used handle after closing it");
1993 const char *device = String_val (devicev);
1996 caml_enter_blocking_section ();
1997 r = guestfs_blockdev_getro (g, device);
1998 caml_leave_blocking_section ();
2000 ocaml_guestfs_raise_error (g, "blockdev_getro");
2007 ocaml_guestfs_blockdev_getss (value gv, value devicev)
2009 CAMLparam2 (gv, devicev);
2012 guestfs_h *g = Guestfs_val (gv);
2014 caml_failwith ("blockdev_getss: used handle after closing it");
2016 const char *device = String_val (devicev);
2019 caml_enter_blocking_section ();
2020 r = guestfs_blockdev_getss (g, device);
2021 caml_leave_blocking_section ();
2023 ocaml_guestfs_raise_error (g, "blockdev_getss");
2030 ocaml_guestfs_blockdev_getbsz (value gv, value devicev)
2032 CAMLparam2 (gv, devicev);
2035 guestfs_h *g = Guestfs_val (gv);
2037 caml_failwith ("blockdev_getbsz: used handle after closing it");
2039 const char *device = String_val (devicev);
2042 caml_enter_blocking_section ();
2043 r = guestfs_blockdev_getbsz (g, device);
2044 caml_leave_blocking_section ();
2046 ocaml_guestfs_raise_error (g, "blockdev_getbsz");
2053 ocaml_guestfs_blockdev_setbsz (value gv, value devicev, value blocksizev)
2055 CAMLparam3 (gv, devicev, blocksizev);
2058 guestfs_h *g = Guestfs_val (gv);
2060 caml_failwith ("blockdev_setbsz: used handle after closing it");
2062 const char *device = String_val (devicev);
2063 int blocksize = Int_val (blocksizev);
2066 caml_enter_blocking_section ();
2067 r = guestfs_blockdev_setbsz (g, device, blocksize);
2068 caml_leave_blocking_section ();
2070 ocaml_guestfs_raise_error (g, "blockdev_setbsz");
2077 ocaml_guestfs_blockdev_getsz (value gv, value devicev)
2079 CAMLparam2 (gv, devicev);
2082 guestfs_h *g = Guestfs_val (gv);
2084 caml_failwith ("blockdev_getsz: used handle after closing it");
2086 const char *device = String_val (devicev);
2089 caml_enter_blocking_section ();
2090 r = guestfs_blockdev_getsz (g, device);
2091 caml_leave_blocking_section ();
2093 ocaml_guestfs_raise_error (g, "blockdev_getsz");
2095 rv = caml_copy_int64 (r);
2100 ocaml_guestfs_blockdev_getsize64 (value gv, value devicev)
2102 CAMLparam2 (gv, devicev);
2105 guestfs_h *g = Guestfs_val (gv);
2107 caml_failwith ("blockdev_getsize64: used handle after closing it");
2109 const char *device = String_val (devicev);
2112 caml_enter_blocking_section ();
2113 r = guestfs_blockdev_getsize64 (g, device);
2114 caml_leave_blocking_section ();
2116 ocaml_guestfs_raise_error (g, "blockdev_getsize64");
2118 rv = caml_copy_int64 (r);
2123 ocaml_guestfs_blockdev_flushbufs (value gv, value devicev)
2125 CAMLparam2 (gv, devicev);
2128 guestfs_h *g = Guestfs_val (gv);
2130 caml_failwith ("blockdev_flushbufs: used handle after closing it");
2132 const char *device = String_val (devicev);
2135 caml_enter_blocking_section ();
2136 r = guestfs_blockdev_flushbufs (g, device);
2137 caml_leave_blocking_section ();
2139 ocaml_guestfs_raise_error (g, "blockdev_flushbufs");
2146 ocaml_guestfs_blockdev_rereadpt (value gv, value devicev)
2148 CAMLparam2 (gv, devicev);
2151 guestfs_h *g = Guestfs_val (gv);
2153 caml_failwith ("blockdev_rereadpt: used handle after closing it");
2155 const char *device = String_val (devicev);
2158 caml_enter_blocking_section ();
2159 r = guestfs_blockdev_rereadpt (g, device);
2160 caml_leave_blocking_section ();
2162 ocaml_guestfs_raise_error (g, "blockdev_rereadpt");