+#ifdef HAVE_WEAK_SYMBOLS
+#ifdef HAVE_VIRSTORAGEPOOLGETINFO
+extern int virStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info)
+ __attribute__((weak));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_pool_get_info (value poolv)
+{
+#if HAVE_VIRSTORAGEPOOLGETINFO
+ CAMLparam1 (poolv);
+ CAMLlocal2 (rv, v);
+ virStoragePoolPtr pool = Pool_val (poolv);
+ virConnectPtr conn = Connect_polv (poolv);
+ virStoragePoolInfo info;
+ int r;
+
+ WEAK_SYMBOL_CHECK (virStoragePoolGetInfo);
+ NONBLOCKING (r = virStoragePoolGetInfo (pool, &info));
+ CHECK_ERROR (r == -1, conn, "virStoragePoolGetInfo");
+
+ rv = caml_alloc (3, 0);
+ Store_field (rv, 0, Val_int (info.state));
+ v = caml_copy_int64 (info.capacity); Store_field (rv, 1, v);
+ v = caml_copy_int64 (info.allocation); Store_field (rv, 1, v);
+
+ CAMLreturn (rv);
+#else
+ not_supported ("virStoragePoolGetInfo");
+#endif
+}
+
+#ifdef HAVE_WEAK_SYMBOLS
+#ifdef HAVE_VIRSTORAGEVOLGETINFO
+extern int virStorageVolGetInfo(virStorageVolPtr vol, virStorageVolInfoPtr info)
+ __attribute__((weak));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_storage_vol_get_info (value volv)
+{
+#if HAVE_VIRSTORAGEVOLGETINFO
+ CAMLparam1 (volv);
+ CAMLlocal2 (rv, v);
+ virStorageVolPtr vol = Volume_val (volv);
+ virConnectPtr conn = Connect_volv (volv);
+ virStorageVolInfo info;
+ int r;
+
+ WEAK_SYMBOL_CHECK (virStorageVolGetInfo);
+ NONBLOCKING (r = virStorageVolGetInfo (vol, &info));
+ CHECK_ERROR (r == -1, conn, "virStorageVolGetInfo");
+
+ rv = caml_alloc (3, 0);
+ Store_field (rv, 0, Val_int (info.type));
+ v = caml_copy_int64 (info.capacity); Store_field (rv, 1, v);
+ v = caml_copy_int64 (info.allocation); Store_field (rv, 1, v);
+
+ CAMLreturn (rv);
+#else
+ not_supported ("virStorageVolGetInfo");
+#endif
+}
+
+#ifdef HAVE_WEAK_SYMBOLS
+#ifdef HAVE_VIRJOBGETINFO
+extern int virJobGetInfo(virJobPtr job, virJobInfoPtr info)
+ __attribute__((weak));
+#endif
+#endif
+
+CAMLprim value
+ocaml_libvirt_job_get_info (value jobv)
+{
+#if HAVE_VIRJOBGETINFO
+ CAMLparam1 (jobv);
+ CAMLlocal1 (rv);
+ virJobPtr job = Job_val (jobv);
+ virConnectPtr conn = Connect_jobv (jobv);
+ virJobInfo info;
+ int r;
+
+ WEAK_SYMBOL_CHECK (virJobGetInfo);
+ NONBLOCKING (r = virJobGetInfo (job, &info));
+ CHECK_ERROR (r == -1, conn, "virJobGetInfo");
+
+ rv = caml_alloc (5, 0);
+ Store_field (rv, 0, Val_int (info.type));
+ Store_field (rv, 1, Val_int (info.state));
+ Store_field (rv, 2, Val_int (info.runningTime));
+ Store_field (rv, 3, Val_int (info.remainingTime));
+ Store_field (rv, 4, Val_int (info.percentComplete));
+
+ CAMLreturn (rv);
+#else
+ not_supported ("virJobGetInfo");
+#endif
+}
+