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.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 #include <libvirt/libvirt.h>
34 #include <libvirt/virterror.h>
36 #include <caml/config.h>
37 #include <caml/alloc.h>
38 #include <caml/callback.h>
39 #include <caml/custom.h>
40 #include <caml/fail.h>
41 #include <caml/memory.h>
42 #include <caml/misc.h>
43 #include <caml/mlvalues.h>
44 #include <caml/signals.h>
46 #include "libvirt_c_prologue.c"
48 #include "libvirt_c_oneoffs.c"
50 /* Automatically generated binding for virConnectClose.
51 * In generator.pl this function has signature "conn : free".
55 ocaml_libvirt_connect_close (value connv)
59 virConnectPtr conn = Connect_val (connv);
62 NONBLOCKING (r = virConnectClose (conn));
63 CHECK_ERROR (r == -1, conn, "virConnectClose");
65 /* So that we don't double-free in the finalizer: */
66 Connect_val (connv) = NULL;
68 CAMLreturn (Val_unit);
71 /* Automatically generated binding for virConnectGetHostname.
72 * In generator.pl this function has signature "conn : string".
75 #ifdef HAVE_WEAK_SYMBOLS
76 #ifdef HAVE_VIRCONNECTGETHOSTNAME
77 extern char *virConnectGetHostname (virConnectPtr conn) __attribute__((weak));
82 ocaml_libvirt_connect_get_hostname (value connv)
85 #ifndef HAVE_VIRCONNECTGETHOSTNAME
86 /* Symbol virConnectGetHostname not found at compile time. */
87 not_supported ("virConnectGetHostname");
88 /* Suppresses a compiler warning. */
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");
126 /* Suppresses a compiler warning. */
129 /* Check that the symbol virConnectGetURI
130 * is in runtime version of libvirt.
132 WEAK_SYMBOL_CHECK (virConnectGetURI);
135 virConnectPtr conn = Connect_val (connv);
138 NONBLOCKING (r = virConnectGetURI (conn));
139 CHECK_ERROR (!r, conn, "virConnectGetURI");
141 rv = caml_copy_string (r);
147 /* Automatically generated binding for virConnectGetType.
148 * In generator.pl this function has signature "conn : static string".
152 ocaml_libvirt_connect_get_type (value connv)
157 virConnectPtr conn = Connect_val (connv);
160 NONBLOCKING (r = virConnectGetType (conn));
161 CHECK_ERROR (!r, conn, "virConnectGetType");
163 rv = caml_copy_string (r);
167 /* Automatically generated binding for virConnectNumOfDomains.
168 * In generator.pl this function has signature "conn : int".
172 ocaml_libvirt_connect_num_of_domains (value connv)
176 virConnectPtr conn = Connect_val (connv);
179 NONBLOCKING (r = virConnectNumOfDomains (conn));
180 CHECK_ERROR (r == -1, conn, "virConnectNumOfDomains");
182 CAMLreturn (Val_int (r));
185 /* Automatically generated binding for virConnectListDomains.
186 * In generator.pl this function has signature "conn, int : int array".
190 ocaml_libvirt_connect_list_domains (value connv, value iv)
192 CAMLparam2 (connv, iv);
195 virConnectPtr conn = Connect_val (connv);
196 int i = Int_val (iv);
199 NONBLOCKING (r = virConnectListDomains (conn, ids, i));
200 CHECK_ERROR (r == -1, conn, "virConnectListDomains");
202 rv = caml_alloc (r, 0);
203 for (i = 0; i < r; ++i)
204 Store_field (rv, i, Val_int (ids[i]));
209 /* Automatically generated binding for virConnectNumOfDefinedDomains.
210 * In generator.pl this function has signature "conn : int".
214 ocaml_libvirt_connect_num_of_defined_domains (value connv)
218 virConnectPtr conn = Connect_val (connv);
221 NONBLOCKING (r = virConnectNumOfDefinedDomains (conn));
222 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedDomains");
224 CAMLreturn (Val_int (r));
227 /* Automatically generated binding for virConnectListDefinedDomains.
228 * In generator.pl this function has signature "conn, int : string array".
232 ocaml_libvirt_connect_list_defined_domains (value connv, value iv)
234 CAMLparam2 (connv, iv);
236 CAMLlocal2 (rv, strv);
237 virConnectPtr conn = Connect_val (connv);
238 int i = Int_val (iv);
242 NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i));
243 CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
245 rv = caml_alloc (r, 0);
246 for (i = 0; i < r; ++i) {
247 strv = caml_copy_string (names[i]);
248 Store_field (rv, i, strv);
255 /* Automatically generated binding for virConnectNumOfNetworks.
256 * In generator.pl this function has signature "conn : int".
260 ocaml_libvirt_connect_num_of_networks (value connv)
264 virConnectPtr conn = Connect_val (connv);
267 NONBLOCKING (r = virConnectNumOfNetworks (conn));
268 CHECK_ERROR (r == -1, conn, "virConnectNumOfNetworks");
270 CAMLreturn (Val_int (r));
273 /* Automatically generated binding for virConnectListNetworks.
274 * In generator.pl this function has signature "conn, int : string array".
278 ocaml_libvirt_connect_list_networks (value connv, value iv)
280 CAMLparam2 (connv, iv);
282 CAMLlocal2 (rv, strv);
283 virConnectPtr conn = Connect_val (connv);
284 int i = Int_val (iv);
288 NONBLOCKING (r = virConnectListNetworks (conn, names, i));
289 CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
291 rv = caml_alloc (r, 0);
292 for (i = 0; i < r; ++i) {
293 strv = caml_copy_string (names[i]);
294 Store_field (rv, i, strv);
301 /* Automatically generated binding for virConnectNumOfDefinedNetworks.
302 * In generator.pl this function has signature "conn : int".
306 ocaml_libvirt_connect_num_of_defined_networks (value connv)
310 virConnectPtr conn = Connect_val (connv);
313 NONBLOCKING (r = virConnectNumOfDefinedNetworks (conn));
314 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedNetworks");
316 CAMLreturn (Val_int (r));
319 /* Automatically generated binding for virConnectListDefinedNetworks.
320 * In generator.pl this function has signature "conn, int : string array".
324 ocaml_libvirt_connect_list_defined_networks (value connv, value iv)
326 CAMLparam2 (connv, iv);
328 CAMLlocal2 (rv, strv);
329 virConnectPtr conn = Connect_val (connv);
330 int i = Int_val (iv);
334 NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i));
335 CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
337 rv = caml_alloc (r, 0);
338 for (i = 0; i < r; ++i) {
339 strv = caml_copy_string (names[i]);
340 Store_field (rv, i, strv);
347 /* Automatically generated binding for virConnectNumOfStoragePools.
348 * In generator.pl this function has signature "conn : int".
351 #ifdef HAVE_WEAK_SYMBOLS
352 #ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
353 extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak));
358 ocaml_libvirt_connect_num_of_storage_pools (value connv)
361 #ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
362 /* Symbol virConnectNumOfStoragePools not found at compile time. */
363 not_supported ("virConnectNumOfStoragePools");
364 /* Suppresses a compiler warning. */
367 /* Check that the symbol virConnectNumOfStoragePools
368 * is in runtime version of libvirt.
370 WEAK_SYMBOL_CHECK (virConnectNumOfStoragePools);
372 virConnectPtr conn = Connect_val (connv);
375 NONBLOCKING (r = virConnectNumOfStoragePools (conn));
376 CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools");
378 CAMLreturn (Val_int (r));
382 /* Automatically generated binding for virConnectListStoragePools.
383 * In generator.pl this function has signature "conn, int : string array".
386 #ifdef HAVE_WEAK_SYMBOLS
387 #ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS
388 extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
393 ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
395 CAMLparam2 (connv, iv);
396 #ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS
397 /* Symbol virConnectListStoragePools not found at compile time. */
398 not_supported ("virConnectListStoragePools");
399 /* Suppresses a compiler warning. */
402 /* Check that the symbol virConnectListStoragePools
403 * is in runtime version of libvirt.
405 WEAK_SYMBOL_CHECK (virConnectListStoragePools);
407 CAMLlocal2 (rv, strv);
408 virConnectPtr conn = Connect_val (connv);
409 int i = Int_val (iv);
413 NONBLOCKING (r = virConnectListStoragePools (conn, names, i));
414 CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
416 rv = caml_alloc (r, 0);
417 for (i = 0; i < r; ++i) {
418 strv = caml_copy_string (names[i]);
419 Store_field (rv, i, strv);
427 /* Automatically generated binding for virConnectNumOfDefinedStoragePools.
428 * In generator.pl this function has signature "conn : int".
431 #ifdef HAVE_WEAK_SYMBOLS
432 #ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
433 extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak));
438 ocaml_libvirt_connect_num_of_defined_storage_pools (value connv)
441 #ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
442 /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */
443 not_supported ("virConnectNumOfDefinedStoragePools");
444 /* Suppresses a compiler warning. */
447 /* Check that the symbol virConnectNumOfDefinedStoragePools
448 * is in runtime version of libvirt.
450 WEAK_SYMBOL_CHECK (virConnectNumOfDefinedStoragePools);
452 virConnectPtr conn = Connect_val (connv);
455 NONBLOCKING (r = virConnectNumOfDefinedStoragePools (conn));
456 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools");
458 CAMLreturn (Val_int (r));
462 /* Automatically generated binding for virConnectListDefinedStoragePools.
463 * In generator.pl this function has signature "conn, int : string array".
466 #ifdef HAVE_WEAK_SYMBOLS
467 #ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
468 extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
473 ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
475 CAMLparam2 (connv, iv);
476 #ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
477 /* Symbol virConnectListDefinedStoragePools not found at compile time. */
478 not_supported ("virConnectListDefinedStoragePools");
479 /* Suppresses a compiler warning. */
482 /* Check that the symbol virConnectListDefinedStoragePools
483 * is in runtime version of libvirt.
485 WEAK_SYMBOL_CHECK (virConnectListDefinedStoragePools);
487 CAMLlocal2 (rv, strv);
488 virConnectPtr conn = Connect_val (connv);
489 int i = Int_val (iv);
493 NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i));
494 CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
496 rv = caml_alloc (r, 0);
497 for (i = 0; i < r; ++i) {
498 strv = caml_copy_string (names[i]);
499 Store_field (rv, i, strv);
507 /* Automatically generated binding for virConnectGetCapabilities.
508 * In generator.pl this function has signature "conn : string".
512 ocaml_libvirt_connect_get_capabilities (value connv)
517 virConnectPtr conn = Connect_val (connv);
520 NONBLOCKING (r = virConnectGetCapabilities (conn));
521 CHECK_ERROR (!r, conn, "virConnectGetCapabilities");
523 rv = caml_copy_string (r);
528 /* Automatically generated binding for virDomainCreateLinux.
529 * In generator.pl this function has signature "conn, string, 0U : dom".
533 ocaml_libvirt_domain_create_linux (value connv, value strv)
535 CAMLparam2 (connv, strv);
538 virConnectPtr conn = Connect_val (connv);
539 char *str = String_val (strv);
542 NONBLOCKING (r = virDomainCreateLinux (conn, str, 0));
543 CHECK_ERROR (!r, conn, "virDomainCreateLinux");
545 rv = Val_domain (r, connv);
550 /* Automatically generated binding for virDomainCreateLinuxJob.
551 * In generator.pl this function has signature "conn, string, 0U : job".
554 #ifdef HAVE_WEAK_SYMBOLS
555 #ifdef HAVE_VIRDOMAINCREATELINUXJOB
556 extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
561 ocaml_libvirt_domain_create_linux_job (value connv, value strv)
563 CAMLparam2 (connv, strv);
564 #ifndef HAVE_VIRDOMAINCREATELINUXJOB
565 /* Symbol virDomainCreateLinuxJob not found at compile time. */
566 not_supported ("virDomainCreateLinuxJob");
567 /* Suppresses a compiler warning. */
570 /* Check that the symbol virDomainCreateLinuxJob
571 * is in runtime version of libvirt.
573 WEAK_SYMBOL_CHECK (virDomainCreateLinuxJob);
576 virConnectPtr conn = Connect_val (connv);
577 char *str = String_val (strv);
580 NONBLOCKING (r = virDomainCreateLinuxJob (conn, str, 0));
581 CHECK_ERROR (!r, conn, "virDomainCreateLinuxJob");
583 rv = Val_job (r, connv);
589 /* Automatically generated binding for virDomainFree.
590 * In generator.pl this function has signature "dom : free".
594 ocaml_libvirt_domain_free (value domv)
598 virDomainPtr dom = Domain_val (domv);
599 virConnectPtr conn = Connect_domv (domv);
602 NONBLOCKING (r = virDomainFree (dom));
603 CHECK_ERROR (r == -1, conn, "virDomainFree");
605 /* So that we don't double-free in the finalizer: */
606 Domain_val (domv) = NULL;
608 CAMLreturn (Val_unit);
611 /* Automatically generated binding for virDomainDestroy.
612 * In generator.pl this function has signature "dom : free".
616 ocaml_libvirt_domain_destroy (value domv)
620 virDomainPtr dom = Domain_val (domv);
621 virConnectPtr conn = Connect_domv (domv);
624 NONBLOCKING (r = virDomainDestroy (dom));
625 CHECK_ERROR (r == -1, conn, "virDomainDestroy");
627 /* So that we don't double-free in the finalizer: */
628 Domain_val (domv) = NULL;
630 CAMLreturn (Val_unit);
633 /* Automatically generated binding for virDomainLookupByName.
634 * In generator.pl this function has signature "conn, string : dom".
638 ocaml_libvirt_domain_lookup_by_name (value connv, value strv)
640 CAMLparam2 (connv, strv);
643 virConnectPtr conn = Connect_val (connv);
644 char *str = String_val (strv);
647 NONBLOCKING (r = virDomainLookupByName (conn, str));
648 CHECK_ERROR (!r, conn, "virDomainLookupByName");
650 rv = Val_domain (r, connv);
655 /* Automatically generated binding for virDomainLookupByID.
656 * In generator.pl this function has signature "conn, int : dom".
660 ocaml_libvirt_domain_lookup_by_id (value connv, value iv)
662 CAMLparam2 (connv, iv);
665 virConnectPtr conn = Connect_val (connv);
666 int i = Int_val (iv);
669 NONBLOCKING (r = virDomainLookupByID (conn, i));
670 CHECK_ERROR (!r, conn, "virDomainLookupByID");
672 rv = Val_domain (r, connv);
677 /* Automatically generated binding for virDomainLookupByUUID.
678 * In generator.pl this function has signature "conn, uuid : dom".
682 ocaml_libvirt_domain_lookup_by_uuid (value connv, value uuidv)
684 CAMLparam2 (connv, uuidv);
687 virConnectPtr conn = Connect_val (connv);
688 unsigned char *uuid = (unsigned char *) String_val (uuidv);
691 NONBLOCKING (r = virDomainLookupByUUID (conn, uuid));
692 CHECK_ERROR (!r, conn, "virDomainLookupByUUID");
694 rv = Val_domain (r, connv);
699 /* Automatically generated binding for virDomainLookupByUUIDString.
700 * In generator.pl this function has signature "conn, string : dom".
704 ocaml_libvirt_domain_lookup_by_uuid_string (value connv, value strv)
706 CAMLparam2 (connv, strv);
709 virConnectPtr conn = Connect_val (connv);
710 char *str = String_val (strv);
713 NONBLOCKING (r = virDomainLookupByUUIDString (conn, str));
714 CHECK_ERROR (!r, conn, "virDomainLookupByUUIDString");
716 rv = Val_domain (r, connv);
721 /* Automatically generated binding for virDomainGetName.
722 * In generator.pl this function has signature "dom : static string".
726 ocaml_libvirt_domain_get_name (value domv)
731 virDomainPtr dom = Domain_val (domv);
732 virConnectPtr conn = Connect_domv (domv);
735 NONBLOCKING (r = virDomainGetName (dom));
736 CHECK_ERROR (!r, conn, "virDomainGetName");
738 rv = caml_copy_string (r);
742 /* Automatically generated binding for virDomainGetOSType.
743 * In generator.pl this function has signature "dom : string".
747 ocaml_libvirt_domain_get_os_type (value domv)
752 virDomainPtr dom = Domain_val (domv);
753 virConnectPtr conn = Connect_domv (domv);
756 NONBLOCKING (r = virDomainGetOSType (dom));
757 CHECK_ERROR (!r, conn, "virDomainGetOSType");
759 rv = caml_copy_string (r);
764 /* Automatically generated binding for virDomainGetXMLDesc.
765 * In generator.pl this function has signature "dom, 0 : string".
769 ocaml_libvirt_domain_get_xml_desc (value domv)
774 virDomainPtr dom = Domain_val (domv);
775 virConnectPtr conn = Connect_domv (domv);
778 NONBLOCKING (r = virDomainGetXMLDesc (dom, 0));
779 CHECK_ERROR (!r, conn, "virDomainGetXMLDesc");
781 rv = caml_copy_string (r);
786 /* Automatically generated binding for virDomainGetUUID.
787 * In generator.pl this function has signature "dom : uuid".
791 ocaml_libvirt_domain_get_uuid (value domv)
796 virDomainPtr dom = Domain_val (domv);
797 virConnectPtr conn = Connect_domv (domv);
798 unsigned char uuid[VIR_UUID_BUFLEN];
801 NONBLOCKING (r = virDomainGetUUID (dom, uuid));
802 CHECK_ERROR (r == -1, conn, "virDomainGetUUID");
804 /* UUIDs are byte arrays with a fixed length. */
805 rv = caml_alloc_string (VIR_UUID_BUFLEN);
806 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
810 /* Automatically generated binding for virDomainGetUUIDString.
811 * In generator.pl this function has signature "dom : uuid string".
815 ocaml_libvirt_domain_get_uuid_string (value domv)
820 virDomainPtr dom = Domain_val (domv);
821 virConnectPtr conn = Connect_domv (domv);
822 char uuid[VIR_UUID_STRING_BUFLEN];
825 NONBLOCKING (r = virDomainGetUUIDString (dom, uuid));
826 CHECK_ERROR (r == -1, conn, "virDomainGetUUIDString");
828 rv = caml_copy_string (uuid);
832 /* Automatically generated binding for virDomainGetMaxVcpus.
833 * In generator.pl this function has signature "dom : int".
837 ocaml_libvirt_domain_get_max_vcpus (value domv)
841 virDomainPtr dom = Domain_val (domv);
842 virConnectPtr conn = Connect_domv (domv);
845 NONBLOCKING (r = virDomainGetMaxVcpus (dom));
846 CHECK_ERROR (r == -1, conn, "virDomainGetMaxVcpus");
848 CAMLreturn (Val_int (r));
851 /* Automatically generated binding for virDomainSave.
852 * In generator.pl this function has signature "dom, string : unit".
856 ocaml_libvirt_domain_save (value domv, value strv)
858 CAMLparam2 (domv, strv);
860 virDomainPtr dom = Domain_val (domv);
861 virConnectPtr conn = Connect_domv (domv);
862 char *str = String_val (strv);
865 NONBLOCKING (r = virDomainSave (dom, str));
866 CHECK_ERROR (r == -1, conn, "virDomainSave");
868 CAMLreturn (Val_unit);
871 /* Automatically generated binding for virDomainSaveJob.
872 * In generator.pl this function has signature "dom, string : job from dom".
875 #ifdef HAVE_WEAK_SYMBOLS
876 #ifdef HAVE_VIRDOMAINSAVEJOB
877 extern virJobPtr virDomainSaveJob (virDomainPtr dom, const char *str) __attribute__((weak));
882 ocaml_libvirt_domain_save_job (value domv, value strv)
884 CAMLparam2 (domv, strv);
885 #ifndef HAVE_VIRDOMAINSAVEJOB
886 /* Symbol virDomainSaveJob not found at compile time. */
887 not_supported ("virDomainSaveJob");
888 /* Suppresses a compiler warning. */
891 /* Check that the symbol virDomainSaveJob
892 * is in runtime version of libvirt.
894 WEAK_SYMBOL_CHECK (virDomainSaveJob);
896 CAMLlocal2 (rv, connv);
897 virDomainPtr dom = Domain_val (domv);
898 virConnectPtr conn = Connect_domv (domv);
899 char *str = String_val (strv);
902 NONBLOCKING (r = virDomainSaveJob (dom, str));
903 CHECK_ERROR (!r, conn, "virDomainSaveJob");
905 connv = Field (domv, 1);
906 rv = Val_job (r, connv);
912 /* Automatically generated binding for virDomainRestore.
913 * In generator.pl this function has signature "conn, string : unit".
917 ocaml_libvirt_domain_restore (value connv, value strv)
919 CAMLparam2 (connv, strv);
921 virConnectPtr conn = Connect_val (connv);
922 char *str = String_val (strv);
925 NONBLOCKING (r = virDomainRestore (conn, str));
926 CHECK_ERROR (r == -1, conn, "virDomainRestore");
928 CAMLreturn (Val_unit);
931 /* Automatically generated binding for virDomainRestoreJob.
932 * In generator.pl this function has signature "conn, string : job".
935 #ifdef HAVE_WEAK_SYMBOLS
936 #ifdef HAVE_VIRDOMAINRESTOREJOB
937 extern virJobPtr virDomainRestoreJob (virConnectPtr conn, const char *str) __attribute__((weak));
942 ocaml_libvirt_domain_restore_job (value connv, value strv)
944 CAMLparam2 (connv, strv);
945 #ifndef HAVE_VIRDOMAINRESTOREJOB
946 /* Symbol virDomainRestoreJob not found at compile time. */
947 not_supported ("virDomainRestoreJob");
948 /* Suppresses a compiler warning. */
951 /* Check that the symbol virDomainRestoreJob
952 * is in runtime version of libvirt.
954 WEAK_SYMBOL_CHECK (virDomainRestoreJob);
957 virConnectPtr conn = Connect_val (connv);
958 char *str = String_val (strv);
961 NONBLOCKING (r = virDomainRestoreJob (conn, str));
962 CHECK_ERROR (!r, conn, "virDomainRestoreJob");
964 rv = Val_job (r, connv);
970 /* Automatically generated binding for virDomainCoreDump.
971 * In generator.pl this function has signature "dom, string, 0 : unit".
975 ocaml_libvirt_domain_core_dump (value domv, value strv)
977 CAMLparam2 (domv, strv);
980 virDomainPtr dom = Domain_val (domv);
981 virConnectPtr conn = Connect_domv (domv);
982 char *str = String_val (strv);
985 NONBLOCKING (r = virDomainCoreDump (dom, str, 0));
986 CHECK_ERROR (!r, conn, "virDomainCoreDump");
988 CAMLreturn (Val_unit);
991 /* Automatically generated binding for virDomainCoreDumpJob.
992 * In generator.pl this function has signature "dom, string, 0 : job from dom".
995 #ifdef HAVE_WEAK_SYMBOLS
996 #ifdef HAVE_VIRDOMAINCOREDUMPJOB
997 extern virJobPtr virDomainCoreDumpJob (virDomainPtr dom, const char *str, int flags) __attribute__((weak));
1002 ocaml_libvirt_domain_core_dump_job (value domv, value strv)
1004 CAMLparam2 (domv, strv);
1005 #ifndef HAVE_VIRDOMAINCOREDUMPJOB
1006 /* Symbol virDomainCoreDumpJob not found at compile time. */
1007 not_supported ("virDomainCoreDumpJob");
1008 /* Suppresses a compiler warning. */
1011 /* Check that the symbol virDomainCoreDumpJob
1012 * is in runtime version of libvirt.
1014 WEAK_SYMBOL_CHECK (virDomainCoreDumpJob);
1016 CAMLlocal2 (rv, connv);
1017 virDomainPtr dom = Domain_val (domv);
1018 virConnectPtr conn = Connect_domv (domv);
1019 char *str = String_val (strv);
1022 NONBLOCKING (r = virDomainCoreDumpJob (dom, str, 0));
1023 CHECK_ERROR (!r, conn, "virDomainCoreDumpJob");
1025 connv = Field (domv, 1);
1026 rv = Val_job (r, connv);
1032 /* Automatically generated binding for virDomainSuspend.
1033 * In generator.pl this function has signature "dom : unit".
1037 ocaml_libvirt_domain_suspend (value domv)
1041 virDomainPtr dom = Domain_val (domv);
1042 virConnectPtr conn = Connect_domv (domv);
1045 NONBLOCKING (r = virDomainSuspend (dom));
1046 CHECK_ERROR (r == -1, conn, "virDomainSuspend");
1048 CAMLreturn (Val_unit);
1051 /* Automatically generated binding for virDomainResume.
1052 * In generator.pl this function has signature "dom : unit".
1056 ocaml_libvirt_domain_resume (value domv)
1060 virDomainPtr dom = Domain_val (domv);
1061 virConnectPtr conn = Connect_domv (domv);
1064 NONBLOCKING (r = virDomainResume (dom));
1065 CHECK_ERROR (r == -1, conn, "virDomainResume");
1067 CAMLreturn (Val_unit);
1070 /* Automatically generated binding for virDomainShutdown.
1071 * In generator.pl this function has signature "dom : unit".
1075 ocaml_libvirt_domain_shutdown (value domv)
1079 virDomainPtr dom = Domain_val (domv);
1080 virConnectPtr conn = Connect_domv (domv);
1083 NONBLOCKING (r = virDomainShutdown (dom));
1084 CHECK_ERROR (r == -1, conn, "virDomainShutdown");
1086 CAMLreturn (Val_unit);
1089 /* Automatically generated binding for virDomainReboot.
1090 * In generator.pl this function has signature "dom, 0 : unit".
1094 ocaml_libvirt_domain_reboot (value domv)
1098 virDomainPtr dom = Domain_val (domv);
1099 virConnectPtr conn = Connect_domv (domv);
1102 NONBLOCKING (r = virDomainReboot (dom, 0));
1103 CHECK_ERROR (r == -1, conn, "virDomainReboot");
1105 CAMLreturn (Val_unit);
1108 /* Automatically generated binding for virDomainDefineXML.
1109 * In generator.pl this function has signature "conn, string : dom".
1113 ocaml_libvirt_domain_define_xml (value connv, value strv)
1115 CAMLparam2 (connv, strv);
1118 virConnectPtr conn = Connect_val (connv);
1119 char *str = String_val (strv);
1122 NONBLOCKING (r = virDomainDefineXML (conn, str));
1123 CHECK_ERROR (!r, conn, "virDomainDefineXML");
1125 rv = Val_domain (r, connv);
1130 /* Automatically generated binding for virDomainUndefine.
1131 * In generator.pl this function has signature "dom : unit".
1135 ocaml_libvirt_domain_undefine (value domv)
1139 virDomainPtr dom = Domain_val (domv);
1140 virConnectPtr conn = Connect_domv (domv);
1143 NONBLOCKING (r = virDomainUndefine (dom));
1144 CHECK_ERROR (r == -1, conn, "virDomainUndefine");
1146 CAMLreturn (Val_unit);
1149 /* Automatically generated binding for virDomainCreate.
1150 * In generator.pl this function has signature "dom : unit".
1154 ocaml_libvirt_domain_create (value domv)
1158 virDomainPtr dom = Domain_val (domv);
1159 virConnectPtr conn = Connect_domv (domv);
1162 NONBLOCKING (r = virDomainCreate (dom));
1163 CHECK_ERROR (r == -1, conn, "virDomainCreate");
1165 CAMLreturn (Val_unit);
1168 /* Automatically generated binding for virDomainCreateJob.
1169 * In generator.pl this function has signature "dom, 0U : job from dom".
1172 #ifdef HAVE_WEAK_SYMBOLS
1173 #ifdef HAVE_VIRDOMAINCREATEJOB
1174 extern virJobPtr virDomainCreateJob (virDomainPtr dom, unsigned int flags) __attribute__((weak));
1179 ocaml_libvirt_domain_create_job (value domv)
1182 #ifndef HAVE_VIRDOMAINCREATEJOB
1183 /* Symbol virDomainCreateJob not found at compile time. */
1184 not_supported ("virDomainCreateJob");
1185 /* Suppresses a compiler warning. */
1188 /* Check that the symbol virDomainCreateJob
1189 * is in runtime version of libvirt.
1191 WEAK_SYMBOL_CHECK (virDomainCreateJob);
1193 CAMLlocal2 (rv, connv);
1194 virDomainPtr dom = Domain_val (domv);
1195 virConnectPtr conn = Connect_domv (domv);
1198 NONBLOCKING (r = virDomainCreateJob (dom, 0));
1199 CHECK_ERROR (!r, conn, "virDomainCreateJob");
1201 connv = Field (domv, 1);
1202 rv = Val_job (r, connv);
1208 /* Automatically generated binding for virDomainAttachDevice.
1209 * In generator.pl this function has signature "dom, string : unit".
1213 ocaml_libvirt_domain_attach_device (value domv, value strv)
1215 CAMLparam2 (domv, strv);
1217 virDomainPtr dom = Domain_val (domv);
1218 virConnectPtr conn = Connect_domv (domv);
1219 char *str = String_val (strv);
1222 NONBLOCKING (r = virDomainAttachDevice (dom, str));
1223 CHECK_ERROR (r == -1, conn, "virDomainAttachDevice");
1225 CAMLreturn (Val_unit);
1228 /* Automatically generated binding for virDomainDetachDevice.
1229 * In generator.pl this function has signature "dom, string : unit".
1233 ocaml_libvirt_domain_detach_device (value domv, value strv)
1235 CAMLparam2 (domv, strv);
1237 virDomainPtr dom = Domain_val (domv);
1238 virConnectPtr conn = Connect_domv (domv);
1239 char *str = String_val (strv);
1242 NONBLOCKING (r = virDomainDetachDevice (dom, str));
1243 CHECK_ERROR (r == -1, conn, "virDomainDetachDevice");
1245 CAMLreturn (Val_unit);
1248 /* Automatically generated binding for virDomainGetAutostart.
1249 * In generator.pl this function has signature "dom : bool".
1253 ocaml_libvirt_domain_get_autostart (value domv)
1257 virDomainPtr dom = Domain_val (domv);
1258 virConnectPtr conn = Connect_domv (domv);
1261 NONBLOCKING (r = virDomainGetAutostart (dom, &b));
1262 CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
1264 CAMLreturn (b ? Val_true : Val_false);
1267 /* Automatically generated binding for virDomainSetAutostart.
1268 * In generator.pl this function has signature "dom, bool : unit".
1272 ocaml_libvirt_domain_set_autostart (value domv, value bv)
1274 CAMLparam2 (domv, bv);
1276 virDomainPtr dom = Domain_val (domv);
1277 virConnectPtr conn = Connect_domv (domv);
1280 b = bv == Val_true ? 1 : 0;
1282 NONBLOCKING (r = virDomainSetAutostart (dom, b));
1283 CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
1285 CAMLreturn (Val_unit);
1288 /* Automatically generated binding for virNetworkFree.
1289 * In generator.pl this function has signature "net : free".
1293 ocaml_libvirt_network_free (value netv)
1297 virNetworkPtr net = Network_val (netv);
1298 virConnectPtr conn = Connect_netv (netv);
1301 NONBLOCKING (r = virNetworkFree (net));
1302 CHECK_ERROR (r == -1, conn, "virNetworkFree");
1304 /* So that we don't double-free in the finalizer: */
1305 Network_val (netv) = NULL;
1307 CAMLreturn (Val_unit);
1310 /* Automatically generated binding for virNetworkDestroy.
1311 * In generator.pl this function has signature "net : free".
1315 ocaml_libvirt_network_destroy (value netv)
1319 virNetworkPtr net = Network_val (netv);
1320 virConnectPtr conn = Connect_netv (netv);
1323 NONBLOCKING (r = virNetworkDestroy (net));
1324 CHECK_ERROR (r == -1, conn, "virNetworkDestroy");
1326 /* So that we don't double-free in the finalizer: */
1327 Network_val (netv) = NULL;
1329 CAMLreturn (Val_unit);
1332 /* Automatically generated binding for virNetworkLookupByName.
1333 * In generator.pl this function has signature "conn, string : net".
1337 ocaml_libvirt_network_lookup_by_name (value connv, value strv)
1339 CAMLparam2 (connv, strv);
1342 virConnectPtr conn = Connect_val (connv);
1343 char *str = String_val (strv);
1346 NONBLOCKING (r = virNetworkLookupByName (conn, str));
1347 CHECK_ERROR (!r, conn, "virNetworkLookupByName");
1349 rv = Val_network (r, connv);
1354 /* Automatically generated binding for virNetworkLookupByUUID.
1355 * In generator.pl this function has signature "conn, uuid : net".
1359 ocaml_libvirt_network_lookup_by_uuid (value connv, value uuidv)
1361 CAMLparam2 (connv, uuidv);
1364 virConnectPtr conn = Connect_val (connv);
1365 unsigned char *uuid = (unsigned char *) String_val (uuidv);
1368 NONBLOCKING (r = virNetworkLookupByUUID (conn, uuid));
1369 CHECK_ERROR (!r, conn, "virNetworkLookupByUUID");
1371 rv = Val_network (r, connv);
1376 /* Automatically generated binding for virNetworkLookupByUUIDString.
1377 * In generator.pl this function has signature "conn, string : net".
1381 ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv)
1383 CAMLparam2 (connv, strv);
1386 virConnectPtr conn = Connect_val (connv);
1387 char *str = String_val (strv);
1390 NONBLOCKING (r = virNetworkLookupByUUIDString (conn, str));
1391 CHECK_ERROR (!r, conn, "virNetworkLookupByUUIDString");
1393 rv = Val_network (r, connv);
1398 /* Automatically generated binding for virNetworkGetName.
1399 * In generator.pl this function has signature "net : static string".
1403 ocaml_libvirt_network_get_name (value netv)
1408 virNetworkPtr net = Network_val (netv);
1409 virConnectPtr conn = Connect_netv (netv);
1412 NONBLOCKING (r = virNetworkGetName (net));
1413 CHECK_ERROR (!r, conn, "virNetworkGetName");
1415 rv = caml_copy_string (r);
1419 /* Automatically generated binding for virNetworkGetXMLDesc.
1420 * In generator.pl this function has signature "net, 0 : string".
1424 ocaml_libvirt_network_get_xml_desc (value netv)
1429 virNetworkPtr net = Network_val (netv);
1430 virConnectPtr conn = Connect_netv (netv);
1433 NONBLOCKING (r = virNetworkGetXMLDesc (net, 0));
1434 CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc");
1436 rv = caml_copy_string (r);
1441 /* Automatically generated binding for virNetworkGetBridgeName.
1442 * In generator.pl this function has signature "net : string".
1446 ocaml_libvirt_network_get_bridge_name (value netv)
1451 virNetworkPtr net = Network_val (netv);
1452 virConnectPtr conn = Connect_netv (netv);
1455 NONBLOCKING (r = virNetworkGetBridgeName (net));
1456 CHECK_ERROR (!r, conn, "virNetworkGetBridgeName");
1458 rv = caml_copy_string (r);
1463 /* Automatically generated binding for virNetworkGetUUID.
1464 * In generator.pl this function has signature "net : uuid".
1468 ocaml_libvirt_network_get_uuid (value netv)
1473 virNetworkPtr net = Network_val (netv);
1474 virConnectPtr conn = Connect_netv (netv);
1475 unsigned char uuid[VIR_UUID_BUFLEN];
1478 NONBLOCKING (r = virNetworkGetUUID (net, uuid));
1479 CHECK_ERROR (r == -1, conn, "virNetworkGetUUID");
1481 /* UUIDs are byte arrays with a fixed length. */
1482 rv = caml_alloc_string (VIR_UUID_BUFLEN);
1483 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
1487 /* Automatically generated binding for virNetworkGetUUIDString.
1488 * In generator.pl this function has signature "net : uuid string".
1492 ocaml_libvirt_network_get_uuid_string (value netv)
1497 virNetworkPtr net = Network_val (netv);
1498 virConnectPtr conn = Connect_netv (netv);
1499 char uuid[VIR_UUID_STRING_BUFLEN];
1502 NONBLOCKING (r = virNetworkGetUUIDString (net, uuid));
1503 CHECK_ERROR (r == -1, conn, "virNetworkGetUUIDString");
1505 rv = caml_copy_string (uuid);
1509 /* Automatically generated binding for virNetworkUndefine.
1510 * In generator.pl this function has signature "net : unit".
1514 ocaml_libvirt_network_undefine (value netv)
1518 virNetworkPtr net = Network_val (netv);
1519 virConnectPtr conn = Connect_netv (netv);
1522 NONBLOCKING (r = virNetworkUndefine (net));
1523 CHECK_ERROR (r == -1, conn, "virNetworkUndefine");
1525 CAMLreturn (Val_unit);
1528 /* Automatically generated binding for virNetworkCreateXML.
1529 * In generator.pl this function has signature "conn, string : net".
1533 ocaml_libvirt_network_create_xml (value connv, value strv)
1535 CAMLparam2 (connv, strv);
1538 virConnectPtr conn = Connect_val (connv);
1539 char *str = String_val (strv);
1542 NONBLOCKING (r = virNetworkCreateXML (conn, str));
1543 CHECK_ERROR (!r, conn, "virNetworkCreateXML");
1545 rv = Val_network (r, connv);
1550 /* Automatically generated binding for virNetworkCreateXMLJob.
1551 * In generator.pl this function has signature "conn, string : job".
1554 #ifdef HAVE_WEAK_SYMBOLS
1555 #ifdef HAVE_VIRNETWORKCREATEXMLJOB
1556 extern virJobPtr virNetworkCreateXMLJob (virConnectPtr conn, const char *str) __attribute__((weak));
1561 ocaml_libvirt_network_create_xml_job (value connv, value strv)
1563 CAMLparam2 (connv, strv);
1564 #ifndef HAVE_VIRNETWORKCREATEXMLJOB
1565 /* Symbol virNetworkCreateXMLJob not found at compile time. */
1566 not_supported ("virNetworkCreateXMLJob");
1567 /* Suppresses a compiler warning. */
1570 /* Check that the symbol virNetworkCreateXMLJob
1571 * is in runtime version of libvirt.
1573 WEAK_SYMBOL_CHECK (virNetworkCreateXMLJob);
1576 virConnectPtr conn = Connect_val (connv);
1577 char *str = String_val (strv);
1580 NONBLOCKING (r = virNetworkCreateXMLJob (conn, str));
1581 CHECK_ERROR (!r, conn, "virNetworkCreateXMLJob");
1583 rv = Val_job (r, connv);
1589 /* Automatically generated binding for virNetworkDefineXML.
1590 * In generator.pl this function has signature "conn, string : net".
1594 ocaml_libvirt_network_define_xml (value connv, value strv)
1596 CAMLparam2 (connv, strv);
1599 virConnectPtr conn = Connect_val (connv);
1600 char *str = String_val (strv);
1603 NONBLOCKING (r = virNetworkDefineXML (conn, str));
1604 CHECK_ERROR (!r, conn, "virNetworkDefineXML");
1606 rv = Val_network (r, connv);
1611 /* Automatically generated binding for virNetworkCreate.
1612 * In generator.pl this function has signature "net : unit".
1616 ocaml_libvirt_network_create (value netv)
1620 virNetworkPtr net = Network_val (netv);
1621 virConnectPtr conn = Connect_netv (netv);
1624 NONBLOCKING (r = virNetworkCreate (net));
1625 CHECK_ERROR (r == -1, conn, "virNetworkCreate");
1627 CAMLreturn (Val_unit);
1630 /* Automatically generated binding for virNetworkCreateJob.
1631 * In generator.pl this function has signature "net : job from net".
1634 #ifdef HAVE_WEAK_SYMBOLS
1635 #ifdef HAVE_VIRNETWORKCREATEJOB
1636 extern virJobPtr virNetworkCreateJob (virNetworkPtr net) __attribute__((weak));
1641 ocaml_libvirt_network_create_job (value netv)
1644 #ifndef HAVE_VIRNETWORKCREATEJOB
1645 /* Symbol virNetworkCreateJob not found at compile time. */
1646 not_supported ("virNetworkCreateJob");
1647 /* Suppresses a compiler warning. */
1650 /* Check that the symbol virNetworkCreateJob
1651 * is in runtime version of libvirt.
1653 WEAK_SYMBOL_CHECK (virNetworkCreateJob);
1655 CAMLlocal2 (rv, connv);
1656 virNetworkPtr net = Network_val (netv);
1657 virConnectPtr conn = Connect_netv (netv);
1660 NONBLOCKING (r = virNetworkCreateJob (net));
1661 CHECK_ERROR (!r, conn, "virNetworkCreateJob");
1663 connv = Field (netv, 1);
1664 rv = Val_job (r, connv);
1670 /* Automatically generated binding for virNetworkGetAutostart.
1671 * In generator.pl this function has signature "net : bool".
1675 ocaml_libvirt_network_get_autostart (value netv)
1679 virNetworkPtr net = Network_val (netv);
1680 virConnectPtr conn = Connect_netv (netv);
1683 NONBLOCKING (r = virNetworkGetAutostart (net, &b));
1684 CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
1686 CAMLreturn (b ? Val_true : Val_false);
1689 /* Automatically generated binding for virNetworkSetAutostart.
1690 * In generator.pl this function has signature "net, bool : unit".
1694 ocaml_libvirt_network_set_autostart (value netv, value bv)
1696 CAMLparam2 (netv, bv);
1698 virNetworkPtr net = Network_val (netv);
1699 virConnectPtr conn = Connect_netv (netv);
1702 b = bv == Val_true ? 1 : 0;
1704 NONBLOCKING (r = virNetworkSetAutostart (net, b));
1705 CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
1707 CAMLreturn (Val_unit);
1710 /* Automatically generated binding for virStoragePoolFree.
1711 * In generator.pl this function has signature "pool : free".
1714 #ifdef HAVE_WEAK_SYMBOLS
1715 #ifdef HAVE_VIRSTORAGEPOOLFREE
1716 extern int virStoragePoolFree (virStoragePoolPtr pool) __attribute__((weak));
1721 ocaml_libvirt_storage_pool_free (value poolv)
1724 #ifndef HAVE_VIRSTORAGEPOOLFREE
1725 /* Symbol virStoragePoolFree not found at compile time. */
1726 not_supported ("virStoragePoolFree");
1727 /* Suppresses a compiler warning. */
1730 /* Check that the symbol virStoragePoolFree
1731 * is in runtime version of libvirt.
1733 WEAK_SYMBOL_CHECK (virStoragePoolFree);
1735 virStoragePoolPtr pool = Pool_val (poolv);
1736 virConnectPtr conn = Connect_polv (poolv);
1739 NONBLOCKING (r = virStoragePoolFree (pool));
1740 CHECK_ERROR (r == -1, conn, "virStoragePoolFree");
1742 /* So that we don't double-free in the finalizer: */
1743 Pool_val (poolv) = NULL;
1745 CAMLreturn (Val_unit);
1749 /* Automatically generated binding for virStoragePoolDestroy.
1750 * In generator.pl this function has signature "pool : free".
1753 #ifdef HAVE_WEAK_SYMBOLS
1754 #ifdef HAVE_VIRSTORAGEPOOLDESTROY
1755 extern int virStoragePoolDestroy (virStoragePoolPtr pool) __attribute__((weak));
1760 ocaml_libvirt_storage_pool_destroy (value poolv)
1763 #ifndef HAVE_VIRSTORAGEPOOLDESTROY
1764 /* Symbol virStoragePoolDestroy not found at compile time. */
1765 not_supported ("virStoragePoolDestroy");
1766 /* Suppresses a compiler warning. */
1769 /* Check that the symbol virStoragePoolDestroy
1770 * is in runtime version of libvirt.
1772 WEAK_SYMBOL_CHECK (virStoragePoolDestroy);
1774 virStoragePoolPtr pool = Pool_val (poolv);
1775 virConnectPtr conn = Connect_polv (poolv);
1778 NONBLOCKING (r = virStoragePoolDestroy (pool));
1779 CHECK_ERROR (r == -1, conn, "virStoragePoolDestroy");
1781 /* So that we don't double-free in the finalizer: */
1782 Pool_val (poolv) = NULL;
1784 CAMLreturn (Val_unit);
1788 /* Automatically generated binding for virStoragePoolLookupByName.
1789 * In generator.pl this function has signature "conn, string : pool".
1792 #ifdef HAVE_WEAK_SYMBOLS
1793 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1794 extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak));
1799 ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
1801 CAMLparam2 (connv, strv);
1802 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1803 /* Symbol virStoragePoolLookupByName not found at compile time. */
1804 not_supported ("virStoragePoolLookupByName");
1805 /* Suppresses a compiler warning. */
1808 /* Check that the symbol virStoragePoolLookupByName
1809 * is in runtime version of libvirt.
1811 WEAK_SYMBOL_CHECK (virStoragePoolLookupByName);
1814 virConnectPtr conn = Connect_val (connv);
1815 char *str = String_val (strv);
1816 virStoragePoolPtr r;
1818 NONBLOCKING (r = virStoragePoolLookupByName (conn, str));
1819 CHECK_ERROR (!r, conn, "virStoragePoolLookupByName");
1821 rv = Val_pool (r, connv);
1827 /* Automatically generated binding for virStoragePoolLookupByUUID.
1828 * In generator.pl this function has signature "conn, uuid : pool".
1831 #ifdef HAVE_WEAK_SYMBOLS
1832 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1833 extern virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn, const unsigned char *str) __attribute__((weak));
1838 ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv)
1840 CAMLparam2 (connv, uuidv);
1841 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1842 /* Symbol virStoragePoolLookupByUUID not found at compile time. */
1843 not_supported ("virStoragePoolLookupByUUID");
1844 /* Suppresses a compiler warning. */
1847 /* Check that the symbol virStoragePoolLookupByUUID
1848 * is in runtime version of libvirt.
1850 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUID);
1853 virConnectPtr conn = Connect_val (connv);
1854 unsigned char *uuid = (unsigned char *) String_val (uuidv);
1855 virStoragePoolPtr r;
1857 NONBLOCKING (r = virStoragePoolLookupByUUID (conn, uuid));
1858 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUID");
1860 rv = Val_pool (r, connv);
1866 /* Automatically generated binding for virStoragePoolLookupByUUIDString.
1867 * In generator.pl this function has signature "conn, string : pool".
1870 #ifdef HAVE_WEAK_SYMBOLS
1871 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1872 extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak));
1877 ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv)
1879 CAMLparam2 (connv, strv);
1880 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1881 /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */
1882 not_supported ("virStoragePoolLookupByUUIDString");
1883 /* Suppresses a compiler warning. */
1886 /* Check that the symbol virStoragePoolLookupByUUIDString
1887 * is in runtime version of libvirt.
1889 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUIDString);
1892 virConnectPtr conn = Connect_val (connv);
1893 char *str = String_val (strv);
1894 virStoragePoolPtr r;
1896 NONBLOCKING (r = virStoragePoolLookupByUUIDString (conn, str));
1897 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUIDString");
1899 rv = Val_pool (r, connv);
1905 /* Automatically generated binding for virStoragePoolGetName.
1906 * In generator.pl this function has signature "pool : static string".
1909 #ifdef HAVE_WEAK_SYMBOLS
1910 #ifdef HAVE_VIRSTORAGEPOOLGETNAME
1911 extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak));
1916 ocaml_libvirt_storage_pool_get_name (value poolv)
1919 #ifndef HAVE_VIRSTORAGEPOOLGETNAME
1920 /* Symbol virStoragePoolGetName not found at compile time. */
1921 not_supported ("virStoragePoolGetName");
1922 /* Suppresses a compiler warning. */
1925 /* Check that the symbol virStoragePoolGetName
1926 * is in runtime version of libvirt.
1928 WEAK_SYMBOL_CHECK (virStoragePoolGetName);
1931 virStoragePoolPtr pool = Pool_val (poolv);
1932 virConnectPtr conn = Connect_polv (poolv);
1935 NONBLOCKING (r = virStoragePoolGetName (pool));
1936 CHECK_ERROR (!r, conn, "virStoragePoolGetName");
1938 rv = caml_copy_string (r);
1943 /* Automatically generated binding for virStoragePoolGetXMLDesc.
1944 * In generator.pl this function has signature "pool, 0U : string".
1947 #ifdef HAVE_WEAK_SYMBOLS
1948 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
1949 extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
1954 ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
1957 #ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC
1958 /* Symbol virStoragePoolGetXMLDesc not found at compile time. */
1959 not_supported ("virStoragePoolGetXMLDesc");
1960 /* Suppresses a compiler warning. */
1963 /* Check that the symbol virStoragePoolGetXMLDesc
1964 * is in runtime version of libvirt.
1966 WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc);
1969 virStoragePoolPtr pool = Pool_val (poolv);
1970 virConnectPtr conn = Connect_polv (poolv);
1973 NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0));
1974 CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc");
1976 rv = caml_copy_string (r);
1982 /* Automatically generated binding for virStoragePoolGetUUID.
1983 * In generator.pl this function has signature "pool : uuid".
1986 #ifdef HAVE_WEAK_SYMBOLS
1987 #ifdef HAVE_VIRSTORAGEPOOLGETUUID
1988 extern int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char *) __attribute__((weak));
1993 ocaml_libvirt_storage_pool_get_uuid (value poolv)
1996 #ifndef HAVE_VIRSTORAGEPOOLGETUUID
1997 /* Symbol virStoragePoolGetUUID not found at compile time. */
1998 not_supported ("virStoragePoolGetUUID");
1999 /* Suppresses a compiler warning. */
2002 /* Check that the symbol virStoragePoolGetUUID
2003 * is in runtime version of libvirt.
2005 WEAK_SYMBOL_CHECK (virStoragePoolGetUUID);
2008 virStoragePoolPtr pool = Pool_val (poolv);
2009 virConnectPtr conn = Connect_polv (poolv);
2010 unsigned char uuid[VIR_UUID_BUFLEN];
2013 NONBLOCKING (r = virStoragePoolGetUUID (pool, uuid));
2014 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUID");
2016 /* UUIDs are byte arrays with a fixed length. */
2017 rv = caml_alloc_string (VIR_UUID_BUFLEN);
2018 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
2023 /* Automatically generated binding for virStoragePoolGetUUIDString.
2024 * In generator.pl this function has signature "pool : uuid string".
2027 #ifdef HAVE_WEAK_SYMBOLS
2028 #ifdef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2029 extern int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char *) __attribute__((weak));
2034 ocaml_libvirt_storage_pool_get_uuid_string (value poolv)
2037 #ifndef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2038 /* Symbol virStoragePoolGetUUIDString not found at compile time. */
2039 not_supported ("virStoragePoolGetUUIDString");
2040 /* Suppresses a compiler warning. */
2043 /* Check that the symbol virStoragePoolGetUUIDString
2044 * is in runtime version of libvirt.
2046 WEAK_SYMBOL_CHECK (virStoragePoolGetUUIDString);
2049 virStoragePoolPtr pool = Pool_val (poolv);
2050 virConnectPtr conn = Connect_polv (poolv);
2051 char uuid[VIR_UUID_STRING_BUFLEN];
2054 NONBLOCKING (r = virStoragePoolGetUUIDString (pool, uuid));
2055 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUIDString");
2057 rv = caml_copy_string (uuid);
2062 /* Automatically generated binding for virStoragePoolCreateXML.
2063 * In generator.pl this function has signature "conn, string, 0U : pool".
2066 #ifdef HAVE_WEAK_SYMBOLS
2067 #ifdef HAVE_VIRSTORAGEPOOLCREATEXML
2068 extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
2073 ocaml_libvirt_storage_pool_create_xml (value connv, value strv)
2075 CAMLparam2 (connv, strv);
2076 #ifndef HAVE_VIRSTORAGEPOOLCREATEXML
2077 /* Symbol virStoragePoolCreateXML not found at compile time. */
2078 not_supported ("virStoragePoolCreateXML");
2079 /* Suppresses a compiler warning. */
2082 /* Check that the symbol virStoragePoolCreateXML
2083 * is in runtime version of libvirt.
2085 WEAK_SYMBOL_CHECK (virStoragePoolCreateXML);
2088 virConnectPtr conn = Connect_val (connv);
2089 char *str = String_val (strv);
2090 virStoragePoolPtr r;
2092 NONBLOCKING (r = virStoragePoolCreateXML (conn, str, 0));
2093 CHECK_ERROR (!r, conn, "virStoragePoolCreateXML");
2095 rv = Val_pool (r, connv);
2101 /* Automatically generated binding for virStoragePoolDefineXML.
2102 * In generator.pl this function has signature "conn, string, 0U : pool".
2105 #ifdef HAVE_WEAK_SYMBOLS
2106 #ifdef HAVE_VIRSTORAGEPOOLDEFINEXML
2107 extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
2112 ocaml_libvirt_storage_pool_define_xml (value connv, value strv)
2114 CAMLparam2 (connv, strv);
2115 #ifndef HAVE_VIRSTORAGEPOOLDEFINEXML
2116 /* Symbol virStoragePoolDefineXML not found at compile time. */
2117 not_supported ("virStoragePoolDefineXML");
2118 /* Suppresses a compiler warning. */
2121 /* Check that the symbol virStoragePoolDefineXML
2122 * is in runtime version of libvirt.
2124 WEAK_SYMBOL_CHECK (virStoragePoolDefineXML);
2127 virConnectPtr conn = Connect_val (connv);
2128 char *str = String_val (strv);
2129 virStoragePoolPtr r;
2131 NONBLOCKING (r = virStoragePoolDefineXML (conn, str, 0));
2132 CHECK_ERROR (!r, conn, "virStoragePoolDefineXML");
2134 rv = Val_pool (r, connv);
2140 /* Automatically generated binding for virStoragePoolBuild.
2141 * In generator.pl this function has signature "pool, uint : unit".
2144 #ifdef HAVE_WEAK_SYMBOLS
2145 #ifdef HAVE_VIRSTORAGEPOOLBUILD
2146 extern int virStoragePoolBuild (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
2151 ocaml_libvirt_storage_pool_build (value poolv, value iv)
2153 CAMLparam2 (poolv, iv);
2154 #ifndef HAVE_VIRSTORAGEPOOLBUILD
2155 /* Symbol virStoragePoolBuild not found at compile time. */
2156 not_supported ("virStoragePoolBuild");
2157 /* Suppresses a compiler warning. */
2160 /* Check that the symbol virStoragePoolBuild
2161 * is in runtime version of libvirt.
2163 WEAK_SYMBOL_CHECK (virStoragePoolBuild);
2165 virStoragePoolPtr pool = Pool_val (poolv);
2166 virConnectPtr conn = Connect_polv (poolv);
2167 unsigned int i = Int_val (iv);
2170 NONBLOCKING (r = virStoragePoolBuild (pool, i));
2171 CHECK_ERROR (!r, conn, "virStoragePoolBuild");
2173 CAMLreturn (Val_unit);
2177 /* Automatically generated binding for virStoragePoolUndefine.
2178 * In generator.pl this function has signature "pool : unit".
2181 #ifdef HAVE_WEAK_SYMBOLS
2182 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
2183 extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
2188 ocaml_libvirt_storage_pool_undefine (value poolv)
2191 #ifndef HAVE_VIRSTORAGEPOOLUNDEFINE
2192 /* Symbol virStoragePoolUndefine not found at compile time. */
2193 not_supported ("virStoragePoolUndefine");
2194 /* Suppresses a compiler warning. */
2197 /* Check that the symbol virStoragePoolUndefine
2198 * is in runtime version of libvirt.
2200 WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
2202 virStoragePoolPtr pool = Pool_val (poolv);
2203 virConnectPtr conn = Connect_polv (poolv);
2206 NONBLOCKING (r = virStoragePoolUndefine (pool));
2207 CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
2209 CAMLreturn (Val_unit);
2213 /* Automatically generated binding for virStoragePoolCreate.
2214 * In generator.pl this function has signature "pool, 0U : unit".
2217 #ifdef HAVE_WEAK_SYMBOLS
2218 #ifdef HAVE_VIRSTORAGEPOOLCREATE
2219 extern int virStoragePoolCreate (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
2224 ocaml_libvirt_storage_pool_create (value poolv)
2227 #ifndef HAVE_VIRSTORAGEPOOLCREATE
2228 /* Symbol virStoragePoolCreate not found at compile time. */
2229 not_supported ("virStoragePoolCreate");
2230 /* Suppresses a compiler warning. */
2233 /* Check that the symbol virStoragePoolCreate
2234 * is in runtime version of libvirt.
2236 WEAK_SYMBOL_CHECK (virStoragePoolCreate);
2238 virStoragePoolPtr pool = Pool_val (poolv);
2239 virConnectPtr conn = Connect_polv (poolv);
2242 NONBLOCKING (r = virStoragePoolCreate (pool, 0));
2243 CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
2245 CAMLreturn (Val_unit);
2249 /* Automatically generated binding for virStoragePoolDelete.
2250 * In generator.pl this function has signature "pool, uint : unit".
2253 #ifdef HAVE_WEAK_SYMBOLS
2254 #ifdef HAVE_VIRSTORAGEPOOLDELETE
2255 extern int virStoragePoolDelete (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
2260 ocaml_libvirt_storage_pool_delete (value poolv, value iv)
2262 CAMLparam2 (poolv, iv);
2263 #ifndef HAVE_VIRSTORAGEPOOLDELETE
2264 /* Symbol virStoragePoolDelete not found at compile time. */
2265 not_supported ("virStoragePoolDelete");
2266 /* Suppresses a compiler warning. */
2269 /* Check that the symbol virStoragePoolDelete
2270 * is in runtime version of libvirt.
2272 WEAK_SYMBOL_CHECK (virStoragePoolDelete);
2274 virStoragePoolPtr pool = Pool_val (poolv);
2275 virConnectPtr conn = Connect_polv (poolv);
2276 unsigned int i = Int_val (iv);
2279 NONBLOCKING (r = virStoragePoolDelete (pool, i));
2280 CHECK_ERROR (!r, conn, "virStoragePoolDelete");
2282 CAMLreturn (Val_unit);
2286 /* Automatically generated binding for virStoragePoolRefresh.
2287 * In generator.pl this function has signature "pool, 0U : unit".
2290 #ifdef HAVE_WEAK_SYMBOLS
2291 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
2292 extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
2297 ocaml_libvirt_storage_pool_refresh (value poolv)
2300 #ifndef HAVE_VIRSTORAGEPOOLREFRESH
2301 /* Symbol virStoragePoolRefresh not found at compile time. */
2302 not_supported ("virStoragePoolRefresh");
2303 /* Suppresses a compiler warning. */
2306 /* Check that the symbol virStoragePoolRefresh
2307 * is in runtime version of libvirt.
2309 WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
2311 virStoragePoolPtr pool = Pool_val (poolv);
2312 virConnectPtr conn = Connect_polv (poolv);
2315 NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
2316 CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
2318 CAMLreturn (Val_unit);
2322 /* Automatically generated binding for virStoragePoolGetAutostart.
2323 * In generator.pl this function has signature "pool : bool".
2326 #ifdef HAVE_WEAK_SYMBOLS
2327 #ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2328 extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak));
2333 ocaml_libvirt_storage_pool_get_autostart (value poolv)
2336 #ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2337 /* Symbol virStoragePoolGetAutostart not found at compile time. */
2338 not_supported ("virStoragePoolGetAutostart");
2339 /* Suppresses a compiler warning. */
2342 /* Check that the symbol virStoragePoolGetAutostart
2343 * is in runtime version of libvirt.
2345 WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
2347 virStoragePoolPtr pool = Pool_val (poolv);
2348 virConnectPtr conn = Connect_polv (poolv);
2351 NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
2352 CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
2354 CAMLreturn (b ? Val_true : Val_false);
2358 /* Automatically generated binding for virStoragePoolSetAutostart.
2359 * In generator.pl this function has signature "pool, bool : unit".
2362 #ifdef HAVE_WEAK_SYMBOLS
2363 #ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2364 extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak));
2369 ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
2371 CAMLparam2 (poolv, bv);
2372 #ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2373 /* Symbol virStoragePoolSetAutostart not found at compile time. */
2374 not_supported ("virStoragePoolSetAutostart");
2375 /* Suppresses a compiler warning. */
2378 /* Check that the symbol virStoragePoolSetAutostart
2379 * is in runtime version of libvirt.
2381 WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
2383 virStoragePoolPtr pool = Pool_val (poolv);
2384 virConnectPtr conn = Connect_polv (poolv);
2387 b = bv == Val_true ? 1 : 0;
2389 NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
2390 CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
2392 CAMLreturn (Val_unit);
2396 /* Automatically generated binding for virStoragePoolNumOfVolumes.
2397 * In generator.pl this function has signature "pool : int".
2400 #ifdef HAVE_WEAK_SYMBOLS
2401 #ifdef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
2402 extern int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) __attribute__((weak));
2407 ocaml_libvirt_storage_pool_num_of_volumes (value poolv)
2410 #ifndef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
2411 /* Symbol virStoragePoolNumOfVolumes not found at compile time. */
2412 not_supported ("virStoragePoolNumOfVolumes");
2413 /* Suppresses a compiler warning. */
2416 /* Check that the symbol virStoragePoolNumOfVolumes
2417 * is in runtime version of libvirt.
2419 WEAK_SYMBOL_CHECK (virStoragePoolNumOfVolumes);
2421 virStoragePoolPtr pool = Pool_val (poolv);
2422 virConnectPtr conn = Connect_polv (poolv);
2425 NONBLOCKING (r = virStoragePoolNumOfVolumes (pool));
2426 CHECK_ERROR (r == -1, conn, "virStoragePoolNumOfVolumes");
2428 CAMLreturn (Val_int (r));
2432 /* Automatically generated binding for virStoragePoolListVolumes.
2433 * In generator.pl this function has signature "pool, int : string array".
2436 #ifdef HAVE_WEAK_SYMBOLS
2437 #ifdef HAVE_VIRSTORAGEPOOLLISTVOLUMES
2438 extern int virStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int maxnames) __attribute__((weak));
2443 ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv)
2445 CAMLparam2 (poolv, iv);
2446 #ifndef HAVE_VIRSTORAGEPOOLLISTVOLUMES
2447 /* Symbol virStoragePoolListVolumes not found at compile time. */
2448 not_supported ("virStoragePoolListVolumes");
2449 /* Suppresses a compiler warning. */
2452 /* Check that the symbol virStoragePoolListVolumes
2453 * is in runtime version of libvirt.
2455 WEAK_SYMBOL_CHECK (virStoragePoolListVolumes);
2457 CAMLlocal2 (rv, strv);
2458 virStoragePoolPtr pool = Pool_val (poolv);
2459 virConnectPtr conn = Connect_polv (poolv);
2460 int i = Int_val (iv);
2464 NONBLOCKING (r = virStoragePoolListVolumes (pool, names, i));
2465 CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes");
2467 rv = caml_alloc (r, 0);
2468 for (i = 0; i < r; ++i) {
2469 strv = caml_copy_string (names[i]);
2470 Store_field (rv, i, strv);
2478 /* Automatically generated binding for virStorageVolFree.
2479 * In generator.pl this function has signature "vol : free".
2482 #ifdef HAVE_WEAK_SYMBOLS
2483 #ifdef HAVE_VIRSTORAGEVOLFREE
2484 extern int virStorageVolFree (virStorageVolPtr vol) __attribute__((weak));
2489 ocaml_libvirt_storage_vol_free (value volv)
2492 #ifndef HAVE_VIRSTORAGEVOLFREE
2493 /* Symbol virStorageVolFree not found at compile time. */
2494 not_supported ("virStorageVolFree");
2495 /* Suppresses a compiler warning. */
2498 /* Check that the symbol virStorageVolFree
2499 * is in runtime version of libvirt.
2501 WEAK_SYMBOL_CHECK (virStorageVolFree);
2503 virStorageVolPtr vol = Volume_val (volv);
2504 virConnectPtr conn = Connect_volv (volv);
2507 NONBLOCKING (r = virStorageVolFree (vol));
2508 CHECK_ERROR (r == -1, conn, "virStorageVolFree");
2510 /* So that we don't double-free in the finalizer: */
2511 Volume_val (volv) = NULL;
2513 CAMLreturn (Val_unit);
2517 /* Automatically generated binding for virStorageVolDelete.
2518 * In generator.pl this function has signature "vol, uint : unit".
2521 #ifdef HAVE_WEAK_SYMBOLS
2522 #ifdef HAVE_VIRSTORAGEVOLDELETE
2523 extern int virStorageVolDelete (virStorageVolPtr vol, unsigned int i) __attribute__((weak));
2528 ocaml_libvirt_storage_vol_delete (value volv, value iv)
2530 CAMLparam2 (volv, iv);
2531 #ifndef HAVE_VIRSTORAGEVOLDELETE
2532 /* Symbol virStorageVolDelete not found at compile time. */
2533 not_supported ("virStorageVolDelete");
2534 /* Suppresses a compiler warning. */
2537 /* Check that the symbol virStorageVolDelete
2538 * is in runtime version of libvirt.
2540 WEAK_SYMBOL_CHECK (virStorageVolDelete);
2542 virStorageVolPtr vol = Volume_val (volv);
2543 virConnectPtr conn = Connect_volv (volv);
2544 unsigned int i = Int_val (iv);
2547 NONBLOCKING (r = virStorageVolDelete (vol, i));
2548 CHECK_ERROR (!r, conn, "virStorageVolDelete");
2550 CAMLreturn (Val_unit);
2554 /* Automatically generated binding for virStorageVolLookupByName.
2555 * In generator.pl this function has signature "pool, string : vol from pool".
2558 #ifdef HAVE_WEAK_SYMBOLS
2559 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2560 extern virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool, const char *str) __attribute__((weak));
2565 ocaml_libvirt_storage_vol_lookup_by_name (value poolv, value strv)
2567 CAMLparam2 (poolv, strv);
2568 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2569 /* Symbol virStorageVolLookupByName not found at compile time. */
2570 not_supported ("virStorageVolLookupByName");
2571 /* Suppresses a compiler warning. */
2574 /* Check that the symbol virStorageVolLookupByName
2575 * is in runtime version of libvirt.
2577 WEAK_SYMBOL_CHECK (virStorageVolLookupByName);
2579 CAMLlocal2 (rv, connv);
2580 virStoragePoolPtr pool = Pool_val (poolv);
2581 virConnectPtr conn = Connect_polv (poolv);
2582 char *str = String_val (strv);
2585 NONBLOCKING (r = virStorageVolLookupByName (pool, str));
2586 CHECK_ERROR (!r, conn, "virStorageVolLookupByName");
2588 connv = Field (poolv, 1);
2589 rv = Val_volume (r, connv);
2595 /* Automatically generated binding for virStorageVolLookupByKey.
2596 * In generator.pl this function has signature "conn, string : vol".
2599 #ifdef HAVE_WEAK_SYMBOLS
2600 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2601 extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak));
2606 ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
2608 CAMLparam2 (connv, strv);
2609 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2610 /* Symbol virStorageVolLookupByKey not found at compile time. */
2611 not_supported ("virStorageVolLookupByKey");
2612 /* Suppresses a compiler warning. */
2615 /* Check that the symbol virStorageVolLookupByKey
2616 * is in runtime version of libvirt.
2618 WEAK_SYMBOL_CHECK (virStorageVolLookupByKey);
2621 virConnectPtr conn = Connect_val (connv);
2622 char *str = String_val (strv);
2625 NONBLOCKING (r = virStorageVolLookupByKey (conn, str));
2626 CHECK_ERROR (!r, conn, "virStorageVolLookupByKey");
2628 rv = Val_volume (r, connv);
2634 /* Automatically generated binding for virStorageVolLookupByPath.
2635 * In generator.pl this function has signature "conn, string : vol".
2638 #ifdef HAVE_WEAK_SYMBOLS
2639 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2640 extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak));
2645 ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
2647 CAMLparam2 (connv, strv);
2648 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2649 /* Symbol virStorageVolLookupByPath not found at compile time. */
2650 not_supported ("virStorageVolLookupByPath");
2651 /* Suppresses a compiler warning. */
2654 /* Check that the symbol virStorageVolLookupByPath
2655 * is in runtime version of libvirt.
2657 WEAK_SYMBOL_CHECK (virStorageVolLookupByPath);
2660 virConnectPtr conn = Connect_val (connv);
2661 char *str = String_val (strv);
2664 NONBLOCKING (r = virStorageVolLookupByPath (conn, str));
2665 CHECK_ERROR (!r, conn, "virStorageVolLookupByPath");
2667 rv = Val_volume (r, connv);
2673 /* Automatically generated binding for virStorageVolCreateXML.
2674 * In generator.pl this function has signature "pool, string, 0U : vol from pool".
2677 #ifdef HAVE_WEAK_SYMBOLS
2678 #ifdef HAVE_VIRSTORAGEVOLCREATEXML
2679 extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, unsigned int flags) __attribute__((weak));
2684 ocaml_libvirt_storage_vol_create_xml (value poolv, value strv)
2686 CAMLparam2 (poolv, strv);
2687 #ifndef HAVE_VIRSTORAGEVOLCREATEXML
2688 /* Symbol virStorageVolCreateXML not found at compile time. */
2689 not_supported ("virStorageVolCreateXML");
2690 /* Suppresses a compiler warning. */
2693 /* Check that the symbol virStorageVolCreateXML
2694 * is in runtime version of libvirt.
2696 WEAK_SYMBOL_CHECK (virStorageVolCreateXML);
2698 CAMLlocal2 (rv, connv);
2699 virStoragePoolPtr pool = Pool_val (poolv);
2700 virConnectPtr conn = Connect_polv (poolv);
2701 char *str = String_val (strv);
2704 NONBLOCKING (r = virStorageVolCreateXML (pool, str, 0));
2705 CHECK_ERROR (!r, conn, "virStorageVolCreateXML");
2707 connv = Field (poolv, 1);
2708 rv = Val_volume (r, connv);
2714 /* Automatically generated binding for virStorageVolGetXMLDesc.
2715 * In generator.pl this function has signature "vol, 0U : string".
2718 #ifdef HAVE_WEAK_SYMBOLS
2719 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
2720 extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, unsigned int flags) __attribute__((weak));
2725 ocaml_libvirt_storage_vol_get_xml_desc (value volv)
2728 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
2729 /* Symbol virStorageVolGetXMLDesc not found at compile time. */
2730 not_supported ("virStorageVolGetXMLDesc");
2731 /* Suppresses a compiler warning. */
2734 /* Check that the symbol virStorageVolGetXMLDesc
2735 * is in runtime version of libvirt.
2737 WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
2740 virStorageVolPtr vol = Volume_val (volv);
2741 virConnectPtr conn = Connect_volv (volv);
2744 NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0));
2745 CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
2747 rv = caml_copy_string (r);
2753 /* Automatically generated binding for virStorageVolGetPath.
2754 * In generator.pl this function has signature "vol : string".
2757 #ifdef HAVE_WEAK_SYMBOLS
2758 #ifdef HAVE_VIRSTORAGEVOLGETPATH
2759 extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak));
2764 ocaml_libvirt_storage_vol_get_path (value volv)
2767 #ifndef HAVE_VIRSTORAGEVOLGETPATH
2768 /* Symbol virStorageVolGetPath not found at compile time. */
2769 not_supported ("virStorageVolGetPath");
2770 /* Suppresses a compiler warning. */
2773 /* Check that the symbol virStorageVolGetPath
2774 * is in runtime version of libvirt.
2776 WEAK_SYMBOL_CHECK (virStorageVolGetPath);
2779 virStorageVolPtr vol = Volume_val (volv);
2780 virConnectPtr conn = Connect_volv (volv);
2783 NONBLOCKING (r = virStorageVolGetPath (vol));
2784 CHECK_ERROR (!r, conn, "virStorageVolGetPath");
2786 rv = caml_copy_string (r);
2792 /* Automatically generated binding for virStorageVolGetKey.
2793 * In generator.pl this function has signature "vol : static string".
2796 #ifdef HAVE_WEAK_SYMBOLS
2797 #ifdef HAVE_VIRSTORAGEVOLGETKEY
2798 extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak));
2803 ocaml_libvirt_storage_vol_get_key (value volv)
2806 #ifndef HAVE_VIRSTORAGEVOLGETKEY
2807 /* Symbol virStorageVolGetKey not found at compile time. */
2808 not_supported ("virStorageVolGetKey");
2809 /* Suppresses a compiler warning. */
2812 /* Check that the symbol virStorageVolGetKey
2813 * is in runtime version of libvirt.
2815 WEAK_SYMBOL_CHECK (virStorageVolGetKey);
2818 virStorageVolPtr vol = Volume_val (volv);
2819 virConnectPtr conn = Connect_volv (volv);
2822 NONBLOCKING (r = virStorageVolGetKey (vol));
2823 CHECK_ERROR (!r, conn, "virStorageVolGetKey");
2825 rv = caml_copy_string (r);
2830 /* Automatically generated binding for virStorageVolGetName.
2831 * In generator.pl this function has signature "vol : static string".
2834 #ifdef HAVE_WEAK_SYMBOLS
2835 #ifdef HAVE_VIRSTORAGEVOLGETNAME
2836 extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak));
2841 ocaml_libvirt_storage_vol_get_name (value volv)
2844 #ifndef HAVE_VIRSTORAGEVOLGETNAME
2845 /* Symbol virStorageVolGetName not found at compile time. */
2846 not_supported ("virStorageVolGetName");
2847 /* Suppresses a compiler warning. */
2850 /* Check that the symbol virStorageVolGetName
2851 * is in runtime version of libvirt.
2853 WEAK_SYMBOL_CHECK (virStorageVolGetName);
2856 virStorageVolPtr vol = Volume_val (volv);
2857 virConnectPtr conn = Connect_volv (volv);
2860 NONBLOCKING (r = virStorageVolGetName (vol));
2861 CHECK_ERROR (!r, conn, "virStorageVolGetName");
2863 rv = caml_copy_string (r);
2868 /* Automatically generated binding for virStoragePoolLookupByVolume.
2869 * In generator.pl this function has signature "vol : pool from vol".
2872 #ifdef HAVE_WEAK_SYMBOLS
2873 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2874 extern virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) __attribute__((weak));
2879 ocaml_libvirt_storage_pool_lookup_by_volume (value volv)
2882 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2883 /* Symbol virStoragePoolLookupByVolume not found at compile time. */
2884 not_supported ("virStoragePoolLookupByVolume");
2885 /* Suppresses a compiler warning. */
2888 /* Check that the symbol virStoragePoolLookupByVolume
2889 * is in runtime version of libvirt.
2891 WEAK_SYMBOL_CHECK (virStoragePoolLookupByVolume);
2893 CAMLlocal2 (rv, connv);
2894 virStorageVolPtr vol = Volume_val (volv);
2895 virConnectPtr conn = Connect_volv (volv);
2896 virStoragePoolPtr r;
2898 NONBLOCKING (r = virStoragePoolLookupByVolume (vol));
2899 CHECK_ERROR (!r, conn, "virStoragePoolLookupByVolume");
2901 connv = Field (volv, 1);
2902 rv = Val_pool (r, connv);
2908 /* Automatically generated binding for virJobFree.
2909 * In generator.pl this function has signature "job : free".
2912 #ifdef HAVE_WEAK_SYMBOLS
2913 #ifdef HAVE_VIRJOBFREE
2914 extern int virJobFree (virJobPtr job) __attribute__((weak));
2919 ocaml_libvirt_job_free (value jobv)
2922 #ifndef HAVE_VIRJOBFREE
2923 /* Symbol virJobFree not found at compile time. */
2924 not_supported ("virJobFree");
2925 /* Suppresses a compiler warning. */
2928 /* Check that the symbol virJobFree
2929 * is in runtime version of libvirt.
2931 WEAK_SYMBOL_CHECK (virJobFree);
2933 virJobPtr job = Job_val (jobv);
2934 virConnectPtr conn = Connect_jobv (jobv);
2937 NONBLOCKING (r = virJobFree (job));
2938 CHECK_ERROR (r == -1, conn, "virJobFree");
2940 /* So that we don't double-free in the finalizer: */
2941 Job_val (jobv) = NULL;
2943 CAMLreturn (Val_unit);
2947 /* Automatically generated binding for virJobCancel.
2948 * In generator.pl this function has signature "job : unit".
2951 #ifdef HAVE_WEAK_SYMBOLS
2952 #ifdef HAVE_VIRJOBCANCEL
2953 extern int virJobCancel (virJobPtr job) __attribute__((weak));
2958 ocaml_libvirt_job_cancel (value jobv)
2961 #ifndef HAVE_VIRJOBCANCEL
2962 /* Symbol virJobCancel not found at compile time. */
2963 not_supported ("virJobCancel");
2964 /* Suppresses a compiler warning. */
2967 /* Check that the symbol virJobCancel
2968 * is in runtime version of libvirt.
2970 WEAK_SYMBOL_CHECK (virJobCancel);
2972 virJobPtr job = Job_val (jobv);
2973 virConnectPtr conn = Connect_jobv (jobv);
2976 NONBLOCKING (r = virJobCancel (job));
2977 CHECK_ERROR (r == -1, conn, "virJobCancel");
2979 CAMLreturn (Val_unit);
2983 /* Automatically generated binding for virJobGetNetwork.
2984 * In generator.pl this function has signature "job : net from job".
2987 #ifdef HAVE_WEAK_SYMBOLS
2988 #ifdef HAVE_VIRJOBGETNETWORK
2989 extern virNetworkPtr virJobGetNetwork (virJobPtr job) __attribute__((weak));
2994 ocaml_libvirt_job_get_network (value jobv)
2997 #ifndef HAVE_VIRJOBGETNETWORK
2998 /* Symbol virJobGetNetwork not found at compile time. */
2999 not_supported ("virJobGetNetwork");
3000 /* Suppresses a compiler warning. */
3003 /* Check that the symbol virJobGetNetwork
3004 * is in runtime version of libvirt.
3006 WEAK_SYMBOL_CHECK (virJobGetNetwork);
3008 CAMLlocal2 (rv, connv);
3009 virJobPtr job = Job_val (jobv);
3010 virConnectPtr conn = Connect_jobv (jobv);
3013 NONBLOCKING (r = virJobGetNetwork (job));
3014 CHECK_ERROR (!r, conn, "virJobGetNetwork");
3016 connv = Field (jobv, 1);
3017 rv = Val_network (r, connv);
3023 /* Automatically generated binding for virJobGetDomain.
3024 * In generator.pl this function has signature "job : dom from job".
3027 #ifdef HAVE_WEAK_SYMBOLS
3028 #ifdef HAVE_VIRJOBGETDOMAIN
3029 extern virDomainPtr virJobGetDomain (virJobPtr job) __attribute__((weak));
3034 ocaml_libvirt_job_get_domain (value jobv)
3037 #ifndef HAVE_VIRJOBGETDOMAIN
3038 /* Symbol virJobGetDomain not found at compile time. */
3039 not_supported ("virJobGetDomain");
3040 /* Suppresses a compiler warning. */
3043 /* Check that the symbol virJobGetDomain
3044 * is in runtime version of libvirt.
3046 WEAK_SYMBOL_CHECK (virJobGetDomain);
3048 CAMLlocal2 (rv, connv);
3049 virJobPtr job = Job_val (jobv);
3050 virConnectPtr conn = Connect_jobv (jobv);
3053 NONBLOCKING (r = virJobGetDomain (job));
3054 CHECK_ERROR (!r, conn, "virJobGetDomain");
3056 connv = Field (jobv, 1);
3057 rv = Val_domain (r, connv);
3063 #include "libvirt_c_epilogue.c"