From patchwork Fri Jan 22 14:38:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 8090781 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 498849F1CC for ; Fri, 22 Jan 2016 14:39:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 66B11203F7 for ; Fri, 22 Jan 2016 14:39:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 772F720256 for ; Fri, 22 Jan 2016 14:39:22 +0000 (UTC) Received: from localhost ([::1]:54184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMcrx-0005yY-Ss for patchwork-qemu-devel@patchwork.kernel.org; Fri, 22 Jan 2016 09:39:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMcrl-0005o3-0C for qemu-devel@nongnu.org; Fri, 22 Jan 2016 09:39:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMcrh-0006H2-J4 for qemu-devel@nongnu.org; Fri, 22 Jan 2016 09:39:08 -0500 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:46130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMcrh-0006Go-AK for qemu-devel@nongnu.org; Fri, 22 Jan 2016 09:39:05 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Jan 2016 14:39:04 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Jan 2016 14:39:02 -0000 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: gkurz@linux.vnet.ibm.com X-IBM-RcptTo: peter.maydell@linaro.org;qemu-devel@nongnu.org Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 168CE17D805A; Fri, 22 Jan 2016 14:39:08 +0000 (GMT) Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0MEd1Yc4522484; Fri, 22 Jan 2016 14:39:01 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6764F52041; Fri, 22 Jan 2016 13:37:52 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3CE235203F; Fri, 22 Jan 2016 13:37:52 +0000 (GMT) Received: from bahia.huguette.org (icon-9-164-177-135.megacenter.de.ibm.com [9.164.177.135]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id A9327220531; Fri, 22 Jan 2016 15:39:00 +0100 (CET) From: Greg Kurz To: qemu-devel@nongnu.org Date: Fri, 22 Jan 2016 15:38:33 +0100 Message-Id: <1453473514-20057-2-git-send-email-gkurz@linux.vnet.ibm.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453473514-20057-1-git-send-email-gkurz@linux.vnet.ibm.com> References: <1453473514-20057-1-git-send-email-gkurz@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16012214-0021-0000-0000-00001FE87E97 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.111 Cc: Peter Maydell , "Aneesh Kumar K.V" , Greg Kurz Subject: [Qemu-devel] [PULL 1/2] 9pfs: use error_report() instead of fprintf(stderr) 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Markus Armbruster Signed-off-by: Greg Kurz --- hw/9pfs/9p-handle.c | 5 +++-- hw/9pfs/9p-local.c | 15 ++++++++------- hw/9pfs/9p-proxy.c | 12 ++++++------ hw/9pfs/9p.c | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/hw/9pfs/9p-handle.c b/hw/9pfs/9p-handle.c index 58b77b4c942d..120486b1aa99 100644 --- a/hw/9pfs/9p-handle.c +++ b/hw/9pfs/9p-handle.c @@ -19,6 +19,7 @@ #include #include #include "qemu/xattr.h" +#include "qemu/error-report.h" #include #include #ifdef CONFIG_LINUX_MAGIC_H @@ -655,12 +656,12 @@ static int handle_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse) const char *path = qemu_opt_get(opts, "path"); if (sec_model) { - fprintf(stderr, "Invalid argument security_model specified with handle fsdriver\n"); + error_report("Invalid argument security_model specified with handle fsdriver"); return -1; } if (!path) { - fprintf(stderr, "fsdev: No path specified.\n"); + error_report("fsdev: No path specified"); return -1; } fse->path = g_strdup(path); diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index bf63eab729ad..bb6662623ff7 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -20,6 +20,7 @@ #include #include #include "qemu/xattr.h" +#include "qemu/error-report.h" #include #include #ifdef CONFIG_LINUX_MAGIC_H @@ -1209,9 +1210,9 @@ static int local_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse) const char *path = qemu_opt_get(opts, "path"); if (!sec_model) { - fprintf(stderr, "security model not specified, " - "local fs needs security model\nvalid options are:" - "\tsecurity_model=[passthrough|mapped|none]\n"); + error_report("Security model not specified, local fs needs security model"); + error_printf("valid options are:" + "\tsecurity_model=[passthrough|mapped-xattr|mapped-file|none]\n"); return -1; } @@ -1225,14 +1226,14 @@ static int local_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse) } else if (!strcmp(sec_model, "mapped-file")) { fse->export_flags |= V9FS_SM_MAPPED_FILE; } else { - fprintf(stderr, "Invalid security model %s specified, valid options are" - "\n\t [passthrough|mapped-xattr|mapped-file|none]\n", - sec_model); + error_report("Invalid security model %s specified", sec_model); + error_printf("valid options are:" + "\t[passthrough|mapped-xattr|mapped-file|none]\n"); return -1; } if (!path) { - fprintf(stderr, "fsdev: No path specified.\n"); + error_report("fsdev: No path specified"); return -1; } fse->path = g_strdup(path); diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c index 73d00dd74d11..91aab43c647c 100644 --- a/hw/9pfs/9p-proxy.c +++ b/hw/9pfs/9p-proxy.c @@ -1100,19 +1100,19 @@ static int connect_namedsocket(const char *path) struct sockaddr_un helper; if (strlen(path) >= sizeof(helper.sun_path)) { - fprintf(stderr, "Socket name too large\n"); + error_report("Socket name too long"); return -1; } sockfd = socket(AF_UNIX, SOCK_STREAM, 0); if (sockfd < 0) { - fprintf(stderr, "failed to create socket: %s\n", strerror(errno)); + error_report("Failed to create socket: %s", strerror(errno)); return -1; } strcpy(helper.sun_path, path); helper.sun_family = AF_UNIX; size = strlen(helper.sun_path) + sizeof(helper.sun_family); if (connect(sockfd, (struct sockaddr *)&helper, size) < 0) { - fprintf(stderr, "failed to connect to %s: %s\n", path, strerror(errno)); + error_report("Failed to connect to %s: %s", path, strerror(errno)); close(sockfd); return -1; } @@ -1128,11 +1128,11 @@ static int proxy_parse_opts(QemuOpts *opts, struct FsDriverEntry *fs) const char *sock_fd = qemu_opt_get(opts, "sock_fd"); if (!socket && !sock_fd) { - fprintf(stderr, "socket and sock_fd none of the option specified\n"); + error_report("Must specify either socket or sock_fd"); return -1; } if (socket && sock_fd) { - fprintf(stderr, "Both socket and sock_fd options specified\n"); + error_report("Both socket and sock_fd options specified"); return -1; } if (socket) { @@ -1155,7 +1155,7 @@ static int proxy_init(FsContext *ctx) } else { sock_id = atoi(ctx->fs_root); if (sock_id < 0) { - fprintf(stderr, "socket descriptor not initialized\n"); + error_report("Socket descriptor not initialized"); } } if (sock_id < 0) { diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 3ff310605cd4..1f3bd12e0d0c 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3370,7 +3370,7 @@ static void __attribute__((__constructor__)) v9fs_set_fd_limit(void) { struct rlimit rlim; if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) { - fprintf(stderr, "Failed to get the resource limit\n"); + error_report("Failed to get the resource limit"); exit(1); } open_fd_hw = rlim.rlim_cur - MIN(400, rlim.rlim_cur/3);