From nobody Wed Nov 5 19:59:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537792507428464.54646150460314; Mon, 24 Sep 2018 05:35:07 -0700 (PDT) Received: from localhost ([::1]:44996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4Q4w-0005rX-By for importer@patchew.org; Mon, 24 Sep 2018 08:35:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4Q3E-00051L-R7 for qemu-devel@nongnu.org; Mon, 24 Sep 2018 08:33:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4Q3A-0007CW-Br for qemu-devel@nongnu.org; Mon, 24 Sep 2018 08:33:20 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:38067) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g4Q38-0007AU-6E for qemu-devel@nongnu.org; Mon, 24 Sep 2018 08:33:14 -0400 Received: by mail-pl1-x643.google.com with SMTP id u11-v6so9050256plq.5 for ; Mon, 24 Sep 2018 05:33:13 -0700 (PDT) Received: from localhost.localdomain (113x36x63x49.ap113.ftth.ucom.ne.jp. [113.36.63.49]) by smtp.gmail.com with ESMTPSA id l85-v6sm61298690pfk.34.2018.09.24.05.33.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 05:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=jVH1ZPPJsp/yrLHA/M0zemA6qa45oQpNQx4a9XwsLrQ=; b=bG5IWwnEFYe+7y6g3CYCeUUaxOMStkjtu0d3M6qhJKjEZtO2Z1tB6EsFzt2bqr2zzi CNxqkPkOEAkzNawxl9db5eXhTrrFl9qmYLqoznuCS0/CD7NYa+syy5n6K6TMjiLrBXSy IHIG3wZpgwXTKgqMHYMdR5fnJ0cu/DfoPSRWLQ7ncyrsYJ6BSbkZ+xp5FZvsk7oo8veH tD2JX0kv717PBMCLs+FF2GW4jiP0qJTTd8CzKAsZkYok69at5hPIGYRrH5buXBHFyAzo zQpv1Su0OoU/Fe97s6VDbjy8hnonouc/3WxOOAuUtTP1BCNY7/xkZiDTF5dJE6E5/uP9 mTbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jVH1ZPPJsp/yrLHA/M0zemA6qa45oQpNQx4a9XwsLrQ=; b=CnbIGIk8gShr6CWm/wdbU/DGv9MZok2PGd2isDrt4YrrtxzYuTUZWjSDdvlpGScGC5 vcbbTsE0sGShdtpfSCw3seDKFctvKKuTypKuwgJu2OKWprItKpc3NjjsXySX0pMmfOz4 Y/PgYKj6ymjWkk1RB0EHuGEQ+mHMLqswlQgsIkUhrSr/iGfFjmHHCDB9vNTiB1V2GitS C7hL/qSQC6mAT7qOlRRaZAyfbbiGHG/h2KRFfav3B87A2LHWHwq4eRytgULaut955eX3 /dC25jES/QYIMcO6i/pd8ntvcorS+V3N2ANuzzBNuXEeqJUvwEMqE4PfSbBDFe6ZDHbO DcWg== X-Gm-Message-State: ABuFfogn2m0w0ILAUwKuCZgaooH2mt3RXba2NNP17viFfW8EGd+7JMfJ az0R6KVHnRW9FIByRKGTPh2XnJPX5t8= X-Google-Smtp-Source: ACcGV61mCas/7uxbVXWCnBVRc8Akc6UemAyRQyszLzooVrhH2AbAWFPSqP0HqCWzzRSvzYxmSLryCw== X-Received: by 2002:a17:902:b496:: with SMTP id y22-v6mr2813345plr.314.1537792392436; Mon, 24 Sep 2018 05:33:12 -0700 (PDT) From: hikarupsp@gmail.com To: qemu-devel@nongnu.org Date: Mon, 24 Sep 2018 21:32:05 +0900 Message-Id: <20180924123205.29651-1-hikarupsp@gmail.com> X-Mailer: git-send-email 2.15.2 (Apple Git-101.1) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v2] hostmem-file: make available memory-backend-file on POSIX-based hosts 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: Eduardo Habkost , Peter Crosthwaite , Hikaru Nishida , Paolo Bonzini , Igor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Hikaru Nishida Before this change, memory-backend-file object is valid for Linux hosts only because hostmem-file.c is compiled only on Linux hosts. However, other POSIX-based hosts (such as macOS) can support memory-backend-file object in the same way as on Linux hosts. This patch makes hostmem-file.c and related functions to be compiled on all POSIX-based hosts to make available memory-backend-file on them. Signed-off-by: Hikaru Nishida --- backends/Makefile.objs | 2 +- backends/hostmem-file.c | 2 +- exec.c | 4 ++-- include/exec/memory.h | 2 +- memory.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backends/Makefile.objs b/backends/Makefile.objs index ad7c0325ed..717fcbdae4 100644 --- a/backends/Makefile.objs +++ b/backends/Makefile.objs @@ -4,7 +4,7 @@ common-obj-$(CONFIG_POSIX) +=3D rng-random.o common-obj-$(CONFIG_TPM) +=3D tpm.o =20 common-obj-y +=3D hostmem.o hostmem-ram.o -common-obj-$(CONFIG_LINUX) +=3D hostmem-file.o +common-obj-$(CONFIG_POSIX) +=3D hostmem-file.o =20 common-obj-y +=3D cryptodev.o common-obj-y +=3D cryptodev-builtin.o diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 2476dcb435..e64074954f 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -51,7 +51,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Err= or **errp) error_setg(errp, "mem-path property not set"); return; } -#ifndef CONFIG_LINUX +#ifndef CONFIG_POSIX error_setg(errp, "-mem-path not supported on this host"); #else if (!host_memory_backend_mr_inited(backend)) { diff --git a/exec.c b/exec.c index 6826c8337d..d0821e69aa 100644 --- a/exec.c +++ b/exec.c @@ -1734,7 +1734,7 @@ long qemu_getrampagesize(void) } #endif =20 -#ifdef __linux__ +#ifdef CONFIG_POSIX static int64_t get_file_size(int fd) { int64_t size =3D lseek(fd, 0, SEEK_END); @@ -2230,7 +2230,7 @@ static void ram_block_add(RAMBlock *new_block, Error = **errp, bool shared) } } =20 -#ifdef __linux__ +#ifdef CONFIG_POSIX RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr, uint32_t ram_flags, int fd, Error **errp) diff --git a/include/exec/memory.h b/include/exec/memory.h index eb4f2fb249..e78a9a4f48 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -633,7 +633,7 @@ void memory_region_init_resizeable_ram(MemoryRegion *mr, uint64_t length, void *host), Error **errp); -#ifdef __linux__ +#ifdef CONFIG_POSIX =20 /** * memory_region_init_ram_from_file: Initialize RAM memory region with a diff --git a/memory.c b/memory.c index 9b73892768..c4c18ac4c3 100644 --- a/memory.c +++ b/memory.c @@ -1545,7 +1545,7 @@ void memory_region_init_resizeable_ram(MemoryRegion *= mr, mr->dirty_log_mask =3D tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0; } =20 -#ifdef __linux__ +#ifdef CONFIG_POSIX void memory_region_init_ram_from_file(MemoryRegion *mr, struct Object *owner, const char *name, --=20 2.15.2 (Apple Git-101.1)