[libvirt] [libvirt-glib 5/6] Remove now redundant 'path' property

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Wed Feb 29 13:51:53 UTC 2012


On Wed, Feb 29, 2012 at 3:18 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> On Tue, Feb 28, 2012 at 08:25:06PM +0200, Zeeshan Ali (Khattak) wrote:
>> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>>
>> Remove now redundant 'path' property from GVirDomainDevice subclasses.
>> ---
>>  libvirt-gobject/libvirt-gobject-domain-disk.c      |   88 ++++----------------
>>  libvirt-gobject/libvirt-gobject-domain-disk.h      |    3 +-
>>  libvirt-gobject/libvirt-gobject-domain-interface.c |   89 +++-----------------
>>  libvirt-gobject/libvirt-gobject-domain-interface.h |    3 +-
>>  4 files changed, 31 insertions(+), 152 deletions(-)
>>
>> diff --git a/libvirt-gobject/libvirt-gobject-domain-disk.c b/libvirt-gobject/libvirt-gobject-domain-disk.c
>> index fb7672e..42e0e6c 100644
>> --- a/libvirt-gobject/libvirt-gobject-domain-disk.c
>> +++ b/libvirt-gobject/libvirt-gobject-domain-disk.c
>> @@ -34,75 +34,22 @@
>>  #define GVIR_DOMAIN_DISK_GET_PRIVATE(obj)                         \
>>          (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_DOMAIN_DISK, GVirDomainDiskPrivate))
>>
>> -struct _GVirDomainDiskPrivate
>> -{
>> -    gchar *path;
>> -};
>
> The rest of the code (GVirConfig*) always has a Private structure with a
> gboolean unused when it's empty, I'd rather we stayed consistent (though I
> keep thinking that we should remove these empty private structs everywhere
> :)

Ah ok, I didn't notice it. Since Daniel wants to keeep this private
struct too, I'll modify this patch accordingly.

>>  static GVirDomainDiskStats *
>> @@ -151,6 +82,15 @@ gvir_domain_disk_stats_free(GVirDomainDiskStats *stats)
>>  G_DEFINE_BOXED_TYPE(GVirDomainDiskStats, gvir_domain_disk_stats,
>>                      gvir_domain_disk_stats_copy, gvir_domain_disk_stats_free)
>>
>> +static const gchar *gvir_domain_disk_get_path(GVirDomainDisk *self)
>> +{
>> +    GVirConfigDomainDevice *config;
>> +
>> +    config = gvir_domain_device_get_config(GVIR_DOMAIN_DEVICE(self));
>
> config needs to be unref'ed after use.

Oops!

>> +
>> +    return gvir_config_domain_disk_get_target_dev (GVIR_CONFIG_DOMAIN_DISK (config));
>
> and the return value would be non-const after the changes I mentioned in my
> previous review.

But you are wrong (see reply to that mail). :)

>> diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.h b/libvirt-gobject/libvirt-gobject-domain-interface.h
>> index 62848db..26b7d1c 100644
>> --- a/libvirt-gobject/libvirt-gobject-domain-interface.h
>> +++ b/libvirt-gobject/libvirt-gobject-domain-interface.h
>> @@ -59,7 +59,8 @@ struct _GVirDomainInterface
>>  {
>>      GVirDomainDevice parent;
>>
>> -    GVirDomainInterfacePrivate *priv;
>> +    /* In case we need a private struct in future */
>> +    gpointer padding[1];
>
> Can you send an updated version of this patch once you have fixed all of
> these things?

Sure, once we agree on the const issue. :)

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124




More information about the libvir-list mailing list