Re: [libvirt] [PATCH 03/10] Add namespace callback hooks to domain_conf.

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

 



On 04/21/2010 10:01 AM, Chris Lalancette wrote:
> This patch adds namespace XML parsers to be hooked into
> the main domain parser.  This allows for individual hypervisor
> drivers to add per-namespace XML into the main domain XML.

> 
> @@ -4366,6 +4372,22 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
>              goto error;
>      }
>  
> +    /* callout to per-namespace parsers (in the individual drivers) */
> +    if (caps->ns) {
> +        /* we have to make a copy of all of the callback pointers here since
> +         * we won't have the virCaps structure available during free
> +         */
> +        def->ns.parse = caps->ns->parse;
> +        def->ns.free = caps->ns->free;
> +        def->ns.format = caps->ns->format;
> +        def->ns.href = caps->ns->href;

Can these four lines be simplified as: def->ns = *caps->ns

> +    if (def->namespaceData && def->ns.href)
> +        virBufferVSprintf(&buf, " %s", (def->ns.href)());

Are we guaranteed that def->namespaceData will be non-null if ns.parse
succeeded, or should we call ns.href if present even if
def->namespaceData is NULL?

> +    if (def->namespaceData && def->ns.format) {
> +        if ((def->ns.format)(&buf, def->namespaceData) < 0)

Likewise - can ns.format exist, but namespaceData validly be NULL after
a successful ns.parse?

If ns.parse is required to set namespaceData to a non-NULL value on
success, then ACK.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital 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]