From patchwork Thu Sep 10 08:58:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 33287 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 173A5B7067 for ; Thu, 10 Sep 2009 19:38:27 +1000 (EST) Received: from localhost ([127.0.0.1]:58543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mlg6i-0005i6-Fw for incoming@patchwork.ozlabs.org; Thu, 10 Sep 2009 05:38:24 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MlfUx-0005YV-IZ for qemu-devel@nongnu.org; Thu, 10 Sep 2009 04:59:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MlfUr-0005Tp-NX for qemu-devel@nongnu.org; Thu, 10 Sep 2009 04:59:21 -0400 Received: from [199.232.76.173] (port=49334 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MlfUr-0005TP-Ab for qemu-devel@nongnu.org; Thu, 10 Sep 2009 04:59:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9196) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MlfUq-0007Xz-Hv for qemu-devel@nongnu.org; Thu, 10 Sep 2009 04:59:17 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8A8xELt025548 for ; Thu, 10 Sep 2009 04:59:15 -0400 Received: from zweiblum.home.kraxel.org (vpn2-9-74.ams2.redhat.com [10.36.9.74]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n8A8x2D6020720; Thu, 10 Sep 2009 04:59:12 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id CB0F6700F4; Thu, 10 Sep 2009 10:58:56 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 10 Sep 2009 10:58:53 +0200 Message-Id: <1252573135-27688-22-git-send-email-kraxel@redhat.com> In-Reply-To: <1252573135-27688-1-git-send-email-kraxel@redhat.com> References: <1252573135-27688-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH v2 21/23] qdev: add parser for chardev properties X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- hw/qdev-properties.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 12ff46b..0e5e5b5 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -170,6 +170,16 @@ PropertyInfo qdev_prop_drive = { /* --- character device --- */ +static int parse_chr(DeviceState *dev, Property *prop, const char *str) +{ + CharDriverState **ptr = qdev_get_prop_ptr(dev, prop); + + *ptr = qemu_chr_find(str); + if (*ptr == NULL) + return -1; + return 0; +} + static int print_chr(DeviceState *dev, Property *prop, char *dest, size_t len) { CharDriverState **ptr = qdev_get_prop_ptr(dev, prop); @@ -185,6 +195,7 @@ PropertyInfo qdev_prop_chr = { .name = "chr", .type = PROP_TYPE_CHR, .size = sizeof(CharDriverState*), + .parse = parse_chr, .print = print_chr, };