On Mon, Mar 11, 2013 at 04:06:12PM +0100, Peter Krempa wrote: > The virCaps structure gathered a ton of irrelevant data over time that. > The original reason is that it was propagated to the XML parser > functions. > > This patch aims to create a new data structure virDomainXMLConf that > will contain immutable data that are used by the XML parser. This will > allow two things we need: > > 1) Get rid of the stuff from virCaps > > 2) Allow us to add callbacks to check and add driver specific stuff > after domain XML is parsed. > > This first attempt removes pointers to private data allocation functions > to this new structure and update all callers and function that require > them. > --- > > Notes: > Version 3: > - Changed comment at the capabilities structure > - virDomainXMLConfGetNamespace now returns a pointer instead of struct > - use virDomainXMLPrivateDataCallbacks instead of separate pointers > - even more fallout fixed in driver's I wasn't compiling originaly > Version 2: > - complete rewrite > > src/conf/capabilities.h | 8 ++---- > src/conf/domain_conf.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++ > src/conf/domain_conf.h | 27 +++++++++++++++++++ > 3 files changed, 100 insertions(+), 6 deletions(-) > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c > index 717fc20..5bec673 100644 > --- a/src/conf/domain_conf.c > +++ b/src/conf/domain_conf.c > @@ -736,6 +736,77 @@ static int virDomainObjOnceInit(void) > > VIR_ONCE_GLOBAL_INIT(virDomainObj) > > + > +/* This structure holds various callbacks and data needed > + * while parsing and creating domain XMLs */ > +struct _virDomainXMLConf { > + virObject parent; > + > + /* domain private data management callbacks */ > + virDomainXMLPrivateDataCallbacks privateData; > + > + /* XML namespace callbacks */ > + virDomainXMLNamespace ns; > + }; > + > + > + > +static virClassPtr virDomainXMLConfClass; > + > +static int virDomainXMLConfOnceInit(void) > +{ > + if (!(virDomainXMLConfClass = virClassNew(virClassForObject(), > + "virDomainXMLConf", > + sizeof(virDomainXMLConf), > + NULL))) > + return -1; > + > + return 0; > +} > + > +VIR_ONCE_GLOBAL_INIT(virDomainXMLConf) We already have a VIR_ONCE_GLOBAL_INIT(virDomainObj) in this file. There is no need to have multiple global init fnuctions per file, just put all the functionality in one. ACK aside from that issue Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list