From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQXEe-0002QH-4d for qemu-devel@nongnu.org; Tue, 23 Oct 2012 01:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TQXEd-0007aB-Bd for qemu-devel@nongnu.org; Tue, 23 Oct 2012 01:41:04 -0400 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:54177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQXEc-0007Zx-OK for qemu-devel@nongnu.org; Tue, 23 Oct 2012 01:41:03 -0400 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 23 Oct 2012 11:10:58 +0530 Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9N5euXx34013326 for ; Tue, 23 Oct 2012 11:10:56 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q9N5es0s019828 for ; Tue, 23 Oct 2012 16:40:55 +1100 Message-ID: <50862DBD.4010403@linux.vnet.ibm.com> Date: Tue, 23 Oct 2012 13:40:13 +0800 From: Lei Li MIME-Version: 1.0 References: <1350838081-6351-1-git-send-email-lilei@linux.vnet.ibm.com> <1350838081-6351-2-git-send-email-lilei@linux.vnet.ibm.com> <5085536D.3010502@redhat.com> In-Reply-To: <5085536D.3010502@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/5] qemu-char: Add new char backend CircularMemCharDriver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: blauwirbel@gmail.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, lcapitulino@redhat.com On 10/22/2012 10:08 PM, Eric Blake wrote: > On 10/21/2012 10:47 AM, Lei Li wrote: >> Signed-off-by: Lei Li >> --- >> qemu-char.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 1 files changed, 72 insertions(+), 0 deletions(-) >> >> diff --git a/qemu-char.c b/qemu-char.c >> index b082bae..b174da1 100644 >> --- a/qemu-char.c >> +++ b/qemu-char.c >> @@ -2588,6 +2588,78 @@ size_t qemu_chr_mem_osize(const CharDriverState *chr) >> return d->outbuf_size; >> } >> >> +/*********************************************************/ >> +/*CircularMemoryr chardev*/ > s/CircularMemoryr/CircularMemory/ > Yeah, I just found it... Thanks! >> +static int cirmem_chr_write(CharDriverState *chr, const uint8_t *buf, int len) >> +{ >> + CirMemCharDriver *d = chr->opaque; >> + int i; >> + >> + if (len < 0) { >> + return -1; >> + } >> + >> + /* The size should be a power of 2. */ > Shouldn't you enforce that, then? Yes, it has been checked when open the CirMemChar backend in patch 2/5, as code below: if (d->size & (d->size -1)) { return NULL; } -- Lei