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_qemu (value gv, value qemuv)
471 CAMLparam2 (gv, qemuv);
474 guestfs_h *g = Guestfs_val (gv);
476 caml_failwith ("set_qemu: used handle after closing it");
478 const char *qemu = String_val (qemuv);
481 caml_enter_blocking_section ();
482 r = guestfs_set_qemu (g, qemu);
483 caml_leave_blocking_section ();
485 ocaml_guestfs_raise_error (g, "set_qemu");
492 ocaml_guestfs_get_qemu (value gv)
497 guestfs_h *g = Guestfs_val (gv);
499 caml_failwith ("get_qemu: used handle after closing it");
503 caml_enter_blocking_section ();
504 r = guestfs_get_qemu (g);
505 caml_leave_blocking_section ();
507 ocaml_guestfs_raise_error (g, "get_qemu");
509 rv = caml_copy_string (r);
514 ocaml_guestfs_set_path (value gv, value pathv)
516 CAMLparam2 (gv, pathv);
519 guestfs_h *g = Guestfs_val (gv);
521 caml_failwith ("set_path: used handle after closing it");
523 const char *path = String_val (pathv);
526 caml_enter_blocking_section ();
527 r = guestfs_set_path (g, path);
528 caml_leave_blocking_section ();
530 ocaml_guestfs_raise_error (g, "set_path");
537 ocaml_guestfs_get_path (value gv)
542 guestfs_h *g = Guestfs_val (gv);
544 caml_failwith ("get_path: used handle after closing it");
548 caml_enter_blocking_section ();
549 r = guestfs_get_path (g);
550 caml_leave_blocking_section ();
552 ocaml_guestfs_raise_error (g, "get_path");
554 rv = caml_copy_string (r);
559 ocaml_guestfs_set_append (value gv, value appendv)
561 CAMLparam2 (gv, appendv);
564 guestfs_h *g = Guestfs_val (gv);
566 caml_failwith ("set_append: used handle after closing it");
568 const char *append = String_val (appendv);
571 caml_enter_blocking_section ();
572 r = guestfs_set_append (g, append);
573 caml_leave_blocking_section ();
575 ocaml_guestfs_raise_error (g, "set_append");
582 ocaml_guestfs_get_append (value gv)
587 guestfs_h *g = Guestfs_val (gv);
589 caml_failwith ("get_append: used handle after closing it");
593 caml_enter_blocking_section ();
594 r = guestfs_get_append (g);
595 caml_leave_blocking_section ();
597 ocaml_guestfs_raise_error (g, "get_append");
599 rv = caml_copy_string (r);
604 ocaml_guestfs_set_autosync (value gv, value autosyncv)
606 CAMLparam2 (gv, autosyncv);
609 guestfs_h *g = Guestfs_val (gv);
611 caml_failwith ("set_autosync: used handle after closing it");
613 int autosync = Bool_val (autosyncv);
616 caml_enter_blocking_section ();
617 r = guestfs_set_autosync (g, autosync);
618 caml_leave_blocking_section ();
620 ocaml_guestfs_raise_error (g, "set_autosync");
627 ocaml_guestfs_get_autosync (value gv)
632 guestfs_h *g = Guestfs_val (gv);
634 caml_failwith ("get_autosync: used handle after closing it");
638 caml_enter_blocking_section ();
639 r = guestfs_get_autosync (g);
640 caml_leave_blocking_section ();
642 ocaml_guestfs_raise_error (g, "get_autosync");
649 ocaml_guestfs_set_verbose (value gv, value verbosev)
651 CAMLparam2 (gv, verbosev);
654 guestfs_h *g = Guestfs_val (gv);
656 caml_failwith ("set_verbose: used handle after closing it");
658 int verbose = Bool_val (verbosev);
661 caml_enter_blocking_section ();
662 r = guestfs_set_verbose (g, verbose);
663 caml_leave_blocking_section ();
665 ocaml_guestfs_raise_error (g, "set_verbose");
672 ocaml_guestfs_get_verbose (value gv)
677 guestfs_h *g = Guestfs_val (gv);
679 caml_failwith ("get_verbose: used handle after closing it");
683 caml_enter_blocking_section ();
684 r = guestfs_get_verbose (g);
685 caml_leave_blocking_section ();
687 ocaml_guestfs_raise_error (g, "get_verbose");
694 ocaml_guestfs_is_ready (value gv)
699 guestfs_h *g = Guestfs_val (gv);
701 caml_failwith ("is_ready: used handle after closing it");
705 caml_enter_blocking_section ();
706 r = guestfs_is_ready (g);
707 caml_leave_blocking_section ();
709 ocaml_guestfs_raise_error (g, "is_ready");
716 ocaml_guestfs_is_config (value gv)
721 guestfs_h *g = Guestfs_val (gv);
723 caml_failwith ("is_config: used handle after closing it");
727 caml_enter_blocking_section ();
728 r = guestfs_is_config (g);
729 caml_leave_blocking_section ();
731 ocaml_guestfs_raise_error (g, "is_config");
738 ocaml_guestfs_is_launching (value gv)
743 guestfs_h *g = Guestfs_val (gv);
745 caml_failwith ("is_launching: used handle after closing it");
749 caml_enter_blocking_section ();
750 r = guestfs_is_launching (g);
751 caml_leave_blocking_section ();
753 ocaml_guestfs_raise_error (g, "is_launching");
760 ocaml_guestfs_is_busy (value gv)
765 guestfs_h *g = Guestfs_val (gv);
767 caml_failwith ("is_busy: used handle after closing it");
771 caml_enter_blocking_section ();
772 r = guestfs_is_busy (g);
773 caml_leave_blocking_section ();
775 ocaml_guestfs_raise_error (g, "is_busy");
782 ocaml_guestfs_get_state (value gv)
787 guestfs_h *g = Guestfs_val (gv);
789 caml_failwith ("get_state: used handle after closing it");
793 caml_enter_blocking_section ();
794 r = guestfs_get_state (g);
795 caml_leave_blocking_section ();
797 ocaml_guestfs_raise_error (g, "get_state");
804 ocaml_guestfs_set_busy (value gv)
809 guestfs_h *g = Guestfs_val (gv);
811 caml_failwith ("set_busy: used handle after closing it");
815 caml_enter_blocking_section ();
816 r = guestfs_set_busy (g);
817 caml_leave_blocking_section ();
819 ocaml_guestfs_raise_error (g, "set_busy");
826 ocaml_guestfs_set_ready (value gv)
831 guestfs_h *g = Guestfs_val (gv);
833 caml_failwith ("set_ready: used handle after closing it");
837 caml_enter_blocking_section ();
838 r = guestfs_set_ready (g);
839 caml_leave_blocking_section ();
841 ocaml_guestfs_raise_error (g, "set_ready");
848 ocaml_guestfs_end_busy (value gv)
853 guestfs_h *g = Guestfs_val (gv);
855 caml_failwith ("end_busy: used handle after closing it");
859 caml_enter_blocking_section ();
860 r = guestfs_end_busy (g);
861 caml_leave_blocking_section ();
863 ocaml_guestfs_raise_error (g, "end_busy");
870 ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
872 CAMLparam3 (gv, devicev, mountpointv);
875 guestfs_h *g = Guestfs_val (gv);
877 caml_failwith ("mount: used handle after closing it");
879 const char *device = String_val (devicev);
880 const char *mountpoint = String_val (mountpointv);
883 caml_enter_blocking_section ();
884 r = guestfs_mount (g, device, mountpoint);
885 caml_leave_blocking_section ();
887 ocaml_guestfs_raise_error (g, "mount");
894 ocaml_guestfs_sync (value gv)
899 guestfs_h *g = Guestfs_val (gv);
901 caml_failwith ("sync: used handle after closing it");
905 caml_enter_blocking_section ();
906 r = guestfs_sync (g);
907 caml_leave_blocking_section ();
909 ocaml_guestfs_raise_error (g, "sync");
916 ocaml_guestfs_touch (value gv, value pathv)
918 CAMLparam2 (gv, pathv);
921 guestfs_h *g = Guestfs_val (gv);
923 caml_failwith ("touch: used handle after closing it");
925 const char *path = String_val (pathv);
928 caml_enter_blocking_section ();
929 r = guestfs_touch (g, path);
930 caml_leave_blocking_section ();
932 ocaml_guestfs_raise_error (g, "touch");
939 ocaml_guestfs_cat (value gv, value pathv)
941 CAMLparam2 (gv, pathv);
944 guestfs_h *g = Guestfs_val (gv);
946 caml_failwith ("cat: used handle after closing it");
948 const char *path = String_val (pathv);
951 caml_enter_blocking_section ();
952 r = guestfs_cat (g, path);
953 caml_leave_blocking_section ();
955 ocaml_guestfs_raise_error (g, "cat");
957 rv = caml_copy_string (r);
963 ocaml_guestfs_ll (value gv, value directoryv)
965 CAMLparam2 (gv, directoryv);
968 guestfs_h *g = Guestfs_val (gv);
970 caml_failwith ("ll: used handle after closing it");
972 const char *directory = String_val (directoryv);
975 caml_enter_blocking_section ();
976 r = guestfs_ll (g, directory);
977 caml_leave_blocking_section ();
979 ocaml_guestfs_raise_error (g, "ll");
981 rv = caml_copy_string (r);
987 ocaml_guestfs_ls (value gv, value directoryv)
989 CAMLparam2 (gv, directoryv);
992 guestfs_h *g = Guestfs_val (gv);
994 caml_failwith ("ls: used handle after closing it");
996 const char *directory = String_val (directoryv);
1000 caml_enter_blocking_section ();
1001 r = guestfs_ls (g, directory);
1002 caml_leave_blocking_section ();
1004 ocaml_guestfs_raise_error (g, "ls");
1006 rv = caml_copy_string_array ((const char **) r);
1007 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1013 ocaml_guestfs_list_devices (value gv)
1018 guestfs_h *g = Guestfs_val (gv);
1020 caml_failwith ("list_devices: used handle after closing it");
1025 caml_enter_blocking_section ();
1026 r = guestfs_list_devices (g);
1027 caml_leave_blocking_section ();
1029 ocaml_guestfs_raise_error (g, "list_devices");
1031 rv = caml_copy_string_array ((const char **) r);
1032 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1038 ocaml_guestfs_list_partitions (value gv)
1043 guestfs_h *g = Guestfs_val (gv);
1045 caml_failwith ("list_partitions: used handle after closing it");
1050 caml_enter_blocking_section ();
1051 r = guestfs_list_partitions (g);
1052 caml_leave_blocking_section ();
1054 ocaml_guestfs_raise_error (g, "list_partitions");
1056 rv = caml_copy_string_array ((const char **) r);
1057 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1063 ocaml_guestfs_pvs (value gv)
1068 guestfs_h *g = Guestfs_val (gv);
1070 caml_failwith ("pvs: used handle after closing it");
1075 caml_enter_blocking_section ();
1076 r = guestfs_pvs (g);
1077 caml_leave_blocking_section ();
1079 ocaml_guestfs_raise_error (g, "pvs");
1081 rv = caml_copy_string_array ((const char **) r);
1082 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1088 ocaml_guestfs_vgs (value gv)
1093 guestfs_h *g = Guestfs_val (gv);
1095 caml_failwith ("vgs: used handle after closing it");
1100 caml_enter_blocking_section ();
1101 r = guestfs_vgs (g);
1102 caml_leave_blocking_section ();
1104 ocaml_guestfs_raise_error (g, "vgs");
1106 rv = caml_copy_string_array ((const char **) r);
1107 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1113 ocaml_guestfs_lvs (value gv)
1118 guestfs_h *g = Guestfs_val (gv);
1120 caml_failwith ("lvs: used handle after closing it");
1125 caml_enter_blocking_section ();
1126 r = guestfs_lvs (g);
1127 caml_leave_blocking_section ();
1129 ocaml_guestfs_raise_error (g, "lvs");
1131 rv = caml_copy_string_array ((const char **) r);
1132 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1138 ocaml_guestfs_pvs_full (value gv)
1143 guestfs_h *g = Guestfs_val (gv);
1145 caml_failwith ("pvs_full: used handle after closing it");
1147 struct guestfs_lvm_pv_list *r;
1149 caml_enter_blocking_section ();
1150 r = guestfs_pvs_full (g);
1151 caml_leave_blocking_section ();
1153 ocaml_guestfs_raise_error (g, "pvs_full");
1155 rv = copy_lvm_pv_list (r);
1156 guestfs_free_lvm_pv_list (r);
1161 ocaml_guestfs_vgs_full (value gv)
1166 guestfs_h *g = Guestfs_val (gv);
1168 caml_failwith ("vgs_full: used handle after closing it");
1170 struct guestfs_lvm_vg_list *r;
1172 caml_enter_blocking_section ();
1173 r = guestfs_vgs_full (g);
1174 caml_leave_blocking_section ();
1176 ocaml_guestfs_raise_error (g, "vgs_full");
1178 rv = copy_lvm_vg_list (r);
1179 guestfs_free_lvm_vg_list (r);
1184 ocaml_guestfs_lvs_full (value gv)
1189 guestfs_h *g = Guestfs_val (gv);
1191 caml_failwith ("lvs_full: used handle after closing it");
1193 struct guestfs_lvm_lv_list *r;
1195 caml_enter_blocking_section ();
1196 r = guestfs_lvs_full (g);
1197 caml_leave_blocking_section ();
1199 ocaml_guestfs_raise_error (g, "lvs_full");
1201 rv = copy_lvm_lv_list (r);
1202 guestfs_free_lvm_lv_list (r);
1207 ocaml_guestfs_read_lines (value gv, value pathv)
1209 CAMLparam2 (gv, pathv);
1212 guestfs_h *g = Guestfs_val (gv);
1214 caml_failwith ("read_lines: used handle after closing it");
1216 const char *path = String_val (pathv);
1220 caml_enter_blocking_section ();
1221 r = guestfs_read_lines (g, path);
1222 caml_leave_blocking_section ();
1224 ocaml_guestfs_raise_error (g, "read_lines");
1226 rv = caml_copy_string_array ((const char **) r);
1227 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1233 ocaml_guestfs_aug_init (value gv, value rootv, value flagsv)
1235 CAMLparam3 (gv, rootv, flagsv);
1238 guestfs_h *g = Guestfs_val (gv);
1240 caml_failwith ("aug_init: used handle after closing it");
1242 const char *root = String_val (rootv);
1243 int flags = Int_val (flagsv);
1246 caml_enter_blocking_section ();
1247 r = guestfs_aug_init (g, root, flags);
1248 caml_leave_blocking_section ();
1250 ocaml_guestfs_raise_error (g, "aug_init");
1257 ocaml_guestfs_aug_close (value gv)
1262 guestfs_h *g = Guestfs_val (gv);
1264 caml_failwith ("aug_close: used handle after closing it");
1268 caml_enter_blocking_section ();
1269 r = guestfs_aug_close (g);
1270 caml_leave_blocking_section ();
1272 ocaml_guestfs_raise_error (g, "aug_close");
1279 ocaml_guestfs_aug_defvar (value gv, value namev, value exprv)
1281 CAMLparam3 (gv, namev, exprv);
1284 guestfs_h *g = Guestfs_val (gv);
1286 caml_failwith ("aug_defvar: used handle after closing it");
1288 const char *name = String_val (namev);
1290 exprv != Val_int (0) ? String_val (Field (exprv, 0)) : NULL;
1293 caml_enter_blocking_section ();
1294 r = guestfs_aug_defvar (g, name, expr);
1295 caml_leave_blocking_section ();
1297 ocaml_guestfs_raise_error (g, "aug_defvar");
1304 ocaml_guestfs_aug_defnode (value gv, value namev, value exprv, value valv)
1306 CAMLparam4 (gv, namev, exprv, valv);
1309 guestfs_h *g = Guestfs_val (gv);
1311 caml_failwith ("aug_defnode: used handle after closing it");
1313 const char *name = String_val (namev);
1314 const char *expr = String_val (exprv);
1315 const char *val = String_val (valv);
1316 struct guestfs_int_bool *r;
1318 caml_enter_blocking_section ();
1319 r = guestfs_aug_defnode (g, name, expr, val);
1320 caml_leave_blocking_section ();
1322 ocaml_guestfs_raise_error (g, "aug_defnode");
1324 rv = caml_alloc (2, 0);
1325 Store_field (rv, 0, Val_int (r->i));
1326 Store_field (rv, 1, Val_bool (r->b));
1327 guestfs_free_int_bool (r);
1332 ocaml_guestfs_aug_get (value gv, value pathv)
1334 CAMLparam2 (gv, pathv);
1337 guestfs_h *g = Guestfs_val (gv);
1339 caml_failwith ("aug_get: used handle after closing it");
1341 const char *path = String_val (pathv);
1344 caml_enter_blocking_section ();
1345 r = guestfs_aug_get (g, path);
1346 caml_leave_blocking_section ();
1348 ocaml_guestfs_raise_error (g, "aug_get");
1350 rv = caml_copy_string (r);
1356 ocaml_guestfs_aug_set (value gv, value pathv, value valv)
1358 CAMLparam3 (gv, pathv, valv);
1361 guestfs_h *g = Guestfs_val (gv);
1363 caml_failwith ("aug_set: used handle after closing it");
1365 const char *path = String_val (pathv);
1366 const char *val = String_val (valv);
1369 caml_enter_blocking_section ();
1370 r = guestfs_aug_set (g, path, val);
1371 caml_leave_blocking_section ();
1373 ocaml_guestfs_raise_error (g, "aug_set");
1380 ocaml_guestfs_aug_insert (value gv, value pathv, value labelv, value beforev)
1382 CAMLparam4 (gv, pathv, labelv, beforev);
1385 guestfs_h *g = Guestfs_val (gv);
1387 caml_failwith ("aug_insert: used handle after closing it");
1389 const char *path = String_val (pathv);
1390 const char *label = String_val (labelv);
1391 int before = Bool_val (beforev);
1394 caml_enter_blocking_section ();
1395 r = guestfs_aug_insert (g, path, label, before);
1396 caml_leave_blocking_section ();
1398 ocaml_guestfs_raise_error (g, "aug_insert");
1405 ocaml_guestfs_aug_rm (value gv, value pathv)
1407 CAMLparam2 (gv, pathv);
1410 guestfs_h *g = Guestfs_val (gv);
1412 caml_failwith ("aug_rm: used handle after closing it");
1414 const char *path = String_val (pathv);
1417 caml_enter_blocking_section ();
1418 r = guestfs_aug_rm (g, path);
1419 caml_leave_blocking_section ();
1421 ocaml_guestfs_raise_error (g, "aug_rm");
1428 ocaml_guestfs_aug_mv (value gv, value srcv, value destv)
1430 CAMLparam3 (gv, srcv, destv);
1433 guestfs_h *g = Guestfs_val (gv);
1435 caml_failwith ("aug_mv: used handle after closing it");
1437 const char *src = String_val (srcv);
1438 const char *dest = String_val (destv);
1441 caml_enter_blocking_section ();
1442 r = guestfs_aug_mv (g, src, dest);
1443 caml_leave_blocking_section ();
1445 ocaml_guestfs_raise_error (g, "aug_mv");
1452 ocaml_guestfs_aug_match (value gv, value pathv)
1454 CAMLparam2 (gv, pathv);
1457 guestfs_h *g = Guestfs_val (gv);
1459 caml_failwith ("aug_match: used handle after closing it");
1461 const char *path = String_val (pathv);
1465 caml_enter_blocking_section ();
1466 r = guestfs_aug_match (g, path);
1467 caml_leave_blocking_section ();
1469 ocaml_guestfs_raise_error (g, "aug_match");
1471 rv = caml_copy_string_array ((const char **) r);
1472 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1478 ocaml_guestfs_aug_save (value gv)
1483 guestfs_h *g = Guestfs_val (gv);
1485 caml_failwith ("aug_save: used handle after closing it");
1489 caml_enter_blocking_section ();
1490 r = guestfs_aug_save (g);
1491 caml_leave_blocking_section ();
1493 ocaml_guestfs_raise_error (g, "aug_save");
1500 ocaml_guestfs_aug_load (value gv)
1505 guestfs_h *g = Guestfs_val (gv);
1507 caml_failwith ("aug_load: used handle after closing it");
1511 caml_enter_blocking_section ();
1512 r = guestfs_aug_load (g);
1513 caml_leave_blocking_section ();
1515 ocaml_guestfs_raise_error (g, "aug_load");
1522 ocaml_guestfs_aug_ls (value gv, value pathv)
1524 CAMLparam2 (gv, pathv);
1527 guestfs_h *g = Guestfs_val (gv);
1529 caml_failwith ("aug_ls: used handle after closing it");
1531 const char *path = String_val (pathv);
1535 caml_enter_blocking_section ();
1536 r = guestfs_aug_ls (g, path);
1537 caml_leave_blocking_section ();
1539 ocaml_guestfs_raise_error (g, "aug_ls");
1541 rv = caml_copy_string_array ((const char **) r);
1542 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1548 ocaml_guestfs_rm (value gv, value pathv)
1550 CAMLparam2 (gv, pathv);
1553 guestfs_h *g = Guestfs_val (gv);
1555 caml_failwith ("rm: used handle after closing it");
1557 const char *path = String_val (pathv);
1560 caml_enter_blocking_section ();
1561 r = guestfs_rm (g, path);
1562 caml_leave_blocking_section ();
1564 ocaml_guestfs_raise_error (g, "rm");
1571 ocaml_guestfs_rmdir (value gv, value pathv)
1573 CAMLparam2 (gv, pathv);
1576 guestfs_h *g = Guestfs_val (gv);
1578 caml_failwith ("rmdir: used handle after closing it");
1580 const char *path = String_val (pathv);
1583 caml_enter_blocking_section ();
1584 r = guestfs_rmdir (g, path);
1585 caml_leave_blocking_section ();
1587 ocaml_guestfs_raise_error (g, "rmdir");
1594 ocaml_guestfs_rm_rf (value gv, value pathv)
1596 CAMLparam2 (gv, pathv);
1599 guestfs_h *g = Guestfs_val (gv);
1601 caml_failwith ("rm_rf: used handle after closing it");
1603 const char *path = String_val (pathv);
1606 caml_enter_blocking_section ();
1607 r = guestfs_rm_rf (g, path);
1608 caml_leave_blocking_section ();
1610 ocaml_guestfs_raise_error (g, "rm_rf");
1617 ocaml_guestfs_mkdir (value gv, value pathv)
1619 CAMLparam2 (gv, pathv);
1622 guestfs_h *g = Guestfs_val (gv);
1624 caml_failwith ("mkdir: used handle after closing it");
1626 const char *path = String_val (pathv);
1629 caml_enter_blocking_section ();
1630 r = guestfs_mkdir (g, path);
1631 caml_leave_blocking_section ();
1633 ocaml_guestfs_raise_error (g, "mkdir");
1640 ocaml_guestfs_mkdir_p (value gv, value pathv)
1642 CAMLparam2 (gv, pathv);
1645 guestfs_h *g = Guestfs_val (gv);
1647 caml_failwith ("mkdir_p: used handle after closing it");
1649 const char *path = String_val (pathv);
1652 caml_enter_blocking_section ();
1653 r = guestfs_mkdir_p (g, path);
1654 caml_leave_blocking_section ();
1656 ocaml_guestfs_raise_error (g, "mkdir_p");
1663 ocaml_guestfs_chmod (value gv, value modev, value pathv)
1665 CAMLparam3 (gv, modev, pathv);
1668 guestfs_h *g = Guestfs_val (gv);
1670 caml_failwith ("chmod: used handle after closing it");
1672 int mode = Int_val (modev);
1673 const char *path = String_val (pathv);
1676 caml_enter_blocking_section ();
1677 r = guestfs_chmod (g, mode, path);
1678 caml_leave_blocking_section ();
1680 ocaml_guestfs_raise_error (g, "chmod");
1687 ocaml_guestfs_chown (value gv, value ownerv, value groupv, value pathv)
1689 CAMLparam4 (gv, ownerv, groupv, pathv);
1692 guestfs_h *g = Guestfs_val (gv);
1694 caml_failwith ("chown: used handle after closing it");
1696 int owner = Int_val (ownerv);
1697 int group = Int_val (groupv);
1698 const char *path = String_val (pathv);
1701 caml_enter_blocking_section ();
1702 r = guestfs_chown (g, owner, group, path);
1703 caml_leave_blocking_section ();
1705 ocaml_guestfs_raise_error (g, "chown");
1712 ocaml_guestfs_exists (value gv, value pathv)
1714 CAMLparam2 (gv, pathv);
1717 guestfs_h *g = Guestfs_val (gv);
1719 caml_failwith ("exists: used handle after closing it");
1721 const char *path = String_val (pathv);
1724 caml_enter_blocking_section ();
1725 r = guestfs_exists (g, path);
1726 caml_leave_blocking_section ();
1728 ocaml_guestfs_raise_error (g, "exists");
1735 ocaml_guestfs_is_file (value gv, value pathv)
1737 CAMLparam2 (gv, pathv);
1740 guestfs_h *g = Guestfs_val (gv);
1742 caml_failwith ("is_file: used handle after closing it");
1744 const char *path = String_val (pathv);
1747 caml_enter_blocking_section ();
1748 r = guestfs_is_file (g, path);
1749 caml_leave_blocking_section ();
1751 ocaml_guestfs_raise_error (g, "is_file");
1758 ocaml_guestfs_is_dir (value gv, value pathv)
1760 CAMLparam2 (gv, pathv);
1763 guestfs_h *g = Guestfs_val (gv);
1765 caml_failwith ("is_dir: used handle after closing it");
1767 const char *path = String_val (pathv);
1770 caml_enter_blocking_section ();
1771 r = guestfs_is_dir (g, path);
1772 caml_leave_blocking_section ();
1774 ocaml_guestfs_raise_error (g, "is_dir");
1781 ocaml_guestfs_pvcreate (value gv, value devicev)
1783 CAMLparam2 (gv, devicev);
1786 guestfs_h *g = Guestfs_val (gv);
1788 caml_failwith ("pvcreate: used handle after closing it");
1790 const char *device = String_val (devicev);
1793 caml_enter_blocking_section ();
1794 r = guestfs_pvcreate (g, device);
1795 caml_leave_blocking_section ();
1797 ocaml_guestfs_raise_error (g, "pvcreate");
1804 ocaml_guestfs_vgcreate (value gv, value volgroupv, value physvolsv)
1806 CAMLparam3 (gv, volgroupv, physvolsv);
1809 guestfs_h *g = Guestfs_val (gv);
1811 caml_failwith ("vgcreate: used handle after closing it");
1813 const char *volgroup = String_val (volgroupv);
1814 char **physvols = ocaml_guestfs_strings_val (g, physvolsv);
1817 caml_enter_blocking_section ();
1818 r = guestfs_vgcreate (g, volgroup, physvols);
1819 caml_leave_blocking_section ();
1820 ocaml_guestfs_free_strings (physvols);
1822 ocaml_guestfs_raise_error (g, "vgcreate");
1829 ocaml_guestfs_lvcreate (value gv, value logvolv, value volgroupv, value mbytesv)
1831 CAMLparam4 (gv, logvolv, volgroupv, mbytesv);
1834 guestfs_h *g = Guestfs_val (gv);
1836 caml_failwith ("lvcreate: used handle after closing it");
1838 const char *logvol = String_val (logvolv);
1839 const char *volgroup = String_val (volgroupv);
1840 int mbytes = Int_val (mbytesv);
1843 caml_enter_blocking_section ();
1844 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
1845 caml_leave_blocking_section ();
1847 ocaml_guestfs_raise_error (g, "lvcreate");
1854 ocaml_guestfs_mkfs (value gv, value fstypev, value devicev)
1856 CAMLparam3 (gv, fstypev, devicev);
1859 guestfs_h *g = Guestfs_val (gv);
1861 caml_failwith ("mkfs: used handle after closing it");
1863 const char *fstype = String_val (fstypev);
1864 const char *device = String_val (devicev);
1867 caml_enter_blocking_section ();
1868 r = guestfs_mkfs (g, fstype, device);
1869 caml_leave_blocking_section ();
1871 ocaml_guestfs_raise_error (g, "mkfs");
1878 ocaml_guestfs_sfdisk (value gv, value devicev, value cylsv, value headsv, value sectorsv, value linesv)
1880 CAMLparam5 (gv, devicev, cylsv, headsv, sectorsv);
1881 CAMLxparam1 (linesv);
1884 guestfs_h *g = Guestfs_val (gv);
1886 caml_failwith ("sfdisk: used handle after closing it");
1888 const char *device = String_val (devicev);
1889 int cyls = Int_val (cylsv);
1890 int heads = Int_val (headsv);
1891 int sectors = Int_val (sectorsv);
1892 char **lines = ocaml_guestfs_strings_val (g, linesv);
1895 caml_enter_blocking_section ();
1896 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1897 caml_leave_blocking_section ();
1898 ocaml_guestfs_free_strings (lines);
1900 ocaml_guestfs_raise_error (g, "sfdisk");
1907 ocaml_guestfs_sfdisk_byte (value *argv, int argn)
1909 return ocaml_guestfs_sfdisk (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4]);
1913 ocaml_guestfs_write_file (value gv, value pathv, value contentv, value sizev)
1915 CAMLparam4 (gv, pathv, contentv, sizev);
1918 guestfs_h *g = Guestfs_val (gv);
1920 caml_failwith ("write_file: used handle after closing it");
1922 const char *path = String_val (pathv);
1923 const char *content = String_val (contentv);
1924 int size = Int_val (sizev);
1927 caml_enter_blocking_section ();
1928 r = guestfs_write_file (g, path, content, size);
1929 caml_leave_blocking_section ();
1931 ocaml_guestfs_raise_error (g, "write_file");
1938 ocaml_guestfs_umount (value gv, value pathordevicev)
1940 CAMLparam2 (gv, pathordevicev);
1943 guestfs_h *g = Guestfs_val (gv);
1945 caml_failwith ("umount: used handle after closing it");
1947 const char *pathordevice = String_val (pathordevicev);
1950 caml_enter_blocking_section ();
1951 r = guestfs_umount (g, pathordevice);
1952 caml_leave_blocking_section ();
1954 ocaml_guestfs_raise_error (g, "umount");
1961 ocaml_guestfs_mounts (value gv)
1966 guestfs_h *g = Guestfs_val (gv);
1968 caml_failwith ("mounts: used handle after closing it");
1973 caml_enter_blocking_section ();
1974 r = guestfs_mounts (g);
1975 caml_leave_blocking_section ();
1977 ocaml_guestfs_raise_error (g, "mounts");
1979 rv = caml_copy_string_array ((const char **) r);
1980 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1986 ocaml_guestfs_umount_all (value gv)
1991 guestfs_h *g = Guestfs_val (gv);
1993 caml_failwith ("umount_all: used handle after closing it");
1997 caml_enter_blocking_section ();
1998 r = guestfs_umount_all (g);
1999 caml_leave_blocking_section ();
2001 ocaml_guestfs_raise_error (g, "umount_all");
2008 ocaml_guestfs_lvm_remove_all (value gv)
2013 guestfs_h *g = Guestfs_val (gv);
2015 caml_failwith ("lvm_remove_all: used handle after closing it");
2019 caml_enter_blocking_section ();
2020 r = guestfs_lvm_remove_all (g);
2021 caml_leave_blocking_section ();
2023 ocaml_guestfs_raise_error (g, "lvm_remove_all");
2030 ocaml_guestfs_file (value gv, value pathv)
2032 CAMLparam2 (gv, pathv);
2035 guestfs_h *g = Guestfs_val (gv);
2037 caml_failwith ("file: used handle after closing it");
2039 const char *path = String_val (pathv);
2042 caml_enter_blocking_section ();
2043 r = guestfs_file (g, path);
2044 caml_leave_blocking_section ();
2046 ocaml_guestfs_raise_error (g, "file");
2048 rv = caml_copy_string (r);
2054 ocaml_guestfs_command (value gv, value argumentsv)
2056 CAMLparam2 (gv, argumentsv);
2059 guestfs_h *g = Guestfs_val (gv);
2061 caml_failwith ("command: used handle after closing it");
2063 char **arguments = ocaml_guestfs_strings_val (g, argumentsv);
2066 caml_enter_blocking_section ();
2067 r = guestfs_command (g, arguments);
2068 caml_leave_blocking_section ();
2069 ocaml_guestfs_free_strings (arguments);
2071 ocaml_guestfs_raise_error (g, "command");
2073 rv = caml_copy_string (r);
2079 ocaml_guestfs_command_lines (value gv, value argumentsv)
2081 CAMLparam2 (gv, argumentsv);
2084 guestfs_h *g = Guestfs_val (gv);
2086 caml_failwith ("command_lines: used handle after closing it");
2088 char **arguments = ocaml_guestfs_strings_val (g, argumentsv);
2092 caml_enter_blocking_section ();
2093 r = guestfs_command_lines (g, arguments);
2094 caml_leave_blocking_section ();
2095 ocaml_guestfs_free_strings (arguments);
2097 ocaml_guestfs_raise_error (g, "command_lines");
2099 rv = caml_copy_string_array ((const char **) r);
2100 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2106 ocaml_guestfs_stat (value gv, value pathv)
2108 CAMLparam2 (gv, pathv);
2111 guestfs_h *g = Guestfs_val (gv);
2113 caml_failwith ("stat: used handle after closing it");
2115 const char *path = String_val (pathv);
2116 struct guestfs_stat *r;
2118 caml_enter_blocking_section ();
2119 r = guestfs_stat (g, path);
2120 caml_leave_blocking_section ();
2122 ocaml_guestfs_raise_error (g, "stat");
2130 ocaml_guestfs_lstat (value gv, value pathv)
2132 CAMLparam2 (gv, pathv);
2135 guestfs_h *g = Guestfs_val (gv);
2137 caml_failwith ("lstat: used handle after closing it");
2139 const char *path = String_val (pathv);
2140 struct guestfs_stat *r;
2142 caml_enter_blocking_section ();
2143 r = guestfs_lstat (g, path);
2144 caml_leave_blocking_section ();
2146 ocaml_guestfs_raise_error (g, "lstat");
2154 ocaml_guestfs_statvfs (value gv, value pathv)
2156 CAMLparam2 (gv, pathv);
2159 guestfs_h *g = Guestfs_val (gv);
2161 caml_failwith ("statvfs: used handle after closing it");
2163 const char *path = String_val (pathv);
2164 struct guestfs_statvfs *r;
2166 caml_enter_blocking_section ();
2167 r = guestfs_statvfs (g, path);
2168 caml_leave_blocking_section ();
2170 ocaml_guestfs_raise_error (g, "statvfs");
2172 rv = copy_statvfs (r);
2178 ocaml_guestfs_tune2fs_l (value gv, value devicev)
2180 CAMLparam2 (gv, devicev);
2183 guestfs_h *g = Guestfs_val (gv);
2185 caml_failwith ("tune2fs_l: used handle after closing it");
2187 const char *device = String_val (devicev);
2191 caml_enter_blocking_section ();
2192 r = guestfs_tune2fs_l (g, device);
2193 caml_leave_blocking_section ();
2195 ocaml_guestfs_raise_error (g, "tune2fs_l");
2197 rv = copy_table (r);
2198 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2204 ocaml_guestfs_blockdev_setro (value gv, value devicev)
2206 CAMLparam2 (gv, devicev);
2209 guestfs_h *g = Guestfs_val (gv);
2211 caml_failwith ("blockdev_setro: used handle after closing it");
2213 const char *device = String_val (devicev);
2216 caml_enter_blocking_section ();
2217 r = guestfs_blockdev_setro (g, device);
2218 caml_leave_blocking_section ();
2220 ocaml_guestfs_raise_error (g, "blockdev_setro");
2227 ocaml_guestfs_blockdev_setrw (value gv, value devicev)
2229 CAMLparam2 (gv, devicev);
2232 guestfs_h *g = Guestfs_val (gv);
2234 caml_failwith ("blockdev_setrw: used handle after closing it");
2236 const char *device = String_val (devicev);
2239 caml_enter_blocking_section ();
2240 r = guestfs_blockdev_setrw (g, device);
2241 caml_leave_blocking_section ();
2243 ocaml_guestfs_raise_error (g, "blockdev_setrw");
2250 ocaml_guestfs_blockdev_getro (value gv, value devicev)
2252 CAMLparam2 (gv, devicev);
2255 guestfs_h *g = Guestfs_val (gv);
2257 caml_failwith ("blockdev_getro: used handle after closing it");
2259 const char *device = String_val (devicev);
2262 caml_enter_blocking_section ();
2263 r = guestfs_blockdev_getro (g, device);
2264 caml_leave_blocking_section ();
2266 ocaml_guestfs_raise_error (g, "blockdev_getro");
2273 ocaml_guestfs_blockdev_getss (value gv, value devicev)
2275 CAMLparam2 (gv, devicev);
2278 guestfs_h *g = Guestfs_val (gv);
2280 caml_failwith ("blockdev_getss: used handle after closing it");
2282 const char *device = String_val (devicev);
2285 caml_enter_blocking_section ();
2286 r = guestfs_blockdev_getss (g, device);
2287 caml_leave_blocking_section ();
2289 ocaml_guestfs_raise_error (g, "blockdev_getss");
2296 ocaml_guestfs_blockdev_getbsz (value gv, value devicev)
2298 CAMLparam2 (gv, devicev);
2301 guestfs_h *g = Guestfs_val (gv);
2303 caml_failwith ("blockdev_getbsz: used handle after closing it");
2305 const char *device = String_val (devicev);
2308 caml_enter_blocking_section ();
2309 r = guestfs_blockdev_getbsz (g, device);
2310 caml_leave_blocking_section ();
2312 ocaml_guestfs_raise_error (g, "blockdev_getbsz");
2319 ocaml_guestfs_blockdev_setbsz (value gv, value devicev, value blocksizev)
2321 CAMLparam3 (gv, devicev, blocksizev);
2324 guestfs_h *g = Guestfs_val (gv);
2326 caml_failwith ("blockdev_setbsz: used handle after closing it");
2328 const char *device = String_val (devicev);
2329 int blocksize = Int_val (blocksizev);
2332 caml_enter_blocking_section ();
2333 r = guestfs_blockdev_setbsz (g, device, blocksize);
2334 caml_leave_blocking_section ();
2336 ocaml_guestfs_raise_error (g, "blockdev_setbsz");
2343 ocaml_guestfs_blockdev_getsz (value gv, value devicev)
2345 CAMLparam2 (gv, devicev);
2348 guestfs_h *g = Guestfs_val (gv);
2350 caml_failwith ("blockdev_getsz: used handle after closing it");
2352 const char *device = String_val (devicev);
2355 caml_enter_blocking_section ();
2356 r = guestfs_blockdev_getsz (g, device);
2357 caml_leave_blocking_section ();
2359 ocaml_guestfs_raise_error (g, "blockdev_getsz");
2361 rv = caml_copy_int64 (r);
2366 ocaml_guestfs_blockdev_getsize64 (value gv, value devicev)
2368 CAMLparam2 (gv, devicev);
2371 guestfs_h *g = Guestfs_val (gv);
2373 caml_failwith ("blockdev_getsize64: used handle after closing it");
2375 const char *device = String_val (devicev);
2378 caml_enter_blocking_section ();
2379 r = guestfs_blockdev_getsize64 (g, device);
2380 caml_leave_blocking_section ();
2382 ocaml_guestfs_raise_error (g, "blockdev_getsize64");
2384 rv = caml_copy_int64 (r);
2389 ocaml_guestfs_blockdev_flushbufs (value gv, value devicev)
2391 CAMLparam2 (gv, devicev);
2394 guestfs_h *g = Guestfs_val (gv);
2396 caml_failwith ("blockdev_flushbufs: used handle after closing it");
2398 const char *device = String_val (devicev);
2401 caml_enter_blocking_section ();
2402 r = guestfs_blockdev_flushbufs (g, device);
2403 caml_leave_blocking_section ();
2405 ocaml_guestfs_raise_error (g, "blockdev_flushbufs");
2412 ocaml_guestfs_blockdev_rereadpt (value gv, value devicev)
2414 CAMLparam2 (gv, devicev);
2417 guestfs_h *g = Guestfs_val (gv);
2419 caml_failwith ("blockdev_rereadpt: used handle after closing it");
2421 const char *device = String_val (devicev);
2424 caml_enter_blocking_section ();
2425 r = guestfs_blockdev_rereadpt (g, device);
2426 caml_leave_blocking_section ();
2428 ocaml_guestfs_raise_error (g, "blockdev_rereadpt");
2435 ocaml_guestfs_upload (value gv, value filenamev, value remotefilenamev)
2437 CAMLparam3 (gv, filenamev, remotefilenamev);
2440 guestfs_h *g = Guestfs_val (gv);
2442 caml_failwith ("upload: used handle after closing it");
2444 const char *filename = String_val (filenamev);
2445 const char *remotefilename = String_val (remotefilenamev);
2448 caml_enter_blocking_section ();
2449 r = guestfs_upload (g, filename, remotefilename);
2450 caml_leave_blocking_section ();
2452 ocaml_guestfs_raise_error (g, "upload");
2459 ocaml_guestfs_download (value gv, value remotefilenamev, value filenamev)
2461 CAMLparam3 (gv, remotefilenamev, filenamev);
2464 guestfs_h *g = Guestfs_val (gv);
2466 caml_failwith ("download: used handle after closing it");
2468 const char *remotefilename = String_val (remotefilenamev);
2469 const char *filename = String_val (filenamev);
2472 caml_enter_blocking_section ();
2473 r = guestfs_download (g, remotefilename, filename);
2474 caml_leave_blocking_section ();
2476 ocaml_guestfs_raise_error (g, "download");
2483 ocaml_guestfs_checksum (value gv, value csumtypev, value pathv)
2485 CAMLparam3 (gv, csumtypev, pathv);
2488 guestfs_h *g = Guestfs_val (gv);
2490 caml_failwith ("checksum: used handle after closing it");
2492 const char *csumtype = String_val (csumtypev);
2493 const char *path = String_val (pathv);
2496 caml_enter_blocking_section ();
2497 r = guestfs_checksum (g, csumtype, path);
2498 caml_leave_blocking_section ();
2500 ocaml_guestfs_raise_error (g, "checksum");
2502 rv = caml_copy_string (r);
2508 ocaml_guestfs_tar_in (value gv, value tarfilev, value directoryv)
2510 CAMLparam3 (gv, tarfilev, directoryv);
2513 guestfs_h *g = Guestfs_val (gv);
2515 caml_failwith ("tar_in: used handle after closing it");
2517 const char *tarfile = String_val (tarfilev);
2518 const char *directory = String_val (directoryv);
2521 caml_enter_blocking_section ();
2522 r = guestfs_tar_in (g, tarfile, directory);
2523 caml_leave_blocking_section ();
2525 ocaml_guestfs_raise_error (g, "tar_in");
2532 ocaml_guestfs_tar_out (value gv, value directoryv, value tarfilev)
2534 CAMLparam3 (gv, directoryv, tarfilev);
2537 guestfs_h *g = Guestfs_val (gv);
2539 caml_failwith ("tar_out: used handle after closing it");
2541 const char *directory = String_val (directoryv);
2542 const char *tarfile = String_val (tarfilev);
2545 caml_enter_blocking_section ();
2546 r = guestfs_tar_out (g, directory, tarfile);
2547 caml_leave_blocking_section ();
2549 ocaml_guestfs_raise_error (g, "tar_out");
2556 ocaml_guestfs_tgz_in (value gv, value tarballv, value directoryv)
2558 CAMLparam3 (gv, tarballv, directoryv);
2561 guestfs_h *g = Guestfs_val (gv);
2563 caml_failwith ("tgz_in: used handle after closing it");
2565 const char *tarball = String_val (tarballv);
2566 const char *directory = String_val (directoryv);
2569 caml_enter_blocking_section ();
2570 r = guestfs_tgz_in (g, tarball, directory);
2571 caml_leave_blocking_section ();
2573 ocaml_guestfs_raise_error (g, "tgz_in");
2580 ocaml_guestfs_tgz_out (value gv, value directoryv, value tarballv)
2582 CAMLparam3 (gv, directoryv, tarballv);
2585 guestfs_h *g = Guestfs_val (gv);
2587 caml_failwith ("tgz_out: used handle after closing it");
2589 const char *directory = String_val (directoryv);
2590 const char *tarball = String_val (tarballv);
2593 caml_enter_blocking_section ();
2594 r = guestfs_tgz_out (g, directory, tarball);
2595 caml_leave_blocking_section ();
2597 ocaml_guestfs_raise_error (g, "tgz_out");
2604 ocaml_guestfs_mount_ro (value gv, value devicev, value mountpointv)
2606 CAMLparam3 (gv, devicev, mountpointv);
2609 guestfs_h *g = Guestfs_val (gv);
2611 caml_failwith ("mount_ro: used handle after closing it");
2613 const char *device = String_val (devicev);
2614 const char *mountpoint = String_val (mountpointv);
2617 caml_enter_blocking_section ();
2618 r = guestfs_mount_ro (g, device, mountpoint);
2619 caml_leave_blocking_section ();
2621 ocaml_guestfs_raise_error (g, "mount_ro");
2628 ocaml_guestfs_mount_options (value gv, value optionsv, value devicev, value mountpointv)
2630 CAMLparam4 (gv, optionsv, devicev, mountpointv);
2633 guestfs_h *g = Guestfs_val (gv);
2635 caml_failwith ("mount_options: used handle after closing it");
2637 const char *options = String_val (optionsv);
2638 const char *device = String_val (devicev);
2639 const char *mountpoint = String_val (mountpointv);
2642 caml_enter_blocking_section ();
2643 r = guestfs_mount_options (g, options, device, mountpoint);
2644 caml_leave_blocking_section ();
2646 ocaml_guestfs_raise_error (g, "mount_options");
2653 ocaml_guestfs_mount_vfs (value gv, value optionsv, value vfstypev, value devicev, value mountpointv)
2655 CAMLparam5 (gv, optionsv, vfstypev, devicev, mountpointv);
2658 guestfs_h *g = Guestfs_val (gv);
2660 caml_failwith ("mount_vfs: used handle after closing it");
2662 const char *options = String_val (optionsv);
2663 const char *vfstype = String_val (vfstypev);
2664 const char *device = String_val (devicev);
2665 const char *mountpoint = String_val (mountpointv);
2668 caml_enter_blocking_section ();
2669 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
2670 caml_leave_blocking_section ();
2672 ocaml_guestfs_raise_error (g, "mount_vfs");
2679 ocaml_guestfs_debug (value gv, value subcmdv, value extraargsv)
2681 CAMLparam3 (gv, subcmdv, extraargsv);
2684 guestfs_h *g = Guestfs_val (gv);
2686 caml_failwith ("debug: used handle after closing it");
2688 const char *subcmd = String_val (subcmdv);
2689 char **extraargs = ocaml_guestfs_strings_val (g, extraargsv);
2692 caml_enter_blocking_section ();
2693 r = guestfs_debug (g, subcmd, extraargs);
2694 caml_leave_blocking_section ();
2695 ocaml_guestfs_free_strings (extraargs);
2697 ocaml_guestfs_raise_error (g, "debug");
2699 rv = caml_copy_string (r);
2705 ocaml_guestfs_lvremove (value gv, value devicev)
2707 CAMLparam2 (gv, devicev);
2710 guestfs_h *g = Guestfs_val (gv);
2712 caml_failwith ("lvremove: used handle after closing it");
2714 const char *device = String_val (devicev);
2717 caml_enter_blocking_section ();
2718 r = guestfs_lvremove (g, device);
2719 caml_leave_blocking_section ();
2721 ocaml_guestfs_raise_error (g, "lvremove");
2728 ocaml_guestfs_vgremove (value gv, value vgnamev)
2730 CAMLparam2 (gv, vgnamev);
2733 guestfs_h *g = Guestfs_val (gv);
2735 caml_failwith ("vgremove: used handle after closing it");
2737 const char *vgname = String_val (vgnamev);
2740 caml_enter_blocking_section ();
2741 r = guestfs_vgremove (g, vgname);
2742 caml_leave_blocking_section ();
2744 ocaml_guestfs_raise_error (g, "vgremove");
2751 ocaml_guestfs_pvremove (value gv, value devicev)
2753 CAMLparam2 (gv, devicev);
2756 guestfs_h *g = Guestfs_val (gv);
2758 caml_failwith ("pvremove: used handle after closing it");
2760 const char *device = String_val (devicev);
2763 caml_enter_blocking_section ();
2764 r = guestfs_pvremove (g, device);
2765 caml_leave_blocking_section ();
2767 ocaml_guestfs_raise_error (g, "pvremove");
2774 ocaml_guestfs_set_e2label (value gv, value devicev, value labelv)
2776 CAMLparam3 (gv, devicev, labelv);
2779 guestfs_h *g = Guestfs_val (gv);
2781 caml_failwith ("set_e2label: used handle after closing it");
2783 const char *device = String_val (devicev);
2784 const char *label = String_val (labelv);
2787 caml_enter_blocking_section ();
2788 r = guestfs_set_e2label (g, device, label);
2789 caml_leave_blocking_section ();
2791 ocaml_guestfs_raise_error (g, "set_e2label");
2798 ocaml_guestfs_get_e2label (value gv, value devicev)
2800 CAMLparam2 (gv, devicev);
2803 guestfs_h *g = Guestfs_val (gv);
2805 caml_failwith ("get_e2label: used handle after closing it");
2807 const char *device = String_val (devicev);
2810 caml_enter_blocking_section ();
2811 r = guestfs_get_e2label (g, device);
2812 caml_leave_blocking_section ();
2814 ocaml_guestfs_raise_error (g, "get_e2label");
2816 rv = caml_copy_string (r);
2822 ocaml_guestfs_set_e2uuid (value gv, value devicev, value uuidv)
2824 CAMLparam3 (gv, devicev, uuidv);
2827 guestfs_h *g = Guestfs_val (gv);
2829 caml_failwith ("set_e2uuid: used handle after closing it");
2831 const char *device = String_val (devicev);
2832 const char *uuid = String_val (uuidv);
2835 caml_enter_blocking_section ();
2836 r = guestfs_set_e2uuid (g, device, uuid);
2837 caml_leave_blocking_section ();
2839 ocaml_guestfs_raise_error (g, "set_e2uuid");
2846 ocaml_guestfs_get_e2uuid (value gv, value devicev)
2848 CAMLparam2 (gv, devicev);
2851 guestfs_h *g = Guestfs_val (gv);
2853 caml_failwith ("get_e2uuid: used handle after closing it");
2855 const char *device = String_val (devicev);
2858 caml_enter_blocking_section ();
2859 r = guestfs_get_e2uuid (g, device);
2860 caml_leave_blocking_section ();
2862 ocaml_guestfs_raise_error (g, "get_e2uuid");
2864 rv = caml_copy_string (r);
2870 ocaml_guestfs_fsck (value gv, value fstypev, value devicev)
2872 CAMLparam3 (gv, fstypev, devicev);
2875 guestfs_h *g = Guestfs_val (gv);
2877 caml_failwith ("fsck: used handle after closing it");
2879 const char *fstype = String_val (fstypev);
2880 const char *device = String_val (devicev);
2883 caml_enter_blocking_section ();
2884 r = guestfs_fsck (g, fstype, device);
2885 caml_leave_blocking_section ();
2887 ocaml_guestfs_raise_error (g, "fsck");
2894 ocaml_guestfs_zero (value gv, value devicev)
2896 CAMLparam2 (gv, devicev);
2899 guestfs_h *g = Guestfs_val (gv);
2901 caml_failwith ("zero: used handle after closing it");
2903 const char *device = String_val (devicev);
2906 caml_enter_blocking_section ();
2907 r = guestfs_zero (g, device);
2908 caml_leave_blocking_section ();
2910 ocaml_guestfs_raise_error (g, "zero");
2917 ocaml_guestfs_grub_install (value gv, value rootv, value devicev)
2919 CAMLparam3 (gv, rootv, devicev);
2922 guestfs_h *g = Guestfs_val (gv);
2924 caml_failwith ("grub_install: used handle after closing it");
2926 const char *root = String_val (rootv);
2927 const char *device = String_val (devicev);
2930 caml_enter_blocking_section ();
2931 r = guestfs_grub_install (g, root, device);
2932 caml_leave_blocking_section ();
2934 ocaml_guestfs_raise_error (g, "grub_install");
2941 ocaml_guestfs_cp (value gv, value srcv, value destv)
2943 CAMLparam3 (gv, srcv, destv);
2946 guestfs_h *g = Guestfs_val (gv);
2948 caml_failwith ("cp: used handle after closing it");
2950 const char *src = String_val (srcv);
2951 const char *dest = String_val (destv);
2954 caml_enter_blocking_section ();
2955 r = guestfs_cp (g, src, dest);
2956 caml_leave_blocking_section ();
2958 ocaml_guestfs_raise_error (g, "cp");
2965 ocaml_guestfs_cp_a (value gv, value srcv, value destv)
2967 CAMLparam3 (gv, srcv, destv);
2970 guestfs_h *g = Guestfs_val (gv);
2972 caml_failwith ("cp_a: used handle after closing it");
2974 const char *src = String_val (srcv);
2975 const char *dest = String_val (destv);
2978 caml_enter_blocking_section ();
2979 r = guestfs_cp_a (g, src, dest);
2980 caml_leave_blocking_section ();
2982 ocaml_guestfs_raise_error (g, "cp_a");
2989 ocaml_guestfs_mv (value gv, value srcv, value destv)
2991 CAMLparam3 (gv, srcv, destv);
2994 guestfs_h *g = Guestfs_val (gv);
2996 caml_failwith ("mv: used handle after closing it");
2998 const char *src = String_val (srcv);
2999 const char *dest = String_val (destv);
3002 caml_enter_blocking_section ();
3003 r = guestfs_mv (g, src, dest);
3004 caml_leave_blocking_section ();
3006 ocaml_guestfs_raise_error (g, "mv");
3013 ocaml_guestfs_drop_caches (value gv, value whattodropv)
3015 CAMLparam2 (gv, whattodropv);
3018 guestfs_h *g = Guestfs_val (gv);
3020 caml_failwith ("drop_caches: used handle after closing it");
3022 int whattodrop = Int_val (whattodropv);
3025 caml_enter_blocking_section ();
3026 r = guestfs_drop_caches (g, whattodrop);
3027 caml_leave_blocking_section ();
3029 ocaml_guestfs_raise_error (g, "drop_caches");
3036 ocaml_guestfs_dmesg (value gv)
3041 guestfs_h *g = Guestfs_val (gv);
3043 caml_failwith ("dmesg: used handle after closing it");
3047 caml_enter_blocking_section ();
3048 r = guestfs_dmesg (g);
3049 caml_leave_blocking_section ();
3051 ocaml_guestfs_raise_error (g, "dmesg");
3053 rv = caml_copy_string (r);
3059 ocaml_guestfs_ping_daemon (value gv)
3064 guestfs_h *g = Guestfs_val (gv);
3066 caml_failwith ("ping_daemon: used handle after closing it");
3070 caml_enter_blocking_section ();
3071 r = guestfs_ping_daemon (g);
3072 caml_leave_blocking_section ();
3074 ocaml_guestfs_raise_error (g, "ping_daemon");
3081 ocaml_guestfs_equal (value gv, value file1v, value file2v)
3083 CAMLparam3 (gv, file1v, file2v);
3086 guestfs_h *g = Guestfs_val (gv);
3088 caml_failwith ("equal: used handle after closing it");
3090 const char *file1 = String_val (file1v);
3091 const char *file2 = String_val (file2v);
3094 caml_enter_blocking_section ();
3095 r = guestfs_equal (g, file1, file2);
3096 caml_leave_blocking_section ();
3098 ocaml_guestfs_raise_error (g, "equal");
3105 ocaml_guestfs_strings (value gv, value pathv)
3107 CAMLparam2 (gv, pathv);
3110 guestfs_h *g = Guestfs_val (gv);
3112 caml_failwith ("strings: used handle after closing it");
3114 const char *path = String_val (pathv);
3118 caml_enter_blocking_section ();
3119 r = guestfs_strings (g, path);
3120 caml_leave_blocking_section ();
3122 ocaml_guestfs_raise_error (g, "strings");
3124 rv = caml_copy_string_array ((const char **) r);
3125 for (i = 0; r[i] != NULL; ++i) free (r[i]);
3131 ocaml_guestfs_strings_e (value gv, value encodingv, value pathv)
3133 CAMLparam3 (gv, encodingv, pathv);
3136 guestfs_h *g = Guestfs_val (gv);
3138 caml_failwith ("strings_e: used handle after closing it");
3140 const char *encoding = String_val (encodingv);
3141 const char *path = String_val (pathv);
3145 caml_enter_blocking_section ();
3146 r = guestfs_strings_e (g, encoding, path);
3147 caml_leave_blocking_section ();
3149 ocaml_guestfs_raise_error (g, "strings_e");
3151 rv = caml_copy_string_array ((const char **) r);
3152 for (i = 0; r[i] != NULL; ++i) free (r[i]);
3158 ocaml_guestfs_hexdump (value gv, value pathv)
3160 CAMLparam2 (gv, pathv);
3163 guestfs_h *g = Guestfs_val (gv);
3165 caml_failwith ("hexdump: used handle after closing it");
3167 const char *path = String_val (pathv);
3170 caml_enter_blocking_section ();
3171 r = guestfs_hexdump (g, path);
3172 caml_leave_blocking_section ();
3174 ocaml_guestfs_raise_error (g, "hexdump");
3176 rv = caml_copy_string (r);
3182 ocaml_guestfs_zerofree (value gv, value devicev)
3184 CAMLparam2 (gv, devicev);
3187 guestfs_h *g = Guestfs_val (gv);
3189 caml_failwith ("zerofree: used handle after closing it");
3191 const char *device = String_val (devicev);
3194 caml_enter_blocking_section ();
3195 r = guestfs_zerofree (g, device);
3196 caml_leave_blocking_section ();
3198 ocaml_guestfs_raise_error (g, "zerofree");
3205 ocaml_guestfs_pvresize (value gv, value devicev)
3207 CAMLparam2 (gv, devicev);
3210 guestfs_h *g = Guestfs_val (gv);
3212 caml_failwith ("pvresize: used handle after closing it");
3214 const char *device = String_val (devicev);
3217 caml_enter_blocking_section ();
3218 r = guestfs_pvresize (g, device);
3219 caml_leave_blocking_section ();
3221 ocaml_guestfs_raise_error (g, "pvresize");
3228 ocaml_guestfs_sfdisk_N (value gv, value devicev, value nv, value cylsv, value headsv, value sectorsv, value linev)
3230 CAMLparam5 (gv, devicev, nv, cylsv, headsv);
3231 CAMLxparam2 (sectorsv, linev);
3234 guestfs_h *g = Guestfs_val (gv);
3236 caml_failwith ("sfdisk_N: used handle after closing it");
3238 const char *device = String_val (devicev);
3239 int n = Int_val (nv);
3240 int cyls = Int_val (cylsv);
3241 int heads = Int_val (headsv);
3242 int sectors = Int_val (sectorsv);
3243 const char *line = String_val (linev);
3246 caml_enter_blocking_section ();
3247 r = guestfs_sfdisk_N (g, device, n, cyls, heads, sectors, line);
3248 caml_leave_blocking_section ();
3250 ocaml_guestfs_raise_error (g, "sfdisk_N");
3257 ocaml_guestfs_sfdisk_N_byte (value *argv, int argn)
3259 return ocaml_guestfs_sfdisk_N (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
3263 ocaml_guestfs_sfdisk_l (value gv, value devicev)
3265 CAMLparam2 (gv, devicev);
3268 guestfs_h *g = Guestfs_val (gv);
3270 caml_failwith ("sfdisk_l: used handle after closing it");
3272 const char *device = String_val (devicev);
3275 caml_enter_blocking_section ();
3276 r = guestfs_sfdisk_l (g, device);
3277 caml_leave_blocking_section ();
3279 ocaml_guestfs_raise_error (g, "sfdisk_l");
3281 rv = caml_copy_string (r);
3287 ocaml_guestfs_sfdisk_kernel_geometry (value gv, value devicev)
3289 CAMLparam2 (gv, devicev);
3292 guestfs_h *g = Guestfs_val (gv);
3294 caml_failwith ("sfdisk_kernel_geometry: used handle after closing it");
3296 const char *device = String_val (devicev);
3299 caml_enter_blocking_section ();
3300 r = guestfs_sfdisk_kernel_geometry (g, device);
3301 caml_leave_blocking_section ();
3303 ocaml_guestfs_raise_error (g, "sfdisk_kernel_geometry");
3305 rv = caml_copy_string (r);
3311 ocaml_guestfs_sfdisk_disk_geometry (value gv, value devicev)
3313 CAMLparam2 (gv, devicev);
3316 guestfs_h *g = Guestfs_val (gv);
3318 caml_failwith ("sfdisk_disk_geometry: used handle after closing it");
3320 const char *device = String_val (devicev);
3323 caml_enter_blocking_section ();
3324 r = guestfs_sfdisk_disk_geometry (g, device);
3325 caml_leave_blocking_section ();
3327 ocaml_guestfs_raise_error (g, "sfdisk_disk_geometry");
3329 rv = caml_copy_string (r);
3335 ocaml_guestfs_vg_activate_all (value gv, value activatev)
3337 CAMLparam2 (gv, activatev);
3340 guestfs_h *g = Guestfs_val (gv);
3342 caml_failwith ("vg_activate_all: used handle after closing it");
3344 int activate = Bool_val (activatev);
3347 caml_enter_blocking_section ();
3348 r = guestfs_vg_activate_all (g, activate);
3349 caml_leave_blocking_section ();
3351 ocaml_guestfs_raise_error (g, "vg_activate_all");
3358 ocaml_guestfs_vg_activate (value gv, value activatev, value volgroupsv)
3360 CAMLparam3 (gv, activatev, volgroupsv);
3363 guestfs_h *g = Guestfs_val (gv);
3365 caml_failwith ("vg_activate: used handle after closing it");
3367 int activate = Bool_val (activatev);
3368 char **volgroups = ocaml_guestfs_strings_val (g, volgroupsv);
3371 caml_enter_blocking_section ();
3372 r = guestfs_vg_activate (g, activate, volgroups);
3373 caml_leave_blocking_section ();
3374 ocaml_guestfs_free_strings (volgroups);
3376 ocaml_guestfs_raise_error (g, "vg_activate");
3383 ocaml_guestfs_lvresize (value gv, value devicev, value mbytesv)
3385 CAMLparam3 (gv, devicev, mbytesv);
3388 guestfs_h *g = Guestfs_val (gv);
3390 caml_failwith ("lvresize: used handle after closing it");
3392 const char *device = String_val (devicev);
3393 int mbytes = Int_val (mbytesv);
3396 caml_enter_blocking_section ();
3397 r = guestfs_lvresize (g, device, mbytes);
3398 caml_leave_blocking_section ();
3400 ocaml_guestfs_raise_error (g, "lvresize");
3407 ocaml_guestfs_resize2fs (value gv, value devicev)
3409 CAMLparam2 (gv, devicev);
3412 guestfs_h *g = Guestfs_val (gv);
3414 caml_failwith ("resize2fs: used handle after closing it");
3416 const char *device = String_val (devicev);
3419 caml_enter_blocking_section ();
3420 r = guestfs_resize2fs (g, device);
3421 caml_leave_blocking_section ();
3423 ocaml_guestfs_raise_error (g, "resize2fs");
3430 ocaml_guestfs_find (value gv, value directoryv)
3432 CAMLparam2 (gv, directoryv);
3435 guestfs_h *g = Guestfs_val (gv);
3437 caml_failwith ("find: used handle after closing it");
3439 const char *directory = String_val (directoryv);
3443 caml_enter_blocking_section ();
3444 r = guestfs_find (g, directory);
3445 caml_leave_blocking_section ();
3447 ocaml_guestfs_raise_error (g, "find");
3449 rv = caml_copy_string_array ((const char **) r);
3450 for (i = 0; r[i] != NULL; ++i) free (r[i]);
3456 ocaml_guestfs_e2fsck_f (value gv, value devicev)
3458 CAMLparam2 (gv, devicev);
3461 guestfs_h *g = Guestfs_val (gv);
3463 caml_failwith ("e2fsck_f: used handle after closing it");
3465 const char *device = String_val (devicev);
3468 caml_enter_blocking_section ();
3469 r = guestfs_e2fsck_f (g, device);
3470 caml_leave_blocking_section ();
3472 ocaml_guestfs_raise_error (g, "e2fsck_f");