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");
90 /* Check that the symbol virConnectGetHostname
91 * is in runtime version of libvirt.
93 WEAK_SYMBOL_CHECK (virConnectGetHostname);
96 virConnectPtr conn = Connect_val (connv);
99 NONBLOCKING (r = virConnectGetHostname (conn));
100 CHECK_ERROR (!r, conn, "virConnectGetHostname");
102 rv = caml_copy_string (r);
108 /* Automatically generated binding for virConnectGetURI.
109 * In generator.pl this function has signature "conn : string".
112 #ifdef HAVE_WEAK_SYMBOLS
113 #ifdef HAVE_VIRCONNECTGETURI
114 extern char *virConnectGetURI (virConnectPtr conn) __attribute__((weak));
119 ocaml_libvirt_connect_get_uri (value connv)
122 #ifndef HAVE_VIRCONNECTGETURI
123 /* Symbol virConnectGetURI not found at compile time. */
124 not_supported ("virConnectGetURI");
127 /* Check that the symbol virConnectGetURI
128 * is in runtime version of libvirt.
130 WEAK_SYMBOL_CHECK (virConnectGetURI);
133 virConnectPtr conn = Connect_val (connv);
136 NONBLOCKING (r = virConnectGetURI (conn));
137 CHECK_ERROR (!r, conn, "virConnectGetURI");
139 rv = caml_copy_string (r);
145 /* Automatically generated binding for virConnectGetType.
146 * In generator.pl this function has signature "conn : static string".
150 ocaml_libvirt_connect_get_type (value connv)
155 virConnectPtr conn = Connect_val (connv);
158 NONBLOCKING (r = virConnectGetType (conn));
159 CHECK_ERROR (!r, conn, "virConnectGetType");
161 rv = caml_copy_string (r);
165 /* Automatically generated binding for virConnectNumOfDomains.
166 * In generator.pl this function has signature "conn : int".
170 ocaml_libvirt_connect_num_of_domains (value connv)
174 virConnectPtr conn = Connect_val (connv);
177 NONBLOCKING (r = virConnectNumOfDomains (conn));
178 CHECK_ERROR (r == -1, conn, "virConnectNumOfDomains");
180 CAMLreturn (Val_int (r));
183 /* Automatically generated binding for virConnectListDomains.
184 * In generator.pl this function has signature "conn, int : int array".
188 ocaml_libvirt_connect_list_domains (value connv, value iv)
190 CAMLparam2 (connv, iv);
193 virConnectPtr conn = Connect_val (connv);
194 int i = Int_val (iv);
197 /* Some libvirt List* functions still throw exceptions if i == 0,
198 * so catch that and return an empty array directly. This changes
199 * the semantics slightly (masking other failures) but it's
200 * unlikely anyone will care. RWMJ 2008/06/10
203 rv = caml_alloc (0, 0);
207 NONBLOCKING (r = virConnectListDomains (conn, ids, i));
208 CHECK_ERROR (r == -1, conn, "virConnectListDomains");
210 rv = caml_alloc (r, 0);
211 for (i = 0; i < r; ++i)
212 Store_field (rv, i, Val_int (ids[i]));
217 /* Automatically generated binding for virConnectNumOfDefinedDomains.
218 * In generator.pl this function has signature "conn : int".
222 ocaml_libvirt_connect_num_of_defined_domains (value connv)
226 virConnectPtr conn = Connect_val (connv);
229 NONBLOCKING (r = virConnectNumOfDefinedDomains (conn));
230 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedDomains");
232 CAMLreturn (Val_int (r));
235 /* Automatically generated binding for virConnectListDefinedDomains.
236 * In generator.pl this function has signature "conn, int : string array".
240 ocaml_libvirt_connect_list_defined_domains (value connv, value iv)
242 CAMLparam2 (connv, iv);
244 CAMLlocal2 (rv, strv);
245 virConnectPtr conn = Connect_val (connv);
246 int i = Int_val (iv);
250 /* Some libvirt List* functions still throw exceptions if i == 0,
251 * so catch that and return an empty array directly. This changes
252 * the semantics slightly (masking other failures) but it's
253 * unlikely anyone will care. RWMJ 2008/06/10
256 rv = caml_alloc (0, 0);
260 NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i));
261 CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
263 rv = caml_alloc (r, 0);
264 for (i = 0; i < r; ++i) {
265 strv = caml_copy_string (names[i]);
266 Store_field (rv, i, strv);
273 /* Automatically generated binding for virConnectNumOfNetworks.
274 * In generator.pl this function has signature "conn : int".
278 ocaml_libvirt_connect_num_of_networks (value connv)
282 virConnectPtr conn = Connect_val (connv);
285 NONBLOCKING (r = virConnectNumOfNetworks (conn));
286 CHECK_ERROR (r == -1, conn, "virConnectNumOfNetworks");
288 CAMLreturn (Val_int (r));
291 /* Automatically generated binding for virConnectListNetworks.
292 * In generator.pl this function has signature "conn, int : string array".
296 ocaml_libvirt_connect_list_networks (value connv, value iv)
298 CAMLparam2 (connv, iv);
300 CAMLlocal2 (rv, strv);
301 virConnectPtr conn = Connect_val (connv);
302 int i = Int_val (iv);
306 /* Some libvirt List* functions still throw exceptions if i == 0,
307 * so catch that and return an empty array directly. This changes
308 * the semantics slightly (masking other failures) but it's
309 * unlikely anyone will care. RWMJ 2008/06/10
312 rv = caml_alloc (0, 0);
316 NONBLOCKING (r = virConnectListNetworks (conn, names, i));
317 CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
319 rv = caml_alloc (r, 0);
320 for (i = 0; i < r; ++i) {
321 strv = caml_copy_string (names[i]);
322 Store_field (rv, i, strv);
329 /* Automatically generated binding for virConnectNumOfDefinedNetworks.
330 * In generator.pl this function has signature "conn : int".
334 ocaml_libvirt_connect_num_of_defined_networks (value connv)
338 virConnectPtr conn = Connect_val (connv);
341 NONBLOCKING (r = virConnectNumOfDefinedNetworks (conn));
342 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedNetworks");
344 CAMLreturn (Val_int (r));
347 /* Automatically generated binding for virConnectListDefinedNetworks.
348 * In generator.pl this function has signature "conn, int : string array".
352 ocaml_libvirt_connect_list_defined_networks (value connv, value iv)
354 CAMLparam2 (connv, iv);
356 CAMLlocal2 (rv, strv);
357 virConnectPtr conn = Connect_val (connv);
358 int i = Int_val (iv);
362 /* Some libvirt List* functions still throw exceptions if i == 0,
363 * so catch that and return an empty array directly. This changes
364 * the semantics slightly (masking other failures) but it's
365 * unlikely anyone will care. RWMJ 2008/06/10
368 rv = caml_alloc (0, 0);
372 NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i));
373 CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
375 rv = caml_alloc (r, 0);
376 for (i = 0; i < r; ++i) {
377 strv = caml_copy_string (names[i]);
378 Store_field (rv, i, strv);
385 /* Automatically generated binding for virConnectNumOfStoragePools.
386 * In generator.pl this function has signature "conn : int".
389 #ifdef HAVE_WEAK_SYMBOLS
390 #ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
391 extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak));
396 ocaml_libvirt_connect_num_of_storage_pools (value connv)
399 #ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
400 /* Symbol virConnectNumOfStoragePools not found at compile time. */
401 not_supported ("virConnectNumOfStoragePools");
404 /* Check that the symbol virConnectNumOfStoragePools
405 * is in runtime version of libvirt.
407 WEAK_SYMBOL_CHECK (virConnectNumOfStoragePools);
409 virConnectPtr conn = Connect_val (connv);
412 NONBLOCKING (r = virConnectNumOfStoragePools (conn));
413 CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools");
415 CAMLreturn (Val_int (r));
419 /* Automatically generated binding for virConnectListStoragePools.
420 * In generator.pl this function has signature "conn, int : string array".
423 #ifdef HAVE_WEAK_SYMBOLS
424 #ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS
425 extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
430 ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
432 CAMLparam2 (connv, iv);
433 #ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS
434 /* Symbol virConnectListStoragePools not found at compile time. */
435 not_supported ("virConnectListStoragePools");
438 /* Check that the symbol virConnectListStoragePools
439 * is in runtime version of libvirt.
441 WEAK_SYMBOL_CHECK (virConnectListStoragePools);
443 CAMLlocal2 (rv, strv);
444 virConnectPtr conn = Connect_val (connv);
445 int i = Int_val (iv);
449 /* Some libvirt List* functions still throw exceptions if i == 0,
450 * so catch that and return an empty array directly. This changes
451 * the semantics slightly (masking other failures) but it's
452 * unlikely anyone will care. RWMJ 2008/06/10
455 rv = caml_alloc (0, 0);
459 NONBLOCKING (r = virConnectListStoragePools (conn, names, i));
460 CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
462 rv = caml_alloc (r, 0);
463 for (i = 0; i < r; ++i) {
464 strv = caml_copy_string (names[i]);
465 Store_field (rv, i, strv);
473 /* Automatically generated binding for virConnectNumOfDefinedStoragePools.
474 * In generator.pl this function has signature "conn : int".
477 #ifdef HAVE_WEAK_SYMBOLS
478 #ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
479 extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak));
484 ocaml_libvirt_connect_num_of_defined_storage_pools (value connv)
487 #ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
488 /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */
489 not_supported ("virConnectNumOfDefinedStoragePools");
492 /* Check that the symbol virConnectNumOfDefinedStoragePools
493 * is in runtime version of libvirt.
495 WEAK_SYMBOL_CHECK (virConnectNumOfDefinedStoragePools);
497 virConnectPtr conn = Connect_val (connv);
500 NONBLOCKING (r = virConnectNumOfDefinedStoragePools (conn));
501 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools");
503 CAMLreturn (Val_int (r));
507 /* Automatically generated binding for virConnectListDefinedStoragePools.
508 * In generator.pl this function has signature "conn, int : string array".
511 #ifdef HAVE_WEAK_SYMBOLS
512 #ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
513 extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
518 ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
520 CAMLparam2 (connv, iv);
521 #ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
522 /* Symbol virConnectListDefinedStoragePools not found at compile time. */
523 not_supported ("virConnectListDefinedStoragePools");
526 /* Check that the symbol virConnectListDefinedStoragePools
527 * is in runtime version of libvirt.
529 WEAK_SYMBOL_CHECK (virConnectListDefinedStoragePools);
531 CAMLlocal2 (rv, strv);
532 virConnectPtr conn = Connect_val (connv);
533 int i = Int_val (iv);
537 /* Some libvirt List* functions still throw exceptions if i == 0,
538 * so catch that and return an empty array directly. This changes
539 * the semantics slightly (masking other failures) but it's
540 * unlikely anyone will care. RWMJ 2008/06/10
543 rv = caml_alloc (0, 0);
547 NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i));
548 CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
550 rv = caml_alloc (r, 0);
551 for (i = 0; i < r; ++i) {
552 strv = caml_copy_string (names[i]);
553 Store_field (rv, i, strv);
561 /* Automatically generated binding for virConnectGetCapabilities.
562 * In generator.pl this function has signature "conn : string".
566 ocaml_libvirt_connect_get_capabilities (value connv)
571 virConnectPtr conn = Connect_val (connv);
574 NONBLOCKING (r = virConnectGetCapabilities (conn));
575 CHECK_ERROR (!r, conn, "virConnectGetCapabilities");
577 rv = caml_copy_string (r);
582 /* Automatically generated binding for virDomainCreateLinux.
583 * In generator.pl this function has signature "conn, string, 0U : dom".
587 ocaml_libvirt_domain_create_linux (value connv, value strv)
589 CAMLparam2 (connv, strv);
592 virConnectPtr conn = Connect_val (connv);
593 char *str = String_val (strv);
596 NONBLOCKING (r = virDomainCreateLinux (conn, str, 0));
597 CHECK_ERROR (!r, conn, "virDomainCreateLinux");
599 rv = Val_domain (r, connv);
604 /* Automatically generated binding for virDomainCreateLinuxJob.
605 * In generator.pl this function has signature "conn, string, 0U : job".
608 #ifdef HAVE_WEAK_SYMBOLS
609 #ifdef HAVE_VIRDOMAINCREATELINUXJOB
610 extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
615 ocaml_libvirt_domain_create_linux_job (value connv, value strv)
617 CAMLparam2 (connv, strv);
618 #ifndef HAVE_VIRDOMAINCREATELINUXJOB
619 /* Symbol virDomainCreateLinuxJob not found at compile time. */
620 not_supported ("virDomainCreateLinuxJob");
623 /* Check that the symbol virDomainCreateLinuxJob
624 * is in runtime version of libvirt.
626 WEAK_SYMBOL_CHECK (virDomainCreateLinuxJob);
629 virConnectPtr conn = Connect_val (connv);
630 char *str = String_val (strv);
633 NONBLOCKING (r = virDomainCreateLinuxJob (conn, str, 0));
634 CHECK_ERROR (!r, conn, "virDomainCreateLinuxJob");
636 rv = Val_job (r, connv);
642 /* Automatically generated binding for virDomainFree.
643 * In generator.pl this function has signature "dom : free".
647 ocaml_libvirt_domain_free (value domv)
651 virDomainPtr dom = Domain_val (domv);
652 virConnectPtr conn = Connect_domv (domv);
655 NONBLOCKING (r = virDomainFree (dom));
656 CHECK_ERROR (r == -1, conn, "virDomainFree");
658 /* So that we don't double-free in the finalizer: */
659 Domain_val (domv) = NULL;
661 CAMLreturn (Val_unit);
664 /* Automatically generated binding for virDomainDestroy.
665 * In generator.pl this function has signature "dom : free".
669 ocaml_libvirt_domain_destroy (value domv)
673 virDomainPtr dom = Domain_val (domv);
674 virConnectPtr conn = Connect_domv (domv);
677 NONBLOCKING (r = virDomainDestroy (dom));
678 CHECK_ERROR (r == -1, conn, "virDomainDestroy");
680 /* So that we don't double-free in the finalizer: */
681 Domain_val (domv) = NULL;
683 CAMLreturn (Val_unit);
686 /* Automatically generated binding for virDomainLookupByName.
687 * In generator.pl this function has signature "conn, string : dom".
691 ocaml_libvirt_domain_lookup_by_name (value connv, value strv)
693 CAMLparam2 (connv, strv);
696 virConnectPtr conn = Connect_val (connv);
697 char *str = String_val (strv);
700 NONBLOCKING (r = virDomainLookupByName (conn, str));
701 CHECK_ERROR (!r, conn, "virDomainLookupByName");
703 rv = Val_domain (r, connv);
708 /* Automatically generated binding for virDomainLookupByID.
709 * In generator.pl this function has signature "conn, int : dom".
713 ocaml_libvirt_domain_lookup_by_id (value connv, value iv)
715 CAMLparam2 (connv, iv);
718 virConnectPtr conn = Connect_val (connv);
719 int i = Int_val (iv);
722 NONBLOCKING (r = virDomainLookupByID (conn, i));
723 CHECK_ERROR (!r, conn, "virDomainLookupByID");
725 rv = Val_domain (r, connv);
730 /* Automatically generated binding for virDomainLookupByUUID.
731 * In generator.pl this function has signature "conn, uuid : dom".
735 ocaml_libvirt_domain_lookup_by_uuid (value connv, value uuidv)
737 CAMLparam2 (connv, uuidv);
740 virConnectPtr conn = Connect_val (connv);
741 unsigned char *uuid = (unsigned char *) String_val (uuidv);
744 NONBLOCKING (r = virDomainLookupByUUID (conn, uuid));
745 CHECK_ERROR (!r, conn, "virDomainLookupByUUID");
747 rv = Val_domain (r, connv);
752 /* Automatically generated binding for virDomainLookupByUUIDString.
753 * In generator.pl this function has signature "conn, string : dom".
757 ocaml_libvirt_domain_lookup_by_uuid_string (value connv, value strv)
759 CAMLparam2 (connv, strv);
762 virConnectPtr conn = Connect_val (connv);
763 char *str = String_val (strv);
766 NONBLOCKING (r = virDomainLookupByUUIDString (conn, str));
767 CHECK_ERROR (!r, conn, "virDomainLookupByUUIDString");
769 rv = Val_domain (r, connv);
774 /* Automatically generated binding for virDomainGetName.
775 * In generator.pl this function has signature "dom : static string".
779 ocaml_libvirt_domain_get_name (value domv)
784 virDomainPtr dom = Domain_val (domv);
785 virConnectPtr conn = Connect_domv (domv);
788 NONBLOCKING (r = virDomainGetName (dom));
789 CHECK_ERROR (!r, conn, "virDomainGetName");
791 rv = caml_copy_string (r);
795 /* Automatically generated binding for virDomainGetOSType.
796 * In generator.pl this function has signature "dom : string".
800 ocaml_libvirt_domain_get_os_type (value domv)
805 virDomainPtr dom = Domain_val (domv);
806 virConnectPtr conn = Connect_domv (domv);
809 NONBLOCKING (r = virDomainGetOSType (dom));
810 CHECK_ERROR (!r, conn, "virDomainGetOSType");
812 rv = caml_copy_string (r);
817 /* Automatically generated binding for virDomainGetXMLDesc.
818 * In generator.pl this function has signature "dom, 0 : string".
822 ocaml_libvirt_domain_get_xml_desc (value domv)
827 virDomainPtr dom = Domain_val (domv);
828 virConnectPtr conn = Connect_domv (domv);
831 NONBLOCKING (r = virDomainGetXMLDesc (dom, 0));
832 CHECK_ERROR (!r, conn, "virDomainGetXMLDesc");
834 rv = caml_copy_string (r);
839 /* Automatically generated binding for virDomainGetUUID.
840 * In generator.pl this function has signature "dom : uuid".
844 ocaml_libvirt_domain_get_uuid (value domv)
849 virDomainPtr dom = Domain_val (domv);
850 virConnectPtr conn = Connect_domv (domv);
851 unsigned char uuid[VIR_UUID_BUFLEN];
854 NONBLOCKING (r = virDomainGetUUID (dom, uuid));
855 CHECK_ERROR (r == -1, conn, "virDomainGetUUID");
857 /* UUIDs are byte arrays with a fixed length. */
858 rv = caml_alloc_string (VIR_UUID_BUFLEN);
859 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
863 /* Automatically generated binding for virDomainGetUUIDString.
864 * In generator.pl this function has signature "dom : uuid string".
868 ocaml_libvirt_domain_get_uuid_string (value domv)
873 virDomainPtr dom = Domain_val (domv);
874 virConnectPtr conn = Connect_domv (domv);
875 char uuid[VIR_UUID_STRING_BUFLEN];
878 NONBLOCKING (r = virDomainGetUUIDString (dom, uuid));
879 CHECK_ERROR (r == -1, conn, "virDomainGetUUIDString");
881 rv = caml_copy_string (uuid);
885 /* Automatically generated binding for virDomainGetMaxVcpus.
886 * In generator.pl this function has signature "dom : int".
890 ocaml_libvirt_domain_get_max_vcpus (value domv)
894 virDomainPtr dom = Domain_val (domv);
895 virConnectPtr conn = Connect_domv (domv);
898 NONBLOCKING (r = virDomainGetMaxVcpus (dom));
899 CHECK_ERROR (r == -1, conn, "virDomainGetMaxVcpus");
901 CAMLreturn (Val_int (r));
904 /* Automatically generated binding for virDomainSave.
905 * In generator.pl this function has signature "dom, string : unit".
909 ocaml_libvirt_domain_save (value domv, value strv)
911 CAMLparam2 (domv, strv);
913 virDomainPtr dom = Domain_val (domv);
914 virConnectPtr conn = Connect_domv (domv);
915 char *str = String_val (strv);
918 NONBLOCKING (r = virDomainSave (dom, str));
919 CHECK_ERROR (r == -1, conn, "virDomainSave");
921 CAMLreturn (Val_unit);
924 /* Automatically generated binding for virDomainSaveJob.
925 * In generator.pl this function has signature "dom, string : job from dom".
928 #ifdef HAVE_WEAK_SYMBOLS
929 #ifdef HAVE_VIRDOMAINSAVEJOB
930 extern virJobPtr virDomainSaveJob (virDomainPtr dom, const char *str) __attribute__((weak));
935 ocaml_libvirt_domain_save_job (value domv, value strv)
937 CAMLparam2 (domv, strv);
938 #ifndef HAVE_VIRDOMAINSAVEJOB
939 /* Symbol virDomainSaveJob not found at compile time. */
940 not_supported ("virDomainSaveJob");
943 /* Check that the symbol virDomainSaveJob
944 * is in runtime version of libvirt.
946 WEAK_SYMBOL_CHECK (virDomainSaveJob);
948 CAMLlocal2 (rv, connv);
949 virDomainPtr dom = Domain_val (domv);
950 virConnectPtr conn = Connect_domv (domv);
951 char *str = String_val (strv);
954 NONBLOCKING (r = virDomainSaveJob (dom, str));
955 CHECK_ERROR (!r, conn, "virDomainSaveJob");
957 connv = Field (domv, 1);
958 rv = Val_job (r, connv);
964 /* Automatically generated binding for virDomainRestore.
965 * In generator.pl this function has signature "conn, string : unit".
969 ocaml_libvirt_domain_restore (value connv, value strv)
971 CAMLparam2 (connv, strv);
973 virConnectPtr conn = Connect_val (connv);
974 char *str = String_val (strv);
977 NONBLOCKING (r = virDomainRestore (conn, str));
978 CHECK_ERROR (r == -1, conn, "virDomainRestore");
980 CAMLreturn (Val_unit);
983 /* Automatically generated binding for virDomainRestoreJob.
984 * In generator.pl this function has signature "conn, string : job".
987 #ifdef HAVE_WEAK_SYMBOLS
988 #ifdef HAVE_VIRDOMAINRESTOREJOB
989 extern virJobPtr virDomainRestoreJob (virConnectPtr conn, const char *str) __attribute__((weak));
994 ocaml_libvirt_domain_restore_job (value connv, value strv)
996 CAMLparam2 (connv, strv);
997 #ifndef HAVE_VIRDOMAINRESTOREJOB
998 /* Symbol virDomainRestoreJob not found at compile time. */
999 not_supported ("virDomainRestoreJob");
1002 /* Check that the symbol virDomainRestoreJob
1003 * is in runtime version of libvirt.
1005 WEAK_SYMBOL_CHECK (virDomainRestoreJob);
1008 virConnectPtr conn = Connect_val (connv);
1009 char *str = String_val (strv);
1012 NONBLOCKING (r = virDomainRestoreJob (conn, str));
1013 CHECK_ERROR (!r, conn, "virDomainRestoreJob");
1015 rv = Val_job (r, connv);
1021 /* Automatically generated binding for virDomainCoreDump.
1022 * In generator.pl this function has signature "dom, string, 0 : unit".
1026 ocaml_libvirt_domain_core_dump (value domv, value strv)
1028 CAMLparam2 (domv, strv);
1031 virDomainPtr dom = Domain_val (domv);
1032 virConnectPtr conn = Connect_domv (domv);
1033 char *str = String_val (strv);
1036 NONBLOCKING (r = virDomainCoreDump (dom, str, 0));
1037 CHECK_ERROR (!r, conn, "virDomainCoreDump");
1039 CAMLreturn (Val_unit);
1042 /* Automatically generated binding for virDomainCoreDumpJob.
1043 * In generator.pl this function has signature "dom, string, 0 : job from dom".
1046 #ifdef HAVE_WEAK_SYMBOLS
1047 #ifdef HAVE_VIRDOMAINCOREDUMPJOB
1048 extern virJobPtr virDomainCoreDumpJob (virDomainPtr dom, const char *str, int flags) __attribute__((weak));
1053 ocaml_libvirt_domain_core_dump_job (value domv, value strv)
1055 CAMLparam2 (domv, strv);
1056 #ifndef HAVE_VIRDOMAINCOREDUMPJOB
1057 /* Symbol virDomainCoreDumpJob not found at compile time. */
1058 not_supported ("virDomainCoreDumpJob");
1061 /* Check that the symbol virDomainCoreDumpJob
1062 * is in runtime version of libvirt.
1064 WEAK_SYMBOL_CHECK (virDomainCoreDumpJob);
1066 CAMLlocal2 (rv, connv);
1067 virDomainPtr dom = Domain_val (domv);
1068 virConnectPtr conn = Connect_domv (domv);
1069 char *str = String_val (strv);
1072 NONBLOCKING (r = virDomainCoreDumpJob (dom, str, 0));
1073 CHECK_ERROR (!r, conn, "virDomainCoreDumpJob");
1075 connv = Field (domv, 1);
1076 rv = Val_job (r, connv);
1082 /* Automatically generated binding for virDomainSuspend.
1083 * In generator.pl this function has signature "dom : unit".
1087 ocaml_libvirt_domain_suspend (value domv)
1091 virDomainPtr dom = Domain_val (domv);
1092 virConnectPtr conn = Connect_domv (domv);
1095 NONBLOCKING (r = virDomainSuspend (dom));
1096 CHECK_ERROR (r == -1, conn, "virDomainSuspend");
1098 CAMLreturn (Val_unit);
1101 /* Automatically generated binding for virDomainResume.
1102 * In generator.pl this function has signature "dom : unit".
1106 ocaml_libvirt_domain_resume (value domv)
1110 virDomainPtr dom = Domain_val (domv);
1111 virConnectPtr conn = Connect_domv (domv);
1114 NONBLOCKING (r = virDomainResume (dom));
1115 CHECK_ERROR (r == -1, conn, "virDomainResume");
1117 CAMLreturn (Val_unit);
1120 /* Automatically generated binding for virDomainShutdown.
1121 * In generator.pl this function has signature "dom : unit".
1125 ocaml_libvirt_domain_shutdown (value domv)
1129 virDomainPtr dom = Domain_val (domv);
1130 virConnectPtr conn = Connect_domv (domv);
1133 NONBLOCKING (r = virDomainShutdown (dom));
1134 CHECK_ERROR (r == -1, conn, "virDomainShutdown");
1136 CAMLreturn (Val_unit);
1139 /* Automatically generated binding for virDomainReboot.
1140 * In generator.pl this function has signature "dom, 0 : unit".
1144 ocaml_libvirt_domain_reboot (value domv)
1148 virDomainPtr dom = Domain_val (domv);
1149 virConnectPtr conn = Connect_domv (domv);
1152 NONBLOCKING (r = virDomainReboot (dom, 0));
1153 CHECK_ERROR (r == -1, conn, "virDomainReboot");
1155 CAMLreturn (Val_unit);
1158 /* Automatically generated binding for virDomainDefineXML.
1159 * In generator.pl this function has signature "conn, string : dom".
1163 ocaml_libvirt_domain_define_xml (value connv, value strv)
1165 CAMLparam2 (connv, strv);
1168 virConnectPtr conn = Connect_val (connv);
1169 char *str = String_val (strv);
1172 NONBLOCKING (r = virDomainDefineXML (conn, str));
1173 CHECK_ERROR (!r, conn, "virDomainDefineXML");
1175 rv = Val_domain (r, connv);
1180 /* Automatically generated binding for virDomainUndefine.
1181 * In generator.pl this function has signature "dom : unit".
1185 ocaml_libvirt_domain_undefine (value domv)
1189 virDomainPtr dom = Domain_val (domv);
1190 virConnectPtr conn = Connect_domv (domv);
1193 NONBLOCKING (r = virDomainUndefine (dom));
1194 CHECK_ERROR (r == -1, conn, "virDomainUndefine");
1196 CAMLreturn (Val_unit);
1199 /* Automatically generated binding for virDomainCreate.
1200 * In generator.pl this function has signature "dom : unit".
1204 ocaml_libvirt_domain_create (value domv)
1208 virDomainPtr dom = Domain_val (domv);
1209 virConnectPtr conn = Connect_domv (domv);
1212 NONBLOCKING (r = virDomainCreate (dom));
1213 CHECK_ERROR (r == -1, conn, "virDomainCreate");
1215 CAMLreturn (Val_unit);
1218 /* Automatically generated binding for virDomainCreateJob.
1219 * In generator.pl this function has signature "dom, 0U : job from dom".
1222 #ifdef HAVE_WEAK_SYMBOLS
1223 #ifdef HAVE_VIRDOMAINCREATEJOB
1224 extern virJobPtr virDomainCreateJob (virDomainPtr dom, unsigned int flags) __attribute__((weak));
1229 ocaml_libvirt_domain_create_job (value domv)
1232 #ifndef HAVE_VIRDOMAINCREATEJOB
1233 /* Symbol virDomainCreateJob not found at compile time. */
1234 not_supported ("virDomainCreateJob");
1237 /* Check that the symbol virDomainCreateJob
1238 * is in runtime version of libvirt.
1240 WEAK_SYMBOL_CHECK (virDomainCreateJob);
1242 CAMLlocal2 (rv, connv);
1243 virDomainPtr dom = Domain_val (domv);
1244 virConnectPtr conn = Connect_domv (domv);
1247 NONBLOCKING (r = virDomainCreateJob (dom, 0));
1248 CHECK_ERROR (!r, conn, "virDomainCreateJob");
1250 connv = Field (domv, 1);
1251 rv = Val_job (r, connv);
1257 /* Automatically generated binding for virDomainAttachDevice.
1258 * In generator.pl this function has signature "dom, string : unit".
1262 ocaml_libvirt_domain_attach_device (value domv, value strv)
1264 CAMLparam2 (domv, strv);
1266 virDomainPtr dom = Domain_val (domv);
1267 virConnectPtr conn = Connect_domv (domv);
1268 char *str = String_val (strv);
1271 NONBLOCKING (r = virDomainAttachDevice (dom, str));
1272 CHECK_ERROR (r == -1, conn, "virDomainAttachDevice");
1274 CAMLreturn (Val_unit);
1277 /* Automatically generated binding for virDomainDetachDevice.
1278 * In generator.pl this function has signature "dom, string : unit".
1282 ocaml_libvirt_domain_detach_device (value domv, value strv)
1284 CAMLparam2 (domv, strv);
1286 virDomainPtr dom = Domain_val (domv);
1287 virConnectPtr conn = Connect_domv (domv);
1288 char *str = String_val (strv);
1291 NONBLOCKING (r = virDomainDetachDevice (dom, str));
1292 CHECK_ERROR (r == -1, conn, "virDomainDetachDevice");
1294 CAMLreturn (Val_unit);
1297 /* Automatically generated binding for virDomainGetAutostart.
1298 * In generator.pl this function has signature "dom : bool".
1302 ocaml_libvirt_domain_get_autostart (value domv)
1306 virDomainPtr dom = Domain_val (domv);
1307 virConnectPtr conn = Connect_domv (domv);
1310 NONBLOCKING (r = virDomainGetAutostart (dom, &b));
1311 CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
1313 CAMLreturn (b ? Val_true : Val_false);
1316 /* Automatically generated binding for virDomainSetAutostart.
1317 * In generator.pl this function has signature "dom, bool : unit".
1321 ocaml_libvirt_domain_set_autostart (value domv, value bv)
1323 CAMLparam2 (domv, bv);
1325 virDomainPtr dom = Domain_val (domv);
1326 virConnectPtr conn = Connect_domv (domv);
1329 b = bv == Val_true ? 1 : 0;
1331 NONBLOCKING (r = virDomainSetAutostart (dom, b));
1332 CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
1334 CAMLreturn (Val_unit);
1337 /* Automatically generated binding for virNetworkFree.
1338 * In generator.pl this function has signature "net : free".
1342 ocaml_libvirt_network_free (value netv)
1346 virNetworkPtr net = Network_val (netv);
1347 virConnectPtr conn = Connect_netv (netv);
1350 NONBLOCKING (r = virNetworkFree (net));
1351 CHECK_ERROR (r == -1, conn, "virNetworkFree");
1353 /* So that we don't double-free in the finalizer: */
1354 Network_val (netv) = NULL;
1356 CAMLreturn (Val_unit);
1359 /* Automatically generated binding for virNetworkDestroy.
1360 * In generator.pl this function has signature "net : free".
1364 ocaml_libvirt_network_destroy (value netv)
1368 virNetworkPtr net = Network_val (netv);
1369 virConnectPtr conn = Connect_netv (netv);
1372 NONBLOCKING (r = virNetworkDestroy (net));
1373 CHECK_ERROR (r == -1, conn, "virNetworkDestroy");
1375 /* So that we don't double-free in the finalizer: */
1376 Network_val (netv) = NULL;
1378 CAMLreturn (Val_unit);
1381 /* Automatically generated binding for virNetworkLookupByName.
1382 * In generator.pl this function has signature "conn, string : net".
1386 ocaml_libvirt_network_lookup_by_name (value connv, value strv)
1388 CAMLparam2 (connv, strv);
1391 virConnectPtr conn = Connect_val (connv);
1392 char *str = String_val (strv);
1395 NONBLOCKING (r = virNetworkLookupByName (conn, str));
1396 CHECK_ERROR (!r, conn, "virNetworkLookupByName");
1398 rv = Val_network (r, connv);
1403 /* Automatically generated binding for virNetworkLookupByUUID.
1404 * In generator.pl this function has signature "conn, uuid : net".
1408 ocaml_libvirt_network_lookup_by_uuid (value connv, value uuidv)
1410 CAMLparam2 (connv, uuidv);
1413 virConnectPtr conn = Connect_val (connv);
1414 unsigned char *uuid = (unsigned char *) String_val (uuidv);
1417 NONBLOCKING (r = virNetworkLookupByUUID (conn, uuid));
1418 CHECK_ERROR (!r, conn, "virNetworkLookupByUUID");
1420 rv = Val_network (r, connv);
1425 /* Automatically generated binding for virNetworkLookupByUUIDString.
1426 * In generator.pl this function has signature "conn, string : net".
1430 ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv)
1432 CAMLparam2 (connv, strv);
1435 virConnectPtr conn = Connect_val (connv);
1436 char *str = String_val (strv);
1439 NONBLOCKING (r = virNetworkLookupByUUIDString (conn, str));
1440 CHECK_ERROR (!r, conn, "virNetworkLookupByUUIDString");
1442 rv = Val_network (r, connv);
1447 /* Automatically generated binding for virNetworkGetName.
1448 * In generator.pl this function has signature "net : static string".
1452 ocaml_libvirt_network_get_name (value netv)
1457 virNetworkPtr net = Network_val (netv);
1458 virConnectPtr conn = Connect_netv (netv);
1461 NONBLOCKING (r = virNetworkGetName (net));
1462 CHECK_ERROR (!r, conn, "virNetworkGetName");
1464 rv = caml_copy_string (r);
1468 /* Automatically generated binding for virNetworkGetXMLDesc.
1469 * In generator.pl this function has signature "net, 0 : string".
1473 ocaml_libvirt_network_get_xml_desc (value netv)
1478 virNetworkPtr net = Network_val (netv);
1479 virConnectPtr conn = Connect_netv (netv);
1482 NONBLOCKING (r = virNetworkGetXMLDesc (net, 0));
1483 CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc");
1485 rv = caml_copy_string (r);
1490 /* Automatically generated binding for virNetworkGetBridgeName.
1491 * In generator.pl this function has signature "net : string".
1495 ocaml_libvirt_network_get_bridge_name (value netv)
1500 virNetworkPtr net = Network_val (netv);
1501 virConnectPtr conn = Connect_netv (netv);
1504 NONBLOCKING (r = virNetworkGetBridgeName (net));
1505 CHECK_ERROR (!r, conn, "virNetworkGetBridgeName");
1507 rv = caml_copy_string (r);
1512 /* Automatically generated binding for virNetworkGetUUID.
1513 * In generator.pl this function has signature "net : uuid".
1517 ocaml_libvirt_network_get_uuid (value netv)
1522 virNetworkPtr net = Network_val (netv);
1523 virConnectPtr conn = Connect_netv (netv);
1524 unsigned char uuid[VIR_UUID_BUFLEN];
1527 NONBLOCKING (r = virNetworkGetUUID (net, uuid));
1528 CHECK_ERROR (r == -1, conn, "virNetworkGetUUID");
1530 /* UUIDs are byte arrays with a fixed length. */
1531 rv = caml_alloc_string (VIR_UUID_BUFLEN);
1532 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
1536 /* Automatically generated binding for virNetworkGetUUIDString.
1537 * In generator.pl this function has signature "net : uuid string".
1541 ocaml_libvirt_network_get_uuid_string (value netv)
1546 virNetworkPtr net = Network_val (netv);
1547 virConnectPtr conn = Connect_netv (netv);
1548 char uuid[VIR_UUID_STRING_BUFLEN];
1551 NONBLOCKING (r = virNetworkGetUUIDString (net, uuid));
1552 CHECK_ERROR (r == -1, conn, "virNetworkGetUUIDString");
1554 rv = caml_copy_string (uuid);
1558 /* Automatically generated binding for virNetworkUndefine.
1559 * In generator.pl this function has signature "net : unit".
1563 ocaml_libvirt_network_undefine (value netv)
1567 virNetworkPtr net = Network_val (netv);
1568 virConnectPtr conn = Connect_netv (netv);
1571 NONBLOCKING (r = virNetworkUndefine (net));
1572 CHECK_ERROR (r == -1, conn, "virNetworkUndefine");
1574 CAMLreturn (Val_unit);
1577 /* Automatically generated binding for virNetworkCreateXML.
1578 * In generator.pl this function has signature "conn, string : net".
1582 ocaml_libvirt_network_create_xml (value connv, value strv)
1584 CAMLparam2 (connv, strv);
1587 virConnectPtr conn = Connect_val (connv);
1588 char *str = String_val (strv);
1591 NONBLOCKING (r = virNetworkCreateXML (conn, str));
1592 CHECK_ERROR (!r, conn, "virNetworkCreateXML");
1594 rv = Val_network (r, connv);
1599 /* Automatically generated binding for virNetworkCreateXMLJob.
1600 * In generator.pl this function has signature "conn, string : job".
1603 #ifdef HAVE_WEAK_SYMBOLS
1604 #ifdef HAVE_VIRNETWORKCREATEXMLJOB
1605 extern virJobPtr virNetworkCreateXMLJob (virConnectPtr conn, const char *str) __attribute__((weak));
1610 ocaml_libvirt_network_create_xml_job (value connv, value strv)
1612 CAMLparam2 (connv, strv);
1613 #ifndef HAVE_VIRNETWORKCREATEXMLJOB
1614 /* Symbol virNetworkCreateXMLJob not found at compile time. */
1615 not_supported ("virNetworkCreateXMLJob");
1618 /* Check that the symbol virNetworkCreateXMLJob
1619 * is in runtime version of libvirt.
1621 WEAK_SYMBOL_CHECK (virNetworkCreateXMLJob);
1624 virConnectPtr conn = Connect_val (connv);
1625 char *str = String_val (strv);
1628 NONBLOCKING (r = virNetworkCreateXMLJob (conn, str));
1629 CHECK_ERROR (!r, conn, "virNetworkCreateXMLJob");
1631 rv = Val_job (r, connv);
1637 /* Automatically generated binding for virNetworkDefineXML.
1638 * In generator.pl this function has signature "conn, string : net".
1642 ocaml_libvirt_network_define_xml (value connv, value strv)
1644 CAMLparam2 (connv, strv);
1647 virConnectPtr conn = Connect_val (connv);
1648 char *str = String_val (strv);
1651 NONBLOCKING (r = virNetworkDefineXML (conn, str));
1652 CHECK_ERROR (!r, conn, "virNetworkDefineXML");
1654 rv = Val_network (r, connv);
1659 /* Automatically generated binding for virNetworkCreate.
1660 * In generator.pl this function has signature "net : unit".
1664 ocaml_libvirt_network_create (value netv)
1668 virNetworkPtr net = Network_val (netv);
1669 virConnectPtr conn = Connect_netv (netv);
1672 NONBLOCKING (r = virNetworkCreate (net));
1673 CHECK_ERROR (r == -1, conn, "virNetworkCreate");
1675 CAMLreturn (Val_unit);
1678 /* Automatically generated binding for virNetworkCreateJob.
1679 * In generator.pl this function has signature "net : job from net".
1682 #ifdef HAVE_WEAK_SYMBOLS
1683 #ifdef HAVE_VIRNETWORKCREATEJOB
1684 extern virJobPtr virNetworkCreateJob (virNetworkPtr net) __attribute__((weak));
1689 ocaml_libvirt_network_create_job (value netv)
1692 #ifndef HAVE_VIRNETWORKCREATEJOB
1693 /* Symbol virNetworkCreateJob not found at compile time. */
1694 not_supported ("virNetworkCreateJob");
1697 /* Check that the symbol virNetworkCreateJob
1698 * is in runtime version of libvirt.
1700 WEAK_SYMBOL_CHECK (virNetworkCreateJob);
1702 CAMLlocal2 (rv, connv);
1703 virNetworkPtr net = Network_val (netv);
1704 virConnectPtr conn = Connect_netv (netv);
1707 NONBLOCKING (r = virNetworkCreateJob (net));
1708 CHECK_ERROR (!r, conn, "virNetworkCreateJob");
1710 connv = Field (netv, 1);
1711 rv = Val_job (r, connv);
1717 /* Automatically generated binding for virNetworkGetAutostart.
1718 * In generator.pl this function has signature "net : bool".
1722 ocaml_libvirt_network_get_autostart (value netv)
1726 virNetworkPtr net = Network_val (netv);
1727 virConnectPtr conn = Connect_netv (netv);
1730 NONBLOCKING (r = virNetworkGetAutostart (net, &b));
1731 CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
1733 CAMLreturn (b ? Val_true : Val_false);
1736 /* Automatically generated binding for virNetworkSetAutostart.
1737 * In generator.pl this function has signature "net, bool : unit".
1741 ocaml_libvirt_network_set_autostart (value netv, value bv)
1743 CAMLparam2 (netv, bv);
1745 virNetworkPtr net = Network_val (netv);
1746 virConnectPtr conn = Connect_netv (netv);
1749 b = bv == Val_true ? 1 : 0;
1751 NONBLOCKING (r = virNetworkSetAutostart (net, b));
1752 CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
1754 CAMLreturn (Val_unit);
1757 /* Automatically generated binding for virStoragePoolFree.
1758 * In generator.pl this function has signature "pool : free".
1761 #ifdef HAVE_WEAK_SYMBOLS
1762 #ifdef HAVE_VIRSTORAGEPOOLFREE
1763 extern int virStoragePoolFree (virStoragePoolPtr pool) __attribute__((weak));
1768 ocaml_libvirt_storage_pool_free (value poolv)
1771 #ifndef HAVE_VIRSTORAGEPOOLFREE
1772 /* Symbol virStoragePoolFree not found at compile time. */
1773 not_supported ("virStoragePoolFree");
1776 /* Check that the symbol virStoragePoolFree
1777 * is in runtime version of libvirt.
1779 WEAK_SYMBOL_CHECK (virStoragePoolFree);
1781 virStoragePoolPtr pool = Pool_val (poolv);
1782 virConnectPtr conn = Connect_polv (poolv);
1785 NONBLOCKING (r = virStoragePoolFree (pool));
1786 CHECK_ERROR (r == -1, conn, "virStoragePoolFree");
1788 /* So that we don't double-free in the finalizer: */
1789 Pool_val (poolv) = NULL;
1791 CAMLreturn (Val_unit);
1795 /* Automatically generated binding for virStoragePoolDestroy.
1796 * In generator.pl this function has signature "pool : free".
1799 #ifdef HAVE_WEAK_SYMBOLS
1800 #ifdef HAVE_VIRSTORAGEPOOLDESTROY
1801 extern int virStoragePoolDestroy (virStoragePoolPtr pool) __attribute__((weak));
1806 ocaml_libvirt_storage_pool_destroy (value poolv)
1809 #ifndef HAVE_VIRSTORAGEPOOLDESTROY
1810 /* Symbol virStoragePoolDestroy not found at compile time. */
1811 not_supported ("virStoragePoolDestroy");
1814 /* Check that the symbol virStoragePoolDestroy
1815 * is in runtime version of libvirt.
1817 WEAK_SYMBOL_CHECK (virStoragePoolDestroy);
1819 virStoragePoolPtr pool = Pool_val (poolv);
1820 virConnectPtr conn = Connect_polv (poolv);
1823 NONBLOCKING (r = virStoragePoolDestroy (pool));
1824 CHECK_ERROR (r == -1, conn, "virStoragePoolDestroy");
1826 /* So that we don't double-free in the finalizer: */
1827 Pool_val (poolv) = NULL;
1829 CAMLreturn (Val_unit);
1833 /* Automatically generated binding for virStoragePoolLookupByName.
1834 * In generator.pl this function has signature "conn, string : pool".
1837 #ifdef HAVE_WEAK_SYMBOLS
1838 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1839 extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak));
1844 ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
1846 CAMLparam2 (connv, strv);
1847 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1848 /* Symbol virStoragePoolLookupByName not found at compile time. */
1849 not_supported ("virStoragePoolLookupByName");
1852 /* Check that the symbol virStoragePoolLookupByName
1853 * is in runtime version of libvirt.
1855 WEAK_SYMBOL_CHECK (virStoragePoolLookupByName);
1858 virConnectPtr conn = Connect_val (connv);
1859 char *str = String_val (strv);
1860 virStoragePoolPtr r;
1862 NONBLOCKING (r = virStoragePoolLookupByName (conn, str));
1863 CHECK_ERROR (!r, conn, "virStoragePoolLookupByName");
1865 rv = Val_pool (r, connv);
1871 /* Automatically generated binding for virStoragePoolLookupByUUID.
1872 * In generator.pl this function has signature "conn, uuid : pool".
1875 #ifdef HAVE_WEAK_SYMBOLS
1876 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1877 extern virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn, const unsigned char *str) __attribute__((weak));
1882 ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv)
1884 CAMLparam2 (connv, uuidv);
1885 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1886 /* Symbol virStoragePoolLookupByUUID not found at compile time. */
1887 not_supported ("virStoragePoolLookupByUUID");
1890 /* Check that the symbol virStoragePoolLookupByUUID
1891 * is in runtime version of libvirt.
1893 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUID);
1896 virConnectPtr conn = Connect_val (connv);
1897 unsigned char *uuid = (unsigned char *) String_val (uuidv);
1898 virStoragePoolPtr r;
1900 NONBLOCKING (r = virStoragePoolLookupByUUID (conn, uuid));
1901 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUID");
1903 rv = Val_pool (r, connv);
1909 /* Automatically generated binding for virStoragePoolLookupByUUIDString.
1910 * In generator.pl this function has signature "conn, string : pool".
1913 #ifdef HAVE_WEAK_SYMBOLS
1914 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1915 extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak));
1920 ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv)
1922 CAMLparam2 (connv, strv);
1923 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1924 /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */
1925 not_supported ("virStoragePoolLookupByUUIDString");
1928 /* Check that the symbol virStoragePoolLookupByUUIDString
1929 * is in runtime version of libvirt.
1931 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUIDString);
1934 virConnectPtr conn = Connect_val (connv);
1935 char *str = String_val (strv);
1936 virStoragePoolPtr r;
1938 NONBLOCKING (r = virStoragePoolLookupByUUIDString (conn, str));
1939 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUIDString");
1941 rv = Val_pool (r, connv);
1947 /* Automatically generated binding for virStoragePoolGetName.
1948 * In generator.pl this function has signature "pool : static string".
1951 #ifdef HAVE_WEAK_SYMBOLS
1952 #ifdef HAVE_VIRSTORAGEPOOLGETNAME
1953 extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak));
1958 ocaml_libvirt_storage_pool_get_name (value poolv)
1961 #ifndef HAVE_VIRSTORAGEPOOLGETNAME
1962 /* Symbol virStoragePoolGetName not found at compile time. */
1963 not_supported ("virStoragePoolGetName");
1966 /* Check that the symbol virStoragePoolGetName
1967 * is in runtime version of libvirt.
1969 WEAK_SYMBOL_CHECK (virStoragePoolGetName);
1972 virStoragePoolPtr pool = Pool_val (poolv);
1973 virConnectPtr conn = Connect_polv (poolv);
1976 NONBLOCKING (r = virStoragePoolGetName (pool));
1977 CHECK_ERROR (!r, conn, "virStoragePoolGetName");
1979 rv = caml_copy_string (r);
1984 /* Automatically generated binding for virStoragePoolGetXMLDesc.
1985 * In generator.pl this function has signature "pool, 0U : string".
1988 #ifdef HAVE_WEAK_SYMBOLS
1989 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
1990 extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
1995 ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
1998 #ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC
1999 /* Symbol virStoragePoolGetXMLDesc not found at compile time. */
2000 not_supported ("virStoragePoolGetXMLDesc");
2003 /* Check that the symbol virStoragePoolGetXMLDesc
2004 * is in runtime version of libvirt.
2006 WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc);
2009 virStoragePoolPtr pool = Pool_val (poolv);
2010 virConnectPtr conn = Connect_polv (poolv);
2013 NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0));
2014 CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc");
2016 rv = caml_copy_string (r);
2022 /* Automatically generated binding for virStoragePoolGetUUID.
2023 * In generator.pl this function has signature "pool : uuid".
2026 #ifdef HAVE_WEAK_SYMBOLS
2027 #ifdef HAVE_VIRSTORAGEPOOLGETUUID
2028 extern int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char *) __attribute__((weak));
2033 ocaml_libvirt_storage_pool_get_uuid (value poolv)
2036 #ifndef HAVE_VIRSTORAGEPOOLGETUUID
2037 /* Symbol virStoragePoolGetUUID not found at compile time. */
2038 not_supported ("virStoragePoolGetUUID");
2041 /* Check that the symbol virStoragePoolGetUUID
2042 * is in runtime version of libvirt.
2044 WEAK_SYMBOL_CHECK (virStoragePoolGetUUID);
2047 virStoragePoolPtr pool = Pool_val (poolv);
2048 virConnectPtr conn = Connect_polv (poolv);
2049 unsigned char uuid[VIR_UUID_BUFLEN];
2052 NONBLOCKING (r = virStoragePoolGetUUID (pool, uuid));
2053 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUID");
2055 /* UUIDs are byte arrays with a fixed length. */
2056 rv = caml_alloc_string (VIR_UUID_BUFLEN);
2057 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
2062 /* Automatically generated binding for virStoragePoolGetUUIDString.
2063 * In generator.pl this function has signature "pool : uuid string".
2066 #ifdef HAVE_WEAK_SYMBOLS
2067 #ifdef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2068 extern int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char *) __attribute__((weak));
2073 ocaml_libvirt_storage_pool_get_uuid_string (value poolv)
2076 #ifndef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2077 /* Symbol virStoragePoolGetUUIDString not found at compile time. */
2078 not_supported ("virStoragePoolGetUUIDString");
2081 /* Check that the symbol virStoragePoolGetUUIDString
2082 * is in runtime version of libvirt.
2084 WEAK_SYMBOL_CHECK (virStoragePoolGetUUIDString);
2087 virStoragePoolPtr pool = Pool_val (poolv);
2088 virConnectPtr conn = Connect_polv (poolv);
2089 char uuid[VIR_UUID_STRING_BUFLEN];
2092 NONBLOCKING (r = virStoragePoolGetUUIDString (pool, uuid));
2093 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUIDString");
2095 rv = caml_copy_string (uuid);
2100 /* Automatically generated binding for virStoragePoolCreateXML.
2101 * In generator.pl this function has signature "conn, string, 0U : pool".
2104 #ifdef HAVE_WEAK_SYMBOLS
2105 #ifdef HAVE_VIRSTORAGEPOOLCREATEXML
2106 extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
2111 ocaml_libvirt_storage_pool_create_xml (value connv, value strv)
2113 CAMLparam2 (connv, strv);
2114 #ifndef HAVE_VIRSTORAGEPOOLCREATEXML
2115 /* Symbol virStoragePoolCreateXML not found at compile time. */
2116 not_supported ("virStoragePoolCreateXML");
2119 /* Check that the symbol virStoragePoolCreateXML
2120 * is in runtime version of libvirt.
2122 WEAK_SYMBOL_CHECK (virStoragePoolCreateXML);
2125 virConnectPtr conn = Connect_val (connv);
2126 char *str = String_val (strv);
2127 virStoragePoolPtr r;
2129 NONBLOCKING (r = virStoragePoolCreateXML (conn, str, 0));
2130 CHECK_ERROR (!r, conn, "virStoragePoolCreateXML");
2132 rv = Val_pool (r, connv);
2138 /* Automatically generated binding for virStoragePoolDefineXML.
2139 * In generator.pl this function has signature "conn, string, 0U : pool".
2142 #ifdef HAVE_WEAK_SYMBOLS
2143 #ifdef HAVE_VIRSTORAGEPOOLDEFINEXML
2144 extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
2149 ocaml_libvirt_storage_pool_define_xml (value connv, value strv)
2151 CAMLparam2 (connv, strv);
2152 #ifndef HAVE_VIRSTORAGEPOOLDEFINEXML
2153 /* Symbol virStoragePoolDefineXML not found at compile time. */
2154 not_supported ("virStoragePoolDefineXML");
2157 /* Check that the symbol virStoragePoolDefineXML
2158 * is in runtime version of libvirt.
2160 WEAK_SYMBOL_CHECK (virStoragePoolDefineXML);
2163 virConnectPtr conn = Connect_val (connv);
2164 char *str = String_val (strv);
2165 virStoragePoolPtr r;
2167 NONBLOCKING (r = virStoragePoolDefineXML (conn, str, 0));
2168 CHECK_ERROR (!r, conn, "virStoragePoolDefineXML");
2170 rv = Val_pool (r, connv);
2176 /* Automatically generated binding for virStoragePoolBuild.
2177 * In generator.pl this function has signature "pool, uint : unit".
2180 #ifdef HAVE_WEAK_SYMBOLS
2181 #ifdef HAVE_VIRSTORAGEPOOLBUILD
2182 extern int virStoragePoolBuild (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
2187 ocaml_libvirt_storage_pool_build (value poolv, value iv)
2189 CAMLparam2 (poolv, iv);
2190 #ifndef HAVE_VIRSTORAGEPOOLBUILD
2191 /* Symbol virStoragePoolBuild not found at compile time. */
2192 not_supported ("virStoragePoolBuild");
2195 /* Check that the symbol virStoragePoolBuild
2196 * is in runtime version of libvirt.
2198 WEAK_SYMBOL_CHECK (virStoragePoolBuild);
2200 virStoragePoolPtr pool = Pool_val (poolv);
2201 virConnectPtr conn = Connect_polv (poolv);
2202 unsigned int i = Int_val (iv);
2205 NONBLOCKING (r = virStoragePoolBuild (pool, i));
2206 CHECK_ERROR (!r, conn, "virStoragePoolBuild");
2208 CAMLreturn (Val_unit);
2212 /* Automatically generated binding for virStoragePoolUndefine.
2213 * In generator.pl this function has signature "pool : unit".
2216 #ifdef HAVE_WEAK_SYMBOLS
2217 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
2218 extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
2223 ocaml_libvirt_storage_pool_undefine (value poolv)
2226 #ifndef HAVE_VIRSTORAGEPOOLUNDEFINE
2227 /* Symbol virStoragePoolUndefine not found at compile time. */
2228 not_supported ("virStoragePoolUndefine");
2231 /* Check that the symbol virStoragePoolUndefine
2232 * is in runtime version of libvirt.
2234 WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
2236 virStoragePoolPtr pool = Pool_val (poolv);
2237 virConnectPtr conn = Connect_polv (poolv);
2240 NONBLOCKING (r = virStoragePoolUndefine (pool));
2241 CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
2243 CAMLreturn (Val_unit);
2247 /* Automatically generated binding for virStoragePoolCreate.
2248 * In generator.pl this function has signature "pool, 0U : unit".
2251 #ifdef HAVE_WEAK_SYMBOLS
2252 #ifdef HAVE_VIRSTORAGEPOOLCREATE
2253 extern int virStoragePoolCreate (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
2258 ocaml_libvirt_storage_pool_create (value poolv)
2261 #ifndef HAVE_VIRSTORAGEPOOLCREATE
2262 /* Symbol virStoragePoolCreate not found at compile time. */
2263 not_supported ("virStoragePoolCreate");
2266 /* Check that the symbol virStoragePoolCreate
2267 * is in runtime version of libvirt.
2269 WEAK_SYMBOL_CHECK (virStoragePoolCreate);
2271 virStoragePoolPtr pool = Pool_val (poolv);
2272 virConnectPtr conn = Connect_polv (poolv);
2275 NONBLOCKING (r = virStoragePoolCreate (pool, 0));
2276 CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
2278 CAMLreturn (Val_unit);
2282 /* Automatically generated binding for virStoragePoolDelete.
2283 * In generator.pl this function has signature "pool, uint : unit".
2286 #ifdef HAVE_WEAK_SYMBOLS
2287 #ifdef HAVE_VIRSTORAGEPOOLDELETE
2288 extern int virStoragePoolDelete (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
2293 ocaml_libvirt_storage_pool_delete (value poolv, value iv)
2295 CAMLparam2 (poolv, iv);
2296 #ifndef HAVE_VIRSTORAGEPOOLDELETE
2297 /* Symbol virStoragePoolDelete not found at compile time. */
2298 not_supported ("virStoragePoolDelete");
2301 /* Check that the symbol virStoragePoolDelete
2302 * is in runtime version of libvirt.
2304 WEAK_SYMBOL_CHECK (virStoragePoolDelete);
2306 virStoragePoolPtr pool = Pool_val (poolv);
2307 virConnectPtr conn = Connect_polv (poolv);
2308 unsigned int i = Int_val (iv);
2311 NONBLOCKING (r = virStoragePoolDelete (pool, i));
2312 CHECK_ERROR (!r, conn, "virStoragePoolDelete");
2314 CAMLreturn (Val_unit);
2318 /* Automatically generated binding for virStoragePoolRefresh.
2319 * In generator.pl this function has signature "pool, 0U : unit".
2322 #ifdef HAVE_WEAK_SYMBOLS
2323 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
2324 extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
2329 ocaml_libvirt_storage_pool_refresh (value poolv)
2332 #ifndef HAVE_VIRSTORAGEPOOLREFRESH
2333 /* Symbol virStoragePoolRefresh not found at compile time. */
2334 not_supported ("virStoragePoolRefresh");
2337 /* Check that the symbol virStoragePoolRefresh
2338 * is in runtime version of libvirt.
2340 WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
2342 virStoragePoolPtr pool = Pool_val (poolv);
2343 virConnectPtr conn = Connect_polv (poolv);
2346 NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
2347 CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
2349 CAMLreturn (Val_unit);
2353 /* Automatically generated binding for virStoragePoolGetAutostart.
2354 * In generator.pl this function has signature "pool : bool".
2357 #ifdef HAVE_WEAK_SYMBOLS
2358 #ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2359 extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak));
2364 ocaml_libvirt_storage_pool_get_autostart (value poolv)
2367 #ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2368 /* Symbol virStoragePoolGetAutostart not found at compile time. */
2369 not_supported ("virStoragePoolGetAutostart");
2372 /* Check that the symbol virStoragePoolGetAutostart
2373 * is in runtime version of libvirt.
2375 WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
2377 virStoragePoolPtr pool = Pool_val (poolv);
2378 virConnectPtr conn = Connect_polv (poolv);
2381 NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
2382 CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
2384 CAMLreturn (b ? Val_true : Val_false);
2388 /* Automatically generated binding for virStoragePoolSetAutostart.
2389 * In generator.pl this function has signature "pool, bool : unit".
2392 #ifdef HAVE_WEAK_SYMBOLS
2393 #ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2394 extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak));
2399 ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
2401 CAMLparam2 (poolv, bv);
2402 #ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2403 /* Symbol virStoragePoolSetAutostart not found at compile time. */
2404 not_supported ("virStoragePoolSetAutostart");
2407 /* Check that the symbol virStoragePoolSetAutostart
2408 * is in runtime version of libvirt.
2410 WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
2412 virStoragePoolPtr pool = Pool_val (poolv);
2413 virConnectPtr conn = Connect_polv (poolv);
2416 b = bv == Val_true ? 1 : 0;
2418 NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
2419 CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
2421 CAMLreturn (Val_unit);
2425 /* Automatically generated binding for virStoragePoolNumOfVolumes.
2426 * In generator.pl this function has signature "pool : int".
2429 #ifdef HAVE_WEAK_SYMBOLS
2430 #ifdef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
2431 extern int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) __attribute__((weak));
2436 ocaml_libvirt_storage_pool_num_of_volumes (value poolv)
2439 #ifndef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
2440 /* Symbol virStoragePoolNumOfVolumes not found at compile time. */
2441 not_supported ("virStoragePoolNumOfVolumes");
2444 /* Check that the symbol virStoragePoolNumOfVolumes
2445 * is in runtime version of libvirt.
2447 WEAK_SYMBOL_CHECK (virStoragePoolNumOfVolumes);
2449 virStoragePoolPtr pool = Pool_val (poolv);
2450 virConnectPtr conn = Connect_polv (poolv);
2453 NONBLOCKING (r = virStoragePoolNumOfVolumes (pool));
2454 CHECK_ERROR (r == -1, conn, "virStoragePoolNumOfVolumes");
2456 CAMLreturn (Val_int (r));
2460 /* Automatically generated binding for virStoragePoolListVolumes.
2461 * In generator.pl this function has signature "pool, int : string array".
2464 #ifdef HAVE_WEAK_SYMBOLS
2465 #ifdef HAVE_VIRSTORAGEPOOLLISTVOLUMES
2466 extern int virStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int maxnames) __attribute__((weak));
2471 ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv)
2473 CAMLparam2 (poolv, iv);
2474 #ifndef HAVE_VIRSTORAGEPOOLLISTVOLUMES
2475 /* Symbol virStoragePoolListVolumes not found at compile time. */
2476 not_supported ("virStoragePoolListVolumes");
2479 /* Check that the symbol virStoragePoolListVolumes
2480 * is in runtime version of libvirt.
2482 WEAK_SYMBOL_CHECK (virStoragePoolListVolumes);
2484 CAMLlocal2 (rv, strv);
2485 virStoragePoolPtr pool = Pool_val (poolv);
2486 virConnectPtr conn = Connect_polv (poolv);
2487 int i = Int_val (iv);
2491 /* Some libvirt List* functions still throw exceptions if i == 0,
2492 * so catch that and return an empty array directly. This changes
2493 * the semantics slightly (masking other failures) but it's
2494 * unlikely anyone will care. RWMJ 2008/06/10
2497 rv = caml_alloc (0, 0);
2501 NONBLOCKING (r = virStoragePoolListVolumes (pool, names, i));
2502 CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes");
2504 rv = caml_alloc (r, 0);
2505 for (i = 0; i < r; ++i) {
2506 strv = caml_copy_string (names[i]);
2507 Store_field (rv, i, strv);
2515 /* Automatically generated binding for virStorageVolFree.
2516 * In generator.pl this function has signature "vol : free".
2519 #ifdef HAVE_WEAK_SYMBOLS
2520 #ifdef HAVE_VIRSTORAGEVOLFREE
2521 extern int virStorageVolFree (virStorageVolPtr vol) __attribute__((weak));
2526 ocaml_libvirt_storage_vol_free (value volv)
2529 #ifndef HAVE_VIRSTORAGEVOLFREE
2530 /* Symbol virStorageVolFree not found at compile time. */
2531 not_supported ("virStorageVolFree");
2534 /* Check that the symbol virStorageVolFree
2535 * is in runtime version of libvirt.
2537 WEAK_SYMBOL_CHECK (virStorageVolFree);
2539 virStorageVolPtr vol = Volume_val (volv);
2540 virConnectPtr conn = Connect_volv (volv);
2543 NONBLOCKING (r = virStorageVolFree (vol));
2544 CHECK_ERROR (r == -1, conn, "virStorageVolFree");
2546 /* So that we don't double-free in the finalizer: */
2547 Volume_val (volv) = NULL;
2549 CAMLreturn (Val_unit);
2553 /* Automatically generated binding for virStorageVolDelete.
2554 * In generator.pl this function has signature "vol, uint : unit".
2557 #ifdef HAVE_WEAK_SYMBOLS
2558 #ifdef HAVE_VIRSTORAGEVOLDELETE
2559 extern int virStorageVolDelete (virStorageVolPtr vol, unsigned int i) __attribute__((weak));
2564 ocaml_libvirt_storage_vol_delete (value volv, value iv)
2566 CAMLparam2 (volv, iv);
2567 #ifndef HAVE_VIRSTORAGEVOLDELETE
2568 /* Symbol virStorageVolDelete not found at compile time. */
2569 not_supported ("virStorageVolDelete");
2572 /* Check that the symbol virStorageVolDelete
2573 * is in runtime version of libvirt.
2575 WEAK_SYMBOL_CHECK (virStorageVolDelete);
2577 virStorageVolPtr vol = Volume_val (volv);
2578 virConnectPtr conn = Connect_volv (volv);
2579 unsigned int i = Int_val (iv);
2582 NONBLOCKING (r = virStorageVolDelete (vol, i));
2583 CHECK_ERROR (!r, conn, "virStorageVolDelete");
2585 CAMLreturn (Val_unit);
2589 /* Automatically generated binding for virStorageVolLookupByName.
2590 * In generator.pl this function has signature "pool, string : vol from pool".
2593 #ifdef HAVE_WEAK_SYMBOLS
2594 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2595 extern virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool, const char *str) __attribute__((weak));
2600 ocaml_libvirt_storage_vol_lookup_by_name (value poolv, value strv)
2602 CAMLparam2 (poolv, strv);
2603 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2604 /* Symbol virStorageVolLookupByName not found at compile time. */
2605 not_supported ("virStorageVolLookupByName");
2608 /* Check that the symbol virStorageVolLookupByName
2609 * is in runtime version of libvirt.
2611 WEAK_SYMBOL_CHECK (virStorageVolLookupByName);
2613 CAMLlocal2 (rv, connv);
2614 virStoragePoolPtr pool = Pool_val (poolv);
2615 virConnectPtr conn = Connect_polv (poolv);
2616 char *str = String_val (strv);
2619 NONBLOCKING (r = virStorageVolLookupByName (pool, str));
2620 CHECK_ERROR (!r, conn, "virStorageVolLookupByName");
2622 connv = Field (poolv, 1);
2623 rv = Val_volume (r, connv);
2629 /* Automatically generated binding for virStorageVolLookupByKey.
2630 * In generator.pl this function has signature "conn, string : vol".
2633 #ifdef HAVE_WEAK_SYMBOLS
2634 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2635 extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak));
2640 ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
2642 CAMLparam2 (connv, strv);
2643 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2644 /* Symbol virStorageVolLookupByKey not found at compile time. */
2645 not_supported ("virStorageVolLookupByKey");
2648 /* Check that the symbol virStorageVolLookupByKey
2649 * is in runtime version of libvirt.
2651 WEAK_SYMBOL_CHECK (virStorageVolLookupByKey);
2654 virConnectPtr conn = Connect_val (connv);
2655 char *str = String_val (strv);
2658 NONBLOCKING (r = virStorageVolLookupByKey (conn, str));
2659 CHECK_ERROR (!r, conn, "virStorageVolLookupByKey");
2661 rv = Val_volume (r, connv);
2667 /* Automatically generated binding for virStorageVolLookupByPath.
2668 * In generator.pl this function has signature "conn, string : vol".
2671 #ifdef HAVE_WEAK_SYMBOLS
2672 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2673 extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak));
2678 ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
2680 CAMLparam2 (connv, strv);
2681 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2682 /* Symbol virStorageVolLookupByPath not found at compile time. */
2683 not_supported ("virStorageVolLookupByPath");
2686 /* Check that the symbol virStorageVolLookupByPath
2687 * is in runtime version of libvirt.
2689 WEAK_SYMBOL_CHECK (virStorageVolLookupByPath);
2692 virConnectPtr conn = Connect_val (connv);
2693 char *str = String_val (strv);
2696 NONBLOCKING (r = virStorageVolLookupByPath (conn, str));
2697 CHECK_ERROR (!r, conn, "virStorageVolLookupByPath");
2699 rv = Val_volume (r, connv);
2705 /* Automatically generated binding for virStorageVolCreateXML.
2706 * In generator.pl this function has signature "pool, string, 0U : vol from pool".
2709 #ifdef HAVE_WEAK_SYMBOLS
2710 #ifdef HAVE_VIRSTORAGEVOLCREATEXML
2711 extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, unsigned int flags) __attribute__((weak));
2716 ocaml_libvirt_storage_vol_create_xml (value poolv, value strv)
2718 CAMLparam2 (poolv, strv);
2719 #ifndef HAVE_VIRSTORAGEVOLCREATEXML
2720 /* Symbol virStorageVolCreateXML not found at compile time. */
2721 not_supported ("virStorageVolCreateXML");
2724 /* Check that the symbol virStorageVolCreateXML
2725 * is in runtime version of libvirt.
2727 WEAK_SYMBOL_CHECK (virStorageVolCreateXML);
2729 CAMLlocal2 (rv, connv);
2730 virStoragePoolPtr pool = Pool_val (poolv);
2731 virConnectPtr conn = Connect_polv (poolv);
2732 char *str = String_val (strv);
2735 NONBLOCKING (r = virStorageVolCreateXML (pool, str, 0));
2736 CHECK_ERROR (!r, conn, "virStorageVolCreateXML");
2738 connv = Field (poolv, 1);
2739 rv = Val_volume (r, connv);
2745 /* Automatically generated binding for virStorageVolGetXMLDesc.
2746 * In generator.pl this function has signature "vol, 0U : string".
2749 #ifdef HAVE_WEAK_SYMBOLS
2750 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
2751 extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, unsigned int flags) __attribute__((weak));
2756 ocaml_libvirt_storage_vol_get_xml_desc (value volv)
2759 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
2760 /* Symbol virStorageVolGetXMLDesc not found at compile time. */
2761 not_supported ("virStorageVolGetXMLDesc");
2764 /* Check that the symbol virStorageVolGetXMLDesc
2765 * is in runtime version of libvirt.
2767 WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
2770 virStorageVolPtr vol = Volume_val (volv);
2771 virConnectPtr conn = Connect_volv (volv);
2774 NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0));
2775 CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
2777 rv = caml_copy_string (r);
2783 /* Automatically generated binding for virStorageVolGetPath.
2784 * In generator.pl this function has signature "vol : string".
2787 #ifdef HAVE_WEAK_SYMBOLS
2788 #ifdef HAVE_VIRSTORAGEVOLGETPATH
2789 extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak));
2794 ocaml_libvirt_storage_vol_get_path (value volv)
2797 #ifndef HAVE_VIRSTORAGEVOLGETPATH
2798 /* Symbol virStorageVolGetPath not found at compile time. */
2799 not_supported ("virStorageVolGetPath");
2802 /* Check that the symbol virStorageVolGetPath
2803 * is in runtime version of libvirt.
2805 WEAK_SYMBOL_CHECK (virStorageVolGetPath);
2808 virStorageVolPtr vol = Volume_val (volv);
2809 virConnectPtr conn = Connect_volv (volv);
2812 NONBLOCKING (r = virStorageVolGetPath (vol));
2813 CHECK_ERROR (!r, conn, "virStorageVolGetPath");
2815 rv = caml_copy_string (r);
2821 /* Automatically generated binding for virStorageVolGetKey.
2822 * In generator.pl this function has signature "vol : static string".
2825 #ifdef HAVE_WEAK_SYMBOLS
2826 #ifdef HAVE_VIRSTORAGEVOLGETKEY
2827 extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak));
2832 ocaml_libvirt_storage_vol_get_key (value volv)
2835 #ifndef HAVE_VIRSTORAGEVOLGETKEY
2836 /* Symbol virStorageVolGetKey not found at compile time. */
2837 not_supported ("virStorageVolGetKey");
2840 /* Check that the symbol virStorageVolGetKey
2841 * is in runtime version of libvirt.
2843 WEAK_SYMBOL_CHECK (virStorageVolGetKey);
2846 virStorageVolPtr vol = Volume_val (volv);
2847 virConnectPtr conn = Connect_volv (volv);
2850 NONBLOCKING (r = virStorageVolGetKey (vol));
2851 CHECK_ERROR (!r, conn, "virStorageVolGetKey");
2853 rv = caml_copy_string (r);
2858 /* Automatically generated binding for virStorageVolGetName.
2859 * In generator.pl this function has signature "vol : static string".
2862 #ifdef HAVE_WEAK_SYMBOLS
2863 #ifdef HAVE_VIRSTORAGEVOLGETNAME
2864 extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak));
2869 ocaml_libvirt_storage_vol_get_name (value volv)
2872 #ifndef HAVE_VIRSTORAGEVOLGETNAME
2873 /* Symbol virStorageVolGetName not found at compile time. */
2874 not_supported ("virStorageVolGetName");
2877 /* Check that the symbol virStorageVolGetName
2878 * is in runtime version of libvirt.
2880 WEAK_SYMBOL_CHECK (virStorageVolGetName);
2883 virStorageVolPtr vol = Volume_val (volv);
2884 virConnectPtr conn = Connect_volv (volv);
2887 NONBLOCKING (r = virStorageVolGetName (vol));
2888 CHECK_ERROR (!r, conn, "virStorageVolGetName");
2890 rv = caml_copy_string (r);
2895 /* Automatically generated binding for virStoragePoolLookupByVolume.
2896 * In generator.pl this function has signature "vol : pool from vol".
2899 #ifdef HAVE_WEAK_SYMBOLS
2900 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2901 extern virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) __attribute__((weak));
2906 ocaml_libvirt_storage_pool_lookup_by_volume (value volv)
2909 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2910 /* Symbol virStoragePoolLookupByVolume not found at compile time. */
2911 not_supported ("virStoragePoolLookupByVolume");
2914 /* Check that the symbol virStoragePoolLookupByVolume
2915 * is in runtime version of libvirt.
2917 WEAK_SYMBOL_CHECK (virStoragePoolLookupByVolume);
2919 CAMLlocal2 (rv, connv);
2920 virStorageVolPtr vol = Volume_val (volv);
2921 virConnectPtr conn = Connect_volv (volv);
2922 virStoragePoolPtr r;
2924 NONBLOCKING (r = virStoragePoolLookupByVolume (vol));
2925 CHECK_ERROR (!r, conn, "virStoragePoolLookupByVolume");
2927 connv = Field (volv, 1);
2928 rv = Val_pool (r, connv);
2934 /* Automatically generated binding for virJobFree.
2935 * In generator.pl this function has signature "job : free".
2938 #ifdef HAVE_WEAK_SYMBOLS
2939 #ifdef HAVE_VIRJOBFREE
2940 extern int virJobFree (virJobPtr job) __attribute__((weak));
2945 ocaml_libvirt_job_free (value jobv)
2948 #ifndef HAVE_VIRJOBFREE
2949 /* Symbol virJobFree not found at compile time. */
2950 not_supported ("virJobFree");
2953 /* Check that the symbol virJobFree
2954 * is in runtime version of libvirt.
2956 WEAK_SYMBOL_CHECK (virJobFree);
2958 virJobPtr job = Job_val (jobv);
2959 virConnectPtr conn = Connect_jobv (jobv);
2962 NONBLOCKING (r = virJobFree (job));
2963 CHECK_ERROR (r == -1, conn, "virJobFree");
2965 /* So that we don't double-free in the finalizer: */
2966 Job_val (jobv) = NULL;
2968 CAMLreturn (Val_unit);
2972 /* Automatically generated binding for virJobCancel.
2973 * In generator.pl this function has signature "job : unit".
2976 #ifdef HAVE_WEAK_SYMBOLS
2977 #ifdef HAVE_VIRJOBCANCEL
2978 extern int virJobCancel (virJobPtr job) __attribute__((weak));
2983 ocaml_libvirt_job_cancel (value jobv)
2986 #ifndef HAVE_VIRJOBCANCEL
2987 /* Symbol virJobCancel not found at compile time. */
2988 not_supported ("virJobCancel");
2991 /* Check that the symbol virJobCancel
2992 * is in runtime version of libvirt.
2994 WEAK_SYMBOL_CHECK (virJobCancel);
2996 virJobPtr job = Job_val (jobv);
2997 virConnectPtr conn = Connect_jobv (jobv);
3000 NONBLOCKING (r = virJobCancel (job));
3001 CHECK_ERROR (r == -1, conn, "virJobCancel");
3003 CAMLreturn (Val_unit);
3007 /* Automatically generated binding for virJobGetNetwork.
3008 * In generator.pl this function has signature "job : net from job".
3011 #ifdef HAVE_WEAK_SYMBOLS
3012 #ifdef HAVE_VIRJOBGETNETWORK
3013 extern virNetworkPtr virJobGetNetwork (virJobPtr job) __attribute__((weak));
3018 ocaml_libvirt_job_get_network (value jobv)
3021 #ifndef HAVE_VIRJOBGETNETWORK
3022 /* Symbol virJobGetNetwork not found at compile time. */
3023 not_supported ("virJobGetNetwork");
3026 /* Check that the symbol virJobGetNetwork
3027 * is in runtime version of libvirt.
3029 WEAK_SYMBOL_CHECK (virJobGetNetwork);
3031 CAMLlocal2 (rv, connv);
3032 virJobPtr job = Job_val (jobv);
3033 virConnectPtr conn = Connect_jobv (jobv);
3036 NONBLOCKING (r = virJobGetNetwork (job));
3037 CHECK_ERROR (!r, conn, "virJobGetNetwork");
3039 connv = Field (jobv, 1);
3040 rv = Val_network (r, connv);
3046 /* Automatically generated binding for virJobGetDomain.
3047 * In generator.pl this function has signature "job : dom from job".
3050 #ifdef HAVE_WEAK_SYMBOLS
3051 #ifdef HAVE_VIRJOBGETDOMAIN
3052 extern virDomainPtr virJobGetDomain (virJobPtr job) __attribute__((weak));
3057 ocaml_libvirt_job_get_domain (value jobv)
3060 #ifndef HAVE_VIRJOBGETDOMAIN
3061 /* Symbol virJobGetDomain not found at compile time. */
3062 not_supported ("virJobGetDomain");
3065 /* Check that the symbol virJobGetDomain
3066 * is in runtime version of libvirt.
3068 WEAK_SYMBOL_CHECK (virJobGetDomain);
3070 CAMLlocal2 (rv, connv);
3071 virJobPtr job = Job_val (jobv);
3072 virConnectPtr conn = Connect_jobv (jobv);
3075 NONBLOCKING (r = virJobGetDomain (job));
3076 CHECK_ERROR (!r, conn, "virJobGetDomain");
3078 connv = Field (jobv, 1);
3079 rv = Val_domain (r, connv);
3085 #include "libvirt_c_epilogue.c"