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

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

 



ACK, though you convinced me that we can and should propagate const char *
throughout the API, but that's another patch.

Christophe

On Thu, Mar 01, 2012 at 12:15:39AM +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 eab4313..5fe27a1 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);
>  }
>  
> +char *gvir_config_domain_interface_get_ifname(GVirConfigDomainInterface *interface)
> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL);
> +
> +    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(interface),
> +                                            "target", "dev");
> +}
> +
> +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);
> +}
> +
> +char *gvir_config_domain_interface_get_mac(GVirConfigDomainInterface *interface)
> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_INTERFACE(interface), NULL);
> +
> +    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(interface),
> +                                            "mac", "address");
> +}
> +
> +char *gvir_config_domain_interface_get_model(GVirConfigDomainInterface *interface)
> +{
> +    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..567f95a 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);
> +char *gvir_config_domain_interface_get_ifname(GVirConfigDomainInterface *interface);
> +GVirConfigDomainInterfaceLinkState gvir_config_domain_interface_get_link_state(GVirConfigDomainInterface *interface);
> +char *gvir_config_domain_interface_get_mac(GVirConfigDomainInterface *interface);
> +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..1329c17 100644
> --- a/libvirt-gconfig/libvirt-gconfig.sym
> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> @@ -142,9 +142,13 @@ LIBVIRT_GCONFIG_0.0.4 {
>  	gvir_config_domain_interface_get_type;
>  	gvir_config_domain_interface_link_state_get_type;
>  	gvir_config_domain_interface_set_ifname;
> +	gvir_config_domain_interface_get_ifname;
>  	gvir_config_domain_interface_set_link_state;
> +	gvir_config_domain_interface_get_link_state;
>  	gvir_config_domain_interface_set_mac;
> +	gvir_config_domain_interface_get_mac;
>  	gvir_config_domain_interface_set_model;
> +	gvir_config_domain_interface_get_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: pgpHnlqRJQWGy.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]