[libvirt] [RFC PATCH 2/5] Add namespace callback hooks to domain_conf.

Chris Lalancette clalance at redhat.com
Sat Apr 17 03:05:39 UTC 2010

On 04/16/2010 07:20 AM, Daniel P. Berrange wrote:
>> +
>>  /* Guest VM main configuration */
>>  typedef struct _virDomainDef virDomainDef;
>>  typedef virDomainDef *virDomainDefPtr;
>> @@ -863,6 +876,9 @@ struct _virDomainDef {
>>      virSecurityLabelDef seclabel;
>>      virDomainWatchdogDefPtr watchdog;
>>      virCPUDefPtr cpu;
>> +
>> +    void *namespaceData;
>> +    struct xmlNamespace ns;
>>  };
> As mentioned in the other patch reply, I think it'd be preferable to
> keep a struct with the parser config in virCapsPtr, so we don't need
> to add to this struct, nor pass it into all the parse/format methods.

I actually started out with this in the virCaps structure, but there was one
problem with that; at virDomainDefFree time, the caps pointer is *not* passed
in (nor is it stored in the virDomainDef structure), so you can't call the
namespace-specific free function.  So it was a choice between modifying all of
the callers of virDomainDefFree to pass in the virCaps structure, or modifying all
of the callers of the virDomainDefParse* to pass in the struct xmlNamespace callback
structure.  I chose the latter because logically the namespaceData does belong in
the virDomainDef structure, since it is part of the XML.

Chris Lalancette

More information about the libvir-list mailing list