From nobody Mon Feb 9 23:39:25 2026 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155011392715155.57234973931543; Wed, 13 Feb 2019 19:12:07 -0800 (PST) Received: from localhost ([127.0.0.1]:38978 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gu7RP-0003wV-2N for importer@patchew.org; Wed, 13 Feb 2019 22:11:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gu7Q0-0003Gc-V7 for qemu-devel@nongnu.org; Wed, 13 Feb 2019 22:10:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gu7Pz-0006aT-1M for qemu-devel@nongnu.org; Wed, 13 Feb 2019 22:10:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gu7Px-0006Uu-7Q for qemu-devel@nongnu.org; Wed, 13 Feb 2019 22:10:30 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67A1436809; Thu, 14 Feb 2019 03:10:28 +0000 (UTC) Received: from localhost (unknown [10.64.242.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id A326E5C221; Thu, 14 Feb 2019 03:10:27 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Thu, 14 Feb 2019 11:10:03 +0800 Message-Id: <20190214031004.32522-2-stefanha@redhat.com> In-Reply-To: <20190214031004.32522-1-stefanha@redhat.com> References: <20190214031004.32522-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 14 Feb 2019 03:10:28 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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] [PATCH v3 1/2] hostmem: simplify ifdef-s in file_backend_memory_alloc() 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 , Eduardo Habkost , Stefan Hajnoczi , Wei Yang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Igor Mammedov cleanup file_backend_memory_alloc() by using one CONFIG_POSIX ifdef instead of several ones within the function to make it simpler to follow. Signed-off-by: Igor Mammedov Suggested-by: Wei Yang Reviewed-by: Wei Yang Message-Id: <20190213123858.24620-1-imammedo@redhat.com> Signed-off-by: Stefan Hajnoczi --- backends/hostmem-file.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index ba601ce940..ce54788048 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -41,10 +41,12 @@ struct HostMemoryBackendFile { static void file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { +#ifndef CONFIG_POSIX + error_setg(errp, "backend '%s' not supported on this host", + object_get_typename(OBJECT(backend))); +#else HostMemoryBackendFile *fb =3D MEMORY_BACKEND_FILE(backend); -#ifdef CONFIG_POSIX gchar *name; -#endif =20 if (!backend->size) { error_setg(errp, "can't create backend with size 0"); @@ -54,9 +56,6 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Err= or **errp) error_setg(errp, "mem-path property not set"); return; } -#ifndef CONFIG_POSIX - error_setg(errp, "-mem-path not supported on this host"); -#else backend->force_prealloc =3D mem_prealloc; name =3D host_memory_backend_get_name(backend); memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), --=20 2.20.1