From patchwork Fri Dec 12 17:09:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 420607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 588681400E9 for ; Sat, 13 Dec 2014 04:22:28 +1100 (AEDT) Received: from localhost ([::1]:58692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTv8-0000LR-GU for incoming@patchwork.ozlabs.org; Fri, 12 Dec 2014 12:22:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTjs-0006AI-GC for qemu-devel@nongnu.org; Fri, 12 Dec 2014 12:10:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzTjm-0004IZ-Tj for qemu-devel@nongnu.org; Fri, 12 Dec 2014 12:10:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35272) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzTjm-0004IL-9J for qemu-devel@nongnu.org; Fri, 12 Dec 2014 12:10:42 -0500 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 sBCHAdf9005228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 12 Dec 2014 12:10:40 -0500 Received: from localhost (ovpn-112-32.ams2.redhat.com [10.36.112.32]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBCHAcr1031304; Fri, 12 Dec 2014 12:10:39 -0500 From: Stefan Hajnoczi To: Date: Fri, 12 Dec 2014 17:09:59 +0000 Message-Id: <1418404205-6213-14-git-send-email-stefanha@redhat.com> In-Reply-To: <1418404205-6213-1-git-send-email-stefanha@redhat.com> References: <1418404205-6213-1-git-send-email-stefanha@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: Peter Maydell , Fam Zheng , Stefan Hajnoczi Subject: [Qemu-devel] [PULL 13/19] block: Don't add trailing space in "Formating..." message 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 From: Fam Zheng Change the message printing code to output a separator for each option string before it instead of after, then we don't one more extra ' ' in the end. To update qemu-iotests output files, most of the times one would just copy the *.out.bad to *.out. With this change we will not have the space disliked by checkpatch.pl. Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster Message-id: 1418110684-19528-3-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi --- block.c | 4 ++-- include/qemu/option.h | 2 +- util/qemu-option.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index a75a992..4165d42 100644 --- a/block.c +++ b/block.c @@ -5668,8 +5668,8 @@ void bdrv_img_create(const char *filename, const char *fmt, } if (!quiet) { - printf("Formatting '%s', fmt=%s ", filename, fmt); - qemu_opts_print(opts); + printf("Formatting '%s', fmt=%s", filename, fmt); + qemu_opts_print(opts, " "); puts(""); } diff --git a/include/qemu/option.h b/include/qemu/option.h index 59bea75..58c0157 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -124,7 +124,7 @@ QDict *qemu_opts_to_qdict(QemuOpts *opts, QDict *qdict); void qemu_opts_absorb_qdict(QemuOpts *opts, QDict *qdict, Error **errp); typedef int (*qemu_opts_loopfunc)(QemuOpts *opts, void *opaque); -void qemu_opts_print(QemuOpts *opts); +void qemu_opts_print(QemuOpts *opts, const char *sep); int qemu_opts_foreach(QemuOptsList *list, qemu_opts_loopfunc func, void *opaque, int abort_on_failure); void qemu_opts_print_help(QemuOptsList *list); diff --git a/util/qemu-option.c b/util/qemu-option.c index 5d10695..a708241 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -737,14 +737,14 @@ void qemu_opts_del(QemuOpts *opts) g_free(opts); } -void qemu_opts_print(QemuOpts *opts) +void qemu_opts_print(QemuOpts *opts, const char *sep) { QemuOpt *opt; QemuOptDesc *desc = opts->list->desc; if (desc[0].name == NULL) { QTAILQ_FOREACH(opt, &opts->head, next) { - printf("%s=\"%s\" ", opt->name, opt->str); + printf("%s%s=\"%s\"", sep, opt->name, opt->str); } return; } @@ -757,12 +757,12 @@ void qemu_opts_print(QemuOpts *opts) continue; } if (desc->type == QEMU_OPT_STRING) { - printf("%s='%s' ", desc->name, value); + printf("%s%s='%s'", sep, desc->name, value); } else if ((desc->type == QEMU_OPT_SIZE || desc->type == QEMU_OPT_NUMBER) && opt) { - printf("%s=%" PRId64 " ", desc->name, opt->value.uint); + printf("%s%s=%" PRId64, sep, desc->name, opt->value.uint); } else { - printf("%s=%s ", desc->name, value); + printf("%s%s=%s", sep, desc->name, value); } } }