X-Git-Url: http://git.annexia.org/?p=virt-top.git;a=blobdiff_plain;f=libvirt%2Flibvirt_c.c;h=0200b1c8e9723658a4f4c726226347f016bef45d;hp=e76431162c48e79dbd59eeeed48fcfc525dbf34a;hb=e7c94d95feb1fb3d7249c2ead935fe2e56ec31a4;hpb=cb83441a2e80b7e57ea0010ca010ea939b416506 diff --git a/libvirt/libvirt_c.c b/libvirt/libvirt_c.c index e764311..0200b1c 100644 --- a/libvirt/libvirt_c.c +++ b/libvirt/libvirt_c.c @@ -2437,6 +2437,47 @@ ocaml_libvirt_storage_vol_destroy (value volv) #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"); + /* Suppresses a compiler warning. */ + (void) caml__frame; +#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". */ @@ -2515,6 +2556,47 @@ 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, 0 : vol from pool". + */ + +#ifdef HAVE_WEAK_SYMBOLS +#ifdef HAVE_VIRSTORAGEVOLCREATEXML +extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, 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"); + /* Suppresses a compiler warning. */ + (void) caml__frame; +#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, 0 : string". */ @@ -2864,22 +2946,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_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"); -} - #include "libvirt_c_epilogue.c" /* EOF */