[libvirt] [libvirt-glib] Corrections to satisfy latest GIR

Christophe Fergeau cfergeau at redhat.com
Wed May 2 10:34:37 UTC 2012


What happens when some parameters are not listed/when some blank lines are
missing? Does it output a warning, or abort?
Also, one oddity below,

Christophe

On Tue, May 01, 2012 at 08:30:27PM +0300, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> 
> ---
>  libvirt-gconfig/libvirt-gconfig-domain.c          |    1 +
>  libvirt-gobject/libvirt-gobject-domain-snapshot.c |    1 +
>  libvirt-gobject/libvirt-gobject-domain.c          |    3 +++
>  libvirt-gobject/libvirt-gobject-interface.c       |    2 ++
>  libvirt-gobject/libvirt-gobject-manager.c         |    2 ++
>  libvirt-gobject/libvirt-gobject-network-filter.c  |    2 ++
>  libvirt-gobject/libvirt-gobject-network.c         |    2 ++
>  libvirt-gobject/libvirt-gobject-node-device.c     |    2 ++
>  libvirt-gobject/libvirt-gobject-secret.c          |    2 ++
>  libvirt-gobject/libvirt-gobject-storage-pool.c    |    6 ++++++
>  libvirt-gobject/libvirt-gobject-storage-vol.c     |    4 ++++
>  libvirt-gobject/libvirt-gobject-stream.c          |   18 +++++++++++-------
>  libvirt-gobject/libvirt-gobject-stream.h          |    2 ++
>  13 files changed, 40 insertions(+), 7 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
> index 33a69e3..c8cd1c5 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain.c
> @@ -277,6 +277,7 @@ static gboolean add_feature(xmlNodePtr node, gpointer opaque)
> @@ -337,6 +337,7 @@ gboolean gvir_domain_start(GVirDomain *dom,
>  /**
>   * gvir_domain_resume:
>   * @dom: the domain
> + * @err: Place-holder for possible errors

I'm a bit surprised that here you add a @err annotation, but further down
the patch you rename some @err to @error. Was the renaming an unrelated
cleanup, or was gir complaining about it?

Christophe

>   *
>   * Returns: TRUE on success
>   */
> @@ -453,6 +454,7 @@ gboolean gvir_domain_reboot(GVirDomain *dom,
>   * gvir_domain_get_config:
>   * @dom: the domain
>   * @flags:  the flags
> + *
>   * Returns: (transfer full): the config
>   */
>  GVirConfigDomain *gvir_domain_get_config(GVirDomain *dom,
> @@ -546,6 +548,7 @@ gboolean gvir_domain_set_config(GVirDomain *domain,
>  /**
>   * gvir_domain_get_info:
>   * @dom: the domain
> + *
>   * Returns: (transfer full): the info
>   */
>  GVirDomainInfo *gvir_domain_get_info(GVirDomain *dom,
> diff --git a/libvirt-gobject/libvirt-gobject-interface.c b/libvirt-gobject/libvirt-gobject-interface.c
> index 892db8b..a8e299c 100644
> --- a/libvirt-gobject/libvirt-gobject-interface.c
> +++ b/libvirt-gobject/libvirt-gobject-interface.c
> @@ -175,6 +175,8 @@ const gchar *gvir_interface_get_name(GVirInterface *iface)
>   * gvir_interface_get_config:
>   * @iface: the interface
>   * @flags: the flags
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the config
>   */
>  GVirConfigInterface *gvir_interface_get_config(GVirInterface *iface,
> diff --git a/libvirt-gobject/libvirt-gobject-manager.c b/libvirt-gobject/libvirt-gobject-manager.c
> index da5d31d..010e8da 100644
> --- a/libvirt-gobject/libvirt-gobject-manager.c
> +++ b/libvirt-gobject/libvirt-gobject-manager.c
> @@ -160,6 +160,7 @@ void gvir_manager_remove_connection(GVirManager *man,
>  
>  /**
>   * gvir_manager_get_connections:
> + *
>   * Returns: (transfer full)(element-type GVirConnection): the connections
>   */
>  GList *gvir_manager_get_connections(GVirManager *man)
> @@ -179,6 +180,7 @@ GList *gvir_manager_get_connections(GVirManager *man)
>  
>  /**
>   * gvir_manager_find_connection_by_uri:
> + *
>   * Returns: (transfer full)(allow-none): the connection,or NULL
>   */
>  GVirConnection *gvir_manager_find_connection_by_uri(GVirManager *man,
> diff --git a/libvirt-gobject/libvirt-gobject-network-filter.c b/libvirt-gobject/libvirt-gobject-network-filter.c
> index 5956a3d..103174b 100644
> --- a/libvirt-gobject/libvirt-gobject-network-filter.c
> +++ b/libvirt-gobject/libvirt-gobject-network-filter.c
> @@ -206,6 +206,8 @@ const gchar *gvir_network_filter_get_uuid(GVirNetworkFilter *filter)
>   * gvir_network_filter_get_config:
>   * @filter: the network_filter
>   * @flags: the flags
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the config
>   */
>  GVirConfigNetworkFilter *gvir_network_filter_get_config
> diff --git a/libvirt-gobject/libvirt-gobject-network.c b/libvirt-gobject/libvirt-gobject-network.c
> index 16cd2f1..2d195d9 100644
> --- a/libvirt-gobject/libvirt-gobject-network.c
> +++ b/libvirt-gobject/libvirt-gobject-network.c
> @@ -203,6 +203,8 @@ const gchar *gvir_network_get_uuid(GVirNetwork *network)
>   * gvir_network_get_config:
>   * @network: the network
>   * @flags: the flags
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the config
>   */
>  GVirConfigNetwork *gvir_network_get_config(GVirNetwork *network,
> diff --git a/libvirt-gobject/libvirt-gobject-node-device.c b/libvirt-gobject/libvirt-gobject-node-device.c
> index b565052..6f81f1a 100644
> --- a/libvirt-gobject/libvirt-gobject-node-device.c
> +++ b/libvirt-gobject/libvirt-gobject-node-device.c
> @@ -175,6 +175,8 @@ const gchar *gvir_node_device_get_name(GVirNodeDevice *device)
>   * gvir_node_device_get_config:
>   * @device: the node_device
>   * @flags: the flags
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the config
>   */
>  GVirConfigNodeDevice *gvir_node_device_get_config(GVirNodeDevice *device,
> diff --git a/libvirt-gobject/libvirt-gobject-secret.c b/libvirt-gobject/libvirt-gobject-secret.c
> index 3c9da86..299fdca 100644
> --- a/libvirt-gobject/libvirt-gobject-secret.c
> +++ b/libvirt-gobject/libvirt-gobject-secret.c
> @@ -191,6 +191,8 @@ const gchar *gvir_secret_get_uuid(GVirSecret *secret)
>   * gvir_secret_get_config:
>   * @secret: the secret
>   * @flags: the flags
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the config
>   */
>  GVirConfigSecret *gvir_secret_get_config(GVirSecret *secret,
> diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
> index 1d89496..f09f122 100644
> --- a/libvirt-gobject/libvirt-gobject-storage-pool.c
> +++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
> @@ -235,6 +235,8 @@ const gchar *gvir_storage_pool_get_uuid(GVirStoragePool *pool)
>   * gvir_storage_pool_get_config:
>   * @pool: the storage_pool
>   * @flags: the flags
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the config
>   */
>  GVirConfigStoragePool *gvir_storage_pool_get_config(GVirStoragePool *pool,
> @@ -260,6 +262,8 @@ GVirConfigStoragePool *gvir_storage_pool_get_config(GVirStoragePool *pool,
>  /**
>   * gvir_storage_pool_get_info:
>   * @pool: the storage_pool
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the info
>   */
>  GVirStoragePoolInfo *gvir_storage_pool_get_info(GVirStoragePool *pool,
> @@ -526,6 +530,8 @@ GVirStorageVol *gvir_storage_pool_get_volume(GVirStoragePool *pool,
>   * gvir_storage_pool_create_volume:
>   * @pool: the storage pool in which to create the volume
>   * @conf: the configuration for the new volume
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the newly created volume
>   */
>  GVirStorageVol *gvir_storage_pool_create_volume
> diff --git a/libvirt-gobject/libvirt-gobject-storage-vol.c b/libvirt-gobject/libvirt-gobject-storage-vol.c
> index 78ce76e..cd02b38 100644
> --- a/libvirt-gobject/libvirt-gobject-storage-vol.c
> +++ b/libvirt-gobject/libvirt-gobject-storage-vol.c
> @@ -225,6 +225,8 @@ const gchar *gvir_storage_vol_get_path(GVirStorageVol *vol, GError **error)
>   * gvir_storage_vol_get_config:
>   * @vol: the storage_vol
>   * @flags: the flags
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the config
>   */
>  GVirConfigStorageVol *gvir_storage_vol_get_config(GVirStorageVol *vol,
> @@ -250,6 +252,8 @@ GVirConfigStorageVol *gvir_storage_vol_get_config(GVirStorageVol *vol,
>  /**
>   * gvir_storage_vol_get_info:
>   * @vol: the storage_vol
> + * @err: Place-holder for possible errors
> + *
>   * Returns: (transfer full): the info
>   */
>  GVirStorageVolInfo *gvir_storage_vol_get_info(GVirStorageVol *vol,
> diff --git a/libvirt-gobject/libvirt-gobject-stream.c b/libvirt-gobject/libvirt-gobject-stream.c
> index 5486b95..60da4bc 100644
> --- a/libvirt-gobject/libvirt-gobject-stream.c
> +++ b/libvirt-gobject/libvirt-gobject-stream.c
> @@ -355,18 +355,20 @@ stream_sink(virStreamPtr st G_GNUC_UNUSED,
>   * @cancellable: cancellation notifier
>   * @func: (scope notified): the callback for writing data to application
>   * @user_data: (closure): data to be passed to @callback
> - * Returns: the number of bytes consumed or -1 upon error
> + * @error: #GError for error reporting, or %NULL to ignore.
>   *
>   * Receive the entire data stream, sending the data to the
>   * requested data sink. This is simply a convenient alternative
>   * to virStreamRecv, for apps that do blocking-I/o.
> + *
> + * Returns: the number of bytes consumed or -1 upon error
>   */
>  gssize
>  gvir_stream_receive_all(GVirStream *self,
>                          GCancellable *cancellable,
>                          GVirStreamSinkFunc func,
>                          gpointer user_data,
> -                        GError **err)
> +                        GError **error)
>  {
>      struct stream_sink_helper helper = {
>          .self = self,
> @@ -381,7 +383,7 @@ gvir_stream_receive_all(GVirStream *self,
>  
>      r = virStreamRecvAll(self->priv->handle, stream_sink, &helper);
>      if (r < 0) {
> -        gvir_set_error_literal(err, GVIR_STREAM_ERROR,
> +        gvir_set_error_literal(error, GVIR_STREAM_ERROR,
>                                 0,
>                                 "Unable to perform RecvAll");
>      }
> @@ -465,18 +467,20 @@ stream_source(virStreamPtr st G_GNUC_UNUSED,
>   * @cancellable: cancellation notifier
>   * @func: (scope notified): the callback for writing data to application
>   * @user_data: (closure): data to be passed to @callback
> - * Returns: the number of bytes consumed or -1 upon error
> + * @error: #GError for error reporting, or %NULL to ignore.
>   *
>   * Send the entire data stream, sending the data to the
>   * requested data source. This is simply a convenient alternative
>   * to virStreamRecv, for apps that do blocking-I/o.
> + *
> + * Returns: the number of bytes consumed or -1 upon error
>   */
>  gssize
>  gvir_stream_send_all(GVirStream *self,
>                       GCancellable *cancellable,
>                       GVirStreamSourceFunc func,
>                       gpointer user_data,
> -                     GError **err)
> +                     GError **error)
>  {
>      struct stream_source_helper helper = {
>          .self = self,
> @@ -491,7 +495,7 @@ gvir_stream_send_all(GVirStream *self,
>  
>      r = virStreamSendAll(self->priv->handle, stream_source, &helper);
>      if (r < 0) {
> -        gvir_set_error_literal(err, GVIR_STREAM_ERROR,
> +        gvir_set_error_literal(error, GVIR_STREAM_ERROR,
>                                 0,
>                                 "Unable to perform SendAll");
>      }
> @@ -618,7 +622,7 @@ GSourceFuncs gvir_stream_source_funcs = {
>  
>  
>  /**
> - * gvir_stream_add_watch: (skip):
> + * gvir_stream_add_watch: (skip)
>   * @stream: the stream
>   * @cond: the conditions to watch for (bitfield of #GVirStreamIOCondition)
>   * @func: (closure opaque): the function to call when the condition is satisfied
> diff --git a/libvirt-gobject/libvirt-gobject-stream.h b/libvirt-gobject/libvirt-gobject-stream.h
> index c84f2a2..4da83ac 100644
> --- a/libvirt-gobject/libvirt-gobject-stream.h
> +++ b/libvirt-gobject/libvirt-gobject-stream.h
> @@ -68,6 +68,7 @@ struct _GVirStreamClass
>   * @buf: (out) (array length=nbytes) (transfer none): data pointer
>   * @nbytes: data size
>   * @user_data: user data passed to the function
> + *
>   * Returns: the number of bytes filled, 0 upon end
>   * of file, or -1 upon error
>   */
> @@ -82,6 +83,7 @@ typedef gint (* GVirStreamSinkFunc)(GVirStream *stream,
>   * @buf: (out) (array length=nbytes) (transfer none): data pointer
>   * @nbytes: data size
>   * @user_data: user data passed to the function
> + *
>   * Returns: the number of bytes filled, 0 upon end
>   * of file, or -1 upon error
>   */
> -- 
> 1.7.7.6
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120502/4ae3b365/attachment-0001.sig>


More information about the libvir-list mailing list