From nobody Thu Nov 6 01:19:36 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=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 153829770589547.09746854305604; Sun, 30 Sep 2018 01:55:05 -0700 (PDT) Received: from localhost ([::1]:54438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6XVD-0008R5-IS for importer@patchew.org; Sun, 30 Sep 2018 04:54:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6WsB-00031f-FZ for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6WsA-0001F2-Af for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:39 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:40009) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6Ws9-0001BM-Qu for qemu-devel@nongnu.org; Sun, 30 Sep 2018 04:14:38 -0400 Received: by mail-wm1-x343.google.com with SMTP id o2-v6so5730568wmh.5 for ; Sun, 30 Sep 2018 01:14:32 -0700 (PDT) Received: from 640k.lan (94-36-187-248.adsl-ull.clienti.tiscali.it. [94.36.187.248]) by smtp.gmail.com with ESMTPSA id u76-v6sm11369194wmd.10.2018.09.30.01.14.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Sep 2018 01:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=c20adhGahgjADW3X+SqJRXUiMmP/SbutTBWf9xSRUBg=; b=ZdBKB9A0P04ntS9e6Vu320tJDQvvkU712k/re47Se8cYbE88BK5BeC1VGDlc+NEyS9 6s9QCKCj+OljMsrf4tatb/D6FtfNLmXfh6JFGCCq4l+R0HRAYNV8eyj+8mIv5z7ad1DW m6QSn9se9BJ0RhrsWY20hvyn48RObqH2BDlLLl+cVJhnTOaO/aMfyq3r5l/3/D8EuwB2 UAfbyK1xm/imZEB68ma8VapiI9IwYXe5OwHEGheOshcAPiRceIT3A05Aa45rrqlzoY1a qRjWerCkPWOzs19zp1jf0qXRc2c6ZTvO+9AW3I33TeW8S09AfNmsuD/Jgxm4TmKn6RK0 0SGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=c20adhGahgjADW3X+SqJRXUiMmP/SbutTBWf9xSRUBg=; b=svOlIt+RHna5qE+gJRoDN6xnORpGAmDtoNVFAwhr8V5MMot76H+RNyaivbrHfsvz25 1J4ZgqDIbTpAoh7MHA3ElxExNLlWqEzoi+L4RTf4xFrr0jsg5ykbIalYnV5A6T8T+3ks NHLqlWxznu/YrBg1QJSNiXP0aadZWuRJGhaONdBi3SWtjjoShmsdvi3UekQeD1FOcLbK ptw/0Mia6CI1fg7ZBNpoUGIxspY6rw3+iW0O5tac6Qm7KoY9D+r3zMaVYcryrbtHxY5h 6H9Qi+H9vqdq70c/apjUIU0jrUJFBNDQMslsWHFStr5J5Y/LNcZ8Z9MxLON/ZXEqNuxY rYuw== X-Gm-Message-State: ABuFfoh2KLSDpZSwvpkG/A+GXYDlcEFSr2kg0S5tSUFIa9Dd4El5Zyrv Fis1NFa6zE76gQdWMEc03u2RSztb X-Google-Smtp-Source: ACcGV61RPw55knrH7wiy6hD2xiHeZKr+mCQcksjaZRuGq8SlIRP6/d0MlTIqWz2Y4t+o6heeh5zI6w== X-Received: by 2002:a1c:a794:: with SMTP id q142-v6mr2299106wme.77.1538295271254; Sun, 30 Sep 2018 01:14:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Sun, 30 Sep 2018 10:13:07 +0200 Message-Id: <1538295197-23704-70-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> References: <1538295197-23704-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PULL 69/79] 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: Hikaru Nishida 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 Message-Id: <20180924123205.29651-1-hikarupsp@gmail.com> Signed-off-by: Paolo Bonzini --- 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 ad7c032..717fcbd 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 2476dcb..e640749 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 6826c83..d0821e6 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 eb4f2fb..e78a9a4 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 aceadb2..f797d82 100644 --- a/memory.c +++ b/memory.c @@ -1557,7 +1557,7 @@ void memory_region_init_resizeable_ram(MemoryRegion *= mr, } } =20 -#ifdef __linux__ +#ifdef CONFIG_POSIX void memory_region_init_ram_from_file(MemoryRegion *mr, struct Object *owner, const char *name, --=20 1.8.3.1