From patchwork Tue Apr 2 20:18:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 233138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7B2002C014F for ; Wed, 3 Apr 2013 07:44:22 +1100 (EST) Received: from localhost ([::1]:43474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN7gu-0005N8-VQ for incoming@patchwork.ozlabs.org; Tue, 02 Apr 2013 16:20:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN7f0-00022k-S5 for qemu-devel@nongnu.org; Tue, 02 Apr 2013 16:18:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UN7ey-0003d7-UA for qemu-devel@nongnu.org; Tue, 02 Apr 2013 16:18:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63910) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN7ey-0003d1-LC for qemu-devel@nongnu.org; Tue, 02 Apr 2013 16:18:24 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r32KIMLL014785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Apr 2013 16:18:22 -0400 Received: from localhost (ovpn-113-147.phx2.redhat.com [10.3.113.147]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r32KILel015266; Tue, 2 Apr 2013 16:18:22 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Tue, 2 Apr 2013 16:18:17 -0400 Message-Id: <1364933897-25803-5-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1364933897-25803-1-git-send-email-lcapitulino@redhat.com> References: <1364933897-25803-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: armbru@redhat.com, aliguori@us.ibm.com, kraxel@redhat.com, fred.konrad@greensocs.com Subject: [Qemu-devel] [PATCH 4/4] chardev: drop the Memory chardev driver X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It's not used anymore since the last commit. Signed-off-by: Luiz Capitulino Reviewed-by: Eric Blake --- qemu-char.c | 64 ------------------------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 7acbf53..5820bda 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2793,70 +2793,6 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts) return NULL; } -/***********************************************************/ -/* Memory chardev */ -typedef struct { - size_t outbuf_size; - size_t outbuf_capacity; - uint8_t *outbuf; -} MemoryDriver; - -static int mem_chr_write(CharDriverState *chr, const uint8_t *buf, int len) -{ - MemoryDriver *d = chr->opaque; - - /* TODO: the QString implementation has the same code, we should - * introduce a generic way to do this in cutils.c */ - if (d->outbuf_capacity < d->outbuf_size + len) { - /* grow outbuf */ - d->outbuf_capacity += len; - d->outbuf_capacity *= 2; - d->outbuf = g_realloc(d->outbuf, d->outbuf_capacity); - } - - memcpy(d->outbuf + d->outbuf_size, buf, len); - d->outbuf_size += len; - - return len; -} - -void qemu_chr_init_mem(CharDriverState *chr) -{ - MemoryDriver *d; - - d = g_malloc(sizeof(*d)); - d->outbuf_size = 0; - d->outbuf_capacity = 4096; - d->outbuf = g_malloc0(d->outbuf_capacity); - - memset(chr, 0, sizeof(*chr)); - chr->opaque = d; - chr->chr_write = mem_chr_write; -} - -QString *qemu_chr_mem_to_qs(CharDriverState *chr) -{ - MemoryDriver *d = chr->opaque; - return qstring_from_substr((char *) d->outbuf, 0, d->outbuf_size - 1); -} - -/* NOTE: this driver can not be closed with qemu_chr_delete()! */ -void qemu_chr_close_mem(CharDriverState *chr) -{ - MemoryDriver *d = chr->opaque; - - g_free(d->outbuf); - g_free(chr->opaque); - chr->opaque = NULL; - chr->chr_write = NULL; -} - -size_t qemu_chr_mem_osize(const CharDriverState *chr) -{ - const MemoryDriver *d = chr->opaque; - return d->outbuf_size; -} - /*********************************************************/ /* Ring buffer chardev */