[libvirt] [PATCH v6 7/8] snapshot: Create virDomainMoment base class

Daniel P. Berrangé berrange at redhat.com
Fri Mar 15 14:05:28 UTC 2019


On Fri, Mar 15, 2019 at 08:51:39AM -0500, Eric Blake wrote:
> On 3/15/19 8:34 AM, Ján Tomko wrote:
> > On Fri, Mar 15, 2019 at 12:02:32AM -0500, Eric Blake wrote:
> >> Upcoming patches want to add virDomainCheckpoint that behaves very
> >> similarly to virDomainCheckpoint; th eeasiest way to share common code
> >> is to give both classes a common base class.  Thanks to the accessor
> >> functions in the previous patch, we have very few changes required
> >> outside of datatypes.[ch].  This also gets rid of the temporary rename
> >> hack that the previous patch used for compiler verification.
> >>
> 
> >> struct _virDomainSnapshot {
> >> -    virObject parent;
> >> -    char *_name;
> >> -    virDomainPtr _domain;
> >> +    virDomainMoment parent;
> > 
> > This breaks the test suite, saying:
> > error : object size 32 of virDomainSnapshot is smaller than parent class 32
> 
> The error message is wrong, but yes, I'll need to patch virObject first
> to allow a child class that adds nothing over its base class.  (Serves
> me right for mailing patches at midnight)

Or add a dummy bool member to the subclass to make it bigger

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