[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 09/45] Migration commands
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [Qemu-devel] [PATCH v5 09/45] Migration commands |
Date: |
Tue, 10 Mar 2015 11:04:14 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
* David Gibson (address@hidden) wrote:
> On Wed, Feb 25, 2015 at 04:51:32PM +0000, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <address@hidden>
> >
> > Create QEMU_VM_COMMAND section type for sending commands from
> > source to destination. These commands are not intended to convey
> > guest state but to control the migration process.
> >
> > For use in postcopy.
> >
> > Signed-off-by: Dr. David Alan Gilbert <address@hidden>
>
> [snip]
> > +/* Send a 'QEMU_VM_COMMAND' type element with the command
> > + * and associated data.
> > + */
> > +void qemu_savevm_command_send(QEMUFile *f,
> > + enum qemu_vm_cmd command,
> > + uint16_t len,
> > + uint8_t *data)
> > +{
> > + uint32_t tmp = (uint16_t)command;
>
> Erm.. cast to u16, assign to u32, then send as u16? What's up with
> that?
Hmm yes, that is insane; now changed to:
+void qemu_savevm_command_send(QEMUFile *f,
+ enum qemu_vm_cmd command,
+ uint16_t len,
+ uint8_t *data)
+{
+ qemu_put_byte(f, QEMU_VM_COMMAND);
+ qemu_put_be16(f, (uint16_t)command);
+ qemu_put_be16(f, len);
+ if (len) {
+ qemu_put_buffer(f, data, len);
+ }
+ qemu_fflush(f);
+}
Thanks,
Dave
>
> > + qemu_put_byte(f, QEMU_VM_COMMAND);
> > + qemu_put_be16(f, tmp);
> > + qemu_put_be16(f, len);
> > + if (len) {
> > + qemu_put_buffer(f, data, len);
> > + }
> > + qemu_fflush(f);
> > +}
> > +
>
> --
> David Gibson | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_
> _other_
> | _way_ _around_!
> http://www.ozlabs.org/~dgibson
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK