1 /* !!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!!
3 * THIS FILE IS AUTOMATICALLY GENERATED BY 'generator.pl'.
5 * Any changes you make to this file may be overwritten.
8 /* OCaml bindings for libvirt.
9 * (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc.
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version,
16 * with the OCaml linking exception described in ../COPYING.LIB.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
34 #include <libvirt/libvirt.h>
35 #include <libvirt/virterror.h>
37 #include <caml/config.h>
38 #include <caml/alloc.h>
39 #include <caml/callback.h>
40 #include <caml/custom.h>
41 #include <caml/fail.h>
42 #include <caml/memory.h>
43 #include <caml/misc.h>
44 #include <caml/mlvalues.h>
45 #include <caml/signals.h>
47 #include "libvirt_c_prologue.c"
49 #include "libvirt_c_oneoffs.c"
51 /* Automatically generated binding for virConnectClose.
52 * In generator.pl this function has signature "conn : free".
56 ocaml_libvirt_connect_close (value connv)
60 virConnectPtr conn = Connect_val (connv);
63 NONBLOCKING (r = virConnectClose (conn));
64 CHECK_ERROR (r == -1, conn, "virConnectClose");
66 /* So that we don't double-free in the finalizer: */
67 Connect_val (connv) = NULL;
69 CAMLreturn (Val_unit);
72 /* Automatically generated binding for virConnectGetHostname.
73 * In generator.pl this function has signature "conn : string".
76 #ifdef HAVE_WEAK_SYMBOLS
77 #ifdef HAVE_VIRCONNECTGETHOSTNAME
78 extern char *virConnectGetHostname (virConnectPtr conn) __attribute__((weak));
83 ocaml_libvirt_connect_get_hostname (value connv)
86 #ifndef HAVE_VIRCONNECTGETHOSTNAME
87 /* Symbol virConnectGetHostname not found at compile time. */
88 not_supported ("virConnectGetHostname");
91 /* Check that the symbol virConnectGetHostname
92 * is in runtime version of libvirt.
94 WEAK_SYMBOL_CHECK (virConnectGetHostname);
97 virConnectPtr conn = Connect_val (connv);
100 NONBLOCKING (r = virConnectGetHostname (conn));
101 CHECK_ERROR (!r, conn, "virConnectGetHostname");
103 rv = caml_copy_string (r);
109 /* Automatically generated binding for virConnectGetURI.
110 * In generator.pl this function has signature "conn : string".
113 #ifdef HAVE_WEAK_SYMBOLS
114 #ifdef HAVE_VIRCONNECTGETURI
115 extern char *virConnectGetURI (virConnectPtr conn) __attribute__((weak));
120 ocaml_libvirt_connect_get_uri (value connv)
123 #ifndef HAVE_VIRCONNECTGETURI
124 /* Symbol virConnectGetURI not found at compile time. */
125 not_supported ("virConnectGetURI");
128 /* Check that the symbol virConnectGetURI
129 * is in runtime version of libvirt.
131 WEAK_SYMBOL_CHECK (virConnectGetURI);
134 virConnectPtr conn = Connect_val (connv);
137 NONBLOCKING (r = virConnectGetURI (conn));
138 CHECK_ERROR (!r, conn, "virConnectGetURI");
140 rv = caml_copy_string (r);
146 /* Automatically generated binding for virConnectGetType.
147 * In generator.pl this function has signature "conn : static string".
151 ocaml_libvirt_connect_get_type (value connv)
156 virConnectPtr conn = Connect_val (connv);
159 NONBLOCKING (r = virConnectGetType (conn));
160 CHECK_ERROR (!r, conn, "virConnectGetType");
162 rv = caml_copy_string (r);
166 /* Automatically generated binding for virConnectNumOfDomains.
167 * In generator.pl this function has signature "conn : int".
171 ocaml_libvirt_connect_num_of_domains (value connv)
175 virConnectPtr conn = Connect_val (connv);
178 NONBLOCKING (r = virConnectNumOfDomains (conn));
179 CHECK_ERROR (r == -1, conn, "virConnectNumOfDomains");
181 CAMLreturn (Val_int (r));
184 /* Automatically generated binding for virConnectListDomains.
185 * In generator.pl this function has signature "conn, int : int array".
189 ocaml_libvirt_connect_list_domains (value connv, value iv)
191 CAMLparam2 (connv, iv);
194 virConnectPtr conn = Connect_val (connv);
195 int i = Int_val (iv);
198 /* Some libvirt List* functions still throw exceptions if i == 0,
199 * so catch that and return an empty array directly. This changes
200 * the semantics slightly (masking other failures) but it's
201 * unlikely anyone will care. RWMJ 2008/06/10
204 rv = caml_alloc (0, 0);
208 NONBLOCKING (r = virConnectListDomains (conn, ids, i));
209 CHECK_ERROR (r == -1, conn, "virConnectListDomains");
211 rv = caml_alloc (r, 0);
212 for (i = 0; i < r; ++i)
213 Store_field (rv, i, Val_int (ids[i]));
218 /* Automatically generated binding for virConnectNumOfDefinedDomains.
219 * In generator.pl this function has signature "conn : int".
223 ocaml_libvirt_connect_num_of_defined_domains (value connv)
227 virConnectPtr conn = Connect_val (connv);
230 NONBLOCKING (r = virConnectNumOfDefinedDomains (conn));
231 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedDomains");
233 CAMLreturn (Val_int (r));
236 /* Automatically generated binding for virConnectListDefinedDomains.
237 * In generator.pl this function has signature "conn, int : string array".
241 ocaml_libvirt_connect_list_defined_domains (value connv, value iv)
243 CAMLparam2 (connv, iv);
245 CAMLlocal2 (rv, strv);
246 virConnectPtr conn = Connect_val (connv);
247 int i = Int_val (iv);
251 /* Some libvirt List* functions still throw exceptions if i == 0,
252 * so catch that and return an empty array directly. This changes
253 * the semantics slightly (masking other failures) but it's
254 * unlikely anyone will care. RWMJ 2008/06/10
257 rv = caml_alloc (0, 0);
261 NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i));
262 CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
264 rv = caml_alloc (r, 0);
265 for (i = 0; i < r; ++i) {
266 strv = caml_copy_string (names[i]);
267 Store_field (rv, i, strv);
274 /* Automatically generated binding for virConnectNumOfNetworks.
275 * In generator.pl this function has signature "conn : int".
279 ocaml_libvirt_connect_num_of_networks (value connv)
283 virConnectPtr conn = Connect_val (connv);
286 NONBLOCKING (r = virConnectNumOfNetworks (conn));
287 CHECK_ERROR (r == -1, conn, "virConnectNumOfNetworks");
289 CAMLreturn (Val_int (r));
292 /* Automatically generated binding for virConnectListNetworks.
293 * In generator.pl this function has signature "conn, int : string array".
297 ocaml_libvirt_connect_list_networks (value connv, value iv)
299 CAMLparam2 (connv, iv);
301 CAMLlocal2 (rv, strv);
302 virConnectPtr conn = Connect_val (connv);
303 int i = Int_val (iv);
307 /* Some libvirt List* functions still throw exceptions if i == 0,
308 * so catch that and return an empty array directly. This changes
309 * the semantics slightly (masking other failures) but it's
310 * unlikely anyone will care. RWMJ 2008/06/10
313 rv = caml_alloc (0, 0);
317 NONBLOCKING (r = virConnectListNetworks (conn, names, i));
318 CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
320 rv = caml_alloc (r, 0);
321 for (i = 0; i < r; ++i) {
322 strv = caml_copy_string (names[i]);
323 Store_field (rv, i, strv);
330 /* Automatically generated binding for virConnectNumOfDefinedNetworks.
331 * In generator.pl this function has signature "conn : int".
335 ocaml_libvirt_connect_num_of_defined_networks (value connv)
339 virConnectPtr conn = Connect_val (connv);
342 NONBLOCKING (r = virConnectNumOfDefinedNetworks (conn));
343 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedNetworks");
345 CAMLreturn (Val_int (r));
348 /* Automatically generated binding for virConnectListDefinedNetworks.
349 * In generator.pl this function has signature "conn, int : string array".
353 ocaml_libvirt_connect_list_defined_networks (value connv, value iv)
355 CAMLparam2 (connv, iv);
357 CAMLlocal2 (rv, strv);
358 virConnectPtr conn = Connect_val (connv);
359 int i = Int_val (iv);
363 /* Some libvirt List* functions still throw exceptions if i == 0,
364 * so catch that and return an empty array directly. This changes
365 * the semantics slightly (masking other failures) but it's
366 * unlikely anyone will care. RWMJ 2008/06/10
369 rv = caml_alloc (0, 0);
373 NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i));
374 CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
376 rv = caml_alloc (r, 0);
377 for (i = 0; i < r; ++i) {
378 strv = caml_copy_string (names[i]);
379 Store_field (rv, i, strv);
386 /* Automatically generated binding for virConnectNumOfStoragePools.
387 * In generator.pl this function has signature "conn : int".
390 #ifdef HAVE_WEAK_SYMBOLS
391 #ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
392 extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak));
397 ocaml_libvirt_connect_num_of_storage_pools (value connv)
400 #ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
401 /* Symbol virConnectNumOfStoragePools not found at compile time. */
402 not_supported ("virConnectNumOfStoragePools");
405 /* Check that the symbol virConnectNumOfStoragePools
406 * is in runtime version of libvirt.
408 WEAK_SYMBOL_CHECK (virConnectNumOfStoragePools);
410 virConnectPtr conn = Connect_val (connv);
413 NONBLOCKING (r = virConnectNumOfStoragePools (conn));
414 CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools");
416 CAMLreturn (Val_int (r));
420 /* Automatically generated binding for virConnectListStoragePools.
421 * In generator.pl this function has signature "conn, int : string array".
424 #ifdef HAVE_WEAK_SYMBOLS
425 #ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS
426 extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
431 ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
433 CAMLparam2 (connv, iv);
434 #ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS
435 /* Symbol virConnectListStoragePools not found at compile time. */
436 not_supported ("virConnectListStoragePools");
439 /* Check that the symbol virConnectListStoragePools
440 * is in runtime version of libvirt.
442 WEAK_SYMBOL_CHECK (virConnectListStoragePools);
444 CAMLlocal2 (rv, strv);
445 virConnectPtr conn = Connect_val (connv);
446 int i = Int_val (iv);
450 /* Some libvirt List* functions still throw exceptions if i == 0,
451 * so catch that and return an empty array directly. This changes
452 * the semantics slightly (masking other failures) but it's
453 * unlikely anyone will care. RWMJ 2008/06/10
456 rv = caml_alloc (0, 0);
460 NONBLOCKING (r = virConnectListStoragePools (conn, names, i));
461 CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
463 rv = caml_alloc (r, 0);
464 for (i = 0; i < r; ++i) {
465 strv = caml_copy_string (names[i]);
466 Store_field (rv, i, strv);
474 /* Automatically generated binding for virConnectNumOfDefinedStoragePools.
475 * In generator.pl this function has signature "conn : int".
478 #ifdef HAVE_WEAK_SYMBOLS
479 #ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
480 extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak));
485 ocaml_libvirt_connect_num_of_defined_storage_pools (value connv)
488 #ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
489 /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */
490 not_supported ("virConnectNumOfDefinedStoragePools");
493 /* Check that the symbol virConnectNumOfDefinedStoragePools
494 * is in runtime version of libvirt.
496 WEAK_SYMBOL_CHECK (virConnectNumOfDefinedStoragePools);
498 virConnectPtr conn = Connect_val (connv);
501 NONBLOCKING (r = virConnectNumOfDefinedStoragePools (conn));
502 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools");
504 CAMLreturn (Val_int (r));
508 /* Automatically generated binding for virConnectListDefinedStoragePools.
509 * In generator.pl this function has signature "conn, int : string array".
512 #ifdef HAVE_WEAK_SYMBOLS
513 #ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
514 extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
519 ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
521 CAMLparam2 (connv, iv);
522 #ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
523 /* Symbol virConnectListDefinedStoragePools not found at compile time. */
524 not_supported ("virConnectListDefinedStoragePools");
527 /* Check that the symbol virConnectListDefinedStoragePools
528 * is in runtime version of libvirt.
530 WEAK_SYMBOL_CHECK (virConnectListDefinedStoragePools);
532 CAMLlocal2 (rv, strv);
533 virConnectPtr conn = Connect_val (connv);
534 int i = Int_val (iv);
538 /* Some libvirt List* functions still throw exceptions if i == 0,
539 * so catch that and return an empty array directly. This changes
540 * the semantics slightly (masking other failures) but it's
541 * unlikely anyone will care. RWMJ 2008/06/10
544 rv = caml_alloc (0, 0);
548 NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i));
549 CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
551 rv = caml_alloc (r, 0);
552 for (i = 0; i < r; ++i) {
553 strv = caml_copy_string (names[i]);
554 Store_field (rv, i, strv);
562 /* Automatically generated binding for virConnectGetCapabilities.
563 * In generator.pl this function has signature "conn : string".
567 ocaml_libvirt_connect_get_capabilities (value connv)
572 virConnectPtr conn = Connect_val (connv);
575 NONBLOCKING (r = virConnectGetCapabilities (conn));
576 CHECK_ERROR (!r, conn, "virConnectGetCapabilities");
578 rv = caml_copy_string (r);
583 /* Automatically generated binding for virDomainCreateLinux.
584 * In generator.pl this function has signature "conn, string, 0U : dom".
588 ocaml_libvirt_domain_create_linux (value connv, value strv)
590 CAMLparam2 (connv, strv);
593 virConnectPtr conn = Connect_val (connv);
594 char *str = String_val (strv);
597 NONBLOCKING (r = virDomainCreateLinux (conn, str, 0));
598 CHECK_ERROR (!r, conn, "virDomainCreateLinux");
600 rv = Val_domain (r, connv);
605 /* Automatically generated binding for virDomainCreateLinuxJob.
606 * In generator.pl this function has signature "conn, string, 0U : job".
609 #ifdef HAVE_WEAK_SYMBOLS
610 #ifdef HAVE_VIRDOMAINCREATELINUXJOB
611 extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
616 ocaml_libvirt_domain_create_linux_job (value connv, value strv)
618 CAMLparam2 (connv, strv);
619 #ifndef HAVE_VIRDOMAINCREATELINUXJOB
620 /* Symbol virDomainCreateLinuxJob not found at compile time. */
621 not_supported ("virDomainCreateLinuxJob");
624 /* Check that the symbol virDomainCreateLinuxJob
625 * is in runtime version of libvirt.
627 WEAK_SYMBOL_CHECK (virDomainCreateLinuxJob);
630 virConnectPtr conn = Connect_val (connv);
631 char *str = String_val (strv);
634 NONBLOCKING (r = virDomainCreateLinuxJob (conn, str, 0));
635 CHECK_ERROR (!r, conn, "virDomainCreateLinuxJob");
637 rv = Val_job (r, connv);
643 /* Automatically generated binding for virDomainFree.
644 * In generator.pl this function has signature "dom : free".
648 ocaml_libvirt_domain_free (value domv)
652 virDomainPtr dom = Domain_val (domv);
653 virConnectPtr conn = Connect_domv (domv);
656 NONBLOCKING (r = virDomainFree (dom));
657 CHECK_ERROR (r == -1, conn, "virDomainFree");
659 /* So that we don't double-free in the finalizer: */
660 Domain_val (domv) = NULL;
662 CAMLreturn (Val_unit);
665 /* Automatically generated binding for virDomainDestroy.
666 * In generator.pl this function has signature "dom : free".
670 ocaml_libvirt_domain_destroy (value domv)
674 virDomainPtr dom = Domain_val (domv);
675 virConnectPtr conn = Connect_domv (domv);
678 NONBLOCKING (r = virDomainDestroy (dom));
679 CHECK_ERROR (r == -1, conn, "virDomainDestroy");
681 /* So that we don't double-free in the finalizer: */
682 Domain_val (domv) = NULL;
684 CAMLreturn (Val_unit);
687 /* Automatically generated binding for virDomainLookupByName.
688 * In generator.pl this function has signature "conn, string : dom".
692 ocaml_libvirt_domain_lookup_by_name (value connv, value strv)
694 CAMLparam2 (connv, strv);
697 virConnectPtr conn = Connect_val (connv);
698 char *str = String_val (strv);
701 NONBLOCKING (r = virDomainLookupByName (conn, str));
702 CHECK_ERROR (!r, conn, "virDomainLookupByName");
704 rv = Val_domain (r, connv);
709 /* Automatically generated binding for virDomainLookupByID.
710 * In generator.pl this function has signature "conn, int : dom".
714 ocaml_libvirt_domain_lookup_by_id (value connv, value iv)
716 CAMLparam2 (connv, iv);
719 virConnectPtr conn = Connect_val (connv);
720 int i = Int_val (iv);
723 NONBLOCKING (r = virDomainLookupByID (conn, i));
724 CHECK_ERROR (!r, conn, "virDomainLookupByID");
726 rv = Val_domain (r, connv);
731 /* Automatically generated binding for virDomainLookupByUUID.
732 * In generator.pl this function has signature "conn, uuid : dom".
736 ocaml_libvirt_domain_lookup_by_uuid (value connv, value uuidv)
738 CAMLparam2 (connv, uuidv);
741 virConnectPtr conn = Connect_val (connv);
742 unsigned char *uuid = (unsigned char *) String_val (uuidv);
745 NONBLOCKING (r = virDomainLookupByUUID (conn, uuid));
746 CHECK_ERROR (!r, conn, "virDomainLookupByUUID");
748 rv = Val_domain (r, connv);
753 /* Automatically generated binding for virDomainLookupByUUIDString.
754 * In generator.pl this function has signature "conn, string : dom".
758 ocaml_libvirt_domain_lookup_by_uuid_string (value connv, value strv)
760 CAMLparam2 (connv, strv);
763 virConnectPtr conn = Connect_val (connv);
764 char *str = String_val (strv);
767 NONBLOCKING (r = virDomainLookupByUUIDString (conn, str));
768 CHECK_ERROR (!r, conn, "virDomainLookupByUUIDString");
770 rv = Val_domain (r, connv);
775 /* Automatically generated binding for virDomainGetName.
776 * In generator.pl this function has signature "dom : static string".
780 ocaml_libvirt_domain_get_name (value domv)
785 virDomainPtr dom = Domain_val (domv);
786 virConnectPtr conn = Connect_domv (domv);
789 NONBLOCKING (r = virDomainGetName (dom));
790 CHECK_ERROR (!r, conn, "virDomainGetName");
792 rv = caml_copy_string (r);
796 /* Automatically generated binding for virDomainGetOSType.
797 * In generator.pl this function has signature "dom : string".
801 ocaml_libvirt_domain_get_os_type (value domv)
806 virDomainPtr dom = Domain_val (domv);
807 virConnectPtr conn = Connect_domv (domv);
810 NONBLOCKING (r = virDomainGetOSType (dom));
811 CHECK_ERROR (!r, conn, "virDomainGetOSType");
813 rv = caml_copy_string (r);
818 /* Automatically generated binding for virDomainGetXMLDesc.
819 * In generator.pl this function has signature "dom, 0 : string".
823 ocaml_libvirt_domain_get_xml_desc (value domv)
828 virDomainPtr dom = Domain_val (domv);
829 virConnectPtr conn = Connect_domv (domv);
832 NONBLOCKING (r = virDomainGetXMLDesc (dom, 0));
833 CHECK_ERROR (!r, conn, "virDomainGetXMLDesc");
835 rv = caml_copy_string (r);
840 /* Automatically generated binding for virDomainGetUUID.
841 * In generator.pl this function has signature "dom : uuid".
845 ocaml_libvirt_domain_get_uuid (value domv)
850 virDomainPtr dom = Domain_val (domv);
851 virConnectPtr conn = Connect_domv (domv);
852 unsigned char uuid[VIR_UUID_BUFLEN];
855 NONBLOCKING (r = virDomainGetUUID (dom, uuid));
856 CHECK_ERROR (r == -1, conn, "virDomainGetUUID");
858 /* UUIDs are byte arrays with a fixed length. */
859 rv = caml_alloc_string (VIR_UUID_BUFLEN);
860 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
864 /* Automatically generated binding for virDomainGetUUIDString.
865 * In generator.pl this function has signature "dom : uuid string".
869 ocaml_libvirt_domain_get_uuid_string (value domv)
874 virDomainPtr dom = Domain_val (domv);
875 virConnectPtr conn = Connect_domv (domv);
876 char uuid[VIR_UUID_STRING_BUFLEN];
879 NONBLOCKING (r = virDomainGetUUIDString (dom, uuid));
880 CHECK_ERROR (r == -1, conn, "virDomainGetUUIDString");
882 rv = caml_copy_string (uuid);
886 /* Automatically generated binding for virDomainGetMaxVcpus.
887 * In generator.pl this function has signature "dom : int".
891 ocaml_libvirt_domain_get_max_vcpus (value domv)
895 virDomainPtr dom = Domain_val (domv);
896 virConnectPtr conn = Connect_domv (domv);
899 NONBLOCKING (r = virDomainGetMaxVcpus (dom));
900 CHECK_ERROR (r == -1, conn, "virDomainGetMaxVcpus");
902 CAMLreturn (Val_int (r));
905 /* Automatically generated binding for virDomainSave.
906 * In generator.pl this function has signature "dom, string : unit".
910 ocaml_libvirt_domain_save (value domv, value strv)
912 CAMLparam2 (domv, strv);
914 virDomainPtr dom = Domain_val (domv);
915 virConnectPtr conn = Connect_domv (domv);
916 char *str = String_val (strv);
919 NONBLOCKING (r = virDomainSave (dom, str));
920 CHECK_ERROR (r == -1, conn, "virDomainSave");
922 CAMLreturn (Val_unit);
925 /* Automatically generated binding for virDomainSaveJob.
926 * In generator.pl this function has signature "dom, string : job from dom".
929 #ifdef HAVE_WEAK_SYMBOLS
930 #ifdef HAVE_VIRDOMAINSAVEJOB
931 extern virJobPtr virDomainSaveJob (virDomainPtr dom, const char *str) __attribute__((weak));
936 ocaml_libvirt_domain_save_job (value domv, value strv)
938 CAMLparam2 (domv, strv);
939 #ifndef HAVE_VIRDOMAINSAVEJOB
940 /* Symbol virDomainSaveJob not found at compile time. */
941 not_supported ("virDomainSaveJob");
944 /* Check that the symbol virDomainSaveJob
945 * is in runtime version of libvirt.
947 WEAK_SYMBOL_CHECK (virDomainSaveJob);
949 CAMLlocal2 (rv, connv);
950 virDomainPtr dom = Domain_val (domv);
951 virConnectPtr conn = Connect_domv (domv);
952 char *str = String_val (strv);
955 NONBLOCKING (r = virDomainSaveJob (dom, str));
956 CHECK_ERROR (!r, conn, "virDomainSaveJob");
958 connv = Field (domv, 1);
959 rv = Val_job (r, connv);
965 /* Automatically generated binding for virDomainRestore.
966 * In generator.pl this function has signature "conn, string : unit".
970 ocaml_libvirt_domain_restore (value connv, value strv)
972 CAMLparam2 (connv, strv);
974 virConnectPtr conn = Connect_val (connv);
975 char *str = String_val (strv);
978 NONBLOCKING (r = virDomainRestore (conn, str));
979 CHECK_ERROR (r == -1, conn, "virDomainRestore");
981 CAMLreturn (Val_unit);
984 /* Automatically generated binding for virDomainRestoreJob.
985 * In generator.pl this function has signature "conn, string : job".
988 #ifdef HAVE_WEAK_SYMBOLS
989 #ifdef HAVE_VIRDOMAINRESTOREJOB
990 extern virJobPtr virDomainRestoreJob (virConnectPtr conn, const char *str) __attribute__((weak));
995 ocaml_libvirt_domain_restore_job (value connv, value strv)
997 CAMLparam2 (connv, strv);
998 #ifndef HAVE_VIRDOMAINRESTOREJOB
999 /* Symbol virDomainRestoreJob not found at compile time. */
1000 not_supported ("virDomainRestoreJob");
1003 /* Check that the symbol virDomainRestoreJob
1004 * is in runtime version of libvirt.
1006 WEAK_SYMBOL_CHECK (virDomainRestoreJob);
1009 virConnectPtr conn = Connect_val (connv);
1010 char *str = String_val (strv);
1013 NONBLOCKING (r = virDomainRestoreJob (conn, str));
1014 CHECK_ERROR (!r, conn, "virDomainRestoreJob");
1016 rv = Val_job (r, connv);
1022 /* Automatically generated binding for virDomainCoreDump.
1023 * In generator.pl this function has signature "dom, string, 0 : unit".
1027 ocaml_libvirt_domain_core_dump (value domv, value strv)
1029 CAMLparam2 (domv, strv);
1032 virDomainPtr dom = Domain_val (domv);
1033 virConnectPtr conn = Connect_domv (domv);
1034 char *str = String_val (strv);
1037 NONBLOCKING (r = virDomainCoreDump (dom, str, 0));
1038 CHECK_ERROR (!r, conn, "virDomainCoreDump");
1040 CAMLreturn (Val_unit);
1043 /* Automatically generated binding for virDomainCoreDumpJob.
1044 * In generator.pl this function has signature "dom, string, 0 : job from dom".
1047 #ifdef HAVE_WEAK_SYMBOLS
1048 #ifdef HAVE_VIRDOMAINCOREDUMPJOB
1049 extern virJobPtr virDomainCoreDumpJob (virDomainPtr dom, const char *str, int flags) __attribute__((weak));
1054 ocaml_libvirt_domain_core_dump_job (value domv, value strv)
1056 CAMLparam2 (domv, strv);
1057 #ifndef HAVE_VIRDOMAINCOREDUMPJOB
1058 /* Symbol virDomainCoreDumpJob not found at compile time. */
1059 not_supported ("virDomainCoreDumpJob");
1062 /* Check that the symbol virDomainCoreDumpJob
1063 * is in runtime version of libvirt.
1065 WEAK_SYMBOL_CHECK (virDomainCoreDumpJob);
1067 CAMLlocal2 (rv, connv);
1068 virDomainPtr dom = Domain_val (domv);
1069 virConnectPtr conn = Connect_domv (domv);
1070 char *str = String_val (strv);
1073 NONBLOCKING (r = virDomainCoreDumpJob (dom, str, 0));
1074 CHECK_ERROR (!r, conn, "virDomainCoreDumpJob");
1076 connv = Field (domv, 1);
1077 rv = Val_job (r, connv);
1083 /* Automatically generated binding for virDomainSuspend.
1084 * In generator.pl this function has signature "dom : unit".
1088 ocaml_libvirt_domain_suspend (value domv)
1092 virDomainPtr dom = Domain_val (domv);
1093 virConnectPtr conn = Connect_domv (domv);
1096 NONBLOCKING (r = virDomainSuspend (dom));
1097 CHECK_ERROR (r == -1, conn, "virDomainSuspend");
1099 CAMLreturn (Val_unit);
1102 /* Automatically generated binding for virDomainResume.
1103 * In generator.pl this function has signature "dom : unit".
1107 ocaml_libvirt_domain_resume (value domv)
1111 virDomainPtr dom = Domain_val (domv);
1112 virConnectPtr conn = Connect_domv (domv);
1115 NONBLOCKING (r = virDomainResume (dom));
1116 CHECK_ERROR (r == -1, conn, "virDomainResume");
1118 CAMLreturn (Val_unit);
1121 /* Automatically generated binding for virDomainShutdown.
1122 * In generator.pl this function has signature "dom : unit".
1126 ocaml_libvirt_domain_shutdown (value domv)
1130 virDomainPtr dom = Domain_val (domv);
1131 virConnectPtr conn = Connect_domv (domv);
1134 NONBLOCKING (r = virDomainShutdown (dom));
1135 CHECK_ERROR (r == -1, conn, "virDomainShutdown");
1137 CAMLreturn (Val_unit);
1140 /* Automatically generated binding for virDomainReboot.
1141 * In generator.pl this function has signature "dom, 0 : unit".
1145 ocaml_libvirt_domain_reboot (value domv)
1149 virDomainPtr dom = Domain_val (domv);
1150 virConnectPtr conn = Connect_domv (domv);
1153 NONBLOCKING (r = virDomainReboot (dom, 0));
1154 CHECK_ERROR (r == -1, conn, "virDomainReboot");
1156 CAMLreturn (Val_unit);
1159 /* Automatically generated binding for virDomainDefineXML.
1160 * In generator.pl this function has signature "conn, string : dom".
1164 ocaml_libvirt_domain_define_xml (value connv, value strv)
1166 CAMLparam2 (connv, strv);
1169 virConnectPtr conn = Connect_val (connv);
1170 char *str = String_val (strv);
1173 NONBLOCKING (r = virDomainDefineXML (conn, str));
1174 CHECK_ERROR (!r, conn, "virDomainDefineXML");
1176 rv = Val_domain (r, connv);
1181 /* Automatically generated binding for virDomainUndefine.
1182 * In generator.pl this function has signature "dom : unit".
1186 ocaml_libvirt_domain_undefine (value domv)
1190 virDomainPtr dom = Domain_val (domv);
1191 virConnectPtr conn = Connect_domv (domv);
1194 NONBLOCKING (r = virDomainUndefine (dom));
1195 CHECK_ERROR (r == -1, conn, "virDomainUndefine");
1197 CAMLreturn (Val_unit);
1200 /* Automatically generated binding for virDomainCreate.
1201 * In generator.pl this function has signature "dom : unit".
1205 ocaml_libvirt_domain_create (value domv)
1209 virDomainPtr dom = Domain_val (domv);
1210 virConnectPtr conn = Connect_domv (domv);
1213 NONBLOCKING (r = virDomainCreate (dom));
1214 CHECK_ERROR (r == -1, conn, "virDomainCreate");
1216 CAMLreturn (Val_unit);
1219 /* Automatically generated binding for virDomainCreateJob.
1220 * In generator.pl this function has signature "dom, 0U : job from dom".
1223 #ifdef HAVE_WEAK_SYMBOLS
1224 #ifdef HAVE_VIRDOMAINCREATEJOB
1225 extern virJobPtr virDomainCreateJob (virDomainPtr dom, unsigned int flags) __attribute__((weak));
1230 ocaml_libvirt_domain_create_job (value domv)
1233 #ifndef HAVE_VIRDOMAINCREATEJOB
1234 /* Symbol virDomainCreateJob not found at compile time. */
1235 not_supported ("virDomainCreateJob");
1238 /* Check that the symbol virDomainCreateJob
1239 * is in runtime version of libvirt.
1241 WEAK_SYMBOL_CHECK (virDomainCreateJob);
1243 CAMLlocal2 (rv, connv);
1244 virDomainPtr dom = Domain_val (domv);
1245 virConnectPtr conn = Connect_domv (domv);
1248 NONBLOCKING (r = virDomainCreateJob (dom, 0));
1249 CHECK_ERROR (!r, conn, "virDomainCreateJob");
1251 connv = Field (domv, 1);
1252 rv = Val_job (r, connv);
1258 /* Automatically generated binding for virDomainAttachDevice.
1259 * In generator.pl this function has signature "dom, string : unit".
1263 ocaml_libvirt_domain_attach_device (value domv, value strv)
1265 CAMLparam2 (domv, strv);
1267 virDomainPtr dom = Domain_val (domv);
1268 virConnectPtr conn = Connect_domv (domv);
1269 char *str = String_val (strv);
1272 NONBLOCKING (r = virDomainAttachDevice (dom, str));
1273 CHECK_ERROR (r == -1, conn, "virDomainAttachDevice");
1275 CAMLreturn (Val_unit);
1278 /* Automatically generated binding for virDomainDetachDevice.
1279 * In generator.pl this function has signature "dom, string : unit".
1283 ocaml_libvirt_domain_detach_device (value domv, value strv)
1285 CAMLparam2 (domv, strv);
1287 virDomainPtr dom = Domain_val (domv);
1288 virConnectPtr conn = Connect_domv (domv);
1289 char *str = String_val (strv);
1292 NONBLOCKING (r = virDomainDetachDevice (dom, str));
1293 CHECK_ERROR (r == -1, conn, "virDomainDetachDevice");
1295 CAMLreturn (Val_unit);
1298 /* Automatically generated binding for virDomainGetAutostart.
1299 * In generator.pl this function has signature "dom : bool".
1303 ocaml_libvirt_domain_get_autostart (value domv)
1307 virDomainPtr dom = Domain_val (domv);
1308 virConnectPtr conn = Connect_domv (domv);
1311 NONBLOCKING (r = virDomainGetAutostart (dom, &b));
1312 CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
1314 CAMLreturn (b ? Val_true : Val_false);
1317 /* Automatically generated binding for virDomainSetAutostart.
1318 * In generator.pl this function has signature "dom, bool : unit".
1322 ocaml_libvirt_domain_set_autostart (value domv, value bv)
1324 CAMLparam2 (domv, bv);
1326 virDomainPtr dom = Domain_val (domv);
1327 virConnectPtr conn = Connect_domv (domv);
1330 b = bv == Val_true ? 1 : 0;
1332 NONBLOCKING (r = virDomainSetAutostart (dom, b));
1333 CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
1335 CAMLreturn (Val_unit);
1338 /* Automatically generated binding for virNetworkFree.
1339 * In generator.pl this function has signature "net : free".
1343 ocaml_libvirt_network_free (value netv)
1347 virNetworkPtr net = Network_val (netv);
1348 virConnectPtr conn = Connect_netv (netv);
1351 NONBLOCKING (r = virNetworkFree (net));
1352 CHECK_ERROR (r == -1, conn, "virNetworkFree");
1354 /* So that we don't double-free in the finalizer: */
1355 Network_val (netv) = NULL;
1357 CAMLreturn (Val_unit);
1360 /* Automatically generated binding for virNetworkDestroy.
1361 * In generator.pl this function has signature "net : free".
1365 ocaml_libvirt_network_destroy (value netv)
1369 virNetworkPtr net = Network_val (netv);
1370 virConnectPtr conn = Connect_netv (netv);
1373 NONBLOCKING (r = virNetworkDestroy (net));
1374 CHECK_ERROR (r == -1, conn, "virNetworkDestroy");
1376 /* So that we don't double-free in the finalizer: */
1377 Network_val (netv) = NULL;
1379 CAMLreturn (Val_unit);
1382 /* Automatically generated binding for virNetworkLookupByName.
1383 * In generator.pl this function has signature "conn, string : net".
1387 ocaml_libvirt_network_lookup_by_name (value connv, value strv)
1389 CAMLparam2 (connv, strv);
1392 virConnectPtr conn = Connect_val (connv);
1393 char *str = String_val (strv);
1396 NONBLOCKING (r = virNetworkLookupByName (conn, str));
1397 CHECK_ERROR (!r, conn, "virNetworkLookupByName");
1399 rv = Val_network (r, connv);
1404 /* Automatically generated binding for virNetworkLookupByUUID.
1405 * In generator.pl this function has signature "conn, uuid : net".
1409 ocaml_libvirt_network_lookup_by_uuid (value connv, value uuidv)
1411 CAMLparam2 (connv, uuidv);
1414 virConnectPtr conn = Connect_val (connv);
1415 unsigned char *uuid = (unsigned char *) String_val (uuidv);
1418 NONBLOCKING (r = virNetworkLookupByUUID (conn, uuid));
1419 CHECK_ERROR (!r, conn, "virNetworkLookupByUUID");
1421 rv = Val_network (r, connv);
1426 /* Automatically generated binding for virNetworkLookupByUUIDString.
1427 * In generator.pl this function has signature "conn, string : net".
1431 ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv)
1433 CAMLparam2 (connv, strv);
1436 virConnectPtr conn = Connect_val (connv);
1437 char *str = String_val (strv);
1440 NONBLOCKING (r = virNetworkLookupByUUIDString (conn, str));
1441 CHECK_ERROR (!r, conn, "virNetworkLookupByUUIDString");
1443 rv = Val_network (r, connv);
1448 /* Automatically generated binding for virNetworkGetName.
1449 * In generator.pl this function has signature "net : static string".
1453 ocaml_libvirt_network_get_name (value netv)
1458 virNetworkPtr net = Network_val (netv);
1459 virConnectPtr conn = Connect_netv (netv);
1462 NONBLOCKING (r = virNetworkGetName (net));
1463 CHECK_ERROR (!r, conn, "virNetworkGetName");
1465 rv = caml_copy_string (r);
1469 /* Automatically generated binding for virNetworkGetXMLDesc.
1470 * In generator.pl this function has signature "net, 0 : string".
1474 ocaml_libvirt_network_get_xml_desc (value netv)
1479 virNetworkPtr net = Network_val (netv);
1480 virConnectPtr conn = Connect_netv (netv);
1483 NONBLOCKING (r = virNetworkGetXMLDesc (net, 0));
1484 CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc");
1486 rv = caml_copy_string (r);
1491 /* Automatically generated binding for virNetworkGetBridgeName.
1492 * In generator.pl this function has signature "net : string".
1496 ocaml_libvirt_network_get_bridge_name (value netv)
1501 virNetworkPtr net = Network_val (netv);
1502 virConnectPtr conn = Connect_netv (netv);
1505 NONBLOCKING (r = virNetworkGetBridgeName (net));
1506 CHECK_ERROR (!r, conn, "virNetworkGetBridgeName");
1508 rv = caml_copy_string (r);
1513 /* Automatically generated binding for virNetworkGetUUID.
1514 * In generator.pl this function has signature "net : uuid".
1518 ocaml_libvirt_network_get_uuid (value netv)
1523 virNetworkPtr net = Network_val (netv);
1524 virConnectPtr conn = Connect_netv (netv);
1525 unsigned char uuid[VIR_UUID_BUFLEN];
1528 NONBLOCKING (r = virNetworkGetUUID (net, uuid));
1529 CHECK_ERROR (r == -1, conn, "virNetworkGetUUID");
1531 /* UUIDs are byte arrays with a fixed length. */
1532 rv = caml_alloc_string (VIR_UUID_BUFLEN);
1533 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
1537 /* Automatically generated binding for virNetworkGetUUIDString.
1538 * In generator.pl this function has signature "net : uuid string".
1542 ocaml_libvirt_network_get_uuid_string (value netv)
1547 virNetworkPtr net = Network_val (netv);
1548 virConnectPtr conn = Connect_netv (netv);
1549 char uuid[VIR_UUID_STRING_BUFLEN];
1552 NONBLOCKING (r = virNetworkGetUUIDString (net, uuid));
1553 CHECK_ERROR (r == -1, conn, "virNetworkGetUUIDString");
1555 rv = caml_copy_string (uuid);
1559 /* Automatically generated binding for virNetworkUndefine.
1560 * In generator.pl this function has signature "net : unit".
1564 ocaml_libvirt_network_undefine (value netv)
1568 virNetworkPtr net = Network_val (netv);
1569 virConnectPtr conn = Connect_netv (netv);
1572 NONBLOCKING (r = virNetworkUndefine (net));
1573 CHECK_ERROR (r == -1, conn, "virNetworkUndefine");
1575 CAMLreturn (Val_unit);
1578 /* Automatically generated binding for virNetworkCreateXML.
1579 * In generator.pl this function has signature "conn, string : net".
1583 ocaml_libvirt_network_create_xml (value connv, value strv)
1585 CAMLparam2 (connv, strv);
1588 virConnectPtr conn = Connect_val (connv);
1589 char *str = String_val (strv);
1592 NONBLOCKING (r = virNetworkCreateXML (conn, str));
1593 CHECK_ERROR (!r, conn, "virNetworkCreateXML");
1595 rv = Val_network (r, connv);
1600 /* Automatically generated binding for virNetworkCreateXMLJob.
1601 * In generator.pl this function has signature "conn, string : job".
1604 #ifdef HAVE_WEAK_SYMBOLS
1605 #ifdef HAVE_VIRNETWORKCREATEXMLJOB
1606 extern virJobPtr virNetworkCreateXMLJob (virConnectPtr conn, const char *str) __attribute__((weak));
1611 ocaml_libvirt_network_create_xml_job (value connv, value strv)
1613 CAMLparam2 (connv, strv);
1614 #ifndef HAVE_VIRNETWORKCREATEXMLJOB
1615 /* Symbol virNetworkCreateXMLJob not found at compile time. */
1616 not_supported ("virNetworkCreateXMLJob");
1619 /* Check that the symbol virNetworkCreateXMLJob
1620 * is in runtime version of libvirt.
1622 WEAK_SYMBOL_CHECK (virNetworkCreateXMLJob);
1625 virConnectPtr conn = Connect_val (connv);
1626 char *str = String_val (strv);
1629 NONBLOCKING (r = virNetworkCreateXMLJob (conn, str));
1630 CHECK_ERROR (!r, conn, "virNetworkCreateXMLJob");
1632 rv = Val_job (r, connv);
1638 /* Automatically generated binding for virNetworkDefineXML.
1639 * In generator.pl this function has signature "conn, string : net".
1643 ocaml_libvirt_network_define_xml (value connv, value strv)
1645 CAMLparam2 (connv, strv);
1648 virConnectPtr conn = Connect_val (connv);
1649 char *str = String_val (strv);
1652 NONBLOCKING (r = virNetworkDefineXML (conn, str));
1653 CHECK_ERROR (!r, conn, "virNetworkDefineXML");
1655 rv = Val_network (r, connv);
1660 /* Automatically generated binding for virNetworkCreate.
1661 * In generator.pl this function has signature "net : unit".
1665 ocaml_libvirt_network_create (value netv)
1669 virNetworkPtr net = Network_val (netv);
1670 virConnectPtr conn = Connect_netv (netv);
1673 NONBLOCKING (r = virNetworkCreate (net));
1674 CHECK_ERROR (r == -1, conn, "virNetworkCreate");
1676 CAMLreturn (Val_unit);
1679 /* Automatically generated binding for virNetworkCreateJob.
1680 * In generator.pl this function has signature "net : job from net".
1683 #ifdef HAVE_WEAK_SYMBOLS
1684 #ifdef HAVE_VIRNETWORKCREATEJOB
1685 extern virJobPtr virNetworkCreateJob (virNetworkPtr net) __attribute__((weak));
1690 ocaml_libvirt_network_create_job (value netv)
1693 #ifndef HAVE_VIRNETWORKCREATEJOB
1694 /* Symbol virNetworkCreateJob not found at compile time. */
1695 not_supported ("virNetworkCreateJob");
1698 /* Check that the symbol virNetworkCreateJob
1699 * is in runtime version of libvirt.
1701 WEAK_SYMBOL_CHECK (virNetworkCreateJob);
1703 CAMLlocal2 (rv, connv);
1704 virNetworkPtr net = Network_val (netv);
1705 virConnectPtr conn = Connect_netv (netv);
1708 NONBLOCKING (r = virNetworkCreateJob (net));
1709 CHECK_ERROR (!r, conn, "virNetworkCreateJob");
1711 connv = Field (netv, 1);
1712 rv = Val_job (r, connv);
1718 /* Automatically generated binding for virNetworkGetAutostart.
1719 * In generator.pl this function has signature "net : bool".
1723 ocaml_libvirt_network_get_autostart (value netv)
1727 virNetworkPtr net = Network_val (netv);
1728 virConnectPtr conn = Connect_netv (netv);
1731 NONBLOCKING (r = virNetworkGetAutostart (net, &b));
1732 CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
1734 CAMLreturn (b ? Val_true : Val_false);
1737 /* Automatically generated binding for virNetworkSetAutostart.
1738 * In generator.pl this function has signature "net, bool : unit".
1742 ocaml_libvirt_network_set_autostart (value netv, value bv)
1744 CAMLparam2 (netv, bv);
1746 virNetworkPtr net = Network_val (netv);
1747 virConnectPtr conn = Connect_netv (netv);
1750 b = bv == Val_true ? 1 : 0;
1752 NONBLOCKING (r = virNetworkSetAutostart (net, b));
1753 CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
1755 CAMLreturn (Val_unit);
1758 /* Automatically generated binding for virStoragePoolFree.
1759 * In generator.pl this function has signature "pool : free".
1762 #ifdef HAVE_WEAK_SYMBOLS
1763 #ifdef HAVE_VIRSTORAGEPOOLFREE
1764 extern int virStoragePoolFree (virStoragePoolPtr pool) __attribute__((weak));
1769 ocaml_libvirt_storage_pool_free (value poolv)
1772 #ifndef HAVE_VIRSTORAGEPOOLFREE
1773 /* Symbol virStoragePoolFree not found at compile time. */
1774 not_supported ("virStoragePoolFree");
1777 /* Check that the symbol virStoragePoolFree
1778 * is in runtime version of libvirt.
1780 WEAK_SYMBOL_CHECK (virStoragePoolFree);
1782 virStoragePoolPtr pool = Pool_val (poolv);
1783 virConnectPtr conn = Connect_polv (poolv);
1786 NONBLOCKING (r = virStoragePoolFree (pool));
1787 CHECK_ERROR (r == -1, conn, "virStoragePoolFree");
1789 /* So that we don't double-free in the finalizer: */
1790 Pool_val (poolv) = NULL;
1792 CAMLreturn (Val_unit);
1796 /* Automatically generated binding for virStoragePoolDestroy.
1797 * In generator.pl this function has signature "pool : free".
1800 #ifdef HAVE_WEAK_SYMBOLS
1801 #ifdef HAVE_VIRSTORAGEPOOLDESTROY
1802 extern int virStoragePoolDestroy (virStoragePoolPtr pool) __attribute__((weak));
1807 ocaml_libvirt_storage_pool_destroy (value poolv)
1810 #ifndef HAVE_VIRSTORAGEPOOLDESTROY
1811 /* Symbol virStoragePoolDestroy not found at compile time. */
1812 not_supported ("virStoragePoolDestroy");
1815 /* Check that the symbol virStoragePoolDestroy
1816 * is in runtime version of libvirt.
1818 WEAK_SYMBOL_CHECK (virStoragePoolDestroy);
1820 virStoragePoolPtr pool = Pool_val (poolv);
1821 virConnectPtr conn = Connect_polv (poolv);
1824 NONBLOCKING (r = virStoragePoolDestroy (pool));
1825 CHECK_ERROR (r == -1, conn, "virStoragePoolDestroy");
1827 /* So that we don't double-free in the finalizer: */
1828 Pool_val (poolv) = NULL;
1830 CAMLreturn (Val_unit);
1834 /* Automatically generated binding for virStoragePoolLookupByName.
1835 * In generator.pl this function has signature "conn, string : pool".
1838 #ifdef HAVE_WEAK_SYMBOLS
1839 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1840 extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak));
1845 ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
1847 CAMLparam2 (connv, strv);
1848 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1849 /* Symbol virStoragePoolLookupByName not found at compile time. */
1850 not_supported ("virStoragePoolLookupByName");
1853 /* Check that the symbol virStoragePoolLookupByName
1854 * is in runtime version of libvirt.
1856 WEAK_SYMBOL_CHECK (virStoragePoolLookupByName);
1859 virConnectPtr conn = Connect_val (connv);
1860 char *str = String_val (strv);
1861 virStoragePoolPtr r;
1863 NONBLOCKING (r = virStoragePoolLookupByName (conn, str));
1864 CHECK_ERROR (!r, conn, "virStoragePoolLookupByName");
1866 rv = Val_pool (r, connv);
1872 /* Automatically generated binding for virStoragePoolLookupByUUID.
1873 * In generator.pl this function has signature "conn, uuid : pool".
1876 #ifdef HAVE_WEAK_SYMBOLS
1877 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1878 extern virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn, const unsigned char *str) __attribute__((weak));
1883 ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv)
1885 CAMLparam2 (connv, uuidv);
1886 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1887 /* Symbol virStoragePoolLookupByUUID not found at compile time. */
1888 not_supported ("virStoragePoolLookupByUUID");
1891 /* Check that the symbol virStoragePoolLookupByUUID
1892 * is in runtime version of libvirt.
1894 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUID);
1897 virConnectPtr conn = Connect_val (connv);
1898 unsigned char *uuid = (unsigned char *) String_val (uuidv);
1899 virStoragePoolPtr r;
1901 NONBLOCKING (r = virStoragePoolLookupByUUID (conn, uuid));
1902 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUID");
1904 rv = Val_pool (r, connv);
1910 /* Automatically generated binding for virStoragePoolLookupByUUIDString.
1911 * In generator.pl this function has signature "conn, string : pool".
1914 #ifdef HAVE_WEAK_SYMBOLS
1915 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1916 extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak));
1921 ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv)
1923 CAMLparam2 (connv, strv);
1924 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1925 /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */
1926 not_supported ("virStoragePoolLookupByUUIDString");
1929 /* Check that the symbol virStoragePoolLookupByUUIDString
1930 * is in runtime version of libvirt.
1932 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUIDString);
1935 virConnectPtr conn = Connect_val (connv);
1936 char *str = String_val (strv);
1937 virStoragePoolPtr r;
1939 NONBLOCKING (r = virStoragePoolLookupByUUIDString (conn, str));
1940 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUIDString");
1942 rv = Val_pool (r, connv);
1948 /* Automatically generated binding for virStoragePoolGetName.
1949 * In generator.pl this function has signature "pool : static string".
1952 #ifdef HAVE_WEAK_SYMBOLS
1953 #ifdef HAVE_VIRSTORAGEPOOLGETNAME
1954 extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak));
1959 ocaml_libvirt_storage_pool_get_name (value poolv)
1962 #ifndef HAVE_VIRSTORAGEPOOLGETNAME
1963 /* Symbol virStoragePoolGetName not found at compile time. */
1964 not_supported ("virStoragePoolGetName");
1967 /* Check that the symbol virStoragePoolGetName
1968 * is in runtime version of libvirt.
1970 WEAK_SYMBOL_CHECK (virStoragePoolGetName);
1973 virStoragePoolPtr pool = Pool_val (poolv);
1974 virConnectPtr conn = Connect_polv (poolv);
1977 NONBLOCKING (r = virStoragePoolGetName (pool));
1978 CHECK_ERROR (!r, conn, "virStoragePoolGetName");
1980 rv = caml_copy_string (r);
1985 /* Automatically generated binding for virStoragePoolGetXMLDesc.
1986 * In generator.pl this function has signature "pool, 0U : string".
1989 #ifdef HAVE_WEAK_SYMBOLS
1990 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
1991 extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
1996 ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
1999 #ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC
2000 /* Symbol virStoragePoolGetXMLDesc not found at compile time. */
2001 not_supported ("virStoragePoolGetXMLDesc");
2004 /* Check that the symbol virStoragePoolGetXMLDesc
2005 * is in runtime version of libvirt.
2007 WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc);
2010 virStoragePoolPtr pool = Pool_val (poolv);
2011 virConnectPtr conn = Connect_polv (poolv);
2014 NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0));
2015 CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc");
2017 rv = caml_copy_string (r);
2023 /* Automatically generated binding for virStoragePoolGetUUID.
2024 * In generator.pl this function has signature "pool : uuid".
2027 #ifdef HAVE_WEAK_SYMBOLS
2028 #ifdef HAVE_VIRSTORAGEPOOLGETUUID
2029 extern int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char *) __attribute__((weak));
2034 ocaml_libvirt_storage_pool_get_uuid (value poolv)
2037 #ifndef HAVE_VIRSTORAGEPOOLGETUUID
2038 /* Symbol virStoragePoolGetUUID not found at compile time. */
2039 not_supported ("virStoragePoolGetUUID");
2042 /* Check that the symbol virStoragePoolGetUUID
2043 * is in runtime version of libvirt.
2045 WEAK_SYMBOL_CHECK (virStoragePoolGetUUID);
2048 virStoragePoolPtr pool = Pool_val (poolv);
2049 virConnectPtr conn = Connect_polv (poolv);
2050 unsigned char uuid[VIR_UUID_BUFLEN];
2053 NONBLOCKING (r = virStoragePoolGetUUID (pool, uuid));
2054 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUID");
2056 /* UUIDs are byte arrays with a fixed length. */
2057 rv = caml_alloc_string (VIR_UUID_BUFLEN);
2058 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
2063 /* Automatically generated binding for virStoragePoolGetUUIDString.
2064 * In generator.pl this function has signature "pool : uuid string".
2067 #ifdef HAVE_WEAK_SYMBOLS
2068 #ifdef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2069 extern int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char *) __attribute__((weak));
2074 ocaml_libvirt_storage_pool_get_uuid_string (value poolv)
2077 #ifndef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2078 /* Symbol virStoragePoolGetUUIDString not found at compile time. */
2079 not_supported ("virStoragePoolGetUUIDString");
2082 /* Check that the symbol virStoragePoolGetUUIDString
2083 * is in runtime version of libvirt.
2085 WEAK_SYMBOL_CHECK (virStoragePoolGetUUIDString);
2088 virStoragePoolPtr pool = Pool_val (poolv);
2089 virConnectPtr conn = Connect_polv (poolv);
2090 char uuid[VIR_UUID_STRING_BUFLEN];
2093 NONBLOCKING (r = virStoragePoolGetUUIDString (pool, uuid));
2094 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUIDString");
2096 rv = caml_copy_string (uuid);
2101 /* Automatically generated binding for virStoragePoolCreateXML.
2102 * In generator.pl this function has signature "conn, string, 0U : pool".
2105 #ifdef HAVE_WEAK_SYMBOLS
2106 #ifdef HAVE_VIRSTORAGEPOOLCREATEXML
2107 extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
2112 ocaml_libvirt_storage_pool_create_xml (value connv, value strv)
2114 CAMLparam2 (connv, strv);
2115 #ifndef HAVE_VIRSTORAGEPOOLCREATEXML
2116 /* Symbol virStoragePoolCreateXML not found at compile time. */
2117 not_supported ("virStoragePoolCreateXML");
2120 /* Check that the symbol virStoragePoolCreateXML
2121 * is in runtime version of libvirt.
2123 WEAK_SYMBOL_CHECK (virStoragePoolCreateXML);
2126 virConnectPtr conn = Connect_val (connv);
2127 char *str = String_val (strv);
2128 virStoragePoolPtr r;
2130 NONBLOCKING (r = virStoragePoolCreateXML (conn, str, 0));
2131 CHECK_ERROR (!r, conn, "virStoragePoolCreateXML");
2133 rv = Val_pool (r, connv);
2139 /* Automatically generated binding for virStoragePoolDefineXML.
2140 * In generator.pl this function has signature "conn, string, 0U : pool".
2143 #ifdef HAVE_WEAK_SYMBOLS
2144 #ifdef HAVE_VIRSTORAGEPOOLDEFINEXML
2145 extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
2150 ocaml_libvirt_storage_pool_define_xml (value connv, value strv)
2152 CAMLparam2 (connv, strv);
2153 #ifndef HAVE_VIRSTORAGEPOOLDEFINEXML
2154 /* Symbol virStoragePoolDefineXML not found at compile time. */
2155 not_supported ("virStoragePoolDefineXML");
2158 /* Check that the symbol virStoragePoolDefineXML
2159 * is in runtime version of libvirt.
2161 WEAK_SYMBOL_CHECK (virStoragePoolDefineXML);
2164 virConnectPtr conn = Connect_val (connv);
2165 char *str = String_val (strv);
2166 virStoragePoolPtr r;
2168 NONBLOCKING (r = virStoragePoolDefineXML (conn, str, 0));
2169 CHECK_ERROR (!r, conn, "virStoragePoolDefineXML");
2171 rv = Val_pool (r, connv);
2177 /* Automatically generated binding for virStoragePoolBuild.
2178 * In generator.pl this function has signature "pool, uint : unit".
2181 #ifdef HAVE_WEAK_SYMBOLS
2182 #ifdef HAVE_VIRSTORAGEPOOLBUILD
2183 extern int virStoragePoolBuild (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
2188 ocaml_libvirt_storage_pool_build (value poolv, value iv)
2190 CAMLparam2 (poolv, iv);
2191 #ifndef HAVE_VIRSTORAGEPOOLBUILD
2192 /* Symbol virStoragePoolBuild not found at compile time. */
2193 not_supported ("virStoragePoolBuild");
2196 /* Check that the symbol virStoragePoolBuild
2197 * is in runtime version of libvirt.
2199 WEAK_SYMBOL_CHECK (virStoragePoolBuild);
2201 virStoragePoolPtr pool = Pool_val (poolv);
2202 virConnectPtr conn = Connect_polv (poolv);
2203 unsigned int i = Int_val (iv);
2206 NONBLOCKING (r = virStoragePoolBuild (pool, i));
2207 CHECK_ERROR (!r, conn, "virStoragePoolBuild");
2209 CAMLreturn (Val_unit);
2213 /* Automatically generated binding for virStoragePoolUndefine.
2214 * In generator.pl this function has signature "pool : unit".
2217 #ifdef HAVE_WEAK_SYMBOLS
2218 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
2219 extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
2224 ocaml_libvirt_storage_pool_undefine (value poolv)
2227 #ifndef HAVE_VIRSTORAGEPOOLUNDEFINE
2228 /* Symbol virStoragePoolUndefine not found at compile time. */
2229 not_supported ("virStoragePoolUndefine");
2232 /* Check that the symbol virStoragePoolUndefine
2233 * is in runtime version of libvirt.
2235 WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
2237 virStoragePoolPtr pool = Pool_val (poolv);
2238 virConnectPtr conn = Connect_polv (poolv);
2241 NONBLOCKING (r = virStoragePoolUndefine (pool));
2242 CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
2244 CAMLreturn (Val_unit);
2248 /* Automatically generated binding for virStoragePoolCreate.
2249 * In generator.pl this function has signature "pool, 0U : unit".
2252 #ifdef HAVE_WEAK_SYMBOLS
2253 #ifdef HAVE_VIRSTORAGEPOOLCREATE
2254 extern int virStoragePoolCreate (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
2259 ocaml_libvirt_storage_pool_create (value poolv)
2262 #ifndef HAVE_VIRSTORAGEPOOLCREATE
2263 /* Symbol virStoragePoolCreate not found at compile time. */
2264 not_supported ("virStoragePoolCreate");
2267 /* Check that the symbol virStoragePoolCreate
2268 * is in runtime version of libvirt.
2270 WEAK_SYMBOL_CHECK (virStoragePoolCreate);
2272 virStoragePoolPtr pool = Pool_val (poolv);
2273 virConnectPtr conn = Connect_polv (poolv);
2276 NONBLOCKING (r = virStoragePoolCreate (pool, 0));
2277 CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
2279 CAMLreturn (Val_unit);
2283 /* Automatically generated binding for virStoragePoolDelete.
2284 * In generator.pl this function has signature "pool, uint : unit".
2287 #ifdef HAVE_WEAK_SYMBOLS
2288 #ifdef HAVE_VIRSTORAGEPOOLDELETE
2289 extern int virStoragePoolDelete (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
2294 ocaml_libvirt_storage_pool_delete (value poolv, value iv)
2296 CAMLparam2 (poolv, iv);
2297 #ifndef HAVE_VIRSTORAGEPOOLDELETE
2298 /* Symbol virStoragePoolDelete not found at compile time. */
2299 not_supported ("virStoragePoolDelete");
2302 /* Check that the symbol virStoragePoolDelete
2303 * is in runtime version of libvirt.
2305 WEAK_SYMBOL_CHECK (virStoragePoolDelete);
2307 virStoragePoolPtr pool = Pool_val (poolv);
2308 virConnectPtr conn = Connect_polv (poolv);
2309 unsigned int i = Int_val (iv);
2312 NONBLOCKING (r = virStoragePoolDelete (pool, i));
2313 CHECK_ERROR (!r, conn, "virStoragePoolDelete");
2315 CAMLreturn (Val_unit);
2319 /* Automatically generated binding for virStoragePoolRefresh.
2320 * In generator.pl this function has signature "pool, 0U : unit".
2323 #ifdef HAVE_WEAK_SYMBOLS
2324 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
2325 extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
2330 ocaml_libvirt_storage_pool_refresh (value poolv)
2333 #ifndef HAVE_VIRSTORAGEPOOLREFRESH
2334 /* Symbol virStoragePoolRefresh not found at compile time. */
2335 not_supported ("virStoragePoolRefresh");
2338 /* Check that the symbol virStoragePoolRefresh
2339 * is in runtime version of libvirt.
2341 WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
2343 virStoragePoolPtr pool = Pool_val (poolv);
2344 virConnectPtr conn = Connect_polv (poolv);
2347 NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
2348 CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
2350 CAMLreturn (Val_unit);
2354 /* Automatically generated binding for virStoragePoolGetAutostart.
2355 * In generator.pl this function has signature "pool : bool".
2358 #ifdef HAVE_WEAK_SYMBOLS
2359 #ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2360 extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak));
2365 ocaml_libvirt_storage_pool_get_autostart (value poolv)
2368 #ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2369 /* Symbol virStoragePoolGetAutostart not found at compile time. */
2370 not_supported ("virStoragePoolGetAutostart");
2373 /* Check that the symbol virStoragePoolGetAutostart
2374 * is in runtime version of libvirt.
2376 WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
2378 virStoragePoolPtr pool = Pool_val (poolv);
2379 virConnectPtr conn = Connect_polv (poolv);
2382 NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
2383 CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
2385 CAMLreturn (b ? Val_true : Val_false);
2389 /* Automatically generated binding for virStoragePoolSetAutostart.
2390 * In generator.pl this function has signature "pool, bool : unit".
2393 #ifdef HAVE_WEAK_SYMBOLS
2394 #ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2395 extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak));
2400 ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
2402 CAMLparam2 (poolv, bv);
2403 #ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2404 /* Symbol virStoragePoolSetAutostart not found at compile time. */
2405 not_supported ("virStoragePoolSetAutostart");
2408 /* Check that the symbol virStoragePoolSetAutostart
2409 * is in runtime version of libvirt.
2411 WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
2413 virStoragePoolPtr pool = Pool_val (poolv);
2414 virConnectPtr conn = Connect_polv (poolv);
2417 b = bv == Val_true ? 1 : 0;
2419 NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
2420 CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
2422 CAMLreturn (Val_unit);
2426 /* Automatically generated binding for virStoragePoolNumOfVolumes.
2427 * In generator.pl this function has signature "pool : int".
2430 #ifdef HAVE_WEAK_SYMBOLS
2431 #ifdef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
2432 extern int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) __attribute__((weak));
2437 ocaml_libvirt_storage_pool_num_of_volumes (value poolv)
2440 #ifndef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
2441 /* Symbol virStoragePoolNumOfVolumes not found at compile time. */
2442 not_supported ("virStoragePoolNumOfVolumes");
2445 /* Check that the symbol virStoragePoolNumOfVolumes
2446 * is in runtime version of libvirt.
2448 WEAK_SYMBOL_CHECK (virStoragePoolNumOfVolumes);
2450 virStoragePoolPtr pool = Pool_val (poolv);
2451 virConnectPtr conn = Connect_polv (poolv);
2454 NONBLOCKING (r = virStoragePoolNumOfVolumes (pool));
2455 CHECK_ERROR (r == -1, conn, "virStoragePoolNumOfVolumes");
2457 CAMLreturn (Val_int (r));
2461 /* Automatically generated binding for virStoragePoolListVolumes.
2462 * In generator.pl this function has signature "pool, int : string array".
2465 #ifdef HAVE_WEAK_SYMBOLS
2466 #ifdef HAVE_VIRSTORAGEPOOLLISTVOLUMES
2467 extern int virStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int maxnames) __attribute__((weak));
2472 ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv)
2474 CAMLparam2 (poolv, iv);
2475 #ifndef HAVE_VIRSTORAGEPOOLLISTVOLUMES
2476 /* Symbol virStoragePoolListVolumes not found at compile time. */
2477 not_supported ("virStoragePoolListVolumes");
2480 /* Check that the symbol virStoragePoolListVolumes
2481 * is in runtime version of libvirt.
2483 WEAK_SYMBOL_CHECK (virStoragePoolListVolumes);
2485 CAMLlocal2 (rv, strv);
2486 virStoragePoolPtr pool = Pool_val (poolv);
2487 virConnectPtr conn = Connect_polv (poolv);
2488 int i = Int_val (iv);
2492 /* Some libvirt List* functions still throw exceptions if i == 0,
2493 * so catch that and return an empty array directly. This changes
2494 * the semantics slightly (masking other failures) but it's
2495 * unlikely anyone will care. RWMJ 2008/06/10
2498 rv = caml_alloc (0, 0);
2502 NONBLOCKING (r = virStoragePoolListVolumes (pool, names, i));
2503 CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes");
2505 rv = caml_alloc (r, 0);
2506 for (i = 0; i < r; ++i) {
2507 strv = caml_copy_string (names[i]);
2508 Store_field (rv, i, strv);
2516 /* Automatically generated binding for virStorageVolFree.
2517 * In generator.pl this function has signature "vol : free".
2520 #ifdef HAVE_WEAK_SYMBOLS
2521 #ifdef HAVE_VIRSTORAGEVOLFREE
2522 extern int virStorageVolFree (virStorageVolPtr vol) __attribute__((weak));
2527 ocaml_libvirt_storage_vol_free (value volv)
2530 #ifndef HAVE_VIRSTORAGEVOLFREE
2531 /* Symbol virStorageVolFree not found at compile time. */
2532 not_supported ("virStorageVolFree");
2535 /* Check that the symbol virStorageVolFree
2536 * is in runtime version of libvirt.
2538 WEAK_SYMBOL_CHECK (virStorageVolFree);
2540 virStorageVolPtr vol = Volume_val (volv);
2541 virConnectPtr conn = Connect_volv (volv);
2544 NONBLOCKING (r = virStorageVolFree (vol));
2545 CHECK_ERROR (r == -1, conn, "virStorageVolFree");
2547 /* So that we don't double-free in the finalizer: */
2548 Volume_val (volv) = NULL;
2550 CAMLreturn (Val_unit);
2554 /* Automatically generated binding for virStorageVolDelete.
2555 * In generator.pl this function has signature "vol, uint : unit".
2558 #ifdef HAVE_WEAK_SYMBOLS
2559 #ifdef HAVE_VIRSTORAGEVOLDELETE
2560 extern int virStorageVolDelete (virStorageVolPtr vol, unsigned int i) __attribute__((weak));
2565 ocaml_libvirt_storage_vol_delete (value volv, value iv)
2567 CAMLparam2 (volv, iv);
2568 #ifndef HAVE_VIRSTORAGEVOLDELETE
2569 /* Symbol virStorageVolDelete not found at compile time. */
2570 not_supported ("virStorageVolDelete");
2573 /* Check that the symbol virStorageVolDelete
2574 * is in runtime version of libvirt.
2576 WEAK_SYMBOL_CHECK (virStorageVolDelete);
2578 virStorageVolPtr vol = Volume_val (volv);
2579 virConnectPtr conn = Connect_volv (volv);
2580 unsigned int i = Int_val (iv);
2583 NONBLOCKING (r = virStorageVolDelete (vol, i));
2584 CHECK_ERROR (!r, conn, "virStorageVolDelete");
2586 CAMLreturn (Val_unit);
2590 /* Automatically generated binding for virStorageVolLookupByName.
2591 * In generator.pl this function has signature "pool, string : vol from pool".
2594 #ifdef HAVE_WEAK_SYMBOLS
2595 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2596 extern virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool, const char *str) __attribute__((weak));
2601 ocaml_libvirt_storage_vol_lookup_by_name (value poolv, value strv)
2603 CAMLparam2 (poolv, strv);
2604 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2605 /* Symbol virStorageVolLookupByName not found at compile time. */
2606 not_supported ("virStorageVolLookupByName");
2609 /* Check that the symbol virStorageVolLookupByName
2610 * is in runtime version of libvirt.
2612 WEAK_SYMBOL_CHECK (virStorageVolLookupByName);
2614 CAMLlocal2 (rv, connv);
2615 virStoragePoolPtr pool = Pool_val (poolv);
2616 virConnectPtr conn = Connect_polv (poolv);
2617 char *str = String_val (strv);
2620 NONBLOCKING (r = virStorageVolLookupByName (pool, str));
2621 CHECK_ERROR (!r, conn, "virStorageVolLookupByName");
2623 connv = Field (poolv, 1);
2624 rv = Val_volume (r, connv);
2630 /* Automatically generated binding for virStorageVolLookupByKey.
2631 * In generator.pl this function has signature "conn, string : vol".
2634 #ifdef HAVE_WEAK_SYMBOLS
2635 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2636 extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak));
2641 ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
2643 CAMLparam2 (connv, strv);
2644 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2645 /* Symbol virStorageVolLookupByKey not found at compile time. */
2646 not_supported ("virStorageVolLookupByKey");
2649 /* Check that the symbol virStorageVolLookupByKey
2650 * is in runtime version of libvirt.
2652 WEAK_SYMBOL_CHECK (virStorageVolLookupByKey);
2655 virConnectPtr conn = Connect_val (connv);
2656 char *str = String_val (strv);
2659 NONBLOCKING (r = virStorageVolLookupByKey (conn, str));
2660 CHECK_ERROR (!r, conn, "virStorageVolLookupByKey");
2662 rv = Val_volume (r, connv);
2668 /* Automatically generated binding for virStorageVolLookupByPath.
2669 * In generator.pl this function has signature "conn, string : vol".
2672 #ifdef HAVE_WEAK_SYMBOLS
2673 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2674 extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak));
2679 ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
2681 CAMLparam2 (connv, strv);
2682 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2683 /* Symbol virStorageVolLookupByPath not found at compile time. */
2684 not_supported ("virStorageVolLookupByPath");
2687 /* Check that the symbol virStorageVolLookupByPath
2688 * is in runtime version of libvirt.
2690 WEAK_SYMBOL_CHECK (virStorageVolLookupByPath);
2693 virConnectPtr conn = Connect_val (connv);
2694 char *str = String_val (strv);
2697 NONBLOCKING (r = virStorageVolLookupByPath (conn, str));
2698 CHECK_ERROR (!r, conn, "virStorageVolLookupByPath");
2700 rv = Val_volume (r, connv);
2706 /* Automatically generated binding for virStorageVolCreateXML.
2707 * In generator.pl this function has signature "pool, string, 0U : vol from pool".
2710 #ifdef HAVE_WEAK_SYMBOLS
2711 #ifdef HAVE_VIRSTORAGEVOLCREATEXML
2712 extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, unsigned int flags) __attribute__((weak));
2717 ocaml_libvirt_storage_vol_create_xml (value poolv, value strv)
2719 CAMLparam2 (poolv, strv);
2720 #ifndef HAVE_VIRSTORAGEVOLCREATEXML
2721 /* Symbol virStorageVolCreateXML not found at compile time. */
2722 not_supported ("virStorageVolCreateXML");
2725 /* Check that the symbol virStorageVolCreateXML
2726 * is in runtime version of libvirt.
2728 WEAK_SYMBOL_CHECK (virStorageVolCreateXML);
2730 CAMLlocal2 (rv, connv);
2731 virStoragePoolPtr pool = Pool_val (poolv);
2732 virConnectPtr conn = Connect_polv (poolv);
2733 char *str = String_val (strv);
2736 NONBLOCKING (r = virStorageVolCreateXML (pool, str, 0));
2737 CHECK_ERROR (!r, conn, "virStorageVolCreateXML");
2739 connv = Field (poolv, 1);
2740 rv = Val_volume (r, connv);
2746 /* Automatically generated binding for virStorageVolGetXMLDesc.
2747 * In generator.pl this function has signature "vol, 0U : string".
2750 #ifdef HAVE_WEAK_SYMBOLS
2751 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
2752 extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, unsigned int flags) __attribute__((weak));
2757 ocaml_libvirt_storage_vol_get_xml_desc (value volv)
2760 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
2761 /* Symbol virStorageVolGetXMLDesc not found at compile time. */
2762 not_supported ("virStorageVolGetXMLDesc");
2765 /* Check that the symbol virStorageVolGetXMLDesc
2766 * is in runtime version of libvirt.
2768 WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
2771 virStorageVolPtr vol = Volume_val (volv);
2772 virConnectPtr conn = Connect_volv (volv);
2775 NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0));
2776 CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
2778 rv = caml_copy_string (r);
2784 /* Automatically generated binding for virStorageVolGetPath.
2785 * In generator.pl this function has signature "vol : string".
2788 #ifdef HAVE_WEAK_SYMBOLS
2789 #ifdef HAVE_VIRSTORAGEVOLGETPATH
2790 extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak));
2795 ocaml_libvirt_storage_vol_get_path (value volv)
2798 #ifndef HAVE_VIRSTORAGEVOLGETPATH
2799 /* Symbol virStorageVolGetPath not found at compile time. */
2800 not_supported ("virStorageVolGetPath");
2803 /* Check that the symbol virStorageVolGetPath
2804 * is in runtime version of libvirt.
2806 WEAK_SYMBOL_CHECK (virStorageVolGetPath);
2809 virStorageVolPtr vol = Volume_val (volv);
2810 virConnectPtr conn = Connect_volv (volv);
2813 NONBLOCKING (r = virStorageVolGetPath (vol));
2814 CHECK_ERROR (!r, conn, "virStorageVolGetPath");
2816 rv = caml_copy_string (r);
2822 /* Automatically generated binding for virStorageVolGetKey.
2823 * In generator.pl this function has signature "vol : static string".
2826 #ifdef HAVE_WEAK_SYMBOLS
2827 #ifdef HAVE_VIRSTORAGEVOLGETKEY
2828 extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak));
2833 ocaml_libvirt_storage_vol_get_key (value volv)
2836 #ifndef HAVE_VIRSTORAGEVOLGETKEY
2837 /* Symbol virStorageVolGetKey not found at compile time. */
2838 not_supported ("virStorageVolGetKey");
2841 /* Check that the symbol virStorageVolGetKey
2842 * is in runtime version of libvirt.
2844 WEAK_SYMBOL_CHECK (virStorageVolGetKey);
2847 virStorageVolPtr vol = Volume_val (volv);
2848 virConnectPtr conn = Connect_volv (volv);
2851 NONBLOCKING (r = virStorageVolGetKey (vol));
2852 CHECK_ERROR (!r, conn, "virStorageVolGetKey");
2854 rv = caml_copy_string (r);
2859 /* Automatically generated binding for virStorageVolGetName.
2860 * In generator.pl this function has signature "vol : static string".
2863 #ifdef HAVE_WEAK_SYMBOLS
2864 #ifdef HAVE_VIRSTORAGEVOLGETNAME
2865 extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak));
2870 ocaml_libvirt_storage_vol_get_name (value volv)
2873 #ifndef HAVE_VIRSTORAGEVOLGETNAME
2874 /* Symbol virStorageVolGetName not found at compile time. */
2875 not_supported ("virStorageVolGetName");
2878 /* Check that the symbol virStorageVolGetName
2879 * is in runtime version of libvirt.
2881 WEAK_SYMBOL_CHECK (virStorageVolGetName);
2884 virStorageVolPtr vol = Volume_val (volv);
2885 virConnectPtr conn = Connect_volv (volv);
2888 NONBLOCKING (r = virStorageVolGetName (vol));
2889 CHECK_ERROR (!r, conn, "virStorageVolGetName");
2891 rv = caml_copy_string (r);
2896 /* Automatically generated binding for virStoragePoolLookupByVolume.
2897 * In generator.pl this function has signature "vol : pool from vol".
2900 #ifdef HAVE_WEAK_SYMBOLS
2901 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2902 extern virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) __attribute__((weak));
2907 ocaml_libvirt_storage_pool_lookup_by_volume (value volv)
2910 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2911 /* Symbol virStoragePoolLookupByVolume not found at compile time. */
2912 not_supported ("virStoragePoolLookupByVolume");
2915 /* Check that the symbol virStoragePoolLookupByVolume
2916 * is in runtime version of libvirt.
2918 WEAK_SYMBOL_CHECK (virStoragePoolLookupByVolume);
2920 CAMLlocal2 (rv, connv);
2921 virStorageVolPtr vol = Volume_val (volv);
2922 virConnectPtr conn = Connect_volv (volv);
2923 virStoragePoolPtr r;
2925 NONBLOCKING (r = virStoragePoolLookupByVolume (vol));
2926 CHECK_ERROR (!r, conn, "virStoragePoolLookupByVolume");
2928 connv = Field (volv, 1);
2929 rv = Val_pool (r, connv);
2935 /* Automatically generated binding for virJobFree.
2936 * In generator.pl this function has signature "job : free".
2939 #ifdef HAVE_WEAK_SYMBOLS
2940 #ifdef HAVE_VIRJOBFREE
2941 extern int virJobFree (virJobPtr job) __attribute__((weak));
2946 ocaml_libvirt_job_free (value jobv)
2949 #ifndef HAVE_VIRJOBFREE
2950 /* Symbol virJobFree not found at compile time. */
2951 not_supported ("virJobFree");
2954 /* Check that the symbol virJobFree
2955 * is in runtime version of libvirt.
2957 WEAK_SYMBOL_CHECK (virJobFree);
2959 virJobPtr job = Job_val (jobv);
2960 virConnectPtr conn = Connect_jobv (jobv);
2963 NONBLOCKING (r = virJobFree (job));
2964 CHECK_ERROR (r == -1, conn, "virJobFree");
2966 /* So that we don't double-free in the finalizer: */
2967 Job_val (jobv) = NULL;
2969 CAMLreturn (Val_unit);
2973 /* Automatically generated binding for virJobCancel.
2974 * In generator.pl this function has signature "job : unit".
2977 #ifdef HAVE_WEAK_SYMBOLS
2978 #ifdef HAVE_VIRJOBCANCEL
2979 extern int virJobCancel (virJobPtr job) __attribute__((weak));
2984 ocaml_libvirt_job_cancel (value jobv)
2987 #ifndef HAVE_VIRJOBCANCEL
2988 /* Symbol virJobCancel not found at compile time. */
2989 not_supported ("virJobCancel");
2992 /* Check that the symbol virJobCancel
2993 * is in runtime version of libvirt.
2995 WEAK_SYMBOL_CHECK (virJobCancel);
2997 virJobPtr job = Job_val (jobv);
2998 virConnectPtr conn = Connect_jobv (jobv);
3001 NONBLOCKING (r = virJobCancel (job));
3002 CHECK_ERROR (r == -1, conn, "virJobCancel");
3004 CAMLreturn (Val_unit);
3008 /* Automatically generated binding for virJobGetNetwork.
3009 * In generator.pl this function has signature "job : net from job".
3012 #ifdef HAVE_WEAK_SYMBOLS
3013 #ifdef HAVE_VIRJOBGETNETWORK
3014 extern virNetworkPtr virJobGetNetwork (virJobPtr job) __attribute__((weak));
3019 ocaml_libvirt_job_get_network (value jobv)
3022 #ifndef HAVE_VIRJOBGETNETWORK
3023 /* Symbol virJobGetNetwork not found at compile time. */
3024 not_supported ("virJobGetNetwork");
3027 /* Check that the symbol virJobGetNetwork
3028 * is in runtime version of libvirt.
3030 WEAK_SYMBOL_CHECK (virJobGetNetwork);
3032 CAMLlocal2 (rv, connv);
3033 virJobPtr job = Job_val (jobv);
3034 virConnectPtr conn = Connect_jobv (jobv);
3037 NONBLOCKING (r = virJobGetNetwork (job));
3038 CHECK_ERROR (!r, conn, "virJobGetNetwork");
3040 connv = Field (jobv, 1);
3041 rv = Val_network (r, connv);
3047 /* Automatically generated binding for virJobGetDomain.
3048 * In generator.pl this function has signature "job : dom from job".
3051 #ifdef HAVE_WEAK_SYMBOLS
3052 #ifdef HAVE_VIRJOBGETDOMAIN
3053 extern virDomainPtr virJobGetDomain (virJobPtr job) __attribute__((weak));
3058 ocaml_libvirt_job_get_domain (value jobv)
3061 #ifndef HAVE_VIRJOBGETDOMAIN
3062 /* Symbol virJobGetDomain not found at compile time. */
3063 not_supported ("virJobGetDomain");
3066 /* Check that the symbol virJobGetDomain
3067 * is in runtime version of libvirt.
3069 WEAK_SYMBOL_CHECK (virJobGetDomain);
3071 CAMLlocal2 (rv, connv);
3072 virJobPtr job = Job_val (jobv);
3073 virConnectPtr conn = Connect_jobv (jobv);
3076 NONBLOCKING (r = virJobGetDomain (job));
3077 CHECK_ERROR (!r, conn, "virJobGetDomain");
3079 connv = Field (jobv, 1);
3080 rv = Val_domain (r, connv);
3086 #include "libvirt_c_epilogue.c"