1 /* libguestfs generated file
2 * WARNING: THIS FILE IS GENERATED BY 'src/generator.ml'.
3 * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
5 * Copyright (C) 2009 Red Hat Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <caml/config.h>
27 #include <caml/alloc.h>
28 #include <caml/callback.h>
29 #include <caml/fail.h>
30 #include <caml/memory.h>
31 #include <caml/mlvalues.h>
32 #include <caml/signals.h>
36 #include "guestfs_c.h"
38 /* Copy a hashtable of string pairs into an assoc-list. We return
39 * the list in reverse order, but hashtables aren't supposed to be
43 copy_table (char * const * argv)
46 CAMLlocal5 (rv, pairv, kv, vv, cons);
50 for (i = 0; argv[i] != NULL; i += 2) {
51 kv = caml_copy_string (argv[i]);
52 vv = caml_copy_string (argv[i+1]);
53 pairv = caml_alloc (2, 0);
54 Store_field (pairv, 0, kv);
55 Store_field (pairv, 1, vv);
56 cons = caml_alloc (2, 0);
57 Store_field (cons, 1, rv);
59 Store_field (cons, 0, pairv);
66 copy_lvm_pv (const struct guestfs_lvm_pv *pv)
71 rv = caml_alloc (14, 0);
72 v = caml_copy_string (pv->pv_name);
73 Store_field (rv, 0, v);
74 v = caml_alloc_string (32);
75 memcpy (String_val (v), pv->pv_uuid, 32);
76 Store_field (rv, 1, v);
77 v = caml_copy_string (pv->pv_fmt);
78 Store_field (rv, 2, v);
79 v = caml_copy_int64 (pv->pv_size);
80 Store_field (rv, 3, v);
81 v = caml_copy_int64 (pv->dev_size);
82 Store_field (rv, 4, v);
83 v = caml_copy_int64 (pv->pv_free);
84 Store_field (rv, 5, v);
85 v = caml_copy_int64 (pv->pv_used);
86 Store_field (rv, 6, v);
87 v = caml_copy_string (pv->pv_attr);
88 Store_field (rv, 7, v);
89 v = caml_copy_int64 (pv->pv_pe_count);
90 Store_field (rv, 8, v);
91 v = caml_copy_int64 (pv->pv_pe_alloc_count);
92 Store_field (rv, 9, v);
93 v = caml_copy_string (pv->pv_tags);
94 Store_field (rv, 10, v);
95 v = caml_copy_int64 (pv->pe_start);
96 Store_field (rv, 11, v);
97 v = caml_copy_int64 (pv->pv_mda_count);
98 Store_field (rv, 12, v);
99 v = caml_copy_int64 (pv->pv_mda_free);
100 Store_field (rv, 13, v);
104 static CAMLprim value
105 copy_lvm_pv_list (const struct guestfs_lvm_pv_list *pvs)
112 CAMLreturn (Atom (0));
114 rv = caml_alloc (pvs->len, 0);
115 for (i = 0; i < pvs->len; ++i) {
116 v = copy_lvm_pv (&pvs->val[i]);
117 caml_modify (&Field (rv, i), v);
123 static CAMLprim value
124 copy_lvm_vg (const struct guestfs_lvm_vg *vg)
129 rv = caml_alloc (19, 0);
130 v = caml_copy_string (vg->vg_name);
131 Store_field (rv, 0, v);
132 v = caml_alloc_string (32);
133 memcpy (String_val (v), vg->vg_uuid, 32);
134 Store_field (rv, 1, v);
135 v = caml_copy_string (vg->vg_fmt);
136 Store_field (rv, 2, v);
137 v = caml_copy_string (vg->vg_attr);
138 Store_field (rv, 3, v);
139 v = caml_copy_int64 (vg->vg_size);
140 Store_field (rv, 4, v);
141 v = caml_copy_int64 (vg->vg_free);
142 Store_field (rv, 5, v);
143 v = caml_copy_string (vg->vg_sysid);
144 Store_field (rv, 6, v);
145 v = caml_copy_int64 (vg->vg_extent_size);
146 Store_field (rv, 7, v);
147 v = caml_copy_int64 (vg->vg_extent_count);
148 Store_field (rv, 8, v);
149 v = caml_copy_int64 (vg->vg_free_count);
150 Store_field (rv, 9, v);
151 v = caml_copy_int64 (vg->max_lv);
152 Store_field (rv, 10, v);
153 v = caml_copy_int64 (vg->max_pv);
154 Store_field (rv, 11, v);
155 v = caml_copy_int64 (vg->pv_count);
156 Store_field (rv, 12, v);
157 v = caml_copy_int64 (vg->lv_count);
158 Store_field (rv, 13, v);
159 v = caml_copy_int64 (vg->snap_count);
160 Store_field (rv, 14, v);
161 v = caml_copy_int64 (vg->vg_seqno);
162 Store_field (rv, 15, v);
163 v = caml_copy_string (vg->vg_tags);
164 Store_field (rv, 16, v);
165 v = caml_copy_int64 (vg->vg_mda_count);
166 Store_field (rv, 17, v);
167 v = caml_copy_int64 (vg->vg_mda_free);
168 Store_field (rv, 18, v);
172 static CAMLprim value
173 copy_lvm_vg_list (const struct guestfs_lvm_vg_list *vgs)
180 CAMLreturn (Atom (0));
182 rv = caml_alloc (vgs->len, 0);
183 for (i = 0; i < vgs->len; ++i) {
184 v = copy_lvm_vg (&vgs->val[i]);
185 caml_modify (&Field (rv, i), v);
191 static CAMLprim value
192 copy_lvm_lv (const struct guestfs_lvm_lv *lv)
195 CAMLlocal3 (rv, v, v2);
197 rv = caml_alloc (16, 0);
198 v = caml_copy_string (lv->lv_name);
199 Store_field (rv, 0, v);
200 v = caml_alloc_string (32);
201 memcpy (String_val (v), lv->lv_uuid, 32);
202 Store_field (rv, 1, v);
203 v = caml_copy_string (lv->lv_attr);
204 Store_field (rv, 2, v);
205 v = caml_copy_int64 (lv->lv_major);
206 Store_field (rv, 3, v);
207 v = caml_copy_int64 (lv->lv_minor);
208 Store_field (rv, 4, v);
209 v = caml_copy_int64 (lv->lv_kernel_major);
210 Store_field (rv, 5, v);
211 v = caml_copy_int64 (lv->lv_kernel_minor);
212 Store_field (rv, 6, v);
213 v = caml_copy_int64 (lv->lv_size);
214 Store_field (rv, 7, v);
215 v = caml_copy_int64 (lv->seg_count);
216 Store_field (rv, 8, v);
217 v = caml_copy_string (lv->origin);
218 Store_field (rv, 9, v);
219 if (lv->snap_percent >= 0) { /* Some snap_percent */
220 v2 = caml_copy_double (lv->snap_percent);
221 v = caml_alloc (1, 0);
222 Store_field (v, 0, v2);
225 Store_field (rv, 10, v);
226 if (lv->copy_percent >= 0) { /* Some copy_percent */
227 v2 = caml_copy_double (lv->copy_percent);
228 v = caml_alloc (1, 0);
229 Store_field (v, 0, v2);
232 Store_field (rv, 11, v);
233 v = caml_copy_string (lv->move_pv);
234 Store_field (rv, 12, v);
235 v = caml_copy_string (lv->lv_tags);
236 Store_field (rv, 13, v);
237 v = caml_copy_string (lv->mirror_log);
238 Store_field (rv, 14, v);
239 v = caml_copy_string (lv->modules);
240 Store_field (rv, 15, v);
244 static CAMLprim value
245 copy_lvm_lv_list (const struct guestfs_lvm_lv_list *lvs)
252 CAMLreturn (Atom (0));
254 rv = caml_alloc (lvs->len, 0);
255 for (i = 0; i < lvs->len; ++i) {
256 v = copy_lvm_lv (&lvs->val[i]);
257 caml_modify (&Field (rv, i), v);
263 static CAMLprim value
264 copy_stat (const struct guestfs_stat *stat)
269 rv = caml_alloc (13, 0);
270 v = caml_copy_int64 (stat->dev);
271 Store_field (rv, 0, v);
272 v = caml_copy_int64 (stat->ino);
273 Store_field (rv, 1, v);
274 v = caml_copy_int64 (stat->mode);
275 Store_field (rv, 2, v);
276 v = caml_copy_int64 (stat->nlink);
277 Store_field (rv, 3, v);
278 v = caml_copy_int64 (stat->uid);
279 Store_field (rv, 4, v);
280 v = caml_copy_int64 (stat->gid);
281 Store_field (rv, 5, v);
282 v = caml_copy_int64 (stat->rdev);
283 Store_field (rv, 6, v);
284 v = caml_copy_int64 (stat->size);
285 Store_field (rv, 7, v);
286 v = caml_copy_int64 (stat->blksize);
287 Store_field (rv, 8, v);
288 v = caml_copy_int64 (stat->blocks);
289 Store_field (rv, 9, v);
290 v = caml_copy_int64 (stat->atime);
291 Store_field (rv, 10, v);
292 v = caml_copy_int64 (stat->mtime);
293 Store_field (rv, 11, v);
294 v = caml_copy_int64 (stat->ctime);
295 Store_field (rv, 12, v);
299 static CAMLprim value
300 copy_statvfs (const struct guestfs_statvfs *statvfs)
305 rv = caml_alloc (11, 0);
306 v = caml_copy_int64 (statvfs->bsize);
307 Store_field (rv, 0, v);
308 v = caml_copy_int64 (statvfs->frsize);
309 Store_field (rv, 1, v);
310 v = caml_copy_int64 (statvfs->blocks);
311 Store_field (rv, 2, v);
312 v = caml_copy_int64 (statvfs->bfree);
313 Store_field (rv, 3, v);
314 v = caml_copy_int64 (statvfs->bavail);
315 Store_field (rv, 4, v);
316 v = caml_copy_int64 (statvfs->files);
317 Store_field (rv, 5, v);
318 v = caml_copy_int64 (statvfs->ffree);
319 Store_field (rv, 6, v);
320 v = caml_copy_int64 (statvfs->favail);
321 Store_field (rv, 7, v);
322 v = caml_copy_int64 (statvfs->fsid);
323 Store_field (rv, 8, v);
324 v = caml_copy_int64 (statvfs->flag);
325 Store_field (rv, 9, v);
326 v = caml_copy_int64 (statvfs->namemax);
327 Store_field (rv, 10, v);
332 ocaml_guestfs_launch (value gv)
337 guestfs_h *g = Guestfs_val (gv);
339 caml_failwith ("launch: used handle after closing it");
343 caml_enter_blocking_section ();
344 r = guestfs_launch (g);
345 caml_leave_blocking_section ();
347 ocaml_guestfs_raise_error (g, "launch");
354 ocaml_guestfs_wait_ready (value gv)
359 guestfs_h *g = Guestfs_val (gv);
361 caml_failwith ("wait_ready: used handle after closing it");
365 caml_enter_blocking_section ();
366 r = guestfs_wait_ready (g);
367 caml_leave_blocking_section ();
369 ocaml_guestfs_raise_error (g, "wait_ready");
376 ocaml_guestfs_kill_subprocess (value gv)
381 guestfs_h *g = Guestfs_val (gv);
383 caml_failwith ("kill_subprocess: used handle after closing it");
387 caml_enter_blocking_section ();
388 r = guestfs_kill_subprocess (g);
389 caml_leave_blocking_section ();
391 ocaml_guestfs_raise_error (g, "kill_subprocess");
398 ocaml_guestfs_add_drive (value gv, value filenamev)
400 CAMLparam2 (gv, filenamev);
403 guestfs_h *g = Guestfs_val (gv);
405 caml_failwith ("add_drive: used handle after closing it");
407 const char *filename = String_val (filenamev);
410 caml_enter_blocking_section ();
411 r = guestfs_add_drive (g, filename);
412 caml_leave_blocking_section ();
414 ocaml_guestfs_raise_error (g, "add_drive");
421 ocaml_guestfs_add_cdrom (value gv, value filenamev)
423 CAMLparam2 (gv, filenamev);
426 guestfs_h *g = Guestfs_val (gv);
428 caml_failwith ("add_cdrom: used handle after closing it");
430 const char *filename = String_val (filenamev);
433 caml_enter_blocking_section ();
434 r = guestfs_add_cdrom (g, filename);
435 caml_leave_blocking_section ();
437 ocaml_guestfs_raise_error (g, "add_cdrom");
444 ocaml_guestfs_config (value gv, value qemuparamv, value qemuvaluev)
446 CAMLparam3 (gv, qemuparamv, qemuvaluev);
449 guestfs_h *g = Guestfs_val (gv);
451 caml_failwith ("config: used handle after closing it");
453 const char *qemuparam = String_val (qemuparamv);
454 const char *qemuvalue =
455 qemuvaluev != Val_int (0) ? String_val (Field (qemuvaluev, 0)) : NULL;
458 caml_enter_blocking_section ();
459 r = guestfs_config (g, qemuparam, qemuvalue);
460 caml_leave_blocking_section ();
462 ocaml_guestfs_raise_error (g, "config");
469 ocaml_guestfs_set_path (value gv, value pathv)
471 CAMLparam2 (gv, pathv);
474 guestfs_h *g = Guestfs_val (gv);
476 caml_failwith ("set_path: used handle after closing it");
478 const char *path = String_val (pathv);
481 caml_enter_blocking_section ();
482 r = guestfs_set_path (g, path);
483 caml_leave_blocking_section ();
485 ocaml_guestfs_raise_error (g, "set_path");
492 ocaml_guestfs_get_path (value gv)
497 guestfs_h *g = Guestfs_val (gv);
499 caml_failwith ("get_path: used handle after closing it");
503 caml_enter_blocking_section ();
504 r = guestfs_get_path (g);
505 caml_leave_blocking_section ();
507 ocaml_guestfs_raise_error (g, "get_path");
509 rv = caml_copy_string (r);
514 ocaml_guestfs_set_autosync (value gv, value autosyncv)
516 CAMLparam2 (gv, autosyncv);
519 guestfs_h *g = Guestfs_val (gv);
521 caml_failwith ("set_autosync: used handle after closing it");
523 int autosync = Bool_val (autosyncv);
526 caml_enter_blocking_section ();
527 r = guestfs_set_autosync (g, autosync);
528 caml_leave_blocking_section ();
530 ocaml_guestfs_raise_error (g, "set_autosync");
537 ocaml_guestfs_get_autosync (value gv)
542 guestfs_h *g = Guestfs_val (gv);
544 caml_failwith ("get_autosync: used handle after closing it");
548 caml_enter_blocking_section ();
549 r = guestfs_get_autosync (g);
550 caml_leave_blocking_section ();
552 ocaml_guestfs_raise_error (g, "get_autosync");
559 ocaml_guestfs_set_verbose (value gv, value verbosev)
561 CAMLparam2 (gv, verbosev);
564 guestfs_h *g = Guestfs_val (gv);
566 caml_failwith ("set_verbose: used handle after closing it");
568 int verbose = Bool_val (verbosev);
571 caml_enter_blocking_section ();
572 r = guestfs_set_verbose (g, verbose);
573 caml_leave_blocking_section ();
575 ocaml_guestfs_raise_error (g, "set_verbose");
582 ocaml_guestfs_get_verbose (value gv)
587 guestfs_h *g = Guestfs_val (gv);
589 caml_failwith ("get_verbose: used handle after closing it");
593 caml_enter_blocking_section ();
594 r = guestfs_get_verbose (g);
595 caml_leave_blocking_section ();
597 ocaml_guestfs_raise_error (g, "get_verbose");
604 ocaml_guestfs_is_ready (value gv)
609 guestfs_h *g = Guestfs_val (gv);
611 caml_failwith ("is_ready: used handle after closing it");
615 caml_enter_blocking_section ();
616 r = guestfs_is_ready (g);
617 caml_leave_blocking_section ();
619 ocaml_guestfs_raise_error (g, "is_ready");
626 ocaml_guestfs_is_config (value gv)
631 guestfs_h *g = Guestfs_val (gv);
633 caml_failwith ("is_config: used handle after closing it");
637 caml_enter_blocking_section ();
638 r = guestfs_is_config (g);
639 caml_leave_blocking_section ();
641 ocaml_guestfs_raise_error (g, "is_config");
648 ocaml_guestfs_is_launching (value gv)
653 guestfs_h *g = Guestfs_val (gv);
655 caml_failwith ("is_launching: used handle after closing it");
659 caml_enter_blocking_section ();
660 r = guestfs_is_launching (g);
661 caml_leave_blocking_section ();
663 ocaml_guestfs_raise_error (g, "is_launching");
670 ocaml_guestfs_is_busy (value gv)
675 guestfs_h *g = Guestfs_val (gv);
677 caml_failwith ("is_busy: used handle after closing it");
681 caml_enter_blocking_section ();
682 r = guestfs_is_busy (g);
683 caml_leave_blocking_section ();
685 ocaml_guestfs_raise_error (g, "is_busy");
692 ocaml_guestfs_get_state (value gv)
697 guestfs_h *g = Guestfs_val (gv);
699 caml_failwith ("get_state: used handle after closing it");
703 caml_enter_blocking_section ();
704 r = guestfs_get_state (g);
705 caml_leave_blocking_section ();
707 ocaml_guestfs_raise_error (g, "get_state");
714 ocaml_guestfs_mount (value gv, value devicev, value mountpointv)
716 CAMLparam3 (gv, devicev, mountpointv);
719 guestfs_h *g = Guestfs_val (gv);
721 caml_failwith ("mount: used handle after closing it");
723 const char *device = String_val (devicev);
724 const char *mountpoint = String_val (mountpointv);
727 caml_enter_blocking_section ();
728 r = guestfs_mount (g, device, mountpoint);
729 caml_leave_blocking_section ();
731 ocaml_guestfs_raise_error (g, "mount");
738 ocaml_guestfs_sync (value gv)
743 guestfs_h *g = Guestfs_val (gv);
745 caml_failwith ("sync: used handle after closing it");
749 caml_enter_blocking_section ();
750 r = guestfs_sync (g);
751 caml_leave_blocking_section ();
753 ocaml_guestfs_raise_error (g, "sync");
760 ocaml_guestfs_touch (value gv, value pathv)
762 CAMLparam2 (gv, pathv);
765 guestfs_h *g = Guestfs_val (gv);
767 caml_failwith ("touch: used handle after closing it");
769 const char *path = String_val (pathv);
772 caml_enter_blocking_section ();
773 r = guestfs_touch (g, path);
774 caml_leave_blocking_section ();
776 ocaml_guestfs_raise_error (g, "touch");
783 ocaml_guestfs_cat (value gv, value pathv)
785 CAMLparam2 (gv, pathv);
788 guestfs_h *g = Guestfs_val (gv);
790 caml_failwith ("cat: used handle after closing it");
792 const char *path = String_val (pathv);
795 caml_enter_blocking_section ();
796 r = guestfs_cat (g, path);
797 caml_leave_blocking_section ();
799 ocaml_guestfs_raise_error (g, "cat");
801 rv = caml_copy_string (r);
807 ocaml_guestfs_ll (value gv, value directoryv)
809 CAMLparam2 (gv, directoryv);
812 guestfs_h *g = Guestfs_val (gv);
814 caml_failwith ("ll: used handle after closing it");
816 const char *directory = String_val (directoryv);
819 caml_enter_blocking_section ();
820 r = guestfs_ll (g, directory);
821 caml_leave_blocking_section ();
823 ocaml_guestfs_raise_error (g, "ll");
825 rv = caml_copy_string (r);
831 ocaml_guestfs_ls (value gv, value directoryv)
833 CAMLparam2 (gv, directoryv);
836 guestfs_h *g = Guestfs_val (gv);
838 caml_failwith ("ls: used handle after closing it");
840 const char *directory = String_val (directoryv);
844 caml_enter_blocking_section ();
845 r = guestfs_ls (g, directory);
846 caml_leave_blocking_section ();
848 ocaml_guestfs_raise_error (g, "ls");
850 rv = caml_copy_string_array ((const char **) r);
851 for (i = 0; r[i] != NULL; ++i) free (r[i]);
857 ocaml_guestfs_list_devices (value gv)
862 guestfs_h *g = Guestfs_val (gv);
864 caml_failwith ("list_devices: used handle after closing it");
869 caml_enter_blocking_section ();
870 r = guestfs_list_devices (g);
871 caml_leave_blocking_section ();
873 ocaml_guestfs_raise_error (g, "list_devices");
875 rv = caml_copy_string_array ((const char **) r);
876 for (i = 0; r[i] != NULL; ++i) free (r[i]);
882 ocaml_guestfs_list_partitions (value gv)
887 guestfs_h *g = Guestfs_val (gv);
889 caml_failwith ("list_partitions: used handle after closing it");
894 caml_enter_blocking_section ();
895 r = guestfs_list_partitions (g);
896 caml_leave_blocking_section ();
898 ocaml_guestfs_raise_error (g, "list_partitions");
900 rv = caml_copy_string_array ((const char **) r);
901 for (i = 0; r[i] != NULL; ++i) free (r[i]);
907 ocaml_guestfs_pvs (value gv)
912 guestfs_h *g = Guestfs_val (gv);
914 caml_failwith ("pvs: used handle after closing it");
919 caml_enter_blocking_section ();
921 caml_leave_blocking_section ();
923 ocaml_guestfs_raise_error (g, "pvs");
925 rv = caml_copy_string_array ((const char **) r);
926 for (i = 0; r[i] != NULL; ++i) free (r[i]);
932 ocaml_guestfs_vgs (value gv)
937 guestfs_h *g = Guestfs_val (gv);
939 caml_failwith ("vgs: used handle after closing it");
944 caml_enter_blocking_section ();
946 caml_leave_blocking_section ();
948 ocaml_guestfs_raise_error (g, "vgs");
950 rv = caml_copy_string_array ((const char **) r);
951 for (i = 0; r[i] != NULL; ++i) free (r[i]);
957 ocaml_guestfs_lvs (value gv)
962 guestfs_h *g = Guestfs_val (gv);
964 caml_failwith ("lvs: used handle after closing it");
969 caml_enter_blocking_section ();
971 caml_leave_blocking_section ();
973 ocaml_guestfs_raise_error (g, "lvs");
975 rv = caml_copy_string_array ((const char **) r);
976 for (i = 0; r[i] != NULL; ++i) free (r[i]);
982 ocaml_guestfs_pvs_full (value gv)
987 guestfs_h *g = Guestfs_val (gv);
989 caml_failwith ("pvs_full: used handle after closing it");
991 struct guestfs_lvm_pv_list *r;
993 caml_enter_blocking_section ();
994 r = guestfs_pvs_full (g);
995 caml_leave_blocking_section ();
997 ocaml_guestfs_raise_error (g, "pvs_full");
999 rv = copy_lvm_pv_list (r);
1000 guestfs_free_lvm_pv_list (r);
1005 ocaml_guestfs_vgs_full (value gv)
1010 guestfs_h *g = Guestfs_val (gv);
1012 caml_failwith ("vgs_full: used handle after closing it");
1014 struct guestfs_lvm_vg_list *r;
1016 caml_enter_blocking_section ();
1017 r = guestfs_vgs_full (g);
1018 caml_leave_blocking_section ();
1020 ocaml_guestfs_raise_error (g, "vgs_full");
1022 rv = copy_lvm_vg_list (r);
1023 guestfs_free_lvm_vg_list (r);
1028 ocaml_guestfs_lvs_full (value gv)
1033 guestfs_h *g = Guestfs_val (gv);
1035 caml_failwith ("lvs_full: used handle after closing it");
1037 struct guestfs_lvm_lv_list *r;
1039 caml_enter_blocking_section ();
1040 r = guestfs_lvs_full (g);
1041 caml_leave_blocking_section ();
1043 ocaml_guestfs_raise_error (g, "lvs_full");
1045 rv = copy_lvm_lv_list (r);
1046 guestfs_free_lvm_lv_list (r);
1051 ocaml_guestfs_read_lines (value gv, value pathv)
1053 CAMLparam2 (gv, pathv);
1056 guestfs_h *g = Guestfs_val (gv);
1058 caml_failwith ("read_lines: used handle after closing it");
1060 const char *path = String_val (pathv);
1064 caml_enter_blocking_section ();
1065 r = guestfs_read_lines (g, path);
1066 caml_leave_blocking_section ();
1068 ocaml_guestfs_raise_error (g, "read_lines");
1070 rv = caml_copy_string_array ((const char **) r);
1071 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1077 ocaml_guestfs_aug_init (value gv, value rootv, value flagsv)
1079 CAMLparam3 (gv, rootv, flagsv);
1082 guestfs_h *g = Guestfs_val (gv);
1084 caml_failwith ("aug_init: used handle after closing it");
1086 const char *root = String_val (rootv);
1087 int flags = Int_val (flagsv);
1090 caml_enter_blocking_section ();
1091 r = guestfs_aug_init (g, root, flags);
1092 caml_leave_blocking_section ();
1094 ocaml_guestfs_raise_error (g, "aug_init");
1101 ocaml_guestfs_aug_close (value gv)
1106 guestfs_h *g = Guestfs_val (gv);
1108 caml_failwith ("aug_close: used handle after closing it");
1112 caml_enter_blocking_section ();
1113 r = guestfs_aug_close (g);
1114 caml_leave_blocking_section ();
1116 ocaml_guestfs_raise_error (g, "aug_close");
1123 ocaml_guestfs_aug_defvar (value gv, value namev, value exprv)
1125 CAMLparam3 (gv, namev, exprv);
1128 guestfs_h *g = Guestfs_val (gv);
1130 caml_failwith ("aug_defvar: used handle after closing it");
1132 const char *name = String_val (namev);
1134 exprv != Val_int (0) ? String_val (Field (exprv, 0)) : NULL;
1137 caml_enter_blocking_section ();
1138 r = guestfs_aug_defvar (g, name, expr);
1139 caml_leave_blocking_section ();
1141 ocaml_guestfs_raise_error (g, "aug_defvar");
1148 ocaml_guestfs_aug_defnode (value gv, value namev, value exprv, value valv)
1150 CAMLparam4 (gv, namev, exprv, valv);
1153 guestfs_h *g = Guestfs_val (gv);
1155 caml_failwith ("aug_defnode: used handle after closing it");
1157 const char *name = String_val (namev);
1158 const char *expr = String_val (exprv);
1159 const char *val = String_val (valv);
1160 struct guestfs_int_bool *r;
1162 caml_enter_blocking_section ();
1163 r = guestfs_aug_defnode (g, name, expr, val);
1164 caml_leave_blocking_section ();
1166 ocaml_guestfs_raise_error (g, "aug_defnode");
1168 rv = caml_alloc (2, 0);
1169 Store_field (rv, 0, Val_int (r->i));
1170 Store_field (rv, 1, Val_bool (r->b));
1171 guestfs_free_int_bool (r);
1176 ocaml_guestfs_aug_get (value gv, value pathv)
1178 CAMLparam2 (gv, pathv);
1181 guestfs_h *g = Guestfs_val (gv);
1183 caml_failwith ("aug_get: used handle after closing it");
1185 const char *path = String_val (pathv);
1188 caml_enter_blocking_section ();
1189 r = guestfs_aug_get (g, path);
1190 caml_leave_blocking_section ();
1192 ocaml_guestfs_raise_error (g, "aug_get");
1194 rv = caml_copy_string (r);
1200 ocaml_guestfs_aug_set (value gv, value pathv, value valv)
1202 CAMLparam3 (gv, pathv, valv);
1205 guestfs_h *g = Guestfs_val (gv);
1207 caml_failwith ("aug_set: used handle after closing it");
1209 const char *path = String_val (pathv);
1210 const char *val = String_val (valv);
1213 caml_enter_blocking_section ();
1214 r = guestfs_aug_set (g, path, val);
1215 caml_leave_blocking_section ();
1217 ocaml_guestfs_raise_error (g, "aug_set");
1224 ocaml_guestfs_aug_insert (value gv, value pathv, value labelv, value beforev)
1226 CAMLparam4 (gv, pathv, labelv, beforev);
1229 guestfs_h *g = Guestfs_val (gv);
1231 caml_failwith ("aug_insert: used handle after closing it");
1233 const char *path = String_val (pathv);
1234 const char *label = String_val (labelv);
1235 int before = Bool_val (beforev);
1238 caml_enter_blocking_section ();
1239 r = guestfs_aug_insert (g, path, label, before);
1240 caml_leave_blocking_section ();
1242 ocaml_guestfs_raise_error (g, "aug_insert");
1249 ocaml_guestfs_aug_rm (value gv, value pathv)
1251 CAMLparam2 (gv, pathv);
1254 guestfs_h *g = Guestfs_val (gv);
1256 caml_failwith ("aug_rm: used handle after closing it");
1258 const char *path = String_val (pathv);
1261 caml_enter_blocking_section ();
1262 r = guestfs_aug_rm (g, path);
1263 caml_leave_blocking_section ();
1265 ocaml_guestfs_raise_error (g, "aug_rm");
1272 ocaml_guestfs_aug_mv (value gv, value srcv, value destv)
1274 CAMLparam3 (gv, srcv, destv);
1277 guestfs_h *g = Guestfs_val (gv);
1279 caml_failwith ("aug_mv: used handle after closing it");
1281 const char *src = String_val (srcv);
1282 const char *dest = String_val (destv);
1285 caml_enter_blocking_section ();
1286 r = guestfs_aug_mv (g, src, dest);
1287 caml_leave_blocking_section ();
1289 ocaml_guestfs_raise_error (g, "aug_mv");
1296 ocaml_guestfs_aug_match (value gv, value pathv)
1298 CAMLparam2 (gv, pathv);
1301 guestfs_h *g = Guestfs_val (gv);
1303 caml_failwith ("aug_match: used handle after closing it");
1305 const char *path = String_val (pathv);
1309 caml_enter_blocking_section ();
1310 r = guestfs_aug_match (g, path);
1311 caml_leave_blocking_section ();
1313 ocaml_guestfs_raise_error (g, "aug_match");
1315 rv = caml_copy_string_array ((const char **) r);
1316 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1322 ocaml_guestfs_aug_save (value gv)
1327 guestfs_h *g = Guestfs_val (gv);
1329 caml_failwith ("aug_save: used handle after closing it");
1333 caml_enter_blocking_section ();
1334 r = guestfs_aug_save (g);
1335 caml_leave_blocking_section ();
1337 ocaml_guestfs_raise_error (g, "aug_save");
1344 ocaml_guestfs_aug_load (value gv)
1349 guestfs_h *g = Guestfs_val (gv);
1351 caml_failwith ("aug_load: used handle after closing it");
1355 caml_enter_blocking_section ();
1356 r = guestfs_aug_load (g);
1357 caml_leave_blocking_section ();
1359 ocaml_guestfs_raise_error (g, "aug_load");
1366 ocaml_guestfs_aug_ls (value gv, value pathv)
1368 CAMLparam2 (gv, pathv);
1371 guestfs_h *g = Guestfs_val (gv);
1373 caml_failwith ("aug_ls: used handle after closing it");
1375 const char *path = String_val (pathv);
1379 caml_enter_blocking_section ();
1380 r = guestfs_aug_ls (g, path);
1381 caml_leave_blocking_section ();
1383 ocaml_guestfs_raise_error (g, "aug_ls");
1385 rv = caml_copy_string_array ((const char **) r);
1386 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1392 ocaml_guestfs_rm (value gv, value pathv)
1394 CAMLparam2 (gv, pathv);
1397 guestfs_h *g = Guestfs_val (gv);
1399 caml_failwith ("rm: used handle after closing it");
1401 const char *path = String_val (pathv);
1404 caml_enter_blocking_section ();
1405 r = guestfs_rm (g, path);
1406 caml_leave_blocking_section ();
1408 ocaml_guestfs_raise_error (g, "rm");
1415 ocaml_guestfs_rmdir (value gv, value pathv)
1417 CAMLparam2 (gv, pathv);
1420 guestfs_h *g = Guestfs_val (gv);
1422 caml_failwith ("rmdir: used handle after closing it");
1424 const char *path = String_val (pathv);
1427 caml_enter_blocking_section ();
1428 r = guestfs_rmdir (g, path);
1429 caml_leave_blocking_section ();
1431 ocaml_guestfs_raise_error (g, "rmdir");
1438 ocaml_guestfs_rm_rf (value gv, value pathv)
1440 CAMLparam2 (gv, pathv);
1443 guestfs_h *g = Guestfs_val (gv);
1445 caml_failwith ("rm_rf: used handle after closing it");
1447 const char *path = String_val (pathv);
1450 caml_enter_blocking_section ();
1451 r = guestfs_rm_rf (g, path);
1452 caml_leave_blocking_section ();
1454 ocaml_guestfs_raise_error (g, "rm_rf");
1461 ocaml_guestfs_mkdir (value gv, value pathv)
1463 CAMLparam2 (gv, pathv);
1466 guestfs_h *g = Guestfs_val (gv);
1468 caml_failwith ("mkdir: used handle after closing it");
1470 const char *path = String_val (pathv);
1473 caml_enter_blocking_section ();
1474 r = guestfs_mkdir (g, path);
1475 caml_leave_blocking_section ();
1477 ocaml_guestfs_raise_error (g, "mkdir");
1484 ocaml_guestfs_mkdir_p (value gv, value pathv)
1486 CAMLparam2 (gv, pathv);
1489 guestfs_h *g = Guestfs_val (gv);
1491 caml_failwith ("mkdir_p: used handle after closing it");
1493 const char *path = String_val (pathv);
1496 caml_enter_blocking_section ();
1497 r = guestfs_mkdir_p (g, path);
1498 caml_leave_blocking_section ();
1500 ocaml_guestfs_raise_error (g, "mkdir_p");
1507 ocaml_guestfs_chmod (value gv, value modev, value pathv)
1509 CAMLparam3 (gv, modev, pathv);
1512 guestfs_h *g = Guestfs_val (gv);
1514 caml_failwith ("chmod: used handle after closing it");
1516 int mode = Int_val (modev);
1517 const char *path = String_val (pathv);
1520 caml_enter_blocking_section ();
1521 r = guestfs_chmod (g, mode, path);
1522 caml_leave_blocking_section ();
1524 ocaml_guestfs_raise_error (g, "chmod");
1531 ocaml_guestfs_chown (value gv, value ownerv, value groupv, value pathv)
1533 CAMLparam4 (gv, ownerv, groupv, pathv);
1536 guestfs_h *g = Guestfs_val (gv);
1538 caml_failwith ("chown: used handle after closing it");
1540 int owner = Int_val (ownerv);
1541 int group = Int_val (groupv);
1542 const char *path = String_val (pathv);
1545 caml_enter_blocking_section ();
1546 r = guestfs_chown (g, owner, group, path);
1547 caml_leave_blocking_section ();
1549 ocaml_guestfs_raise_error (g, "chown");
1556 ocaml_guestfs_exists (value gv, value pathv)
1558 CAMLparam2 (gv, pathv);
1561 guestfs_h *g = Guestfs_val (gv);
1563 caml_failwith ("exists: used handle after closing it");
1565 const char *path = String_val (pathv);
1568 caml_enter_blocking_section ();
1569 r = guestfs_exists (g, path);
1570 caml_leave_blocking_section ();
1572 ocaml_guestfs_raise_error (g, "exists");
1579 ocaml_guestfs_is_file (value gv, value pathv)
1581 CAMLparam2 (gv, pathv);
1584 guestfs_h *g = Guestfs_val (gv);
1586 caml_failwith ("is_file: used handle after closing it");
1588 const char *path = String_val (pathv);
1591 caml_enter_blocking_section ();
1592 r = guestfs_is_file (g, path);
1593 caml_leave_blocking_section ();
1595 ocaml_guestfs_raise_error (g, "is_file");
1602 ocaml_guestfs_is_dir (value gv, value pathv)
1604 CAMLparam2 (gv, pathv);
1607 guestfs_h *g = Guestfs_val (gv);
1609 caml_failwith ("is_dir: used handle after closing it");
1611 const char *path = String_val (pathv);
1614 caml_enter_blocking_section ();
1615 r = guestfs_is_dir (g, path);
1616 caml_leave_blocking_section ();
1618 ocaml_guestfs_raise_error (g, "is_dir");
1625 ocaml_guestfs_pvcreate (value gv, value devicev)
1627 CAMLparam2 (gv, devicev);
1630 guestfs_h *g = Guestfs_val (gv);
1632 caml_failwith ("pvcreate: used handle after closing it");
1634 const char *device = String_val (devicev);
1637 caml_enter_blocking_section ();
1638 r = guestfs_pvcreate (g, device);
1639 caml_leave_blocking_section ();
1641 ocaml_guestfs_raise_error (g, "pvcreate");
1648 ocaml_guestfs_vgcreate (value gv, value volgroupv, value physvolsv)
1650 CAMLparam3 (gv, volgroupv, physvolsv);
1653 guestfs_h *g = Guestfs_val (gv);
1655 caml_failwith ("vgcreate: used handle after closing it");
1657 const char *volgroup = String_val (volgroupv);
1658 char **physvols = ocaml_guestfs_strings_val (physvolsv);
1661 caml_enter_blocking_section ();
1662 r = guestfs_vgcreate (g, volgroup, physvols);
1663 caml_leave_blocking_section ();
1664 ocaml_guestfs_free_strings (physvols);
1666 ocaml_guestfs_raise_error (g, "vgcreate");
1673 ocaml_guestfs_lvcreate (value gv, value logvolv, value volgroupv, value mbytesv)
1675 CAMLparam4 (gv, logvolv, volgroupv, mbytesv);
1678 guestfs_h *g = Guestfs_val (gv);
1680 caml_failwith ("lvcreate: used handle after closing it");
1682 const char *logvol = String_val (logvolv);
1683 const char *volgroup = String_val (volgroupv);
1684 int mbytes = Int_val (mbytesv);
1687 caml_enter_blocking_section ();
1688 r = guestfs_lvcreate (g, logvol, volgroup, mbytes);
1689 caml_leave_blocking_section ();
1691 ocaml_guestfs_raise_error (g, "lvcreate");
1698 ocaml_guestfs_mkfs (value gv, value fstypev, value devicev)
1700 CAMLparam3 (gv, fstypev, devicev);
1703 guestfs_h *g = Guestfs_val (gv);
1705 caml_failwith ("mkfs: used handle after closing it");
1707 const char *fstype = String_val (fstypev);
1708 const char *device = String_val (devicev);
1711 caml_enter_blocking_section ();
1712 r = guestfs_mkfs (g, fstype, device);
1713 caml_leave_blocking_section ();
1715 ocaml_guestfs_raise_error (g, "mkfs");
1722 ocaml_guestfs_sfdisk (value gv, value devicev, value cylsv, value headsv, value sectorsv, value linesv)
1724 CAMLparam5 (gv, devicev, cylsv, headsv, sectorsv);
1725 CAMLxparam1 (linesv);
1728 guestfs_h *g = Guestfs_val (gv);
1730 caml_failwith ("sfdisk: used handle after closing it");
1732 const char *device = String_val (devicev);
1733 int cyls = Int_val (cylsv);
1734 int heads = Int_val (headsv);
1735 int sectors = Int_val (sectorsv);
1736 char **lines = ocaml_guestfs_strings_val (linesv);
1739 caml_enter_blocking_section ();
1740 r = guestfs_sfdisk (g, device, cyls, heads, sectors, lines);
1741 caml_leave_blocking_section ();
1742 ocaml_guestfs_free_strings (lines);
1744 ocaml_guestfs_raise_error (g, "sfdisk");
1751 ocaml_guestfs_sfdisk_byte (value *argv, int argn)
1753 return ocaml_guestfs_sfdisk (argv[0], argv[0], argv[1], argv[2], argv[3], argv[4]);
1757 ocaml_guestfs_write_file (value gv, value pathv, value contentv, value sizev)
1759 CAMLparam4 (gv, pathv, contentv, sizev);
1762 guestfs_h *g = Guestfs_val (gv);
1764 caml_failwith ("write_file: used handle after closing it");
1766 const char *path = String_val (pathv);
1767 const char *content = String_val (contentv);
1768 int size = Int_val (sizev);
1771 caml_enter_blocking_section ();
1772 r = guestfs_write_file (g, path, content, size);
1773 caml_leave_blocking_section ();
1775 ocaml_guestfs_raise_error (g, "write_file");
1782 ocaml_guestfs_umount (value gv, value pathordevicev)
1784 CAMLparam2 (gv, pathordevicev);
1787 guestfs_h *g = Guestfs_val (gv);
1789 caml_failwith ("umount: used handle after closing it");
1791 const char *pathordevice = String_val (pathordevicev);
1794 caml_enter_blocking_section ();
1795 r = guestfs_umount (g, pathordevice);
1796 caml_leave_blocking_section ();
1798 ocaml_guestfs_raise_error (g, "umount");
1805 ocaml_guestfs_mounts (value gv)
1810 guestfs_h *g = Guestfs_val (gv);
1812 caml_failwith ("mounts: used handle after closing it");
1817 caml_enter_blocking_section ();
1818 r = guestfs_mounts (g);
1819 caml_leave_blocking_section ();
1821 ocaml_guestfs_raise_error (g, "mounts");
1823 rv = caml_copy_string_array ((const char **) r);
1824 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1830 ocaml_guestfs_umount_all (value gv)
1835 guestfs_h *g = Guestfs_val (gv);
1837 caml_failwith ("umount_all: used handle after closing it");
1841 caml_enter_blocking_section ();
1842 r = guestfs_umount_all (g);
1843 caml_leave_blocking_section ();
1845 ocaml_guestfs_raise_error (g, "umount_all");
1852 ocaml_guestfs_lvm_remove_all (value gv)
1857 guestfs_h *g = Guestfs_val (gv);
1859 caml_failwith ("lvm_remove_all: used handle after closing it");
1863 caml_enter_blocking_section ();
1864 r = guestfs_lvm_remove_all (g);
1865 caml_leave_blocking_section ();
1867 ocaml_guestfs_raise_error (g, "lvm_remove_all");
1874 ocaml_guestfs_file (value gv, value pathv)
1876 CAMLparam2 (gv, pathv);
1879 guestfs_h *g = Guestfs_val (gv);
1881 caml_failwith ("file: used handle after closing it");
1883 const char *path = String_val (pathv);
1886 caml_enter_blocking_section ();
1887 r = guestfs_file (g, path);
1888 caml_leave_blocking_section ();
1890 ocaml_guestfs_raise_error (g, "file");
1892 rv = caml_copy_string (r);
1898 ocaml_guestfs_command (value gv, value argumentsv)
1900 CAMLparam2 (gv, argumentsv);
1903 guestfs_h *g = Guestfs_val (gv);
1905 caml_failwith ("command: used handle after closing it");
1907 char **arguments = ocaml_guestfs_strings_val (argumentsv);
1910 caml_enter_blocking_section ();
1911 r = guestfs_command (g, arguments);
1912 caml_leave_blocking_section ();
1913 ocaml_guestfs_free_strings (arguments);
1915 ocaml_guestfs_raise_error (g, "command");
1917 rv = caml_copy_string (r);
1923 ocaml_guestfs_command_lines (value gv, value argumentsv)
1925 CAMLparam2 (gv, argumentsv);
1928 guestfs_h *g = Guestfs_val (gv);
1930 caml_failwith ("command_lines: used handle after closing it");
1932 char **arguments = ocaml_guestfs_strings_val (argumentsv);
1936 caml_enter_blocking_section ();
1937 r = guestfs_command_lines (g, arguments);
1938 caml_leave_blocking_section ();
1939 ocaml_guestfs_free_strings (arguments);
1941 ocaml_guestfs_raise_error (g, "command_lines");
1943 rv = caml_copy_string_array ((const char **) r);
1944 for (i = 0; r[i] != NULL; ++i) free (r[i]);
1950 ocaml_guestfs_stat (value gv, value pathv)
1952 CAMLparam2 (gv, pathv);
1955 guestfs_h *g = Guestfs_val (gv);
1957 caml_failwith ("stat: used handle after closing it");
1959 const char *path = String_val (pathv);
1960 struct guestfs_stat *r;
1962 caml_enter_blocking_section ();
1963 r = guestfs_stat (g, path);
1964 caml_leave_blocking_section ();
1966 ocaml_guestfs_raise_error (g, "stat");
1974 ocaml_guestfs_lstat (value gv, value pathv)
1976 CAMLparam2 (gv, pathv);
1979 guestfs_h *g = Guestfs_val (gv);
1981 caml_failwith ("lstat: used handle after closing it");
1983 const char *path = String_val (pathv);
1984 struct guestfs_stat *r;
1986 caml_enter_blocking_section ();
1987 r = guestfs_lstat (g, path);
1988 caml_leave_blocking_section ();
1990 ocaml_guestfs_raise_error (g, "lstat");
1998 ocaml_guestfs_statvfs (value gv, value pathv)
2000 CAMLparam2 (gv, pathv);
2003 guestfs_h *g = Guestfs_val (gv);
2005 caml_failwith ("statvfs: used handle after closing it");
2007 const char *path = String_val (pathv);
2008 struct guestfs_statvfs *r;
2010 caml_enter_blocking_section ();
2011 r = guestfs_statvfs (g, path);
2012 caml_leave_blocking_section ();
2014 ocaml_guestfs_raise_error (g, "statvfs");
2016 rv = copy_statvfs (r);
2022 ocaml_guestfs_tune2fs_l (value gv, value devicev)
2024 CAMLparam2 (gv, devicev);
2027 guestfs_h *g = Guestfs_val (gv);
2029 caml_failwith ("tune2fs_l: used handle after closing it");
2031 const char *device = String_val (devicev);
2035 caml_enter_blocking_section ();
2036 r = guestfs_tune2fs_l (g, device);
2037 caml_leave_blocking_section ();
2039 ocaml_guestfs_raise_error (g, "tune2fs_l");
2041 rv = copy_table (r);
2042 for (i = 0; r[i] != NULL; ++i) free (r[i]);
2048 ocaml_guestfs_blockdev_setro (value gv, value devicev)
2050 CAMLparam2 (gv, devicev);
2053 guestfs_h *g = Guestfs_val (gv);
2055 caml_failwith ("blockdev_setro: used handle after closing it");
2057 const char *device = String_val (devicev);
2060 caml_enter_blocking_section ();
2061 r = guestfs_blockdev_setro (g, device);
2062 caml_leave_blocking_section ();
2064 ocaml_guestfs_raise_error (g, "blockdev_setro");
2071 ocaml_guestfs_blockdev_setrw (value gv, value devicev)
2073 CAMLparam2 (gv, devicev);
2076 guestfs_h *g = Guestfs_val (gv);
2078 caml_failwith ("blockdev_setrw: used handle after closing it");
2080 const char *device = String_val (devicev);
2083 caml_enter_blocking_section ();
2084 r = guestfs_blockdev_setrw (g, device);
2085 caml_leave_blocking_section ();
2087 ocaml_guestfs_raise_error (g, "blockdev_setrw");
2094 ocaml_guestfs_blockdev_getro (value gv, value devicev)
2096 CAMLparam2 (gv, devicev);
2099 guestfs_h *g = Guestfs_val (gv);
2101 caml_failwith ("blockdev_getro: used handle after closing it");
2103 const char *device = String_val (devicev);
2106 caml_enter_blocking_section ();
2107 r = guestfs_blockdev_getro (g, device);
2108 caml_leave_blocking_section ();
2110 ocaml_guestfs_raise_error (g, "blockdev_getro");
2117 ocaml_guestfs_blockdev_getss (value gv, value devicev)
2119 CAMLparam2 (gv, devicev);
2122 guestfs_h *g = Guestfs_val (gv);
2124 caml_failwith ("blockdev_getss: used handle after closing it");
2126 const char *device = String_val (devicev);
2129 caml_enter_blocking_section ();
2130 r = guestfs_blockdev_getss (g, device);
2131 caml_leave_blocking_section ();
2133 ocaml_guestfs_raise_error (g, "blockdev_getss");
2140 ocaml_guestfs_blockdev_getbsz (value gv, value devicev)
2142 CAMLparam2 (gv, devicev);
2145 guestfs_h *g = Guestfs_val (gv);
2147 caml_failwith ("blockdev_getbsz: used handle after closing it");
2149 const char *device = String_val (devicev);
2152 caml_enter_blocking_section ();
2153 r = guestfs_blockdev_getbsz (g, device);
2154 caml_leave_blocking_section ();
2156 ocaml_guestfs_raise_error (g, "blockdev_getbsz");
2163 ocaml_guestfs_blockdev_setbsz (value gv, value devicev, value blocksizev)
2165 CAMLparam3 (gv, devicev, blocksizev);
2168 guestfs_h *g = Guestfs_val (gv);
2170 caml_failwith ("blockdev_setbsz: used handle after closing it");
2172 const char *device = String_val (devicev);
2173 int blocksize = Int_val (blocksizev);
2176 caml_enter_blocking_section ();
2177 r = guestfs_blockdev_setbsz (g, device, blocksize);
2178 caml_leave_blocking_section ();
2180 ocaml_guestfs_raise_error (g, "blockdev_setbsz");
2187 ocaml_guestfs_blockdev_getsz (value gv, value devicev)
2189 CAMLparam2 (gv, devicev);
2192 guestfs_h *g = Guestfs_val (gv);
2194 caml_failwith ("blockdev_getsz: used handle after closing it");
2196 const char *device = String_val (devicev);
2199 caml_enter_blocking_section ();
2200 r = guestfs_blockdev_getsz (g, device);
2201 caml_leave_blocking_section ();
2203 ocaml_guestfs_raise_error (g, "blockdev_getsz");
2205 rv = caml_copy_int64 (r);
2210 ocaml_guestfs_blockdev_getsize64 (value gv, value devicev)
2212 CAMLparam2 (gv, devicev);
2215 guestfs_h *g = Guestfs_val (gv);
2217 caml_failwith ("blockdev_getsize64: used handle after closing it");
2219 const char *device = String_val (devicev);
2222 caml_enter_blocking_section ();
2223 r = guestfs_blockdev_getsize64 (g, device);
2224 caml_leave_blocking_section ();
2226 ocaml_guestfs_raise_error (g, "blockdev_getsize64");
2228 rv = caml_copy_int64 (r);
2233 ocaml_guestfs_blockdev_flushbufs (value gv, value devicev)
2235 CAMLparam2 (gv, devicev);
2238 guestfs_h *g = Guestfs_val (gv);
2240 caml_failwith ("blockdev_flushbufs: used handle after closing it");
2242 const char *device = String_val (devicev);
2245 caml_enter_blocking_section ();
2246 r = guestfs_blockdev_flushbufs (g, device);
2247 caml_leave_blocking_section ();
2249 ocaml_guestfs_raise_error (g, "blockdev_flushbufs");
2256 ocaml_guestfs_blockdev_rereadpt (value gv, value devicev)
2258 CAMLparam2 (gv, devicev);
2261 guestfs_h *g = Guestfs_val (gv);
2263 caml_failwith ("blockdev_rereadpt: used handle after closing it");
2265 const char *device = String_val (devicev);
2268 caml_enter_blocking_section ();
2269 r = guestfs_blockdev_rereadpt (g, device);
2270 caml_leave_blocking_section ();
2272 ocaml_guestfs_raise_error (g, "blockdev_rereadpt");