On Fri, Apr 16, 2010 at 11:05:39PM -0400, Chris Lalancette wrote:
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.
Ok, but it should still be possible to have a 'virDomainParserConfig *' struct
in the virCaps struct, and then at time of parse copy it to the virDOmainDef
struct so that its there at time of free. This should avoid needing to change
any of the functions
Regards,
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://deltacloud.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|