static void gvir_storage_pool_constructed(GObject *object) { GVirStoragePool *pool = GVIR_STORAGE_POOL(object); GVirStoragePoolPrivate *priv = pool->priv; G_OBJECT_CLASS(gvir_storage_pool_parent_class)->constructed(object); /* xxx we may want to turn this into an initable */ if (virStoragePoolGetUUIDString(priv->handle, priv->uuid) < 0) gvir_warning("Failed to get storage pool UUID on %p", priv->handle); }
static void gvir_storage_pool_refresh_helper(GSimpleAsyncResult *res, GObject *object, GCancellable *cancellable) { GVirStoragePool *pool = GVIR_STORAGE_POOL(object); GError *err = NULL; if (!gvir_storage_pool_refresh(pool, cancellable, &err)) { g_simple_async_result_set_from_error(res, err); g_error_free(err); } }
static void gvir_storage_pool_refresh_helper(GTask *task, gpointer source_object, gpointer task_data G_GNUC_UNUSED, GCancellable *cancellable) { GVirStoragePool *pool = GVIR_STORAGE_POOL(source_object); GError *err = NULL; if (!gvir_storage_pool_refresh(pool, cancellable, &err)) g_task_return_error(task, err); else g_task_return_boolean(task, TRUE); }
static void gvir_storage_pool_finalize(GObject *object) { GVirStoragePool *pool = GVIR_STORAGE_POOL(object); GVirStoragePoolPrivate *priv = pool->priv; if (priv->volumes) { g_hash_table_unref(priv->volumes); priv->volumes = NULL; } virStoragePoolFree(priv->handle); g_mutex_free(priv->lock); G_OBJECT_CLASS(gvir_storage_pool_parent_class)->finalize(object); }
static void gvir_storage_pool_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { GVirStoragePool *pool = GVIR_STORAGE_POOL(object); GVirStoragePoolPrivate *priv = pool->priv; switch (prop_id) { case PROP_HANDLE: g_value_set_boxed(value, priv->handle); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); } }
static void gvir_storage_pool_constructed(GObject *object) { GVirStoragePool *conn = GVIR_STORAGE_POOL(object); GVirStoragePoolPrivate *priv = conn->priv; G_OBJECT_CLASS(gvir_storage_pool_parent_class)->constructed(object); /* xxx we may want to turn this into an initable */ if (virStoragePoolGetUUIDString(priv->handle, priv->uuid) < 0) { virErrorPtr verr = virGetLastError(); if (verr) { g_warning("Failed to get storage pool UUID on %p: %s", priv->handle, verr->message); } else { g_warning("Failed to get storage pool UUID on %p", priv->handle); } } }
gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR, 0, "Failed to build storage pool"); return FALSE; } return TRUE; } static void gvir_storage_pool_build_helper(GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable G_GNUC_UNUSED) { GVirStoragePool *pool = GVIR_STORAGE_POOL(source_object); guint flags = GPOINTER_TO_UINT(task_data); GError *err = NULL; if (!gvir_storage_pool_build(pool, flags, &err)) g_task_return_error(task, err); else g_task_return_boolean(task, TRUE); } /** * gvir_storage_pool_build_async: * @pool: the storage pool to build * @flags: the flags * @cancellable: (allow-none)(transfer none): cancellation object * @callback: (scope async): completion callback
return FALSE; } return TRUE; } typedef struct { guint flags; } StoragePoolBuildData; static void gvir_storage_pool_build_helper(GSimpleAsyncResult *res, GObject *object, GCancellable *cancellable G_GNUC_UNUSED) { GVirStoragePool *pool = GVIR_STORAGE_POOL(object); StoragePoolBuildData *data; GError *err = NULL; data = (StoragePoolBuildData *) g_object_get_data(G_OBJECT(res), "StoragePoolBuildData"); if (!gvir_storage_pool_build(pool, data->flags, &err)) { g_simple_async_result_set_from_error(res, err); g_error_free(err); } g_slice_free (StoragePoolBuildData, data); } /**