monitor: remove MonitorDef from typedefs.h
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 2 May 2024 15:09:39 +0000 (17:09 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 3 May 2024 13:47:48 +0000 (15:47 +0200)
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.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/monitor/hmp-target.h
include/qemu/typedefs.h
stubs/target-monitor-defs.c

index d78e979f0532354623528d55eb2d6e46006fb917..b679aaebbff602af99617aa962b61e302cc8f0e9 100644 (file)
 #ifndef MONITOR_HMP_TARGET_H
 #define MONITOR_HMP_TARGET_H
 
-#include "cpu.h"
-
-#define MD_TLONG 0
-#define MD_I32   1
+typedef struct MonitorDef MonitorDef;
 
+#ifdef COMPILING_PER_TARGET
+#include "cpu.h"
 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);
index 2b1948a19ac36223f3a614a775760ddc930e2ab8..b71a36d02b2813f51a21affa2afc643f78ffd61b 100644 (file)
@@ -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;
index ac07b19064cf6f89f259ee0e9a71f09feeea2853..35a0a342772adabf05cb1384291311461bd417aa 100644 (file)
@@ -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)
 {