[libvirt] [RFC PATCH 0/6] Split domain_conf.h

Daniel P. Berrangé berrange at redhat.com
Fri Jul 19 13:07:48 UTC 2019


On Fri, Jul 19, 2019 at 02:15:42PM +0200, Ján Tomko wrote:
> Currently, domain_conf.{c,h} is a giant pile of functions somewhat
> related to the domain definition. Try to change that by splitting out
> the type declarations, XML parsing and XML formatting from the header
> file.

Refactoring this is totally overdue.

For most newer stuff we've been using a different naming
convention and split of code, more closely following the
1 file per object / def, named to match. I think it'd be good
to align with that more closely.

I can see that the virdomaindef.c file is still going to
be quite huge though. So splitting off the parse + format
code would still be a win, at least for the virDomainDef.
Probably not worth it for virDomainObj.

I'm not convinced we need to have a separate header
just for the typedefs, without the helper methds.

So how about, as a starting point:

     virdomaindef.h
     virdomaindef.c
     virdomaindefparse.h
     virdomaindefparse.c
     virdomaindefformat.h
     virdomaindefformat.c
     virdomainobj.h
     virdomainobj.c


Some of the stuff we currently have in domain_conf.c
is really stuff that belongs in the virt drivers, but
we dumped it into domain_conf.c so that we could share
it across drivers.

This could suggest a virdomain{obj,def}helpers.{c.h}
for the virt driver code that's being shared.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list