Re: [libvirt-glib 1/6] Getters for GVirConfigDomainInterface attributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 28, 2012 at 08:25:02PM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>
> 
> ---
>  libvirt-gconfig/libvirt-gconfig-domain-interface.c |   35 ++++++++++++++++++++
>  libvirt-gconfig/libvirt-gconfig-domain-interface.h |    4 ++
>  libvirt-gconfig/libvirt-gconfig.sym                |    4 ++
>  3 files changed, 43 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.c b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
> index 85cc194..61d35bd 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-interface.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.c
> @@ -96,6 +96,41 @@ void gvir_config_domain_interface_set_model(GVirConfigDomainInterface *interface
>                                                      "model", "type", model);
>  }
>  
> +const char *gvir_config_domain_interface_get_ifname(GVirConfigDomainInterface *interface)

Unless I'm missing something, this should not be const (caller needs to
free the returned string).

> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL);
> +
> +    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(interface),
> +                                            "target", "device");

This is "dev", not "device"

> +}
> +
> +GVirConfigDomainInterfaceLinkState gvir_config_domain_interface_get_link_state(GVirConfigDomainInterface *interface)
> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface),
> +                         GVIR_CONFIG_DOMAIN_INTERFACE_LINK_STATE_DEFAULT);
> +
> +    return gvir_config_object_get_attribute_genum(GVIR_CONFIG_OBJECT(interface),
> +                                                  "link", "state",
> +                                                  GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_LINK_STATE,
> +                                                  GVIR_CONFIG_DOMAIN_INTERFACE_LINK_STATE_DEFAULT);
> +}

Have you tested this? Is it available for reading after having been set?
The reason I'm asking is that libvirt documentation only talk about
modifying it.

> +
> +const char *gvir_config_domain_interface_get_mac(GVirConfigDomainInterface *interface)

Non-const here too

> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL);
> +
> +    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(interface),
> +                                            "mac", "address");
> +}
> +
> +const char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface *interface)

And same for this getter.

> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL);
> +
> +    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(interface),
> +                                            "model", "type");
> +}
> +
>  G_GNUC_INTERNAL GVirConfigDomainDevice *
>  gvir_config_domain_interface_new_from_tree(GVirConfigXmlDoc *doc,
>                                             xmlNodePtr tree)
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-interface.h b/libvirt-gconfig/libvirt-gconfig-domain-interface.h
> index 6e802fb..c8c4fb3 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-interface.h
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-interface.h
> @@ -72,6 +72,10 @@ void gvir_config_domain_interface_set_mac(GVirConfigDomainInterface *interface,
>                                            const char *mac_address);
>  void gvir_config_domain_interface_set_model(GVirConfigDomainInterface *interface,
>                                              const char *model);
> +const char *gvir_config_domain_interface_get_ifname(GVirConfigDomainInterface *interface);
> +GVirConfigDomainInterfaceLinkState gvir_config_domain_interface_get_link_state(GVirConfigDomainInterface *interface);
> +const char *gvir_config_domain_interface_get_mac(GVirConfigDomainInterface *interface);
> +const char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface *interface);
>  
>  G_END_DECLS
>  
> diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
> index 96ce58f..f91b8b0 100644
> --- a/libvirt-gconfig/libvirt-gconfig.sym
> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> @@ -145,6 +145,10 @@ LIBVIRT_GCONFIG_0.0.4 {
>  	gvir_config_domain_interface_set_link_state;
>  	gvir_config_domain_interface_set_mac;
>  	gvir_config_domain_interface_set_model;
> +	gvir_config_domain_interface_get_ifname;
> +	gvir_config_domain_interface_get_link_state;
> +	gvir_config_domain_interface_get_mac;
> +	gvir_config_domain_interface_get_model;

The other sections in this file put getter and setter for the same property
next to each other, I'd prefer if we stayed consistant:

+	gvir_config_domain_interface_get_ifname;
+	gvir_config_domain_interface_set_ifname;
+	gvir_config_domain_interface_get_link_state;
 	gvir_config_domain_interface_set_link_state;
+	gvir_config_domain_interface_get_mac;
 	gvir_config_domain_interface_set_mac;
+	gvir_config_domain_interface_get_model;
 	gvir_config_domain_interface_set_model;

>  
>  	gvir_config_domain_interface_bridge_get_type;
>  	gvir_config_domain_interface_bridge_new;
> -- 
> 1.7.7.6
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpp1ZX9lmBMo.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]