X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=libvirt%2Flibvirt_c.c;h=d07a55e6f90fbe119a0154166110cb7b0775d3a2;hb=2360cd228542c6a523f10daacbd631a753d17208;hp=e8d071dc811fc87b1beb021d38729a683fb011c5;hpb=e8d5e3e4498e693173bb47f9485ba28989d0a6f7;p=ocaml-libvirt.git diff --git a/libvirt/libvirt_c.c b/libvirt/libvirt_c.c index e8d071d..d07a55e 100644 --- a/libvirt/libvirt_c.c +++ b/libvirt/libvirt_c.c @@ -12,7 +12,8 @@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2 of the License, or (at your option) any later version, + * with the OCaml linking exception described in ../COPYING.LIB. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -601,44 +602,6 @@ 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); - char *str = String_val (strv); - virJobPtr r; - - NONBLOCKING (r = virDomainCreateLinuxJob (conn, str, 0)); - CHECK_ERROR (!r, conn, "virDomainCreateLinuxJob"); - - rv = Val_job (r, connv); - - CAMLreturn (rv); -#endif -} - /* Automatically generated binding for virDomainFree. * In generator.pl this function has signature "dom : free". */ @@ -921,46 +884,6 @@ 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); - virConnectPtr conn = Connect_domv (domv); - char *str = String_val (strv); - virJobPtr r; - - NONBLOCKING (r = virDomainSaveJob (dom, str)); - CHECK_ERROR (!r, conn, "virDomainSaveJob"); - - connv = Field (domv, 1); - rv = Val_job (r, connv); - - CAMLreturn (rv); -#endif -} - /* Automatically generated binding for virDomainRestore. * In generator.pl this function has signature "conn, string : unit". */ @@ -980,44 +903,6 @@ 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); - char *str = String_val (strv); - virJobPtr r; - - NONBLOCKING (r = virDomainRestoreJob (conn, str)); - CHECK_ERROR (!r, conn, "virDomainRestoreJob"); - - rv = Val_job (r, connv); - - CAMLreturn (rv); -#endif -} - /* Automatically generated binding for virDomainCoreDump. * In generator.pl this function has signature "dom, string, 0 : unit". */ @@ -1039,46 +924,6 @@ 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); - virConnectPtr conn = Connect_domv (domv); - char *str = String_val (strv); - virJobPtr r; - - NONBLOCKING (r = virDomainCoreDumpJob (dom, str, 0)); - CHECK_ERROR (!r, conn, "virDomainCoreDumpJob"); - - connv = Field (domv, 1); - rv = Val_job (r, connv); - - CAMLreturn (rv); -#endif -} - /* Automatically generated binding for virDomainSuspend. * In generator.pl this function has signature "dom : unit". */ @@ -1215,45 +1060,6 @@ 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); - virConnectPtr conn = Connect_domv (domv); - virJobPtr r; - - NONBLOCKING (r = virDomainCreateJob (dom, 0)); - CHECK_ERROR (!r, conn, "virDomainCreateJob"); - - connv = Field (domv, 1); - rv = Val_job (r, connv); - - CAMLreturn (rv); -#endif -} - /* Automatically generated binding for virDomainAttachDevice. * In generator.pl this function has signature "dom, string : unit". */ @@ -1596,44 +1402,6 @@ 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); - char *str = String_val (strv); - virJobPtr r; - - NONBLOCKING (r = virNetworkCreateXMLJob (conn, str)); - CHECK_ERROR (!r, conn, "virNetworkCreateXMLJob"); - - rv = Val_job (r, connv); - - CAMLreturn (rv); -#endif -} - /* Automatically generated binding for virNetworkDefineXML. * In generator.pl this function has signature "conn, string : net". */ @@ -1675,45 +1443,6 @@ 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); - virConnectPtr conn = Connect_netv (netv); - virJobPtr r; - - NONBLOCKING (r = virNetworkCreateJob (net)); - CHECK_ERROR (!r, conn, "virNetworkCreateJob"); - - connv = Field (netv, 1); - rv = Val_job (r, connv); - - CAMLreturn (rv); -#endif -} - /* Automatically generated binding for virNetworkGetAutostart. * In generator.pl this function has signature "net : bool". */ @@ -2203,7 +1932,7 @@ ocaml_libvirt_storage_pool_build (value poolv, value iv) int r; NONBLOCKING (r = virStoragePoolBuild (pool, i)); - CHECK_ERROR (!r, conn, "virStoragePoolBuild"); + CHECK_ERROR (r == -1, conn, "virStoragePoolBuild"); CAMLreturn (Val_unit); #endif @@ -2309,7 +2038,7 @@ ocaml_libvirt_storage_pool_delete (value poolv, value iv) int r; NONBLOCKING (r = virStoragePoolDelete (pool, i)); - CHECK_ERROR (!r, conn, "virStoragePoolDelete"); + CHECK_ERROR (r == -1, conn, "virStoragePoolDelete"); CAMLreturn (Val_unit); #endif @@ -2580,7 +2309,7 @@ ocaml_libvirt_storage_vol_delete (value volv, value iv) int r; NONBLOCKING (r = virStorageVolDelete (vol, i)); - CHECK_ERROR (!r, conn, "virStorageVolDelete"); + CHECK_ERROR (r == -1, conn, "virStorageVolDelete"); CAMLreturn (Val_unit); #endif @@ -2931,157 +2660,6 @@ 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)); -#endif -#endif - -CAMLprim value -ocaml_libvirt_job_free (value jobv) -{ - CAMLparam1 (jobv); -#ifndef HAVE_VIRJOBFREE - /* Symbol virJobFree not found at compile time. */ - not_supported ("virJobFree"); - CAMLnoreturn; -#else - /* Check that the symbol virJobFree - * is in runtime version of libvirt. - */ - WEAK_SYMBOL_CHECK (virJobFree); - - virJobPtr job = Job_val (jobv); - virConnectPtr conn = Connect_jobv (jobv); - int r; - - NONBLOCKING (r = virJobFree (job)); - CHECK_ERROR (r == -1, conn, "virJobFree"); - - /* So that we don't double-free in the finalizer: */ - Job_val (jobv) = NULL; - - CAMLreturn (Val_unit); -#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)); -#endif -#endif - -CAMLprim value -ocaml_libvirt_job_cancel (value jobv) -{ - CAMLparam1 (jobv); -#ifndef HAVE_VIRJOBCANCEL - /* Symbol virJobCancel not found at compile time. */ - not_supported ("virJobCancel"); - CAMLnoreturn; -#else - /* Check that the symbol virJobCancel - * is in runtime version of libvirt. - */ - WEAK_SYMBOL_CHECK (virJobCancel); - - virJobPtr job = Job_val (jobv); - virConnectPtr conn = Connect_jobv (jobv); - int r; - - NONBLOCKING (r = virJobCancel (job)); - CHECK_ERROR (r == -1, conn, "virJobCancel"); - - CAMLreturn (Val_unit); -#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)); -#endif -#endif - -CAMLprim value -ocaml_libvirt_job_get_network (value jobv) -{ - CAMLparam1 (jobv); -#ifndef HAVE_VIRJOBGETNETWORK - /* Symbol virJobGetNetwork not found at compile time. */ - not_supported ("virJobGetNetwork"); - CAMLnoreturn; -#else - /* Check that the symbol virJobGetNetwork - * is in runtime version of libvirt. - */ - WEAK_SYMBOL_CHECK (virJobGetNetwork); - - CAMLlocal2 (rv, connv); - virJobPtr job = Job_val (jobv); - virConnectPtr conn = Connect_jobv (jobv); - virNetworkPtr r; - - NONBLOCKING (r = virJobGetNetwork (job)); - CHECK_ERROR (!r, conn, "virJobGetNetwork"); - - connv = Field (jobv, 1); - rv = Val_network (r, connv); - - CAMLreturn (rv); -#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)); -#endif -#endif - -CAMLprim value -ocaml_libvirt_job_get_domain (value jobv) -{ - CAMLparam1 (jobv); -#ifndef HAVE_VIRJOBGETDOMAIN - /* Symbol virJobGetDomain not found at compile time. */ - not_supported ("virJobGetDomain"); - CAMLnoreturn; -#else - /* Check that the symbol virJobGetDomain - * is in runtime version of libvirt. - */ - WEAK_SYMBOL_CHECK (virJobGetDomain); - - CAMLlocal2 (rv, connv); - virJobPtr job = Job_val (jobv); - virConnectPtr conn = Connect_jobv (jobv); - virDomainPtr r; - - NONBLOCKING (r = virJobGetDomain (job)); - CHECK_ERROR (!r, conn, "virJobGetDomain"); - - connv = Field (jobv, 1); - rv = Val_domain (r, connv); - - CAMLreturn (rv); -#endif -} - #include "libvirt_c_epilogue.c" /* EOF */