On Sat, Jun 23, 2012 at 10:17:57PM +0300, Zeeshan Ali (Khattak) wrote: > From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx> > > - gvir_config_capabilities_cpu_add_feature > - gvir_config_capabilities_cpu_set_topology As I understand it, the capabilities XML is read-only, the only reason for these setters to exist is for use with GVirConfigDomainCpu which is added later in this patch set. I think I'd put the setters in this new class even if this makes the API asymetric (getters in one class, setters in another). Christophe > --- > libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c | 32 ++++++++++++++++++++ > libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h | 6 ++++ > libvirt-gconfig/libvirt-gconfig.sym | 2 ++ > 3 files changed, 40 insertions(+) > > diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c > index df77364..e517a20 100644 > --- a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c > +++ b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c > @@ -56,6 +56,21 @@ gvir_config_capabilities_cpu_get_arch(GVirConfigCapabilitiesCpu *cpu) > return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(cpu), "arch"); > } > > +/** > + * gvir_config_capabilities_cpu_add_feature: > + * > + * Adds a new feature to CPU. > + */ > +void gvir_config_capabilities_cpu_add_feature(GVirConfigCapabilitiesCpu *cpu, > + GVirConfigCapabilitiesCpuFeature *feature) > +{ > + g_return_if_fail(GVIR_CONFIG_IS_CAPABILITIES_CPU(cpu)); > + g_return_if_fail(GVIR_CONFIG_IS_CAPABILITIES_CPU_FEATURE(feature)); > + > + gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(cpu), > + GVIR_CONFIG_OBJECT(feature)); > +} > + > struct GetFeatureData { > GVirConfigXmlDoc *doc; > const gchar *schema; > @@ -133,3 +148,20 @@ gvir_config_capabilities_cpu_get_topology(GVirConfigCapabilitiesCpu *cpu) > > return GVIR_CONFIG_CAPABILITIES_CPU_TOPOLOGY(object); > } > + > +/** > + * gvir_config_capabilities_cpu_set_topology: > + * > + * Sets the topology of the cpu. > + */ > +void > +gvir_config_capabilities_cpu_set_topology(GVirConfigCapabilitiesCpu *cpu, > + GVirConfigCapabilitiesCpuTopology *topology) > +{ > + g_return_if_fail(GVIR_CONFIG_IS_CAPABILITIES_CPU(cpu)); > + g_return_if_fail(GVIR_CONFIG_IS_CAPABILITIES_CPU_TOPOLOGY(topology)); > + > + gvir_config_object_attach_replace(GVIR_CONFIG_OBJECT(cpu), > + "topology", > + GVIR_CONFIG_OBJECT(topology)); > +} > diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h > index 4d896ef..67fe607 100644 > --- a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h > +++ b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h > @@ -29,6 +29,7 @@ > #define __LIBVIRT_GCONFIG_CAPABILITIES_CPU_H__ > > #include "libvirt-gconfig-capabilities-cpu-topology.h" > +#include "libvirt-gconfig-capabilities-cpu-feature.h" > > G_BEGIN_DECLS > > @@ -63,10 +64,15 @@ GType gvir_config_capabilities_cpu_get_type(void); > > const gchar * > gvir_config_capabilities_cpu_get_arch(GVirConfigCapabilitiesCpu *cpu); > +void gvir_config_capabilities_cpu_add_feature(GVirConfigCapabilitiesCpu *cpu, > + GVirConfigCapabilitiesCpuFeature *feature); > GList * > gvir_config_capabilities_cpu_get_features(GVirConfigCapabilitiesCpu *cpu); > GVirConfigCapabilitiesCpuTopology * > gvir_config_capabilities_cpu_get_topology(GVirConfigCapabilitiesCpu *cpu); > +void > +gvir_config_capabilities_cpu_set_topology(GVirConfigCapabilitiesCpu *cpu, > + GVirConfigCapabilitiesCpuTopology *topology); > > G_END_DECLS > > diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym > index 5473148..a9e5da5 100644 > --- a/libvirt-gconfig/libvirt-gconfig.sym > +++ b/libvirt-gconfig/libvirt-gconfig.sym > @@ -389,9 +389,11 @@ LIBVIRT_GCONFIG_0.0.9 { > gvir_config_capabilities_get_guests; > > gvir_config_capabilities_cpu_get_type; > + gvir_config_capabilities_cpu_add_feature; > gvir_config_capabilities_cpu_get_arch; > gvir_config_capabilities_cpu_get_features; > gvir_config_capabilities_cpu_get_topology; > + gvir_config_capabilities_cpu_set_topology; > > gvir_config_capabilities_cpu_feature_get_type; > gvir_config_capabilities_cpu_feature_get_name; > -- > 1.7.10.4 > > -- > libvir-list mailing list > libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list
Attachment:
pgpgoARgRTGaj.pgp
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list