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_get_uuid (value domv)
538 virDomainPtr dom = Domain_val (domv);
539 virConnectPtr conn = Connect_domv (domv);
540 unsigned char uuid[VIR_UUID_BUFLEN];
543 NONBLOCKING (r = virDomainGetUUID (dom, uuid));
544 CHECK_ERROR (r == -1, conn, "virDomainGetUUID");
546 rv = caml_copy_string ((char *) uuid);
551 ocaml_libvirt_domain_get_uuid_string (value domv)
556 virDomainPtr dom = Domain_val (domv);
557 virConnectPtr conn = Connect_domv (domv);
558 char uuid[VIR_UUID_STRING_BUFLEN];
561 NONBLOCKING (r = virDomainGetUUIDString (dom, uuid));
562 CHECK_ERROR (r == -1, conn, "virDomainGetUUIDString");
564 rv = caml_copy_string (uuid);
569 ocaml_libvirt_domain_suspend (value domv)
573 virDomainPtr dom = Domain_val (domv);
574 virConnectPtr conn = Connect_domv (domv);
577 NONBLOCKING (r = virDomainSuspend (dom));
578 CHECK_ERROR (r == -1, conn, "virDomainSuspend");
580 CAMLreturn (Val_unit);
584 ocaml_libvirt_domain_resume (value domv)
588 virDomainPtr dom = Domain_val (domv);
589 virConnectPtr conn = Connect_domv (domv);
592 NONBLOCKING (r = virDomainResume (dom));
593 CHECK_ERROR (r == -1, conn, "virDomainResume");
595 CAMLreturn (Val_unit);
599 ocaml_libvirt_domain_shutdown (value domv)
603 virDomainPtr dom = Domain_val (domv);
604 virConnectPtr conn = Connect_domv (domv);
607 NONBLOCKING (r = virDomainShutdown (dom));
608 CHECK_ERROR (r == -1, conn, "virDomainShutdown");
610 CAMLreturn (Val_unit);
614 ocaml_libvirt_domain_reboot (value domv)
618 virDomainPtr dom = Domain_val (domv);
619 virConnectPtr conn = Connect_domv (domv);
622 NONBLOCKING (r = virDomainReboot (dom, 0));
623 CHECK_ERROR (r == -1, conn, "virDomainReboot");
625 CAMLreturn (Val_unit);
629 ocaml_libvirt_domain_undefine (value domv)
633 virDomainPtr dom = Domain_val (domv);
634 virConnectPtr conn = Connect_domv (domv);
637 NONBLOCKING (r = virDomainUndefine (dom));
638 CHECK_ERROR (r == -1, conn, "virDomainUndefine");
640 CAMLreturn (Val_unit);
644 ocaml_libvirt_domain_create (value domv)
648 virDomainPtr dom = Domain_val (domv);
649 virConnectPtr conn = Connect_domv (domv);
652 NONBLOCKING (r = virDomainCreate (dom));
653 CHECK_ERROR (r == -1, conn, "virDomainCreate");
655 CAMLreturn (Val_unit);
659 ocaml_libvirt_domain_get_autostart (value domv)
663 virDomainPtr dom = Domain_val (domv);
664 virConnectPtr conn = Connect_domv (domv);
667 NONBLOCKING (r = virDomainGetAutostart (dom, &b));
668 CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
670 CAMLreturn (b ? Val_true : Val_false);
674 ocaml_libvirt_domain_set_autostart (value domv, value bv)
676 CAMLparam2 (domv, bv);
678 virDomainPtr dom = Domain_val (domv);
679 virConnectPtr conn = Connect_domv (domv);
682 b = bv == Val_true ? 1 : 0;
684 NONBLOCKING (r = virDomainSetAutostart (dom, b));
685 CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
687 CAMLreturn (Val_unit);
691 ocaml_libvirt_network_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 = virNetworkLookupByName (conn, str));
701 CHECK_ERROR (!r, conn, "virNetworkLookupByName");
703 rv = Val_network (r, connv);
709 ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv)
711 CAMLparam2 (connv, strv);
714 virConnectPtr conn = Connect_val (connv);
715 char *str = String_val (strv);
718 NONBLOCKING (r = virNetworkLookupByUUIDString (conn, str));
719 CHECK_ERROR (!r, conn, "virNetworkLookupByUUIDString");
721 rv = Val_network (r, connv);
727 ocaml_libvirt_network_get_name (value netv)
732 virNetworkPtr net = Network_val (netv);
733 virConnectPtr conn = Connect_netv (netv);
736 NONBLOCKING (r = virNetworkGetName (net));
737 CHECK_ERROR (!r, conn, "virNetworkGetName");
739 rv = caml_copy_string (r);
744 ocaml_libvirt_network_get_xml_desc (value netv)
749 virNetworkPtr net = Network_val (netv);
750 virConnectPtr conn = Connect_netv (netv);
753 NONBLOCKING (r = virNetworkGetXMLDesc (net, 0));
754 CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc");
756 rv = caml_copy_string (r);
762 ocaml_libvirt_network_get_bridge_name (value netv)
767 virNetworkPtr net = Network_val (netv);
768 virConnectPtr conn = Connect_netv (netv);
771 NONBLOCKING (r = virNetworkGetBridgeName (net));
772 CHECK_ERROR (!r, conn, "virNetworkGetBridgeName");
774 rv = caml_copy_string (r);
780 ocaml_libvirt_network_get_uuid (value netv)
785 virNetworkPtr net = Network_val (netv);
786 virConnectPtr conn = Connect_netv (netv);
787 unsigned char uuid[VIR_UUID_BUFLEN];
790 NONBLOCKING (r = virNetworkGetUUID (net, uuid));
791 CHECK_ERROR (r == -1, conn, "virNetworkGetUUID");
793 rv = caml_copy_string ((char *) uuid);
798 ocaml_libvirt_network_get_uuid_string (value netv)
803 virNetworkPtr net = Network_val (netv);
804 virConnectPtr conn = Connect_netv (netv);
805 char uuid[VIR_UUID_STRING_BUFLEN];
808 NONBLOCKING (r = virNetworkGetUUIDString (net, uuid));
809 CHECK_ERROR (r == -1, conn, "virNetworkGetUUIDString");
811 rv = caml_copy_string (uuid);
816 ocaml_libvirt_network_undefine (value netv)
820 virNetworkPtr net = Network_val (netv);
821 virConnectPtr conn = Connect_netv (netv);
824 NONBLOCKING (r = virNetworkUndefine (net));
825 CHECK_ERROR (r == -1, conn, "virNetworkUndefine");
827 CAMLreturn (Val_unit);
831 ocaml_libvirt_network_create (value netv)
835 virNetworkPtr net = Network_val (netv);
836 virConnectPtr conn = Connect_netv (netv);
839 NONBLOCKING (r = virNetworkCreate (net));
840 CHECK_ERROR (r == -1, conn, "virNetworkCreate");
842 CAMLreturn (Val_unit);
846 ocaml_libvirt_network_get_autostart (value netv)
850 virNetworkPtr net = Network_val (netv);
851 virConnectPtr conn = Connect_netv (netv);
854 NONBLOCKING (r = virNetworkGetAutostart (net, &b));
855 CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
857 CAMLreturn (b ? Val_true : Val_false);
861 ocaml_libvirt_network_set_autostart (value netv, value bv)
863 CAMLparam2 (netv, bv);
865 virNetworkPtr net = Network_val (netv);
866 virConnectPtr conn = Connect_netv (netv);
869 b = bv == Val_true ? 1 : 0;
871 NONBLOCKING (r = virNetworkSetAutostart (net, b));
872 CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
874 CAMLreturn (Val_unit);
877 #ifdef HAVE_WEAK_SYMBOLS
878 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
879 extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak));
884 ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
886 CAMLparam2 (connv, strv);
887 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
888 /* Symbol virStoragePoolLookupByName not found at compile time. */
889 not_supported ("virStoragePoolLookupByName");
890 /* Suppresses a compiler warning. */
893 /* Check that the symbol virStoragePoolLookupByName
894 * is in runtime version of libvirt.
896 WEAK_SYMBOL_CHECK (virStoragePoolLookupByName);
899 virConnectPtr conn = Connect_val (connv);
900 char *str = String_val (strv);
903 NONBLOCKING (r = virStoragePoolLookupByName (conn, str));
904 CHECK_ERROR (!r, conn, "virStoragePoolLookupByName");
906 rv = Val_pool (r, connv);
912 #ifdef HAVE_WEAK_SYMBOLS
913 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
914 extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak));
919 ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv)
921 CAMLparam2 (connv, strv);
922 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
923 /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */
924 not_supported ("virStoragePoolLookupByUUIDString");
925 /* Suppresses a compiler warning. */
928 /* Check that the symbol virStoragePoolLookupByUUIDString
929 * is in runtime version of libvirt.
931 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUIDString);
934 virConnectPtr conn = Connect_val (connv);
935 char *str = String_val (strv);
938 NONBLOCKING (r = virStoragePoolLookupByUUIDString (conn, str));
939 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUIDString");
941 rv = Val_pool (r, connv);
947 #ifdef HAVE_WEAK_SYMBOLS
948 #ifdef HAVE_VIRSTORAGEPOOLGETNAME
949 extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak));
954 ocaml_libvirt_storage_pool_get_name (value poolv)
957 #ifndef HAVE_VIRSTORAGEPOOLGETNAME
958 /* Symbol virStoragePoolGetName not found at compile time. */
959 not_supported ("virStoragePoolGetName");
960 /* Suppresses a compiler warning. */
963 /* Check that the symbol virStoragePoolGetName
964 * is in runtime version of libvirt.
966 WEAK_SYMBOL_CHECK (virStoragePoolGetName);
969 virStoragePoolPtr pool = Pool_val (poolv);
970 virConnectPtr conn = Connect_polv (poolv);
973 NONBLOCKING (r = virStoragePoolGetName (pool));
974 CHECK_ERROR (!r, conn, "virStoragePoolGetName");
976 rv = caml_copy_string (r);
981 #ifdef HAVE_WEAK_SYMBOLS
982 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
983 extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, int flags) __attribute__((weak));
988 ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
991 #ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC
992 /* Symbol virStoragePoolGetXMLDesc not found at compile time. */
993 not_supported ("virStoragePoolGetXMLDesc");
994 /* Suppresses a compiler warning. */
997 /* Check that the symbol virStoragePoolGetXMLDesc
998 * is in runtime version of libvirt.
1000 WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc);
1003 virStoragePoolPtr pool = Pool_val (poolv);
1004 virConnectPtr conn = Connect_polv (poolv);
1007 NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0));
1008 CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc");
1010 rv = caml_copy_string (r);
1016 #ifdef HAVE_WEAK_SYMBOLS
1017 #ifdef HAVE_VIRSTORAGEPOOLGETUUID
1018 extern int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char *) __attribute__((weak));
1023 ocaml_libvirt_storage_pool_get_uuid (value poolv)
1026 #ifndef HAVE_VIRSTORAGEPOOLGETUUID
1027 /* Symbol virStoragePoolGetUUID not found at compile time. */
1028 not_supported ("virStoragePoolGetUUID");
1029 /* Suppresses a compiler warning. */
1032 /* Check that the symbol virStoragePoolGetUUID
1033 * is in runtime version of libvirt.
1035 WEAK_SYMBOL_CHECK (virStoragePoolGetUUID);
1038 virStoragePoolPtr pool = Pool_val (poolv);
1039 virConnectPtr conn = Connect_polv (poolv);
1040 unsigned char uuid[VIR_UUID_BUFLEN];
1043 NONBLOCKING (r = virStoragePoolGetUUID (pool, uuid));
1044 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUID");
1046 rv = caml_copy_string ((char *) uuid);
1051 #ifdef HAVE_WEAK_SYMBOLS
1052 #ifdef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
1053 extern int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char *) __attribute__((weak));
1058 ocaml_libvirt_storage_pool_get_uuid_string (value poolv)
1061 #ifndef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
1062 /* Symbol virStoragePoolGetUUIDString not found at compile time. */
1063 not_supported ("virStoragePoolGetUUIDString");
1064 /* Suppresses a compiler warning. */
1067 /* Check that the symbol virStoragePoolGetUUIDString
1068 * is in runtime version of libvirt.
1070 WEAK_SYMBOL_CHECK (virStoragePoolGetUUIDString);
1073 virStoragePoolPtr pool = Pool_val (poolv);
1074 virConnectPtr conn = Connect_polv (poolv);
1075 char uuid[VIR_UUID_STRING_BUFLEN];
1078 NONBLOCKING (r = virStoragePoolGetUUIDString (pool, uuid));
1079 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUIDString");
1081 rv = caml_copy_string (uuid);
1086 #ifdef HAVE_WEAK_SYMBOLS
1087 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
1088 extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
1093 ocaml_libvirt_storage_pool_undefine (value poolv)
1096 #ifndef HAVE_VIRSTORAGEPOOLUNDEFINE
1097 /* Symbol virStoragePoolUndefine not found at compile time. */
1098 not_supported ("virStoragePoolUndefine");
1099 /* Suppresses a compiler warning. */
1102 /* Check that the symbol virStoragePoolUndefine
1103 * is in runtime version of libvirt.
1105 WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
1107 virStoragePoolPtr pool = Pool_val (poolv);
1108 virConnectPtr conn = Connect_polv (poolv);
1111 NONBLOCKING (r = virStoragePoolUndefine (pool));
1112 CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
1114 CAMLreturn (Val_unit);
1118 #ifdef HAVE_WEAK_SYMBOLS
1119 #ifdef HAVE_VIRSTORAGEPOOLCREATE
1120 extern int virStoragePoolCreate (virStoragePoolPtr pool) __attribute__((weak));
1125 ocaml_libvirt_storage_pool_create (value poolv)
1128 #ifndef HAVE_VIRSTORAGEPOOLCREATE
1129 /* Symbol virStoragePoolCreate not found at compile time. */
1130 not_supported ("virStoragePoolCreate");
1131 /* Suppresses a compiler warning. */
1134 /* Check that the symbol virStoragePoolCreate
1135 * is in runtime version of libvirt.
1137 WEAK_SYMBOL_CHECK (virStoragePoolCreate);
1139 virStoragePoolPtr pool = Pool_val (poolv);
1140 virConnectPtr conn = Connect_polv (poolv);
1143 NONBLOCKING (r = virStoragePoolCreate (pool));
1144 CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
1146 CAMLreturn (Val_unit);
1150 #ifdef HAVE_WEAK_SYMBOLS
1151 #ifdef HAVE_VIRSTORAGEPOOLSHUTDOWN
1152 extern int virStoragePoolShutdown (virStoragePoolPtr pool) __attribute__((weak));
1157 ocaml_libvirt_storage_pool_shutdown (value poolv)
1160 #ifndef HAVE_VIRSTORAGEPOOLSHUTDOWN
1161 /* Symbol virStoragePoolShutdown not found at compile time. */
1162 not_supported ("virStoragePoolShutdown");
1163 /* Suppresses a compiler warning. */
1166 /* Check that the symbol virStoragePoolShutdown
1167 * is in runtime version of libvirt.
1169 WEAK_SYMBOL_CHECK (virStoragePoolShutdown);
1171 virStoragePoolPtr pool = Pool_val (poolv);
1172 virConnectPtr conn = Connect_polv (poolv);
1175 NONBLOCKING (r = virStoragePoolShutdown (pool));
1176 CHECK_ERROR (r == -1, conn, "virStoragePoolShutdown");
1178 CAMLreturn (Val_unit);
1182 #ifdef HAVE_WEAK_SYMBOLS
1183 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
1184 extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
1189 ocaml_libvirt_storage_pool_refresh (value poolv)
1192 #ifndef HAVE_VIRSTORAGEPOOLREFRESH
1193 /* Symbol virStoragePoolRefresh not found at compile time. */
1194 not_supported ("virStoragePoolRefresh");
1195 /* Suppresses a compiler warning. */
1198 /* Check that the symbol virStoragePoolRefresh
1199 * is in runtime version of libvirt.
1201 WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
1203 virStoragePoolPtr pool = Pool_val (poolv);
1204 virConnectPtr conn = Connect_polv (poolv);
1207 NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
1208 CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
1210 CAMLreturn (Val_unit);
1214 #ifdef HAVE_WEAK_SYMBOLS
1215 #ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART
1216 extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak));
1221 ocaml_libvirt_storage_pool_get_autostart (value poolv)
1224 #ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
1225 /* Symbol virStoragePoolGetAutostart not found at compile time. */
1226 not_supported ("virStoragePoolGetAutostart");
1227 /* Suppresses a compiler warning. */
1230 /* Check that the symbol virStoragePoolGetAutostart
1231 * is in runtime version of libvirt.
1233 WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
1235 virStoragePoolPtr pool = Pool_val (poolv);
1236 virConnectPtr conn = Connect_polv (poolv);
1239 NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
1240 CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
1242 CAMLreturn (b ? Val_true : Val_false);
1246 #ifdef HAVE_WEAK_SYMBOLS
1247 #ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART
1248 extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak));
1253 ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
1255 CAMLparam2 (poolv, bv);
1256 #ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
1257 /* Symbol virStoragePoolSetAutostart not found at compile time. */
1258 not_supported ("virStoragePoolSetAutostart");
1259 /* Suppresses a compiler warning. */
1262 /* Check that the symbol virStoragePoolSetAutostart
1263 * is in runtime version of libvirt.
1265 WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
1267 virStoragePoolPtr pool = Pool_val (poolv);
1268 virConnectPtr conn = Connect_polv (poolv);
1271 b = bv == Val_true ? 1 : 0;
1273 NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
1274 CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
1276 CAMLreturn (Val_unit);
1280 #ifdef HAVE_WEAK_SYMBOLS
1281 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
1282 extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak));
1287 ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
1289 CAMLparam2 (connv, strv);
1290 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
1291 /* Symbol virStorageVolLookupByKey not found at compile time. */
1292 not_supported ("virStorageVolLookupByKey");
1293 /* Suppresses a compiler warning. */
1296 /* Check that the symbol virStorageVolLookupByKey
1297 * is in runtime version of libvirt.
1299 WEAK_SYMBOL_CHECK (virStorageVolLookupByKey);
1302 virConnectPtr conn = Connect_val (connv);
1303 char *str = String_val (strv);
1306 NONBLOCKING (r = virStorageVolLookupByKey (conn, str));
1307 CHECK_ERROR (!r, conn, "virStorageVolLookupByKey");
1309 rv = Val_volume (r, connv);
1315 #ifdef HAVE_WEAK_SYMBOLS
1316 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
1317 extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak));
1322 ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
1324 CAMLparam2 (connv, strv);
1325 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
1326 /* Symbol virStorageVolLookupByPath not found at compile time. */
1327 not_supported ("virStorageVolLookupByPath");
1328 /* Suppresses a compiler warning. */
1331 /* Check that the symbol virStorageVolLookupByPath
1332 * is in runtime version of libvirt.
1334 WEAK_SYMBOL_CHECK (virStorageVolLookupByPath);
1337 virConnectPtr conn = Connect_val (connv);
1338 char *str = String_val (strv);
1341 NONBLOCKING (r = virStorageVolLookupByPath (conn, str));
1342 CHECK_ERROR (!r, conn, "virStorageVolLookupByPath");
1344 rv = Val_volume (r, connv);
1350 #ifdef HAVE_WEAK_SYMBOLS
1351 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
1352 extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, int flags) __attribute__((weak));
1357 ocaml_libvirt_storage_vol_get_xml_desc (value volv)
1360 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
1361 /* Symbol virStorageVolGetXMLDesc not found at compile time. */
1362 not_supported ("virStorageVolGetXMLDesc");
1363 /* Suppresses a compiler warning. */
1366 /* Check that the symbol virStorageVolGetXMLDesc
1367 * is in runtime version of libvirt.
1369 WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
1372 virStorageVolPtr vol = Volume_val (volv);
1373 virConnectPtr conn = Connect_volv (volv);
1376 NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0));
1377 CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
1379 rv = caml_copy_string (r);
1385 #ifdef HAVE_WEAK_SYMBOLS
1386 #ifdef HAVE_VIRSTORAGEVOLGETPATH
1387 extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak));
1392 ocaml_libvirt_storage_vol_get_path (value volv)
1395 #ifndef HAVE_VIRSTORAGEVOLGETPATH
1396 /* Symbol virStorageVolGetPath not found at compile time. */
1397 not_supported ("virStorageVolGetPath");
1398 /* Suppresses a compiler warning. */
1401 /* Check that the symbol virStorageVolGetPath
1402 * is in runtime version of libvirt.
1404 WEAK_SYMBOL_CHECK (virStorageVolGetPath);
1407 virStorageVolPtr vol = Volume_val (volv);
1408 virConnectPtr conn = Connect_volv (volv);
1411 NONBLOCKING (r = virStorageVolGetPath (vol));
1412 CHECK_ERROR (!r, conn, "virStorageVolGetPath");
1414 rv = caml_copy_string (r);
1420 #ifdef HAVE_WEAK_SYMBOLS
1421 #ifdef HAVE_VIRSTORAGEVOLGETKEY
1422 extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak));
1427 ocaml_libvirt_storage_vol_get_key (value volv)
1430 #ifndef HAVE_VIRSTORAGEVOLGETKEY
1431 /* Symbol virStorageVolGetKey not found at compile time. */
1432 not_supported ("virStorageVolGetKey");
1433 /* Suppresses a compiler warning. */
1436 /* Check that the symbol virStorageVolGetKey
1437 * is in runtime version of libvirt.
1439 WEAK_SYMBOL_CHECK (virStorageVolGetKey);
1442 virStorageVolPtr vol = Volume_val (volv);
1443 virConnectPtr conn = Connect_volv (volv);
1446 NONBLOCKING (r = virStorageVolGetKey (vol));
1447 CHECK_ERROR (!r, conn, "virStorageVolGetKey");
1449 rv = caml_copy_string (r);
1454 #ifdef HAVE_WEAK_SYMBOLS
1455 #ifdef HAVE_VIRSTORAGEVOLGETNAME
1456 extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak));
1461 ocaml_libvirt_storage_vol_get_name (value volv)
1464 #ifndef HAVE_VIRSTORAGEVOLGETNAME
1465 /* Symbol virStorageVolGetName not found at compile time. */
1466 not_supported ("virStorageVolGetName");
1467 /* Suppresses a compiler warning. */
1470 /* Check that the symbol virStorageVolGetName
1471 * is in runtime version of libvirt.
1473 WEAK_SYMBOL_CHECK (virStorageVolGetName);
1476 virStorageVolPtr vol = Volume_val (volv);
1477 virConnectPtr conn = Connect_volv (volv);
1480 NONBLOCKING (r = virStorageVolGetName (vol));
1481 CHECK_ERROR (!r, conn, "virStorageVolGetName");
1483 rv = caml_copy_string (r);
1489 ocaml_libvirt_domain_create_job ()
1491 failwith ("ocaml_libvirt_domain_create_job is unimplemented");
1495 ocaml_libvirt_domain_core_dump_job ()
1497 failwith ("ocaml_libvirt_domain_core_dump_job is unimplemented");
1501 ocaml_libvirt_domain_restore_job ()
1503 failwith ("ocaml_libvirt_domain_restore_job is unimplemented");
1507 ocaml_libvirt_domain_save_job ()
1509 failwith ("ocaml_libvirt_domain_save_job is unimplemented");
1513 ocaml_libvirt_connect_create_linux_job ()
1515 failwith ("ocaml_libvirt_connect_create_linux_job is unimplemented");
1519 ocaml_libvirt_network_create_job ()
1521 failwith ("ocaml_libvirt_network_create_job is unimplemented");
1525 ocaml_libvirt_network_create_xml_job ()
1527 failwith ("ocaml_libvirt_network_create_xml_job is unimplemented");
1531 ocaml_libvirt_storage_pool_get_info ()
1533 failwith ("ocaml_libvirt_storage_pool_get_info is unimplemented");
1537 ocaml_libvirt_storage_pool_free ()
1539 failwith ("ocaml_libvirt_storage_pool_free is unimplemented");
1543 ocaml_libvirt_storage_pool_destroy ()
1545 failwith ("ocaml_libvirt_storage_pool_destroy is unimplemented");
1549 ocaml_libvirt_storage_pool_define_xml ()
1551 failwith ("ocaml_libvirt_storage_pool_define_xml is unimplemented");
1555 ocaml_libvirt_storage_pool_create_xml ()
1557 failwith ("ocaml_libvirt_storage_pool_create_xml is unimplemented");
1561 ocaml_libvirt_storage_pool_lookup_by_uuid ()
1563 failwith ("ocaml_libvirt_storage_pool_lookup_by_uuid is unimplemented");
1567 ocaml_libvirt_storage_vol_lookup_by_name ()
1569 failwith ("ocaml_libvirt_storage_vol_lookup_by_name is unimplemented");
1573 ocaml_libvirt_storage_vol_free ()
1575 failwith ("ocaml_libvirt_storage_vol_free is unimplemented");
1579 ocaml_libvirt_storage_vol_destroy ()
1581 failwith ("ocaml_libvirt_storage_vol_destroy is unimplemented");
1585 ocaml_libvirt_storage_vol_create_xml ()
1587 failwith ("ocaml_libvirt_storage_vol_create_xml is unimplemented");
1591 ocaml_libvirt_storage_vol_get_info ()
1593 failwith ("ocaml_libvirt_storage_vol_get_info is unimplemented");
1597 ocaml_libvirt_pool_of_volume ()
1599 failwith ("ocaml_libvirt_pool_of_volume is unimplemented");
1603 ocaml_libvirt_job_cancel ()
1605 failwith ("ocaml_libvirt_job_cancel is unimplemented");
1609 ocaml_libvirt_job_get_network ()
1611 failwith ("ocaml_libvirt_job_get_network is unimplemented");
1615 ocaml_libvirt_job_get_domain ()
1617 failwith ("ocaml_libvirt_job_get_domain is unimplemented");
1621 ocaml_libvirt_job_get_info ()
1623 failwith ("ocaml_libvirt_job_get_info is unimplemented");
1626 #include "libvirt_c_epilogue.c"