From 1ae00000c153f56f45a62e9520a773bbfa3d185c Mon Sep 17 00:00:00 2001 Message-Id: From: Blue Swirl Date: Sat, 26 Mar 2011 15:15:05 +0000 Subject: [PATCH 1/4] Introduce host state Move host specific state (not guest visible except for PV, unrelated to any specific target machine, VM, VCPU or devices) declarations to host-state.h. Move macro TFR to qemu-common.h, so that qemu-char.c does not need to include sysemu.h. Signed-off-by: Blue Swirl --- host-state.h | 40 ++++++++++++++++++++++++++++++++++++++++ hw/fw_cfg.c | 1 + hw/usb-bus.c | 2 +- hw/xen_devconfig.c | 1 + hw/xen_domainbuild.c | 1 + monitor.c | 1 + os-posix.c | 1 + oslib-win32.c | 2 +- qemu-char.c | 2 +- qemu-common.h | 1 + sysemu.h | 31 ------------------------------- ui/curses.c | 2 +- ui/sdl.c | 1 + ui/vnc.c | 2 +- usb-linux.c | 2 +- vl.c | 1 + 16 files changed, 54 insertions(+), 37 deletions(-) create mode 100644 host-state.h diff --git a/host-state.h b/host-state.h new file mode 100644 index 0000000..0974405 --- /dev/null +++ b/host-state.h @@ -0,0 +1,40 @@ +#ifndef QEMU_HOST_STATE_H +#define QEMU_HOST_STATE_H +/* + * Host state: All state which is not guest visible except for PV, + * unrelated to any specific target machine, VM, VCPU or devices. + */ + +#include "notify.h" + +typedef enum DisplayType +{ + DT_DEFAULT, + DT_CURSES, + DT_SDL, + DT_NOGRAPHIC, + DT_NONE, +} DisplayType; + +extern DisplayType display_type; +extern int alt_grab; +extern int ctrl_grab; +extern int cursor_hide; +extern int no_quit; +extern int no_shutdown; +extern const char *qemu_name; +extern const char *keyboard_layout; + +void qemu_add_exit_notifier(Notifier *notify); +void qemu_remove_exit_notifier(Notifier *notify); +void qemu_system_killed(int signal, pid_t pid); +void qemu_kill_report(void); + +/* SLIRP */ +void do_info_slirp(Monitor *mon); + +void do_usb_add(Monitor *mon, const QDict *qdict); +void do_usb_del(Monitor *mon, const QDict *qdict); +void usb_info(Monitor *mon); + +#endif diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c index 85c8c3c..3c191d0 100644 --- a/hw/fw_cfg.c +++ b/hw/fw_cfg.c @@ -26,6 +26,7 @@ #include "isa.h" #include "fw_cfg.h" #include "sysbus.h" +#include "host-state.h" /* debug firmware config */ //#define DEBUG_FW_CFG diff --git a/hw/usb-bus.c b/hw/usb-bus.c index abc7e61..7c769ae 100644 --- a/hw/usb-bus.c +++ b/hw/usb-bus.c @@ -1,8 +1,8 @@ #include "hw.h" #include "usb.h" #include "qdev.h" -#include "sysemu.h" #include "monitor.h" +#include "host-state.h" static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent); diff --git a/hw/xen_devconfig.c b/hw/xen_devconfig.c index 8d50216..b99d504 100644 --- a/hw/xen_devconfig.c +++ b/hw/xen_devconfig.c @@ -1,6 +1,7 @@ #include "xen_backend.h" #include "blockdev.h" #include "block_int.h" /* XXX */ +#include "host-state.h" /* ------------------------------------------------------------- */ diff --git a/hw/xen_domainbuild.c b/hw/xen_domainbuild.c index 371c562..9440864 100644 --- a/hw/xen_domainbuild.c +++ b/hw/xen_domainbuild.c @@ -4,6 +4,7 @@ #include "sysemu.h" #include "qemu-timer.h" #include "qemu-log.h" +#include "host-state.h" #include diff --git a/monitor.c b/monitor.c index 76a8207..d8cf21d 100644 --- a/monitor.c +++ b/monitor.c @@ -61,6 +61,7 @@ #include "trace.h" #endif #include "ui/qemu-spice.h" +#include "host-state.h" //#define DEBUG //#define DEBUG_COMPLETION diff --git a/os-posix.c b/os-posix.c index eb49e2f..e6097c6 100644 --- a/os-posix.c +++ b/os-posix.c @@ -38,6 +38,7 @@ #include "sysemu.h" #include "net/slirp.h" #include "qemu-options.h" +#include "host-state.h" #ifdef CONFIG_LINUX #include diff --git a/oslib-win32.c b/oslib-win32.c index 5f0759f..c542a39 100644 --- a/oslib-win32.c +++ b/oslib-win32.c @@ -27,9 +27,9 @@ */ #include #include "config-host.h" -#include "sysemu.h" #include "trace.h" #include "qemu_socket.h" +#include "host-state.h" void *qemu_oom_check(void *ptr) { diff --git a/qemu-char.c b/qemu-char.c index 03858d4..6f2156d 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -25,7 +25,6 @@ #include "net.h" #include "monitor.h" #include "console.h" -#include "sysemu.h" #include "qemu-timer.h" #include "qemu-char.h" #include "hw/usb.h" @@ -98,6 +97,7 @@ #include "qemu_socket.h" #include "ui/qemu-spice.h" +#include "host-state.h" #define READ_BUF_LEN 4096 diff --git a/qemu-common.h b/qemu-common.h index 7a96dd1..8a52f14 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -12,6 +12,7 @@ #endif #define QEMU_BUILD_BUG_ON(x) typedef char __build_bug_on__##__LINE__[(x)?-1:1]; +#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) typedef struct QEMUTimer QEMUTimer; typedef struct QEMUFile QEMUFile; diff --git a/sysemu.h b/sysemu.h index bbbd0fd..8e54a01 100644 --- a/sysemu.h +++ b/sysemu.h @@ -25,7 +25,6 @@ extern const char *bios_name; char *qemu_find_file(int type, const char *name); extern int vm_running; -extern const char *qemu_name; extern uint8_t qemu_uuid[]; int qemu_uuid_parse(const char *str, uint8_t *uuid); #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx" @@ -66,14 +65,9 @@ void qemu_system_vmstop_request(int reason); int qemu_shutdown_requested(void); int qemu_reset_requested(void); int qemu_powerdown_requested(void); -void qemu_system_killed(int signal, pid_t pid); -void qemu_kill_report(void); extern qemu_irq qemu_system_powerdown; void qemu_system_reset(void); -void qemu_add_exit_notifier(Notifier *notify); -void qemu_remove_exit_notifier(Notifier *notify); - void qemu_add_machine_init_done_notifier(Notifier *notify); void do_savevm(Monitor *mon, const QDict *qdict); @@ -97,24 +91,12 @@ int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f); void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f); int qemu_loadvm_state(QEMUFile *f); -/* SLIRP */ -void do_info_slirp(Monitor *mon); - /* OS specific functions */ void os_setup_early_signal_handling(void); char *os_find_datadir(const char *argv0); void os_parse_cmd_args(int index, const char *optarg); void os_pidfile_error(void); -typedef enum DisplayType -{ - DT_DEFAULT, - DT_CURSES, - DT_SDL, - DT_NOGRAPHIC, - DT_NONE, -} DisplayType; - extern int autostart; extern int incoming_expected; extern int bios_size; @@ -134,19 +116,12 @@ extern int graphic_width; extern int graphic_height; extern int graphic_depth; extern uint8_t irq0override; -extern DisplayType display_type; -extern const char *keyboard_layout; extern int win2k_install_hack; extern int rtc_td_hack; -extern int alt_grab; -extern int ctrl_grab; extern int usb_enabled; extern int smp_cpus; extern int max_cpus; -extern int cursor_hide; extern int graphic_rotate; -extern int no_quit; -extern int no_shutdown; extern int semihosting_enabled; extern int old_param; extern int boot_menu; @@ -191,12 +166,6 @@ extern CharDriverState *serial_hds[MAX_SERIAL_PORTS]; extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; -#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) - -void do_usb_add(Monitor *mon, const QDict *qdict); -void do_usb_del(Monitor *mon, const QDict *qdict); -void usb_info(Monitor *mon); - void rtc_change_mon_event(struct tm *tm); void register_devices(void); diff --git a/ui/curses.c b/ui/curses.c index 82bc614..7942efe 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -35,7 +35,7 @@ #include "qemu-common.h" #include "console.h" -#include "sysemu.h" +#include "host-state.h" #define FONT_HEIGHT 16 #define FONT_WIDTH 8 diff --git a/ui/sdl.c b/ui/sdl.c index c5bb0a3..6a96ea1 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -37,6 +37,7 @@ #include "sysemu.h" #include "x_keymap.h" #include "sdl_zoom.h" +#include "host-state.h" static DisplayChangeListener *dcl; static SDL_Surface *real_screen; diff --git a/ui/vnc.c b/ui/vnc.c index 14f2930..90b3c99 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -26,11 +26,11 @@ #include "vnc.h" #include "vnc-jobs.h" -#include "sysemu.h" #include "qemu_socket.h" #include "qemu-timer.h" #include "acl.h" #include "qemu-objects.h" +#include "host-state.h" #define VNC_REFRESH_INTERVAL_BASE 30 #define VNC_REFRESH_INTERVAL_INC 50 diff --git a/usb-linux.c b/usb-linux.c index 255009f..0dd2729 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -33,7 +33,6 @@ #include "qemu-common.h" #include "qemu-timer.h" #include "monitor.h" -#include "sysemu.h" #include #include @@ -42,6 +41,7 @@ #include #include #include "hw/usb.h" +#include "host-state.h" /* We redefine it to avoid version problems */ struct usb_ctrltransfer { diff --git a/vl.c b/vl.c index 192a240..4354674 100644 --- a/vl.c +++ b/vl.c @@ -160,6 +160,7 @@ int main(int argc, char **argv) #include "qemu-queue.h" #include "cpus.h" #include "arch_init.h" +#include "host-state.h" #include "ui/qemu-spice.h" -- 1.7.2.5