From patchwork Thu Sep 18 22:39:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 37610 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C99F72054E for ; Thu, 18 Sep 2014 22:40:02 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id c41sf1116882eek.1 for ; Thu, 18 Sep 2014 15:40:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=B/K7x/m2lAT1yoda54XJDN59SSddhNroXM2owZW1wuA=; b=hGx8WFsRrbBzKuXpNrVXx60yvaNafN/MKglhNa582GrvOTomz2lDwPX352UYxHQEyk dkqUoGhylOV+ac04zAuA+YlApgX23uyP1gVaj3Ar0M2+kBL4deIFY0uwtoBKAo55OipU XTL/wfyhAGILbP2h3dpJmAgG/3j+ovFe+0ujgfMtIoA885Zkf+ThDDN8vPuzT21ifzmp mmpwIo5qJNqf6Mo9O9VcnL/i2XAyJKqV/C+zW6U1c2qU8b6ntfU9KtSmmm3OtDJZmMqj cCILFWVccHminOHWulok18GId7fsa1r2MMY1HdYTtbl2DA/n93HIW7M95BMxlJ21neCj zMOw== X-Gm-Message-State: ALoCoQmcS0oigGHNj5xvNl+onL2jRAhUh57N9XCinvuRAlmIRs2GpuvaSaCwBbiAafCvuufoCn6+ X-Received: by 10.194.201.198 with SMTP id kc6mr1207567wjc.0.1411080001978; Thu, 18 Sep 2014 15:40:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.6.2 with SMTP id cq2ls261150lad.102.gmail; Thu, 18 Sep 2014 15:40:01 -0700 (PDT) X-Received: by 10.112.143.36 with SMTP id sb4mr2766368lbb.8.1411080001345; Thu, 18 Sep 2014 15:40:01 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by mx.google.com with ESMTPS id mt6si36690lbb.137.2014.09.18.15.40.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Sep 2014 15:40:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id l4so2082291lbv.19 for ; Thu, 18 Sep 2014 15:40:01 -0700 (PDT) X-Received: by 10.152.7.8 with SMTP id f8mr2598810laa.27.1411080001234; Thu, 18 Sep 2014 15:40:01 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp841980lbb; Thu, 18 Sep 2014 15:40:00 -0700 (PDT) X-Received: by 10.224.36.4 with SMTP id r4mr12902911qad.69.1411079999925; Thu, 18 Sep 2014 15:39:59 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v6si173978qco.27.2014.09.18.15.39.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Sep 2014 15:39:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:54275 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUkMp-0005Ep-6r for patch@linaro.org; Thu, 18 Sep 2014 18:39:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUkME-0004nl-B5 for qemu-devel@nongnu.org; Thu, 18 Sep 2014 18:39:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUkM8-0004aK-5m for qemu-devel@nongnu.org; Thu, 18 Sep 2014 18:39:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUkM7-0004Zs-U4 for qemu-devel@nongnu.org; Thu, 18 Sep 2014 18:39:16 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8IMd8mf028762 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Sep 2014 18:39:08 -0400 Received: from hawk.usersys.redhat.com (dhcp-1-153.brq.redhat.com [10.34.1.153]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8IMd6gn026887; Thu, 18 Sep 2014 18:39:07 -0400 From: Andrew Jones To: qemu-devel@nongnu.org Date: Fri, 19 Sep 2014 00:39:00 +0200 Message-Id: <1411079940-26553-1-git-send-email-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: afaerber@suse.de, mst@redhat.com Subject: [Qemu-devel] [PATCH] ivshmem: use error_report 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: drjones@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Replace all the fprintf(stderr, ...) calls with error_report. Signed-off-by: Andrew Jones --- hw/misc/ivshmem.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index bf585b7691998..d285df7d65a9f 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -300,7 +300,7 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier * chr = qemu_chr_open_eventfd(eventfd); if (chr == NULL) { - fprintf(stderr, "creating eventfd for eventfd %d failed\n", eventfd); + error_report("creating eventfd for eventfd %d failed\n", eventfd); exit(-1); } qemu_chr_fe_claim_no_fail(chr); @@ -328,14 +328,13 @@ static int check_shm_size(IVShmemState *s, int fd) { struct stat buf; if (fstat(fd, &buf) < 0) { - fprintf(stderr, "ivshmem: exiting: fstat on fd %d failed: %s\n", + error_report("exiting: fstat on fd %d failed: %s\n", fd, strerror(errno)); return -1; } if (s->ivshmem_size > buf.st_size) { - fprintf(stderr, - "IVSHMEM ERROR: Requested memory size greater" + error_report("Requested memory size greater" " than shared object size (%" PRIu64 " > %" PRIu64")\n", s->ivshmem_size, (uint64_t)buf.st_size); return -1; @@ -510,7 +509,7 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size) incoming_fd = dup(tmp_fd); if (incoming_fd == -1) { - fprintf(stderr, "could not allocate file descriptor %s\n", + error_report("could not allocate file descriptor %s\n", strerror(errno)); close(tmp_fd); return; @@ -618,13 +617,13 @@ static uint64_t ivshmem_get_size(IVShmemState * s) { value <<= 30; break; default: - fprintf(stderr, "qemu: invalid ram size: %s\n", s->sizearg); + error_report("invalid ram size: %s\n", s->sizearg); exit(1); } /* BARs must be a power of 2 */ if (!is_power_of_two(value)) { - fprintf(stderr, "ivshmem: size must be power of 2\n"); + error_report("size must be power of 2\n"); exit(1); } @@ -676,7 +675,7 @@ static int ivshmem_load(QEMUFile* f, void *opaque, int version_id) } if (proxy->role_val == IVSHMEM_PEER) { - fprintf(stderr, "ivshmem: 'peer' devices are not migratable\n"); + error_report("'peer' devices are not migratable\n"); return -EINVAL; } @@ -722,7 +721,7 @@ static int pci_ivshmem_init(PCIDevice *dev) /* IRQFD requires MSI */ if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD) && !ivshmem_has_feature(s, IVSHMEM_MSI)) { - fprintf(stderr, "ivshmem: ioeventfd/irqfd requires MSI\n"); + error_report("ioeventfd/irqfd requires MSI\n"); exit(1); } @@ -733,7 +732,7 @@ static int pci_ivshmem_init(PCIDevice *dev) } else if (strncmp(s->role, "master", 7) == 0) { s->role_val = IVSHMEM_MASTER; } else { - fprintf(stderr, "ivshmem: 'role' must be 'peer' or 'master'\n"); + error_report("'role' must be 'peer' or 'master'\n"); exit(1); } } else { @@ -773,7 +772,7 @@ static int pci_ivshmem_init(PCIDevice *dev) * to the ivshmem server to receive the memory region */ if (s->shmobj != NULL) { - fprintf(stderr, "WARNING: do not specify both 'chardev' " + error_report("WARNING: do not specify both 'chardev' " "and 'shm' with ivshmem\n"); } @@ -802,7 +801,7 @@ static int pci_ivshmem_init(PCIDevice *dev) int fd; if (s->shmobj == NULL) { - fprintf(stderr, "Must specify 'chardev' or 'shm' to ivshmem\n"); + error_report("Must specify 'chardev' or 'shm' to ivshmem\n"); exit(1); } @@ -814,12 +813,12 @@ static int pci_ivshmem_init(PCIDevice *dev) S_IRWXU|S_IRWXG|S_IRWXO)) > 0) { /* truncate file to length PCI device's memory */ if (ftruncate(fd, s->ivshmem_size) != 0) { - fprintf(stderr, "ivshmem: could not truncate shared file\n"); + error_report("could not truncate shared file\n"); } } else if ((fd = shm_open(s->shmobj, O_CREAT|O_RDWR, S_IRWXU|S_IRWXG|S_IRWXO)) < 0) { - fprintf(stderr, "ivshmem: could not open shared file\n"); + error_report("could not open shared file\n"); exit(-1); }