diff mbox series

[09/13] monitor: remove MonitorDef from typedefs.h

Message ID 20240502155331.109297-10-pbonzini@redhat.com
State New
Headers show
Series remove some types from typedefs.h | expand

Commit Message

Paolo Bonzini May 2, 2024, 3:53 p.m. UTC
MonitorDef is defined by hmp-target.h, and all users except one already
include it; the reason why the stubs do not include it, is because
hmp-target.h currently can only be used in files that are compiled
per target.  However, that is easily fixed.  Because the benefit of
having MonitorDef in typedefs.h is very small, do it and remove the
type from typedefs.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/monitor/hmp-target.h | 11 +++++++----
 include/qemu/typedefs.h      |  1 -
 stubs/target-monitor-defs.c  |  3 +--
 3 files changed, 8 insertions(+), 7 deletions(-)

Comments

Philippe Mathieu-Daudé May 3, 2024, 8:38 a.m. UTC | #1
On 2/5/24 17:53, Paolo Bonzini wrote:
> MonitorDef is defined by hmp-target.h, and all users except one already
> include it; the reason why the stubs do not include it, is because
> hmp-target.h currently can only be used in files that are compiled
> per target.  However, that is easily fixed.  Because the benefit of
> having MonitorDef in typedefs.h is very small, do it and remove the
> type from typedefs.h.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   include/monitor/hmp-target.h | 11 +++++++----
>   include/qemu/typedefs.h      |  1 -
>   stubs/target-monitor-defs.c  |  3 +--
>   3 files changed, 8 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
index d78e979f053..b679aaebbff 100644
--- a/include/monitor/hmp-target.h
+++ b/include/monitor/hmp-target.h
@@ -25,11 +25,10 @@ 
 #ifndef MONITOR_HMP_TARGET_H
 #define MONITOR_HMP_TARGET_H
 
+typedef struct MonitorDef MonitorDef;
+
+#ifdef COMPILING_PER_TARGET
 #include "cpu.h"
-
-#define MD_TLONG 0
-#define MD_I32   1
-
 struct MonitorDef {
     const char *name;
     int offset;
@@ -37,6 +36,10 @@  struct MonitorDef {
                              int val);
     int type;
 };
+#endif
+
+#define MD_TLONG 0
+#define MD_I32   1
 
 const MonitorDef *target_monitor_defs(void);
 int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 2b1948a19ac..b71a36d02b2 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -75,7 +75,6 @@  typedef struct MemoryRegionSection MemoryRegionSection;
 typedef struct MigrationIncomingState MigrationIncomingState;
 typedef struct MigrationState MigrationState;
 typedef struct Monitor Monitor;
-typedef struct MonitorDef MonitorDef;
 typedef struct MSIMessage MSIMessage;
 typedef struct NetClientState NetClientState;
 typedef struct NetFilterState NetFilterState;
diff --git a/stubs/target-monitor-defs.c b/stubs/target-monitor-defs.c
index ac07b19064c..35a0a342772 100644
--- a/stubs/target-monitor-defs.c
+++ b/stubs/target-monitor-defs.c
@@ -1,6 +1,5 @@ 
 #include "qemu/osdep.h"
-
-const MonitorDef *target_monitor_defs(void);
+#include "monitor/hmp-target.h"
 
 const MonitorDef *target_monitor_defs(void)
 {