X-Git-Url: http://git.annexia.org/?p=virt-top.git;a=blobdiff_plain;f=libvirt%2Flibvirt_c.c;h=ca7f30350598931eea001907d63942aba3670245;hp=ef674c73ccc701410a4c5ff0190d7e8367482fe5;hb=0bdb08c61ec66a16a81c2778a2a76cac77b08fda;hpb=4696e201fac1d3138fa583229ffa93478a1dea1d diff --git a/libvirt/libvirt_c.c b/libvirt/libvirt_c.c index ef674c7..ca7f303 100644 --- a/libvirt/libvirt_c.c +++ b/libvirt/libvirt_c.c @@ -47,6 +47,10 @@ #include "libvirt_c_oneoffs.c" +/* Automatically generated binding for virConnectClose. + * In generator.pl this function has signature "conn : free". + */ + CAMLprim value ocaml_libvirt_connect_close (value connv) { @@ -64,6 +68,10 @@ ocaml_libvirt_connect_close (value connv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virConnectGetHostname. + * In generator.pl this function has signature "conn : string". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRCONNECTGETHOSTNAME extern char *virConnectGetHostname (virConnectPtr conn) __attribute__((weak)); @@ -77,8 +85,7 @@ ocaml_libvirt_connect_get_hostname (value connv) #ifndef HAVE_VIRCONNECTGETHOSTNAME /* Symbol virConnectGetHostname not found at compile time. */ not_supported ("virConnectGetHostname"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virConnectGetHostname * is in runtime version of libvirt. @@ -98,6 +105,10 @@ ocaml_libvirt_connect_get_hostname (value connv) #endif } +/* Automatically generated binding for virConnectGetURI. + * In generator.pl this function has signature "conn : string". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRCONNECTGETURI extern char *virConnectGetURI (virConnectPtr conn) __attribute__((weak)); @@ -111,8 +122,7 @@ ocaml_libvirt_connect_get_uri (value connv) #ifndef HAVE_VIRCONNECTGETURI /* Symbol virConnectGetURI not found at compile time. */ not_supported ("virConnectGetURI"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virConnectGetURI * is in runtime version of libvirt. @@ -132,6 +142,10 @@ ocaml_libvirt_connect_get_uri (value connv) #endif } +/* Automatically generated binding for virConnectGetType. + * In generator.pl this function has signature "conn : static string". + */ + CAMLprim value ocaml_libvirt_connect_get_type (value connv) { @@ -148,6 +162,10 @@ ocaml_libvirt_connect_get_type (value connv) CAMLreturn (rv); } +/* Automatically generated binding for virConnectNumOfDomains. + * In generator.pl this function has signature "conn : int". + */ + CAMLprim value ocaml_libvirt_connect_num_of_domains (value connv) { @@ -162,6 +180,10 @@ ocaml_libvirt_connect_num_of_domains (value connv) CAMLreturn (Val_int (r)); } +/* Automatically generated binding for virConnectListDomains. + * In generator.pl this function has signature "conn, int : int array". + */ + CAMLprim value ocaml_libvirt_connect_list_domains (value connv, value iv) { @@ -182,6 +204,10 @@ ocaml_libvirt_connect_list_domains (value connv, value iv) CAMLreturn (rv); } +/* Automatically generated binding for virConnectNumOfDefinedDomains. + * In generator.pl this function has signature "conn : int". + */ + CAMLprim value ocaml_libvirt_connect_num_of_defined_domains (value connv) { @@ -196,6 +222,10 @@ ocaml_libvirt_connect_num_of_defined_domains (value connv) CAMLreturn (Val_int (r)); } +/* Automatically generated binding for virConnectListDefinedDomains. + * In generator.pl this function has signature "conn, int : string array". + */ + CAMLprim value ocaml_libvirt_connect_list_defined_domains (value connv, value iv) { @@ -220,6 +250,10 @@ ocaml_libvirt_connect_list_defined_domains (value connv, value iv) CAMLreturn (rv); } +/* Automatically generated binding for virConnectNumOfNetworks. + * In generator.pl this function has signature "conn : int". + */ + CAMLprim value ocaml_libvirt_connect_num_of_networks (value connv) { @@ -234,6 +268,10 @@ ocaml_libvirt_connect_num_of_networks (value connv) CAMLreturn (Val_int (r)); } +/* Automatically generated binding for virConnectListNetworks. + * In generator.pl this function has signature "conn, int : string array". + */ + CAMLprim value ocaml_libvirt_connect_list_networks (value connv, value iv) { @@ -258,6 +296,10 @@ ocaml_libvirt_connect_list_networks (value connv, value iv) CAMLreturn (rv); } +/* Automatically generated binding for virConnectNumOfDefinedNetworks. + * In generator.pl this function has signature "conn : int". + */ + CAMLprim value ocaml_libvirt_connect_num_of_defined_networks (value connv) { @@ -272,6 +314,10 @@ ocaml_libvirt_connect_num_of_defined_networks (value connv) CAMLreturn (Val_int (r)); } +/* Automatically generated binding for virConnectListDefinedNetworks. + * In generator.pl this function has signature "conn, int : string array". + */ + CAMLprim value ocaml_libvirt_connect_list_defined_networks (value connv, value iv) { @@ -296,6 +342,10 @@ ocaml_libvirt_connect_list_defined_networks (value connv, value iv) CAMLreturn (rv); } +/* Automatically generated binding for virConnectNumOfStoragePools. + * In generator.pl this function has signature "conn : int". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak)); @@ -309,8 +359,7 @@ ocaml_libvirt_connect_num_of_storage_pools (value connv) #ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS /* Symbol virConnectNumOfStoragePools not found at compile time. */ not_supported ("virConnectNumOfStoragePools"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virConnectNumOfStoragePools * is in runtime version of libvirt. @@ -327,6 +376,10 @@ ocaml_libvirt_connect_num_of_storage_pools (value connv) #endif } +/* Automatically generated binding for virConnectListStoragePools. + * In generator.pl this function has signature "conn, int : string array". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak)); @@ -340,8 +393,7 @@ ocaml_libvirt_connect_list_storage_pools (value connv, value iv) #ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS /* Symbol virConnectListStoragePools not found at compile time. */ not_supported ("virConnectListStoragePools"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virConnectListStoragePools * is in runtime version of libvirt. @@ -368,6 +420,10 @@ ocaml_libvirt_connect_list_storage_pools (value connv, value iv) #endif } +/* Automatically generated binding for virConnectNumOfDefinedStoragePools. + * In generator.pl this function has signature "conn : int". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak)); @@ -381,8 +437,7 @@ ocaml_libvirt_connect_num_of_defined_storage_pools (value connv) #ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */ not_supported ("virConnectNumOfDefinedStoragePools"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virConnectNumOfDefinedStoragePools * is in runtime version of libvirt. @@ -399,6 +454,10 @@ ocaml_libvirt_connect_num_of_defined_storage_pools (value connv) #endif } +/* Automatically generated binding for virConnectListDefinedStoragePools. + * In generator.pl this function has signature "conn, int : string array". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak)); @@ -412,8 +471,7 @@ ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv) #ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS /* Symbol virConnectListDefinedStoragePools not found at compile time. */ not_supported ("virConnectListDefinedStoragePools"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virConnectListDefinedStoragePools * is in runtime version of libvirt. @@ -440,6 +498,10 @@ ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv) #endif } +/* Automatically generated binding for virConnectGetCapabilities. + * In generator.pl this function has signature "conn : string". + */ + CAMLprim value ocaml_libvirt_connect_get_capabilities (value connv) { @@ -457,6 +519,10 @@ ocaml_libvirt_connect_get_capabilities (value connv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainCreateLinux. + * In generator.pl this function has signature "conn, string, 0U : dom". + */ + CAMLprim value ocaml_libvirt_domain_create_linux (value connv, value strv) { @@ -475,10 +541,29 @@ ocaml_libvirt_domain_create_linux (value connv, value strv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainCreateLinuxJob. + * In generator.pl this function has signature "conn, string, 0U : job". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINCREATELINUXJOB +extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak)); +#endif +#endif + CAMLprim value ocaml_libvirt_domain_create_linux_job (value connv, value strv) { CAMLparam2 (connv, strv); +#ifndef HAVE_VIRDOMAINCREATELINUXJOB + /* Symbol virDomainCreateLinuxJob not found at compile time. */ + not_supported ("virDomainCreateLinuxJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainCreateLinuxJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainCreateLinuxJob); CAMLlocal1 (rv); virConnectPtr conn = Connect_val (connv); @@ -491,8 +576,13 @@ ocaml_libvirt_domain_create_linux_job (value connv, value strv) rv = Val_job (r, connv); CAMLreturn (rv); +#endif } +/* Automatically generated binding for virDomainFree. + * In generator.pl this function has signature "dom : free". + */ + CAMLprim value ocaml_libvirt_domain_free (value domv) { @@ -511,6 +601,10 @@ ocaml_libvirt_domain_free (value domv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainDestroy. + * In generator.pl this function has signature "dom : free". + */ + CAMLprim value ocaml_libvirt_domain_destroy (value domv) { @@ -529,6 +623,10 @@ ocaml_libvirt_domain_destroy (value domv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainLookupByName. + * In generator.pl this function has signature "conn, string : dom". + */ + CAMLprim value ocaml_libvirt_domain_lookup_by_name (value connv, value strv) { @@ -547,6 +645,10 @@ ocaml_libvirt_domain_lookup_by_name (value connv, value strv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainLookupByID. + * In generator.pl this function has signature "conn, int : dom". + */ + CAMLprim value ocaml_libvirt_domain_lookup_by_id (value connv, value iv) { @@ -565,6 +667,10 @@ ocaml_libvirt_domain_lookup_by_id (value connv, value iv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainLookupByUUID. + * In generator.pl this function has signature "conn, uuid : dom". + */ + CAMLprim value ocaml_libvirt_domain_lookup_by_uuid (value connv, value uuidv) { @@ -583,6 +689,10 @@ ocaml_libvirt_domain_lookup_by_uuid (value connv, value uuidv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainLookupByUUIDString. + * In generator.pl this function has signature "conn, string : dom". + */ + CAMLprim value ocaml_libvirt_domain_lookup_by_uuid_string (value connv, value strv) { @@ -601,6 +711,10 @@ ocaml_libvirt_domain_lookup_by_uuid_string (value connv, value strv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainGetName. + * In generator.pl this function has signature "dom : static string". + */ + CAMLprim value ocaml_libvirt_domain_get_name (value domv) { @@ -618,6 +732,10 @@ ocaml_libvirt_domain_get_name (value domv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainGetOSType. + * In generator.pl this function has signature "dom : string". + */ + CAMLprim value ocaml_libvirt_domain_get_os_type (value domv) { @@ -636,6 +754,10 @@ ocaml_libvirt_domain_get_os_type (value domv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainGetXMLDesc. + * In generator.pl this function has signature "dom, 0 : string". + */ + CAMLprim value ocaml_libvirt_domain_get_xml_desc (value domv) { @@ -654,6 +776,10 @@ ocaml_libvirt_domain_get_xml_desc (value domv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainGetUUID. + * In generator.pl this function has signature "dom : uuid". + */ + CAMLprim value ocaml_libvirt_domain_get_uuid (value domv) { @@ -668,10 +794,16 @@ ocaml_libvirt_domain_get_uuid (value domv) NONBLOCKING (r = virDomainGetUUID (dom, uuid)); CHECK_ERROR (r == -1, conn, "virDomainGetUUID"); - rv = caml_copy_string ((char *) uuid); + /* UUIDs are byte arrays with a fixed length. */ + rv = caml_alloc_string (VIR_UUID_BUFLEN); + memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN); CAMLreturn (rv); } +/* Automatically generated binding for virDomainGetUUIDString. + * In generator.pl this function has signature "dom : uuid string". + */ + CAMLprim value ocaml_libvirt_domain_get_uuid_string (value domv) { @@ -690,6 +822,10 @@ ocaml_libvirt_domain_get_uuid_string (value domv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainGetMaxVcpus. + * In generator.pl this function has signature "dom : int". + */ + CAMLprim value ocaml_libvirt_domain_get_max_vcpus (value domv) { @@ -705,12 +841,15 @@ ocaml_libvirt_domain_get_max_vcpus (value domv) CAMLreturn (Val_int (r)); } +/* Automatically generated binding for virDomainSave. + * In generator.pl this function has signature "dom, string : unit". + */ + CAMLprim value ocaml_libvirt_domain_save (value domv, value strv) { CAMLparam2 (domv, strv); - CAMLlocal1 (rv); virDomainPtr dom = Domain_val (domv); virConnectPtr conn = Connect_domv (domv); char *str = String_val (strv); @@ -722,10 +861,29 @@ ocaml_libvirt_domain_save (value domv, value strv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainSaveJob. + * In generator.pl this function has signature "dom, string : job from dom". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINSAVEJOB +extern virJobPtr virDomainSaveJob (virDomainPtr dom, const char *str) __attribute__((weak)); +#endif +#endif + CAMLprim value ocaml_libvirt_domain_save_job (value domv, value strv) { CAMLparam2 (domv, strv); +#ifndef HAVE_VIRDOMAINSAVEJOB + /* Symbol virDomainSaveJob not found at compile time. */ + not_supported ("virDomainSaveJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainSaveJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainSaveJob); CAMLlocal2 (rv, connv); virDomainPtr dom = Domain_val (domv); @@ -740,14 +898,18 @@ ocaml_libvirt_domain_save_job (value domv, value strv) rv = Val_job (r, connv); CAMLreturn (rv); +#endif } +/* Automatically generated binding for virDomainRestore. + * In generator.pl this function has signature "conn, string : unit". + */ + CAMLprim value ocaml_libvirt_domain_restore (value connv, value strv) { CAMLparam2 (connv, strv); - CAMLlocal1 (rv); virConnectPtr conn = Connect_val (connv); char *str = String_val (strv); int r; @@ -758,10 +920,29 @@ ocaml_libvirt_domain_restore (value connv, value strv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainRestoreJob. + * In generator.pl this function has signature "conn, string : job". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINRESTOREJOB +extern virJobPtr virDomainRestoreJob (virConnectPtr conn, const char *str) __attribute__((weak)); +#endif +#endif + CAMLprim value ocaml_libvirt_domain_restore_job (value connv, value strv) { CAMLparam2 (connv, strv); +#ifndef HAVE_VIRDOMAINRESTOREJOB + /* Symbol virDomainRestoreJob not found at compile time. */ + not_supported ("virDomainRestoreJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainRestoreJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainRestoreJob); CAMLlocal1 (rv); virConnectPtr conn = Connect_val (connv); @@ -774,8 +955,13 @@ ocaml_libvirt_domain_restore_job (value connv, value strv) rv = Val_job (r, connv); CAMLreturn (rv); +#endif } +/* Automatically generated binding for virDomainCoreDump. + * In generator.pl this function has signature "dom, string, 0 : unit". + */ + CAMLprim value ocaml_libvirt_domain_core_dump (value domv, value strv) { @@ -793,10 +979,29 @@ ocaml_libvirt_domain_core_dump (value domv, value strv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainCoreDumpJob. + * In generator.pl this function has signature "dom, string, 0 : job from dom". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINCOREDUMPJOB +extern virJobPtr virDomainCoreDumpJob (virDomainPtr dom, const char *str, int flags) __attribute__((weak)); +#endif +#endif + CAMLprim value ocaml_libvirt_domain_core_dump_job (value domv, value strv) { CAMLparam2 (domv, strv); +#ifndef HAVE_VIRDOMAINCOREDUMPJOB + /* Symbol virDomainCoreDumpJob not found at compile time. */ + not_supported ("virDomainCoreDumpJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainCoreDumpJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainCoreDumpJob); CAMLlocal2 (rv, connv); virDomainPtr dom = Domain_val (domv); @@ -811,8 +1016,13 @@ ocaml_libvirt_domain_core_dump_job (value domv, value strv) rv = Val_job (r, connv); CAMLreturn (rv); +#endif } +/* Automatically generated binding for virDomainSuspend. + * In generator.pl this function has signature "dom : unit". + */ + CAMLprim value ocaml_libvirt_domain_suspend (value domv) { @@ -828,6 +1038,10 @@ ocaml_libvirt_domain_suspend (value domv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainResume. + * In generator.pl this function has signature "dom : unit". + */ + CAMLprim value ocaml_libvirt_domain_resume (value domv) { @@ -843,6 +1057,10 @@ ocaml_libvirt_domain_resume (value domv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainShutdown. + * In generator.pl this function has signature "dom : unit". + */ + CAMLprim value ocaml_libvirt_domain_shutdown (value domv) { @@ -858,6 +1076,10 @@ ocaml_libvirt_domain_shutdown (value domv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainReboot. + * In generator.pl this function has signature "dom, 0 : unit". + */ + CAMLprim value ocaml_libvirt_domain_reboot (value domv) { @@ -873,6 +1095,10 @@ ocaml_libvirt_domain_reboot (value domv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainDefineXML. + * In generator.pl this function has signature "conn, string : dom". + */ + CAMLprim value ocaml_libvirt_domain_define_xml (value connv, value strv) { @@ -891,6 +1117,10 @@ ocaml_libvirt_domain_define_xml (value connv, value strv) CAMLreturn (rv); } +/* Automatically generated binding for virDomainUndefine. + * In generator.pl this function has signature "dom : unit". + */ + CAMLprim value ocaml_libvirt_domain_undefine (value domv) { @@ -906,6 +1136,10 @@ ocaml_libvirt_domain_undefine (value domv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainCreate. + * In generator.pl this function has signature "dom : unit". + */ + CAMLprim value ocaml_libvirt_domain_create (value domv) { @@ -921,10 +1155,29 @@ ocaml_libvirt_domain_create (value domv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainCreateJob. + * In generator.pl this function has signature "dom, 0U : job from dom". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRDOMAINCREATEJOB +extern virJobPtr virDomainCreateJob (virDomainPtr dom, unsigned int flags) __attribute__((weak)); +#endif +#endif + CAMLprim value ocaml_libvirt_domain_create_job (value domv) { CAMLparam1 (domv); +#ifndef HAVE_VIRDOMAINCREATEJOB + /* Symbol virDomainCreateJob not found at compile time. */ + not_supported ("virDomainCreateJob"); + CAMLnoreturn; +#else + /* Check that the symbol virDomainCreateJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virDomainCreateJob); CAMLlocal2 (rv, connv); virDomainPtr dom = Domain_val (domv); @@ -938,14 +1191,18 @@ ocaml_libvirt_domain_create_job (value domv) rv = Val_job (r, connv); CAMLreturn (rv); +#endif } +/* Automatically generated binding for virDomainAttachDevice. + * In generator.pl this function has signature "dom, string : unit". + */ + CAMLprim value ocaml_libvirt_domain_attach_device (value domv, value strv) { CAMLparam2 (domv, strv); - CAMLlocal1 (rv); virDomainPtr dom = Domain_val (domv); virConnectPtr conn = Connect_domv (domv); char *str = String_val (strv); @@ -957,12 +1214,15 @@ ocaml_libvirt_domain_attach_device (value domv, value strv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainDetachDevice. + * In generator.pl this function has signature "dom, string : unit". + */ + CAMLprim value ocaml_libvirt_domain_detach_device (value domv, value strv) { CAMLparam2 (domv, strv); - CAMLlocal1 (rv); virDomainPtr dom = Domain_val (domv); virConnectPtr conn = Connect_domv (domv); char *str = String_val (strv); @@ -974,6 +1234,10 @@ ocaml_libvirt_domain_detach_device (value domv, value strv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virDomainGetAutostart. + * In generator.pl this function has signature "dom : bool". + */ + CAMLprim value ocaml_libvirt_domain_get_autostart (value domv) { @@ -989,6 +1253,10 @@ ocaml_libvirt_domain_get_autostart (value domv) CAMLreturn (b ? Val_true : Val_false); } +/* Automatically generated binding for virDomainSetAutostart. + * In generator.pl this function has signature "dom, bool : unit". + */ + CAMLprim value ocaml_libvirt_domain_set_autostart (value domv, value bv) { @@ -1006,6 +1274,10 @@ ocaml_libvirt_domain_set_autostart (value domv, value bv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virNetworkFree. + * In generator.pl this function has signature "net : free". + */ + CAMLprim value ocaml_libvirt_network_free (value netv) { @@ -1024,6 +1296,10 @@ ocaml_libvirt_network_free (value netv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virNetworkDestroy. + * In generator.pl this function has signature "net : free". + */ + CAMLprim value ocaml_libvirt_network_destroy (value netv) { @@ -1042,6 +1318,10 @@ ocaml_libvirt_network_destroy (value netv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virNetworkLookupByName. + * In generator.pl this function has signature "conn, string : net". + */ + CAMLprim value ocaml_libvirt_network_lookup_by_name (value connv, value strv) { @@ -1060,6 +1340,10 @@ ocaml_libvirt_network_lookup_by_name (value connv, value strv) CAMLreturn (rv); } +/* Automatically generated binding for virNetworkLookupByUUID. + * In generator.pl this function has signature "conn, uuid : net". + */ + CAMLprim value ocaml_libvirt_network_lookup_by_uuid (value connv, value uuidv) { @@ -1078,6 +1362,10 @@ ocaml_libvirt_network_lookup_by_uuid (value connv, value uuidv) CAMLreturn (rv); } +/* Automatically generated binding for virNetworkLookupByUUIDString. + * In generator.pl this function has signature "conn, string : net". + */ + CAMLprim value ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv) { @@ -1096,6 +1384,10 @@ ocaml_libvirt_network_lookup_by_uuid_string (value connv, value strv) CAMLreturn (rv); } +/* Automatically generated binding for virNetworkGetName. + * In generator.pl this function has signature "net : static string". + */ + CAMLprim value ocaml_libvirt_network_get_name (value netv) { @@ -1113,6 +1405,10 @@ ocaml_libvirt_network_get_name (value netv) CAMLreturn (rv); } +/* Automatically generated binding for virNetworkGetXMLDesc. + * In generator.pl this function has signature "net, 0 : string". + */ + CAMLprim value ocaml_libvirt_network_get_xml_desc (value netv) { @@ -1131,6 +1427,10 @@ ocaml_libvirt_network_get_xml_desc (value netv) CAMLreturn (rv); } +/* Automatically generated binding for virNetworkGetBridgeName. + * In generator.pl this function has signature "net : string". + */ + CAMLprim value ocaml_libvirt_network_get_bridge_name (value netv) { @@ -1149,6 +1449,10 @@ ocaml_libvirt_network_get_bridge_name (value netv) CAMLreturn (rv); } +/* Automatically generated binding for virNetworkGetUUID. + * In generator.pl this function has signature "net : uuid". + */ + CAMLprim value ocaml_libvirt_network_get_uuid (value netv) { @@ -1163,10 +1467,16 @@ ocaml_libvirt_network_get_uuid (value netv) NONBLOCKING (r = virNetworkGetUUID (net, uuid)); CHECK_ERROR (r == -1, conn, "virNetworkGetUUID"); - rv = caml_copy_string ((char *) uuid); + /* UUIDs are byte arrays with a fixed length. */ + rv = caml_alloc_string (VIR_UUID_BUFLEN); + memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN); CAMLreturn (rv); } +/* Automatically generated binding for virNetworkGetUUIDString. + * In generator.pl this function has signature "net : uuid string". + */ + CAMLprim value ocaml_libvirt_network_get_uuid_string (value netv) { @@ -1185,6 +1495,10 @@ ocaml_libvirt_network_get_uuid_string (value netv) CAMLreturn (rv); } +/* Automatically generated binding for virNetworkUndefine. + * In generator.pl this function has signature "net : unit". + */ + CAMLprim value ocaml_libvirt_network_undefine (value netv) { @@ -1200,6 +1514,10 @@ ocaml_libvirt_network_undefine (value netv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virNetworkCreateXML. + * In generator.pl this function has signature "conn, string : net". + */ + CAMLprim value ocaml_libvirt_network_create_xml (value connv, value strv) { @@ -1218,10 +1536,29 @@ ocaml_libvirt_network_create_xml (value connv, value strv) CAMLreturn (rv); } +/* Automatically generated binding for virNetworkCreateXMLJob. + * In generator.pl this function has signature "conn, string : job". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRNETWORKCREATEXMLJOB +extern virJobPtr virNetworkCreateXMLJob (virConnectPtr conn, const char *str) __attribute__((weak)); +#endif +#endif + CAMLprim value ocaml_libvirt_network_create_xml_job (value connv, value strv) { CAMLparam2 (connv, strv); +#ifndef HAVE_VIRNETWORKCREATEXMLJOB + /* Symbol virNetworkCreateXMLJob not found at compile time. */ + not_supported ("virNetworkCreateXMLJob"); + CAMLnoreturn; +#else + /* Check that the symbol virNetworkCreateXMLJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virNetworkCreateXMLJob); CAMLlocal1 (rv); virConnectPtr conn = Connect_val (connv); @@ -1234,8 +1571,13 @@ ocaml_libvirt_network_create_xml_job (value connv, value strv) rv = Val_job (r, connv); CAMLreturn (rv); +#endif } +/* Automatically generated binding for virNetworkDefineXML. + * In generator.pl this function has signature "conn, string : net". + */ + CAMLprim value ocaml_libvirt_network_define_xml (value connv, value strv) { @@ -1254,6 +1596,10 @@ ocaml_libvirt_network_define_xml (value connv, value strv) CAMLreturn (rv); } +/* Automatically generated binding for virNetworkCreate. + * In generator.pl this function has signature "net : unit". + */ + CAMLprim value ocaml_libvirt_network_create (value netv) { @@ -1269,10 +1615,29 @@ ocaml_libvirt_network_create (value netv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virNetworkCreateJob. + * In generator.pl this function has signature "net : job from net". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRNETWORKCREATEJOB +extern virJobPtr virNetworkCreateJob (virNetworkPtr net) __attribute__((weak)); +#endif +#endif + CAMLprim value ocaml_libvirt_network_create_job (value netv) { CAMLparam1 (netv); +#ifndef HAVE_VIRNETWORKCREATEJOB + /* Symbol virNetworkCreateJob not found at compile time. */ + not_supported ("virNetworkCreateJob"); + CAMLnoreturn; +#else + /* Check that the symbol virNetworkCreateJob + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virNetworkCreateJob); CAMLlocal2 (rv, connv); virNetworkPtr net = Network_val (netv); @@ -1286,8 +1651,13 @@ ocaml_libvirt_network_create_job (value netv) rv = Val_job (r, connv); CAMLreturn (rv); +#endif } +/* Automatically generated binding for virNetworkGetAutostart. + * In generator.pl this function has signature "net : bool". + */ + CAMLprim value ocaml_libvirt_network_get_autostart (value netv) { @@ -1303,6 +1673,10 @@ ocaml_libvirt_network_get_autostart (value netv) CAMLreturn (b ? Val_true : Val_false); } +/* Automatically generated binding for virNetworkSetAutostart. + * In generator.pl this function has signature "net, bool : unit". + */ + CAMLprim value ocaml_libvirt_network_set_autostart (value netv, value bv) { @@ -1320,6 +1694,10 @@ ocaml_libvirt_network_set_autostart (value netv, value bv) CAMLreturn (Val_unit); } +/* Automatically generated binding for virStoragePoolFree. + * In generator.pl this function has signature "pool : free". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLFREE extern int virStoragePoolFree (virStoragePoolPtr pool) __attribute__((weak)); @@ -1333,8 +1711,7 @@ ocaml_libvirt_storage_pool_free (value poolv) #ifndef HAVE_VIRSTORAGEPOOLFREE /* Symbol virStoragePoolFree not found at compile time. */ not_supported ("virStoragePoolFree"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolFree * is in runtime version of libvirt. @@ -1355,6 +1732,10 @@ ocaml_libvirt_storage_pool_free (value poolv) #endif } +/* Automatically generated binding for virStoragePoolDestroy. + * In generator.pl this function has signature "pool : free". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLDESTROY extern int virStoragePoolDestroy (virStoragePoolPtr pool) __attribute__((weak)); @@ -1368,8 +1749,7 @@ ocaml_libvirt_storage_pool_destroy (value poolv) #ifndef HAVE_VIRSTORAGEPOOLDESTROY /* Symbol virStoragePoolDestroy not found at compile time. */ not_supported ("virStoragePoolDestroy"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolDestroy * is in runtime version of libvirt. @@ -1390,6 +1770,10 @@ ocaml_libvirt_storage_pool_destroy (value poolv) #endif } +/* Automatically generated binding for virStoragePoolLookupByName. + * In generator.pl this function has signature "conn, string : pool". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak)); @@ -1403,8 +1787,7 @@ ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv) #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME /* Symbol virStoragePoolLookupByName not found at compile time. */ not_supported ("virStoragePoolLookupByName"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolLookupByName * is in runtime version of libvirt. @@ -1425,6 +1808,10 @@ ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv) #endif } +/* Automatically generated binding for virStoragePoolLookupByUUID. + * In generator.pl this function has signature "conn, uuid : pool". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID extern virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn, const unsigned char *str) __attribute__((weak)); @@ -1438,8 +1825,7 @@ ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv) #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID /* Symbol virStoragePoolLookupByUUID not found at compile time. */ not_supported ("virStoragePoolLookupByUUID"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolLookupByUUID * is in runtime version of libvirt. @@ -1460,6 +1846,10 @@ ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv) #endif } +/* Automatically generated binding for virStoragePoolLookupByUUIDString. + * In generator.pl this function has signature "conn, string : pool". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak)); @@ -1473,8 +1863,7 @@ ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv) #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */ not_supported ("virStoragePoolLookupByUUIDString"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolLookupByUUIDString * is in runtime version of libvirt. @@ -1495,6 +1884,10 @@ ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv) #endif } +/* Automatically generated binding for virStoragePoolGetName. + * In generator.pl this function has signature "pool : static string". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLGETNAME extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak)); @@ -1508,8 +1901,7 @@ ocaml_libvirt_storage_pool_get_name (value poolv) #ifndef HAVE_VIRSTORAGEPOOLGETNAME /* Symbol virStoragePoolGetName not found at compile time. */ not_supported ("virStoragePoolGetName"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolGetName * is in runtime version of libvirt. @@ -1529,9 +1921,13 @@ ocaml_libvirt_storage_pool_get_name (value poolv) #endif } +/* Automatically generated binding for virStoragePoolGetXMLDesc. + * In generator.pl this function has signature "pool, 0U : string". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC -extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, int flags) __attribute__((weak)); +extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak)); #endif #endif @@ -1542,8 +1938,7 @@ ocaml_libvirt_storage_pool_get_xml_desc (value poolv) #ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC /* Symbol virStoragePoolGetXMLDesc not found at compile time. */ not_supported ("virStoragePoolGetXMLDesc"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolGetXMLDesc * is in runtime version of libvirt. @@ -1564,6 +1959,10 @@ ocaml_libvirt_storage_pool_get_xml_desc (value poolv) #endif } +/* Automatically generated binding for virStoragePoolGetUUID. + * In generator.pl this function has signature "pool : uuid". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLGETUUID extern int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char *) __attribute__((weak)); @@ -1577,8 +1976,7 @@ ocaml_libvirt_storage_pool_get_uuid (value poolv) #ifndef HAVE_VIRSTORAGEPOOLGETUUID /* Symbol virStoragePoolGetUUID not found at compile time. */ not_supported ("virStoragePoolGetUUID"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolGetUUID * is in runtime version of libvirt. @@ -1594,11 +1992,17 @@ ocaml_libvirt_storage_pool_get_uuid (value poolv) NONBLOCKING (r = virStoragePoolGetUUID (pool, uuid)); CHECK_ERROR (r == -1, conn, "virStoragePoolGetUUID"); - rv = caml_copy_string ((char *) uuid); + /* UUIDs are byte arrays with a fixed length. */ + rv = caml_alloc_string (VIR_UUID_BUFLEN); + memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN); CAMLreturn (rv); #endif } +/* Automatically generated binding for virStoragePoolGetUUIDString. + * In generator.pl this function has signature "pool : uuid string". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLGETUUIDSTRING extern int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char *) __attribute__((weak)); @@ -1612,8 +2016,7 @@ ocaml_libvirt_storage_pool_get_uuid_string (value poolv) #ifndef HAVE_VIRSTORAGEPOOLGETUUIDSTRING /* Symbol virStoragePoolGetUUIDString not found at compile time. */ not_supported ("virStoragePoolGetUUIDString"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolGetUUIDString * is in runtime version of libvirt. @@ -1634,9 +2037,13 @@ ocaml_libvirt_storage_pool_get_uuid_string (value poolv) #endif } +/* Automatically generated binding for virStoragePoolCreateXML. + * In generator.pl this function has signature "conn, string, 0U : pool". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLCREATEXML -extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str) __attribute__((weak)); +extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak)); #endif #endif @@ -1647,8 +2054,7 @@ ocaml_libvirt_storage_pool_create_xml (value connv, value strv) #ifndef HAVE_VIRSTORAGEPOOLCREATEXML /* Symbol virStoragePoolCreateXML not found at compile time. */ not_supported ("virStoragePoolCreateXML"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolCreateXML * is in runtime version of libvirt. @@ -1660,7 +2066,7 @@ ocaml_libvirt_storage_pool_create_xml (value connv, value strv) char *str = String_val (strv); virStoragePoolPtr r; - NONBLOCKING (r = virStoragePoolCreateXML (conn, str)); + NONBLOCKING (r = virStoragePoolCreateXML (conn, str, 0)); CHECK_ERROR (!r, conn, "virStoragePoolCreateXML"); rv = Val_pool (r, connv); @@ -1669,9 +2075,13 @@ ocaml_libvirt_storage_pool_create_xml (value connv, value strv) #endif } +/* Automatically generated binding for virStoragePoolDefineXML. + * In generator.pl this function has signature "conn, string, 0U : pool". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLDEFINEXML -extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str) __attribute__((weak)); +extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak)); #endif #endif @@ -1682,8 +2092,7 @@ ocaml_libvirt_storage_pool_define_xml (value connv, value strv) #ifndef HAVE_VIRSTORAGEPOOLDEFINEXML /* Symbol virStoragePoolDefineXML not found at compile time. */ not_supported ("virStoragePoolDefineXML"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolDefineXML * is in runtime version of libvirt. @@ -1695,7 +2104,7 @@ ocaml_libvirt_storage_pool_define_xml (value connv, value strv) char *str = String_val (strv); virStoragePoolPtr r; - NONBLOCKING (r = virStoragePoolDefineXML (conn, str)); + NONBLOCKING (r = virStoragePoolDefineXML (conn, str, 0)); CHECK_ERROR (!r, conn, "virStoragePoolDefineXML"); rv = Val_pool (r, connv); @@ -1704,6 +2113,46 @@ ocaml_libvirt_storage_pool_define_xml (value connv, value strv) #endif } +/* Automatically generated binding for virStoragePoolBuild. + * In generator.pl this function has signature "pool, uint : unit". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLBUILD +extern int virStoragePoolBuild (virStoragePoolPtr pool, unsigned int i) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_build (value poolv, value iv) +{ + CAMLparam2 (poolv, iv); +#ifndef HAVE_VIRSTORAGEPOOLBUILD + /* Symbol virStoragePoolBuild not found at compile time. */ + not_supported ("virStoragePoolBuild"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolBuild + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolBuild); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + unsigned int i = Int_val (iv); + int r; + + NONBLOCKING (r = virStoragePoolBuild (pool, i)); + CHECK_ERROR (!r, conn, "virStoragePoolBuild"); + + CAMLreturn (Val_unit); +#endif +} + +/* Automatically generated binding for virStoragePoolUndefine. + * In generator.pl this function has signature "pool : unit". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLUNDEFINE extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak)); @@ -1717,8 +2166,7 @@ ocaml_libvirt_storage_pool_undefine (value poolv) #ifndef HAVE_VIRSTORAGEPOOLUNDEFINE /* Symbol virStoragePoolUndefine not found at compile time. */ not_supported ("virStoragePoolUndefine"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolUndefine * is in runtime version of libvirt. @@ -1736,9 +2184,13 @@ ocaml_libvirt_storage_pool_undefine (value poolv) #endif } +/* Automatically generated binding for virStoragePoolCreate. + * In generator.pl this function has signature "pool, 0U : unit". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLCREATE -extern int virStoragePoolCreate (virStoragePoolPtr pool) __attribute__((weak)); +extern int virStoragePoolCreate (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak)); #endif #endif @@ -1749,8 +2201,7 @@ ocaml_libvirt_storage_pool_create (value poolv) #ifndef HAVE_VIRSTORAGEPOOLCREATE /* Symbol virStoragePoolCreate not found at compile time. */ not_supported ("virStoragePoolCreate"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolCreate * is in runtime version of libvirt. @@ -1761,45 +2212,53 @@ ocaml_libvirt_storage_pool_create (value poolv) virConnectPtr conn = Connect_polv (poolv); int r; - NONBLOCKING (r = virStoragePoolCreate (pool)); + NONBLOCKING (r = virStoragePoolCreate (pool, 0)); CHECK_ERROR (r == -1, conn, "virStoragePoolCreate"); CAMLreturn (Val_unit); #endif } +/* Automatically generated binding for virStoragePoolDelete. + * In generator.pl this function has signature "pool, uint : unit". + */ + #ifdef HAVE_WEAK_SYMBOLS -#ifdef HAVE_VIRSTORAGEPOOLSHUTDOWN -extern int virStoragePoolShutdown (virStoragePoolPtr pool) __attribute__((weak)); +#ifdef HAVE_VIRSTORAGEPOOLDELETE +extern int virStoragePoolDelete (virStoragePoolPtr pool, unsigned int i) __attribute__((weak)); #endif #endif CAMLprim value -ocaml_libvirt_storage_pool_shutdown (value poolv) +ocaml_libvirt_storage_pool_delete (value poolv, value iv) { - CAMLparam1 (poolv); -#ifndef HAVE_VIRSTORAGEPOOLSHUTDOWN - /* Symbol virStoragePoolShutdown not found at compile time. */ - not_supported ("virStoragePoolShutdown"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLparam2 (poolv, iv); +#ifndef HAVE_VIRSTORAGEPOOLDELETE + /* Symbol virStoragePoolDelete not found at compile time. */ + not_supported ("virStoragePoolDelete"); + CAMLnoreturn; #else - /* Check that the symbol virStoragePoolShutdown + /* Check that the symbol virStoragePoolDelete * is in runtime version of libvirt. */ - WEAK_SYMBOL_CHECK (virStoragePoolShutdown); + WEAK_SYMBOL_CHECK (virStoragePoolDelete); virStoragePoolPtr pool = Pool_val (poolv); virConnectPtr conn = Connect_polv (poolv); + unsigned int i = Int_val (iv); int r; - NONBLOCKING (r = virStoragePoolShutdown (pool)); - CHECK_ERROR (r == -1, conn, "virStoragePoolShutdown"); + NONBLOCKING (r = virStoragePoolDelete (pool, i)); + CHECK_ERROR (!r, conn, "virStoragePoolDelete"); CAMLreturn (Val_unit); #endif } +/* Automatically generated binding for virStoragePoolRefresh. + * In generator.pl this function has signature "pool, 0U : unit". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLREFRESH extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned int flags) __attribute__((weak)); @@ -1813,8 +2272,7 @@ ocaml_libvirt_storage_pool_refresh (value poolv) #ifndef HAVE_VIRSTORAGEPOOLREFRESH /* Symbol virStoragePoolRefresh not found at compile time. */ not_supported ("virStoragePoolRefresh"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolRefresh * is in runtime version of libvirt. @@ -1832,6 +2290,10 @@ ocaml_libvirt_storage_pool_refresh (value poolv) #endif } +/* Automatically generated binding for virStoragePoolGetAutostart. + * In generator.pl this function has signature "pool : bool". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak)); @@ -1845,8 +2307,7 @@ ocaml_libvirt_storage_pool_get_autostart (value poolv) #ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART /* Symbol virStoragePoolGetAutostart not found at compile time. */ not_supported ("virStoragePoolGetAutostart"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolGetAutostart * is in runtime version of libvirt. @@ -1864,6 +2325,10 @@ ocaml_libvirt_storage_pool_get_autostart (value poolv) #endif } +/* Automatically generated binding for virStoragePoolSetAutostart. + * In generator.pl this function has signature "pool, bool : unit". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak)); @@ -1877,8 +2342,7 @@ ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv) #ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART /* Symbol virStoragePoolSetAutostart not found at compile time. */ not_supported ("virStoragePoolSetAutostart"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolSetAutostart * is in runtime version of libvirt. @@ -1898,6 +2362,90 @@ ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv) #endif } +/* Automatically generated binding for virStoragePoolNumOfVolumes. + * In generator.pl this function has signature "pool : int". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES +extern int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_num_of_volumes (value poolv) +{ + CAMLparam1 (poolv); +#ifndef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES + /* Symbol virStoragePoolNumOfVolumes not found at compile time. */ + not_supported ("virStoragePoolNumOfVolumes"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolNumOfVolumes + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolNumOfVolumes); + + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int r; + + NONBLOCKING (r = virStoragePoolNumOfVolumes (pool)); + CHECK_ERROR (r == -1, conn, "virStoragePoolNumOfVolumes"); + + CAMLreturn (Val_int (r)); +#endif +} + +/* Automatically generated binding for virStoragePoolListVolumes. + * In generator.pl this function has signature "pool, int : string array". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEPOOLLISTVOLUMES +extern int virStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int maxnames) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv) +{ + CAMLparam2 (poolv, iv); +#ifndef HAVE_VIRSTORAGEPOOLLISTVOLUMES + /* Symbol virStoragePoolListVolumes not found at compile time. */ + not_supported ("virStoragePoolListVolumes"); + CAMLnoreturn; +#else + /* Check that the symbol virStoragePoolListVolumes + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStoragePoolListVolumes); + + CAMLlocal2 (rv, strv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + int i = Int_val (iv); + char *names[i]; + int r; + + NONBLOCKING (r = virStoragePoolListVolumes (pool, names, i)); + CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes"); + + rv = caml_alloc (r, 0); + for (i = 0; i < r; ++i) { + strv = caml_copy_string (names[i]); + Store_field (rv, i, strv); + free (names[i]); + } + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolFree. + * In generator.pl this function has signature "vol : free". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEVOLFREE extern int virStorageVolFree (virStorageVolPtr vol) __attribute__((weak)); @@ -1911,8 +2459,7 @@ ocaml_libvirt_storage_vol_free (value volv) #ifndef HAVE_VIRSTORAGEVOLFREE /* Symbol virStorageVolFree not found at compile time. */ not_supported ("virStorageVolFree"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStorageVolFree * is in runtime version of libvirt. @@ -1933,41 +2480,86 @@ ocaml_libvirt_storage_vol_free (value volv) #endif } +/* Automatically generated binding for virStorageVolDelete. + * In generator.pl this function has signature "vol, uint : unit". + */ + #ifdef HAVE_WEAK_SYMBOLS -#ifdef HAVE_VIRSTORAGEVOLDESTROY -extern int virStorageVolDestroy (virStorageVolPtr vol) __attribute__((weak)); +#ifdef HAVE_VIRSTORAGEVOLDELETE +extern int virStorageVolDelete (virStorageVolPtr vol, unsigned int i) __attribute__((weak)); #endif #endif CAMLprim value -ocaml_libvirt_storage_vol_destroy (value volv) +ocaml_libvirt_storage_vol_delete (value volv, value iv) { - CAMLparam1 (volv); -#ifndef HAVE_VIRSTORAGEVOLDESTROY - /* Symbol virStorageVolDestroy not found at compile time. */ - not_supported ("virStorageVolDestroy"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLparam2 (volv, iv); +#ifndef HAVE_VIRSTORAGEVOLDELETE + /* Symbol virStorageVolDelete not found at compile time. */ + not_supported ("virStorageVolDelete"); + CAMLnoreturn; #else - /* Check that the symbol virStorageVolDestroy + /* Check that the symbol virStorageVolDelete * is in runtime version of libvirt. */ - WEAK_SYMBOL_CHECK (virStorageVolDestroy); + WEAK_SYMBOL_CHECK (virStorageVolDelete); virStorageVolPtr vol = Volume_val (volv); virConnectPtr conn = Connect_volv (volv); + unsigned int i = Int_val (iv); int r; - NONBLOCKING (r = virStorageVolDestroy (vol)); - CHECK_ERROR (r == -1, conn, "virStorageVolDestroy"); - - /* So that we don't double-free in the finalizer: */ - Volume_val (volv) = NULL; + NONBLOCKING (r = virStorageVolDelete (vol, i)); + CHECK_ERROR (!r, conn, "virStorageVolDelete"); CAMLreturn (Val_unit); #endif } +/* Automatically generated binding for virStorageVolLookupByName. + * In generator.pl this function has signature "pool, string : vol from pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLLOOKUPBYNAME +extern virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool, const char *str) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_lookup_by_name (value poolv, value strv) +{ + CAMLparam2 (poolv, strv); +#ifndef HAVE_VIRSTORAGEVOLLOOKUPBYNAME + /* Symbol virStorageVolLookupByName not found at compile time. */ + not_supported ("virStorageVolLookupByName"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolLookupByName + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolLookupByName); + + CAMLlocal2 (rv, connv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + char *str = String_val (strv); + virStorageVolPtr r; + + NONBLOCKING (r = virStorageVolLookupByName (pool, str)); + CHECK_ERROR (!r, conn, "virStorageVolLookupByName"); + + connv = Field (poolv, 1); + rv = Val_volume (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolLookupByKey. + * In generator.pl this function has signature "conn, string : vol". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak)); @@ -1981,8 +2573,7 @@ ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv) #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY /* Symbol virStorageVolLookupByKey not found at compile time. */ not_supported ("virStorageVolLookupByKey"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStorageVolLookupByKey * is in runtime version of libvirt. @@ -2003,6 +2594,10 @@ ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv) #endif } +/* Automatically generated binding for virStorageVolLookupByPath. + * In generator.pl this function has signature "conn, string : vol". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak)); @@ -2016,8 +2611,7 @@ ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv) #ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH /* Symbol virStorageVolLookupByPath not found at compile time. */ not_supported ("virStorageVolLookupByPath"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStorageVolLookupByPath * is in runtime version of libvirt. @@ -2038,9 +2632,53 @@ ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv) #endif } +/* Automatically generated binding for virStorageVolCreateXML. + * In generator.pl this function has signature "pool, string, 0U : vol from pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLCREATEXML +extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, unsigned int flags) __attribute__((weak)); +#endif +#endif + +CAMLprim value +ocaml_libvirt_storage_vol_create_xml (value poolv, value strv) +{ + CAMLparam2 (poolv, strv); +#ifndef HAVE_VIRSTORAGEVOLCREATEXML + /* Symbol virStorageVolCreateXML not found at compile time. */ + not_supported ("virStorageVolCreateXML"); + CAMLnoreturn; +#else + /* Check that the symbol virStorageVolCreateXML + * is in runtime version of libvirt. + */ + WEAK_SYMBOL_CHECK (virStorageVolCreateXML); + + CAMLlocal2 (rv, connv); + virStoragePoolPtr pool = Pool_val (poolv); + virConnectPtr conn = Connect_polv (poolv); + char *str = String_val (strv); + virStorageVolPtr r; + + NONBLOCKING (r = virStorageVolCreateXML (pool, str, 0)); + CHECK_ERROR (!r, conn, "virStorageVolCreateXML"); + + connv = Field (poolv, 1); + rv = Val_volume (r, connv); + + CAMLreturn (rv); +#endif +} + +/* Automatically generated binding for virStorageVolGetXMLDesc. + * In generator.pl this function has signature "vol, 0U : string". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEVOLGETXMLDESC -extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, int flags) __attribute__((weak)); +extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, unsigned int flags) __attribute__((weak)); #endif #endif @@ -2051,8 +2689,7 @@ ocaml_libvirt_storage_vol_get_xml_desc (value volv) #ifndef HAVE_VIRSTORAGEVOLGETXMLDESC /* Symbol virStorageVolGetXMLDesc not found at compile time. */ not_supported ("virStorageVolGetXMLDesc"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStorageVolGetXMLDesc * is in runtime version of libvirt. @@ -2073,6 +2710,10 @@ ocaml_libvirt_storage_vol_get_xml_desc (value volv) #endif } +/* Automatically generated binding for virStorageVolGetPath. + * In generator.pl this function has signature "vol : string". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEVOLGETPATH extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak)); @@ -2086,8 +2727,7 @@ ocaml_libvirt_storage_vol_get_path (value volv) #ifndef HAVE_VIRSTORAGEVOLGETPATH /* Symbol virStorageVolGetPath not found at compile time. */ not_supported ("virStorageVolGetPath"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStorageVolGetPath * is in runtime version of libvirt. @@ -2108,6 +2748,10 @@ ocaml_libvirt_storage_vol_get_path (value volv) #endif } +/* Automatically generated binding for virStorageVolGetKey. + * In generator.pl this function has signature "vol : static string". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEVOLGETKEY extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak)); @@ -2121,8 +2765,7 @@ ocaml_libvirt_storage_vol_get_key (value volv) #ifndef HAVE_VIRSTORAGEVOLGETKEY /* Symbol virStorageVolGetKey not found at compile time. */ not_supported ("virStorageVolGetKey"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStorageVolGetKey * is in runtime version of libvirt. @@ -2142,6 +2785,10 @@ ocaml_libvirt_storage_vol_get_key (value volv) #endif } +/* Automatically generated binding for virStorageVolGetName. + * In generator.pl this function has signature "vol : static string". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEVOLGETNAME extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak)); @@ -2155,8 +2802,7 @@ ocaml_libvirt_storage_vol_get_name (value volv) #ifndef HAVE_VIRSTORAGEVOLGETNAME /* Symbol virStorageVolGetName not found at compile time. */ not_supported ("virStorageVolGetName"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStorageVolGetName * is in runtime version of libvirt. @@ -2176,6 +2822,10 @@ ocaml_libvirt_storage_vol_get_name (value volv) #endif } +/* Automatically generated binding for virStoragePoolLookupByVolume. + * In generator.pl this function has signature "vol : pool from vol". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME extern virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) __attribute__((weak)); @@ -2189,8 +2839,7 @@ ocaml_libvirt_storage_pool_lookup_by_volume (value volv) #ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME /* Symbol virStoragePoolLookupByVolume not found at compile time. */ not_supported ("virStoragePoolLookupByVolume"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virStoragePoolLookupByVolume * is in runtime version of libvirt. @@ -2212,6 +2861,10 @@ ocaml_libvirt_storage_pool_lookup_by_volume (value volv) #endif } +/* Automatically generated binding for virJobFree. + * In generator.pl this function has signature "job : free". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRJOBFREE extern int virJobFree (virJobPtr job) __attribute__((weak)); @@ -2225,8 +2878,7 @@ ocaml_libvirt_job_free (value jobv) #ifndef HAVE_VIRJOBFREE /* Symbol virJobFree not found at compile time. */ not_supported ("virJobFree"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virJobFree * is in runtime version of libvirt. @@ -2247,6 +2899,10 @@ ocaml_libvirt_job_free (value jobv) #endif } +/* Automatically generated binding for virJobCancel. + * In generator.pl this function has signature "job : unit". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRJOBCANCEL extern int virJobCancel (virJobPtr job) __attribute__((weak)); @@ -2260,8 +2916,7 @@ ocaml_libvirt_job_cancel (value jobv) #ifndef HAVE_VIRJOBCANCEL /* Symbol virJobCancel not found at compile time. */ not_supported ("virJobCancel"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virJobCancel * is in runtime version of libvirt. @@ -2279,6 +2934,10 @@ ocaml_libvirt_job_cancel (value jobv) #endif } +/* Automatically generated binding for virJobGetNetwork. + * In generator.pl this function has signature "job : net from job". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRJOBGETNETWORK extern virNetworkPtr virJobGetNetwork (virJobPtr job) __attribute__((weak)); @@ -2292,8 +2951,7 @@ ocaml_libvirt_job_get_network (value jobv) #ifndef HAVE_VIRJOBGETNETWORK /* Symbol virJobGetNetwork not found at compile time. */ not_supported ("virJobGetNetwork"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virJobGetNetwork * is in runtime version of libvirt. @@ -2315,6 +2973,10 @@ ocaml_libvirt_job_get_network (value jobv) #endif } +/* Automatically generated binding for virJobGetDomain. + * In generator.pl this function has signature "job : dom from job". + */ + #ifdef HAVE_WEAK_SYMBOLS #ifdef HAVE_VIRJOBGETDOMAIN extern virDomainPtr virJobGetDomain (virJobPtr job) __attribute__((weak)); @@ -2328,8 +2990,7 @@ ocaml_libvirt_job_get_domain (value jobv) #ifndef HAVE_VIRJOBGETDOMAIN /* Symbol virJobGetDomain not found at compile time. */ not_supported ("virJobGetDomain"); - /* Suppresses a compiler warning. */ - (void) caml__frame; + CAMLnoreturn; #else /* Check that the symbol virJobGetDomain * is in runtime version of libvirt. @@ -2351,40 +3012,6 @@ ocaml_libvirt_job_get_domain (value jobv) #endif } -/* The following functions are unimplemented and always fail. - * See generator.pl '@unimplemented' - */ - -CAMLprim value -ocaml_libvirt_storage_pool_get_info () -{ - failwith ("ocaml_libvirt_storage_pool_get_info is unimplemented"); -} - -CAMLprim value -ocaml_libvirt_storage_vol_lookup_by_name () -{ - failwith ("ocaml_libvirt_storage_vol_lookup_by_name is unimplemented"); -} - -CAMLprim value -ocaml_libvirt_storage_vol_create_xml () -{ - failwith ("ocaml_libvirt_storage_vol_create_xml is unimplemented"); -} - -CAMLprim value -ocaml_libvirt_storage_vol_get_info () -{ - failwith ("ocaml_libvirt_storage_vol_get_info is unimplemented"); -} - -CAMLprim value -ocaml_libvirt_job_get_info () -{ - failwith ("ocaml_libvirt_job_get_info is unimplemented"); -} - #include "libvirt_c_epilogue.c" /* EOF */