From nobody Fri Nov 7 19:49:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548704775181378.8063897931004; Mon, 28 Jan 2019 11:46:15 -0800 (PST) Received: from localhost ([127.0.0.1]:37804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goCrG-0005oj-8N for importer@patchew.org; Mon, 28 Jan 2019 14:46:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goCp4-00047U-OJ for qemu-devel@nongnu.org; Mon, 28 Jan 2019 14:43:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goCp4-0004Sz-1a for qemu-devel@nongnu.org; Mon, 28 Jan 2019 14:43:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43418) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1goCp3-0004SG-SK for qemu-devel@nongnu.org; Mon, 28 Jan 2019 14:43:57 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AFC5C08E289; Mon, 28 Jan 2019 19:43:57 +0000 (UTC) Received: from localhost (ovpn-116-63.gru2.redhat.com [10.97.116.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 956831048108; Mon, 28 Jan 2019 19:43:56 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Mon, 28 Jan 2019 17:43:51 -0200 Message-Id: <20190128194351.14679-3-ehabkost@redhat.com> In-Reply-To: <20190128194351.14679-1-ehabkost@redhat.com> References: <20190128194351.14679-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 28 Jan 2019 19:43:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/2] hostmem: add more information in error messages X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Zhang Yi , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Zhang Yi When there are multiple memory backends in use, including the object type and property name in the error message can help users to locate the error. Signed-off-by: Haozhong Zhang Signed-off-by: Zhang Yi Message-Id: <97d9193875747d8378c05b9e3b3cb39c1b7d2b4e.1546399191.git.yi.z.z= hang@linux.intel.com> Reviewed-by: Eduardo Habkost [ehabkost: reword commit message] Signed-off-by: Eduardo Habkost --- backends/hostmem-file.c | 6 ++++-- backends/hostmem.c | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 7a34e25c43..ba601ce940 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -82,7 +82,8 @@ static void set_mem_path(Object *o, const char *str, Erro= r **errp) HostMemoryBackendFile *fb =3D MEMORY_BACKEND_FILE(o); =20 if (host_memory_backend_mr_inited(backend)) { - error_setg(errp, "cannot change property value"); + error_setg(errp, "cannot change property 'mem-path' of %s", + object_get_typename(o)); return; } g_free(fb->mem_path); @@ -120,7 +121,8 @@ static void file_memory_backend_set_align(Object *o, Vi= sitor *v, uint64_t val; =20 if (host_memory_backend_mr_inited(backend)) { - error_setg(&local_err, "cannot change property value"); + error_setg(&local_err, "cannot change property '%s' of %s", + name, object_get_typename(o)); goto out; } =20 diff --git a/backends/hostmem.c b/backends/hostmem.c index 0c8ef17653..87b19d2111 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -57,7 +57,8 @@ host_memory_backend_set_size(Object *obj, Visitor *v, con= st char *name, uint64_t value; =20 if (host_memory_backend_mr_inited(backend)) { - error_setg(&local_err, "cannot change property value"); + error_setg(&local_err, "cannot change property %s of %s ", + name, object_get_typename(obj)); goto out; } =20 @@ -66,8 +67,9 @@ host_memory_backend_set_size(Object *obj, Visitor *v, con= st char *name, goto out; } if (!value) { - error_setg(&local_err, "Property '%s.%s' doesn't take value '%" - PRIu64 "'", object_get_typename(obj), name, value); + error_setg(&local_err, + "property '%s' of %s doesn't take value '%" PRIu64 "'", + name, object_get_typename(obj), value); goto out; } backend->size =3D value; --=20 2.18.0.rc1.1.g3f1ff2140