[libvirt] [PATCHv5 3/5] Add GVirConfigDomainHostdevPci

Christophe Fergeau cfergeau at redhat.com
Mon Jul 18 14:58:14 UTC 2016


gconfig: prefix to add to the subject line.

On Wed, Jul 06, 2016 at 10:45:53PM +0100, Zeeshan Ali (Khattak) wrote:
> +
> +const gchar *gvir_config_domain_hostdev_pci_get_rom_file(GVirConfigDomainHostdevPci *hostdev)
> +{
> +    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(hostdev), "rom", "file");
> +}
> +
> +gboolean gvir_config_domain_hostdev_pci_get_rom_bar(GVirConfigDomainHostdevPci *hostdev)
> +{
> +    xmlNodePtr hostdev_node;
> +    xmlNodePtr rom_node;
> +    const gchar *bar_str;
> +
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_HOSTDEV_PCI(hostdev), FALSE);
> +
> +    hostdev_node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(hostdev));
> +    g_return_val_if_fail(hostdev_node != NULL, FALSE);
> +
> +    rom_node = gvir_config_xml_get_element(hostdev_node, "rom", NULL);
> +    if (!rom_node || !(rom_node->children))
> +        /* When containain rom node is missing, default value is TRUE for newer Qemu */
> +        return TRUE;

"containain" typo

> +
> +    bar_str = gvir_config_xml_get_attribute_content(rom_node, "bar");
> +    if (g_strcmp0(bar_str, "on"))
> +        return TRUE;
> +    else
> +        return FALSE;

Wouldn't:
    bar_str = gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(hostdev), "rom", "bar");
    return (g_strcmp0(bar_str, "on") == 0)
work too (and be simpler)?

Reviewed-by: Christophe Fergeau <cfergeau at redhat.com>

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160718/a39c41ee/attachment-0001.sig>


More information about the libvir-list mailing list