From patchwork Wed Sep 23 10:24:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 34133 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 ozlabs.org (Postfix) with ESMTPS id 16572B7B78 for ; Wed, 23 Sep 2009 20:56:55 +1000 (EST) Received: from localhost ([127.0.0.1]:50294 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqPWl-0000LW-Ch for incoming@patchwork.ozlabs.org; Wed, 23 Sep 2009 06:56:51 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MqP2t-0003p4-Ut for qemu-devel@nongnu.org; Wed, 23 Sep 2009 06:26:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MqP2k-0003iT-HZ for qemu-devel@nongnu.org; Wed, 23 Sep 2009 06:25:55 -0400 Received: from [199.232.76.173] (port=37821 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MqP2i-0003hX-KZ for qemu-devel@nongnu.org; Wed, 23 Sep 2009 06:25:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15202) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MqP2h-0001Vx-4Z for qemu-devel@nongnu.org; Wed, 23 Sep 2009 06:25:47 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8NAPkg1004008 for ; Wed, 23 Sep 2009 06:25:46 -0400 Received: from blaa.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8NAPhtd011618; Wed, 23 Sep 2009 06:25:45 -0400 Received: by blaa.localdomain (Postfix, from userid 500) id 816A947449; Wed, 23 Sep 2009 11:24:24 +0100 (IST) From: Mark McLoughlin To: qemu-devel@nongnu.org Date: Wed, 23 Sep 2009 11:24:22 +0100 Message-Id: <1253701463-3134-24-git-send-email-markmc@redhat.com> In-Reply-To: <1253701463-3134-1-git-send-email-markmc@redhat.com> References: <1253701463-3134-1-git-send-email-markmc@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Mark McLoughlin Subject: [Qemu-devel] [PATCH 23/24] Port PCI NIC hotplug to QemuOpts 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: Mark McLoughlin --- hw/pci-hotplug.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index f3dc421..4905157 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -32,14 +32,26 @@ #include "block_int.h" #include "scsi-disk.h" #include "virtio-blk.h" +#include "qemu-config.h" #if defined(TARGET_I386) || defined(TARGET_X86_64) static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, - const char *devaddr, const char *opts) + const char *devaddr, + const char *opts_str) { + QemuOpts *opts; int ret; - ret = net_client_init(mon, "nic", opts); + opts = qemu_opts_parse(&qemu_net_opts, opts_str ? opts_str : "", NULL); + if (!opts) { + monitor_printf(mon, "parsing network options '%s' failed\n", + opts_str ? opts_str : ""); + return NULL; + } + + qemu_opt_set(opts, "type", "nic"); + + ret = net_client_init_from_opts(mon, opts); if (ret < 0) return NULL; if (nd_table[ret].devaddr) {