<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Sorry, I noticed just now that here you
      are discussing about the problem with the compilation of libvirt
      on ARM platforms. An alternative solution can be ATTRIBUTE_PACKED.<br>
      <br>
      I've sent right now to the ML a patch based on this.<br>
      <br>
      Michele<br>
      <br>
      On 12/12/2013 17:11, Daniel P. Berrange wrote:<br>
    </div>
    <blockquote cite="mid:20131212161112.GX25234@redhat.com" type="cite">
      <pre wrap="">On Wed, Dec 11, 2013 at 12:28:32PM -0700, Eric Blake wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">On 12/11/2013 12:15 PM, Eric Blake wrote:

</pre>
        <blockquote type="cite">
          <pre wrap="">struct _virObjectEvent {
    virObject parent;
    int eventID;
    virObjectMeta meta;
};

Only has alignment specified by virObject (which in turn is unsigned
int, int, void*),
</pre>
        </blockquote>
        <pre wrap="">
struct _virObject {
    unsigned int magic;
    int refs;
    virClassPtr klass;
};


</pre>
        <blockquote type="cite">
          <pre wrap="">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?
</pre>
        </blockquote>
        <pre wrap="">
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;
}

which keeps the size at 16 bytes on 64-bit platform, keeps things at 12
bytes on 32-bit platforms that don't care about long long alignment, and
for ARM (*) would change things from 12 to 16 bytes with 8-byte
alignment for the long long.

Yeah, that means using obj->u.s.refs instead of obj->refs, but most code
shouldn't be directly mucking with object-internal fields, so hopefully
the fallout would be limited to just virobject.c (if only C99 had
anonymous struct/unions; C11 does, but we don't require that yet).

(*) Am I correct that your platform with the compile failure is a 32-bit
ARM platform with 4-byte pointers? Because if it were 64-bit, then I
would have guessed that an 8-byte pointer would already be forcing
8-byte alignment, such that use of 'long long' in a subclass wouldn't be
warning about changed alignment.
</pre>
      </blockquote>
      <pre wrap="">
That seems reasonable to me - it makes sense that we should have
our base object type be nicely aligned, instead of trying to fix
this in the events code (and potentially anywhere else using
objects in the future).

Daniel
</pre>
    </blockquote>
    <br>
    <br>
    <div class="moz-signature">-- <br>
      <strong><span style="font-size: large;"><span style="color:
            #2e3436;">Michele Paolino</span></span></strong><span
        style="font-size:14px;"><span style="color: rgb(46, 52, 54);">,
        </span>Virtualization R&D Engineer<span style="color:
          rgb(46, 52, 54);"> </span></span><br>
      <span style="color: #888888;">Virtual Open Systems</span><br>
      <em><span style="color: #888888;">Open Source  KVM 
          Virtualization  Developments</span></em><br>
      <em><span style="color: #888888;">Multicore Systems Virtualization
          Porting Services</span></em><br>
      <span style="color: #888888;">Web</span><span style="color:
        #888888;"><em>:</em></span><span style="color: #888888;"> </span><span
        style="color: #888888;"><span style="text-decoration:
          underline;"><a href="http://www.virtualopensystems.com/">www.virtualopensystems.</a><a
            href="http://www.virtualopensystems.com/">com</a></span></span>
      <p><br>
      </p>
    </div>
  </body>
</html>