From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVHxi-0000XD-3T for qemu-devel@nongnu.org; Tue, 10 Mar 2015 07:04:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVHxe-0004Cw-Jc for qemu-devel@nongnu.org; Tue, 10 Mar 2015 07:04:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVHxe-0004Cn-Az for qemu-devel@nongnu.org; Tue, 10 Mar 2015 07:04:30 -0400 Date: Tue, 10 Mar 2015 11:04:14 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20150310110414.GE2338@work-vm> References: <1424883128-9841-1-git-send-email-dgilbert@redhat.com> <1424883128-9841-10-git-send-email-dgilbert@redhat.com> <20150310045815.GA11973@voom.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150310045815.GA11973@voom.redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 09/45] Migration commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, quintela@redhat.com, qemu-devel@nongnu.org, amit.shah@redhat.com, pbonzini@redhat.com, yanghy@cn.fujitsu.com * David Gibson (david@gibson.dropbear.id.au) wrote: > On Wed, Feb 25, 2015 at 04:51:32PM +0000, Dr. David Alan Gilbert (git) wrote: > > From: "Dr. David Alan Gilbert" > > > > 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 > > [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 / dgilbert@redhat.com / Manchester, UK