Re: [PATCH 00/34] network events feature v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11.12.2013 20:28, Eric Blake wrote:
> On 12/11/2013 12:15 PM, Eric Blake wrote:
> 
>> struct _virObjectEvent {
>>     virObject parent;
>>     int eventID;
>>     virObjectMeta meta;
>> };
>>
>> Only has alignment specified by virObject (which in turn is unsigned
>> int, int, void*),
> 
> struct _virObject {
>     unsigned int magic;
>     int refs;
>     virClassPtr klass;
> };
> 
> 
>> I think one possible solution would be as simple as altering
>> src/util/virobject.h to change 'magic' from 'unsigned int' to 'unsigned
>> long long' - then ALL virObject structs will be forcefully aligned to
>> the worst case between void* and long long, so that any subclass can use
>> long long without requiring stricter alignment than the parent class,
>> and so that downcasting code like domain_event.c no longer warns.  But
>> it does make every object consume more memory on 64-bit platforms (from
>> 16 bytes into 24 bytes), is that okay?
> 
> Or maybe even change _virObject to contain a union:
> 
> struct _virObject {
>     union {
>         long long align;
>         struct {
>             unsigned int magic;
>             int refs;
>         } s;
>     } u;
>     virClassPtr klass;
> }

Yep. I can confirm that this works. This and all the subsequent code
adaptations made me able to compile again. Will you post it as a patch
please?

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]