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

Re: [Xen-devel] [PATCH 16/27] tools/libxl: Infrastructure for reading a libxl migration v2 stream



On 17/06/15 08:57, Wen Congyang wrote:
>> +    /* Queue up reading the body. */
>> > +    size_t bytes_to_read;
>> > +
>> > +    switch (rec_hdr->type) {
>> > +        /*
>> > +         * Emulator records want to retain the blob in the pipe, for a 
>> > further
>> > +         * datacopier call to move elsewhere.  Just read the emulator 
>> > header.
>> > +         */
> In this case, we should not call ROUNDUP().
>
>> > +    case REC_TYPE_EMULATOR_CONTEXT:
>> > +        bytes_to_read = sizeof(struct libxl_sr_emulator_hdr);
>> > +        break;
>> > +
>> > +    default:
>> > +        bytes_to_read = rec_hdr->length;
>> > +        break;
>> > +    }
>> > +
>> > +    bytes_to_read = ROUNDUP(bytes_to_read, REC_ALIGN_ORDER);
> So, I think it is better to move ROUNDUP to default case.
>
> Thanks
> Wen Congyang
>

sizeof(struct libxl_sr_emulator_hdr) is cunningly of the appropriate
order already.

I suppose it is probably better to move the roundup into the default
case and assert() appropriate alignment after the switch()

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.