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 #ifdef HAVE_WEAK_SYMBOLS
51 #ifdef HAVE_VIRCONNECTGETHOSTNAME
52 extern char *virConnectGetHostname (virConnectPtr conn) __attribute__((weak));
57 ocaml_libvirt_connect_get_hostname (value connv)
60 #ifndef HAVE_VIRCONNECTGETHOSTNAME
61 /* Symbol virConnectGetHostname not found at compile time. */
62 not_supported ("virConnectGetHostname");
63 /* Suppresses a compiler warning. */
66 /* Check that the symbol virConnectGetHostname
67 * is in runtime version of libvirt.
69 WEAK_SYMBOL_CHECK (virConnectGetHostname);
72 virConnectPtr conn = Connect_val (connv);
75 NONBLOCKING (r = virConnectGetHostname (conn));
76 CHECK_ERROR (!r, conn, "virConnectGetHostname");
78 rv = caml_copy_string (r);
84 #ifdef HAVE_WEAK_SYMBOLS
85 #ifdef HAVE_VIRCONNECTGETURI
86 extern char *virConnectGetURI (virConnectPtr conn) __attribute__((weak));
91 ocaml_libvirt_connect_get_uri (value connv)
94 #ifndef HAVE_VIRCONNECTGETURI
95 /* Symbol virConnectGetURI not found at compile time. */
96 not_supported ("virConnectGetURI");
97 /* Suppresses a compiler warning. */
100 /* Check that the symbol virConnectGetURI
101 * is in runtime version of libvirt.
103 WEAK_SYMBOL_CHECK (virConnectGetURI);
106 virConnectPtr conn = Connect_val (connv);
109 NONBLOCKING (r = virConnectGetURI (conn));
110 CHECK_ERROR (!r, conn, "virConnectGetURI");
112 rv = caml_copy_string (r);
119 ocaml_libvirt_connect_get_type (value connv)
124 virConnectPtr conn = Connect_val (connv);
127 NONBLOCKING (r = virConnectGetType (conn));
128 CHECK_ERROR (!r, conn, "virConnectGetType");
130 rv = caml_copy_string (r);
135 ocaml_libvirt_connect_num_of_domains (value connv)
139 virConnectPtr conn = Connect_val (connv);
142 NONBLOCKING (r = virConnectNumOfDomains (conn));
143 CHECK_ERROR (r == -1, conn, "virConnectNumOfDomains");
145 CAMLreturn (Val_int (r));
149 ocaml_libvirt_connect_list_domains (value connv, value iv)
151 CAMLparam2 (connv, iv);
154 virConnectPtr conn = Connect_val (connv);
155 int i = Int_val (iv);
158 NONBLOCKING (r = virConnectListDomains (conn, ids, i));
159 CHECK_ERROR (r == -1, conn, "virConnectListDomains");
161 rv = caml_alloc (r, 0);
162 for (i = 0; i < r; ++i)
163 Store_field (rv, i, Val_int (ids[i]));
169 ocaml_libvirt_connect_num_of_defined_domains (value connv)
173 virConnectPtr conn = Connect_val (connv);
176 NONBLOCKING (r = virConnectNumOfDefinedDomains (conn));
177 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedDomains");
179 CAMLreturn (Val_int (r));
183 ocaml_libvirt_connect_list_defined_domains (value connv, value iv)
185 CAMLparam2 (connv, iv);
187 CAMLlocal2 (rv, strv);
188 virConnectPtr conn = Connect_val (connv);
189 int i = Int_val (iv);
193 NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i));
194 CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
196 rv = caml_alloc (r, 0);
197 for (i = 0; i < r; ++i) {
198 strv = caml_copy_string (names[i]);
199 Store_field (rv, i, strv);
207 ocaml_libvirt_connect_num_of_networks (value connv)
211 virConnectPtr conn = Connect_val (connv);
214 NONBLOCKING (r = virConnectNumOfNetworks (conn));
215 CHECK_ERROR (r == -1, conn, "virConnectNumOfNetworks");
217 CAMLreturn (Val_int (r));
221 ocaml_libvirt_connect_list_networks (value connv, value iv)
223 CAMLparam2 (connv, iv);
225 CAMLlocal2 (rv, strv);
226 virConnectPtr conn = Connect_val (connv);
227 int i = Int_val (iv);
231 NONBLOCKING (r = virConnectListNetworks (conn, names, i));
232 CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
234 rv = caml_alloc (r, 0);
235 for (i = 0; i < r; ++i) {
236 strv = caml_copy_string (names[i]);
237 Store_field (rv, i, strv);
245 ocaml_libvirt_connect_num_of_defined_networks (value connv)
249 virConnectPtr conn = Connect_val (connv);
252 NONBLOCKING (r = virConnectNumOfDefinedNetworks (conn));
253 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedNetworks");
255 CAMLreturn (Val_int (r));
259 ocaml_libvirt_connect_list_defined_networks (value connv, value iv)
261 CAMLparam2 (connv, iv);
263 CAMLlocal2 (rv, strv);
264 virConnectPtr conn = Connect_val (connv);
265 int i = Int_val (iv);
269 NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i));
270 CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
272 rv = caml_alloc (r, 0);
273 for (i = 0; i < r; ++i) {
274 strv = caml_copy_string (names[i]);
275 Store_field (rv, i, strv);
282 #ifdef HAVE_WEAK_SYMBOLS
283 #ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
284 extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak));
289 ocaml_libvirt_connect_num_of_storage_pools (value connv)
292 #ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
293 /* Symbol virConnectNumOfStoragePools not found at compile time. */
294 not_supported ("virConnectNumOfStoragePools");
295 /* Suppresses a compiler warning. */
298 /* Check that the symbol virConnectNumOfStoragePools
299 * is in runtime version of libvirt.
301 WEAK_SYMBOL_CHECK (virConnectNumOfStoragePools);
303 virConnectPtr conn = Connect_val (connv);
306 NONBLOCKING (r = virConnectNumOfStoragePools (conn));
307 CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools");
309 CAMLreturn (Val_int (r));
313 #ifdef HAVE_WEAK_SYMBOLS
314 #ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS
315 extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
320 ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
322 CAMLparam2 (connv, iv);
323 #ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS
324 /* Symbol virConnectListStoragePools not found at compile time. */
325 not_supported ("virConnectListStoragePools");
326 /* Suppresses a compiler warning. */
329 /* Check that the symbol virConnectListStoragePools
330 * is in runtime version of libvirt.
332 WEAK_SYMBOL_CHECK (virConnectListStoragePools);
334 CAMLlocal2 (rv, strv);
335 virConnectPtr conn = Connect_val (connv);
336 int i = Int_val (iv);
340 NONBLOCKING (r = virConnectListStoragePools (conn, names, i));
341 CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
343 rv = caml_alloc (r, 0);
344 for (i = 0; i < r; ++i) {
345 strv = caml_copy_string (names[i]);
346 Store_field (rv, i, strv);
354 #ifdef HAVE_WEAK_SYMBOLS
355 #ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
356 extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak));
361 ocaml_libvirt_connect_num_of_defined_storage_pools (value connv)
364 #ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
365 /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */
366 not_supported ("virConnectNumOfDefinedStoragePools");
367 /* Suppresses a compiler warning. */
370 /* Check that the symbol virConnectNumOfDefinedStoragePools
371 * is in runtime version of libvirt.
373 WEAK_SYMBOL_CHECK (virConnectNumOfDefinedStoragePools);
375 virConnectPtr conn = Connect_val (connv);
378 NONBLOCKING (r = virConnectNumOfDefinedStoragePools (conn));
379 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools");
381 CAMLreturn (Val_int (r));
385 #ifdef HAVE_WEAK_SYMBOLS
386 #ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
387 extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
392 ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
394 CAMLparam2 (connv, iv);
395 #ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
396 /* Symbol virConnectListDefinedStoragePools not found at compile time. */
397 not_supported ("virConnectListDefinedStoragePools");
398 /* Suppresses a compiler warning. */
401 /* Check that the symbol virConnectListDefinedStoragePools
402 * is in runtime version of libvirt.
404 WEAK_SYMBOL_CHECK (virConnectListDefinedStoragePools);
406 CAMLlocal2 (rv, strv);
407 virConnectPtr conn = Connect_val (connv);
408 int i = Int_val (iv);
412 NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i));
413 CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
415 rv = caml_alloc (r, 0);
416 for (i = 0; i < r; ++i) {
417 strv = caml_copy_string (names[i]);
418 Store_field (rv, i, strv);
427 ocaml_libvirt_connect_get_capabilities (value connv)
432 virConnectPtr conn = Connect_val (connv);
435 NONBLOCKING (r = virConnectGetCapabilities (conn));
436 CHECK_ERROR (!r, conn, "virConnectGetCapabilities");
438 rv = caml_copy_string (r);
444 ocaml_libvirt_domain_lookup_by_name (value connv, value strv)
446 CAMLparam2 (connv, strv);
449 virConnectPtr conn = Connect_val (connv);
450 char *str = String_val (strv);
453 NONBLOCKING (r = virDomainLookupByName (conn, str));
454 CHECK_ERROR (!r, conn, "virDomainLookupByName");
456 rv = Val_domain (r, connv);
462 ocaml_libvirt_domain_lookup_by_uuid_string (value connv, value strv)
464 CAMLparam2 (connv, strv);
467 virConnectPtr conn = Connect_val (connv);
468 char *str = String_val (strv);
471 NONBLOCKING (r = virDomainLookupByUUIDString (conn, str));
472 CHECK_ERROR (!r, conn, "virDomainLookupByUUIDString");
474 rv = Val_domain (r, connv);
480 ocaml_libvirt_domain_get_name (value domv)
485 virDomainPtr dom = Domain_val (domv);
486 virConnectPtr conn = Connect_domv (domv);
489 NONBLOCKING (r = virDomainGetName (dom));
490 CHECK_ERROR (!r, conn, "virDomainGetName");
492 rv = caml_copy_string (r);
497 ocaml_libvirt_domain_get_os_type (value domv)
502 virDomainPtr dom = Domain_val (domv);
503 virConnectPtr conn = Connect_domv (domv);
506 NONBLOCKING (r = virDomainGetOSType (dom));
507 CHECK_ERROR (!r, conn, "virDomainGetOSType");
509 rv = caml_copy_string (r);
515 ocaml_libvirt_domain_get_xml_desc (value domv)
520 virDomainPtr dom = Domain_val (domv);
521 virConnectPtr conn = Connect_domv (domv);
524 NONBLOCKING (r = virDomainGetXMLDesc (dom, 0));
525 CHECK_ERROR (!r, conn, "virDomainGetXMLDesc");
527 rv = caml_copy_string (r);
533 ocaml_libvirt_domain_suspend (value domv)
537 virDomainPtr dom = Domain_val (domv);
538 virConnectPtr conn = Connect_domv (domv);
541 NONBLOCKING (r = virDomainSuspend (dom));
542 CHECK_ERROR (r == -1, conn, "virDomainSuspend");
544 CAMLreturn (Val_unit);
548 ocaml_libvirt_domain_resume (value domv)
552 virDomainPtr dom = Domain_val (domv);
553 virConnectPtr conn = Connect_domv (domv);
556 NONBLOCKING (r = virDomainResume (dom));
557 CHECK_ERROR (r == -1, conn, "virDomainResume");
559 CAMLreturn (Val_unit);
563 ocaml_libvirt_domain_shutdown (value domv)
567 virDomainPtr dom = Domain_val (domv);
568 virConnectPtr conn = Connect_domv (domv);
571 NONBLOCKING (r = virDomainShutdown (dom));
572 CHECK_ERROR (r == -1, conn, "virDomainShutdown");
574 CAMLreturn (Val_unit);
578 ocaml_libvirt_domain_reboot (value domv)
582 virDomainPtr dom = Domain_val (domv);
583 virConnectPtr conn = Connect_domv (domv);
586 NONBLOCKING (r = virDomainReboot (dom, 0));
587 CHECK_ERROR (r == -1, conn, "virDomainReboot");
589 CAMLreturn (Val_unit);
593 ocaml_libvirt_domain_undefine (value domv)
597 virDomainPtr dom = Domain_val (domv);
598 virConnectPtr conn = Connect_domv (domv);
601 NONBLOCKING (r = virDomainUndefine (dom));
602 CHECK_ERROR (r == -1, conn, "virDomainUndefine");
604 CAMLreturn (Val_unit);
608 ocaml_libvirt_domain_create (value domv)
612 virDomainPtr dom = Domain_val (domv);
613 virConnectPtr conn = Connect_domv (domv);
616 NONBLOCKING (r = virDomainCreate (dom));
617 CHECK_ERROR (r == -1, conn, "virDomainCreate");
619 CAMLreturn (Val_unit);
623 ocaml_libvirt_domain_get_autostart (value domv)
627 virDomainPtr dom = Domain_val (domv);
628 virConnectPtr conn = Connect_domv (domv);
631 NONBLOCKING (r = virDomainGetAutostart (dom, &b));
632 CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
634 CAMLreturn (b ? Val_true : Val_false);
638 ocaml_libvirt_domain_set_autostart (value domv, value bv)
640 CAMLparam2 (domv, bv);
642 virDomainPtr dom = Domain_val (domv);
643 virConnectPtr conn = Connect_domv (domv);
646 b = bv == Val_true ? 1 : 0;
648 NONBLOCKING (r = virDomainSetAutostart (dom, b));
649 CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
651 CAMLreturn (Val_unit);
655 ocaml_libvirt_network_lookup_by_name (value connv, value strv)
657 CAMLparam2 (connv, strv);
660 virConnectPtr conn = Connect_val (connv);
661 char *str = String_val (strv);
664 NONBLOCKING (r = virNetworkLookupByName (conn, str));
665 CHECK_ERROR (!r, conn, "virNetworkLookupByName");
667 rv = Val_network (r, connv);
673 ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv)
675 CAMLparam2 (connv, strv);
678 virConnectPtr conn = Connect_val (connv);
679 char *str = String_val (strv);
682 NONBLOCKING (r = virNetworkLookupByUUIDString (conn, str));
683 CHECK_ERROR (!r, conn, "virNetworkLookupByUUIDString");
685 rv = Val_network (r, connv);
691 ocaml_libvirt_network_get_name (value netv)
696 virNetworkPtr net = Network_val (netv);
697 virConnectPtr conn = Connect_netv (netv);
700 NONBLOCKING (r = virNetworkGetName (net));
701 CHECK_ERROR (!r, conn, "virNetworkGetName");
703 rv = caml_copy_string (r);
708 ocaml_libvirt_network_get_xml_desc (value netv)
713 virNetworkPtr net = Network_val (netv);
714 virConnectPtr conn = Connect_netv (netv);
717 NONBLOCKING (r = virNetworkGetXMLDesc (net, 0));
718 CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc");
720 rv = caml_copy_string (r);
726 ocaml_libvirt_network_get_bridge_name (value netv)
731 virNetworkPtr net = Network_val (netv);
732 virConnectPtr conn = Connect_netv (netv);
735 NONBLOCKING (r = virNetworkGetBridgeName (net));
736 CHECK_ERROR (!r, conn, "virNetworkGetBridgeName");
738 rv = caml_copy_string (r);
744 ocaml_libvirt_network_undefine (value netv)
748 virNetworkPtr net = Network_val (netv);
749 virConnectPtr conn = Connect_netv (netv);
752 NONBLOCKING (r = virNetworkUndefine (net));
753 CHECK_ERROR (r == -1, conn, "virNetworkUndefine");
755 CAMLreturn (Val_unit);
759 ocaml_libvirt_network_create (value netv)
763 virNetworkPtr net = Network_val (netv);
764 virConnectPtr conn = Connect_netv (netv);
767 NONBLOCKING (r = virNetworkCreate (net));
768 CHECK_ERROR (r == -1, conn, "virNetworkCreate");
770 CAMLreturn (Val_unit);
774 ocaml_libvirt_network_get_autostart (value netv)
778 virNetworkPtr net = Network_val (netv);
779 virConnectPtr conn = Connect_netv (netv);
782 NONBLOCKING (r = virNetworkGetAutostart (net, &b));
783 CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
785 CAMLreturn (b ? Val_true : Val_false);
789 ocaml_libvirt_network_set_autostart (value netv, value bv)
791 CAMLparam2 (netv, bv);
793 virNetworkPtr net = Network_val (netv);
794 virConnectPtr conn = Connect_netv (netv);
797 b = bv == Val_true ? 1 : 0;
799 NONBLOCKING (r = virNetworkSetAutostart (net, b));
800 CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
802 CAMLreturn (Val_unit);
805 #ifdef HAVE_WEAK_SYMBOLS
806 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
807 extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak));
812 ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
814 CAMLparam2 (connv, strv);
815 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
816 /* Symbol virStoragePoolLookupByName not found at compile time. */
817 not_supported ("virStoragePoolLookupByName");
818 /* Suppresses a compiler warning. */
821 /* Check that the symbol virStoragePoolLookupByName
822 * is in runtime version of libvirt.
824 WEAK_SYMBOL_CHECK (virStoragePoolLookupByName);
827 virConnectPtr conn = Connect_val (connv);
828 char *str = String_val (strv);
831 NONBLOCKING (r = virStoragePoolLookupByName (conn, str));
832 CHECK_ERROR (!r, conn, "virStoragePoolLookupByName");
834 rv = Val_pool (r, connv);
840 #ifdef HAVE_WEAK_SYMBOLS
841 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
842 extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak));
847 ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv)
849 CAMLparam2 (connv, strv);
850 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
851 /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */
852 not_supported ("virStoragePoolLookupByUUIDString");
853 /* Suppresses a compiler warning. */
856 /* Check that the symbol virStoragePoolLookupByUUIDString
857 * is in runtime version of libvirt.
859 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUIDString);
862 virConnectPtr conn = Connect_val (connv);
863 char *str = String_val (strv);
866 NONBLOCKING (r = virStoragePoolLookupByUUIDString (conn, str));
867 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUIDString");
869 rv = Val_pool (r, connv);
875 #ifdef HAVE_WEAK_SYMBOLS
876 #ifdef HAVE_VIRSTORAGEPOOLGETNAME
877 extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak));
882 ocaml_libvirt_storage_pool_get_name (value poolv)
885 #ifndef HAVE_VIRSTORAGEPOOLGETNAME
886 /* Symbol virStoragePoolGetName not found at compile time. */
887 not_supported ("virStoragePoolGetName");
888 /* Suppresses a compiler warning. */
891 /* Check that the symbol virStoragePoolGetName
892 * is in runtime version of libvirt.
894 WEAK_SYMBOL_CHECK (virStoragePoolGetName);
897 virStoragePoolPtr pool = Pool_val (poolv);
898 virConnectPtr conn = Connect_polv (poolv);
901 NONBLOCKING (r = virStoragePoolGetName (pool));
902 CHECK_ERROR (!r, conn, "virStoragePoolGetName");
904 rv = caml_copy_string (r);
909 #ifdef HAVE_WEAK_SYMBOLS
910 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
911 extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, int flags) __attribute__((weak));
916 ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
919 #ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC
920 /* Symbol virStoragePoolGetXMLDesc not found at compile time. */
921 not_supported ("virStoragePoolGetXMLDesc");
922 /* Suppresses a compiler warning. */
925 /* Check that the symbol virStoragePoolGetXMLDesc
926 * is in runtime version of libvirt.
928 WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc);
931 virStoragePoolPtr pool = Pool_val (poolv);
932 virConnectPtr conn = Connect_polv (poolv);
935 NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0));
936 CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc");
938 rv = caml_copy_string (r);
944 #ifdef HAVE_WEAK_SYMBOLS
945 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
946 extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
951 ocaml_libvirt_storage_pool_undefine (value poolv)
954 #ifndef HAVE_VIRSTORAGEPOOLUNDEFINE
955 /* Symbol virStoragePoolUndefine not found at compile time. */
956 not_supported ("virStoragePoolUndefine");
957 /* Suppresses a compiler warning. */
960 /* Check that the symbol virStoragePoolUndefine
961 * is in runtime version of libvirt.
963 WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
965 virStoragePoolPtr pool = Pool_val (poolv);
966 virConnectPtr conn = Connect_polv (poolv);
969 NONBLOCKING (r = virStoragePoolUndefine (pool));
970 CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
972 CAMLreturn (Val_unit);
976 #ifdef HAVE_WEAK_SYMBOLS
977 #ifdef HAVE_VIRSTORAGEPOOLCREATE
978 extern int virStoragePoolCreate (virStoragePoolPtr pool) __attribute__((weak));
983 ocaml_libvirt_storage_pool_create (value poolv)
986 #ifndef HAVE_VIRSTORAGEPOOLCREATE
987 /* Symbol virStoragePoolCreate not found at compile time. */
988 not_supported ("virStoragePoolCreate");
989 /* Suppresses a compiler warning. */
992 /* Check that the symbol virStoragePoolCreate
993 * is in runtime version of libvirt.
995 WEAK_SYMBOL_CHECK (virStoragePoolCreate);
997 virStoragePoolPtr pool = Pool_val (poolv);
998 virConnectPtr conn = Connect_polv (poolv);
1001 NONBLOCKING (r = virStoragePoolCreate (pool));
1002 CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
1004 CAMLreturn (Val_unit);
1008 #ifdef HAVE_WEAK_SYMBOLS
1009 #ifdef HAVE_VIRSTORAGEPOOLSHUTDOWN
1010 extern int virStoragePoolShutdown (virStoragePoolPtr pool) __attribute__((weak));
1015 ocaml_libvirt_storage_pool_shutdown (value poolv)
1018 #ifndef HAVE_VIRSTORAGEPOOLSHUTDOWN
1019 /* Symbol virStoragePoolShutdown not found at compile time. */
1020 not_supported ("virStoragePoolShutdown");
1021 /* Suppresses a compiler warning. */
1024 /* Check that the symbol virStoragePoolShutdown
1025 * is in runtime version of libvirt.
1027 WEAK_SYMBOL_CHECK (virStoragePoolShutdown);
1029 virStoragePoolPtr pool = Pool_val (poolv);
1030 virConnectPtr conn = Connect_polv (poolv);
1033 NONBLOCKING (r = virStoragePoolShutdown (pool));
1034 CHECK_ERROR (r == -1, conn, "virStoragePoolShutdown");
1036 CAMLreturn (Val_unit);
1040 #ifdef HAVE_WEAK_SYMBOLS
1041 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
1042 extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
1047 ocaml_libvirt_storage_pool_refresh (value poolv)
1050 #ifndef HAVE_VIRSTORAGEPOOLREFRESH
1051 /* Symbol virStoragePoolRefresh not found at compile time. */
1052 not_supported ("virStoragePoolRefresh");
1053 /* Suppresses a compiler warning. */
1056 /* Check that the symbol virStoragePoolRefresh
1057 * is in runtime version of libvirt.
1059 WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
1061 virStoragePoolPtr pool = Pool_val (poolv);
1062 virConnectPtr conn = Connect_polv (poolv);
1065 NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
1066 CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
1068 CAMLreturn (Val_unit);
1072 #ifdef HAVE_WEAK_SYMBOLS
1073 #ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART
1074 extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak));
1079 ocaml_libvirt_storage_pool_get_autostart (value poolv)
1082 #ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
1083 /* Symbol virStoragePoolGetAutostart not found at compile time. */
1084 not_supported ("virStoragePoolGetAutostart");
1085 /* Suppresses a compiler warning. */
1088 /* Check that the symbol virStoragePoolGetAutostart
1089 * is in runtime version of libvirt.
1091 WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
1093 virStoragePoolPtr pool = Pool_val (poolv);
1094 virConnectPtr conn = Connect_polv (poolv);
1097 NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
1098 CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
1100 CAMLreturn (b ? Val_true : Val_false);
1104 #ifdef HAVE_WEAK_SYMBOLS
1105 #ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART
1106 extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak));
1111 ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
1113 CAMLparam2 (poolv, bv);
1114 #ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
1115 /* Symbol virStoragePoolSetAutostart not found at compile time. */
1116 not_supported ("virStoragePoolSetAutostart");
1117 /* Suppresses a compiler warning. */
1120 /* Check that the symbol virStoragePoolSetAutostart
1121 * is in runtime version of libvirt.
1123 WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
1125 virStoragePoolPtr pool = Pool_val (poolv);
1126 virConnectPtr conn = Connect_polv (poolv);
1129 b = bv == Val_true ? 1 : 0;
1131 NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
1132 CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
1134 CAMLreturn (Val_unit);
1138 #ifdef HAVE_WEAK_SYMBOLS
1139 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
1140 extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak));
1145 ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
1147 CAMLparam2 (connv, strv);
1148 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
1149 /* Symbol virStorageVolLookupByKey not found at compile time. */
1150 not_supported ("virStorageVolLookupByKey");
1151 /* Suppresses a compiler warning. */
1154 /* Check that the symbol virStorageVolLookupByKey
1155 * is in runtime version of libvirt.
1157 WEAK_SYMBOL_CHECK (virStorageVolLookupByKey);
1160 virConnectPtr conn = Connect_val (connv);
1161 char *str = String_val (strv);
1164 NONBLOCKING (r = virStorageVolLookupByKey (conn, str));
1165 CHECK_ERROR (!r, conn, "virStorageVolLookupByKey");
1167 rv = Val_volume (r, connv);
1173 #ifdef HAVE_WEAK_SYMBOLS
1174 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
1175 extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak));
1180 ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
1182 CAMLparam2 (connv, strv);
1183 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
1184 /* Symbol virStorageVolLookupByPath not found at compile time. */
1185 not_supported ("virStorageVolLookupByPath");
1186 /* Suppresses a compiler warning. */
1189 /* Check that the symbol virStorageVolLookupByPath
1190 * is in runtime version of libvirt.
1192 WEAK_SYMBOL_CHECK (virStorageVolLookupByPath);
1195 virConnectPtr conn = Connect_val (connv);
1196 char *str = String_val (strv);
1199 NONBLOCKING (r = virStorageVolLookupByPath (conn, str));
1200 CHECK_ERROR (!r, conn, "virStorageVolLookupByPath");
1202 rv = Val_volume (r, connv);
1208 #ifdef HAVE_WEAK_SYMBOLS
1209 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
1210 extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, int flags) __attribute__((weak));
1215 ocaml_libvirt_storage_vol_get_xml_desc (value volv)
1218 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
1219 /* Symbol virStorageVolGetXMLDesc not found at compile time. */
1220 not_supported ("virStorageVolGetXMLDesc");
1221 /* Suppresses a compiler warning. */
1224 /* Check that the symbol virStorageVolGetXMLDesc
1225 * is in runtime version of libvirt.
1227 WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
1230 virStorageVolPtr vol = Volume_val (volv);
1231 virConnectPtr conn = Connect_volv (volv);
1234 NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0));
1235 CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
1237 rv = caml_copy_string (r);
1243 #ifdef HAVE_WEAK_SYMBOLS
1244 #ifdef HAVE_VIRSTORAGEVOLGETPATH
1245 extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak));
1250 ocaml_libvirt_storage_vol_get_path (value volv)
1253 #ifndef HAVE_VIRSTORAGEVOLGETPATH
1254 /* Symbol virStorageVolGetPath not found at compile time. */
1255 not_supported ("virStorageVolGetPath");
1256 /* Suppresses a compiler warning. */
1259 /* Check that the symbol virStorageVolGetPath
1260 * is in runtime version of libvirt.
1262 WEAK_SYMBOL_CHECK (virStorageVolGetPath);
1265 virStorageVolPtr vol = Volume_val (volv);
1266 virConnectPtr conn = Connect_volv (volv);
1269 NONBLOCKING (r = virStorageVolGetPath (vol));
1270 CHECK_ERROR (!r, conn, "virStorageVolGetPath");
1272 rv = caml_copy_string (r);
1278 #ifdef HAVE_WEAK_SYMBOLS
1279 #ifdef HAVE_VIRSTORAGEVOLGETKEY
1280 extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak));
1285 ocaml_libvirt_storage_vol_get_key (value volv)
1288 #ifndef HAVE_VIRSTORAGEVOLGETKEY
1289 /* Symbol virStorageVolGetKey not found at compile time. */
1290 not_supported ("virStorageVolGetKey");
1291 /* Suppresses a compiler warning. */
1294 /* Check that the symbol virStorageVolGetKey
1295 * is in runtime version of libvirt.
1297 WEAK_SYMBOL_CHECK (virStorageVolGetKey);
1300 virStorageVolPtr vol = Volume_val (volv);
1301 virConnectPtr conn = Connect_volv (volv);
1304 NONBLOCKING (r = virStorageVolGetKey (vol));
1305 CHECK_ERROR (!r, conn, "virStorageVolGetKey");
1307 rv = caml_copy_string (r);
1312 #ifdef HAVE_WEAK_SYMBOLS
1313 #ifdef HAVE_VIRSTORAGEVOLGETNAME
1314 extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak));
1319 ocaml_libvirt_storage_vol_get_name (value volv)
1322 #ifndef HAVE_VIRSTORAGEVOLGETNAME
1323 /* Symbol virStorageVolGetName not found at compile time. */
1324 not_supported ("virStorageVolGetName");
1325 /* Suppresses a compiler warning. */
1328 /* Check that the symbol virStorageVolGetName
1329 * is in runtime version of libvirt.
1331 WEAK_SYMBOL_CHECK (virStorageVolGetName);
1334 virStorageVolPtr vol = Volume_val (volv);
1335 virConnectPtr conn = Connect_volv (volv);
1338 NONBLOCKING (r = virStorageVolGetName (vol));
1339 CHECK_ERROR (!r, conn, "virStorageVolGetName");
1341 rv = caml_copy_string (r);
1347 ocaml_libvirt_domain_create_job ()
1349 failwith ("ocaml_libvirt_domain_create_job is unimplemented");
1353 ocaml_libvirt_domain_core_dump_job ()
1355 failwith ("ocaml_libvirt_domain_core_dump_job is unimplemented");
1359 ocaml_libvirt_domain_restore_job ()
1361 failwith ("ocaml_libvirt_domain_restore_job is unimplemented");
1365 ocaml_libvirt_domain_save_job ()
1367 failwith ("ocaml_libvirt_domain_save_job is unimplemented");
1371 ocaml_libvirt_connect_create_linux_job ()
1373 failwith ("ocaml_libvirt_connect_create_linux_job is unimplemented");
1377 ocaml_libvirt_network_create_job ()
1379 failwith ("ocaml_libvirt_network_create_job is unimplemented");
1383 ocaml_libvirt_network_create_xml_job ()
1385 failwith ("ocaml_libvirt_network_create_xml_job is unimplemented");
1389 ocaml_libvirt_storage_pool_get_info ()
1391 failwith ("ocaml_libvirt_storage_pool_get_info is unimplemented");
1395 ocaml_libvirt_storage_pool_get_uuid_string ()
1397 failwith ("ocaml_libvirt_storage_pool_get_uuid_string is unimplemented");
1401 ocaml_libvirt_storage_pool_get_uuid ()
1403 failwith ("ocaml_libvirt_storage_pool_get_uuid is unimplemented");
1407 ocaml_libvirt_storage_pool_free ()
1409 failwith ("ocaml_libvirt_storage_pool_free is unimplemented");
1413 ocaml_libvirt_storage_pool_destroy ()
1415 failwith ("ocaml_libvirt_storage_pool_destroy is unimplemented");
1419 ocaml_libvirt_storage_pool_define_xml ()
1421 failwith ("ocaml_libvirt_storage_pool_define_xml is unimplemented");
1425 ocaml_libvirt_storage_pool_create_xml ()
1427 failwith ("ocaml_libvirt_storage_pool_create_xml is unimplemented");
1431 ocaml_libvirt_storage_pool_lookup_by_uuid ()
1433 failwith ("ocaml_libvirt_storage_pool_lookup_by_uuid is unimplemented");
1437 ocaml_libvirt_storage_vol_lookup_by_name ()
1439 failwith ("ocaml_libvirt_storage_vol_lookup_by_name is unimplemented");
1443 ocaml_libvirt_storage_vol_free ()
1445 failwith ("ocaml_libvirt_storage_vol_free is unimplemented");
1449 ocaml_libvirt_storage_vol_destroy ()
1451 failwith ("ocaml_libvirt_storage_vol_destroy is unimplemented");
1455 ocaml_libvirt_storage_vol_create_xml ()
1457 failwith ("ocaml_libvirt_storage_vol_create_xml is unimplemented");
1461 ocaml_libvirt_storage_vol_get_info ()
1463 failwith ("ocaml_libvirt_storage_vol_get_info is unimplemented");
1467 ocaml_libvirt_pool_of_volume ()
1469 failwith ("ocaml_libvirt_pool_of_volume is unimplemented");
1473 ocaml_libvirt_job_cancel ()
1475 failwith ("ocaml_libvirt_job_cancel is unimplemented");
1479 ocaml_libvirt_job_get_network ()
1481 failwith ("ocaml_libvirt_job_get_network is unimplemented");
1485 ocaml_libvirt_job_get_domain ()
1487 failwith ("ocaml_libvirt_job_get_domain is unimplemented");
1491 ocaml_libvirt_job_get_info ()
1493 failwith ("ocaml_libvirt_job_get_info is unimplemented");
1496 #include "libvirt_c_epilogue.c"