|
From: | Lei Li |
Subject: | Re: [Qemu-devel] [PATCH 1/5] qemu-char: Add new char backend CircularMemCharDriver |
Date: | Tue, 23 Oct 2012 13:40:13 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 |
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 <address@hidden> --- 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
[Prev in Thread] | Current Thread | [Next in Thread] |