From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KdRG4-0004ap-7c for qemu-devel@nongnu.org; Wed, 10 Sep 2008 11:05:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KdRG2-0004aG-P6 for qemu-devel@nongnu.org; Wed, 10 Sep 2008 11:05:27 -0400 Received: from [199.232.76.173] (port=58094 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KdRG2-0004aD-Jv for qemu-devel@nongnu.org; Wed, 10 Sep 2008 11:05:26 -0400 Received: from il.qumranet.com ([212.179.150.194]:15784) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KdRG1-0008Ds-Pe for qemu-devel@nongnu.org; Wed, 10 Sep 2008 11:05:26 -0400 Message-ID: <48C7E22F.3000407@qumranet.com> Date: Wed, 10 Sep 2008 18:05:19 +0300 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 1/10] Refactor QEMUFile for live migration References: <1220989802-13706-1-git-send-email-aliguori@us.ibm.com> <1220989802-13706-2-git-send-email-aliguori@us.ibm.com> <5d6222a80809100738i3e3ed54fs666ca6c3225a7c63@mail.gmail.com> In-Reply-To: <5d6222a80809100738i3e3ed54fs666ca6c3225a7c63@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Chris Wright , Uri Lublin , Anthony Liguori , kvm@vger.kernel.org Glauber Costa wrote: >> +static int fd_put_buffer(void *opaque, const uint8_t *buf, >> + int64_t pos, int size) >> +{ >> + QEMUFileFD *s = opaque; >> + ssize_t len; >> + >> + do { >> + len = write(s->fd, buf, size); >> + } while (len == -1 && errno == EINTR); >> > > What about the len == size case ? > > Should work, no? >> + >> +QEMUFile *qemu_fopen_fd(int fd) >> +{ >> + QEMUFileFD *s = qemu_mallocz(sizeof(QEMUFileFD)); >> > > can't it fail? > If it does, the entire world will disappear in a black hole. Qemu isn't prepared to handle allocation failures. > Isn't it possible to abstract the differences between bdrv and file so > to have a common implementation > between them? Do you think it's worthwhile ? > > They're very different. bdrvs are sector-granularity, random access, concurrent, and want dma. QEMUFiles are byte-granularity, sequential access, serial, and aren't too worried about dma (though it could be nice). -- error compiling committee.c: too many arguments to function