+ CAMLparam2 (poolv, iv);
+#ifndef HAVE_VIRSTORAGEPOOLDELETE
+ /* Symbol virStoragePoolDelete not found at compile time. */
+ not_supported ("virStoragePoolDelete");
+ CAMLnoreturn;
+#else
+ /* Check that the symbol virStoragePoolDelete
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStoragePoolDelete);
+
+ virStoragePoolPtr pool = Pool_val (poolv);
+ virConnectPtr conn = Connect_polv (poolv);
+ unsigned int i = Int_val (iv);
+ int r;
+
+ 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));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_pool_refresh (value poolv)
+{
+ CAMLparam1 (poolv);
+#ifndef HAVE_VIRSTORAGEPOOLREFRESH
+ /* Symbol virStoragePoolRefresh not found at compile time. */
+ not_supported ("virStoragePoolRefresh");
+ CAMLnoreturn;
+#else
+ /* Check that the symbol virStoragePoolRefresh
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
+
+ virStoragePoolPtr pool = Pool_val (poolv);
+ virConnectPtr conn = Connect_polv (poolv);
+ int r;
+
+ NONBLOCKING (r = virStoragePoolRefresh (pool, 0));
+ CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
+
+ CAMLreturn (Val_unit);
+#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));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_pool_get_autostart (value poolv)
+{
+ CAMLparam1 (poolv);
+#ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
+ /* Symbol virStoragePoolGetAutostart not found at compile time. */
+ not_supported ("virStoragePoolGetAutostart");
+ CAMLnoreturn;
+#else
+ /* Check that the symbol virStoragePoolGetAutostart
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
+
+ virStoragePoolPtr pool = Pool_val (poolv);
+ virConnectPtr conn = Connect_polv (poolv);
+ int r, b;
+
+ NONBLOCKING (r = virStoragePoolGetAutostart (pool, &b));
+ CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
+
+ CAMLreturn (b ? Val_true : Val_false);
+#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));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
+{
+ CAMLparam2 (poolv, bv);
+#ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
+ /* Symbol virStoragePoolSetAutostart not found at compile time. */
+ not_supported ("virStoragePoolSetAutostart");
+ CAMLnoreturn;
+#else
+ /* Check that the symbol virStoragePoolSetAutostart
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
+
+ virStoragePoolPtr pool = Pool_val (poolv);
+ virConnectPtr conn = Connect_polv (poolv);
+ int r, b;
+
+ b = bv == Val_true ? 1 : 0;
+
+ NONBLOCKING (r = virStoragePoolSetAutostart (pool, b));
+ CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
+
+ CAMLreturn (Val_unit);
+#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));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_vol_free (value volv)
+{
+ CAMLparam1 (volv);
+#ifndef HAVE_VIRSTORAGEVOLFREE
+ /* Symbol virStorageVolFree not found at compile time. */
+ not_supported ("virStorageVolFree");
+ CAMLnoreturn;
+#else
+ /* Check that the symbol virStorageVolFree
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStorageVolFree);
+
+ virStorageVolPtr vol = Volume_val (volv);
+ virConnectPtr conn = Connect_volv (volv);
+ int r;
+
+ NONBLOCKING (r = virStorageVolFree (vol));
+ CHECK_ERROR (r == -1, conn, "virStorageVolFree");
+
+ /* So that we don't double-free in the finalizer: */
+ Volume_val (volv) = NULL;
+
+ CAMLreturn (Val_unit);
+#endif
+}
+
+/* Automatically generated binding for virStorageVolDelete.
+ * In generator.pl this function has signature "vol, uint : unit".
+ */
+
+#ifdef HAVE_WEAK_SYMBOLS
+#ifdef HAVE_VIRSTORAGEVOLDELETE
+extern int virStorageVolDelete (virStorageVolPtr vol, unsigned int i) __attribute__((weak));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_vol_delete (value volv, value iv)
+{
+ CAMLparam2 (volv, iv);
+#ifndef HAVE_VIRSTORAGEVOLDELETE
+ /* Symbol virStorageVolDelete not found at compile time. */
+ not_supported ("virStorageVolDelete");
+ CAMLnoreturn;
+#else
+ /* Check that the symbol virStorageVolDelete
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStorageVolDelete);
+
+ virStorageVolPtr vol = Volume_val (volv);
+ virConnectPtr conn = Connect_volv (volv);
+ unsigned int i = Int_val (iv);
+ int r;
+
+ 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));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
+{
+ CAMLparam2 (connv, strv);
+#ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
+ /* Symbol virStorageVolLookupByKey not found at compile time. */
+ not_supported ("virStorageVolLookupByKey");
+ CAMLnoreturn;
+#else
+ /* Check that the symbol virStorageVolLookupByKey
+ * is in runtime version of libvirt.
+ */
+ WEAK_SYMBOL_CHECK (virStorageVolLookupByKey);
+