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);
331 static CAMLprim value
332 copy_dirent (const struct guestfs_dirent *dirent)
337 rv = caml_alloc (3, 0);
338 v = caml_copy_int64 (dirent->ino);
339 Store_field (rv, 0, v);
340 v = Val_int (dirent->ftyp);
341 Store_field (rv, 1, v);
342 v = caml_copy_string (dirent->name);
343 Store_field (rv, 2, v);
347 static CAMLprim value
348 copy_dirent_list (const struct guestfs_dirent_list *dirents)
354 if (dirents->len == 0)
355 CAMLreturn (Atom (0));
357 rv = caml_alloc (dirents->len, 0);
358 for (i = 0; i < dirents->len; ++i) {
359 v = copy_dirent (&dirents->val[i]);
360 caml_modify (&Field (rv, i), v);
367 ocaml_guestfs_test0 (value gv, value strv, value optstrv, value strlistv, value bv, value integerv, value fileinv, value fileoutv)
369 CAMLparam5 (gv, strv, optstrv, strlistv, bv);
370 CAMLxparam3 (integerv, fileinv, fileoutv);
373 guestfs_h *g = Guestfs_val (gv);
375 caml_failwith ("test0: used handle after closing it");
377 const char *str = String_val (strv);
379 optstrv != Val_int (0) ? String_val (Field (optstrv, 0)) : NULL;
380 char **strlist = ocaml_guestfs_strings_val (g, strlistv);
381 int b = Bool_val (bv);
382 int integer = Int_val (integerv);
383 const char *filein = String_val (fileinv);
384 const char *fileout = String_val (fileoutv);
387 caml_enter_blocking_section ();
388 r = guestfs_test0 (g, str, optstr, strlist, b, integer, filein, fileout);
389 caml_leave_blocking_section ();
390 ocaml_guestfs_free_strings (strlist);
392 ocaml_guestfs_raise_error (g, "test0");
399 ocaml_guestfs_test0_byte (value *argv, int argn)
401 return ocaml_guestfs_test0 (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
405 ocaml_guestfs_test0rint (value gv, value valv)
407 CAMLparam2 (gv, valv);
410 guestfs_h *g = Guestfs_val (gv);
412 caml_failwith ("test0rint: used handle after closing it");
414 const char *val = String_val (valv);
417 caml_enter_blocking_section ();
418 r = guestfs_test0rint (g, val);
419 caml_leave_blocking_section ();
421 ocaml_guestfs_raise_error (g, "test0rint");
428 ocaml_guestfs_test0rinterr (value gv)
433 guestfs_h *g = Guestfs_val (gv);
435 caml_failwith ("test0rinterr: used handle after closing it");
439 caml_enter_blocking_section ();
440 r = guestfs_test0rinterr (g);
441 caml_leave_blocking_section ();
443 ocaml_guestfs_raise_error (g, "test0rinterr");
450 ocaml_guestfs_test0rint64 (value gv, value valv)
452 CAMLparam2 (gv, valv);
455 guestfs_h *g = Guestfs_val (gv);
457 caml_failwith ("test0rint64: used handle after closing it");
459 const char *val = String_val (valv);
462 caml_enter_blocking_section ();
463 r = guestfs_test0rint64 (g, val);
464 caml_leave_blocking_section ();
466 ocaml_guestfs_raise_error (g, "test0rint64");
468 rv = caml_copy_int64 (r);
473 ocaml_guestfs_test0rint64err (value gv)
478 guestfs_h *g = Guestfs_val (gv);
480 caml_failwith ("test0rint64err: used handle after closing it");
484 caml_enter_blocking_section ();
485 r = guestfs_test0rint64err (g);
486 caml_leave_blocking_section ();
488 ocaml_guestfs_raise_error (g, "test0rint64err");
490 rv = caml_copy_int64 (r);
495 ocaml_guestfs_test0rbool (value gv, value valv)
497 CAMLparam2 (gv, valv);
500 guestfs_h *g = Guestfs_val (gv);
502 caml_failwith ("test0rbool: used handle after closing it");
504 const char *val = String_val (valv);
507 caml_enter_blocking_section ();
508 r = guestfs_test0rbool (g, val);
509 caml_leave_blocking_section ();
511 ocaml_guestfs_raise_error (g, "test0rbool");
518 ocaml_guestfs_test0rboolerr (value gv)
523 guestfs_h *g = Guestfs_val (gv);
525 caml_failwith ("test0rboolerr: used handle after closing it");
529 caml_enter_blocking_section ();
530 r = guestfs_test0rboolerr (g);
531 caml_leave_blocking_section ();
533 ocaml_guestfs_raise_error (g, "test0rboolerr");
540 ocaml_guestfs_test0rconststring (value gv, value valv)
542 CAMLparam2 (gv, valv);
545 guestfs_h *g = Guestfs_val (gv);
547 caml_failwith ("test0rconststring: used handle after closing it");
549 const char *val = String_val (valv);
552 caml_enter_blocking_section ();
553 r = guestfs_test0rconststring (g, val);
554 caml_leave_blocking_section ();
556 ocaml_guestfs_raise_error (g, "test0rconststring");
558 rv = caml_copy_string (r);
563 ocaml_guestfs_test0rconststringerr (value gv)
568 guestfs_h *g = Guestfs_val (gv);
570 caml_failwith ("test0rconststringerr: used handle after closing it");
574 caml_enter_blocking_section ();
575 r = guestfs_test0rconststringerr (g);
576 caml_leave_blocking_section ();
578 ocaml_guestfs_raise_error (g, "test0rconststringerr");
580 rv = caml_copy_string (r);
585 ocaml_guestfs_test0rstring (value gv, value valv)
587 CAMLparam2 (gv, valv);
590 guestfs_h *g = Guestfs_val (gv);
592 caml_failwith ("test0rstring: used handle after closing it");
594 const char *val = String_val (valv);
597 caml_enter_blocking_section ();
598 r = guestfs_test0rstring (g, val);
599 caml_leave_blocking_section ();
601 ocaml_guestfs_raise_error (g, "test0rstring");
603 rv = caml_copy_string (r);
609 ocaml_guestfs_test0rstringerr (value gv)
614 guestfs_h *g = Guestfs_val (gv);
616 caml_failwith ("test0rstringerr: used handle after closing it");
620 caml_enter_blocking_section ();
621 r = guestfs_test0rstringerr (g);
622 caml_leave_blocking_section ();
624 ocaml_guestfs_raise_error (g, "test0rstringerr");
626 rv = caml_copy_string (r);
632 ocaml_guestfs_test0rstringlist (value gv, value valv)
634 CAMLparam2 (gv, valv);
637 guestfs_h *g = Guestfs_val (gv);
639 caml_failwith ("test0rstringlist: used handle after closing it");
641 const char *val = String_val (valv);
645 caml_enter_blocking_section ();
646 r = guestfs_test0rstringlist (g, val);
647 caml_leave_blocking_section ();
649 ocaml_guestfs_raise_error (g, "test0rstringlist");
651 rv = caml_copy_string_array ((const char **) r);
652 for (i = 0; r[i] != NULL; ++i) free (r[i]);
658 ocaml_guestfs_test0rstringlisterr (value gv)
663 guestfs_h *g = Guestfs_val (gv);
665 caml_failwith ("test0rstringlisterr: used handle after closing it");
670 caml_enter_blocking_section ();
671 r = guestfs_test0rstringlisterr (g);
672 caml_leave_blocking_section ();
674 ocaml_guestfs_raise_error (g, "test0rstringlisterr");
676 rv = caml_copy_string_array ((const char **) r);
677 for (i = 0; r[i] != NULL; ++i) free (r[i]);
683 ocaml_guestfs_test0rintbool (value gv, value valv)
685 CAMLparam2 (gv, valv);
688 guestfs_h *g = Guestfs_val (gv);
690 caml_failwith ("test0rintbool: used handle after closing it");
692 const char *val = String_val (valv);
693 struct guestfs_int_bool *r;
695 caml_enter_blocking_section ();
696 r = guestfs_test0rintbool (g, val);
697 caml_leave_blocking_section ();
699 ocaml_guestfs_raise_error (g, "test0rintbool");
701 rv = caml_alloc (2, 0);
702 Store_field (rv, 0, Val_int (r->i));
703 Store_field (rv, 1, Val_bool (r->b));
704 guestfs_free_int_bool (r);
709 ocaml_guestfs_test0rintboolerr (value gv)
714 guestfs_h *g = Guestfs_val (gv);
716 caml_failwith ("test0rintboolerr: used handle after closing it");
718 struct guestfs_int_bool *r;
720 caml_enter_blocking_section ();
721 r = guestfs_test0rintboolerr (g);
722 caml_leave_blocking_section ();
724 ocaml_guestfs_raise_error (g, "test0rintboolerr");
726 rv = caml_alloc (2, 0);
727 Store_field (rv, 0, Val_int (r->i));
728 Store_field (rv, 1, Val_bool (r->b));
729 guestfs_free_int_bool (r);
734 ocaml_guestfs_test0rpvlist (value gv, value valv)
736 CAMLparam2 (gv, valv);
739 guestfs_h *g = Guestfs_val (gv);
741 caml_failwith ("test0rpvlist: used handle after closing it");
743 const char *val = String_val (valv);
744 struct guestfs_lvm_pv_list *r;
746 caml_enter_blocking_section ();
747 r = guestfs_test0rpvlist (g, val);
748 caml_leave_blocking_section ();
750 ocaml_guestfs_raise_error (g, "test0rpvlist");
752 rv = copy_lvm_pv_list (r);
753 guestfs_free_lvm_pv_list (r);
758 ocaml_guestfs_test0rpvlisterr (value gv)
763 guestfs_h *g = Guestfs_val (gv);
765 caml_failwith ("test0rpvlisterr: used handle after closing it");
767 struct guestfs_lvm_pv_list *r;
769 caml_enter_blocking_section ();
770 r = guestfs_test0rpvlisterr (g);
771 caml_leave_blocking_section ();
773 ocaml_guestfs_raise_error (g, "test0rpvlisterr");
775 rv = copy_lvm_pv_list (r);
776 guestfs_free_lvm_pv_list (r);
781 ocaml_guestfs_test0rvglist (value gv, value valv)
783 CAMLparam2 (gv, valv);
786 guestfs_h *g = Guestfs_val (gv);
788 caml_failwith ("test0rvglist: used handle after closing it");
790 const char *val = String_val (valv);
791 struct guestfs_lvm_vg_list *r;
793 caml_enter_blocking_section ();
794 r = guestfs_test0rvglist (g, val);
795 caml_leave_blocking_section ();
797 ocaml_guestfs_raise_error (g, "test0rvglist");
799 rv = copy_lvm_vg_list (r);
800 guestfs_free_lvm_vg_list (r);
805 ocaml_guestfs_test0rvglisterr (value gv)
810 guestfs_h *g = Guestfs_val (gv);
812 caml_failwith ("test0rvglisterr: used handle after closing it");
814 struct guestfs_lvm_vg_list *r;
816 caml_enter_blocking_section ();
817 r = guestfs_test0rvglisterr (g);
818 caml_leave_blocking_section ();
820 ocaml_guestfs_raise_error (g, "test0rvglisterr");
822 rv = copy_lvm_vg_list (r);
823 guestfs_free_lvm_vg_list (r);
828 ocaml_guestfs_test0rlvlist (value gv, value valv)
830 CAMLparam2 (gv, valv);
833 guestfs_h *g = Guestfs_val (gv);
835 caml_failwith ("test0rlvlist: used handle after closing it");
837 const char *val = String_val (valv);
838 struct guestfs_lvm_lv_list *r;
840 caml_enter_blocking_section ();
841 r = guestfs_test0rlvlist (g, val);
842 caml_leave_blocking_section ();
844 ocaml_guestfs_raise_error (g, "test0rlvlist");
846 rv = copy_lvm_lv_list (r);
847 guestfs_free_lvm_lv_list (r);
852 ocaml_guestfs_test0rlvlisterr (value gv)
857 guestfs_h *g = Guestfs_val (gv);
859 caml_failwith ("test0rlvlisterr: used handle after closing it");
861 struct guestfs_lvm_lv_list *r;
863 caml_enter_blocking_section ();
864 r = guestfs_test0rlvlisterr (g);
865 caml_leave_blocking_section ();
867 ocaml_guestfs_raise_error (g, "test0rlvlisterr");
869 rv = copy_lvm_lv_list (r);
870 guestfs_free_lvm_lv_list (r);
875 ocaml_guestfs_test0rstat (value gv, value valv)
877 CAMLparam2 (gv, valv);
880 guestfs_h *g = Guestfs_val (gv);
882 caml_failwith ("test0rstat: used handle after closing it");
884 const char *val = String_val (valv);
885 struct guestfs_stat *r;
887 caml_enter_blocking_section ();
888 r = guestfs_test0rstat (g, val);
889 caml_leave_blocking_section ();
891 ocaml_guestfs_raise_error (g, "test0rstat");
899 ocaml_guestfs_test0rstaterr (value gv)
904 guestfs_h *g = Guestfs_val (gv);
906 caml_failwith ("test0rstaterr: used handle after closing it");
908 struct guestfs_stat *r;
910 caml_enter_blocking_section ();
911 r = guestfs_test0rstaterr (g);
912 caml_leave_blocking_section ();
914 ocaml_guestfs_raise_error (g, "test0rstaterr");
922 ocaml_guestfs_test0rstatvfs (value gv, value valv)
924 CAMLparam2 (gv, valv);
927 guestfs_h *g = Guestfs_val (gv);
929 caml_failwith ("test0rstatvfs: used handle after closing it");
931 const char *val = String_val (valv);
932 struct guestfs_statvfs *r;
934 caml_enter_blocking_section ();
935 r = guestfs_test0rstatvfs (g, val);
936 caml_leave_blocking_section ();
938 ocaml_guestfs_raise_error (g, "test0rstatvfs");
940 rv = copy_statvfs (r);
946 ocaml_guestfs_test0rstatvfserr (value gv)
951 guestfs_h *g = Guestfs_val (gv);
953 caml_failwith ("test0rstatvfserr: used handle after closing it");
955 struct guestfs_statvfs *r;
957 caml_enter_blocking_section ();
958 r = guestfs_test0rstatvfserr (g);
959 caml_leave_blocking_section ();
961 ocaml_guestfs_raise_error (g, "test0rstatvfserr");
963 rv = copy_statvfs (r);
969 ocaml_guestfs_test0rhashtable (value gv, value valv)
971 CAMLparam2 (gv, valv);
974 guestfs_h *g = Guestfs_val (gv);
976 caml_failwith ("test0rhashtable: used handle after closing it");
978 const char *val = String_val (valv);
982 caml_enter_blocking_section ();
983 r = guestfs_test0rhashtable (g, val);
984 caml_leave_blocking_section ();
986 ocaml_guestfs_raise_error (g, "test0rhashtable");
989 for (i = 0; r[i] != NULL; ++i) free (r[i]);
995 ocaml_guestfs_test0rhashtableerr (value gv)
1000 guestfs_h *g = Guestfs_val (gv);
1002 caml_failwith ("test0rhashtableerr: used handle after closing it");
1007 caml_enter_blocking_section ();
1008 r = guestfs_test0rhashtableerr (g);
1009 caml_leave_blocking_section ();
1011 ocaml_guestfs_raise_error (g, "test0rhashtableerr");
1013 rv = copy_table (r);
1014 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1020 ocaml_guestfs_launch (value gv)
1025 guestfs_h *g = Guestfs_val (gv);
1027 caml_failwith ("launch: used handle after closing it");
1031 caml_enter_blocking_section ();
1032 r = guestfs_launch (g);
1033 caml_leave_blocking_section ();
1035 ocaml_guestfs_raise_error (g, "launch");
1042 ocaml_guestfs_wait_ready (value gv)
1047 guestfs_h *g = Guestfs_val (gv);
1049 caml_failwith ("wait_ready: used handle after closing it");
1053 caml_enter_blocking_section ();
1054 r = guestfs_wait_ready (g);
1055 caml_leave_blocking_section ();
1057 ocaml_guestfs_raise_error (g, "wait_ready");
1064 ocaml_guestfs_kill_subprocess (value gv)
1069 guestfs_h *g = Guestfs_val (gv);
1071 caml_failwith ("kill_subprocess: used handle after closing it");
1075 caml_enter_blocking_section ();
1076 r = guestfs_kill_subprocess (g);
1077 caml_leave_blocking_section ();
1079 ocaml_guestfs_raise_error (g, "kill_subprocess");
1086 ocaml_guestfs_add_drive (value gv, value filenamev)
1088 CAMLparam2 (gv, filenamev);
1091 guestfs_h *g = Guestfs_val (gv);
1093 caml_failwith ("add_drive: used handle after closing it");
1095 const char *filename = String_val (filenamev);
1098 caml_enter_blocking_section ();
1099 r = guestfs_add_drive (g, filename);
1100 caml_leave_blocking_section ();
1102 ocaml_guestfs_raise_error (g, "add_drive");
1109 ocaml_guestfs_add_cdrom (value gv, value filenamev)
1111 CAMLparam2 (gv, filenamev);
1114 guestfs_h *g = Guestfs_val (gv);
1116 caml_failwith ("add_cdrom: used handle after closing it");
1118 const char *filename = String_val (filenamev);
1121 caml_enter_blocking_section ();
1122 r = guestfs_add_cdrom (g, filename);
1123 caml_leave_blocking_section ();
1125 ocaml_guestfs_raise_error (g, "add_cdrom");
1132 ocaml_guestfs_add_drive_ro (value gv, value filenamev)
1134 CAMLparam2 (gv, filenamev);
1137 guestfs_h *g = Guestfs_val (gv);
1139 caml_failwith ("add_drive_ro: used handle after closing it");
1141 const char *filename = String_val (filenamev);
1144 caml_enter_blocking_section ();
1145 r = guestfs_add_drive_ro (g, filename);
1146 caml_leave_blocking_section ();
1148 ocaml_guestfs_raise_error (g, "add_drive_ro");
1155 ocaml_guestfs_config (value gv, value qemuparamv, value qemuvaluev)
1157 CAMLparam3 (gv, qemuparamv, qemuvaluev);
1160 guestfs_h *g = Guestfs_val (gv);
1162 caml_failwith ("config: used handle after closing it");
1164 const char *qemuparam = String_val (qemuparamv);
1165 const char *qemuvalue =
1166 qemuvaluev != Val_int (0) ? String_val (Field (qemuvaluev, 0)) : NULL;
1169 caml_enter_blocking_section ();
1170 r = guestfs_config (g, qemuparam, qemuvalue);
1171 caml_leave_blocking_section ();
1173 ocaml_guestfs_raise_error (g, "config");
1180 ocaml_guestfs_set_qemu (value gv, value qemuv)
1182 CAMLparam2 (gv, qemuv);
1185 guestfs_h *g = Guestfs_val (gv);
1187 caml_failwith ("set_qemu: used handle after closing it");
1189 const char *qemu = String_val (qemuv);
1192 caml_enter_blocking_section ();
1193 r = guestfs_set_qemu (g, qemu);
1194 caml_leave_blocking_section ();
1196 ocaml_guestfs_raise_error (g, "set_qemu");
1203 ocaml_guestfs_get_qemu (value gv)
1208 guestfs_h *g = Guestfs_val (gv);
1210 caml_failwith ("get_qemu: used handle after closing it");
1214 caml_enter_blocking_section ();
1215 r = guestfs_get_qemu (g);
1216 caml_leave_blocking_section ();
1218 ocaml_guestfs_raise_error (g, "get_qemu");
1220 rv = caml_copy_string (r);
1225 ocaml_guestfs_set_path (value gv, value pathv)
1227 CAMLparam2 (gv, pathv);
1230 guestfs_h *g = Guestfs_val (gv);
1232 caml_failwith ("set_path: used handle after closing it");
1234 const char *path = String_val (pathv);
1237 caml_enter_blocking_section ();
1238 r = guestfs_set_path (g, path);
1239 caml_leave_blocking_section ();
1241 ocaml_guestfs_raise_error (g, "set_path");
1248 ocaml_guestfs_get_path (value gv)
1253 guestfs_h *g = Guestfs_val (gv);
1255 caml_failwith ("get_path: used handle after closing it");
1259 caml_enter_blocking_section ();
1260 r = guestfs_get_path (g);
1261 caml_leave_blocking_section ();
1263 ocaml_guestfs_raise_error (g, "get_path");
1265 rv = caml_copy_string (r);
1270 ocaml_guestfs_set_append (value gv, value appendv)
1272 CAMLparam2 (gv, appendv);
1275 guestfs_h *g = Guestfs_val (gv);
1277 caml_failwith ("set_append: used handle after closing it");
1279 const char *append = String_val (appendv);
1282 caml_enter_blocking_section ();
1283 r = guestfs_set_append (g, append);
1284 caml_leave_blocking_section ();
1286 ocaml_guestfs_raise_error (g, "set_append");
1293 ocaml_guestfs_get_append (value gv)
1298 guestfs_h *g = Guestfs_val (gv);
1300 caml_failwith ("get_append: used handle after closing it");
1304 caml_enter_blocking_section ();
1305 r = guestfs_get_append (g);
1306 caml_leave_blocking_section ();
1308 ocaml_guestfs_raise_error (g, "get_append");
1310 rv = caml_copy_string (r);
1315 ocaml_guestfs_set_autosync (value gv, value autosyncv)
1317 CAMLparam2 (gv, autosyncv);
1320 guestfs_h *g = Guestfs_val (gv);
1322 caml_failwith ("set_autosync: used handle after closing it");
1324 int autosync = Bool_val (autosyncv);
1327 caml_enter_blocking_section ();
1328 r = guestfs_set_autosync (g, autosync);
1329 caml_leave_blocking_section ();
1331 ocaml_guestfs_raise_error (g, "set_autosync");
1338 ocaml_guestfs_get_autosync (value gv)
1343 guestfs_h *g = Guestfs_val (gv);
1345 caml_failwith ("get_autosync: used handle after closing it");
1349 caml_enter_blocking_section ();
1350 r = guestfs_get_autosync (g);
1351 caml_leave_blocking_section ();
1353 ocaml_guestfs_raise_error (g, "get_autosync");
1360 ocaml_guestfs_set_verbose (value gv, value verbosev)
1362 CAMLparam2 (gv, verbosev);
1365 guestfs_h *g = Guestfs_val (gv);
1367 caml_failwith ("set_verbose: used handle after closing it");
1369 int verbose = Bool_val (verbosev);
1372 caml_enter_blocking_section ();
1373 r = guestfs_set_verbose (g, verbose);
1374 caml_leave_blocking_section ();
1376 ocaml_guestfs_raise_error (g, "set_verbose");
1383 ocaml_guestfs_get_verbose (value gv)
1388 guestfs_h *g = Guestfs_val (gv);
1390 caml_failwith ("get_verbose: used handle after closing it");
1394 caml_enter_blocking_section ();
1395 r = guestfs_get_verbose (g);
1396 caml_leave_blocking_section ();
1398 ocaml_guestfs_raise_error (g, "get_verbose");
1405 ocaml_guestfs_is_ready (value gv)
1410 guestfs_h *g = Guestfs_val (gv);
1412 caml_failwith ("is_ready: used handle after closing it");
1416 caml_enter_blocking_section ();
1417 r = guestfs_is_ready (g);
1418 caml_leave_blocking_section ();
1420 ocaml_guestfs_raise_error (g, "is_ready");
1427 ocaml_guestfs_is_config (value gv)
1432 guestfs_h *g = Guestfs_val (gv);
1434 caml_failwith ("is_config: used handle after closing it");
1438 caml_enter_blocking_section ();
1439 r = guestfs_is_config (g);
1440 caml_leave_blocking_section ();
1442 ocaml_guestfs_raise_error (g, "is_config");
1449 ocaml_guestfs_is_launching (value gv)
1454 guestfs_h *g = Guestfs_val (gv);
1456 caml_failwith ("is_launching: used handle after closing it");
1460 caml_enter_blocking_section ();
1461 r = guestfs_is_launching (g);
1462 caml_leave_blocking_section ();
1464 ocaml_guestfs_raise_error (g, "is_launching");
1471 ocaml_guestfs_is_busy (value gv)
1476 guestfs_h *g = Guestfs_val (gv);
1478 caml_failwith ("is_busy: used handle after closing it");
1482 caml_enter_blocking_section ();
1483 r = guestfs_is_busy (g);
1484 caml_leave_blocking_section ();
1486 ocaml_guestfs_raise_error (g, "is_busy");
1493 ocaml_guestfs_get_state (value gv)
1498 guestfs_h *g = Guestfs_val (gv);
1500 caml_failwith ("get_state: used handle after closing it");
1504 caml_enter_blocking_section ();
1505 r = guestfs_get_state (g);
1506 caml_leave_blocking_section ();
1508 ocaml_guestfs_raise_error (g, "get_state");
1515 ocaml_guestfs_set_busy (value gv)
1520 guestfs_h *g = Guestfs_val (gv);
1522 caml_failwith ("set_busy: used handle after closing it");
1526 caml_enter_blocking_section ();
1527 r = guestfs_set_busy (g);
1528 caml_leave_blocking_section ();
1530 ocaml_guestfs_raise_error (g, "set_busy");
1537 ocaml_guestfs_set_ready (value gv)
1542 guestfs_h *g = Guestfs_val (gv);
1544 caml_failwith ("set_ready: used handle after closing it");
1548 caml_enter_blocking_section ();
1549 r = guestfs_set_ready (g);
1550 caml_leave_blocking_section ();
1552 ocaml_guestfs_raise_error (g, "set_ready");
1559 ocaml_guestfs_end_busy (value gv)
1564 guestfs_h *g = Guestfs_val (gv);
1566 caml_failwith ("end_busy: used handle after closing it");
1570 caml_enter_blocking_section ();
1571 r = guestfs_end_busy (g);
1572 caml_leave_blocking_section ();
1574 ocaml_guestfs_raise_error (g, "end_busy");
1581 ocaml_guestfs_set_memsize (value gv, value memsizev)
1583 CAMLparam2 (gv, memsizev);
1586 guestfs_h *g = Guestfs_val (gv);
1588 caml_failwith ("set_memsize: used handle after closing it");
1590 int memsize = Int_val (memsizev);
1593 caml_enter_blocking_section ();
1594 r = guestfs_set_memsize (g, memsize);
1595 caml_leave_blocking_section ();
1597 ocaml_guestfs_raise_error (g, "set_memsize");
1604 ocaml_guestfs_get_memsize (value gv)
1609 guestfs_h *g = Guestfs_val (gv);
1611 caml_failwith ("get_memsize: used handle after closing it");
1615 caml_enter_blocking_section ();
1616 r = guestfs_get_memsize (g);
1617 caml_leave_blocking_section ();
1619 ocaml_guestfs_raise_error (g, "get_memsize");
1626 ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
1628 CAMLparam3 (gv, devicev, mountpointv);
1631 guestfs_h *g = Guestfs_val (gv);
1633 caml_failwith ("mount: used handle after closing it");
1635 const char *device = String_val (devicev);
1636 const char *mountpoint = String_val (mountpointv);
1639 caml_enter_blocking_section ();
1640 r = guestfs_mount (g, device, mountpoint);
1641 caml_leave_blocking_section ();
1643 ocaml_guestfs_raise_error (g, "mount");
1650 ocaml_guestfs_sync (value gv)
1655 guestfs_h *g = Guestfs_val (gv);
1657 caml_failwith ("sync: used handle after closing it");
1661 caml_enter_blocking_section ();
1662 r = guestfs_sync (g);
1663 caml_leave_blocking_section ();
1665 ocaml_guestfs_raise_error (g, "sync");
1672 ocaml_guestfs_touch (value gv, value pathv)
1674 CAMLparam2 (gv, pathv);
1677 guestfs_h *g = Guestfs_val (gv);
1679 caml_failwith ("touch: used handle after closing it");
1681 const char *path = String_val (pathv);
1684 caml_enter_blocking_section ();
1685 r = guestfs_touch (g, path);
1686 caml_leave_blocking_section ();
1688 ocaml_guestfs_raise_error (g, "touch");
1695 ocaml_guestfs_cat (value gv, value pathv)
1697 CAMLparam2 (gv, pathv);
1700 guestfs_h *g = Guestfs_val (gv);
1702 caml_failwith ("cat: used handle after closing it");
1704 const char *path = String_val (pathv);
1707 caml_enter_blocking_section ();
1708 r = guestfs_cat (g, path);
1709 caml_leave_blocking_section ();
1711 ocaml_guestfs_raise_error (g, "cat");
1713 rv = caml_copy_string (r);
1719 ocaml_guestfs_ll (value gv, value directoryv)
1721 CAMLparam2 (gv, directoryv);
1724 guestfs_h *g = Guestfs_val (gv);
1726 caml_failwith ("ll: used handle after closing it");
1728 const char *directory = String_val (directoryv);
1731 caml_enter_blocking_section ();
1732 r = guestfs_ll (g, directory);
1733 caml_leave_blocking_section ();
1735 ocaml_guestfs_raise_error (g, "ll");
1737 rv = caml_copy_string (r);
1743 ocaml_guestfs_ls (value gv, value directoryv)
1745 CAMLparam2 (gv, directoryv);
1748 guestfs_h *g = Guestfs_val (gv);
1750 caml_failwith ("ls: used handle after closing it");
1752 const char *directory = String_val (directoryv);
1756 caml_enter_blocking_section ();
1757 r = guestfs_ls (g, directory);
1758 caml_leave_blocking_section ();
1760 ocaml_guestfs_raise_error (g, "ls");
1762 rv = caml_copy_string_array ((const char **) r);
1763 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1769 ocaml_guestfs_list_devices (value gv)
1774 guestfs_h *g = Guestfs_val (gv);
1776 caml_failwith ("list_devices: used handle after closing it");
1781 caml_enter_blocking_section ();
1782 r = guestfs_list_devices (g);
1783 caml_leave_blocking_section ();
1785 ocaml_guestfs_raise_error (g, "list_devices");
1787 rv = caml_copy_string_array ((const char **) r);
1788 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1794 ocaml_guestfs_list_partitions (value gv)
1799 guestfs_h *g = Guestfs_val (gv);
1801 caml_failwith ("list_partitions: used handle after closing it");
1806 caml_enter_blocking_section ();
1807 r = guestfs_list_partitions (g);
1808 caml_leave_blocking_section ();
1810 ocaml_guestfs_raise_error (g, "list_partitions");
1812 rv = caml_copy_string_array ((const char **) r);
1813 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1819 ocaml_guestfs_pvs (value gv)
1824 guestfs_h *g = Guestfs_val (gv);
1826 caml_failwith ("pvs: used handle after closing it");
1831 caml_enter_blocking_section ();
1832 r = guestfs_pvs (g);
1833 caml_leave_blocking_section ();
1835 ocaml_guestfs_raise_error (g, "pvs");
1837 rv = caml_copy_string_array ((const char **) r);
1838 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1844 ocaml_guestfs_vgs (value gv)
1849 guestfs_h *g = Guestfs_val (gv);
1851 caml_failwith ("vgs: used handle after closing it");
1856 caml_enter_blocking_section ();
1857 r = guestfs_vgs (g);
1858 caml_leave_blocking_section ();
1860 ocaml_guestfs_raise_error (g, "vgs");
1862 rv = caml_copy_string_array ((const char **) r);
1863 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1869 ocaml_guestfs_lvs (value gv)
1874 guestfs_h *g = Guestfs_val (gv);
1876 caml_failwith ("lvs: used handle after closing it");
1881 caml_enter_blocking_section ();
1882 r = guestfs_lvs (g);
1883 caml_leave_blocking_section ();
1885 ocaml_guestfs_raise_error (g, "lvs");
1887 rv = caml_copy_string_array ((const char **) r);
1888 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1894 ocaml_guestfs_pvs_full (value gv)
1899 guestfs_h *g = Guestfs_val (gv);
1901 caml_failwith ("pvs_full: used handle after closing it");
1903 struct guestfs_lvm_pv_list *r;
1905 caml_enter_blocking_section ();
1906 r = guestfs_pvs_full (g);
1907 caml_leave_blocking_section ();
1909 ocaml_guestfs_raise_error (g, "pvs_full");
1911 rv = copy_lvm_pv_list (r);
1912 guestfs_free_lvm_pv_list (r);
1917 ocaml_guestfs_vgs_full (value gv)
1922 guestfs_h *g = Guestfs_val (gv);
1924 caml_failwith ("vgs_full: used handle after closing it");
1926 struct guestfs_lvm_vg_list *r;
1928 caml_enter_blocking_section ();
1929 r = guestfs_vgs_full (g);
1930 caml_leave_blocking_section ();
1932 ocaml_guestfs_raise_error (g, "vgs_full");
1934 rv = copy_lvm_vg_list (r);
1935 guestfs_free_lvm_vg_list (r);
1940 ocaml_guestfs_lvs_full (value gv)
1945 guestfs_h *g = Guestfs_val (gv);
1947 caml_failwith ("lvs_full: used handle after closing it");
1949 struct guestfs_lvm_lv_list *r;
1951 caml_enter_blocking_section ();
1952 r = guestfs_lvs_full (g);
1953 caml_leave_blocking_section ();
1955 ocaml_guestfs_raise_error (g, "lvs_full");
1957 rv = copy_lvm_lv_list (r);
1958 guestfs_free_lvm_lv_list (r);
1963 ocaml_guestfs_read_lines (value gv, value pathv)
1965 CAMLparam2 (gv, pathv);
1968 guestfs_h *g = Guestfs_val (gv);
1970 caml_failwith ("read_lines: used handle after closing it");
1972 const char *path = String_val (pathv);
1976 caml_enter_blocking_section ();
1977 r = guestfs_read_lines (g, path);
1978 caml_leave_blocking_section ();
1980 ocaml_guestfs_raise_error (g, "read_lines");
1982 rv = caml_copy_string_array ((const char **) r);
1983 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1989 ocaml_guestfs_aug_init (value gv, value rootv, value flagsv)
1991 CAMLparam3 (gv, rootv, flagsv);
1994 guestfs_h *g = Guestfs_val (gv);
1996 caml_failwith ("aug_init: used handle after closing it");
1998 const char *root = String_val (rootv);
1999 int flags = Int_val (flagsv);
2002 caml_enter_blocking_section ();
2003 r = guestfs_aug_init (g, root, flags);
2004 caml_leave_blocking_section ();
2006 ocaml_guestfs_raise_error (g, "aug_init");
2013 ocaml_guestfs_aug_close (value gv)
2018 guestfs_h *g = Guestfs_val (gv);
2020 caml_failwith ("aug_close: used handle after closing it");
2024 caml_enter_blocking_section ();
2025 r = guestfs_aug_close (g);
2026 caml_leave_blocking_section ();
2028 ocaml_guestfs_raise_error (g, "aug_close");
2035 ocaml_guestfs_aug_defvar (value gv, value namev, value exprv)
2037 CAMLparam3 (gv, namev, exprv);
2040 guestfs_h *g = Guestfs_val (gv);
2042 caml_failwith ("aug_defvar: used handle after closing it");
2044 const char *name = String_val (namev);
2046 exprv != Val_int (0) ? String_val (Field (exprv, 0)) : NULL;
2049 caml_enter_blocking_section ();
2050 r = guestfs_aug_defvar (g, name, expr);
2051 caml_leave_blocking_section ();
2053 ocaml_guestfs_raise_error (g, "aug_defvar");
2060 ocaml_guestfs_aug_defnode (value gv, value namev, value exprv, value valv)
2062 CAMLparam4 (gv, namev, exprv, valv);
2065 guestfs_h *g = Guestfs_val (gv);
2067 caml_failwith ("aug_defnode: used handle after closing it");
2069 const char *name = String_val (namev);
2070 const char *expr = String_val (exprv);
2071 const char *val = String_val (valv);
2072 struct guestfs_int_bool *r;
2074 caml_enter_blocking_section ();
2075 r = guestfs_aug_defnode (g, name, expr, val);
2076 caml_leave_blocking_section ();
2078 ocaml_guestfs_raise_error (g, "aug_defnode");
2080 rv = caml_alloc (2, 0);
2081 Store_field (rv, 0, Val_int (r->i));
2082 Store_field (rv, 1, Val_bool (r->b));
2083 guestfs_free_int_bool (r);
2088 ocaml_guestfs_aug_get (value gv, value pathv)
2090 CAMLparam2 (gv, pathv);
2093 guestfs_h *g = Guestfs_val (gv);
2095 caml_failwith ("aug_get: used handle after closing it");
2097 const char *path = String_val (pathv);
2100 caml_enter_blocking_section ();
2101 r = guestfs_aug_get (g, path);
2102 caml_leave_blocking_section ();
2104 ocaml_guestfs_raise_error (g, "aug_get");
2106 rv = caml_copy_string (r);
2112 ocaml_guestfs_aug_set (value gv, value pathv, value valv)
2114 CAMLparam3 (gv, pathv, valv);
2117 guestfs_h *g = Guestfs_val (gv);
2119 caml_failwith ("aug_set: used handle after closing it");
2121 const char *path = String_val (pathv);
2122 const char *val = String_val (valv);
2125 caml_enter_blocking_section ();
2126 r = guestfs_aug_set (g, path, val);
2127 caml_leave_blocking_section ();
2129 ocaml_guestfs_raise_error (g, "aug_set");
2136 ocaml_guestfs_aug_insert (value gv, value pathv, value labelv, value beforev)
2138 CAMLparam4 (gv, pathv, labelv, beforev);
2141 guestfs_h *g = Guestfs_val (gv);
2143 caml_failwith ("aug_insert: used handle after closing it");
2145 const char *path = String_val (pathv);
2146 const char *label = String_val (labelv);
2147 int before = Bool_val (beforev);
2150 caml_enter_blocking_section ();
2151 r = guestfs_aug_insert (g, path, label, before);
2152 caml_leave_blocking_section ();
2154 ocaml_guestfs_raise_error (g, "aug_insert");
2161 ocaml_guestfs_aug_rm (value gv, value pathv)
2163 CAMLparam2 (gv, pathv);
2166 guestfs_h *g = Guestfs_val (gv);
2168 caml_failwith ("aug_rm: used handle after closing it");
2170 const char *path = String_val (pathv);
2173 caml_enter_blocking_section ();
2174 r = guestfs_aug_rm (g, path);
2175 caml_leave_blocking_section ();
2177 ocaml_guestfs_raise_error (g, "aug_rm");
2184 ocaml_guestfs_aug_mv (value gv, value srcv, value destv)
2186 CAMLparam3 (gv, srcv, destv);
2189 guestfs_h *g = Guestfs_val (gv);
2191 caml_failwith ("aug_mv: used handle after closing it");
2193 const char *src = String_val (srcv);
2194 const char *dest = String_val (destv);
2197 caml_enter_blocking_section ();
2198 r = guestfs_aug_mv (g, src, dest);
2199 caml_leave_blocking_section ();
2201 ocaml_guestfs_raise_error (g, "aug_mv");
2208 ocaml_guestfs_aug_match (value gv, value pathv)
2210 CAMLparam2 (gv, pathv);
2213 guestfs_h *g = Guestfs_val (gv);
2215 caml_failwith ("aug_match: used handle after closing it");
2217 const char *path = String_val (pathv);
2221 caml_enter_blocking_section ();
2222 r = guestfs_aug_match (g, path);
2223 caml_leave_blocking_section ();
2225 ocaml_guestfs_raise_error (g, "aug_match");
2227 rv = caml_copy_string_array ((const char **) r);
2228 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2234 ocaml_guestfs_aug_save (value gv)
2239 guestfs_h *g = Guestfs_val (gv);
2241 caml_failwith ("aug_save: used handle after closing it");
2245 caml_enter_blocking_section ();
2246 r = guestfs_aug_save (g);
2247 caml_leave_blocking_section ();
2249 ocaml_guestfs_raise_error (g, "aug_save");
2256 ocaml_guestfs_aug_load (value gv)
2261 guestfs_h *g = Guestfs_val (gv);
2263 caml_failwith ("aug_load: used handle after closing it");
2267 caml_enter_blocking_section ();
2268 r = guestfs_aug_load (g);
2269 caml_leave_blocking_section ();
2271 ocaml_guestfs_raise_error (g, "aug_load");
2278 ocaml_guestfs_aug_ls (value gv, value pathv)
2280 CAMLparam2 (gv, pathv);
2283 guestfs_h *g = Guestfs_val (gv);
2285 caml_failwith ("aug_ls: used handle after closing it");
2287 const char *path = String_val (pathv);
2291 caml_enter_blocking_section ();
2292 r = guestfs_aug_ls (g, path);
2293 caml_leave_blocking_section ();
2295 ocaml_guestfs_raise_error (g, "aug_ls");
2297 rv = caml_copy_string_array ((const char **) r);
2298 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2304 ocaml_guestfs_rm (value gv, value pathv)
2306 CAMLparam2 (gv, pathv);
2309 guestfs_h *g = Guestfs_val (gv);
2311 caml_failwith ("rm: used handle after closing it");
2313 const char *path = String_val (pathv);
2316 caml_enter_blocking_section ();
2317 r = guestfs_rm (g, path);
2318 caml_leave_blocking_section ();
2320 ocaml_guestfs_raise_error (g, "rm");
2327 ocaml_guestfs_rmdir (value gv, value pathv)
2329 CAMLparam2 (gv, pathv);
2332 guestfs_h *g = Guestfs_val (gv);
2334 caml_failwith ("rmdir: used handle after closing it");
2336 const char *path = String_val (pathv);
2339 caml_enter_blocking_section ();
2340 r = guestfs_rmdir (g, path);
2341 caml_leave_blocking_section ();
2343 ocaml_guestfs_raise_error (g, "rmdir");
2350 ocaml_guestfs_rm_rf (value gv, value pathv)
2352 CAMLparam2 (gv, pathv);
2355 guestfs_h *g = Guestfs_val (gv);
2357 caml_failwith ("rm_rf: used handle after closing it");
2359 const char *path = String_val (pathv);
2362 caml_enter_blocking_section ();
2363 r = guestfs_rm_rf (g, path);
2364 caml_leave_blocking_section ();
2366 ocaml_guestfs_raise_error (g, "rm_rf");
2373 ocaml_guestfs_mkdir (value gv, value pathv)
2375 CAMLparam2 (gv, pathv);
2378 guestfs_h *g = Guestfs_val (gv);
2380 caml_failwith ("mkdir: used handle after closing it");
2382 const char *path = String_val (pathv);
2385 caml_enter_blocking_section ();
2386 r = guestfs_mkdir (g, path);
2387 caml_leave_blocking_section ();
2389 ocaml_guestfs_raise_error (g, "mkdir");
2396 ocaml_guestfs_mkdir_p (value gv, value pathv)
2398 CAMLparam2 (gv, pathv);
2401 guestfs_h *g = Guestfs_val (gv);
2403 caml_failwith ("mkdir_p: used handle after closing it");
2405 const char *path = String_val (pathv);
2408 caml_enter_blocking_section ();
2409 r = guestfs_mkdir_p (g, path);
2410 caml_leave_blocking_section ();
2412 ocaml_guestfs_raise_error (g, "mkdir_p");
2419 ocaml_guestfs_chmod (value gv, value modev, value pathv)
2421 CAMLparam3 (gv, modev, pathv);
2424 guestfs_h *g = Guestfs_val (gv);
2426 caml_failwith ("chmod: used handle after closing it");
2428 int mode = Int_val (modev);
2429 const char *path = String_val (pathv);
2432 caml_enter_blocking_section ();
2433 r = guestfs_chmod (g, mode, path);
2434 caml_leave_blocking_section ();
2436 ocaml_guestfs_raise_error (g, "chmod");
2443 ocaml_guestfs_chown (value gv, value ownerv, value groupv, value pathv)
2445 CAMLparam4 (gv, ownerv, groupv, pathv);
2448 guestfs_h *g = Guestfs_val (gv);
2450 caml_failwith ("chown: used handle after closing it");
2452 int owner = Int_val (ownerv);
2453 int group = Int_val (groupv);
2454 const char *path = String_val (pathv);
2457 caml_enter_blocking_section ();
2458 r = guestfs_chown (g, owner, group, path);
2459 caml_leave_blocking_section ();
2461 ocaml_guestfs_raise_error (g, "chown");
2468 ocaml_guestfs_exists (value gv, value pathv)
2470 CAMLparam2 (gv, pathv);
2473 guestfs_h *g = Guestfs_val (gv);
2475 caml_failwith ("exists: used handle after closing it");
2477 const char *path = String_val (pathv);
2480 caml_enter_blocking_section ();
2481 r = guestfs_exists (g, path);
2482 caml_leave_blocking_section ();
2484 ocaml_guestfs_raise_error (g, "exists");
2491 ocaml_guestfs_is_file (value gv, value pathv)
2493 CAMLparam2 (gv, pathv);
2496 guestfs_h *g = Guestfs_val (gv);
2498 caml_failwith ("is_file: used handle after closing it");
2500 const char *path = String_val (pathv);
2503 caml_enter_blocking_section ();
2504 r = guestfs_is_file (g, path);
2505 caml_leave_blocking_section ();
2507 ocaml_guestfs_raise_error (g, "is_file");
2514 ocaml_guestfs_is_dir (value gv, value pathv)
2516 CAMLparam2 (gv, pathv);
2519 guestfs_h *g = Guestfs_val (gv);
2521 caml_failwith ("is_dir: used handle after closing it");
2523 const char *path = String_val (pathv);
2526 caml_enter_blocking_section ();
2527 r = guestfs_is_dir (g, path);
2528 caml_leave_blocking_section ();
2530 ocaml_guestfs_raise_error (g, "is_dir");
2537 ocaml_guestfs_pvcreate (value gv, value devicev)
2539 CAMLparam2 (gv, devicev);
2542 guestfs_h *g = Guestfs_val (gv);
2544 caml_failwith ("pvcreate: used handle after closing it");
2546 const char *device = String_val (devicev);
2549 caml_enter_blocking_section ();
2550 r = guestfs_pvcreate (g, device);
2551 caml_leave_blocking_section ();
2553 ocaml_guestfs_raise_error (g, "pvcreate");
2560 ocaml_guestfs_vgcreate (value gv, value volgroupv, value physvolsv)
2562 CAMLparam3 (gv, volgroupv, physvolsv);
2565 guestfs_h *g = Guestfs_val (gv);
2567 caml_failwith ("vgcreate: used handle after closing it");
2569 const char *volgroup = String_val (volgroupv);
2570 char **physvols = ocaml_guestfs_strings_val (g, physvolsv);
2573 caml_enter_blocking_section ();
2574 r = guestfs_vgcreate (g, volgroup, physvols);
2575 caml_leave_blocking_section ();
2576 ocaml_guestfs_free_strings (physvols);
2578 ocaml_guestfs_raise_error (g, "vgcreate");
2585 ocaml_guestfs_lvcreate (value gv, value logvolv, value volgroupv, value mbytesv)
2587 CAMLparam4 (gv, logvolv, volgroupv, mbytesv);
2590 guestfs_h *g = Guestfs_val (gv);
2592 caml_failwith ("lvcreate: used handle after closing it");
2594 const char *logvol = String_val (logvolv);
2595 const char *volgroup = String_val (volgroupv);
2596 int mbytes = Int_val (mbytesv);
2599 caml_enter_blocking_section ();
2600 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
2601 caml_leave_blocking_section ();
2603 ocaml_guestfs_raise_error (g, "lvcreate");
2610 ocaml_guestfs_mkfs (value gv, value fstypev, value devicev)
2612 CAMLparam3 (gv, fstypev, devicev);
2615 guestfs_h *g = Guestfs_val (gv);
2617 caml_failwith ("mkfs: used handle after closing it");
2619 const char *fstype = String_val (fstypev);
2620 const char *device = String_val (devicev);
2623 caml_enter_blocking_section ();
2624 r = guestfs_mkfs (g, fstype, device);
2625 caml_leave_blocking_section ();
2627 ocaml_guestfs_raise_error (g, "mkfs");
2634 ocaml_guestfs_sfdisk (value gv, value devicev, value cylsv, value headsv, value sectorsv, value linesv)
2636 CAMLparam5 (gv, devicev, cylsv, headsv, sectorsv);
2637 CAMLxparam1 (linesv);
2640 guestfs_h *g = Guestfs_val (gv);
2642 caml_failwith ("sfdisk: used handle after closing it");
2644 const char *device = String_val (devicev);
2645 int cyls = Int_val (cylsv);
2646 int heads = Int_val (headsv);
2647 int sectors = Int_val (sectorsv);
2648 char **lines = ocaml_guestfs_strings_val (g, linesv);
2651 caml_enter_blocking_section ();
2652 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
2653 caml_leave_blocking_section ();
2654 ocaml_guestfs_free_strings (lines);
2656 ocaml_guestfs_raise_error (g, "sfdisk");
2663 ocaml_guestfs_sfdisk_byte (value *argv, int argn)
2665 return ocaml_guestfs_sfdisk (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4]);
2669 ocaml_guestfs_write_file (value gv, value pathv, value contentv, value sizev)
2671 CAMLparam4 (gv, pathv, contentv, sizev);
2674 guestfs_h *g = Guestfs_val (gv);
2676 caml_failwith ("write_file: used handle after closing it");
2678 const char *path = String_val (pathv);
2679 const char *content = String_val (contentv);
2680 int size = Int_val (sizev);
2683 caml_enter_blocking_section ();
2684 r = guestfs_write_file (g, path, content, size);
2685 caml_leave_blocking_section ();
2687 ocaml_guestfs_raise_error (g, "write_file");
2694 ocaml_guestfs_umount (value gv, value pathordevicev)
2696 CAMLparam2 (gv, pathordevicev);
2699 guestfs_h *g = Guestfs_val (gv);
2701 caml_failwith ("umount: used handle after closing it");
2703 const char *pathordevice = String_val (pathordevicev);
2706 caml_enter_blocking_section ();
2707 r = guestfs_umount (g, pathordevice);
2708 caml_leave_blocking_section ();
2710 ocaml_guestfs_raise_error (g, "umount");
2717 ocaml_guestfs_mounts (value gv)
2722 guestfs_h *g = Guestfs_val (gv);
2724 caml_failwith ("mounts: used handle after closing it");
2729 caml_enter_blocking_section ();
2730 r = guestfs_mounts (g);
2731 caml_leave_blocking_section ();
2733 ocaml_guestfs_raise_error (g, "mounts");
2735 rv = caml_copy_string_array ((const char **) r);
2736 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2742 ocaml_guestfs_umount_all (value gv)
2747 guestfs_h *g = Guestfs_val (gv);
2749 caml_failwith ("umount_all: used handle after closing it");
2753 caml_enter_blocking_section ();
2754 r = guestfs_umount_all (g);
2755 caml_leave_blocking_section ();
2757 ocaml_guestfs_raise_error (g, "umount_all");
2764 ocaml_guestfs_lvm_remove_all (value gv)
2769 guestfs_h *g = Guestfs_val (gv);
2771 caml_failwith ("lvm_remove_all: used handle after closing it");
2775 caml_enter_blocking_section ();
2776 r = guestfs_lvm_remove_all (g);
2777 caml_leave_blocking_section ();
2779 ocaml_guestfs_raise_error (g, "lvm_remove_all");
2786 ocaml_guestfs_file (value gv, value pathv)
2788 CAMLparam2 (gv, pathv);
2791 guestfs_h *g = Guestfs_val (gv);
2793 caml_failwith ("file: used handle after closing it");
2795 const char *path = String_val (pathv);
2798 caml_enter_blocking_section ();
2799 r = guestfs_file (g, path);
2800 caml_leave_blocking_section ();
2802 ocaml_guestfs_raise_error (g, "file");
2804 rv = caml_copy_string (r);
2810 ocaml_guestfs_command (value gv, value argumentsv)
2812 CAMLparam2 (gv, argumentsv);
2815 guestfs_h *g = Guestfs_val (gv);
2817 caml_failwith ("command: used handle after closing it");
2819 char **arguments = ocaml_guestfs_strings_val (g, argumentsv);
2822 caml_enter_blocking_section ();
2823 r = guestfs_command (g, arguments);
2824 caml_leave_blocking_section ();
2825 ocaml_guestfs_free_strings (arguments);
2827 ocaml_guestfs_raise_error (g, "command");
2829 rv = caml_copy_string (r);
2835 ocaml_guestfs_command_lines (value gv, value argumentsv)
2837 CAMLparam2 (gv, argumentsv);
2840 guestfs_h *g = Guestfs_val (gv);
2842 caml_failwith ("command_lines: used handle after closing it");
2844 char **arguments = ocaml_guestfs_strings_val (g, argumentsv);
2848 caml_enter_blocking_section ();
2849 r = guestfs_command_lines (g, arguments);
2850 caml_leave_blocking_section ();
2851 ocaml_guestfs_free_strings (arguments);
2853 ocaml_guestfs_raise_error (g, "command_lines");
2855 rv = caml_copy_string_array ((const char **) r);
2856 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2862 ocaml_guestfs_stat (value gv, value pathv)
2864 CAMLparam2 (gv, pathv);
2867 guestfs_h *g = Guestfs_val (gv);
2869 caml_failwith ("stat: used handle after closing it");
2871 const char *path = String_val (pathv);
2872 struct guestfs_stat *r;
2874 caml_enter_blocking_section ();
2875 r = guestfs_stat (g, path);
2876 caml_leave_blocking_section ();
2878 ocaml_guestfs_raise_error (g, "stat");
2886 ocaml_guestfs_lstat (value gv, value pathv)
2888 CAMLparam2 (gv, pathv);
2891 guestfs_h *g = Guestfs_val (gv);
2893 caml_failwith ("lstat: used handle after closing it");
2895 const char *path = String_val (pathv);
2896 struct guestfs_stat *r;
2898 caml_enter_blocking_section ();
2899 r = guestfs_lstat (g, path);
2900 caml_leave_blocking_section ();
2902 ocaml_guestfs_raise_error (g, "lstat");
2910 ocaml_guestfs_statvfs (value gv, value pathv)
2912 CAMLparam2 (gv, pathv);
2915 guestfs_h *g = Guestfs_val (gv);
2917 caml_failwith ("statvfs: used handle after closing it");
2919 const char *path = String_val (pathv);
2920 struct guestfs_statvfs *r;
2922 caml_enter_blocking_section ();
2923 r = guestfs_statvfs (g, path);
2924 caml_leave_blocking_section ();
2926 ocaml_guestfs_raise_error (g, "statvfs");
2928 rv = copy_statvfs (r);
2934 ocaml_guestfs_tune2fs_l (value gv, value devicev)
2936 CAMLparam2 (gv, devicev);
2939 guestfs_h *g = Guestfs_val (gv);
2941 caml_failwith ("tune2fs_l: used handle after closing it");
2943 const char *device = String_val (devicev);
2947 caml_enter_blocking_section ();
2948 r = guestfs_tune2fs_l (g, device);
2949 caml_leave_blocking_section ();
2951 ocaml_guestfs_raise_error (g, "tune2fs_l");
2953 rv = copy_table (r);
2954 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2960 ocaml_guestfs_blockdev_setro (value gv, value devicev)
2962 CAMLparam2 (gv, devicev);
2965 guestfs_h *g = Guestfs_val (gv);
2967 caml_failwith ("blockdev_setro: used handle after closing it");
2969 const char *device = String_val (devicev);
2972 caml_enter_blocking_section ();
2973 r = guestfs_blockdev_setro (g, device);
2974 caml_leave_blocking_section ();
2976 ocaml_guestfs_raise_error (g, "blockdev_setro");
2983 ocaml_guestfs_blockdev_setrw (value gv, value devicev)
2985 CAMLparam2 (gv, devicev);
2988 guestfs_h *g = Guestfs_val (gv);
2990 caml_failwith ("blockdev_setrw: used handle after closing it");
2992 const char *device = String_val (devicev);
2995 caml_enter_blocking_section ();
2996 r = guestfs_blockdev_setrw (g, device);
2997 caml_leave_blocking_section ();
2999 ocaml_guestfs_raise_error (g, "blockdev_setrw");
3006 ocaml_guestfs_blockdev_getro (value gv, value devicev)
3008 CAMLparam2 (gv, devicev);
3011 guestfs_h *g = Guestfs_val (gv);
3013 caml_failwith ("blockdev_getro: used handle after closing it");
3015 const char *device = String_val (devicev);
3018 caml_enter_blocking_section ();
3019 r = guestfs_blockdev_getro (g, device);
3020 caml_leave_blocking_section ();
3022 ocaml_guestfs_raise_error (g, "blockdev_getro");
3029 ocaml_guestfs_blockdev_getss (value gv, value devicev)
3031 CAMLparam2 (gv, devicev);
3034 guestfs_h *g = Guestfs_val (gv);
3036 caml_failwith ("blockdev_getss: used handle after closing it");
3038 const char *device = String_val (devicev);
3041 caml_enter_blocking_section ();
3042 r = guestfs_blockdev_getss (g, device);
3043 caml_leave_blocking_section ();
3045 ocaml_guestfs_raise_error (g, "blockdev_getss");
3052 ocaml_guestfs_blockdev_getbsz (value gv, value devicev)
3054 CAMLparam2 (gv, devicev);
3057 guestfs_h *g = Guestfs_val (gv);
3059 caml_failwith ("blockdev_getbsz: used handle after closing it");
3061 const char *device = String_val (devicev);
3064 caml_enter_blocking_section ();
3065 r = guestfs_blockdev_getbsz (g, device);
3066 caml_leave_blocking_section ();
3068 ocaml_guestfs_raise_error (g, "blockdev_getbsz");
3075 ocaml_guestfs_blockdev_setbsz (value gv, value devicev, value blocksizev)
3077 CAMLparam3 (gv, devicev, blocksizev);
3080 guestfs_h *g = Guestfs_val (gv);
3082 caml_failwith ("blockdev_setbsz: used handle after closing it");
3084 const char *device = String_val (devicev);
3085 int blocksize = Int_val (blocksizev);
3088 caml_enter_blocking_section ();
3089 r = guestfs_blockdev_setbsz (g, device, blocksize);
3090 caml_leave_blocking_section ();
3092 ocaml_guestfs_raise_error (g, "blockdev_setbsz");
3099 ocaml_guestfs_blockdev_getsz (value gv, value devicev)
3101 CAMLparam2 (gv, devicev);
3104 guestfs_h *g = Guestfs_val (gv);
3106 caml_failwith ("blockdev_getsz: used handle after closing it");
3108 const char *device = String_val (devicev);
3111 caml_enter_blocking_section ();
3112 r = guestfs_blockdev_getsz (g, device);
3113 caml_leave_blocking_section ();
3115 ocaml_guestfs_raise_error (g, "blockdev_getsz");
3117 rv = caml_copy_int64 (r);
3122 ocaml_guestfs_blockdev_getsize64 (value gv, value devicev)
3124 CAMLparam2 (gv, devicev);
3127 guestfs_h *g = Guestfs_val (gv);
3129 caml_failwith ("blockdev_getsize64: used handle after closing it");
3131 const char *device = String_val (devicev);
3134 caml_enter_blocking_section ();
3135 r = guestfs_blockdev_getsize64 (g, device);
3136 caml_leave_blocking_section ();
3138 ocaml_guestfs_raise_error (g, "blockdev_getsize64");
3140 rv = caml_copy_int64 (r);
3145 ocaml_guestfs_blockdev_flushbufs (value gv, value devicev)
3147 CAMLparam2 (gv, devicev);
3150 guestfs_h *g = Guestfs_val (gv);
3152 caml_failwith ("blockdev_flushbufs: used handle after closing it");
3154 const char *device = String_val (devicev);
3157 caml_enter_blocking_section ();
3158 r = guestfs_blockdev_flushbufs (g, device);
3159 caml_leave_blocking_section ();
3161 ocaml_guestfs_raise_error (g, "blockdev_flushbufs");
3168 ocaml_guestfs_blockdev_rereadpt (value gv, value devicev)
3170 CAMLparam2 (gv, devicev);
3173 guestfs_h *g = Guestfs_val (gv);
3175 caml_failwith ("blockdev_rereadpt: used handle after closing it");
3177 const char *device = String_val (devicev);
3180 caml_enter_blocking_section ();
3181 r = guestfs_blockdev_rereadpt (g, device);
3182 caml_leave_blocking_section ();
3184 ocaml_guestfs_raise_error (g, "blockdev_rereadpt");
3191 ocaml_guestfs_upload (value gv, value filenamev, value remotefilenamev)
3193 CAMLparam3 (gv, filenamev, remotefilenamev);
3196 guestfs_h *g = Guestfs_val (gv);
3198 caml_failwith ("upload: used handle after closing it");
3200 const char *filename = String_val (filenamev);
3201 const char *remotefilename = String_val (remotefilenamev);
3204 caml_enter_blocking_section ();
3205 r = guestfs_upload (g, filename, remotefilename);
3206 caml_leave_blocking_section ();
3208 ocaml_guestfs_raise_error (g, "upload");
3215 ocaml_guestfs_download (value gv, value remotefilenamev, value filenamev)
3217 CAMLparam3 (gv, remotefilenamev, filenamev);
3220 guestfs_h *g = Guestfs_val (gv);
3222 caml_failwith ("download: used handle after closing it");
3224 const char *remotefilename = String_val (remotefilenamev);
3225 const char *filename = String_val (filenamev);
3228 caml_enter_blocking_section ();
3229 r = guestfs_download (g, remotefilename, filename);
3230 caml_leave_blocking_section ();
3232 ocaml_guestfs_raise_error (g, "download");
3239 ocaml_guestfs_checksum (value gv, value csumtypev, value pathv)
3241 CAMLparam3 (gv, csumtypev, pathv);
3244 guestfs_h *g = Guestfs_val (gv);
3246 caml_failwith ("checksum: used handle after closing it");
3248 const char *csumtype = String_val (csumtypev);
3249 const char *path = String_val (pathv);
3252 caml_enter_blocking_section ();
3253 r = guestfs_checksum (g, csumtype, path);
3254 caml_leave_blocking_section ();
3256 ocaml_guestfs_raise_error (g, "checksum");
3258 rv = caml_copy_string (r);
3264 ocaml_guestfs_tar_in (value gv, value tarfilev, value directoryv)
3266 CAMLparam3 (gv, tarfilev, directoryv);
3269 guestfs_h *g = Guestfs_val (gv);
3271 caml_failwith ("tar_in: used handle after closing it");
3273 const char *tarfile = String_val (tarfilev);
3274 const char *directory = String_val (directoryv);
3277 caml_enter_blocking_section ();
3278 r = guestfs_tar_in (g, tarfile, directory);
3279 caml_leave_blocking_section ();
3281 ocaml_guestfs_raise_error (g, "tar_in");
3288 ocaml_guestfs_tar_out (value gv, value directoryv, value tarfilev)
3290 CAMLparam3 (gv, directoryv, tarfilev);
3293 guestfs_h *g = Guestfs_val (gv);
3295 caml_failwith ("tar_out: used handle after closing it");
3297 const char *directory = String_val (directoryv);
3298 const char *tarfile = String_val (tarfilev);
3301 caml_enter_blocking_section ();
3302 r = guestfs_tar_out (g, directory, tarfile);
3303 caml_leave_blocking_section ();
3305 ocaml_guestfs_raise_error (g, "tar_out");
3312 ocaml_guestfs_tgz_in (value gv, value tarballv, value directoryv)
3314 CAMLparam3 (gv, tarballv, directoryv);
3317 guestfs_h *g = Guestfs_val (gv);
3319 caml_failwith ("tgz_in: used handle after closing it");
3321 const char *tarball = String_val (tarballv);
3322 const char *directory = String_val (directoryv);
3325 caml_enter_blocking_section ();
3326 r = guestfs_tgz_in (g, tarball, directory);
3327 caml_leave_blocking_section ();
3329 ocaml_guestfs_raise_error (g, "tgz_in");
3336 ocaml_guestfs_tgz_out (value gv, value directoryv, value tarballv)
3338 CAMLparam3 (gv, directoryv, tarballv);
3341 guestfs_h *g = Guestfs_val (gv);
3343 caml_failwith ("tgz_out: used handle after closing it");
3345 const char *directory = String_val (directoryv);
3346 const char *tarball = String_val (tarballv);
3349 caml_enter_blocking_section ();
3350 r = guestfs_tgz_out (g, directory, tarball);
3351 caml_leave_blocking_section ();
3353 ocaml_guestfs_raise_error (g, "tgz_out");
3360 ocaml_guestfs_mount_ro (value gv, value devicev, value mountpointv)
3362 CAMLparam3 (gv, devicev, mountpointv);
3365 guestfs_h *g = Guestfs_val (gv);
3367 caml_failwith ("mount_ro: used handle after closing it");
3369 const char *device = String_val (devicev);
3370 const char *mountpoint = String_val (mountpointv);
3373 caml_enter_blocking_section ();
3374 r = guestfs_mount_ro (g, device, mountpoint);
3375 caml_leave_blocking_section ();
3377 ocaml_guestfs_raise_error (g, "mount_ro");
3384 ocaml_guestfs_mount_options (value gv, value optionsv, value devicev, value mountpointv)
3386 CAMLparam4 (gv, optionsv, devicev, mountpointv);
3389 guestfs_h *g = Guestfs_val (gv);
3391 caml_failwith ("mount_options: used handle after closing it");
3393 const char *options = String_val (optionsv);
3394 const char *device = String_val (devicev);
3395 const char *mountpoint = String_val (mountpointv);
3398 caml_enter_blocking_section ();
3399 r = guestfs_mount_options (g, options, device, mountpoint);
3400 caml_leave_blocking_section ();
3402 ocaml_guestfs_raise_error (g, "mount_options");
3409 ocaml_guestfs_mount_vfs (value gv, value optionsv, value vfstypev, value devicev, value mountpointv)
3411 CAMLparam5 (gv, optionsv, vfstypev, devicev, mountpointv);
3414 guestfs_h *g = Guestfs_val (gv);
3416 caml_failwith ("mount_vfs: used handle after closing it");
3418 const char *options = String_val (optionsv);
3419 const char *vfstype = String_val (vfstypev);
3420 const char *device = String_val (devicev);
3421 const char *mountpoint = String_val (mountpointv);
3424 caml_enter_blocking_section ();
3425 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
3426 caml_leave_blocking_section ();
3428 ocaml_guestfs_raise_error (g, "mount_vfs");
3435 ocaml_guestfs_debug (value gv, value subcmdv, value extraargsv)
3437 CAMLparam3 (gv, subcmdv, extraargsv);
3440 guestfs_h *g = Guestfs_val (gv);
3442 caml_failwith ("debug: used handle after closing it");
3444 const char *subcmd = String_val (subcmdv);
3445 char **extraargs = ocaml_guestfs_strings_val (g, extraargsv);
3448 caml_enter_blocking_section ();
3449 r = guestfs_debug (g, subcmd, extraargs);
3450 caml_leave_blocking_section ();
3451 ocaml_guestfs_free_strings (extraargs);
3453 ocaml_guestfs_raise_error (g, "debug");
3455 rv = caml_copy_string (r);
3461 ocaml_guestfs_lvremove (value gv, value devicev)
3463 CAMLparam2 (gv, devicev);
3466 guestfs_h *g = Guestfs_val (gv);
3468 caml_failwith ("lvremove: used handle after closing it");
3470 const char *device = String_val (devicev);
3473 caml_enter_blocking_section ();
3474 r = guestfs_lvremove (g, device);
3475 caml_leave_blocking_section ();
3477 ocaml_guestfs_raise_error (g, "lvremove");
3484 ocaml_guestfs_vgremove (value gv, value vgnamev)
3486 CAMLparam2 (gv, vgnamev);
3489 guestfs_h *g = Guestfs_val (gv);
3491 caml_failwith ("vgremove: used handle after closing it");
3493 const char *vgname = String_val (vgnamev);
3496 caml_enter_blocking_section ();
3497 r = guestfs_vgremove (g, vgname);
3498 caml_leave_blocking_section ();
3500 ocaml_guestfs_raise_error (g, "vgremove");
3507 ocaml_guestfs_pvremove (value gv, value devicev)
3509 CAMLparam2 (gv, devicev);
3512 guestfs_h *g = Guestfs_val (gv);
3514 caml_failwith ("pvremove: used handle after closing it");
3516 const char *device = String_val (devicev);
3519 caml_enter_blocking_section ();
3520 r = guestfs_pvremove (g, device);
3521 caml_leave_blocking_section ();
3523 ocaml_guestfs_raise_error (g, "pvremove");
3530 ocaml_guestfs_set_e2label (value gv, value devicev, value labelv)
3532 CAMLparam3 (gv, devicev, labelv);
3535 guestfs_h *g = Guestfs_val (gv);
3537 caml_failwith ("set_e2label: used handle after closing it");
3539 const char *device = String_val (devicev);
3540 const char *label = String_val (labelv);
3543 caml_enter_blocking_section ();
3544 r = guestfs_set_e2label (g, device, label);
3545 caml_leave_blocking_section ();
3547 ocaml_guestfs_raise_error (g, "set_e2label");
3554 ocaml_guestfs_get_e2label (value gv, value devicev)
3556 CAMLparam2 (gv, devicev);
3559 guestfs_h *g = Guestfs_val (gv);
3561 caml_failwith ("get_e2label: used handle after closing it");
3563 const char *device = String_val (devicev);
3566 caml_enter_blocking_section ();
3567 r = guestfs_get_e2label (g, device);
3568 caml_leave_blocking_section ();
3570 ocaml_guestfs_raise_error (g, "get_e2label");
3572 rv = caml_copy_string (r);
3578 ocaml_guestfs_set_e2uuid (value gv, value devicev, value uuidv)
3580 CAMLparam3 (gv, devicev, uuidv);
3583 guestfs_h *g = Guestfs_val (gv);
3585 caml_failwith ("set_e2uuid: used handle after closing it");
3587 const char *device = String_val (devicev);
3588 const char *uuid = String_val (uuidv);
3591 caml_enter_blocking_section ();
3592 r = guestfs_set_e2uuid (g, device, uuid);
3593 caml_leave_blocking_section ();
3595 ocaml_guestfs_raise_error (g, "set_e2uuid");
3602 ocaml_guestfs_get_e2uuid (value gv, value devicev)
3604 CAMLparam2 (gv, devicev);
3607 guestfs_h *g = Guestfs_val (gv);
3609 caml_failwith ("get_e2uuid: used handle after closing it");
3611 const char *device = String_val (devicev);
3614 caml_enter_blocking_section ();
3615 r = guestfs_get_e2uuid (g, device);
3616 caml_leave_blocking_section ();
3618 ocaml_guestfs_raise_error (g, "get_e2uuid");
3620 rv = caml_copy_string (r);
3626 ocaml_guestfs_fsck (value gv, value fstypev, value devicev)
3628 CAMLparam3 (gv, fstypev, devicev);
3631 guestfs_h *g = Guestfs_val (gv);
3633 caml_failwith ("fsck: used handle after closing it");
3635 const char *fstype = String_val (fstypev);
3636 const char *device = String_val (devicev);
3639 caml_enter_blocking_section ();
3640 r = guestfs_fsck (g, fstype, device);
3641 caml_leave_blocking_section ();
3643 ocaml_guestfs_raise_error (g, "fsck");
3650 ocaml_guestfs_zero (value gv, value devicev)
3652 CAMLparam2 (gv, devicev);
3655 guestfs_h *g = Guestfs_val (gv);
3657 caml_failwith ("zero: used handle after closing it");
3659 const char *device = String_val (devicev);
3662 caml_enter_blocking_section ();
3663 r = guestfs_zero (g, device);
3664 caml_leave_blocking_section ();
3666 ocaml_guestfs_raise_error (g, "zero");
3673 ocaml_guestfs_grub_install (value gv, value rootv, value devicev)
3675 CAMLparam3 (gv, rootv, devicev);
3678 guestfs_h *g = Guestfs_val (gv);
3680 caml_failwith ("grub_install: used handle after closing it");
3682 const char *root = String_val (rootv);
3683 const char *device = String_val (devicev);
3686 caml_enter_blocking_section ();
3687 r = guestfs_grub_install (g, root, device);
3688 caml_leave_blocking_section ();
3690 ocaml_guestfs_raise_error (g, "grub_install");
3697 ocaml_guestfs_cp (value gv, value srcv, value destv)
3699 CAMLparam3 (gv, srcv, destv);
3702 guestfs_h *g = Guestfs_val (gv);
3704 caml_failwith ("cp: used handle after closing it");
3706 const char *src = String_val (srcv);
3707 const char *dest = String_val (destv);
3710 caml_enter_blocking_section ();
3711 r = guestfs_cp (g, src, dest);
3712 caml_leave_blocking_section ();
3714 ocaml_guestfs_raise_error (g, "cp");
3721 ocaml_guestfs_cp_a (value gv, value srcv, value destv)
3723 CAMLparam3 (gv, srcv, destv);
3726 guestfs_h *g = Guestfs_val (gv);
3728 caml_failwith ("cp_a: used handle after closing it");
3730 const char *src = String_val (srcv);
3731 const char *dest = String_val (destv);
3734 caml_enter_blocking_section ();
3735 r = guestfs_cp_a (g, src, dest);
3736 caml_leave_blocking_section ();
3738 ocaml_guestfs_raise_error (g, "cp_a");
3745 ocaml_guestfs_mv (value gv, value srcv, value destv)
3747 CAMLparam3 (gv, srcv, destv);
3750 guestfs_h *g = Guestfs_val (gv);
3752 caml_failwith ("mv: used handle after closing it");
3754 const char *src = String_val (srcv);
3755 const char *dest = String_val (destv);
3758 caml_enter_blocking_section ();
3759 r = guestfs_mv (g, src, dest);
3760 caml_leave_blocking_section ();
3762 ocaml_guestfs_raise_error (g, "mv");
3769 ocaml_guestfs_drop_caches (value gv, value whattodropv)
3771 CAMLparam2 (gv, whattodropv);
3774 guestfs_h *g = Guestfs_val (gv);
3776 caml_failwith ("drop_caches: used handle after closing it");
3778 int whattodrop = Int_val (whattodropv);
3781 caml_enter_blocking_section ();
3782 r = guestfs_drop_caches (g, whattodrop);
3783 caml_leave_blocking_section ();
3785 ocaml_guestfs_raise_error (g, "drop_caches");
3792 ocaml_guestfs_dmesg (value gv)
3797 guestfs_h *g = Guestfs_val (gv);
3799 caml_failwith ("dmesg: used handle after closing it");
3803 caml_enter_blocking_section ();
3804 r = guestfs_dmesg (g);
3805 caml_leave_blocking_section ();
3807 ocaml_guestfs_raise_error (g, "dmesg");
3809 rv = caml_copy_string (r);
3815 ocaml_guestfs_ping_daemon (value gv)
3820 guestfs_h *g = Guestfs_val (gv);
3822 caml_failwith ("ping_daemon: used handle after closing it");
3826 caml_enter_blocking_section ();
3827 r = guestfs_ping_daemon (g);
3828 caml_leave_blocking_section ();
3830 ocaml_guestfs_raise_error (g, "ping_daemon");
3837 ocaml_guestfs_equal (value gv, value file1v, value file2v)
3839 CAMLparam3 (gv, file1v, file2v);
3842 guestfs_h *g = Guestfs_val (gv);
3844 caml_failwith ("equal: used handle after closing it");
3846 const char *file1 = String_val (file1v);
3847 const char *file2 = String_val (file2v);
3850 caml_enter_blocking_section ();
3851 r = guestfs_equal (g, file1, file2);
3852 caml_leave_blocking_section ();
3854 ocaml_guestfs_raise_error (g, "equal");
3861 ocaml_guestfs_strings (value gv, value pathv)
3863 CAMLparam2 (gv, pathv);
3866 guestfs_h *g = Guestfs_val (gv);
3868 caml_failwith ("strings: used handle after closing it");
3870 const char *path = String_val (pathv);
3874 caml_enter_blocking_section ();
3875 r = guestfs_strings (g, path);
3876 caml_leave_blocking_section ();
3878 ocaml_guestfs_raise_error (g, "strings");
3880 rv = caml_copy_string_array ((const char **) r);
3881 for (i = 0; r[i] != NULL; ++i) free (r[i]);
3887 ocaml_guestfs_strings_e (value gv, value encodingv, value pathv)
3889 CAMLparam3 (gv, encodingv, pathv);
3892 guestfs_h *g = Guestfs_val (gv);
3894 caml_failwith ("strings_e: used handle after closing it");
3896 const char *encoding = String_val (encodingv);
3897 const char *path = String_val (pathv);
3901 caml_enter_blocking_section ();
3902 r = guestfs_strings_e (g, encoding, path);
3903 caml_leave_blocking_section ();
3905 ocaml_guestfs_raise_error (g, "strings_e");
3907 rv = caml_copy_string_array ((const char **) r);
3908 for (i = 0; r[i] != NULL; ++i) free (r[i]);
3914 ocaml_guestfs_hexdump (value gv, value pathv)
3916 CAMLparam2 (gv, pathv);
3919 guestfs_h *g = Guestfs_val (gv);
3921 caml_failwith ("hexdump: used handle after closing it");
3923 const char *path = String_val (pathv);
3926 caml_enter_blocking_section ();
3927 r = guestfs_hexdump (g, path);
3928 caml_leave_blocking_section ();
3930 ocaml_guestfs_raise_error (g, "hexdump");
3932 rv = caml_copy_string (r);
3938 ocaml_guestfs_zerofree (value gv, value devicev)
3940 CAMLparam2 (gv, devicev);
3943 guestfs_h *g = Guestfs_val (gv);
3945 caml_failwith ("zerofree: used handle after closing it");
3947 const char *device = String_val (devicev);
3950 caml_enter_blocking_section ();
3951 r = guestfs_zerofree (g, device);
3952 caml_leave_blocking_section ();
3954 ocaml_guestfs_raise_error (g, "zerofree");
3961 ocaml_guestfs_pvresize (value gv, value devicev)
3963 CAMLparam2 (gv, devicev);
3966 guestfs_h *g = Guestfs_val (gv);
3968 caml_failwith ("pvresize: used handle after closing it");
3970 const char *device = String_val (devicev);
3973 caml_enter_blocking_section ();
3974 r = guestfs_pvresize (g, device);
3975 caml_leave_blocking_section ();
3977 ocaml_guestfs_raise_error (g, "pvresize");
3984 ocaml_guestfs_sfdisk_N (value gv, value devicev, value partnumv, value cylsv, value headsv, value sectorsv, value linev)
3986 CAMLparam5 (gv, devicev, partnumv, cylsv, headsv);
3987 CAMLxparam2 (sectorsv, linev);
3990 guestfs_h *g = Guestfs_val (gv);
3992 caml_failwith ("sfdisk_N: used handle after closing it");
3994 const char *device = String_val (devicev);
3995 int partnum = Int_val (partnumv);
3996 int cyls = Int_val (cylsv);
3997 int heads = Int_val (headsv);
3998 int sectors = Int_val (sectorsv);
3999 const char *line = String_val (linev);
4002 caml_enter_blocking_section ();
4003 r = guestfs_sfdisk_N (g, device, partnum, cyls, heads, sectors, line);
4004 caml_leave_blocking_section ();
4006 ocaml_guestfs_raise_error (g, "sfdisk_N");
4013 ocaml_guestfs_sfdisk_N_byte (value *argv, int argn)
4015 return ocaml_guestfs_sfdisk_N (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
4019 ocaml_guestfs_sfdisk_l (value gv, value devicev)
4021 CAMLparam2 (gv, devicev);
4024 guestfs_h *g = Guestfs_val (gv);
4026 caml_failwith ("sfdisk_l: used handle after closing it");
4028 const char *device = String_val (devicev);
4031 caml_enter_blocking_section ();
4032 r = guestfs_sfdisk_l (g, device);
4033 caml_leave_blocking_section ();
4035 ocaml_guestfs_raise_error (g, "sfdisk_l");
4037 rv = caml_copy_string (r);
4043 ocaml_guestfs_sfdisk_kernel_geometry (value gv, value devicev)
4045 CAMLparam2 (gv, devicev);
4048 guestfs_h *g = Guestfs_val (gv);
4050 caml_failwith ("sfdisk_kernel_geometry: used handle after closing it");
4052 const char *device = String_val (devicev);
4055 caml_enter_blocking_section ();
4056 r = guestfs_sfdisk_kernel_geometry (g, device);
4057 caml_leave_blocking_section ();
4059 ocaml_guestfs_raise_error (g, "sfdisk_kernel_geometry");
4061 rv = caml_copy_string (r);
4067 ocaml_guestfs_sfdisk_disk_geometry (value gv, value devicev)
4069 CAMLparam2 (gv, devicev);
4072 guestfs_h *g = Guestfs_val (gv);
4074 caml_failwith ("sfdisk_disk_geometry: used handle after closing it");
4076 const char *device = String_val (devicev);
4079 caml_enter_blocking_section ();
4080 r = guestfs_sfdisk_disk_geometry (g, device);
4081 caml_leave_blocking_section ();
4083 ocaml_guestfs_raise_error (g, "sfdisk_disk_geometry");
4085 rv = caml_copy_string (r);
4091 ocaml_guestfs_vg_activate_all (value gv, value activatev)
4093 CAMLparam2 (gv, activatev);
4096 guestfs_h *g = Guestfs_val (gv);
4098 caml_failwith ("vg_activate_all: used handle after closing it");
4100 int activate = Bool_val (activatev);
4103 caml_enter_blocking_section ();
4104 r = guestfs_vg_activate_all (g, activate);
4105 caml_leave_blocking_section ();
4107 ocaml_guestfs_raise_error (g, "vg_activate_all");
4114 ocaml_guestfs_vg_activate (value gv, value activatev, value volgroupsv)
4116 CAMLparam3 (gv, activatev, volgroupsv);
4119 guestfs_h *g = Guestfs_val (gv);
4121 caml_failwith ("vg_activate: used handle after closing it");
4123 int activate = Bool_val (activatev);
4124 char **volgroups = ocaml_guestfs_strings_val (g, volgroupsv);
4127 caml_enter_blocking_section ();
4128 r = guestfs_vg_activate (g, activate, volgroups);
4129 caml_leave_blocking_section ();
4130 ocaml_guestfs_free_strings (volgroups);
4132 ocaml_guestfs_raise_error (g, "vg_activate");
4139 ocaml_guestfs_lvresize (value gv, value devicev, value mbytesv)
4141 CAMLparam3 (gv, devicev, mbytesv);
4144 guestfs_h *g = Guestfs_val (gv);
4146 caml_failwith ("lvresize: used handle after closing it");
4148 const char *device = String_val (devicev);
4149 int mbytes = Int_val (mbytesv);
4152 caml_enter_blocking_section ();
4153 r = guestfs_lvresize (g, device, mbytes);
4154 caml_leave_blocking_section ();
4156 ocaml_guestfs_raise_error (g, "lvresize");
4163 ocaml_guestfs_resize2fs (value gv, value devicev)
4165 CAMLparam2 (gv, devicev);
4168 guestfs_h *g = Guestfs_val (gv);
4170 caml_failwith ("resize2fs: used handle after closing it");
4172 const char *device = String_val (devicev);
4175 caml_enter_blocking_section ();
4176 r = guestfs_resize2fs (g, device);
4177 caml_leave_blocking_section ();
4179 ocaml_guestfs_raise_error (g, "resize2fs");
4186 ocaml_guestfs_find (value gv, value directoryv)
4188 CAMLparam2 (gv, directoryv);
4191 guestfs_h *g = Guestfs_val (gv);
4193 caml_failwith ("find: used handle after closing it");
4195 const char *directory = String_val (directoryv);
4199 caml_enter_blocking_section ();
4200 r = guestfs_find (g, directory);
4201 caml_leave_blocking_section ();
4203 ocaml_guestfs_raise_error (g, "find");
4205 rv = caml_copy_string_array ((const char **) r);
4206 for (i = 0; r[i] != NULL; ++i) free (r[i]);
4212 ocaml_guestfs_e2fsck_f (value gv, value devicev)
4214 CAMLparam2 (gv, devicev);
4217 guestfs_h *g = Guestfs_val (gv);
4219 caml_failwith ("e2fsck_f: used handle after closing it");
4221 const char *device = String_val (devicev);
4224 caml_enter_blocking_section ();
4225 r = guestfs_e2fsck_f (g, device);
4226 caml_leave_blocking_section ();
4228 ocaml_guestfs_raise_error (g, "e2fsck_f");
4235 ocaml_guestfs_sleep (value gv, value secsv)
4237 CAMLparam2 (gv, secsv);
4240 guestfs_h *g = Guestfs_val (gv);
4242 caml_failwith ("sleep: used handle after closing it");
4244 int secs = Int_val (secsv);
4247 caml_enter_blocking_section ();
4248 r = guestfs_sleep (g, secs);
4249 caml_leave_blocking_section ();
4251 ocaml_guestfs_raise_error (g, "sleep");
4258 ocaml_guestfs_ntfs_3g_probe (value gv, value rwv, value devicev)
4260 CAMLparam3 (gv, rwv, devicev);
4263 guestfs_h *g = Guestfs_val (gv);
4265 caml_failwith ("ntfs_3g_probe: used handle after closing it");
4267 int rw = Bool_val (rwv);
4268 const char *device = String_val (devicev);
4271 caml_enter_blocking_section ();
4272 r = guestfs_ntfs_3g_probe (g, rw, device);
4273 caml_leave_blocking_section ();
4275 ocaml_guestfs_raise_error (g, "ntfs_3g_probe");
4282 ocaml_guestfs_sh (value gv, value commandv)
4284 CAMLparam2 (gv, commandv);
4287 guestfs_h *g = Guestfs_val (gv);
4289 caml_failwith ("sh: used handle after closing it");
4291 const char *command = String_val (commandv);
4294 caml_enter_blocking_section ();
4295 r = guestfs_sh (g, command);
4296 caml_leave_blocking_section ();
4298 ocaml_guestfs_raise_error (g, "sh");
4300 rv = caml_copy_string (r);
4306 ocaml_guestfs_sh_lines (value gv, value commandv)
4308 CAMLparam2 (gv, commandv);
4311 guestfs_h *g = Guestfs_val (gv);
4313 caml_failwith ("sh_lines: used handle after closing it");
4315 const char *command = String_val (commandv);
4319 caml_enter_blocking_section ();
4320 r = guestfs_sh_lines (g, command);
4321 caml_leave_blocking_section ();
4323 ocaml_guestfs_raise_error (g, "sh_lines");
4325 rv = caml_copy_string_array ((const char **) r);
4326 for (i = 0; r[i] != NULL; ++i) free (r[i]);
4332 ocaml_guestfs_glob_expand (value gv, value patternv)
4334 CAMLparam2 (gv, patternv);
4337 guestfs_h *g = Guestfs_val (gv);
4339 caml_failwith ("glob_expand: used handle after closing it");
4341 const char *pattern = String_val (patternv);
4345 caml_enter_blocking_section ();
4346 r = guestfs_glob_expand (g, pattern);
4347 caml_leave_blocking_section ();
4349 ocaml_guestfs_raise_error (g, "glob_expand");
4351 rv = caml_copy_string_array ((const char **) r);
4352 for (i = 0; r[i] != NULL; ++i) free (r[i]);
4358 ocaml_guestfs_scrub_device (value gv, value devicev)
4360 CAMLparam2 (gv, devicev);
4363 guestfs_h *g = Guestfs_val (gv);
4365 caml_failwith ("scrub_device: used handle after closing it");
4367 const char *device = String_val (devicev);
4370 caml_enter_blocking_section ();
4371 r = guestfs_scrub_device (g, device);
4372 caml_leave_blocking_section ();
4374 ocaml_guestfs_raise_error (g, "scrub_device");
4381 ocaml_guestfs_scrub_file (value gv, value filev)
4383 CAMLparam2 (gv, filev);
4386 guestfs_h *g = Guestfs_val (gv);
4388 caml_failwith ("scrub_file: used handle after closing it");
4390 const char *file = String_val (filev);
4393 caml_enter_blocking_section ();
4394 r = guestfs_scrub_file (g, file);
4395 caml_leave_blocking_section ();
4397 ocaml_guestfs_raise_error (g, "scrub_file");
4404 ocaml_guestfs_scrub_freespace (value gv, value dirv)
4406 CAMLparam2 (gv, dirv);
4409 guestfs_h *g = Guestfs_val (gv);
4411 caml_failwith ("scrub_freespace: used handle after closing it");
4413 const char *dir = String_val (dirv);
4416 caml_enter_blocking_section ();
4417 r = guestfs_scrub_freespace (g, dir);
4418 caml_leave_blocking_section ();
4420 ocaml_guestfs_raise_error (g, "scrub_freespace");
4427 ocaml_guestfs_mkdtemp (value gv, value templatev)
4429 CAMLparam2 (gv, templatev);
4432 guestfs_h *g = Guestfs_val (gv);
4434 caml_failwith ("mkdtemp: used handle after closing it");
4436 const char *template = String_val (templatev);
4439 caml_enter_blocking_section ();
4440 r = guestfs_mkdtemp (g, template);
4441 caml_leave_blocking_section ();
4443 ocaml_guestfs_raise_error (g, "mkdtemp");
4445 rv = caml_copy_string (r);
4451 ocaml_guestfs_wc_l (value gv, value pathv)
4453 CAMLparam2 (gv, pathv);
4456 guestfs_h *g = Guestfs_val (gv);
4458 caml_failwith ("wc_l: used handle after closing it");
4460 const char *path = String_val (pathv);
4463 caml_enter_blocking_section ();
4464 r = guestfs_wc_l (g, path);
4465 caml_leave_blocking_section ();
4467 ocaml_guestfs_raise_error (g, "wc_l");
4474 ocaml_guestfs_wc_w (value gv, value pathv)
4476 CAMLparam2 (gv, pathv);
4479 guestfs_h *g = Guestfs_val (gv);
4481 caml_failwith ("wc_w: used handle after closing it");
4483 const char *path = String_val (pathv);
4486 caml_enter_blocking_section ();
4487 r = guestfs_wc_w (g, path);
4488 caml_leave_blocking_section ();
4490 ocaml_guestfs_raise_error (g, "wc_w");
4497 ocaml_guestfs_wc_c (value gv, value pathv)
4499 CAMLparam2 (gv, pathv);
4502 guestfs_h *g = Guestfs_val (gv);
4504 caml_failwith ("wc_c: used handle after closing it");
4506 const char *path = String_val (pathv);
4509 caml_enter_blocking_section ();
4510 r = guestfs_wc_c (g, path);
4511 caml_leave_blocking_section ();
4513 ocaml_guestfs_raise_error (g, "wc_c");
4520 ocaml_guestfs_head (value gv, value pathv)
4522 CAMLparam2 (gv, pathv);
4525 guestfs_h *g = Guestfs_val (gv);
4527 caml_failwith ("head: used handle after closing it");
4529 const char *path = String_val (pathv);
4533 caml_enter_blocking_section ();
4534 r = guestfs_head (g, path);
4535 caml_leave_blocking_section ();
4537 ocaml_guestfs_raise_error (g, "head");
4539 rv = caml_copy_string_array ((const char **) r);
4540 for (i = 0; r[i] != NULL; ++i) free (r[i]);
4546 ocaml_guestfs_head_n (value gv, value nrlinesv, value pathv)
4548 CAMLparam3 (gv, nrlinesv, pathv);
4551 guestfs_h *g = Guestfs_val (gv);
4553 caml_failwith ("head_n: used handle after closing it");
4555 int nrlines = Int_val (nrlinesv);
4556 const char *path = String_val (pathv);
4560 caml_enter_blocking_section ();
4561 r = guestfs_head_n (g, nrlines, path);
4562 caml_leave_blocking_section ();
4564 ocaml_guestfs_raise_error (g, "head_n");
4566 rv = caml_copy_string_array ((const char **) r);
4567 for (i = 0; r[i] != NULL; ++i) free (r[i]);
4573 ocaml_guestfs_tail (value gv, value pathv)
4575 CAMLparam2 (gv, pathv);
4578 guestfs_h *g = Guestfs_val (gv);
4580 caml_failwith ("tail: used handle after closing it");
4582 const char *path = String_val (pathv);
4586 caml_enter_blocking_section ();
4587 r = guestfs_tail (g, path);
4588 caml_leave_blocking_section ();
4590 ocaml_guestfs_raise_error (g, "tail");
4592 rv = caml_copy_string_array ((const char **) r);
4593 for (i = 0; r[i] != NULL; ++i) free (r[i]);
4599 ocaml_guestfs_tail_n (value gv, value nrlinesv, value pathv)
4601 CAMLparam3 (gv, nrlinesv, pathv);
4604 guestfs_h *g = Guestfs_val (gv);
4606 caml_failwith ("tail_n: used handle after closing it");
4608 int nrlines = Int_val (nrlinesv);
4609 const char *path = String_val (pathv);
4613 caml_enter_blocking_section ();
4614 r = guestfs_tail_n (g, nrlines, path);
4615 caml_leave_blocking_section ();
4617 ocaml_guestfs_raise_error (g, "tail_n");
4619 rv = caml_copy_string_array ((const char **) r);
4620 for (i = 0; r[i] != NULL; ++i) free (r[i]);
4626 ocaml_guestfs_df (value gv)
4631 guestfs_h *g = Guestfs_val (gv);
4633 caml_failwith ("df: used handle after closing it");
4637 caml_enter_blocking_section ();
4639 caml_leave_blocking_section ();
4641 ocaml_guestfs_raise_error (g, "df");
4643 rv = caml_copy_string (r);
4649 ocaml_guestfs_df_h (value gv)
4654 guestfs_h *g = Guestfs_val (gv);
4656 caml_failwith ("df_h: used handle after closing it");
4660 caml_enter_blocking_section ();
4661 r = guestfs_df_h (g);
4662 caml_leave_blocking_section ();
4664 ocaml_guestfs_raise_error (g, "df_h");
4666 rv = caml_copy_string (r);
4672 ocaml_guestfs_du (value gv, value pathv)
4674 CAMLparam2 (gv, pathv);
4677 guestfs_h *g = Guestfs_val (gv);
4679 caml_failwith ("du: used handle after closing it");
4681 const char *path = String_val (pathv);
4684 caml_enter_blocking_section ();
4685 r = guestfs_du (g, path);
4686 caml_leave_blocking_section ();
4688 ocaml_guestfs_raise_error (g, "du");
4690 rv = caml_copy_int64 (r);
4695 ocaml_guestfs_initrd_list (value gv, value pathv)
4697 CAMLparam2 (gv, pathv);
4700 guestfs_h *g = Guestfs_val (gv);
4702 caml_failwith ("initrd_list: used handle after closing it");
4704 const char *path = String_val (pathv);
4708 caml_enter_blocking_section ();
4709 r = guestfs_initrd_list (g, path);
4710 caml_leave_blocking_section ();
4712 ocaml_guestfs_raise_error (g, "initrd_list");
4714 rv = caml_copy_string_array ((const char **) r);
4715 for (i = 0; r[i] != NULL; ++i) free (r[i]);
4721 ocaml_guestfs_mount_loop (value gv, value filev, value mountpointv)
4723 CAMLparam3 (gv, filev, mountpointv);
4726 guestfs_h *g = Guestfs_val (gv);
4728 caml_failwith ("mount_loop: used handle after closing it");
4730 const char *file = String_val (filev);
4731 const char *mountpoint = String_val (mountpointv);
4734 caml_enter_blocking_section ();
4735 r = guestfs_mount_loop (g, file, mountpoint);
4736 caml_leave_blocking_section ();
4738 ocaml_guestfs_raise_error (g, "mount_loop");
4745 ocaml_guestfs_mkswap (value gv, value devicev)
4747 CAMLparam2 (gv, devicev);
4750 guestfs_h *g = Guestfs_val (gv);
4752 caml_failwith ("mkswap: used handle after closing it");
4754 const char *device = String_val (devicev);
4757 caml_enter_blocking_section ();
4758 r = guestfs_mkswap (g, device);
4759 caml_leave_blocking_section ();
4761 ocaml_guestfs_raise_error (g, "mkswap");
4768 ocaml_guestfs_mkswap_L (value gv, value labelv, value devicev)
4770 CAMLparam3 (gv, labelv, devicev);
4773 guestfs_h *g = Guestfs_val (gv);
4775 caml_failwith ("mkswap_L: used handle after closing it");
4777 const char *label = String_val (labelv);
4778 const char *device = String_val (devicev);
4781 caml_enter_blocking_section ();
4782 r = guestfs_mkswap_L (g, label, device);
4783 caml_leave_blocking_section ();
4785 ocaml_guestfs_raise_error (g, "mkswap_L");
4792 ocaml_guestfs_mkswap_U (value gv, value uuidv, value devicev)
4794 CAMLparam3 (gv, uuidv, devicev);
4797 guestfs_h *g = Guestfs_val (gv);
4799 caml_failwith ("mkswap_U: used handle after closing it");
4801 const char *uuid = String_val (uuidv);
4802 const char *device = String_val (devicev);
4805 caml_enter_blocking_section ();
4806 r = guestfs_mkswap_U (g, uuid, device);
4807 caml_leave_blocking_section ();
4809 ocaml_guestfs_raise_error (g, "mkswap_U");
4816 ocaml_guestfs_mknod (value gv, value modev, value devmajorv, value devminorv, value pathv)
4818 CAMLparam5 (gv, modev, devmajorv, devminorv, pathv);
4821 guestfs_h *g = Guestfs_val (gv);
4823 caml_failwith ("mknod: used handle after closing it");
4825 int mode = Int_val (modev);
4826 int devmajor = Int_val (devmajorv);
4827 int devminor = Int_val (devminorv);
4828 const char *path = String_val (pathv);
4831 caml_enter_blocking_section ();
4832 r = guestfs_mknod (g, mode, devmajor, devminor, path);
4833 caml_leave_blocking_section ();
4835 ocaml_guestfs_raise_error (g, "mknod");
4842 ocaml_guestfs_mkfifo (value gv, value modev, value pathv)
4844 CAMLparam3 (gv, modev, pathv);
4847 guestfs_h *g = Guestfs_val (gv);
4849 caml_failwith ("mkfifo: used handle after closing it");
4851 int mode = Int_val (modev);
4852 const char *path = String_val (pathv);
4855 caml_enter_blocking_section ();
4856 r = guestfs_mkfifo (g, mode, path);
4857 caml_leave_blocking_section ();
4859 ocaml_guestfs_raise_error (g, "mkfifo");
4866 ocaml_guestfs_mknod_b (value gv, value modev, value devmajorv, value devminorv, value pathv)
4868 CAMLparam5 (gv, modev, devmajorv, devminorv, pathv);
4871 guestfs_h *g = Guestfs_val (gv);
4873 caml_failwith ("mknod_b: used handle after closing it");
4875 int mode = Int_val (modev);
4876 int devmajor = Int_val (devmajorv);
4877 int devminor = Int_val (devminorv);
4878 const char *path = String_val (pathv);
4881 caml_enter_blocking_section ();
4882 r = guestfs_mknod_b (g, mode, devmajor, devminor, path);
4883 caml_leave_blocking_section ();
4885 ocaml_guestfs_raise_error (g, "mknod_b");
4892 ocaml_guestfs_mknod_c (value gv, value modev, value devmajorv, value devminorv, value pathv)
4894 CAMLparam5 (gv, modev, devmajorv, devminorv, pathv);
4897 guestfs_h *g = Guestfs_val (gv);
4899 caml_failwith ("mknod_c: used handle after closing it");
4901 int mode = Int_val (modev);
4902 int devmajor = Int_val (devmajorv);
4903 int devminor = Int_val (devminorv);
4904 const char *path = String_val (pathv);
4907 caml_enter_blocking_section ();
4908 r = guestfs_mknod_c (g, mode, devmajor, devminor, path);
4909 caml_leave_blocking_section ();
4911 ocaml_guestfs_raise_error (g, "mknod_c");
4918 ocaml_guestfs_umask (value gv, value maskv)
4920 CAMLparam2 (gv, maskv);
4923 guestfs_h *g = Guestfs_val (gv);
4925 caml_failwith ("umask: used handle after closing it");
4927 int mask = Int_val (maskv);
4930 caml_enter_blocking_section ();
4931 r = guestfs_umask (g, mask);
4932 caml_leave_blocking_section ();
4934 ocaml_guestfs_raise_error (g, "umask");
4941 ocaml_guestfs_readdir (value gv, value dirv)
4943 CAMLparam2 (gv, dirv);
4946 guestfs_h *g = Guestfs_val (gv);
4948 caml_failwith ("readdir: used handle after closing it");
4950 const char *dir = String_val (dirv);
4951 struct guestfs_dirent_list *r;
4953 caml_enter_blocking_section ();
4954 r = guestfs_readdir (g, dir);
4955 caml_leave_blocking_section ();
4957 ocaml_guestfs_raise_error (g, "readdir");
4959 rv = copy_dirent_list (r);
4960 guestfs_free_dirent_list (r);