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_test0 (value gv, value strv, value optstrv, value strlistv, value bv, value integerv, value fileinv, value fileoutv)
334 CAMLparam5 (gv, strv, optstrv, strlistv, bv);
335 CAMLxparam3 (integerv, fileinv, fileoutv);
338 guestfs_h *g = Guestfs_val (gv);
340 caml_failwith ("test0: used handle after closing it");
342 const char *str = String_val (strv);
344 optstrv != Val_int (0) ? String_val (Field (optstrv, 0)) : NULL;
345 char **strlist = ocaml_guestfs_strings_val (g, strlistv);
346 int b = Bool_val (bv);
347 int integer = Int_val (integerv);
348 const char *filein = String_val (fileinv);
349 const char *fileout = String_val (fileoutv);
352 caml_enter_blocking_section ();
353 r = guestfs_test0 (g, str, optstr, strlist, b, integer, filein, fileout);
354 caml_leave_blocking_section ();
355 ocaml_guestfs_free_strings (strlist);
357 ocaml_guestfs_raise_error (g, "test0");
364 ocaml_guestfs_test0_byte (value *argv, int argn)
366 return ocaml_guestfs_test0 (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
370 ocaml_guestfs_test0rint (value gv, value valv)
372 CAMLparam2 (gv, valv);
375 guestfs_h *g = Guestfs_val (gv);
377 caml_failwith ("test0rint: used handle after closing it");
379 const char *val = String_val (valv);
382 caml_enter_blocking_section ();
383 r = guestfs_test0rint (g, val);
384 caml_leave_blocking_section ();
386 ocaml_guestfs_raise_error (g, "test0rint");
393 ocaml_guestfs_test0rinterr (value gv)
398 guestfs_h *g = Guestfs_val (gv);
400 caml_failwith ("test0rinterr: used handle after closing it");
404 caml_enter_blocking_section ();
405 r = guestfs_test0rinterr (g);
406 caml_leave_blocking_section ();
408 ocaml_guestfs_raise_error (g, "test0rinterr");
415 ocaml_guestfs_test0rint64 (value gv, value valv)
417 CAMLparam2 (gv, valv);
420 guestfs_h *g = Guestfs_val (gv);
422 caml_failwith ("test0rint64: used handle after closing it");
424 const char *val = String_val (valv);
427 caml_enter_blocking_section ();
428 r = guestfs_test0rint64 (g, val);
429 caml_leave_blocking_section ();
431 ocaml_guestfs_raise_error (g, "test0rint64");
433 rv = caml_copy_int64 (r);
438 ocaml_guestfs_test0rint64err (value gv)
443 guestfs_h *g = Guestfs_val (gv);
445 caml_failwith ("test0rint64err: used handle after closing it");
449 caml_enter_blocking_section ();
450 r = guestfs_test0rint64err (g);
451 caml_leave_blocking_section ();
453 ocaml_guestfs_raise_error (g, "test0rint64err");
455 rv = caml_copy_int64 (r);
460 ocaml_guestfs_test0rbool (value gv, value valv)
462 CAMLparam2 (gv, valv);
465 guestfs_h *g = Guestfs_val (gv);
467 caml_failwith ("test0rbool: used handle after closing it");
469 const char *val = String_val (valv);
472 caml_enter_blocking_section ();
473 r = guestfs_test0rbool (g, val);
474 caml_leave_blocking_section ();
476 ocaml_guestfs_raise_error (g, "test0rbool");
483 ocaml_guestfs_test0rboolerr (value gv)
488 guestfs_h *g = Guestfs_val (gv);
490 caml_failwith ("test0rboolerr: used handle after closing it");
494 caml_enter_blocking_section ();
495 r = guestfs_test0rboolerr (g);
496 caml_leave_blocking_section ();
498 ocaml_guestfs_raise_error (g, "test0rboolerr");
505 ocaml_guestfs_test0rconststring (value gv, value valv)
507 CAMLparam2 (gv, valv);
510 guestfs_h *g = Guestfs_val (gv);
512 caml_failwith ("test0rconststring: used handle after closing it");
514 const char *val = String_val (valv);
517 caml_enter_blocking_section ();
518 r = guestfs_test0rconststring (g, val);
519 caml_leave_blocking_section ();
521 ocaml_guestfs_raise_error (g, "test0rconststring");
523 rv = caml_copy_string (r);
528 ocaml_guestfs_test0rconststringerr (value gv)
533 guestfs_h *g = Guestfs_val (gv);
535 caml_failwith ("test0rconststringerr: used handle after closing it");
539 caml_enter_blocking_section ();
540 r = guestfs_test0rconststringerr (g);
541 caml_leave_blocking_section ();
543 ocaml_guestfs_raise_error (g, "test0rconststringerr");
545 rv = caml_copy_string (r);
550 ocaml_guestfs_test0rstring (value gv, value valv)
552 CAMLparam2 (gv, valv);
555 guestfs_h *g = Guestfs_val (gv);
557 caml_failwith ("test0rstring: used handle after closing it");
559 const char *val = String_val (valv);
562 caml_enter_blocking_section ();
563 r = guestfs_test0rstring (g, val);
564 caml_leave_blocking_section ();
566 ocaml_guestfs_raise_error (g, "test0rstring");
568 rv = caml_copy_string (r);
574 ocaml_guestfs_test0rstringerr (value gv)
579 guestfs_h *g = Guestfs_val (gv);
581 caml_failwith ("test0rstringerr: used handle after closing it");
585 caml_enter_blocking_section ();
586 r = guestfs_test0rstringerr (g);
587 caml_leave_blocking_section ();
589 ocaml_guestfs_raise_error (g, "test0rstringerr");
591 rv = caml_copy_string (r);
597 ocaml_guestfs_test0rstringlist (value gv, value valv)
599 CAMLparam2 (gv, valv);
602 guestfs_h *g = Guestfs_val (gv);
604 caml_failwith ("test0rstringlist: used handle after closing it");
606 const char *val = String_val (valv);
610 caml_enter_blocking_section ();
611 r = guestfs_test0rstringlist (g, val);
612 caml_leave_blocking_section ();
614 ocaml_guestfs_raise_error (g, "test0rstringlist");
616 rv = caml_copy_string_array ((const char **) r);
617 for (i = 0; r[i] != NULL; ++i) free (r[i]);
623 ocaml_guestfs_test0rstringlisterr (value gv)
628 guestfs_h *g = Guestfs_val (gv);
630 caml_failwith ("test0rstringlisterr: used handle after closing it");
635 caml_enter_blocking_section ();
636 r = guestfs_test0rstringlisterr (g);
637 caml_leave_blocking_section ();
639 ocaml_guestfs_raise_error (g, "test0rstringlisterr");
641 rv = caml_copy_string_array ((const char **) r);
642 for (i = 0; r[i] != NULL; ++i) free (r[i]);
648 ocaml_guestfs_test0rintbool (value gv, value valv)
650 CAMLparam2 (gv, valv);
653 guestfs_h *g = Guestfs_val (gv);
655 caml_failwith ("test0rintbool: used handle after closing it");
657 const char *val = String_val (valv);
658 struct guestfs_int_bool *r;
660 caml_enter_blocking_section ();
661 r = guestfs_test0rintbool (g, val);
662 caml_leave_blocking_section ();
664 ocaml_guestfs_raise_error (g, "test0rintbool");
666 rv = caml_alloc (2, 0);
667 Store_field (rv, 0, Val_int (r->i));
668 Store_field (rv, 1, Val_bool (r->b));
669 guestfs_free_int_bool (r);
674 ocaml_guestfs_test0rintboolerr (value gv)
679 guestfs_h *g = Guestfs_val (gv);
681 caml_failwith ("test0rintboolerr: used handle after closing it");
683 struct guestfs_int_bool *r;
685 caml_enter_blocking_section ();
686 r = guestfs_test0rintboolerr (g);
687 caml_leave_blocking_section ();
689 ocaml_guestfs_raise_error (g, "test0rintboolerr");
691 rv = caml_alloc (2, 0);
692 Store_field (rv, 0, Val_int (r->i));
693 Store_field (rv, 1, Val_bool (r->b));
694 guestfs_free_int_bool (r);
699 ocaml_guestfs_test0rpvlist (value gv, value valv)
701 CAMLparam2 (gv, valv);
704 guestfs_h *g = Guestfs_val (gv);
706 caml_failwith ("test0rpvlist: used handle after closing it");
708 const char *val = String_val (valv);
709 struct guestfs_lvm_pv_list *r;
711 caml_enter_blocking_section ();
712 r = guestfs_test0rpvlist (g, val);
713 caml_leave_blocking_section ();
715 ocaml_guestfs_raise_error (g, "test0rpvlist");
717 rv = copy_lvm_pv_list (r);
718 guestfs_free_lvm_pv_list (r);
723 ocaml_guestfs_test0rpvlisterr (value gv)
728 guestfs_h *g = Guestfs_val (gv);
730 caml_failwith ("test0rpvlisterr: used handle after closing it");
732 struct guestfs_lvm_pv_list *r;
734 caml_enter_blocking_section ();
735 r = guestfs_test0rpvlisterr (g);
736 caml_leave_blocking_section ();
738 ocaml_guestfs_raise_error (g, "test0rpvlisterr");
740 rv = copy_lvm_pv_list (r);
741 guestfs_free_lvm_pv_list (r);
746 ocaml_guestfs_test0rvglist (value gv, value valv)
748 CAMLparam2 (gv, valv);
751 guestfs_h *g = Guestfs_val (gv);
753 caml_failwith ("test0rvglist: used handle after closing it");
755 const char *val = String_val (valv);
756 struct guestfs_lvm_vg_list *r;
758 caml_enter_blocking_section ();
759 r = guestfs_test0rvglist (g, val);
760 caml_leave_blocking_section ();
762 ocaml_guestfs_raise_error (g, "test0rvglist");
764 rv = copy_lvm_vg_list (r);
765 guestfs_free_lvm_vg_list (r);
770 ocaml_guestfs_test0rvglisterr (value gv)
775 guestfs_h *g = Guestfs_val (gv);
777 caml_failwith ("test0rvglisterr: used handle after closing it");
779 struct guestfs_lvm_vg_list *r;
781 caml_enter_blocking_section ();
782 r = guestfs_test0rvglisterr (g);
783 caml_leave_blocking_section ();
785 ocaml_guestfs_raise_error (g, "test0rvglisterr");
787 rv = copy_lvm_vg_list (r);
788 guestfs_free_lvm_vg_list (r);
793 ocaml_guestfs_test0rlvlist (value gv, value valv)
795 CAMLparam2 (gv, valv);
798 guestfs_h *g = Guestfs_val (gv);
800 caml_failwith ("test0rlvlist: used handle after closing it");
802 const char *val = String_val (valv);
803 struct guestfs_lvm_lv_list *r;
805 caml_enter_blocking_section ();
806 r = guestfs_test0rlvlist (g, val);
807 caml_leave_blocking_section ();
809 ocaml_guestfs_raise_error (g, "test0rlvlist");
811 rv = copy_lvm_lv_list (r);
812 guestfs_free_lvm_lv_list (r);
817 ocaml_guestfs_test0rlvlisterr (value gv)
822 guestfs_h *g = Guestfs_val (gv);
824 caml_failwith ("test0rlvlisterr: used handle after closing it");
826 struct guestfs_lvm_lv_list *r;
828 caml_enter_blocking_section ();
829 r = guestfs_test0rlvlisterr (g);
830 caml_leave_blocking_section ();
832 ocaml_guestfs_raise_error (g, "test0rlvlisterr");
834 rv = copy_lvm_lv_list (r);
835 guestfs_free_lvm_lv_list (r);
840 ocaml_guestfs_test0rstat (value gv, value valv)
842 CAMLparam2 (gv, valv);
845 guestfs_h *g = Guestfs_val (gv);
847 caml_failwith ("test0rstat: used handle after closing it");
849 const char *val = String_val (valv);
850 struct guestfs_stat *r;
852 caml_enter_blocking_section ();
853 r = guestfs_test0rstat (g, val);
854 caml_leave_blocking_section ();
856 ocaml_guestfs_raise_error (g, "test0rstat");
864 ocaml_guestfs_test0rstaterr (value gv)
869 guestfs_h *g = Guestfs_val (gv);
871 caml_failwith ("test0rstaterr: used handle after closing it");
873 struct guestfs_stat *r;
875 caml_enter_blocking_section ();
876 r = guestfs_test0rstaterr (g);
877 caml_leave_blocking_section ();
879 ocaml_guestfs_raise_error (g, "test0rstaterr");
887 ocaml_guestfs_test0rstatvfs (value gv, value valv)
889 CAMLparam2 (gv, valv);
892 guestfs_h *g = Guestfs_val (gv);
894 caml_failwith ("test0rstatvfs: used handle after closing it");
896 const char *val = String_val (valv);
897 struct guestfs_statvfs *r;
899 caml_enter_blocking_section ();
900 r = guestfs_test0rstatvfs (g, val);
901 caml_leave_blocking_section ();
903 ocaml_guestfs_raise_error (g, "test0rstatvfs");
905 rv = copy_statvfs (r);
911 ocaml_guestfs_test0rstatvfserr (value gv)
916 guestfs_h *g = Guestfs_val (gv);
918 caml_failwith ("test0rstatvfserr: used handle after closing it");
920 struct guestfs_statvfs *r;
922 caml_enter_blocking_section ();
923 r = guestfs_test0rstatvfserr (g);
924 caml_leave_blocking_section ();
926 ocaml_guestfs_raise_error (g, "test0rstatvfserr");
928 rv = copy_statvfs (r);
934 ocaml_guestfs_test0rhashtable (value gv, value valv)
936 CAMLparam2 (gv, valv);
939 guestfs_h *g = Guestfs_val (gv);
941 caml_failwith ("test0rhashtable: used handle after closing it");
943 const char *val = String_val (valv);
947 caml_enter_blocking_section ();
948 r = guestfs_test0rhashtable (g, val);
949 caml_leave_blocking_section ();
951 ocaml_guestfs_raise_error (g, "test0rhashtable");
954 for (i = 0; r[i] != NULL; ++i) free (r[i]);
960 ocaml_guestfs_test0rhashtableerr (value gv)
965 guestfs_h *g = Guestfs_val (gv);
967 caml_failwith ("test0rhashtableerr: used handle after closing it");
972 caml_enter_blocking_section ();
973 r = guestfs_test0rhashtableerr (g);
974 caml_leave_blocking_section ();
976 ocaml_guestfs_raise_error (g, "test0rhashtableerr");
979 for (i = 0; r[i] != NULL; ++i) free (r[i]);
985 ocaml_guestfs_launch (value gv)
990 guestfs_h *g = Guestfs_val (gv);
992 caml_failwith ("launch: used handle after closing it");
996 caml_enter_blocking_section ();
997 r = guestfs_launch (g);
998 caml_leave_blocking_section ();
1000 ocaml_guestfs_raise_error (g, "launch");
1007 ocaml_guestfs_wait_ready (value gv)
1012 guestfs_h *g = Guestfs_val (gv);
1014 caml_failwith ("wait_ready: used handle after closing it");
1018 caml_enter_blocking_section ();
1019 r = guestfs_wait_ready (g);
1020 caml_leave_blocking_section ();
1022 ocaml_guestfs_raise_error (g, "wait_ready");
1029 ocaml_guestfs_kill_subprocess (value gv)
1034 guestfs_h *g = Guestfs_val (gv);
1036 caml_failwith ("kill_subprocess: used handle after closing it");
1040 caml_enter_blocking_section ();
1041 r = guestfs_kill_subprocess (g);
1042 caml_leave_blocking_section ();
1044 ocaml_guestfs_raise_error (g, "kill_subprocess");
1051 ocaml_guestfs_add_drive (value gv, value filenamev)
1053 CAMLparam2 (gv, filenamev);
1056 guestfs_h *g = Guestfs_val (gv);
1058 caml_failwith ("add_drive: used handle after closing it");
1060 const char *filename = String_val (filenamev);
1063 caml_enter_blocking_section ();
1064 r = guestfs_add_drive (g, filename);
1065 caml_leave_blocking_section ();
1067 ocaml_guestfs_raise_error (g, "add_drive");
1074 ocaml_guestfs_add_cdrom (value gv, value filenamev)
1076 CAMLparam2 (gv, filenamev);
1079 guestfs_h *g = Guestfs_val (gv);
1081 caml_failwith ("add_cdrom: used handle after closing it");
1083 const char *filename = String_val (filenamev);
1086 caml_enter_blocking_section ();
1087 r = guestfs_add_cdrom (g, filename);
1088 caml_leave_blocking_section ();
1090 ocaml_guestfs_raise_error (g, "add_cdrom");
1097 ocaml_guestfs_add_drive_ro (value gv, value filenamev)
1099 CAMLparam2 (gv, filenamev);
1102 guestfs_h *g = Guestfs_val (gv);
1104 caml_failwith ("add_drive_ro: used handle after closing it");
1106 const char *filename = String_val (filenamev);
1109 caml_enter_blocking_section ();
1110 r = guestfs_add_drive_ro (g, filename);
1111 caml_leave_blocking_section ();
1113 ocaml_guestfs_raise_error (g, "add_drive_ro");
1120 ocaml_guestfs_config (value gv, value qemuparamv, value qemuvaluev)
1122 CAMLparam3 (gv, qemuparamv, qemuvaluev);
1125 guestfs_h *g = Guestfs_val (gv);
1127 caml_failwith ("config: used handle after closing it");
1129 const char *qemuparam = String_val (qemuparamv);
1130 const char *qemuvalue =
1131 qemuvaluev != Val_int (0) ? String_val (Field (qemuvaluev, 0)) : NULL;
1134 caml_enter_blocking_section ();
1135 r = guestfs_config (g, qemuparam, qemuvalue);
1136 caml_leave_blocking_section ();
1138 ocaml_guestfs_raise_error (g, "config");
1145 ocaml_guestfs_set_qemu (value gv, value qemuv)
1147 CAMLparam2 (gv, qemuv);
1150 guestfs_h *g = Guestfs_val (gv);
1152 caml_failwith ("set_qemu: used handle after closing it");
1154 const char *qemu = String_val (qemuv);
1157 caml_enter_blocking_section ();
1158 r = guestfs_set_qemu (g, qemu);
1159 caml_leave_blocking_section ();
1161 ocaml_guestfs_raise_error (g, "set_qemu");
1168 ocaml_guestfs_get_qemu (value gv)
1173 guestfs_h *g = Guestfs_val (gv);
1175 caml_failwith ("get_qemu: used handle after closing it");
1179 caml_enter_blocking_section ();
1180 r = guestfs_get_qemu (g);
1181 caml_leave_blocking_section ();
1183 ocaml_guestfs_raise_error (g, "get_qemu");
1185 rv = caml_copy_string (r);
1190 ocaml_guestfs_set_path (value gv, value pathv)
1192 CAMLparam2 (gv, pathv);
1195 guestfs_h *g = Guestfs_val (gv);
1197 caml_failwith ("set_path: used handle after closing it");
1199 const char *path = String_val (pathv);
1202 caml_enter_blocking_section ();
1203 r = guestfs_set_path (g, path);
1204 caml_leave_blocking_section ();
1206 ocaml_guestfs_raise_error (g, "set_path");
1213 ocaml_guestfs_get_path (value gv)
1218 guestfs_h *g = Guestfs_val (gv);
1220 caml_failwith ("get_path: used handle after closing it");
1224 caml_enter_blocking_section ();
1225 r = guestfs_get_path (g);
1226 caml_leave_blocking_section ();
1228 ocaml_guestfs_raise_error (g, "get_path");
1230 rv = caml_copy_string (r);
1235 ocaml_guestfs_set_append (value gv, value appendv)
1237 CAMLparam2 (gv, appendv);
1240 guestfs_h *g = Guestfs_val (gv);
1242 caml_failwith ("set_append: used handle after closing it");
1244 const char *append = String_val (appendv);
1247 caml_enter_blocking_section ();
1248 r = guestfs_set_append (g, append);
1249 caml_leave_blocking_section ();
1251 ocaml_guestfs_raise_error (g, "set_append");
1258 ocaml_guestfs_get_append (value gv)
1263 guestfs_h *g = Guestfs_val (gv);
1265 caml_failwith ("get_append: used handle after closing it");
1269 caml_enter_blocking_section ();
1270 r = guestfs_get_append (g);
1271 caml_leave_blocking_section ();
1273 ocaml_guestfs_raise_error (g, "get_append");
1275 rv = caml_copy_string (r);
1280 ocaml_guestfs_set_autosync (value gv, value autosyncv)
1282 CAMLparam2 (gv, autosyncv);
1285 guestfs_h *g = Guestfs_val (gv);
1287 caml_failwith ("set_autosync: used handle after closing it");
1289 int autosync = Bool_val (autosyncv);
1292 caml_enter_blocking_section ();
1293 r = guestfs_set_autosync (g, autosync);
1294 caml_leave_blocking_section ();
1296 ocaml_guestfs_raise_error (g, "set_autosync");
1303 ocaml_guestfs_get_autosync (value gv)
1308 guestfs_h *g = Guestfs_val (gv);
1310 caml_failwith ("get_autosync: used handle after closing it");
1314 caml_enter_blocking_section ();
1315 r = guestfs_get_autosync (g);
1316 caml_leave_blocking_section ();
1318 ocaml_guestfs_raise_error (g, "get_autosync");
1325 ocaml_guestfs_set_verbose (value gv, value verbosev)
1327 CAMLparam2 (gv, verbosev);
1330 guestfs_h *g = Guestfs_val (gv);
1332 caml_failwith ("set_verbose: used handle after closing it");
1334 int verbose = Bool_val (verbosev);
1337 caml_enter_blocking_section ();
1338 r = guestfs_set_verbose (g, verbose);
1339 caml_leave_blocking_section ();
1341 ocaml_guestfs_raise_error (g, "set_verbose");
1348 ocaml_guestfs_get_verbose (value gv)
1353 guestfs_h *g = Guestfs_val (gv);
1355 caml_failwith ("get_verbose: used handle after closing it");
1359 caml_enter_blocking_section ();
1360 r = guestfs_get_verbose (g);
1361 caml_leave_blocking_section ();
1363 ocaml_guestfs_raise_error (g, "get_verbose");
1370 ocaml_guestfs_is_ready (value gv)
1375 guestfs_h *g = Guestfs_val (gv);
1377 caml_failwith ("is_ready: used handle after closing it");
1381 caml_enter_blocking_section ();
1382 r = guestfs_is_ready (g);
1383 caml_leave_blocking_section ();
1385 ocaml_guestfs_raise_error (g, "is_ready");
1392 ocaml_guestfs_is_config (value gv)
1397 guestfs_h *g = Guestfs_val (gv);
1399 caml_failwith ("is_config: used handle after closing it");
1403 caml_enter_blocking_section ();
1404 r = guestfs_is_config (g);
1405 caml_leave_blocking_section ();
1407 ocaml_guestfs_raise_error (g, "is_config");
1414 ocaml_guestfs_is_launching (value gv)
1419 guestfs_h *g = Guestfs_val (gv);
1421 caml_failwith ("is_launching: used handle after closing it");
1425 caml_enter_blocking_section ();
1426 r = guestfs_is_launching (g);
1427 caml_leave_blocking_section ();
1429 ocaml_guestfs_raise_error (g, "is_launching");
1436 ocaml_guestfs_is_busy (value gv)
1441 guestfs_h *g = Guestfs_val (gv);
1443 caml_failwith ("is_busy: used handle after closing it");
1447 caml_enter_blocking_section ();
1448 r = guestfs_is_busy (g);
1449 caml_leave_blocking_section ();
1451 ocaml_guestfs_raise_error (g, "is_busy");
1458 ocaml_guestfs_get_state (value gv)
1463 guestfs_h *g = Guestfs_val (gv);
1465 caml_failwith ("get_state: used handle after closing it");
1469 caml_enter_blocking_section ();
1470 r = guestfs_get_state (g);
1471 caml_leave_blocking_section ();
1473 ocaml_guestfs_raise_error (g, "get_state");
1480 ocaml_guestfs_set_busy (value gv)
1485 guestfs_h *g = Guestfs_val (gv);
1487 caml_failwith ("set_busy: used handle after closing it");
1491 caml_enter_blocking_section ();
1492 r = guestfs_set_busy (g);
1493 caml_leave_blocking_section ();
1495 ocaml_guestfs_raise_error (g, "set_busy");
1502 ocaml_guestfs_set_ready (value gv)
1507 guestfs_h *g = Guestfs_val (gv);
1509 caml_failwith ("set_ready: used handle after closing it");
1513 caml_enter_blocking_section ();
1514 r = guestfs_set_ready (g);
1515 caml_leave_blocking_section ();
1517 ocaml_guestfs_raise_error (g, "set_ready");
1524 ocaml_guestfs_end_busy (value gv)
1529 guestfs_h *g = Guestfs_val (gv);
1531 caml_failwith ("end_busy: used handle after closing it");
1535 caml_enter_blocking_section ();
1536 r = guestfs_end_busy (g);
1537 caml_leave_blocking_section ();
1539 ocaml_guestfs_raise_error (g, "end_busy");
1546 ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
1548 CAMLparam3 (gv, devicev, mountpointv);
1551 guestfs_h *g = Guestfs_val (gv);
1553 caml_failwith ("mount: used handle after closing it");
1555 const char *device = String_val (devicev);
1556 const char *mountpoint = String_val (mountpointv);
1559 caml_enter_blocking_section ();
1560 r = guestfs_mount (g, device, mountpoint);
1561 caml_leave_blocking_section ();
1563 ocaml_guestfs_raise_error (g, "mount");
1570 ocaml_guestfs_sync (value gv)
1575 guestfs_h *g = Guestfs_val (gv);
1577 caml_failwith ("sync: used handle after closing it");
1581 caml_enter_blocking_section ();
1582 r = guestfs_sync (g);
1583 caml_leave_blocking_section ();
1585 ocaml_guestfs_raise_error (g, "sync");
1592 ocaml_guestfs_touch (value gv, value pathv)
1594 CAMLparam2 (gv, pathv);
1597 guestfs_h *g = Guestfs_val (gv);
1599 caml_failwith ("touch: used handle after closing it");
1601 const char *path = String_val (pathv);
1604 caml_enter_blocking_section ();
1605 r = guestfs_touch (g, path);
1606 caml_leave_blocking_section ();
1608 ocaml_guestfs_raise_error (g, "touch");
1615 ocaml_guestfs_cat (value gv, value pathv)
1617 CAMLparam2 (gv, pathv);
1620 guestfs_h *g = Guestfs_val (gv);
1622 caml_failwith ("cat: used handle after closing it");
1624 const char *path = String_val (pathv);
1627 caml_enter_blocking_section ();
1628 r = guestfs_cat (g, path);
1629 caml_leave_blocking_section ();
1631 ocaml_guestfs_raise_error (g, "cat");
1633 rv = caml_copy_string (r);
1639 ocaml_guestfs_ll (value gv, value directoryv)
1641 CAMLparam2 (gv, directoryv);
1644 guestfs_h *g = Guestfs_val (gv);
1646 caml_failwith ("ll: used handle after closing it");
1648 const char *directory = String_val (directoryv);
1651 caml_enter_blocking_section ();
1652 r = guestfs_ll (g, directory);
1653 caml_leave_blocking_section ();
1655 ocaml_guestfs_raise_error (g, "ll");
1657 rv = caml_copy_string (r);
1663 ocaml_guestfs_ls (value gv, value directoryv)
1665 CAMLparam2 (gv, directoryv);
1668 guestfs_h *g = Guestfs_val (gv);
1670 caml_failwith ("ls: used handle after closing it");
1672 const char *directory = String_val (directoryv);
1676 caml_enter_blocking_section ();
1677 r = guestfs_ls (g, directory);
1678 caml_leave_blocking_section ();
1680 ocaml_guestfs_raise_error (g, "ls");
1682 rv = caml_copy_string_array ((const char **) r);
1683 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1689 ocaml_guestfs_list_devices (value gv)
1694 guestfs_h *g = Guestfs_val (gv);
1696 caml_failwith ("list_devices: used handle after closing it");
1701 caml_enter_blocking_section ();
1702 r = guestfs_list_devices (g);
1703 caml_leave_blocking_section ();
1705 ocaml_guestfs_raise_error (g, "list_devices");
1707 rv = caml_copy_string_array ((const char **) r);
1708 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1714 ocaml_guestfs_list_partitions (value gv)
1719 guestfs_h *g = Guestfs_val (gv);
1721 caml_failwith ("list_partitions: used handle after closing it");
1726 caml_enter_blocking_section ();
1727 r = guestfs_list_partitions (g);
1728 caml_leave_blocking_section ();
1730 ocaml_guestfs_raise_error (g, "list_partitions");
1732 rv = caml_copy_string_array ((const char **) r);
1733 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1739 ocaml_guestfs_pvs (value gv)
1744 guestfs_h *g = Guestfs_val (gv);
1746 caml_failwith ("pvs: used handle after closing it");
1751 caml_enter_blocking_section ();
1752 r = guestfs_pvs (g);
1753 caml_leave_blocking_section ();
1755 ocaml_guestfs_raise_error (g, "pvs");
1757 rv = caml_copy_string_array ((const char **) r);
1758 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1764 ocaml_guestfs_vgs (value gv)
1769 guestfs_h *g = Guestfs_val (gv);
1771 caml_failwith ("vgs: used handle after closing it");
1776 caml_enter_blocking_section ();
1777 r = guestfs_vgs (g);
1778 caml_leave_blocking_section ();
1780 ocaml_guestfs_raise_error (g, "vgs");
1782 rv = caml_copy_string_array ((const char **) r);
1783 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1789 ocaml_guestfs_lvs (value gv)
1794 guestfs_h *g = Guestfs_val (gv);
1796 caml_failwith ("lvs: used handle after closing it");
1801 caml_enter_blocking_section ();
1802 r = guestfs_lvs (g);
1803 caml_leave_blocking_section ();
1805 ocaml_guestfs_raise_error (g, "lvs");
1807 rv = caml_copy_string_array ((const char **) r);
1808 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1814 ocaml_guestfs_pvs_full (value gv)
1819 guestfs_h *g = Guestfs_val (gv);
1821 caml_failwith ("pvs_full: used handle after closing it");
1823 struct guestfs_lvm_pv_list *r;
1825 caml_enter_blocking_section ();
1826 r = guestfs_pvs_full (g);
1827 caml_leave_blocking_section ();
1829 ocaml_guestfs_raise_error (g, "pvs_full");
1831 rv = copy_lvm_pv_list (r);
1832 guestfs_free_lvm_pv_list (r);
1837 ocaml_guestfs_vgs_full (value gv)
1842 guestfs_h *g = Guestfs_val (gv);
1844 caml_failwith ("vgs_full: used handle after closing it");
1846 struct guestfs_lvm_vg_list *r;
1848 caml_enter_blocking_section ();
1849 r = guestfs_vgs_full (g);
1850 caml_leave_blocking_section ();
1852 ocaml_guestfs_raise_error (g, "vgs_full");
1854 rv = copy_lvm_vg_list (r);
1855 guestfs_free_lvm_vg_list (r);
1860 ocaml_guestfs_lvs_full (value gv)
1865 guestfs_h *g = Guestfs_val (gv);
1867 caml_failwith ("lvs_full: used handle after closing it");
1869 struct guestfs_lvm_lv_list *r;
1871 caml_enter_blocking_section ();
1872 r = guestfs_lvs_full (g);
1873 caml_leave_blocking_section ();
1875 ocaml_guestfs_raise_error (g, "lvs_full");
1877 rv = copy_lvm_lv_list (r);
1878 guestfs_free_lvm_lv_list (r);
1883 ocaml_guestfs_read_lines (value gv, value pathv)
1885 CAMLparam2 (gv, pathv);
1888 guestfs_h *g = Guestfs_val (gv);
1890 caml_failwith ("read_lines: used handle after closing it");
1892 const char *path = String_val (pathv);
1896 caml_enter_blocking_section ();
1897 r = guestfs_read_lines (g, path);
1898 caml_leave_blocking_section ();
1900 ocaml_guestfs_raise_error (g, "read_lines");
1902 rv = caml_copy_string_array ((const char **) r);
1903 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1909 ocaml_guestfs_aug_init (value gv, value rootv, value flagsv)
1911 CAMLparam3 (gv, rootv, flagsv);
1914 guestfs_h *g = Guestfs_val (gv);
1916 caml_failwith ("aug_init: used handle after closing it");
1918 const char *root = String_val (rootv);
1919 int flags = Int_val (flagsv);
1922 caml_enter_blocking_section ();
1923 r = guestfs_aug_init (g, root, flags);
1924 caml_leave_blocking_section ();
1926 ocaml_guestfs_raise_error (g, "aug_init");
1933 ocaml_guestfs_aug_close (value gv)
1938 guestfs_h *g = Guestfs_val (gv);
1940 caml_failwith ("aug_close: used handle after closing it");
1944 caml_enter_blocking_section ();
1945 r = guestfs_aug_close (g);
1946 caml_leave_blocking_section ();
1948 ocaml_guestfs_raise_error (g, "aug_close");
1955 ocaml_guestfs_aug_defvar (value gv, value namev, value exprv)
1957 CAMLparam3 (gv, namev, exprv);
1960 guestfs_h *g = Guestfs_val (gv);
1962 caml_failwith ("aug_defvar: used handle after closing it");
1964 const char *name = String_val (namev);
1966 exprv != Val_int (0) ? String_val (Field (exprv, 0)) : NULL;
1969 caml_enter_blocking_section ();
1970 r = guestfs_aug_defvar (g, name, expr);
1971 caml_leave_blocking_section ();
1973 ocaml_guestfs_raise_error (g, "aug_defvar");
1980 ocaml_guestfs_aug_defnode (value gv, value namev, value exprv, value valv)
1982 CAMLparam4 (gv, namev, exprv, valv);
1985 guestfs_h *g = Guestfs_val (gv);
1987 caml_failwith ("aug_defnode: used handle after closing it");
1989 const char *name = String_val (namev);
1990 const char *expr = String_val (exprv);
1991 const char *val = String_val (valv);
1992 struct guestfs_int_bool *r;
1994 caml_enter_blocking_section ();
1995 r = guestfs_aug_defnode (g, name, expr, val);
1996 caml_leave_blocking_section ();
1998 ocaml_guestfs_raise_error (g, "aug_defnode");
2000 rv = caml_alloc (2, 0);
2001 Store_field (rv, 0, Val_int (r->i));
2002 Store_field (rv, 1, Val_bool (r->b));
2003 guestfs_free_int_bool (r);
2008 ocaml_guestfs_aug_get (value gv, value pathv)
2010 CAMLparam2 (gv, pathv);
2013 guestfs_h *g = Guestfs_val (gv);
2015 caml_failwith ("aug_get: used handle after closing it");
2017 const char *path = String_val (pathv);
2020 caml_enter_blocking_section ();
2021 r = guestfs_aug_get (g, path);
2022 caml_leave_blocking_section ();
2024 ocaml_guestfs_raise_error (g, "aug_get");
2026 rv = caml_copy_string (r);
2032 ocaml_guestfs_aug_set (value gv, value pathv, value valv)
2034 CAMLparam3 (gv, pathv, valv);
2037 guestfs_h *g = Guestfs_val (gv);
2039 caml_failwith ("aug_set: used handle after closing it");
2041 const char *path = String_val (pathv);
2042 const char *val = String_val (valv);
2045 caml_enter_blocking_section ();
2046 r = guestfs_aug_set (g, path, val);
2047 caml_leave_blocking_section ();
2049 ocaml_guestfs_raise_error (g, "aug_set");
2056 ocaml_guestfs_aug_insert (value gv, value pathv, value labelv, value beforev)
2058 CAMLparam4 (gv, pathv, labelv, beforev);
2061 guestfs_h *g = Guestfs_val (gv);
2063 caml_failwith ("aug_insert: used handle after closing it");
2065 const char *path = String_val (pathv);
2066 const char *label = String_val (labelv);
2067 int before = Bool_val (beforev);
2070 caml_enter_blocking_section ();
2071 r = guestfs_aug_insert (g, path, label, before);
2072 caml_leave_blocking_section ();
2074 ocaml_guestfs_raise_error (g, "aug_insert");
2081 ocaml_guestfs_aug_rm (value gv, value pathv)
2083 CAMLparam2 (gv, pathv);
2086 guestfs_h *g = Guestfs_val (gv);
2088 caml_failwith ("aug_rm: used handle after closing it");
2090 const char *path = String_val (pathv);
2093 caml_enter_blocking_section ();
2094 r = guestfs_aug_rm (g, path);
2095 caml_leave_blocking_section ();
2097 ocaml_guestfs_raise_error (g, "aug_rm");
2104 ocaml_guestfs_aug_mv (value gv, value srcv, value destv)
2106 CAMLparam3 (gv, srcv, destv);
2109 guestfs_h *g = Guestfs_val (gv);
2111 caml_failwith ("aug_mv: used handle after closing it");
2113 const char *src = String_val (srcv);
2114 const char *dest = String_val (destv);
2117 caml_enter_blocking_section ();
2118 r = guestfs_aug_mv (g, src, dest);
2119 caml_leave_blocking_section ();
2121 ocaml_guestfs_raise_error (g, "aug_mv");
2128 ocaml_guestfs_aug_match (value gv, value pathv)
2130 CAMLparam2 (gv, pathv);
2133 guestfs_h *g = Guestfs_val (gv);
2135 caml_failwith ("aug_match: used handle after closing it");
2137 const char *path = String_val (pathv);
2141 caml_enter_blocking_section ();
2142 r = guestfs_aug_match (g, path);
2143 caml_leave_blocking_section ();
2145 ocaml_guestfs_raise_error (g, "aug_match");
2147 rv = caml_copy_string_array ((const char **) r);
2148 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2154 ocaml_guestfs_aug_save (value gv)
2159 guestfs_h *g = Guestfs_val (gv);
2161 caml_failwith ("aug_save: used handle after closing it");
2165 caml_enter_blocking_section ();
2166 r = guestfs_aug_save (g);
2167 caml_leave_blocking_section ();
2169 ocaml_guestfs_raise_error (g, "aug_save");
2176 ocaml_guestfs_aug_load (value gv)
2181 guestfs_h *g = Guestfs_val (gv);
2183 caml_failwith ("aug_load: used handle after closing it");
2187 caml_enter_blocking_section ();
2188 r = guestfs_aug_load (g);
2189 caml_leave_blocking_section ();
2191 ocaml_guestfs_raise_error (g, "aug_load");
2198 ocaml_guestfs_aug_ls (value gv, value pathv)
2200 CAMLparam2 (gv, pathv);
2203 guestfs_h *g = Guestfs_val (gv);
2205 caml_failwith ("aug_ls: used handle after closing it");
2207 const char *path = String_val (pathv);
2211 caml_enter_blocking_section ();
2212 r = guestfs_aug_ls (g, path);
2213 caml_leave_blocking_section ();
2215 ocaml_guestfs_raise_error (g, "aug_ls");
2217 rv = caml_copy_string_array ((const char **) r);
2218 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2224 ocaml_guestfs_rm (value gv, value pathv)
2226 CAMLparam2 (gv, pathv);
2229 guestfs_h *g = Guestfs_val (gv);
2231 caml_failwith ("rm: used handle after closing it");
2233 const char *path = String_val (pathv);
2236 caml_enter_blocking_section ();
2237 r = guestfs_rm (g, path);
2238 caml_leave_blocking_section ();
2240 ocaml_guestfs_raise_error (g, "rm");
2247 ocaml_guestfs_rmdir (value gv, value pathv)
2249 CAMLparam2 (gv, pathv);
2252 guestfs_h *g = Guestfs_val (gv);
2254 caml_failwith ("rmdir: used handle after closing it");
2256 const char *path = String_val (pathv);
2259 caml_enter_blocking_section ();
2260 r = guestfs_rmdir (g, path);
2261 caml_leave_blocking_section ();
2263 ocaml_guestfs_raise_error (g, "rmdir");
2270 ocaml_guestfs_rm_rf (value gv, value pathv)
2272 CAMLparam2 (gv, pathv);
2275 guestfs_h *g = Guestfs_val (gv);
2277 caml_failwith ("rm_rf: used handle after closing it");
2279 const char *path = String_val (pathv);
2282 caml_enter_blocking_section ();
2283 r = guestfs_rm_rf (g, path);
2284 caml_leave_blocking_section ();
2286 ocaml_guestfs_raise_error (g, "rm_rf");
2293 ocaml_guestfs_mkdir (value gv, value pathv)
2295 CAMLparam2 (gv, pathv);
2298 guestfs_h *g = Guestfs_val (gv);
2300 caml_failwith ("mkdir: used handle after closing it");
2302 const char *path = String_val (pathv);
2305 caml_enter_blocking_section ();
2306 r = guestfs_mkdir (g, path);
2307 caml_leave_blocking_section ();
2309 ocaml_guestfs_raise_error (g, "mkdir");
2316 ocaml_guestfs_mkdir_p (value gv, value pathv)
2318 CAMLparam2 (gv, pathv);
2321 guestfs_h *g = Guestfs_val (gv);
2323 caml_failwith ("mkdir_p: used handle after closing it");
2325 const char *path = String_val (pathv);
2328 caml_enter_blocking_section ();
2329 r = guestfs_mkdir_p (g, path);
2330 caml_leave_blocking_section ();
2332 ocaml_guestfs_raise_error (g, "mkdir_p");
2339 ocaml_guestfs_chmod (value gv, value modev, value pathv)
2341 CAMLparam3 (gv, modev, pathv);
2344 guestfs_h *g = Guestfs_val (gv);
2346 caml_failwith ("chmod: used handle after closing it");
2348 int mode = Int_val (modev);
2349 const char *path = String_val (pathv);
2352 caml_enter_blocking_section ();
2353 r = guestfs_chmod (g, mode, path);
2354 caml_leave_blocking_section ();
2356 ocaml_guestfs_raise_error (g, "chmod");
2363 ocaml_guestfs_chown (value gv, value ownerv, value groupv, value pathv)
2365 CAMLparam4 (gv, ownerv, groupv, pathv);
2368 guestfs_h *g = Guestfs_val (gv);
2370 caml_failwith ("chown: used handle after closing it");
2372 int owner = Int_val (ownerv);
2373 int group = Int_val (groupv);
2374 const char *path = String_val (pathv);
2377 caml_enter_blocking_section ();
2378 r = guestfs_chown (g, owner, group, path);
2379 caml_leave_blocking_section ();
2381 ocaml_guestfs_raise_error (g, "chown");
2388 ocaml_guestfs_exists (value gv, value pathv)
2390 CAMLparam2 (gv, pathv);
2393 guestfs_h *g = Guestfs_val (gv);
2395 caml_failwith ("exists: used handle after closing it");
2397 const char *path = String_val (pathv);
2400 caml_enter_blocking_section ();
2401 r = guestfs_exists (g, path);
2402 caml_leave_blocking_section ();
2404 ocaml_guestfs_raise_error (g, "exists");
2411 ocaml_guestfs_is_file (value gv, value pathv)
2413 CAMLparam2 (gv, pathv);
2416 guestfs_h *g = Guestfs_val (gv);
2418 caml_failwith ("is_file: used handle after closing it");
2420 const char *path = String_val (pathv);
2423 caml_enter_blocking_section ();
2424 r = guestfs_is_file (g, path);
2425 caml_leave_blocking_section ();
2427 ocaml_guestfs_raise_error (g, "is_file");
2434 ocaml_guestfs_is_dir (value gv, value pathv)
2436 CAMLparam2 (gv, pathv);
2439 guestfs_h *g = Guestfs_val (gv);
2441 caml_failwith ("is_dir: used handle after closing it");
2443 const char *path = String_val (pathv);
2446 caml_enter_blocking_section ();
2447 r = guestfs_is_dir (g, path);
2448 caml_leave_blocking_section ();
2450 ocaml_guestfs_raise_error (g, "is_dir");
2457 ocaml_guestfs_pvcreate (value gv, value devicev)
2459 CAMLparam2 (gv, devicev);
2462 guestfs_h *g = Guestfs_val (gv);
2464 caml_failwith ("pvcreate: used handle after closing it");
2466 const char *device = String_val (devicev);
2469 caml_enter_blocking_section ();
2470 r = guestfs_pvcreate (g, device);
2471 caml_leave_blocking_section ();
2473 ocaml_guestfs_raise_error (g, "pvcreate");
2480 ocaml_guestfs_vgcreate (value gv, value volgroupv, value physvolsv)
2482 CAMLparam3 (gv, volgroupv, physvolsv);
2485 guestfs_h *g = Guestfs_val (gv);
2487 caml_failwith ("vgcreate: used handle after closing it");
2489 const char *volgroup = String_val (volgroupv);
2490 char **physvols = ocaml_guestfs_strings_val (g, physvolsv);
2493 caml_enter_blocking_section ();
2494 r = guestfs_vgcreate (g, volgroup, physvols);
2495 caml_leave_blocking_section ();
2496 ocaml_guestfs_free_strings (physvols);
2498 ocaml_guestfs_raise_error (g, "vgcreate");
2505 ocaml_guestfs_lvcreate (value gv, value logvolv, value volgroupv, value mbytesv)
2507 CAMLparam4 (gv, logvolv, volgroupv, mbytesv);
2510 guestfs_h *g = Guestfs_val (gv);
2512 caml_failwith ("lvcreate: used handle after closing it");
2514 const char *logvol = String_val (logvolv);
2515 const char *volgroup = String_val (volgroupv);
2516 int mbytes = Int_val (mbytesv);
2519 caml_enter_blocking_section ();
2520 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
2521 caml_leave_blocking_section ();
2523 ocaml_guestfs_raise_error (g, "lvcreate");
2530 ocaml_guestfs_mkfs (value gv, value fstypev, value devicev)
2532 CAMLparam3 (gv, fstypev, devicev);
2535 guestfs_h *g = Guestfs_val (gv);
2537 caml_failwith ("mkfs: used handle after closing it");
2539 const char *fstype = String_val (fstypev);
2540 const char *device = String_val (devicev);
2543 caml_enter_blocking_section ();
2544 r = guestfs_mkfs (g, fstype, device);
2545 caml_leave_blocking_section ();
2547 ocaml_guestfs_raise_error (g, "mkfs");
2554 ocaml_guestfs_sfdisk (value gv, value devicev, value cylsv, value headsv, value sectorsv, value linesv)
2556 CAMLparam5 (gv, devicev, cylsv, headsv, sectorsv);
2557 CAMLxparam1 (linesv);
2560 guestfs_h *g = Guestfs_val (gv);
2562 caml_failwith ("sfdisk: used handle after closing it");
2564 const char *device = String_val (devicev);
2565 int cyls = Int_val (cylsv);
2566 int heads = Int_val (headsv);
2567 int sectors = Int_val (sectorsv);
2568 char **lines = ocaml_guestfs_strings_val (g, linesv);
2571 caml_enter_blocking_section ();
2572 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
2573 caml_leave_blocking_section ();
2574 ocaml_guestfs_free_strings (lines);
2576 ocaml_guestfs_raise_error (g, "sfdisk");
2583 ocaml_guestfs_sfdisk_byte (value *argv, int argn)
2585 return ocaml_guestfs_sfdisk (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4]);
2589 ocaml_guestfs_write_file (value gv, value pathv, value contentv, value sizev)
2591 CAMLparam4 (gv, pathv, contentv, sizev);
2594 guestfs_h *g = Guestfs_val (gv);
2596 caml_failwith ("write_file: used handle after closing it");
2598 const char *path = String_val (pathv);
2599 const char *content = String_val (contentv);
2600 int size = Int_val (sizev);
2603 caml_enter_blocking_section ();
2604 r = guestfs_write_file (g, path, content, size);
2605 caml_leave_blocking_section ();
2607 ocaml_guestfs_raise_error (g, "write_file");
2614 ocaml_guestfs_umount (value gv, value pathordevicev)
2616 CAMLparam2 (gv, pathordevicev);
2619 guestfs_h *g = Guestfs_val (gv);
2621 caml_failwith ("umount: used handle after closing it");
2623 const char *pathordevice = String_val (pathordevicev);
2626 caml_enter_blocking_section ();
2627 r = guestfs_umount (g, pathordevice);
2628 caml_leave_blocking_section ();
2630 ocaml_guestfs_raise_error (g, "umount");
2637 ocaml_guestfs_mounts (value gv)
2642 guestfs_h *g = Guestfs_val (gv);
2644 caml_failwith ("mounts: used handle after closing it");
2649 caml_enter_blocking_section ();
2650 r = guestfs_mounts (g);
2651 caml_leave_blocking_section ();
2653 ocaml_guestfs_raise_error (g, "mounts");
2655 rv = caml_copy_string_array ((const char **) r);
2656 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2662 ocaml_guestfs_umount_all (value gv)
2667 guestfs_h *g = Guestfs_val (gv);
2669 caml_failwith ("umount_all: used handle after closing it");
2673 caml_enter_blocking_section ();
2674 r = guestfs_umount_all (g);
2675 caml_leave_blocking_section ();
2677 ocaml_guestfs_raise_error (g, "umount_all");
2684 ocaml_guestfs_lvm_remove_all (value gv)
2689 guestfs_h *g = Guestfs_val (gv);
2691 caml_failwith ("lvm_remove_all: used handle after closing it");
2695 caml_enter_blocking_section ();
2696 r = guestfs_lvm_remove_all (g);
2697 caml_leave_blocking_section ();
2699 ocaml_guestfs_raise_error (g, "lvm_remove_all");
2706 ocaml_guestfs_file (value gv, value pathv)
2708 CAMLparam2 (gv, pathv);
2711 guestfs_h *g = Guestfs_val (gv);
2713 caml_failwith ("file: used handle after closing it");
2715 const char *path = String_val (pathv);
2718 caml_enter_blocking_section ();
2719 r = guestfs_file (g, path);
2720 caml_leave_blocking_section ();
2722 ocaml_guestfs_raise_error (g, "file");
2724 rv = caml_copy_string (r);
2730 ocaml_guestfs_command (value gv, value argumentsv)
2732 CAMLparam2 (gv, argumentsv);
2735 guestfs_h *g = Guestfs_val (gv);
2737 caml_failwith ("command: used handle after closing it");
2739 char **arguments = ocaml_guestfs_strings_val (g, argumentsv);
2742 caml_enter_blocking_section ();
2743 r = guestfs_command (g, arguments);
2744 caml_leave_blocking_section ();
2745 ocaml_guestfs_free_strings (arguments);
2747 ocaml_guestfs_raise_error (g, "command");
2749 rv = caml_copy_string (r);
2755 ocaml_guestfs_command_lines (value gv, value argumentsv)
2757 CAMLparam2 (gv, argumentsv);
2760 guestfs_h *g = Guestfs_val (gv);
2762 caml_failwith ("command_lines: used handle after closing it");
2764 char **arguments = ocaml_guestfs_strings_val (g, argumentsv);
2768 caml_enter_blocking_section ();
2769 r = guestfs_command_lines (g, arguments);
2770 caml_leave_blocking_section ();
2771 ocaml_guestfs_free_strings (arguments);
2773 ocaml_guestfs_raise_error (g, "command_lines");
2775 rv = caml_copy_string_array ((const char **) r);
2776 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2782 ocaml_guestfs_stat (value gv, value pathv)
2784 CAMLparam2 (gv, pathv);
2787 guestfs_h *g = Guestfs_val (gv);
2789 caml_failwith ("stat: used handle after closing it");
2791 const char *path = String_val (pathv);
2792 struct guestfs_stat *r;
2794 caml_enter_blocking_section ();
2795 r = guestfs_stat (g, path);
2796 caml_leave_blocking_section ();
2798 ocaml_guestfs_raise_error (g, "stat");
2806 ocaml_guestfs_lstat (value gv, value pathv)
2808 CAMLparam2 (gv, pathv);
2811 guestfs_h *g = Guestfs_val (gv);
2813 caml_failwith ("lstat: used handle after closing it");
2815 const char *path = String_val (pathv);
2816 struct guestfs_stat *r;
2818 caml_enter_blocking_section ();
2819 r = guestfs_lstat (g, path);
2820 caml_leave_blocking_section ();
2822 ocaml_guestfs_raise_error (g, "lstat");
2830 ocaml_guestfs_statvfs (value gv, value pathv)
2832 CAMLparam2 (gv, pathv);
2835 guestfs_h *g = Guestfs_val (gv);
2837 caml_failwith ("statvfs: used handle after closing it");
2839 const char *path = String_val (pathv);
2840 struct guestfs_statvfs *r;
2842 caml_enter_blocking_section ();
2843 r = guestfs_statvfs (g, path);
2844 caml_leave_blocking_section ();
2846 ocaml_guestfs_raise_error (g, "statvfs");
2848 rv = copy_statvfs (r);
2854 ocaml_guestfs_tune2fs_l (value gv, value devicev)
2856 CAMLparam2 (gv, devicev);
2859 guestfs_h *g = Guestfs_val (gv);
2861 caml_failwith ("tune2fs_l: used handle after closing it");
2863 const char *device = String_val (devicev);
2867 caml_enter_blocking_section ();
2868 r = guestfs_tune2fs_l (g, device);
2869 caml_leave_blocking_section ();
2871 ocaml_guestfs_raise_error (g, "tune2fs_l");
2873 rv = copy_table (r);
2874 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2880 ocaml_guestfs_blockdev_setro (value gv, value devicev)
2882 CAMLparam2 (gv, devicev);
2885 guestfs_h *g = Guestfs_val (gv);
2887 caml_failwith ("blockdev_setro: used handle after closing it");
2889 const char *device = String_val (devicev);
2892 caml_enter_blocking_section ();
2893 r = guestfs_blockdev_setro (g, device);
2894 caml_leave_blocking_section ();
2896 ocaml_guestfs_raise_error (g, "blockdev_setro");
2903 ocaml_guestfs_blockdev_setrw (value gv, value devicev)
2905 CAMLparam2 (gv, devicev);
2908 guestfs_h *g = Guestfs_val (gv);
2910 caml_failwith ("blockdev_setrw: used handle after closing it");
2912 const char *device = String_val (devicev);
2915 caml_enter_blocking_section ();
2916 r = guestfs_blockdev_setrw (g, device);
2917 caml_leave_blocking_section ();
2919 ocaml_guestfs_raise_error (g, "blockdev_setrw");
2926 ocaml_guestfs_blockdev_getro (value gv, value devicev)
2928 CAMLparam2 (gv, devicev);
2931 guestfs_h *g = Guestfs_val (gv);
2933 caml_failwith ("blockdev_getro: used handle after closing it");
2935 const char *device = String_val (devicev);
2938 caml_enter_blocking_section ();
2939 r = guestfs_blockdev_getro (g, device);
2940 caml_leave_blocking_section ();
2942 ocaml_guestfs_raise_error (g, "blockdev_getro");
2949 ocaml_guestfs_blockdev_getss (value gv, value devicev)
2951 CAMLparam2 (gv, devicev);
2954 guestfs_h *g = Guestfs_val (gv);
2956 caml_failwith ("blockdev_getss: used handle after closing it");
2958 const char *device = String_val (devicev);
2961 caml_enter_blocking_section ();
2962 r = guestfs_blockdev_getss (g, device);
2963 caml_leave_blocking_section ();
2965 ocaml_guestfs_raise_error (g, "blockdev_getss");
2972 ocaml_guestfs_blockdev_getbsz (value gv, value devicev)
2974 CAMLparam2 (gv, devicev);
2977 guestfs_h *g = Guestfs_val (gv);
2979 caml_failwith ("blockdev_getbsz: used handle after closing it");
2981 const char *device = String_val (devicev);
2984 caml_enter_blocking_section ();
2985 r = guestfs_blockdev_getbsz (g, device);
2986 caml_leave_blocking_section ();
2988 ocaml_guestfs_raise_error (g, "blockdev_getbsz");
2995 ocaml_guestfs_blockdev_setbsz (value gv, value devicev, value blocksizev)
2997 CAMLparam3 (gv, devicev, blocksizev);
3000 guestfs_h *g = Guestfs_val (gv);
3002 caml_failwith ("blockdev_setbsz: used handle after closing it");
3004 const char *device = String_val (devicev);
3005 int blocksize = Int_val (blocksizev);
3008 caml_enter_blocking_section ();
3009 r = guestfs_blockdev_setbsz (g, device, blocksize);
3010 caml_leave_blocking_section ();
3012 ocaml_guestfs_raise_error (g, "blockdev_setbsz");
3019 ocaml_guestfs_blockdev_getsz (value gv, value devicev)
3021 CAMLparam2 (gv, devicev);
3024 guestfs_h *g = Guestfs_val (gv);
3026 caml_failwith ("blockdev_getsz: used handle after closing it");
3028 const char *device = String_val (devicev);
3031 caml_enter_blocking_section ();
3032 r = guestfs_blockdev_getsz (g, device);
3033 caml_leave_blocking_section ();
3035 ocaml_guestfs_raise_error (g, "blockdev_getsz");
3037 rv = caml_copy_int64 (r);
3042 ocaml_guestfs_blockdev_getsize64 (value gv, value devicev)
3044 CAMLparam2 (gv, devicev);
3047 guestfs_h *g = Guestfs_val (gv);
3049 caml_failwith ("blockdev_getsize64: used handle after closing it");
3051 const char *device = String_val (devicev);
3054 caml_enter_blocking_section ();
3055 r = guestfs_blockdev_getsize64 (g, device);
3056 caml_leave_blocking_section ();
3058 ocaml_guestfs_raise_error (g, "blockdev_getsize64");
3060 rv = caml_copy_int64 (r);
3065 ocaml_guestfs_blockdev_flushbufs (value gv, value devicev)
3067 CAMLparam2 (gv, devicev);
3070 guestfs_h *g = Guestfs_val (gv);
3072 caml_failwith ("blockdev_flushbufs: used handle after closing it");
3074 const char *device = String_val (devicev);
3077 caml_enter_blocking_section ();
3078 r = guestfs_blockdev_flushbufs (g, device);
3079 caml_leave_blocking_section ();
3081 ocaml_guestfs_raise_error (g, "blockdev_flushbufs");
3088 ocaml_guestfs_blockdev_rereadpt (value gv, value devicev)
3090 CAMLparam2 (gv, devicev);
3093 guestfs_h *g = Guestfs_val (gv);
3095 caml_failwith ("blockdev_rereadpt: used handle after closing it");
3097 const char *device = String_val (devicev);
3100 caml_enter_blocking_section ();
3101 r = guestfs_blockdev_rereadpt (g, device);
3102 caml_leave_blocking_section ();
3104 ocaml_guestfs_raise_error (g, "blockdev_rereadpt");
3111 ocaml_guestfs_upload (value gv, value filenamev, value remotefilenamev)
3113 CAMLparam3 (gv, filenamev, remotefilenamev);
3116 guestfs_h *g = Guestfs_val (gv);
3118 caml_failwith ("upload: used handle after closing it");
3120 const char *filename = String_val (filenamev);
3121 const char *remotefilename = String_val (remotefilenamev);
3124 caml_enter_blocking_section ();
3125 r = guestfs_upload (g, filename, remotefilename);
3126 caml_leave_blocking_section ();
3128 ocaml_guestfs_raise_error (g, "upload");
3135 ocaml_guestfs_download (value gv, value remotefilenamev, value filenamev)
3137 CAMLparam3 (gv, remotefilenamev, filenamev);
3140 guestfs_h *g = Guestfs_val (gv);
3142 caml_failwith ("download: used handle after closing it");
3144 const char *remotefilename = String_val (remotefilenamev);
3145 const char *filename = String_val (filenamev);
3148 caml_enter_blocking_section ();
3149 r = guestfs_download (g, remotefilename, filename);
3150 caml_leave_blocking_section ();
3152 ocaml_guestfs_raise_error (g, "download");
3159 ocaml_guestfs_checksum (value gv, value csumtypev, value pathv)
3161 CAMLparam3 (gv, csumtypev, pathv);
3164 guestfs_h *g = Guestfs_val (gv);
3166 caml_failwith ("checksum: used handle after closing it");
3168 const char *csumtype = String_val (csumtypev);
3169 const char *path = String_val (pathv);
3172 caml_enter_blocking_section ();
3173 r = guestfs_checksum (g, csumtype, path);
3174 caml_leave_blocking_section ();
3176 ocaml_guestfs_raise_error (g, "checksum");
3178 rv = caml_copy_string (r);
3184 ocaml_guestfs_tar_in (value gv, value tarfilev, value directoryv)
3186 CAMLparam3 (gv, tarfilev, directoryv);
3189 guestfs_h *g = Guestfs_val (gv);
3191 caml_failwith ("tar_in: used handle after closing it");
3193 const char *tarfile = String_val (tarfilev);
3194 const char *directory = String_val (directoryv);
3197 caml_enter_blocking_section ();
3198 r = guestfs_tar_in (g, tarfile, directory);
3199 caml_leave_blocking_section ();
3201 ocaml_guestfs_raise_error (g, "tar_in");
3208 ocaml_guestfs_tar_out (value gv, value directoryv, value tarfilev)
3210 CAMLparam3 (gv, directoryv, tarfilev);
3213 guestfs_h *g = Guestfs_val (gv);
3215 caml_failwith ("tar_out: used handle after closing it");
3217 const char *directory = String_val (directoryv);
3218 const char *tarfile = String_val (tarfilev);
3221 caml_enter_blocking_section ();
3222 r = guestfs_tar_out (g, directory, tarfile);
3223 caml_leave_blocking_section ();
3225 ocaml_guestfs_raise_error (g, "tar_out");
3232 ocaml_guestfs_tgz_in (value gv, value tarballv, value directoryv)
3234 CAMLparam3 (gv, tarballv, directoryv);
3237 guestfs_h *g = Guestfs_val (gv);
3239 caml_failwith ("tgz_in: used handle after closing it");
3241 const char *tarball = String_val (tarballv);
3242 const char *directory = String_val (directoryv);
3245 caml_enter_blocking_section ();
3246 r = guestfs_tgz_in (g, tarball, directory);
3247 caml_leave_blocking_section ();
3249 ocaml_guestfs_raise_error (g, "tgz_in");
3256 ocaml_guestfs_tgz_out (value gv, value directoryv, value tarballv)
3258 CAMLparam3 (gv, directoryv, tarballv);
3261 guestfs_h *g = Guestfs_val (gv);
3263 caml_failwith ("tgz_out: used handle after closing it");
3265 const char *directory = String_val (directoryv);
3266 const char *tarball = String_val (tarballv);
3269 caml_enter_blocking_section ();
3270 r = guestfs_tgz_out (g, directory, tarball);
3271 caml_leave_blocking_section ();
3273 ocaml_guestfs_raise_error (g, "tgz_out");
3280 ocaml_guestfs_mount_ro (value gv, value devicev, value mountpointv)
3282 CAMLparam3 (gv, devicev, mountpointv);
3285 guestfs_h *g = Guestfs_val (gv);
3287 caml_failwith ("mount_ro: used handle after closing it");
3289 const char *device = String_val (devicev);
3290 const char *mountpoint = String_val (mountpointv);
3293 caml_enter_blocking_section ();
3294 r = guestfs_mount_ro (g, device, mountpoint);
3295 caml_leave_blocking_section ();
3297 ocaml_guestfs_raise_error (g, "mount_ro");
3304 ocaml_guestfs_mount_options (value gv, value optionsv, value devicev, value mountpointv)
3306 CAMLparam4 (gv, optionsv, devicev, mountpointv);
3309 guestfs_h *g = Guestfs_val (gv);
3311 caml_failwith ("mount_options: used handle after closing it");
3313 const char *options = String_val (optionsv);
3314 const char *device = String_val (devicev);
3315 const char *mountpoint = String_val (mountpointv);
3318 caml_enter_blocking_section ();
3319 r = guestfs_mount_options (g, options, device, mountpoint);
3320 caml_leave_blocking_section ();
3322 ocaml_guestfs_raise_error (g, "mount_options");
3329 ocaml_guestfs_mount_vfs (value gv, value optionsv, value vfstypev, value devicev, value mountpointv)
3331 CAMLparam5 (gv, optionsv, vfstypev, devicev, mountpointv);
3334 guestfs_h *g = Guestfs_val (gv);
3336 caml_failwith ("mount_vfs: used handle after closing it");
3338 const char *options = String_val (optionsv);
3339 const char *vfstype = String_val (vfstypev);
3340 const char *device = String_val (devicev);
3341 const char *mountpoint = String_val (mountpointv);
3344 caml_enter_blocking_section ();
3345 r = guestfs_mount_vfs (g, options, vfstype, device, mountpoint);
3346 caml_leave_blocking_section ();
3348 ocaml_guestfs_raise_error (g, "mount_vfs");
3355 ocaml_guestfs_debug (value gv, value subcmdv, value extraargsv)
3357 CAMLparam3 (gv, subcmdv, extraargsv);
3360 guestfs_h *g = Guestfs_val (gv);
3362 caml_failwith ("debug: used handle after closing it");
3364 const char *subcmd = String_val (subcmdv);
3365 char **extraargs = ocaml_guestfs_strings_val (g, extraargsv);
3368 caml_enter_blocking_section ();
3369 r = guestfs_debug (g, subcmd, extraargs);
3370 caml_leave_blocking_section ();
3371 ocaml_guestfs_free_strings (extraargs);
3373 ocaml_guestfs_raise_error (g, "debug");
3375 rv = caml_copy_string (r);
3381 ocaml_guestfs_lvremove (value gv, value devicev)
3383 CAMLparam2 (gv, devicev);
3386 guestfs_h *g = Guestfs_val (gv);
3388 caml_failwith ("lvremove: used handle after closing it");
3390 const char *device = String_val (devicev);
3393 caml_enter_blocking_section ();
3394 r = guestfs_lvremove (g, device);
3395 caml_leave_blocking_section ();
3397 ocaml_guestfs_raise_error (g, "lvremove");
3404 ocaml_guestfs_vgremove (value gv, value vgnamev)
3406 CAMLparam2 (gv, vgnamev);
3409 guestfs_h *g = Guestfs_val (gv);
3411 caml_failwith ("vgremove: used handle after closing it");
3413 const char *vgname = String_val (vgnamev);
3416 caml_enter_blocking_section ();
3417 r = guestfs_vgremove (g, vgname);
3418 caml_leave_blocking_section ();
3420 ocaml_guestfs_raise_error (g, "vgremove");
3427 ocaml_guestfs_pvremove (value gv, value devicev)
3429 CAMLparam2 (gv, devicev);
3432 guestfs_h *g = Guestfs_val (gv);
3434 caml_failwith ("pvremove: used handle after closing it");
3436 const char *device = String_val (devicev);
3439 caml_enter_blocking_section ();
3440 r = guestfs_pvremove (g, device);
3441 caml_leave_blocking_section ();
3443 ocaml_guestfs_raise_error (g, "pvremove");
3450 ocaml_guestfs_set_e2label (value gv, value devicev, value labelv)
3452 CAMLparam3 (gv, devicev, labelv);
3455 guestfs_h *g = Guestfs_val (gv);
3457 caml_failwith ("set_e2label: used handle after closing it");
3459 const char *device = String_val (devicev);
3460 const char *label = String_val (labelv);
3463 caml_enter_blocking_section ();
3464 r = guestfs_set_e2label (g, device, label);
3465 caml_leave_blocking_section ();
3467 ocaml_guestfs_raise_error (g, "set_e2label");
3474 ocaml_guestfs_get_e2label (value gv, value devicev)
3476 CAMLparam2 (gv, devicev);
3479 guestfs_h *g = Guestfs_val (gv);
3481 caml_failwith ("get_e2label: used handle after closing it");
3483 const char *device = String_val (devicev);
3486 caml_enter_blocking_section ();
3487 r = guestfs_get_e2label (g, device);
3488 caml_leave_blocking_section ();
3490 ocaml_guestfs_raise_error (g, "get_e2label");
3492 rv = caml_copy_string (r);
3498 ocaml_guestfs_set_e2uuid (value gv, value devicev, value uuidv)
3500 CAMLparam3 (gv, devicev, uuidv);
3503 guestfs_h *g = Guestfs_val (gv);
3505 caml_failwith ("set_e2uuid: used handle after closing it");
3507 const char *device = String_val (devicev);
3508 const char *uuid = String_val (uuidv);
3511 caml_enter_blocking_section ();
3512 r = guestfs_set_e2uuid (g, device, uuid);
3513 caml_leave_blocking_section ();
3515 ocaml_guestfs_raise_error (g, "set_e2uuid");
3522 ocaml_guestfs_get_e2uuid (value gv, value devicev)
3524 CAMLparam2 (gv, devicev);
3527 guestfs_h *g = Guestfs_val (gv);
3529 caml_failwith ("get_e2uuid: used handle after closing it");
3531 const char *device = String_val (devicev);
3534 caml_enter_blocking_section ();
3535 r = guestfs_get_e2uuid (g, device);
3536 caml_leave_blocking_section ();
3538 ocaml_guestfs_raise_error (g, "get_e2uuid");
3540 rv = caml_copy_string (r);
3546 ocaml_guestfs_fsck (value gv, value fstypev, value devicev)
3548 CAMLparam3 (gv, fstypev, devicev);
3551 guestfs_h *g = Guestfs_val (gv);
3553 caml_failwith ("fsck: used handle after closing it");
3555 const char *fstype = String_val (fstypev);
3556 const char *device = String_val (devicev);
3559 caml_enter_blocking_section ();
3560 r = guestfs_fsck (g, fstype, device);
3561 caml_leave_blocking_section ();
3563 ocaml_guestfs_raise_error (g, "fsck");
3570 ocaml_guestfs_zero (value gv, value devicev)
3572 CAMLparam2 (gv, devicev);
3575 guestfs_h *g = Guestfs_val (gv);
3577 caml_failwith ("zero: used handle after closing it");
3579 const char *device = String_val (devicev);
3582 caml_enter_blocking_section ();
3583 r = guestfs_zero (g, device);
3584 caml_leave_blocking_section ();
3586 ocaml_guestfs_raise_error (g, "zero");
3593 ocaml_guestfs_grub_install (value gv, value rootv, value devicev)
3595 CAMLparam3 (gv, rootv, devicev);
3598 guestfs_h *g = Guestfs_val (gv);
3600 caml_failwith ("grub_install: used handle after closing it");
3602 const char *root = String_val (rootv);
3603 const char *device = String_val (devicev);
3606 caml_enter_blocking_section ();
3607 r = guestfs_grub_install (g, root, device);
3608 caml_leave_blocking_section ();
3610 ocaml_guestfs_raise_error (g, "grub_install");
3617 ocaml_guestfs_cp (value gv, value srcv, value destv)
3619 CAMLparam3 (gv, srcv, destv);
3622 guestfs_h *g = Guestfs_val (gv);
3624 caml_failwith ("cp: used handle after closing it");
3626 const char *src = String_val (srcv);
3627 const char *dest = String_val (destv);
3630 caml_enter_blocking_section ();
3631 r = guestfs_cp (g, src, dest);
3632 caml_leave_blocking_section ();
3634 ocaml_guestfs_raise_error (g, "cp");
3641 ocaml_guestfs_cp_a (value gv, value srcv, value destv)
3643 CAMLparam3 (gv, srcv, destv);
3646 guestfs_h *g = Guestfs_val (gv);
3648 caml_failwith ("cp_a: used handle after closing it");
3650 const char *src = String_val (srcv);
3651 const char *dest = String_val (destv);
3654 caml_enter_blocking_section ();
3655 r = guestfs_cp_a (g, src, dest);
3656 caml_leave_blocking_section ();
3658 ocaml_guestfs_raise_error (g, "cp_a");
3665 ocaml_guestfs_mv (value gv, value srcv, value destv)
3667 CAMLparam3 (gv, srcv, destv);
3670 guestfs_h *g = Guestfs_val (gv);
3672 caml_failwith ("mv: used handle after closing it");
3674 const char *src = String_val (srcv);
3675 const char *dest = String_val (destv);
3678 caml_enter_blocking_section ();
3679 r = guestfs_mv (g, src, dest);
3680 caml_leave_blocking_section ();
3682 ocaml_guestfs_raise_error (g, "mv");
3689 ocaml_guestfs_drop_caches (value gv, value whattodropv)
3691 CAMLparam2 (gv, whattodropv);
3694 guestfs_h *g = Guestfs_val (gv);
3696 caml_failwith ("drop_caches: used handle after closing it");
3698 int whattodrop = Int_val (whattodropv);
3701 caml_enter_blocking_section ();
3702 r = guestfs_drop_caches (g, whattodrop);
3703 caml_leave_blocking_section ();
3705 ocaml_guestfs_raise_error (g, "drop_caches");
3712 ocaml_guestfs_dmesg (value gv)
3717 guestfs_h *g = Guestfs_val (gv);
3719 caml_failwith ("dmesg: used handle after closing it");
3723 caml_enter_blocking_section ();
3724 r = guestfs_dmesg (g);
3725 caml_leave_blocking_section ();
3727 ocaml_guestfs_raise_error (g, "dmesg");
3729 rv = caml_copy_string (r);
3735 ocaml_guestfs_ping_daemon (value gv)
3740 guestfs_h *g = Guestfs_val (gv);
3742 caml_failwith ("ping_daemon: used handle after closing it");
3746 caml_enter_blocking_section ();
3747 r = guestfs_ping_daemon (g);
3748 caml_leave_blocking_section ();
3750 ocaml_guestfs_raise_error (g, "ping_daemon");
3757 ocaml_guestfs_equal (value gv, value file1v, value file2v)
3759 CAMLparam3 (gv, file1v, file2v);
3762 guestfs_h *g = Guestfs_val (gv);
3764 caml_failwith ("equal: used handle after closing it");
3766 const char *file1 = String_val (file1v);
3767 const char *file2 = String_val (file2v);
3770 caml_enter_blocking_section ();
3771 r = guestfs_equal (g, file1, file2);
3772 caml_leave_blocking_section ();
3774 ocaml_guestfs_raise_error (g, "equal");
3781 ocaml_guestfs_strings (value gv, value pathv)
3783 CAMLparam2 (gv, pathv);
3786 guestfs_h *g = Guestfs_val (gv);
3788 caml_failwith ("strings: used handle after closing it");
3790 const char *path = String_val (pathv);
3794 caml_enter_blocking_section ();
3795 r = guestfs_strings (g, path);
3796 caml_leave_blocking_section ();
3798 ocaml_guestfs_raise_error (g, "strings");
3800 rv = caml_copy_string_array ((const char **) r);
3801 for (i = 0; r[i] != NULL; ++i) free (r[i]);
3807 ocaml_guestfs_strings_e (value gv, value encodingv, value pathv)
3809 CAMLparam3 (gv, encodingv, pathv);
3812 guestfs_h *g = Guestfs_val (gv);
3814 caml_failwith ("strings_e: used handle after closing it");
3816 const char *encoding = String_val (encodingv);
3817 const char *path = String_val (pathv);
3821 caml_enter_blocking_section ();
3822 r = guestfs_strings_e (g, encoding, path);
3823 caml_leave_blocking_section ();
3825 ocaml_guestfs_raise_error (g, "strings_e");
3827 rv = caml_copy_string_array ((const char **) r);
3828 for (i = 0; r[i] != NULL; ++i) free (r[i]);
3834 ocaml_guestfs_hexdump (value gv, value pathv)
3836 CAMLparam2 (gv, pathv);
3839 guestfs_h *g = Guestfs_val (gv);
3841 caml_failwith ("hexdump: used handle after closing it");
3843 const char *path = String_val (pathv);
3846 caml_enter_blocking_section ();
3847 r = guestfs_hexdump (g, path);
3848 caml_leave_blocking_section ();
3850 ocaml_guestfs_raise_error (g, "hexdump");
3852 rv = caml_copy_string (r);
3858 ocaml_guestfs_zerofree (value gv, value devicev)
3860 CAMLparam2 (gv, devicev);
3863 guestfs_h *g = Guestfs_val (gv);
3865 caml_failwith ("zerofree: used handle after closing it");
3867 const char *device = String_val (devicev);
3870 caml_enter_blocking_section ();
3871 r = guestfs_zerofree (g, device);
3872 caml_leave_blocking_section ();
3874 ocaml_guestfs_raise_error (g, "zerofree");
3881 ocaml_guestfs_pvresize (value gv, value devicev)
3883 CAMLparam2 (gv, devicev);
3886 guestfs_h *g = Guestfs_val (gv);
3888 caml_failwith ("pvresize: used handle after closing it");
3890 const char *device = String_val (devicev);
3893 caml_enter_blocking_section ();
3894 r = guestfs_pvresize (g, device);
3895 caml_leave_blocking_section ();
3897 ocaml_guestfs_raise_error (g, "pvresize");
3904 ocaml_guestfs_sfdisk_N (value gv, value devicev, value nv, value cylsv, value headsv, value sectorsv, value linev)
3906 CAMLparam5 (gv, devicev, nv, cylsv, headsv);
3907 CAMLxparam2 (sectorsv, linev);
3910 guestfs_h *g = Guestfs_val (gv);
3912 caml_failwith ("sfdisk_N: used handle after closing it");
3914 const char *device = String_val (devicev);
3915 int n = Int_val (nv);
3916 int cyls = Int_val (cylsv);
3917 int heads = Int_val (headsv);
3918 int sectors = Int_val (sectorsv);
3919 const char *line = String_val (linev);
3922 caml_enter_blocking_section ();
3923 r = guestfs_sfdisk_N (g, device, n, cyls, heads, sectors, line);
3924 caml_leave_blocking_section ();
3926 ocaml_guestfs_raise_error (g, "sfdisk_N");
3933 ocaml_guestfs_sfdisk_N_byte (value *argv, int argn)
3935 return ocaml_guestfs_sfdisk_N (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
3939 ocaml_guestfs_sfdisk_l (value gv, value devicev)
3941 CAMLparam2 (gv, devicev);
3944 guestfs_h *g = Guestfs_val (gv);
3946 caml_failwith ("sfdisk_l: used handle after closing it");
3948 const char *device = String_val (devicev);
3951 caml_enter_blocking_section ();
3952 r = guestfs_sfdisk_l (g, device);
3953 caml_leave_blocking_section ();
3955 ocaml_guestfs_raise_error (g, "sfdisk_l");
3957 rv = caml_copy_string (r);
3963 ocaml_guestfs_sfdisk_kernel_geometry (value gv, value devicev)
3965 CAMLparam2 (gv, devicev);
3968 guestfs_h *g = Guestfs_val (gv);
3970 caml_failwith ("sfdisk_kernel_geometry: used handle after closing it");
3972 const char *device = String_val (devicev);
3975 caml_enter_blocking_section ();
3976 r = guestfs_sfdisk_kernel_geometry (g, device);
3977 caml_leave_blocking_section ();
3979 ocaml_guestfs_raise_error (g, "sfdisk_kernel_geometry");
3981 rv = caml_copy_string (r);
3987 ocaml_guestfs_sfdisk_disk_geometry (value gv, value devicev)
3989 CAMLparam2 (gv, devicev);
3992 guestfs_h *g = Guestfs_val (gv);
3994 caml_failwith ("sfdisk_disk_geometry: used handle after closing it");
3996 const char *device = String_val (devicev);
3999 caml_enter_blocking_section ();
4000 r = guestfs_sfdisk_disk_geometry (g, device);
4001 caml_leave_blocking_section ();
4003 ocaml_guestfs_raise_error (g, "sfdisk_disk_geometry");
4005 rv = caml_copy_string (r);
4011 ocaml_guestfs_vg_activate_all (value gv, value activatev)
4013 CAMLparam2 (gv, activatev);
4016 guestfs_h *g = Guestfs_val (gv);
4018 caml_failwith ("vg_activate_all: used handle after closing it");
4020 int activate = Bool_val (activatev);
4023 caml_enter_blocking_section ();
4024 r = guestfs_vg_activate_all (g, activate);
4025 caml_leave_blocking_section ();
4027 ocaml_guestfs_raise_error (g, "vg_activate_all");
4034 ocaml_guestfs_vg_activate (value gv, value activatev, value volgroupsv)
4036 CAMLparam3 (gv, activatev, volgroupsv);
4039 guestfs_h *g = Guestfs_val (gv);
4041 caml_failwith ("vg_activate: used handle after closing it");
4043 int activate = Bool_val (activatev);
4044 char **volgroups = ocaml_guestfs_strings_val (g, volgroupsv);
4047 caml_enter_blocking_section ();
4048 r = guestfs_vg_activate (g, activate, volgroups);
4049 caml_leave_blocking_section ();
4050 ocaml_guestfs_free_strings (volgroups);
4052 ocaml_guestfs_raise_error (g, "vg_activate");
4059 ocaml_guestfs_lvresize (value gv, value devicev, value mbytesv)
4061 CAMLparam3 (gv, devicev, mbytesv);
4064 guestfs_h *g = Guestfs_val (gv);
4066 caml_failwith ("lvresize: used handle after closing it");
4068 const char *device = String_val (devicev);
4069 int mbytes = Int_val (mbytesv);
4072 caml_enter_blocking_section ();
4073 r = guestfs_lvresize (g, device, mbytes);
4074 caml_leave_blocking_section ();
4076 ocaml_guestfs_raise_error (g, "lvresize");
4083 ocaml_guestfs_resize2fs (value gv, value devicev)
4085 CAMLparam2 (gv, devicev);
4088 guestfs_h *g = Guestfs_val (gv);
4090 caml_failwith ("resize2fs: used handle after closing it");
4092 const char *device = String_val (devicev);
4095 caml_enter_blocking_section ();
4096 r = guestfs_resize2fs (g, device);
4097 caml_leave_blocking_section ();
4099 ocaml_guestfs_raise_error (g, "resize2fs");
4106 ocaml_guestfs_find (value gv, value directoryv)
4108 CAMLparam2 (gv, directoryv);
4111 guestfs_h *g = Guestfs_val (gv);
4113 caml_failwith ("find: used handle after closing it");
4115 const char *directory = String_val (directoryv);
4119 caml_enter_blocking_section ();
4120 r = guestfs_find (g, directory);
4121 caml_leave_blocking_section ();
4123 ocaml_guestfs_raise_error (g, "find");
4125 rv = caml_copy_string_array ((const char **) r);
4126 for (i = 0; r[i] != NULL; ++i) free (r[i]);
4132 ocaml_guestfs_e2fsck_f (value gv, value devicev)
4134 CAMLparam2 (gv, devicev);
4137 guestfs_h *g = Guestfs_val (gv);
4139 caml_failwith ("e2fsck_f: used handle after closing it");
4141 const char *device = String_val (devicev);
4144 caml_enter_blocking_section ();
4145 r = guestfs_e2fsck_f (g, device);
4146 caml_leave_blocking_section ();
4148 ocaml_guestfs_raise_error (g, "e2fsck_f");