From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFtEP-0001D3-OY for qemu-devel@nongnu.org; Wed, 13 Mar 2013 17:29:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UFtEL-0008HW-A5 for qemu-devel@nongnu.org; Wed, 13 Mar 2013 17:29:05 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:55654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UFtEL-0008HJ-6D for qemu-devel@nongnu.org; Wed, 13 Mar 2013 17:29:01 -0400 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 13 Mar 2013 17:29:00 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 76E306E804C for ; Wed, 13 Mar 2013 17:28:55 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r2DLSv9e283172 for ; Wed, 13 Mar 2013 17:28:57 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r2DLSu2i001577 for ; Wed, 13 Mar 2013 18:28:57 -0300 Message-ID: <5140EF98.8020307@linux.vnet.ibm.com> Date: Wed, 13 Mar 2013 17:28:56 -0400 From: Stefan Berger MIME-Version: 1.0 References: <1363200988-17865-1-git-send-email-jschopp@linux.vnet.ibm.com> <1363200988-17865-5-git-send-email-jschopp@linux.vnet.ibm.com> <20130313211135.GB6188@vm> In-Reply-To: <20130313211135.GB6188@vm> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/9] qemu_qsb.diff List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mdroth Cc: Joel Schopp , qemu-devel@nongnu.org On 03/13/2013 05:11 PM, mdroth wrote: > On Wed, Mar 13, 2013 at 01:56:23PM -0500, Joel Schopp wrote: >> This patch adds support functions for operating on in memory sized file buffers. > There's been some past refactorings to remove non-migration users of > QEMUFile, and AFAIK that's still the case today. QEMUFile satisfies > funky requirements like rate-limiting, buffering, etc that were specific > to migration. > > IIUC all we want here is an abstraction on top of write()/memcpy(), > and access to qemu_{put|get}_be* utility functions. > > Have you considered rolling those abstractions in the visitor > implementations as opposed to extending QEMUFile, and using > be*_to_cpus/cpus_to_be* helpers directly instead (like block/qcow2.c > does, for example)? The advantage of using the QEMUFile abstractions is that now you can build a visitor on top of it and read from buffers, sockets, BDRV's (later on), plain files, and whatever else you can hide underneath that interface. Back in 2011 when I initially wrote this code there at least was talk about using ASN.1 for migration, but this is nearly 2 years ago and it may never be done that way, so this was one driving force behind using QEMUFile inside the visitor. Besides that we later want to use the visitors for writing into virtual NVRAM, which we would build on top of a QEMUFile wrapping BDRVs. So there are some immediate advantages of using the common QEMUFile interface for reading and writing of data from different types of sources. Regards, Stefan