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 * Please see the file ../COPYING.LIB.
31 #include <libvirt/libvirt.h>
32 #include <libvirt/virterror.h>
34 #include <caml/config.h>
35 #include <caml/alloc.h>
36 #include <caml/callback.h>
37 #include <caml/custom.h>
38 #include <caml/fail.h>
39 #include <caml/memory.h>
40 #include <caml/misc.h>
41 #include <caml/mlvalues.h>
42 #include <caml/signals.h>
44 #include "libvirt_c_prologue.c"
46 #include "libvirt_c_oneoffs.c"
48 /* Automatically generated binding for virConnectClose.
49 * In generator.pl this function has signature "conn : free".
53 ocaml_libvirt_connect_close (value connv)
57 virConnectPtr conn = Connect_val (connv);
60 NONBLOCKING (r = virConnectClose (conn));
61 CHECK_ERROR (r == -1, conn, "virConnectClose");
63 /* So that we don't double-free in the finalizer: */
64 Connect_val (connv) = NULL;
66 CAMLreturn (Val_unit);
69 /* Automatically generated binding for virConnectGetHostname.
70 * In generator.pl this function has signature "conn : string".
73 #ifdef HAVE_WEAK_SYMBOLS
74 #ifdef HAVE_VIRCONNECTGETHOSTNAME
75 extern char *virConnectGetHostname (virConnectPtr conn) __attribute__((weak));
80 ocaml_libvirt_connect_get_hostname (value connv)
83 #ifndef HAVE_VIRCONNECTGETHOSTNAME
84 /* Symbol virConnectGetHostname not found at compile time. */
85 not_supported ("virConnectGetHostname");
88 /* Check that the symbol virConnectGetHostname
89 * is in runtime version of libvirt.
91 WEAK_SYMBOL_CHECK (virConnectGetHostname);
94 virConnectPtr conn = Connect_val (connv);
97 NONBLOCKING (r = virConnectGetHostname (conn));
98 CHECK_ERROR (!r, conn, "virConnectGetHostname");
100 rv = caml_copy_string (r);
106 /* Automatically generated binding for virConnectGetURI.
107 * In generator.pl this function has signature "conn : string".
110 #ifdef HAVE_WEAK_SYMBOLS
111 #ifdef HAVE_VIRCONNECTGETURI
112 extern char *virConnectGetURI (virConnectPtr conn) __attribute__((weak));
117 ocaml_libvirt_connect_get_uri (value connv)
120 #ifndef HAVE_VIRCONNECTGETURI
121 /* Symbol virConnectGetURI not found at compile time. */
122 not_supported ("virConnectGetURI");
125 /* Check that the symbol virConnectGetURI
126 * is in runtime version of libvirt.
128 WEAK_SYMBOL_CHECK (virConnectGetURI);
131 virConnectPtr conn = Connect_val (connv);
134 NONBLOCKING (r = virConnectGetURI (conn));
135 CHECK_ERROR (!r, conn, "virConnectGetURI");
137 rv = caml_copy_string (r);
143 /* Automatically generated binding for virConnectGetType.
144 * In generator.pl this function has signature "conn : static string".
148 ocaml_libvirt_connect_get_type (value connv)
153 virConnectPtr conn = Connect_val (connv);
156 NONBLOCKING (r = virConnectGetType (conn));
157 CHECK_ERROR (!r, conn, "virConnectGetType");
159 rv = caml_copy_string (r);
163 /* Automatically generated binding for virConnectNumOfDomains.
164 * In generator.pl this function has signature "conn : int".
168 ocaml_libvirt_connect_num_of_domains (value connv)
172 virConnectPtr conn = Connect_val (connv);
175 NONBLOCKING (r = virConnectNumOfDomains (conn));
176 CHECK_ERROR (r == -1, conn, "virConnectNumOfDomains");
178 CAMLreturn (Val_int (r));
181 /* Automatically generated binding for virConnectListDomains.
182 * In generator.pl this function has signature "conn, int : int array".
186 ocaml_libvirt_connect_list_domains (value connv, value iv)
188 CAMLparam2 (connv, iv);
191 virConnectPtr conn = Connect_val (connv);
192 int i = Int_val (iv);
195 /* Some libvirt List* functions still throw exceptions if i == 0,
196 * so catch that and return an empty array directly. This changes
197 * the semantics slightly (masking other failures) but it's
198 * unlikely anyone will care. RWMJ 2008/06/10
201 rv = caml_alloc (0, 0);
205 NONBLOCKING (r = virConnectListDomains (conn, ids, i));
206 CHECK_ERROR (r == -1, conn, "virConnectListDomains");
208 rv = caml_alloc (r, 0);
209 for (i = 0; i < r; ++i)
210 Store_field (rv, i, Val_int (ids[i]));
215 /* Automatically generated binding for virConnectNumOfDefinedDomains.
216 * In generator.pl this function has signature "conn : int".
220 ocaml_libvirt_connect_num_of_defined_domains (value connv)
224 virConnectPtr conn = Connect_val (connv);
227 NONBLOCKING (r = virConnectNumOfDefinedDomains (conn));
228 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedDomains");
230 CAMLreturn (Val_int (r));
233 /* Automatically generated binding for virConnectListDefinedDomains.
234 * In generator.pl this function has signature "conn, int : string array".
238 ocaml_libvirt_connect_list_defined_domains (value connv, value iv)
240 CAMLparam2 (connv, iv);
242 CAMLlocal2 (rv, strv);
243 virConnectPtr conn = Connect_val (connv);
244 int i = Int_val (iv);
248 /* Some libvirt List* functions still throw exceptions if i == 0,
249 * so catch that and return an empty array directly. This changes
250 * the semantics slightly (masking other failures) but it's
251 * unlikely anyone will care. RWMJ 2008/06/10
254 rv = caml_alloc (0, 0);
258 NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i));
259 CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
261 rv = caml_alloc (r, 0);
262 for (i = 0; i < r; ++i) {
263 strv = caml_copy_string (names[i]);
264 Store_field (rv, i, strv);
271 /* Automatically generated binding for virConnectNumOfNetworks.
272 * In generator.pl this function has signature "conn : int".
276 ocaml_libvirt_connect_num_of_networks (value connv)
280 virConnectPtr conn = Connect_val (connv);
283 NONBLOCKING (r = virConnectNumOfNetworks (conn));
284 CHECK_ERROR (r == -1, conn, "virConnectNumOfNetworks");
286 CAMLreturn (Val_int (r));
289 /* Automatically generated binding for virConnectListNetworks.
290 * In generator.pl this function has signature "conn, int : string array".
294 ocaml_libvirt_connect_list_networks (value connv, value iv)
296 CAMLparam2 (connv, iv);
298 CAMLlocal2 (rv, strv);
299 virConnectPtr conn = Connect_val (connv);
300 int i = Int_val (iv);
304 /* Some libvirt List* functions still throw exceptions if i == 0,
305 * so catch that and return an empty array directly. This changes
306 * the semantics slightly (masking other failures) but it's
307 * unlikely anyone will care. RWMJ 2008/06/10
310 rv = caml_alloc (0, 0);
314 NONBLOCKING (r = virConnectListNetworks (conn, names, i));
315 CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
317 rv = caml_alloc (r, 0);
318 for (i = 0; i < r; ++i) {
319 strv = caml_copy_string (names[i]);
320 Store_field (rv, i, strv);
327 /* Automatically generated binding for virConnectNumOfDefinedNetworks.
328 * In generator.pl this function has signature "conn : int".
332 ocaml_libvirt_connect_num_of_defined_networks (value connv)
336 virConnectPtr conn = Connect_val (connv);
339 NONBLOCKING (r = virConnectNumOfDefinedNetworks (conn));
340 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedNetworks");
342 CAMLreturn (Val_int (r));
345 /* Automatically generated binding for virConnectListDefinedNetworks.
346 * In generator.pl this function has signature "conn, int : string array".
350 ocaml_libvirt_connect_list_defined_networks (value connv, value iv)
352 CAMLparam2 (connv, iv);
354 CAMLlocal2 (rv, strv);
355 virConnectPtr conn = Connect_val (connv);
356 int i = Int_val (iv);
360 /* Some libvirt List* functions still throw exceptions if i == 0,
361 * so catch that and return an empty array directly. This changes
362 * the semantics slightly (masking other failures) but it's
363 * unlikely anyone will care. RWMJ 2008/06/10
366 rv = caml_alloc (0, 0);
370 NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i));
371 CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
373 rv = caml_alloc (r, 0);
374 for (i = 0; i < r; ++i) {
375 strv = caml_copy_string (names[i]);
376 Store_field (rv, i, strv);
383 /* Automatically generated binding for virConnectNumOfStoragePools.
384 * In generator.pl this function has signature "conn : int".
387 #ifdef HAVE_WEAK_SYMBOLS
388 #ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
389 extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak));
394 ocaml_libvirt_connect_num_of_storage_pools (value connv)
397 #ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
398 /* Symbol virConnectNumOfStoragePools not found at compile time. */
399 not_supported ("virConnectNumOfStoragePools");
402 /* Check that the symbol virConnectNumOfStoragePools
403 * is in runtime version of libvirt.
405 WEAK_SYMBOL_CHECK (virConnectNumOfStoragePools);
407 virConnectPtr conn = Connect_val (connv);
410 NONBLOCKING (r = virConnectNumOfStoragePools (conn));
411 CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools");
413 CAMLreturn (Val_int (r));
417 /* Automatically generated binding for virConnectListStoragePools.
418 * In generator.pl this function has signature "conn, int : string array".
421 #ifdef HAVE_WEAK_SYMBOLS
422 #ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS
423 extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
428 ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
430 CAMLparam2 (connv, iv);
431 #ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS
432 /* Symbol virConnectListStoragePools not found at compile time. */
433 not_supported ("virConnectListStoragePools");
436 /* Check that the symbol virConnectListStoragePools
437 * is in runtime version of libvirt.
439 WEAK_SYMBOL_CHECK (virConnectListStoragePools);
441 CAMLlocal2 (rv, strv);
442 virConnectPtr conn = Connect_val (connv);
443 int i = Int_val (iv);
447 /* Some libvirt List* functions still throw exceptions if i == 0,
448 * so catch that and return an empty array directly. This changes
449 * the semantics slightly (masking other failures) but it's
450 * unlikely anyone will care. RWMJ 2008/06/10
453 rv = caml_alloc (0, 0);
457 NONBLOCKING (r = virConnectListStoragePools (conn, names, i));
458 CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
460 rv = caml_alloc (r, 0);
461 for (i = 0; i < r; ++i) {
462 strv = caml_copy_string (names[i]);
463 Store_field (rv, i, strv);
471 /* Automatically generated binding for virConnectNumOfDefinedStoragePools.
472 * In generator.pl this function has signature "conn : int".
475 #ifdef HAVE_WEAK_SYMBOLS
476 #ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
477 extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak));
482 ocaml_libvirt_connect_num_of_defined_storage_pools (value connv)
485 #ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
486 /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */
487 not_supported ("virConnectNumOfDefinedStoragePools");
490 /* Check that the symbol virConnectNumOfDefinedStoragePools
491 * is in runtime version of libvirt.
493 WEAK_SYMBOL_CHECK (virConnectNumOfDefinedStoragePools);
495 virConnectPtr conn = Connect_val (connv);
498 NONBLOCKING (r = virConnectNumOfDefinedStoragePools (conn));
499 CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools");
501 CAMLreturn (Val_int (r));
505 /* Automatically generated binding for virConnectListDefinedStoragePools.
506 * In generator.pl this function has signature "conn, int : string array".
509 #ifdef HAVE_WEAK_SYMBOLS
510 #ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
511 extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
516 ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
518 CAMLparam2 (connv, iv);
519 #ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
520 /* Symbol virConnectListDefinedStoragePools not found at compile time. */
521 not_supported ("virConnectListDefinedStoragePools");
524 /* Check that the symbol virConnectListDefinedStoragePools
525 * is in runtime version of libvirt.
527 WEAK_SYMBOL_CHECK (virConnectListDefinedStoragePools);
529 CAMLlocal2 (rv, strv);
530 virConnectPtr conn = Connect_val (connv);
531 int i = Int_val (iv);
535 /* Some libvirt List* functions still throw exceptions if i == 0,
536 * so catch that and return an empty array directly. This changes
537 * the semantics slightly (masking other failures) but it's
538 * unlikely anyone will care. RWMJ 2008/06/10
541 rv = caml_alloc (0, 0);
545 NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i));
546 CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
548 rv = caml_alloc (r, 0);
549 for (i = 0; i < r; ++i) {
550 strv = caml_copy_string (names[i]);
551 Store_field (rv, i, strv);
559 /* Automatically generated binding for virConnectGetCapabilities.
560 * In generator.pl this function has signature "conn : string".
564 ocaml_libvirt_connect_get_capabilities (value connv)
569 virConnectPtr conn = Connect_val (connv);
572 NONBLOCKING (r = virConnectGetCapabilities (conn));
573 CHECK_ERROR (!r, conn, "virConnectGetCapabilities");
575 rv = caml_copy_string (r);
580 /* Automatically generated binding for virDomainCreateLinux.
581 * In generator.pl this function has signature "conn, string, 0U : dom".
585 ocaml_libvirt_domain_create_linux (value connv, value strv)
587 CAMLparam2 (connv, strv);
590 virConnectPtr conn = Connect_val (connv);
591 char *str = String_val (strv);
594 NONBLOCKING (r = virDomainCreateLinux (conn, str, 0));
595 CHECK_ERROR (!r, conn, "virDomainCreateLinux");
597 rv = Val_domain (r, connv);
602 /* Automatically generated binding for virDomainCreateLinuxJob.
603 * In generator.pl this function has signature "conn, string, 0U : job".
606 #ifdef HAVE_WEAK_SYMBOLS
607 #ifdef HAVE_VIRDOMAINCREATELINUXJOB
608 extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
613 ocaml_libvirt_domain_create_linux_job (value connv, value strv)
615 CAMLparam2 (connv, strv);
616 #ifndef HAVE_VIRDOMAINCREATELINUXJOB
617 /* Symbol virDomainCreateLinuxJob not found at compile time. */
618 not_supported ("virDomainCreateLinuxJob");
621 /* Check that the symbol virDomainCreateLinuxJob
622 * is in runtime version of libvirt.
624 WEAK_SYMBOL_CHECK (virDomainCreateLinuxJob);
627 virConnectPtr conn = Connect_val (connv);
628 char *str = String_val (strv);
631 NONBLOCKING (r = virDomainCreateLinuxJob (conn, str, 0));
632 CHECK_ERROR (!r, conn, "virDomainCreateLinuxJob");
634 rv = Val_job (r, connv);
640 /* Automatically generated binding for virDomainFree.
641 * In generator.pl this function has signature "dom : free".
645 ocaml_libvirt_domain_free (value domv)
649 virDomainPtr dom = Domain_val (domv);
650 virConnectPtr conn = Connect_domv (domv);
653 NONBLOCKING (r = virDomainFree (dom));
654 CHECK_ERROR (r == -1, conn, "virDomainFree");
656 /* So that we don't double-free in the finalizer: */
657 Domain_val (domv) = NULL;
659 CAMLreturn (Val_unit);
662 /* Automatically generated binding for virDomainDestroy.
663 * In generator.pl this function has signature "dom : free".
667 ocaml_libvirt_domain_destroy (value domv)
671 virDomainPtr dom = Domain_val (domv);
672 virConnectPtr conn = Connect_domv (domv);
675 NONBLOCKING (r = virDomainDestroy (dom));
676 CHECK_ERROR (r == -1, conn, "virDomainDestroy");
678 /* So that we don't double-free in the finalizer: */
679 Domain_val (domv) = NULL;
681 CAMLreturn (Val_unit);
684 /* Automatically generated binding for virDomainLookupByName.
685 * In generator.pl this function has signature "conn, string : dom".
689 ocaml_libvirt_domain_lookup_by_name (value connv, value strv)
691 CAMLparam2 (connv, strv);
694 virConnectPtr conn = Connect_val (connv);
695 char *str = String_val (strv);
698 NONBLOCKING (r = virDomainLookupByName (conn, str));
699 CHECK_ERROR (!r, conn, "virDomainLookupByName");
701 rv = Val_domain (r, connv);
706 /* Automatically generated binding for virDomainLookupByID.
707 * In generator.pl this function has signature "conn, int : dom".
711 ocaml_libvirt_domain_lookup_by_id (value connv, value iv)
713 CAMLparam2 (connv, iv);
716 virConnectPtr conn = Connect_val (connv);
717 int i = Int_val (iv);
720 NONBLOCKING (r = virDomainLookupByID (conn, i));
721 CHECK_ERROR (!r, conn, "virDomainLookupByID");
723 rv = Val_domain (r, connv);
728 /* Automatically generated binding for virDomainLookupByUUID.
729 * In generator.pl this function has signature "conn, uuid : dom".
733 ocaml_libvirt_domain_lookup_by_uuid (value connv, value uuidv)
735 CAMLparam2 (connv, uuidv);
738 virConnectPtr conn = Connect_val (connv);
739 unsigned char *uuid = (unsigned char *) String_val (uuidv);
742 NONBLOCKING (r = virDomainLookupByUUID (conn, uuid));
743 CHECK_ERROR (!r, conn, "virDomainLookupByUUID");
745 rv = Val_domain (r, connv);
750 /* Automatically generated binding for virDomainLookupByUUIDString.
751 * In generator.pl this function has signature "conn, string : dom".
755 ocaml_libvirt_domain_lookup_by_uuid_string (value connv, value strv)
757 CAMLparam2 (connv, strv);
760 virConnectPtr conn = Connect_val (connv);
761 char *str = String_val (strv);
764 NONBLOCKING (r = virDomainLookupByUUIDString (conn, str));
765 CHECK_ERROR (!r, conn, "virDomainLookupByUUIDString");
767 rv = Val_domain (r, connv);
772 /* Automatically generated binding for virDomainGetName.
773 * In generator.pl this function has signature "dom : static string".
777 ocaml_libvirt_domain_get_name (value domv)
782 virDomainPtr dom = Domain_val (domv);
783 virConnectPtr conn = Connect_domv (domv);
786 NONBLOCKING (r = virDomainGetName (dom));
787 CHECK_ERROR (!r, conn, "virDomainGetName");
789 rv = caml_copy_string (r);
793 /* Automatically generated binding for virDomainGetOSType.
794 * In generator.pl this function has signature "dom : string".
798 ocaml_libvirt_domain_get_os_type (value domv)
803 virDomainPtr dom = Domain_val (domv);
804 virConnectPtr conn = Connect_domv (domv);
807 NONBLOCKING (r = virDomainGetOSType (dom));
808 CHECK_ERROR (!r, conn, "virDomainGetOSType");
810 rv = caml_copy_string (r);
815 /* Automatically generated binding for virDomainGetXMLDesc.
816 * In generator.pl this function has signature "dom, 0 : string".
820 ocaml_libvirt_domain_get_xml_desc (value domv)
825 virDomainPtr dom = Domain_val (domv);
826 virConnectPtr conn = Connect_domv (domv);
829 NONBLOCKING (r = virDomainGetXMLDesc (dom, 0));
830 CHECK_ERROR (!r, conn, "virDomainGetXMLDesc");
832 rv = caml_copy_string (r);
837 /* Automatically generated binding for virDomainGetUUID.
838 * In generator.pl this function has signature "dom : uuid".
842 ocaml_libvirt_domain_get_uuid (value domv)
847 virDomainPtr dom = Domain_val (domv);
848 virConnectPtr conn = Connect_domv (domv);
849 unsigned char uuid[VIR_UUID_BUFLEN];
852 NONBLOCKING (r = virDomainGetUUID (dom, uuid));
853 CHECK_ERROR (r == -1, conn, "virDomainGetUUID");
855 /* UUIDs are byte arrays with a fixed length. */
856 rv = caml_alloc_string (VIR_UUID_BUFLEN);
857 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
861 /* Automatically generated binding for virDomainGetUUIDString.
862 * In generator.pl this function has signature "dom : uuid string".
866 ocaml_libvirt_domain_get_uuid_string (value domv)
871 virDomainPtr dom = Domain_val (domv);
872 virConnectPtr conn = Connect_domv (domv);
873 char uuid[VIR_UUID_STRING_BUFLEN];
876 NONBLOCKING (r = virDomainGetUUIDString (dom, uuid));
877 CHECK_ERROR (r == -1, conn, "virDomainGetUUIDString");
879 rv = caml_copy_string (uuid);
883 /* Automatically generated binding for virDomainGetMaxVcpus.
884 * In generator.pl this function has signature "dom : int".
888 ocaml_libvirt_domain_get_max_vcpus (value domv)
892 virDomainPtr dom = Domain_val (domv);
893 virConnectPtr conn = Connect_domv (domv);
896 NONBLOCKING (r = virDomainGetMaxVcpus (dom));
897 CHECK_ERROR (r == -1, conn, "virDomainGetMaxVcpus");
899 CAMLreturn (Val_int (r));
902 /* Automatically generated binding for virDomainSave.
903 * In generator.pl this function has signature "dom, string : unit".
907 ocaml_libvirt_domain_save (value domv, value strv)
909 CAMLparam2 (domv, strv);
911 virDomainPtr dom = Domain_val (domv);
912 virConnectPtr conn = Connect_domv (domv);
913 char *str = String_val (strv);
916 NONBLOCKING (r = virDomainSave (dom, str));
917 CHECK_ERROR (r == -1, conn, "virDomainSave");
919 CAMLreturn (Val_unit);
922 /* Automatically generated binding for virDomainSaveJob.
923 * In generator.pl this function has signature "dom, string : job from dom".
926 #ifdef HAVE_WEAK_SYMBOLS
927 #ifdef HAVE_VIRDOMAINSAVEJOB
928 extern virJobPtr virDomainSaveJob (virDomainPtr dom, const char *str) __attribute__((weak));
933 ocaml_libvirt_domain_save_job (value domv, value strv)
935 CAMLparam2 (domv, strv);
936 #ifndef HAVE_VIRDOMAINSAVEJOB
937 /* Symbol virDomainSaveJob not found at compile time. */
938 not_supported ("virDomainSaveJob");
941 /* Check that the symbol virDomainSaveJob
942 * is in runtime version of libvirt.
944 WEAK_SYMBOL_CHECK (virDomainSaveJob);
946 CAMLlocal2 (rv, connv);
947 virDomainPtr dom = Domain_val (domv);
948 virConnectPtr conn = Connect_domv (domv);
949 char *str = String_val (strv);
952 NONBLOCKING (r = virDomainSaveJob (dom, str));
953 CHECK_ERROR (!r, conn, "virDomainSaveJob");
955 connv = Field (domv, 1);
956 rv = Val_job (r, connv);
962 /* Automatically generated binding for virDomainRestore.
963 * In generator.pl this function has signature "conn, string : unit".
967 ocaml_libvirt_domain_restore (value connv, value strv)
969 CAMLparam2 (connv, strv);
971 virConnectPtr conn = Connect_val (connv);
972 char *str = String_val (strv);
975 NONBLOCKING (r = virDomainRestore (conn, str));
976 CHECK_ERROR (r == -1, conn, "virDomainRestore");
978 CAMLreturn (Val_unit);
981 /* Automatically generated binding for virDomainRestoreJob.
982 * In generator.pl this function has signature "conn, string : job".
985 #ifdef HAVE_WEAK_SYMBOLS
986 #ifdef HAVE_VIRDOMAINRESTOREJOB
987 extern virJobPtr virDomainRestoreJob (virConnectPtr conn, const char *str) __attribute__((weak));
992 ocaml_libvirt_domain_restore_job (value connv, value strv)
994 CAMLparam2 (connv, strv);
995 #ifndef HAVE_VIRDOMAINRESTOREJOB
996 /* Symbol virDomainRestoreJob not found at compile time. */
997 not_supported ("virDomainRestoreJob");
1000 /* Check that the symbol virDomainRestoreJob
1001 * is in runtime version of libvirt.
1003 WEAK_SYMBOL_CHECK (virDomainRestoreJob);
1006 virConnectPtr conn = Connect_val (connv);
1007 char *str = String_val (strv);
1010 NONBLOCKING (r = virDomainRestoreJob (conn, str));
1011 CHECK_ERROR (!r, conn, "virDomainRestoreJob");
1013 rv = Val_job (r, connv);
1019 /* Automatically generated binding for virDomainCoreDump.
1020 * In generator.pl this function has signature "dom, string, 0 : unit".
1024 ocaml_libvirt_domain_core_dump (value domv, value strv)
1026 CAMLparam2 (domv, strv);
1029 virDomainPtr dom = Domain_val (domv);
1030 virConnectPtr conn = Connect_domv (domv);
1031 char *str = String_val (strv);
1034 NONBLOCKING (r = virDomainCoreDump (dom, str, 0));
1035 CHECK_ERROR (!r, conn, "virDomainCoreDump");
1037 CAMLreturn (Val_unit);
1040 /* Automatically generated binding for virDomainCoreDumpJob.
1041 * In generator.pl this function has signature "dom, string, 0 : job from dom".
1044 #ifdef HAVE_WEAK_SYMBOLS
1045 #ifdef HAVE_VIRDOMAINCOREDUMPJOB
1046 extern virJobPtr virDomainCoreDumpJob (virDomainPtr dom, const char *str, int flags) __attribute__((weak));
1051 ocaml_libvirt_domain_core_dump_job (value domv, value strv)
1053 CAMLparam2 (domv, strv);
1054 #ifndef HAVE_VIRDOMAINCOREDUMPJOB
1055 /* Symbol virDomainCoreDumpJob not found at compile time. */
1056 not_supported ("virDomainCoreDumpJob");
1059 /* Check that the symbol virDomainCoreDumpJob
1060 * is in runtime version of libvirt.
1062 WEAK_SYMBOL_CHECK (virDomainCoreDumpJob);
1064 CAMLlocal2 (rv, connv);
1065 virDomainPtr dom = Domain_val (domv);
1066 virConnectPtr conn = Connect_domv (domv);
1067 char *str = String_val (strv);
1070 NONBLOCKING (r = virDomainCoreDumpJob (dom, str, 0));
1071 CHECK_ERROR (!r, conn, "virDomainCoreDumpJob");
1073 connv = Field (domv, 1);
1074 rv = Val_job (r, connv);
1080 /* Automatically generated binding for virDomainSuspend.
1081 * In generator.pl this function has signature "dom : unit".
1085 ocaml_libvirt_domain_suspend (value domv)
1089 virDomainPtr dom = Domain_val (domv);
1090 virConnectPtr conn = Connect_domv (domv);
1093 NONBLOCKING (r = virDomainSuspend (dom));
1094 CHECK_ERROR (r == -1, conn, "virDomainSuspend");
1096 CAMLreturn (Val_unit);
1099 /* Automatically generated binding for virDomainResume.
1100 * In generator.pl this function has signature "dom : unit".
1104 ocaml_libvirt_domain_resume (value domv)
1108 virDomainPtr dom = Domain_val (domv);
1109 virConnectPtr conn = Connect_domv (domv);
1112 NONBLOCKING (r = virDomainResume (dom));
1113 CHECK_ERROR (r == -1, conn, "virDomainResume");
1115 CAMLreturn (Val_unit);
1118 /* Automatically generated binding for virDomainShutdown.
1119 * In generator.pl this function has signature "dom : unit".
1123 ocaml_libvirt_domain_shutdown (value domv)
1127 virDomainPtr dom = Domain_val (domv);
1128 virConnectPtr conn = Connect_domv (domv);
1131 NONBLOCKING (r = virDomainShutdown (dom));
1132 CHECK_ERROR (r == -1, conn, "virDomainShutdown");
1134 CAMLreturn (Val_unit);
1137 /* Automatically generated binding for virDomainReboot.
1138 * In generator.pl this function has signature "dom, 0 : unit".
1142 ocaml_libvirt_domain_reboot (value domv)
1146 virDomainPtr dom = Domain_val (domv);
1147 virConnectPtr conn = Connect_domv (domv);
1150 NONBLOCKING (r = virDomainReboot (dom, 0));
1151 CHECK_ERROR (r == -1, conn, "virDomainReboot");
1153 CAMLreturn (Val_unit);
1156 /* Automatically generated binding for virDomainDefineXML.
1157 * In generator.pl this function has signature "conn, string : dom".
1161 ocaml_libvirt_domain_define_xml (value connv, value strv)
1163 CAMLparam2 (connv, strv);
1166 virConnectPtr conn = Connect_val (connv);
1167 char *str = String_val (strv);
1170 NONBLOCKING (r = virDomainDefineXML (conn, str));
1171 CHECK_ERROR (!r, conn, "virDomainDefineXML");
1173 rv = Val_domain (r, connv);
1178 /* Automatically generated binding for virDomainUndefine.
1179 * In generator.pl this function has signature "dom : unit".
1183 ocaml_libvirt_domain_undefine (value domv)
1187 virDomainPtr dom = Domain_val (domv);
1188 virConnectPtr conn = Connect_domv (domv);
1191 NONBLOCKING (r = virDomainUndefine (dom));
1192 CHECK_ERROR (r == -1, conn, "virDomainUndefine");
1194 CAMLreturn (Val_unit);
1197 /* Automatically generated binding for virDomainCreate.
1198 * In generator.pl this function has signature "dom : unit".
1202 ocaml_libvirt_domain_create (value domv)
1206 virDomainPtr dom = Domain_val (domv);
1207 virConnectPtr conn = Connect_domv (domv);
1210 NONBLOCKING (r = virDomainCreate (dom));
1211 CHECK_ERROR (r == -1, conn, "virDomainCreate");
1213 CAMLreturn (Val_unit);
1216 /* Automatically generated binding for virDomainCreateJob.
1217 * In generator.pl this function has signature "dom, 0U : job from dom".
1220 #ifdef HAVE_WEAK_SYMBOLS
1221 #ifdef HAVE_VIRDOMAINCREATEJOB
1222 extern virJobPtr virDomainCreateJob (virDomainPtr dom, unsigned int flags) __attribute__((weak));
1227 ocaml_libvirt_domain_create_job (value domv)
1230 #ifndef HAVE_VIRDOMAINCREATEJOB
1231 /* Symbol virDomainCreateJob not found at compile time. */
1232 not_supported ("virDomainCreateJob");
1235 /* Check that the symbol virDomainCreateJob
1236 * is in runtime version of libvirt.
1238 WEAK_SYMBOL_CHECK (virDomainCreateJob);
1240 CAMLlocal2 (rv, connv);
1241 virDomainPtr dom = Domain_val (domv);
1242 virConnectPtr conn = Connect_domv (domv);
1245 NONBLOCKING (r = virDomainCreateJob (dom, 0));
1246 CHECK_ERROR (!r, conn, "virDomainCreateJob");
1248 connv = Field (domv, 1);
1249 rv = Val_job (r, connv);
1255 /* Automatically generated binding for virDomainAttachDevice.
1256 * In generator.pl this function has signature "dom, string : unit".
1260 ocaml_libvirt_domain_attach_device (value domv, value strv)
1262 CAMLparam2 (domv, strv);
1264 virDomainPtr dom = Domain_val (domv);
1265 virConnectPtr conn = Connect_domv (domv);
1266 char *str = String_val (strv);
1269 NONBLOCKING (r = virDomainAttachDevice (dom, str));
1270 CHECK_ERROR (r == -1, conn, "virDomainAttachDevice");
1272 CAMLreturn (Val_unit);
1275 /* Automatically generated binding for virDomainDetachDevice.
1276 * In generator.pl this function has signature "dom, string : unit".
1280 ocaml_libvirt_domain_detach_device (value domv, value strv)
1282 CAMLparam2 (domv, strv);
1284 virDomainPtr dom = Domain_val (domv);
1285 virConnectPtr conn = Connect_domv (domv);
1286 char *str = String_val (strv);
1289 NONBLOCKING (r = virDomainDetachDevice (dom, str));
1290 CHECK_ERROR (r == -1, conn, "virDomainDetachDevice");
1292 CAMLreturn (Val_unit);
1295 /* Automatically generated binding for virDomainGetAutostart.
1296 * In generator.pl this function has signature "dom : bool".
1300 ocaml_libvirt_domain_get_autostart (value domv)
1304 virDomainPtr dom = Domain_val (domv);
1305 virConnectPtr conn = Connect_domv (domv);
1308 NONBLOCKING (r = virDomainGetAutostart (dom, &b));
1309 CHECK_ERROR (r == -1, conn, "virDomainGetAutostart");
1311 CAMLreturn (b ? Val_true : Val_false);
1314 /* Automatically generated binding for virDomainSetAutostart.
1315 * In generator.pl this function has signature "dom, bool : unit".
1319 ocaml_libvirt_domain_set_autostart (value domv, value bv)
1321 CAMLparam2 (domv, bv);
1323 virDomainPtr dom = Domain_val (domv);
1324 virConnectPtr conn = Connect_domv (domv);
1327 b = bv == Val_true ? 1 : 0;
1329 NONBLOCKING (r = virDomainSetAutostart (dom, b));
1330 CHECK_ERROR (r == -1, conn, "virDomainSetAutostart");
1332 CAMLreturn (Val_unit);
1335 /* Automatically generated binding for virNetworkFree.
1336 * In generator.pl this function has signature "net : free".
1340 ocaml_libvirt_network_free (value netv)
1344 virNetworkPtr net = Network_val (netv);
1345 virConnectPtr conn = Connect_netv (netv);
1348 NONBLOCKING (r = virNetworkFree (net));
1349 CHECK_ERROR (r == -1, conn, "virNetworkFree");
1351 /* So that we don't double-free in the finalizer: */
1352 Network_val (netv) = NULL;
1354 CAMLreturn (Val_unit);
1357 /* Automatically generated binding for virNetworkDestroy.
1358 * In generator.pl this function has signature "net : free".
1362 ocaml_libvirt_network_destroy (value netv)
1366 virNetworkPtr net = Network_val (netv);
1367 virConnectPtr conn = Connect_netv (netv);
1370 NONBLOCKING (r = virNetworkDestroy (net));
1371 CHECK_ERROR (r == -1, conn, "virNetworkDestroy");
1373 /* So that we don't double-free in the finalizer: */
1374 Network_val (netv) = NULL;
1376 CAMLreturn (Val_unit);
1379 /* Automatically generated binding for virNetworkLookupByName.
1380 * In generator.pl this function has signature "conn, string : net".
1384 ocaml_libvirt_network_lookup_by_name (value connv, value strv)
1386 CAMLparam2 (connv, strv);
1389 virConnectPtr conn = Connect_val (connv);
1390 char *str = String_val (strv);
1393 NONBLOCKING (r = virNetworkLookupByName (conn, str));
1394 CHECK_ERROR (!r, conn, "virNetworkLookupByName");
1396 rv = Val_network (r, connv);
1401 /* Automatically generated binding for virNetworkLookupByUUID.
1402 * In generator.pl this function has signature "conn, uuid : net".
1406 ocaml_libvirt_network_lookup_by_uuid (value connv, value uuidv)
1408 CAMLparam2 (connv, uuidv);
1411 virConnectPtr conn = Connect_val (connv);
1412 unsigned char *uuid = (unsigned char *) String_val (uuidv);
1415 NONBLOCKING (r = virNetworkLookupByUUID (conn, uuid));
1416 CHECK_ERROR (!r, conn, "virNetworkLookupByUUID");
1418 rv = Val_network (r, connv);
1423 /* Automatically generated binding for virNetworkLookupByUUIDString.
1424 * In generator.pl this function has signature "conn, string : net".
1428 ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv)
1430 CAMLparam2 (connv, strv);
1433 virConnectPtr conn = Connect_val (connv);
1434 char *str = String_val (strv);
1437 NONBLOCKING (r = virNetworkLookupByUUIDString (conn, str));
1438 CHECK_ERROR (!r, conn, "virNetworkLookupByUUIDString");
1440 rv = Val_network (r, connv);
1445 /* Automatically generated binding for virNetworkGetName.
1446 * In generator.pl this function has signature "net : static string".
1450 ocaml_libvirt_network_get_name (value netv)
1455 virNetworkPtr net = Network_val (netv);
1456 virConnectPtr conn = Connect_netv (netv);
1459 NONBLOCKING (r = virNetworkGetName (net));
1460 CHECK_ERROR (!r, conn, "virNetworkGetName");
1462 rv = caml_copy_string (r);
1466 /* Automatically generated binding for virNetworkGetXMLDesc.
1467 * In generator.pl this function has signature "net, 0 : string".
1471 ocaml_libvirt_network_get_xml_desc (value netv)
1476 virNetworkPtr net = Network_val (netv);
1477 virConnectPtr conn = Connect_netv (netv);
1480 NONBLOCKING (r = virNetworkGetXMLDesc (net, 0));
1481 CHECK_ERROR (!r, conn, "virNetworkGetXMLDesc");
1483 rv = caml_copy_string (r);
1488 /* Automatically generated binding for virNetworkGetBridgeName.
1489 * In generator.pl this function has signature "net : string".
1493 ocaml_libvirt_network_get_bridge_name (value netv)
1498 virNetworkPtr net = Network_val (netv);
1499 virConnectPtr conn = Connect_netv (netv);
1502 NONBLOCKING (r = virNetworkGetBridgeName (net));
1503 CHECK_ERROR (!r, conn, "virNetworkGetBridgeName");
1505 rv = caml_copy_string (r);
1510 /* Automatically generated binding for virNetworkGetUUID.
1511 * In generator.pl this function has signature "net : uuid".
1515 ocaml_libvirt_network_get_uuid (value netv)
1520 virNetworkPtr net = Network_val (netv);
1521 virConnectPtr conn = Connect_netv (netv);
1522 unsigned char uuid[VIR_UUID_BUFLEN];
1525 NONBLOCKING (r = virNetworkGetUUID (net, uuid));
1526 CHECK_ERROR (r == -1, conn, "virNetworkGetUUID");
1528 /* UUIDs are byte arrays with a fixed length. */
1529 rv = caml_alloc_string (VIR_UUID_BUFLEN);
1530 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
1534 /* Automatically generated binding for virNetworkGetUUIDString.
1535 * In generator.pl this function has signature "net : uuid string".
1539 ocaml_libvirt_network_get_uuid_string (value netv)
1544 virNetworkPtr net = Network_val (netv);
1545 virConnectPtr conn = Connect_netv (netv);
1546 char uuid[VIR_UUID_STRING_BUFLEN];
1549 NONBLOCKING (r = virNetworkGetUUIDString (net, uuid));
1550 CHECK_ERROR (r == -1, conn, "virNetworkGetUUIDString");
1552 rv = caml_copy_string (uuid);
1556 /* Automatically generated binding for virNetworkUndefine.
1557 * In generator.pl this function has signature "net : unit".
1561 ocaml_libvirt_network_undefine (value netv)
1565 virNetworkPtr net = Network_val (netv);
1566 virConnectPtr conn = Connect_netv (netv);
1569 NONBLOCKING (r = virNetworkUndefine (net));
1570 CHECK_ERROR (r == -1, conn, "virNetworkUndefine");
1572 CAMLreturn (Val_unit);
1575 /* Automatically generated binding for virNetworkCreateXML.
1576 * In generator.pl this function has signature "conn, string : net".
1580 ocaml_libvirt_network_create_xml (value connv, value strv)
1582 CAMLparam2 (connv, strv);
1585 virConnectPtr conn = Connect_val (connv);
1586 char *str = String_val (strv);
1589 NONBLOCKING (r = virNetworkCreateXML (conn, str));
1590 CHECK_ERROR (!r, conn, "virNetworkCreateXML");
1592 rv = Val_network (r, connv);
1597 /* Automatically generated binding for virNetworkCreateXMLJob.
1598 * In generator.pl this function has signature "conn, string : job".
1601 #ifdef HAVE_WEAK_SYMBOLS
1602 #ifdef HAVE_VIRNETWORKCREATEXMLJOB
1603 extern virJobPtr virNetworkCreateXMLJob (virConnectPtr conn, const char *str) __attribute__((weak));
1608 ocaml_libvirt_network_create_xml_job (value connv, value strv)
1610 CAMLparam2 (connv, strv);
1611 #ifndef HAVE_VIRNETWORKCREATEXMLJOB
1612 /* Symbol virNetworkCreateXMLJob not found at compile time. */
1613 not_supported ("virNetworkCreateXMLJob");
1616 /* Check that the symbol virNetworkCreateXMLJob
1617 * is in runtime version of libvirt.
1619 WEAK_SYMBOL_CHECK (virNetworkCreateXMLJob);
1622 virConnectPtr conn = Connect_val (connv);
1623 char *str = String_val (strv);
1626 NONBLOCKING (r = virNetworkCreateXMLJob (conn, str));
1627 CHECK_ERROR (!r, conn, "virNetworkCreateXMLJob");
1629 rv = Val_job (r, connv);
1635 /* Automatically generated binding for virNetworkDefineXML.
1636 * In generator.pl this function has signature "conn, string : net".
1640 ocaml_libvirt_network_define_xml (value connv, value strv)
1642 CAMLparam2 (connv, strv);
1645 virConnectPtr conn = Connect_val (connv);
1646 char *str = String_val (strv);
1649 NONBLOCKING (r = virNetworkDefineXML (conn, str));
1650 CHECK_ERROR (!r, conn, "virNetworkDefineXML");
1652 rv = Val_network (r, connv);
1657 /* Automatically generated binding for virNetworkCreate.
1658 * In generator.pl this function has signature "net : unit".
1662 ocaml_libvirt_network_create (value netv)
1666 virNetworkPtr net = Network_val (netv);
1667 virConnectPtr conn = Connect_netv (netv);
1670 NONBLOCKING (r = virNetworkCreate (net));
1671 CHECK_ERROR (r == -1, conn, "virNetworkCreate");
1673 CAMLreturn (Val_unit);
1676 /* Automatically generated binding for virNetworkCreateJob.
1677 * In generator.pl this function has signature "net : job from net".
1680 #ifdef HAVE_WEAK_SYMBOLS
1681 #ifdef HAVE_VIRNETWORKCREATEJOB
1682 extern virJobPtr virNetworkCreateJob (virNetworkPtr net) __attribute__((weak));
1687 ocaml_libvirt_network_create_job (value netv)
1690 #ifndef HAVE_VIRNETWORKCREATEJOB
1691 /* Symbol virNetworkCreateJob not found at compile time. */
1692 not_supported ("virNetworkCreateJob");
1695 /* Check that the symbol virNetworkCreateJob
1696 * is in runtime version of libvirt.
1698 WEAK_SYMBOL_CHECK (virNetworkCreateJob);
1700 CAMLlocal2 (rv, connv);
1701 virNetworkPtr net = Network_val (netv);
1702 virConnectPtr conn = Connect_netv (netv);
1705 NONBLOCKING (r = virNetworkCreateJob (net));
1706 CHECK_ERROR (!r, conn, "virNetworkCreateJob");
1708 connv = Field (netv, 1);
1709 rv = Val_job (r, connv);
1715 /* Automatically generated binding for virNetworkGetAutostart.
1716 * In generator.pl this function has signature "net : bool".
1720 ocaml_libvirt_network_get_autostart (value netv)
1724 virNetworkPtr net = Network_val (netv);
1725 virConnectPtr conn = Connect_netv (netv);
1728 NONBLOCKING (r = virNetworkGetAutostart (net, &b));
1729 CHECK_ERROR (r == -1, conn, "virNetworkGetAutostart");
1731 CAMLreturn (b ? Val_true : Val_false);
1734 /* Automatically generated binding for virNetworkSetAutostart.
1735 * In generator.pl this function has signature "net, bool : unit".
1739 ocaml_libvirt_network_set_autostart (value netv, value bv)
1741 CAMLparam2 (netv, bv);
1743 virNetworkPtr net = Network_val (netv);
1744 virConnectPtr conn = Connect_netv (netv);
1747 b = bv == Val_true ? 1 : 0;
1749 NONBLOCKING (r = virNetworkSetAutostart (net, b));
1750 CHECK_ERROR (r == -1, conn, "virNetworkSetAutostart");
1752 CAMLreturn (Val_unit);
1755 /* Automatically generated binding for virStoragePoolFree.
1756 * In generator.pl this function has signature "pool : free".
1759 #ifdef HAVE_WEAK_SYMBOLS
1760 #ifdef HAVE_VIRSTORAGEPOOLFREE
1761 extern int virStoragePoolFree (virStoragePoolPtr pool) __attribute__((weak));
1766 ocaml_libvirt_storage_pool_free (value poolv)
1769 #ifndef HAVE_VIRSTORAGEPOOLFREE
1770 /* Symbol virStoragePoolFree not found at compile time. */
1771 not_supported ("virStoragePoolFree");
1774 /* Check that the symbol virStoragePoolFree
1775 * is in runtime version of libvirt.
1777 WEAK_SYMBOL_CHECK (virStoragePoolFree);
1779 virStoragePoolPtr pool = Pool_val (poolv);
1780 virConnectPtr conn = Connect_polv (poolv);
1783 NONBLOCKING (r = virStoragePoolFree (pool));
1784 CHECK_ERROR (r == -1, conn, "virStoragePoolFree");
1786 /* So that we don't double-free in the finalizer: */
1787 Pool_val (poolv) = NULL;
1789 CAMLreturn (Val_unit);
1793 /* Automatically generated binding for virStoragePoolDestroy.
1794 * In generator.pl this function has signature "pool : free".
1797 #ifdef HAVE_WEAK_SYMBOLS
1798 #ifdef HAVE_VIRSTORAGEPOOLDESTROY
1799 extern int virStoragePoolDestroy (virStoragePoolPtr pool) __attribute__((weak));
1804 ocaml_libvirt_storage_pool_destroy (value poolv)
1807 #ifndef HAVE_VIRSTORAGEPOOLDESTROY
1808 /* Symbol virStoragePoolDestroy not found at compile time. */
1809 not_supported ("virStoragePoolDestroy");
1812 /* Check that the symbol virStoragePoolDestroy
1813 * is in runtime version of libvirt.
1815 WEAK_SYMBOL_CHECK (virStoragePoolDestroy);
1817 virStoragePoolPtr pool = Pool_val (poolv);
1818 virConnectPtr conn = Connect_polv (poolv);
1821 NONBLOCKING (r = virStoragePoolDestroy (pool));
1822 CHECK_ERROR (r == -1, conn, "virStoragePoolDestroy");
1824 /* So that we don't double-free in the finalizer: */
1825 Pool_val (poolv) = NULL;
1827 CAMLreturn (Val_unit);
1831 /* Automatically generated binding for virStoragePoolLookupByName.
1832 * In generator.pl this function has signature "conn, string : pool".
1835 #ifdef HAVE_WEAK_SYMBOLS
1836 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1837 extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak));
1842 ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
1844 CAMLparam2 (connv, strv);
1845 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
1846 /* Symbol virStoragePoolLookupByName not found at compile time. */
1847 not_supported ("virStoragePoolLookupByName");
1850 /* Check that the symbol virStoragePoolLookupByName
1851 * is in runtime version of libvirt.
1853 WEAK_SYMBOL_CHECK (virStoragePoolLookupByName);
1856 virConnectPtr conn = Connect_val (connv);
1857 char *str = String_val (strv);
1858 virStoragePoolPtr r;
1860 NONBLOCKING (r = virStoragePoolLookupByName (conn, str));
1861 CHECK_ERROR (!r, conn, "virStoragePoolLookupByName");
1863 rv = Val_pool (r, connv);
1869 /* Automatically generated binding for virStoragePoolLookupByUUID.
1870 * In generator.pl this function has signature "conn, uuid : pool".
1873 #ifdef HAVE_WEAK_SYMBOLS
1874 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1875 extern virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn, const unsigned char *str) __attribute__((weak));
1880 ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv)
1882 CAMLparam2 (connv, uuidv);
1883 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
1884 /* Symbol virStoragePoolLookupByUUID not found at compile time. */
1885 not_supported ("virStoragePoolLookupByUUID");
1888 /* Check that the symbol virStoragePoolLookupByUUID
1889 * is in runtime version of libvirt.
1891 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUID);
1894 virConnectPtr conn = Connect_val (connv);
1895 unsigned char *uuid = (unsigned char *) String_val (uuidv);
1896 virStoragePoolPtr r;
1898 NONBLOCKING (r = virStoragePoolLookupByUUID (conn, uuid));
1899 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUID");
1901 rv = Val_pool (r, connv);
1907 /* Automatically generated binding for virStoragePoolLookupByUUIDString.
1908 * In generator.pl this function has signature "conn, string : pool".
1911 #ifdef HAVE_WEAK_SYMBOLS
1912 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1913 extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak));
1918 ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv)
1920 CAMLparam2 (connv, strv);
1921 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
1922 /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */
1923 not_supported ("virStoragePoolLookupByUUIDString");
1926 /* Check that the symbol virStoragePoolLookupByUUIDString
1927 * is in runtime version of libvirt.
1929 WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUIDString);
1932 virConnectPtr conn = Connect_val (connv);
1933 char *str = String_val (strv);
1934 virStoragePoolPtr r;
1936 NONBLOCKING (r = virStoragePoolLookupByUUIDString (conn, str));
1937 CHECK_ERROR (!r, conn, "virStoragePoolLookupByUUIDString");
1939 rv = Val_pool (r, connv);
1945 /* Automatically generated binding for virStoragePoolGetName.
1946 * In generator.pl this function has signature "pool : static string".
1949 #ifdef HAVE_WEAK_SYMBOLS
1950 #ifdef HAVE_VIRSTORAGEPOOLGETNAME
1951 extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak));
1956 ocaml_libvirt_storage_pool_get_name (value poolv)
1959 #ifndef HAVE_VIRSTORAGEPOOLGETNAME
1960 /* Symbol virStoragePoolGetName not found at compile time. */
1961 not_supported ("virStoragePoolGetName");
1964 /* Check that the symbol virStoragePoolGetName
1965 * is in runtime version of libvirt.
1967 WEAK_SYMBOL_CHECK (virStoragePoolGetName);
1970 virStoragePoolPtr pool = Pool_val (poolv);
1971 virConnectPtr conn = Connect_polv (poolv);
1974 NONBLOCKING (r = virStoragePoolGetName (pool));
1975 CHECK_ERROR (!r, conn, "virStoragePoolGetName");
1977 rv = caml_copy_string (r);
1982 /* Automatically generated binding for virStoragePoolGetXMLDesc.
1983 * In generator.pl this function has signature "pool, 0U : string".
1986 #ifdef HAVE_WEAK_SYMBOLS
1987 #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
1988 extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
1993 ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
1996 #ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC
1997 /* Symbol virStoragePoolGetXMLDesc not found at compile time. */
1998 not_supported ("virStoragePoolGetXMLDesc");
2001 /* Check that the symbol virStoragePoolGetXMLDesc
2002 * is in runtime version of libvirt.
2004 WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc);
2007 virStoragePoolPtr pool = Pool_val (poolv);
2008 virConnectPtr conn = Connect_polv (poolv);
2011 NONBLOCKING (r = virStoragePoolGetXMLDesc (pool, 0));
2012 CHECK_ERROR (!r, conn, "virStoragePoolGetXMLDesc");
2014 rv = caml_copy_string (r);
2020 /* Automatically generated binding for virStoragePoolGetUUID.
2021 * In generator.pl this function has signature "pool : uuid".
2024 #ifdef HAVE_WEAK_SYMBOLS
2025 #ifdef HAVE_VIRSTORAGEPOOLGETUUID
2026 extern int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char *) __attribute__((weak));
2031 ocaml_libvirt_storage_pool_get_uuid (value poolv)
2034 #ifndef HAVE_VIRSTORAGEPOOLGETUUID
2035 /* Symbol virStoragePoolGetUUID not found at compile time. */
2036 not_supported ("virStoragePoolGetUUID");
2039 /* Check that the symbol virStoragePoolGetUUID
2040 * is in runtime version of libvirt.
2042 WEAK_SYMBOL_CHECK (virStoragePoolGetUUID);
2045 virStoragePoolPtr pool = Pool_val (poolv);
2046 virConnectPtr conn = Connect_polv (poolv);
2047 unsigned char uuid[VIR_UUID_BUFLEN];
2050 NONBLOCKING (r = virStoragePoolGetUUID (pool, uuid));
2051 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUID");
2053 /* UUIDs are byte arrays with a fixed length. */
2054 rv = caml_alloc_string (VIR_UUID_BUFLEN);
2055 memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
2060 /* Automatically generated binding for virStoragePoolGetUUIDString.
2061 * In generator.pl this function has signature "pool : uuid string".
2064 #ifdef HAVE_WEAK_SYMBOLS
2065 #ifdef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2066 extern int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char *) __attribute__((weak));
2071 ocaml_libvirt_storage_pool_get_uuid_string (value poolv)
2074 #ifndef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
2075 /* Symbol virStoragePoolGetUUIDString not found at compile time. */
2076 not_supported ("virStoragePoolGetUUIDString");
2079 /* Check that the symbol virStoragePoolGetUUIDString
2080 * is in runtime version of libvirt.
2082 WEAK_SYMBOL_CHECK (virStoragePoolGetUUIDString);
2085 virStoragePoolPtr pool = Pool_val (poolv);
2086 virConnectPtr conn = Connect_polv (poolv);
2087 char uuid[VIR_UUID_STRING_BUFLEN];
2090 NONBLOCKING (r = virStoragePoolGetUUIDString (pool, uuid));
2091 CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUIDString");
2093 rv = caml_copy_string (uuid);
2098 /* Automatically generated binding for virStoragePoolCreateXML.
2099 * In generator.pl this function has signature "conn, string, 0U : pool".
2102 #ifdef HAVE_WEAK_SYMBOLS
2103 #ifdef HAVE_VIRSTORAGEPOOLCREATEXML
2104 extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
2109 ocaml_libvirt_storage_pool_create_xml (value connv, value strv)
2111 CAMLparam2 (connv, strv);
2112 #ifndef HAVE_VIRSTORAGEPOOLCREATEXML
2113 /* Symbol virStoragePoolCreateXML not found at compile time. */
2114 not_supported ("virStoragePoolCreateXML");
2117 /* Check that the symbol virStoragePoolCreateXML
2118 * is in runtime version of libvirt.
2120 WEAK_SYMBOL_CHECK (virStoragePoolCreateXML);
2123 virConnectPtr conn = Connect_val (connv);
2124 char *str = String_val (strv);
2125 virStoragePoolPtr r;
2127 NONBLOCKING (r = virStoragePoolCreateXML (conn, str, 0));
2128 CHECK_ERROR (!r, conn, "virStoragePoolCreateXML");
2130 rv = Val_pool (r, connv);
2136 /* Automatically generated binding for virStoragePoolDefineXML.
2137 * In generator.pl this function has signature "conn, string, 0U : pool".
2140 #ifdef HAVE_WEAK_SYMBOLS
2141 #ifdef HAVE_VIRSTORAGEPOOLDEFINEXML
2142 extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
2147 ocaml_libvirt_storage_pool_define_xml (value connv, value strv)
2149 CAMLparam2 (connv, strv);
2150 #ifndef HAVE_VIRSTORAGEPOOLDEFINEXML
2151 /* Symbol virStoragePoolDefineXML not found at compile time. */
2152 not_supported ("virStoragePoolDefineXML");
2155 /* Check that the symbol virStoragePoolDefineXML
2156 * is in runtime version of libvirt.
2158 WEAK_SYMBOL_CHECK (virStoragePoolDefineXML);
2161 virConnectPtr conn = Connect_val (connv);
2162 char *str = String_val (strv);
2163 virStoragePoolPtr r;
2165 NONBLOCKING (r = virStoragePoolDefineXML (conn, str, 0));
2166 CHECK_ERROR (!r, conn, "virStoragePoolDefineXML");
2168 rv = Val_pool (r, connv);
2174 /* Automatically generated binding for virStoragePoolBuild.
2175 * In generator.pl this function has signature "pool, uint : unit".
2178 #ifdef HAVE_WEAK_SYMBOLS
2179 #ifdef HAVE_VIRSTORAGEPOOLBUILD
2180 extern int virStoragePoolBuild (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
2185 ocaml_libvirt_storage_pool_build (value poolv, value iv)
2187 CAMLparam2 (poolv, iv);
2188 #ifndef HAVE_VIRSTORAGEPOOLBUILD
2189 /* Symbol virStoragePoolBuild not found at compile time. */
2190 not_supported ("virStoragePoolBuild");
2193 /* Check that the symbol virStoragePoolBuild
2194 * is in runtime version of libvirt.
2196 WEAK_SYMBOL_CHECK (virStoragePoolBuild);
2198 virStoragePoolPtr pool = Pool_val (poolv);
2199 virConnectPtr conn = Connect_polv (poolv);
2200 unsigned int i = Int_val (iv);
2203 NONBLOCKING (r = virStoragePoolBuild (pool, i));
2204 CHECK_ERROR (!r, conn, "virStoragePoolBuild");
2206 CAMLreturn (Val_unit);
2210 /* Automatically generated binding for virStoragePoolUndefine.
2211 * In generator.pl this function has signature "pool : unit".
2214 #ifdef HAVE_WEAK_SYMBOLS
2215 #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
2216 extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
2221 ocaml_libvirt_storage_pool_undefine (value poolv)
2224 #ifndef HAVE_VIRSTORAGEPOOLUNDEFINE
2225 /* Symbol virStoragePoolUndefine not found at compile time. */
2226 not_supported ("virStoragePoolUndefine");
2229 /* Check that the symbol virStoragePoolUndefine
2230 * is in runtime version of libvirt.
2232 WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
2234 virStoragePoolPtr pool = Pool_val (poolv);
2235 virConnectPtr conn = Connect_polv (poolv);
2238 NONBLOCKING (r = virStoragePoolUndefine (pool));
2239 CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
2241 CAMLreturn (Val_unit);
2245 /* Automatically generated binding for virStoragePoolCreate.
2246 * In generator.pl this function has signature "pool, 0U : unit".
2249 #ifdef HAVE_WEAK_SYMBOLS
2250 #ifdef HAVE_VIRSTORAGEPOOLCREATE
2251 extern int virStoragePoolCreate (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
2256 ocaml_libvirt_storage_pool_create (value poolv)
2259 #ifndef HAVE_VIRSTORAGEPOOLCREATE
2260 /* Symbol virStoragePoolCreate not found at compile time. */
2261 not_supported ("virStoragePoolCreate");
2264 /* Check that the symbol virStoragePoolCreate
2265 * is in runtime version of libvirt.
2267 WEAK_SYMBOL_CHECK (virStoragePoolCreate);
2269 virStoragePoolPtr pool = Pool_val (poolv);
2270 virConnectPtr conn = Connect_polv (poolv);
2273 NONBLOCKING (r = virStoragePoolCreate (pool, 0));
2274 CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
2276 CAMLreturn (Val_unit);
2280 /* Automatically generated binding for virStoragePoolDelete.
2281 * In generator.pl this function has signature "pool, uint : unit".
2284 #ifdef HAVE_WEAK_SYMBOLS
2285 #ifdef HAVE_VIRSTORAGEPOOLDELETE
2286 extern int virStoragePoolDelete (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
2291 ocaml_libvirt_storage_pool_delete (value poolv, value iv)
2293 CAMLparam2 (poolv, iv);
2294 #ifndef HAVE_VIRSTORAGEPOOLDELETE
2295 /* Symbol virStoragePoolDelete not found at compile time. */
2296 not_supported ("virStoragePoolDelete");
2299 /* Check that the symbol virStoragePoolDelete
2300 * is in runtime version of libvirt.
2302 WEAK_SYMBOL_CHECK (virStoragePoolDelete);
2304 virStoragePoolPtr pool = Pool_val (poolv);
2305 virConnectPtr conn = Connect_polv (poolv);
2306 unsigned int i = Int_val (iv);
2309 NONBLOCKING (r = virStoragePoolDelete (pool, i));
2310 CHECK_ERROR (!r, conn, "virStoragePoolDelete");
2312 CAMLreturn (Val_unit);
2316 /* Automatically generated binding for virStoragePoolRefresh.
2317 * In generator.pl this function has signature "pool, 0U : unit".
2320 #ifdef HAVE_WEAK_SYMBOLS
2321 #ifdef HAVE_VIRSTORAGEPOOLREFRESH
2322 extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak));
2327 ocaml_libvirt_storage_pool_refresh (value poolv)
2330 #ifndef HAVE_VIRSTORAGEPOOLREFRESH
2331 /* Symbol virStoragePoolRefresh not found at compile time. */
2332 not_supported ("virStoragePoolRefresh");
2335 /* Check that the symbol virStoragePoolRefresh
2336 * is in runtime version of libvirt.
2338 WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
2340 virStoragePoolPtr pool = Pool_val (poolv);
2341 virConnectPtr conn = Connect_polv (poolv);
2344 NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
2345 CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
2347 CAMLreturn (Val_unit);
2351 /* Automatically generated binding for virStoragePoolGetAutostart.
2352 * In generator.pl this function has signature "pool : bool".
2355 #ifdef HAVE_WEAK_SYMBOLS
2356 #ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2357 extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak));
2362 ocaml_libvirt_storage_pool_get_autostart (value poolv)
2365 #ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
2366 /* Symbol virStoragePoolGetAutostart not found at compile time. */
2367 not_supported ("virStoragePoolGetAutostart");
2370 /* Check that the symbol virStoragePoolGetAutostart
2371 * is in runtime version of libvirt.
2373 WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
2375 virStoragePoolPtr pool = Pool_val (poolv);
2376 virConnectPtr conn = Connect_polv (poolv);
2379 NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
2380 CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
2382 CAMLreturn (b ? Val_true : Val_false);
2386 /* Automatically generated binding for virStoragePoolSetAutostart.
2387 * In generator.pl this function has signature "pool, bool : unit".
2390 #ifdef HAVE_WEAK_SYMBOLS
2391 #ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2392 extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak));
2397 ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
2399 CAMLparam2 (poolv, bv);
2400 #ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
2401 /* Symbol virStoragePoolSetAutostart not found at compile time. */
2402 not_supported ("virStoragePoolSetAutostart");
2405 /* Check that the symbol virStoragePoolSetAutostart
2406 * is in runtime version of libvirt.
2408 WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
2410 virStoragePoolPtr pool = Pool_val (poolv);
2411 virConnectPtr conn = Connect_polv (poolv);
2414 b = bv == Val_true ? 1 : 0;
2416 NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
2417 CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
2419 CAMLreturn (Val_unit);
2423 /* Automatically generated binding for virStoragePoolNumOfVolumes.
2424 * In generator.pl this function has signature "pool : int".
2427 #ifdef HAVE_WEAK_SYMBOLS
2428 #ifdef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
2429 extern int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) __attribute__((weak));
2434 ocaml_libvirt_storage_pool_num_of_volumes (value poolv)
2437 #ifndef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
2438 /* Symbol virStoragePoolNumOfVolumes not found at compile time. */
2439 not_supported ("virStoragePoolNumOfVolumes");
2442 /* Check that the symbol virStoragePoolNumOfVolumes
2443 * is in runtime version of libvirt.
2445 WEAK_SYMBOL_CHECK (virStoragePoolNumOfVolumes);
2447 virStoragePoolPtr pool = Pool_val (poolv);
2448 virConnectPtr conn = Connect_polv (poolv);
2451 NONBLOCKING (r = virStoragePoolNumOfVolumes (pool));
2452 CHECK_ERROR (r == -1, conn, "virStoragePoolNumOfVolumes");
2454 CAMLreturn (Val_int (r));
2458 /* Automatically generated binding for virStoragePoolListVolumes.
2459 * In generator.pl this function has signature "pool, int : string array".
2462 #ifdef HAVE_WEAK_SYMBOLS
2463 #ifdef HAVE_VIRSTORAGEPOOLLISTVOLUMES
2464 extern int virStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int maxnames) __attribute__((weak));
2469 ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv)
2471 CAMLparam2 (poolv, iv);
2472 #ifndef HAVE_VIRSTORAGEPOOLLISTVOLUMES
2473 /* Symbol virStoragePoolListVolumes not found at compile time. */
2474 not_supported ("virStoragePoolListVolumes");
2477 /* Check that the symbol virStoragePoolListVolumes
2478 * is in runtime version of libvirt.
2480 WEAK_SYMBOL_CHECK (virStoragePoolListVolumes);
2482 CAMLlocal2 (rv, strv);
2483 virStoragePoolPtr pool = Pool_val (poolv);
2484 virConnectPtr conn = Connect_polv (poolv);
2485 int i = Int_val (iv);
2489 /* Some libvirt List* functions still throw exceptions if i == 0,
2490 * so catch that and return an empty array directly. This changes
2491 * the semantics slightly (masking other failures) but it's
2492 * unlikely anyone will care. RWMJ 2008/06/10
2495 rv = caml_alloc (0, 0);
2499 NONBLOCKING (r = virStoragePoolListVolumes (pool, names, i));
2500 CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes");
2502 rv = caml_alloc (r, 0);
2503 for (i = 0; i < r; ++i) {
2504 strv = caml_copy_string (names[i]);
2505 Store_field (rv, i, strv);
2513 /* Automatically generated binding for virStorageVolFree.
2514 * In generator.pl this function has signature "vol : free".
2517 #ifdef HAVE_WEAK_SYMBOLS
2518 #ifdef HAVE_VIRSTORAGEVOLFREE
2519 extern int virStorageVolFree (virStorageVolPtr vol) __attribute__((weak));
2524 ocaml_libvirt_storage_vol_free (value volv)
2527 #ifndef HAVE_VIRSTORAGEVOLFREE
2528 /* Symbol virStorageVolFree not found at compile time. */
2529 not_supported ("virStorageVolFree");
2532 /* Check that the symbol virStorageVolFree
2533 * is in runtime version of libvirt.
2535 WEAK_SYMBOL_CHECK (virStorageVolFree);
2537 virStorageVolPtr vol = Volume_val (volv);
2538 virConnectPtr conn = Connect_volv (volv);
2541 NONBLOCKING (r = virStorageVolFree (vol));
2542 CHECK_ERROR (r == -1, conn, "virStorageVolFree");
2544 /* So that we don't double-free in the finalizer: */
2545 Volume_val (volv) = NULL;
2547 CAMLreturn (Val_unit);
2551 /* Automatically generated binding for virStorageVolDelete.
2552 * In generator.pl this function has signature "vol, uint : unit".
2555 #ifdef HAVE_WEAK_SYMBOLS
2556 #ifdef HAVE_VIRSTORAGEVOLDELETE
2557 extern int virStorageVolDelete (virStorageVolPtr vol, unsigned int i) __attribute__((weak));
2562 ocaml_libvirt_storage_vol_delete (value volv, value iv)
2564 CAMLparam2 (volv, iv);
2565 #ifndef HAVE_VIRSTORAGEVOLDELETE
2566 /* Symbol virStorageVolDelete not found at compile time. */
2567 not_supported ("virStorageVolDelete");
2570 /* Check that the symbol virStorageVolDelete
2571 * is in runtime version of libvirt.
2573 WEAK_SYMBOL_CHECK (virStorageVolDelete);
2575 virStorageVolPtr vol = Volume_val (volv);
2576 virConnectPtr conn = Connect_volv (volv);
2577 unsigned int i = Int_val (iv);
2580 NONBLOCKING (r = virStorageVolDelete (vol, i));
2581 CHECK_ERROR (!r, conn, "virStorageVolDelete");
2583 CAMLreturn (Val_unit);
2587 /* Automatically generated binding for virStorageVolLookupByName.
2588 * In generator.pl this function has signature "pool, string : vol from pool".
2591 #ifdef HAVE_WEAK_SYMBOLS
2592 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2593 extern virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool, const char *str) __attribute__((weak));
2598 ocaml_libvirt_storage_vol_lookup_by_name (value poolv, value strv)
2600 CAMLparam2 (poolv, strv);
2601 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
2602 /* Symbol virStorageVolLookupByName not found at compile time. */
2603 not_supported ("virStorageVolLookupByName");
2606 /* Check that the symbol virStorageVolLookupByName
2607 * is in runtime version of libvirt.
2609 WEAK_SYMBOL_CHECK (virStorageVolLookupByName);
2611 CAMLlocal2 (rv, connv);
2612 virStoragePoolPtr pool = Pool_val (poolv);
2613 virConnectPtr conn = Connect_polv (poolv);
2614 char *str = String_val (strv);
2617 NONBLOCKING (r = virStorageVolLookupByName (pool, str));
2618 CHECK_ERROR (!r, conn, "virStorageVolLookupByName");
2620 connv = Field (poolv, 1);
2621 rv = Val_volume (r, connv);
2627 /* Automatically generated binding for virStorageVolLookupByKey.
2628 * In generator.pl this function has signature "conn, string : vol".
2631 #ifdef HAVE_WEAK_SYMBOLS
2632 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2633 extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak));
2638 ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
2640 CAMLparam2 (connv, strv);
2641 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
2642 /* Symbol virStorageVolLookupByKey not found at compile time. */
2643 not_supported ("virStorageVolLookupByKey");
2646 /* Check that the symbol virStorageVolLookupByKey
2647 * is in runtime version of libvirt.
2649 WEAK_SYMBOL_CHECK (virStorageVolLookupByKey);
2652 virConnectPtr conn = Connect_val (connv);
2653 char *str = String_val (strv);
2656 NONBLOCKING (r = virStorageVolLookupByKey (conn, str));
2657 CHECK_ERROR (!r, conn, "virStorageVolLookupByKey");
2659 rv = Val_volume (r, connv);
2665 /* Automatically generated binding for virStorageVolLookupByPath.
2666 * In generator.pl this function has signature "conn, string : vol".
2669 #ifdef HAVE_WEAK_SYMBOLS
2670 #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2671 extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak));
2676 ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
2678 CAMLparam2 (connv, strv);
2679 #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
2680 /* Symbol virStorageVolLookupByPath not found at compile time. */
2681 not_supported ("virStorageVolLookupByPath");
2684 /* Check that the symbol virStorageVolLookupByPath
2685 * is in runtime version of libvirt.
2687 WEAK_SYMBOL_CHECK (virStorageVolLookupByPath);
2690 virConnectPtr conn = Connect_val (connv);
2691 char *str = String_val (strv);
2694 NONBLOCKING (r = virStorageVolLookupByPath (conn, str));
2695 CHECK_ERROR (!r, conn, "virStorageVolLookupByPath");
2697 rv = Val_volume (r, connv);
2703 /* Automatically generated binding for virStorageVolCreateXML.
2704 * In generator.pl this function has signature "pool, string, 0U : vol from pool".
2707 #ifdef HAVE_WEAK_SYMBOLS
2708 #ifdef HAVE_VIRSTORAGEVOLCREATEXML
2709 extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, unsigned int flags) __attribute__((weak));
2714 ocaml_libvirt_storage_vol_create_xml (value poolv, value strv)
2716 CAMLparam2 (poolv, strv);
2717 #ifndef HAVE_VIRSTORAGEVOLCREATEXML
2718 /* Symbol virStorageVolCreateXML not found at compile time. */
2719 not_supported ("virStorageVolCreateXML");
2722 /* Check that the symbol virStorageVolCreateXML
2723 * is in runtime version of libvirt.
2725 WEAK_SYMBOL_CHECK (virStorageVolCreateXML);
2727 CAMLlocal2 (rv, connv);
2728 virStoragePoolPtr pool = Pool_val (poolv);
2729 virConnectPtr conn = Connect_polv (poolv);
2730 char *str = String_val (strv);
2733 NONBLOCKING (r = virStorageVolCreateXML (pool, str, 0));
2734 CHECK_ERROR (!r, conn, "virStorageVolCreateXML");
2736 connv = Field (poolv, 1);
2737 rv = Val_volume (r, connv);
2743 /* Automatically generated binding for virStorageVolGetXMLDesc.
2744 * In generator.pl this function has signature "vol, 0U : string".
2747 #ifdef HAVE_WEAK_SYMBOLS
2748 #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
2749 extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, unsigned int flags) __attribute__((weak));
2754 ocaml_libvirt_storage_vol_get_xml_desc (value volv)
2757 #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
2758 /* Symbol virStorageVolGetXMLDesc not found at compile time. */
2759 not_supported ("virStorageVolGetXMLDesc");
2762 /* Check that the symbol virStorageVolGetXMLDesc
2763 * is in runtime version of libvirt.
2765 WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
2768 virStorageVolPtr vol = Volume_val (volv);
2769 virConnectPtr conn = Connect_volv (volv);
2772 NONBLOCKING (r = virStorageVolGetXMLDesc (vol, 0));
2773 CHECK_ERROR (!r, conn, "virStorageVolGetXMLDesc");
2775 rv = caml_copy_string (r);
2781 /* Automatically generated binding for virStorageVolGetPath.
2782 * In generator.pl this function has signature "vol : string".
2785 #ifdef HAVE_WEAK_SYMBOLS
2786 #ifdef HAVE_VIRSTORAGEVOLGETPATH
2787 extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak));
2792 ocaml_libvirt_storage_vol_get_path (value volv)
2795 #ifndef HAVE_VIRSTORAGEVOLGETPATH
2796 /* Symbol virStorageVolGetPath not found at compile time. */
2797 not_supported ("virStorageVolGetPath");
2800 /* Check that the symbol virStorageVolGetPath
2801 * is in runtime version of libvirt.
2803 WEAK_SYMBOL_CHECK (virStorageVolGetPath);
2806 virStorageVolPtr vol = Volume_val (volv);
2807 virConnectPtr conn = Connect_volv (volv);
2810 NONBLOCKING (r = virStorageVolGetPath (vol));
2811 CHECK_ERROR (!r, conn, "virStorageVolGetPath");
2813 rv = caml_copy_string (r);
2819 /* Automatically generated binding for virStorageVolGetKey.
2820 * In generator.pl this function has signature "vol : static string".
2823 #ifdef HAVE_WEAK_SYMBOLS
2824 #ifdef HAVE_VIRSTORAGEVOLGETKEY
2825 extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak));
2830 ocaml_libvirt_storage_vol_get_key (value volv)
2833 #ifndef HAVE_VIRSTORAGEVOLGETKEY
2834 /* Symbol virStorageVolGetKey not found at compile time. */
2835 not_supported ("virStorageVolGetKey");
2838 /* Check that the symbol virStorageVolGetKey
2839 * is in runtime version of libvirt.
2841 WEAK_SYMBOL_CHECK (virStorageVolGetKey);
2844 virStorageVolPtr vol = Volume_val (volv);
2845 virConnectPtr conn = Connect_volv (volv);
2848 NONBLOCKING (r = virStorageVolGetKey (vol));
2849 CHECK_ERROR (!r, conn, "virStorageVolGetKey");
2851 rv = caml_copy_string (r);
2856 /* Automatically generated binding for virStorageVolGetName.
2857 * In generator.pl this function has signature "vol : static string".
2860 #ifdef HAVE_WEAK_SYMBOLS
2861 #ifdef HAVE_VIRSTORAGEVOLGETNAME
2862 extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak));
2867 ocaml_libvirt_storage_vol_get_name (value volv)
2870 #ifndef HAVE_VIRSTORAGEVOLGETNAME
2871 /* Symbol virStorageVolGetName not found at compile time. */
2872 not_supported ("virStorageVolGetName");
2875 /* Check that the symbol virStorageVolGetName
2876 * is in runtime version of libvirt.
2878 WEAK_SYMBOL_CHECK (virStorageVolGetName);
2881 virStorageVolPtr vol = Volume_val (volv);
2882 virConnectPtr conn = Connect_volv (volv);
2885 NONBLOCKING (r = virStorageVolGetName (vol));
2886 CHECK_ERROR (!r, conn, "virStorageVolGetName");
2888 rv = caml_copy_string (r);
2893 /* Automatically generated binding for virStoragePoolLookupByVolume.
2894 * In generator.pl this function has signature "vol : pool from vol".
2897 #ifdef HAVE_WEAK_SYMBOLS
2898 #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2899 extern virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) __attribute__((weak));
2904 ocaml_libvirt_storage_pool_lookup_by_volume (value volv)
2907 #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
2908 /* Symbol virStoragePoolLookupByVolume not found at compile time. */
2909 not_supported ("virStoragePoolLookupByVolume");
2912 /* Check that the symbol virStoragePoolLookupByVolume
2913 * is in runtime version of libvirt.
2915 WEAK_SYMBOL_CHECK (virStoragePoolLookupByVolume);
2917 CAMLlocal2 (rv, connv);
2918 virStorageVolPtr vol = Volume_val (volv);
2919 virConnectPtr conn = Connect_volv (volv);
2920 virStoragePoolPtr r;
2922 NONBLOCKING (r = virStoragePoolLookupByVolume (vol));
2923 CHECK_ERROR (!r, conn, "virStoragePoolLookupByVolume");
2925 connv = Field (volv, 1);
2926 rv = Val_pool (r, connv);
2932 /* Automatically generated binding for virJobFree.
2933 * In generator.pl this function has signature "job : free".
2936 #ifdef HAVE_WEAK_SYMBOLS
2937 #ifdef HAVE_VIRJOBFREE
2938 extern int virJobFree (virJobPtr job) __attribute__((weak));
2943 ocaml_libvirt_job_free (value jobv)
2946 #ifndef HAVE_VIRJOBFREE
2947 /* Symbol virJobFree not found at compile time. */
2948 not_supported ("virJobFree");
2951 /* Check that the symbol virJobFree
2952 * is in runtime version of libvirt.
2954 WEAK_SYMBOL_CHECK (virJobFree);
2956 virJobPtr job = Job_val (jobv);
2957 virConnectPtr conn = Connect_jobv (jobv);
2960 NONBLOCKING (r = virJobFree (job));
2961 CHECK_ERROR (r == -1, conn, "virJobFree");
2963 /* So that we don't double-free in the finalizer: */
2964 Job_val (jobv) = NULL;
2966 CAMLreturn (Val_unit);
2970 /* Automatically generated binding for virJobCancel.
2971 * In generator.pl this function has signature "job : unit".
2974 #ifdef HAVE_WEAK_SYMBOLS
2975 #ifdef HAVE_VIRJOBCANCEL
2976 extern int virJobCancel (virJobPtr job) __attribute__((weak));
2981 ocaml_libvirt_job_cancel (value jobv)
2984 #ifndef HAVE_VIRJOBCANCEL
2985 /* Symbol virJobCancel not found at compile time. */
2986 not_supported ("virJobCancel");
2989 /* Check that the symbol virJobCancel
2990 * is in runtime version of libvirt.
2992 WEAK_SYMBOL_CHECK (virJobCancel);
2994 virJobPtr job = Job_val (jobv);
2995 virConnectPtr conn = Connect_jobv (jobv);
2998 NONBLOCKING (r = virJobCancel (job));
2999 CHECK_ERROR (r == -1, conn, "virJobCancel");
3001 CAMLreturn (Val_unit);
3005 /* Automatically generated binding for virJobGetNetwork.
3006 * In generator.pl this function has signature "job : net from job".
3009 #ifdef HAVE_WEAK_SYMBOLS
3010 #ifdef HAVE_VIRJOBGETNETWORK
3011 extern virNetworkPtr virJobGetNetwork (virJobPtr job) __attribute__((weak));
3016 ocaml_libvirt_job_get_network (value jobv)
3019 #ifndef HAVE_VIRJOBGETNETWORK
3020 /* Symbol virJobGetNetwork not found at compile time. */
3021 not_supported ("virJobGetNetwork");
3024 /* Check that the symbol virJobGetNetwork
3025 * is in runtime version of libvirt.
3027 WEAK_SYMBOL_CHECK (virJobGetNetwork);
3029 CAMLlocal2 (rv, connv);
3030 virJobPtr job = Job_val (jobv);
3031 virConnectPtr conn = Connect_jobv (jobv);
3034 NONBLOCKING (r = virJobGetNetwork (job));
3035 CHECK_ERROR (!r, conn, "virJobGetNetwork");
3037 connv = Field (jobv, 1);
3038 rv = Val_network (r, connv);
3044 /* Automatically generated binding for virJobGetDomain.
3045 * In generator.pl this function has signature "job : dom from job".
3048 #ifdef HAVE_WEAK_SYMBOLS
3049 #ifdef HAVE_VIRJOBGETDOMAIN
3050 extern virDomainPtr virJobGetDomain (virJobPtr job) __attribute__((weak));
3055 ocaml_libvirt_job_get_domain (value jobv)
3058 #ifndef HAVE_VIRJOBGETDOMAIN
3059 /* Symbol virJobGetDomain not found at compile time. */
3060 not_supported ("virJobGetDomain");
3063 /* Check that the symbol virJobGetDomain
3064 * is in runtime version of libvirt.
3066 WEAK_SYMBOL_CHECK (virJobGetDomain);
3068 CAMLlocal2 (rv, connv);
3069 virJobPtr job = Job_val (jobv);
3070 virConnectPtr conn = Connect_jobv (jobv);
3073 NONBLOCKING (r = virJobGetDomain (job));
3074 CHECK_ERROR (!r, conn, "virJobGetDomain");
3076 connv = Field (jobv, 1);
3077 rv = Val_domain (r, connv);
3083 #include "libvirt_c_epilogue.c"