From patchwork Thu Sep 27 05:14:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Wang X-Patchwork-Id: 187276 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 48CC42C00B5 for ; Thu, 27 Sep 2012 15:34:12 +1000 (EST) Received: from localhost ([::1]:36772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TH6R8-0000a1-QF for incoming@patchwork.ozlabs.org; Thu, 27 Sep 2012 01:14:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TH6QX-0007Yp-K3 for qemu-devel@nongnu.org; Thu, 27 Sep 2012 01:14:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TH6QW-0003Zs-4p for qemu-devel@nongnu.org; Thu, 27 Sep 2012 01:14:21 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:53262) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TH6QV-0003XY-WF for qemu-devel@nongnu.org; Thu, 27 Sep 2012 01:14:20 -0400 Received: by mail-ob0-f173.google.com with SMTP id ta14so1308124obb.4 for ; Wed, 26 Sep 2012 22:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=SdZ8G25u0L/yrcjHB5pIfbhdAa8nOfLqBYEr/+9RGUQ=; b=MCR422nX8hQ5Kx8SFg2xWwMdu9zIfTHl2AP2uI8NKvy9Uc2H/3pzqibg2yMFwqHP3U AivxeBIFIJd+uGFohhC9DQtqjeSIEJyE4pa8Q+7BkHVvbcHtl8kN6KbKy1ifhSVJAUOs IpFR4nZSkYFv3zqxmq4cRlsRDpUXcWRNKdsGrlByO6yiHVcIbCZohSvg0qF/gw9pf6SH EAPIEtr4ObP+j7SmfU4WioQfy5B/prr4J+0eVnPICn4bTh7KCSDQkDdAeFYKwse2fHhp VTLszdxNuJuHImflY3y06APv2YpWc6LOqpl/n3i5utSEmXytrxX1+xrsqjj/cUIWtR0g LZ5Q== Received: by 10.182.31.102 with SMTP id z6mr2248775obh.66.1348722859784; Wed, 26 Sep 2012 22:14:19 -0700 (PDT) Received: from localhost.localdomain ([202.108.130.138]) by mx.google.com with ESMTPS id q6sm3833954oec.7.2012.09.26.22.14.17 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 26 Sep 2012 22:14:19 -0700 (PDT) From: Dong Xu Wang To: qemu-devel@nongnu.org Date: Thu, 27 Sep 2012 13:14:23 +0800 Message-Id: <1348722865-20564-6-git-send-email-wdongxu@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1348722865-20564-1-git-send-email-wdongxu@linux.vnet.ibm.com> References: <1348722865-20564-1-git-send-email-wdongxu@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.173 Cc: kwolf@redhat.com, Dong Xu Wang , armbru@redhat.com, lcapitulino@redhat.com Subject: [Qemu-devel] [RFC v2 5/7] use qemu_opts_create_nofail 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 use qemu_opts_create_nofail while id is NULL. Signed-off-by: Dong Xu Wang --- blockdev.c | 2 +- hw/watchdog.c | 2 +- qemu-config.c | 4 ++-- qemu-img.c | 2 +- qemu-sockets.c | 8 ++++---- vl.c | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/blockdev.c b/blockdev.c index 7c83baa..1d0fe0f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -559,7 +559,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) break; case IF_VIRTIO: /* add virtio block device */ - opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0, NULL); + opts = qemu_opts_create_nofail(qemu_find_opts("device")); if (arch_type == QEMU_ARCH_S390X) { qemu_opt_set(opts, "driver", "virtio-blk-s390"); } else { diff --git a/hw/watchdog.c b/hw/watchdog.c index b52aced..5c82c17 100644 --- a/hw/watchdog.c +++ b/hw/watchdog.c @@ -66,7 +66,7 @@ int select_watchdog(const char *p) QLIST_FOREACH(model, &watchdog_list, entry) { if (strcasecmp(model->wdt_name, p) == 0) { /* add the device */ - opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0, NULL); + opts = qemu_opts_create_nofail(qemu_find_opts("device")); qemu_opt_set(opts, "driver", p); return 0; } diff --git a/qemu-config.c b/qemu-config.c index 12eafbb..6e3718e 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -762,7 +762,7 @@ int qemu_global_option(const char *str) return -1; } - opts = qemu_opts_create(&qemu_global_opts, NULL, 0, NULL); + opts = qemu_opts_create_nofail(&qemu_global_opts); qemu_opt_set(opts, "driver", driver); qemu_opt_set(opts, "property", property); qemu_opt_set(opts, "value", str+offset+1); @@ -849,7 +849,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) error_free(local_err); goto out; } - opts = qemu_opts_create(list, NULL, 0, NULL); + opts = qemu_opts_create_nofail(list); continue; } if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2) { diff --git a/qemu-img.c b/qemu-img.c index f17f187..f1c224e 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1778,7 +1778,7 @@ static int img_resize(int argc, char **argv) } /* Parse size */ - param = qemu_opts_create(&resize_options, NULL, 0, NULL); + param = qemu_opts_create_nofail(&resize_options); if (qemu_opt_set(param, BLOCK_OPT_SIZE, size)) { /* Error message already printed when size parsing fails */ ret = -1; diff --git a/qemu-sockets.c b/qemu-sockets.c index 361d890..a576a24 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -469,7 +469,7 @@ int inet_listen(const char *str, char *ostr, int olen, char *optstr; int sock = -1; - opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); + opts = qemu_opts_create_nofail(&dummy_opts); if (inet_parse(opts, str) == 0) { sock = inet_listen_opts(opts, port_offset, errp); if (sock != -1 && ostr) { @@ -498,7 +498,7 @@ int inet_connect(const char *str, bool block, bool *in_progress, Error **errp) QemuOpts *opts; int sock = -1; - opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); + opts = qemu_opts_create_nofail(&dummy_opts); if (inet_parse(opts, str) == 0) { if (block) { qemu_opt_set(opts, "block", "on"); @@ -597,7 +597,7 @@ int unix_listen(const char *str, char *ostr, int olen) char *path, *optstr; int sock, len; - opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); + opts = qemu_opts_create_nofail(&dummy_opts); optstr = strchr(str, ','); if (optstr) { @@ -625,7 +625,7 @@ int unix_connect(const char *path) QemuOpts *opts; int sock; - opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); + opts = qemu_opts_create_nofail(&dummy_opts); qemu_opt_set(opts, "path", path); sock = unix_connect_opts(opts); qemu_opts_del(opts); diff --git a/vl.c b/vl.c index 7c577fa..e13aead 100644 --- a/vl.c +++ b/vl.c @@ -1863,7 +1863,7 @@ static int balloon_parse(const char *arg) return -1; } else { /* create empty opts */ - opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0, NULL); + opts = qemu_opts_create_nofail(qemu_find_opts("device")); } qemu_opt_set(opts, "driver", "virtio-balloon"); return 0; @@ -2111,14 +2111,14 @@ static int virtcon_parse(const char *devname) exit(1); } - bus_opts = qemu_opts_create(device, NULL, 0, NULL); + bus_opts = qemu_opts_create_nofail(device); if (arch_type == QEMU_ARCH_S390X) { qemu_opt_set(bus_opts, "driver", "virtio-serial-s390"); } else { qemu_opt_set(bus_opts, "driver", "virtio-serial-pci"); } - dev_opts = qemu_opts_create(device, NULL, 0, NULL); + dev_opts = qemu_opts_create_nofail(device); qemu_opt_set(dev_opts, "driver", "virtconsole"); snprintf(label, sizeof(label), "virtcon%d", index);