On Thu, Apr 21, 2016 at 3:14 PM, Christophe Fergeau <cfergeau(a)redhat.com> wrote:
Another patch that I wrote...
Christophe
On Fri, Apr 15, 2016 at 02:38:23PM +0100, Zeeshan Ali (Khattak) wrote:
> From: Christophe Fergeau <cfergeau(a)redhat.com>
>
> They will be useful to do more checks in the GVirDomainDeviceHostdev
> unit test.
> ---
> .../libvirt-gconfig-domain-address-pci.c | 45 ++++++++++++++++++++++
> .../libvirt-gconfig-domain-address-pci.h | 5 +++
> libvirt-gconfig/libvirt-gconfig.sym | 6 +++
> 3 files changed, 56 insertions(+)
>
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
> index 4bf94cc..0105402 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.c
> @@ -92,30 +92,75 @@ static void set_attribute_hex(GVirConfigDomainAddressPci
*address,
> g_free(format);
> }
>
> +int gvir_config_domain_address_pci_get_domain(GVirConfigDomainAddressPci *address)
> +{
> + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), -1);
> +
> + return gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(address),
> + NULL, "domain",
> + -1);
> +}
> +
> void gvir_config_domain_address_pci_set_domain(GVirConfigDomainAddressPci *address,
> guint16 pci_domain)
> {
> set_attribute_hex(address, "domain", pci_domain, 0, G_MAXUINT16, 4);
> }
>
> +int gvir_config_domain_address_pci_get_bus(GVirConfigDomainAddressPci *address)
> +{
> + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), -1);
> +
> + return gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(address),
> + NULL, "bus",
> + -1);
> +}
> +
> void gvir_config_domain_address_pci_set_bus(GVirConfigDomainAddressPci *address,
> guchar bus)
> {
> set_attribute_hex(address, "bus", bus, 0, G_MAXUINT8, 2);
> }
>
> +int gvir_config_domain_address_pci_get_slot(GVirConfigDomainAddressPci *address)
> +{
> + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), -1);
> +
> + return gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(address),
> + NULL, "slot",
> + -1);
> +}
> +
> void gvir_config_domain_address_pci_set_slot(GVirConfigDomainAddressPci *address,
> guchar slot)
> {
> set_attribute_hex(address, "slot", slot, 0, 0x1f, 2);
> }
>
> +int gvir_config_domain_address_pci_get_function(GVirConfigDomainAddressPci
*address)
> +{
> + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), -1);
> +
> + return gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(address),
> + NULL, "function",
> + -1);
> +}
> +
> void gvir_config_domain_address_pci_set_function(GVirConfigDomainAddressPci
*address,
> guchar function)
> {
> set_attribute_hex(address, "function", function, 0, 7, 1);
> }
>
> +gboolean gvir_config_domain_address_pci_get_multifunction(GVirConfigDomainAddressPci
*address)
> +{
> + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_ADDRESS_PCI(address), FALSE);
> +
> + return gvir_config_object_get_attribute_boolean(GVIR_CONFIG_OBJECT(address),
> + NULL,
"multifunction",
> + FALSE);
> +}
> +
> void gvir_config_domain_address_pci_set_multifunction(GVirConfigDomainAddressPci
*address,
> gboolean multifunction)
> {
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.h
b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.h
> index 3b82624..cdef4a8 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain-address-pci.h
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-address-pci.h
> @@ -62,14 +62,19 @@ GVirConfigDomainAddressPci
*gvir_config_domain_address_pci_new(void);
> GVirConfigDomainAddressPci *gvir_config_domain_address_pci_new_from_xml(const gchar
*xml,
> GError
**error);
>
> +int gvir_config_domain_address_pci_get_domain(GVirConfigDomainAddressPci *address);
> void gvir_config_domain_address_pci_set_domain(GVirConfigDomainAddressPci *address,
> guint16 pci_domain);
> +int gvir_config_domain_address_pci_get_bus(GVirConfigDomainAddressPci *address);
> void gvir_config_domain_address_pci_set_bus(GVirConfigDomainAddressPci *address,
> guchar bus);
> +int gvir_config_domain_address_pci_get_slot(GVirConfigDomainAddressPci *address);
> void gvir_config_domain_address_pci_set_slot(GVirConfigDomainAddressPci *address,
> guchar slot);
> +int gvir_config_domain_address_pci_get_function(GVirConfigDomainAddressPci
*address);
> void gvir_config_domain_address_pci_set_function(GVirConfigDomainAddressPci
*address,
> guchar function);
> +gboolean gvir_config_domain_address_pci_get_multifunction(GVirConfigDomainAddressPci
*address);
> void gvir_config_domain_address_pci_set_multifunction(GVirConfigDomainAddressPci
*address,
> gboolean multifunction);
>
> diff --git a/libvirt-gconfig/libvirt-gconfig.sym
b/libvirt-gconfig/libvirt-gconfig.sym
> index f26423f..a5040ba 100644
> --- a/libvirt-gconfig/libvirt-gconfig.sym
> +++ b/libvirt-gconfig/libvirt-gconfig.sym
> @@ -735,6 +735,12 @@ global:
>
> LIBVIRT_GCONFIG_0.2.4 {
> global:
> + gvir_config_domain_address_pci_get_bus;
> + gvir_config_domain_address_pci_get_domain;
> + gvir_config_domain_address_pci_get_function;
> + gvir_config_domain_address_pci_get_multifunction;
> + gvir_config_domain_address_pci_get_slot;
> +
> gvir_config_domain_graphics_spice_set_gl;
>
> gvir_config_domain_hostdev_get_boot_order;
> --
> 2.5.5
>
> --
> libvir-list mailing list
> libvir-list(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/libvir-list