diff mbox series

[2/5] include: Move qemu_mprotect_*() to new qemu/mprotect.h

Message ID 20220208200856.3558249-3-peter.maydell@linaro.org
State New
Headers show
Series include: Trim some fat from osdep.h | expand

Commit Message

Peter Maydell Feb. 8, 2022, 8:08 p.m. UTC
The qemu_mprotect_*() family of functions are used in very few files;
move them from osdep.h to a new qemu/mprotect.h.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/qemu/mprotect.h | 14 ++++++++++++++
 include/qemu/osdep.h    |  4 ----
 tcg/region.c            |  1 +
 util/osdep.c            |  1 +
 4 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 include/qemu/mprotect.h

Comments

Richard Henderson Feb. 8, 2022, 11:02 p.m. UTC | #1
On 2/9/22 07:08, Peter Maydell wrote:
> The qemu_mprotect_*() family of functions are used in very few files;
> move them from osdep.h to a new qemu/mprotect.h.
> 
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   include/qemu/mprotect.h | 14 ++++++++++++++
>   include/qemu/osdep.h    |  4 ----
>   tcg/region.c            |  1 +
>   util/osdep.c            |  1 +
>   4 files changed, 16 insertions(+), 4 deletions(-)
>   create mode 100644 include/qemu/mprotect.h

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/include/qemu/mprotect.h b/include/qemu/mprotect.h
new file mode 100644
index 00000000000..1e83d1433ee
--- /dev/null
+++ b/include/qemu/mprotect.h
@@ -0,0 +1,14 @@ 
+/*
+ * QEMU mprotect functions
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef QEMU_MPROTECT_H
+#define QEMU_MPROTECT_H
+
+int qemu_mprotect_rw(void *addr, size_t size);
+int qemu_mprotect_rwx(void *addr, size_t size);
+int qemu_mprotect_none(void *addr, size_t size);
+
+#endif
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index cb74f4571a3..2a52933ce0e 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -496,10 +496,6 @@  void sigaction_invoke(struct sigaction *action,
                       struct qemu_signalfd_siginfo *info);
 #endif
 
-int qemu_mprotect_rw(void *addr, size_t size);
-int qemu_mprotect_rwx(void *addr, size_t size);
-int qemu_mprotect_none(void *addr, size_t size);
-
 /*
  * Don't introduce new usage of this function, prefer the following
  * qemu_open/qemu_create that take an "Error **errp"
diff --git a/tcg/region.c b/tcg/region.c
index c46021d1604..7b4e65a52e8 100644
--- a/tcg/region.c
+++ b/tcg/region.c
@@ -25,6 +25,7 @@ 
 #include "qemu/osdep.h"
 #include "qemu/units.h"
 #include "qemu/madvise.h"
+#include "qemu/mprotect.h"
 #include "qapi/error.h"
 #include "exec/exec-all.h"
 #include "tcg/tcg.h"
diff --git a/util/osdep.c b/util/osdep.c
index 1999f42f6fc..72b678ca2e3 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -38,6 +38,7 @@  extern int madvise(char *, size_t, int);
 #include "qemu/sockets.h"
 #include "qemu/error-report.h"
 #include "qemu/madvise.h"
+#include "qemu/mprotect.h"
 #include "monitor/monitor.h"
 
 static bool fips_enabled = false;