From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [Qemu-devel] Re: [PATCH 1/10] Refactor QEMUFile for live migration Date: Wed, 10 Sep 2008 18:05:19 +0300 Message-ID: <48C7E22F.3000407@qumranet.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Anthony Liguori , Chris Wright , Uri Lublin , kvm@vger.kernel.org To: qemu-devel@nongnu.org Return-path: Received: from il.qumranet.com ([212.179.150.194]:15782 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751293AbYIJPFU (ORCPT ); Wed, 10 Sep 2008 11:05:20 -0400 In-Reply-To: <5d6222a80809100738i3e3ed54fs666ca6c3225a7c63@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: 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