All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PATCH 3/5] include: Move QEMU_MAP_* constants to mmap-alloc.h
Date: Tue,  8 Feb 2022 20:08:54 +0000	[thread overview]
Message-ID: <20220208200856.3558249-4-peter.maydell@linaro.org> (raw)
In-Reply-To: <20220208200856.3558249-1-peter.maydell@linaro.org>

The QEMU_MAP_* constants are used only as arguments to the
qemu_ram_mmap() function.  Move them to mmap-alloc.h, where that
function's prototype is defined.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/qemu/mmap-alloc.h | 23 +++++++++++++++++++++++
 include/qemu/osdep.h      | 25 -------------------------
 2 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h
index 90d0eee7053..5076695cc81 100644
--- a/include/qemu/mmap-alloc.h
+++ b/include/qemu/mmap-alloc.h
@@ -35,4 +35,27 @@ void *qemu_ram_mmap(int fd,
 
 void qemu_ram_munmap(int fd, void *ptr, size_t size);
 
+/*
+ * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example,
+ * consumed by qemu_ram_mmap().
+ */
+
+/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */
+#define QEMU_MAP_READONLY   (1 << 0)
+
+/* Use MAP_SHARED instead of MAP_PRIVATE. */
+#define QEMU_MAP_SHARED     (1 << 1)
+
+/*
+ * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without
+ * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC.
+ */
+#define QEMU_MAP_SYNC       (1 << 2)
+
+/*
+ * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if
+ * applicable). Bail out if not supported/effective.
+ */
+#define QEMU_MAP_NORESERVE  (1 << 3)
+
 #endif
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 2a52933ce0e..0715d6b4509 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -401,31 +401,6 @@ static inline void qemu_cleanup_generic_vfree(void *p)
  */
 #define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree)))
 
-/*
- * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example,
- * consumed by qemu_ram_mmap().
- */
-
-/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */
-#define QEMU_MAP_READONLY   (1 << 0)
-
-/* Use MAP_SHARED instead of MAP_PRIVATE. */
-#define QEMU_MAP_SHARED     (1 << 1)
-
-/*
- * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without
- * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC.
- */
-#define QEMU_MAP_SYNC       (1 << 2)
-
-/*
- * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if
- * applicable). Bail out if not supported/effective.
- */
-#define QEMU_MAP_NORESERVE  (1 << 3)
-
-
-
 #ifdef _WIN32
 #define HAVE_CHARDEV_SERIAL 1
 #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__)    \
-- 
2.25.1



  parent reply	other threads:[~2022-02-08 20:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08 20:08 [PATCH 0/5] include: Trim some fat from osdep.h Peter Maydell
2022-02-08 20:08 ` [PATCH 1/5] include: Move qemu_madvise() and related #defines to new qemu/madvise.h Peter Maydell
2022-02-08 23:01   ` Richard Henderson
2022-02-08 20:08 ` [PATCH 2/5] include: Move qemu_mprotect_*() to new qemu/mprotect.h Peter Maydell
2022-02-08 23:02   ` Richard Henderson
2022-02-08 20:08 ` Peter Maydell [this message]
2022-02-08 23:03   ` [PATCH 3/5] include: Move QEMU_MAP_* constants to mmap-alloc.h Richard Henderson
2022-02-08 20:08 ` [PATCH 4/5] include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h Peter Maydell
2022-02-08 23:04   ` Richard Henderson
2022-02-08 20:08 ` [PATCH 5/5] include: Move hardware version declarations to new qemu/hw-version.h Peter Maydell
2022-02-08 23:06   ` Richard Henderson
2022-02-09  9:20   ` Philippe Mathieu-Daudé via
2022-02-09  9:25     ` Peter Maydell
2022-02-09 10:10       ` Philippe Mathieu-Daudé via
2022-02-09 13:44         ` Peter Maydell
2022-02-09  9:21 ` [PATCH 0/5] include: Trim some fat from osdep.h Philippe Mathieu-Daudé via
2022-02-18 12:18 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220208200856.3558249-4-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.