From 28ecbaeecb139a214f019207402a35d7b58aec0f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 28 Nov 2012 12:06:30 +0100 Subject: ui: move files to ui/ and include/ui/ Signed-off-by: Paolo Bonzini --- ui/input.c | 529 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 529 insertions(+) create mode 100644 ui/input.c (limited to 'ui/input.c') diff --git a/ui/input.c b/ui/input.c new file mode 100644 index 0000000000..58d3b4709c --- /dev/null +++ b/ui/input.c @@ -0,0 +1,529 @@ +/* + * QEMU System Emulator + * + * Copyright (c) 2003-2008 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "sysemu.h" +#include "monitor.h" +#include "ui/console.h" +#include "error.h" +#include "qmp-commands.h" +#include "qapi-types.h" + +static QEMUPutKBDEvent *qemu_put_kbd_event; +static void *qemu_put_kbd_event_opaque; +static QTAILQ_HEAD(, QEMUPutLEDEntry) led_handlers = QTAILQ_HEAD_INITIALIZER(led_handlers); +static QTAILQ_HEAD(, QEMUPutMouseEntry) mouse_handlers = + QTAILQ_HEAD_INITIALIZER(mouse_handlers); +static NotifierList mouse_mode_notifiers = + NOTIFIER_LIST_INITIALIZER(mouse_mode_notifiers); + +static const int key_defs[] = { + [Q_KEY_CODE_SHIFT] = 0x2a, + [Q_KEY_CODE_SHIFT_R] = 0x36, + + [Q_KEY_CODE_ALT] = 0x38, + [Q_KEY_CODE_ALT_R] = 0xb8, + [Q_KEY_CODE_ALTGR] = 0x64, + [Q_KEY_CODE_ALTGR_R] = 0xe4, + [Q_KEY_CODE_CTRL] = 0x1d, + [Q_KEY_CODE_CTRL_R] = 0x9d, + + [Q_KEY_CODE_MENU] = 0xdd, + + [Q_KEY_CODE_ESC] = 0x01, + + [Q_KEY_CODE_1] = 0x02, + [Q_KEY_CODE_2] = 0x03, + [Q_KEY_CODE_3] = 0x04, + [Q_KEY_CODE_4] = 0x05, + [Q_KEY_CODE_5] = 0x06, + [Q_KEY_CODE_6] = 0x07, + [Q_KEY_CODE_7] = 0x08, + [Q_KEY_CODE_8] = 0x09, + [Q_KEY_CODE_9] = 0x0a, + [Q_KEY_CODE_0] = 0x0b, + [Q_KEY_CODE_MINUS] = 0x0c, + [Q_KEY_CODE_EQUAL] = 0x0d, + [Q_KEY_CODE_BACKSPACE] = 0x0e, + + [Q_KEY_CODE_TAB] = 0x0f, + [Q_KEY_CODE_Q] = 0x10, + [Q_KEY_CODE_W] = 0x11, + [Q_KEY_CODE_E] = 0x12, + [Q_KEY_CODE_R] = 0x13, + [Q_KEY_CODE_T] = 0x14, + [Q_KEY_CODE_Y] = 0x15, + [Q_KEY_CODE_U] = 0x16, + [Q_KEY_CODE_I] = 0x17, + [Q_KEY_CODE_O] = 0x18, + [Q_KEY_CODE_P] = 0x19, + [Q_KEY_CODE_BRACKET_LEFT] = 0x1a, + [Q_KEY_CODE_BRACKET_RIGHT] = 0x1b, + [Q_KEY_CODE_RET] = 0x1c, + + [Q_KEY_CODE_A] = 0x1e, + [Q_KEY_CODE_S] = 0x1f, + [Q_KEY_CODE_D] = 0x20, + [Q_KEY_CODE_F] = 0x21, + [Q_KEY_CODE_G] = 0x22, + [Q_KEY_CODE_H] = 0x23, + [Q_KEY_CODE_J] = 0x24, + [Q_KEY_CODE_K] = 0x25, + [Q_KEY_CODE_L] = 0x26, + [Q_KEY_CODE_SEMICOLON] = 0x27, + [Q_KEY_CODE_APOSTROPHE] = 0x28, + [Q_KEY_CODE_GRAVE_ACCENT] = 0x29, + + [Q_KEY_CODE_BACKSLASH] = 0x2b, + [Q_KEY_CODE_Z] = 0x2c, + [Q_KEY_CODE_X] = 0x2d, + [Q_KEY_CODE_C] = 0x2e, + [Q_KEY_CODE_V] = 0x2f, + [Q_KEY_CODE_B] = 0x30, + [Q_KEY_CODE_N] = 0x31, + [Q_KEY_CODE_M] = 0x32, + [Q_KEY_CODE_COMMA] = 0x33, + [Q_KEY_CODE_DOT] = 0x34, + [Q_KEY_CODE_SLASH] = 0x35, + + [Q_KEY_CODE_ASTERISK] = 0x37, + + [Q_KEY_CODE_SPC] = 0x39, + [Q_KEY_CODE_CAPS_LOCK] = 0x3a, + [Q_KEY_CODE_F1] = 0x3b, + [Q_KEY_CODE_F2] = 0x3c, + [Q_KEY_CODE_F3] = 0x3d, + [Q_KEY_CODE_F4] = 0x3e, + [Q_KEY_CODE_F5] = 0x3f, + [Q_KEY_CODE_F6] = 0x40, + [Q_KEY_CODE_F7] = 0x41, + [Q_KEY_CODE_F8] = 0x42, + [Q_KEY_CODE_F9] = 0x43, + [Q_KEY_CODE_F10] = 0x44, + [Q_KEY_CODE_NUM_LOCK] = 0x45, + [Q_KEY_CODE_SCROLL_LOCK] = 0x46, + + [Q_KEY_CODE_KP_DIVIDE] = 0xb5, + [Q_KEY_CODE_KP_MULTIPLY] = 0x37, + [Q_KEY_CODE_KP_SUBTRACT] = 0x4a, + [Q_KEY_CODE_KP_ADD] = 0x4e, + [Q_KEY_CODE_KP_ENTER] = 0x9c, + [Q_KEY_CODE_KP_DECIMAL] = 0x53, + [Q_KEY_CODE_SYSRQ] = 0x54, + + [Q_KEY_CODE_KP_0] = 0x52, + [Q_KEY_CODE_KP_1] = 0x4f, + [Q_KEY_CODE_KP_2] = 0x50, + [Q_KEY_CODE_KP_3] = 0x51, + [Q_KEY_CODE_KP_4] = 0x4b, + [Q_KEY_CODE_KP_5] = 0x4c, + [Q_KEY_CODE_KP_6] = 0x4d, + [Q_KEY_CODE_KP_7] = 0x47, + [Q_KEY_CODE_KP_8] = 0x48, + [Q_KEY_CODE_KP_9] = 0x49, + + [Q_KEY_CODE_LESS] = 0x56, + + [Q_KEY_CODE_F11] = 0x57, + [Q_KEY_CODE_F12] = 0x58, + + [Q_KEY_CODE_PRINT] = 0xb7, + + [Q_KEY_CODE_HOME] = 0xc7, + [Q_KEY_CODE_PGUP] = 0xc9, + [Q_KEY_CODE_PGDN] = 0xd1, + [Q_KEY_CODE_END] = 0xcf, + + [Q_KEY_CODE_LEFT] = 0xcb, + [Q_KEY_CODE_UP] = 0xc8, + [Q_KEY_CODE_DOWN] = 0xd0, + [Q_KEY_CODE_RIGHT] = 0xcd, + + [Q_KEY_CODE_INSERT] = 0xd2, + [Q_KEY_CODE_DELETE] = 0xd3, +#ifdef NEED_CPU_H +#if defined(TARGET_SPARC) && !defined(TARGET_SPARC64) + [Q_KEY_CODE_STOP] = 0xf0, + [Q_KEY_CODE_AGAIN] = 0xf1, + [Q_KEY_CODE_PROPS] = 0xf2, + [Q_KEY_CODE_UNDO] = 0xf3, + [Q_KEY_CODE_FRONT] = 0xf4, + [Q_KEY_CODE_COPY] = 0xf5, + [Q_KEY_CODE_OPEN] = 0xf6, + [Q_KEY_CODE_PASTE] = 0xf7, + [Q_KEY_CODE_FIND] = 0xf8, + [Q_KEY_CODE_CUT] = 0xf9, + [Q_KEY_CODE_LF] = 0xfa, + [Q_KEY_CODE_HELP] = 0xfb, + [Q_KEY_CODE_META_L] = 0xfc, + [Q_KEY_CODE_META_R] = 0xfd, + [Q_KEY_CODE_COMPOSE] = 0xfe, +#endif +#endif + [Q_KEY_CODE_MAX] = 0, +}; + +int index_from_key(const char *key) +{ + int i; + + for (i = 0; QKeyCode_lookup[i] != NULL; i++) { + if (!strcmp(key, QKeyCode_lookup[i])) { + break; + } + } + + /* Return Q_KEY_CODE_MAX if the key is invalid */ + return i; +} + +int index_from_keycode(int code) +{ + int i; + + for (i = 0; i < Q_KEY_CODE_MAX; i++) { + if (key_defs[i] == code) { + break; + } + } + + /* Return Q_KEY_CODE_MAX if the code is invalid */ + return i; +} + +static int *keycodes; +static int keycodes_size; +static QEMUTimer *key_timer; + +static int keycode_from_keyvalue(const KeyValue *value) +{ + if (value->kind == KEY_VALUE_KIND_QCODE) { + return key_defs[value->qcode]; + } else { + assert(value->kind == KEY_VALUE_KIND_NUMBER); + return value->number; + } +} + +static void free_keycodes(void) +{ + g_free(keycodes); + keycodes = NULL; + keycodes_size = 0; +} + +static void release_keys(void *opaque) +{ + int i; + + for (i = 0; i < keycodes_size; i++) { + if (keycodes[i] & 0x80) { + kbd_put_keycode(0xe0); + } + kbd_put_keycode(keycodes[i]| 0x80); + } + + free_keycodes(); +} + +void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time, + Error **errp) +{ + int keycode; + KeyValueList *p; + + if (!key_timer) { + key_timer = qemu_new_timer_ns(vm_clock, release_keys, NULL); + } + + if (keycodes != NULL) { + qemu_del_timer(key_timer); + release_keys(NULL); + } + + if (!has_hold_time) { + hold_time = 100; + } + + for (p = keys; p != NULL; p = p->next) { + /* key down events */ + keycode = keycode_from_keyvalue(p->value); + if (keycode < 0x01 || keycode > 0xff) { + error_setg(errp, "invalid hex keycode 0x%x\n", keycode); + free_keycodes(); + return; + } + + if (keycode & 0x80) { + kbd_put_keycode(0xe0); + } + kbd_put_keycode(keycode & 0x7f); + + keycodes = g_realloc(keycodes, sizeof(int) * (keycodes_size + 1)); + keycodes[keycodes_size++] = keycode; + } + + /* delayed key up events */ + qemu_mod_timer(key_timer, qemu_get_clock_ns(vm_clock) + + muldiv64(get_ticks_per_sec(), hold_time, 1000)); +} + +void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque) +{ + qemu_put_kbd_event_opaque = opaque; + qemu_put_kbd_event = func; +} + +void qemu_remove_kbd_event_handler(void) +{ + qemu_put_kbd_event_opaque = NULL; + qemu_put_kbd_event = NULL; +} + +static void check_mode_change(void) +{ + static int current_is_absolute, current_has_absolute; + int is_absolute; + int has_absolute; + + is_absolute = kbd_mouse_is_absolute(); + has_absolute = kbd_mouse_has_absolute(); + + if (is_absolute != current_is_absolute || + has_absolute != current_has_absolute) { + notifier_list_notify(&mouse_mode_notifiers, NULL); + } + + current_is_absolute = is_absolute; + current_has_absolute = has_absolute; +} + +QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, + void *opaque, int absolute, + const char *name) +{ + QEMUPutMouseEntry *s; + static int mouse_index = 0; + + s = g_malloc0(sizeof(QEMUPutMouseEntry)); + + s->qemu_put_mouse_event = func; + s->qemu_put_mouse_event_opaque = opaque; + s->qemu_put_mouse_event_absolute = absolute; + s->qemu_put_mouse_event_name = g_strdup(name); + s->index = mouse_index++; + + QTAILQ_INSERT_TAIL(&mouse_handlers, s, node); + + check_mode_change(); + + return s; +} + +void qemu_activate_mouse_event_handler(QEMUPutMouseEntry *entry) +{ + QTAILQ_REMOVE(&mouse_handlers, entry, node); + QTAILQ_INSERT_HEAD(&mouse_handlers, entry, node); + + check_mode_change(); +} + +void qemu_remove_mouse_event_handler(QEMUPutMouseEntry *entry) +{ + QTAILQ_REMOVE(&mouse_handlers, entry, node); + + g_free(entry->qemu_put_mouse_event_name); + g_free(entry); + + check_mode_change(); +} + +QEMUPutLEDEntry *qemu_add_led_event_handler(QEMUPutLEDEvent *func, + void *opaque) +{ + QEMUPutLEDEntry *s; + + s = g_malloc0(sizeof(QEMUPutLEDEntry)); + + s->put_led = func; + s->opaque = opaque; + QTAILQ_INSERT_TAIL(&led_handlers, s, next); + return s; +} + +void qemu_remove_led_event_handler(QEMUPutLEDEntry *entry) +{ + if (entry == NULL) + return; + QTAILQ_REMOVE(&led_handlers, entry, next); + g_free(entry); +} + +void kbd_put_keycode(int keycode) +{ + if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) { + return; + } + if (qemu_put_kbd_event) { + qemu_put_kbd_event(qemu_put_kbd_event_opaque, keycode); + } +} + +void kbd_put_ledstate(int ledstate) +{ + QEMUPutLEDEntry *cursor; + + QTAILQ_FOREACH(cursor, &led_handlers, next) { + cursor->put_led(cursor->opaque, ledstate); + } +} + +void kbd_mouse_event(int dx, int dy, int dz, int buttons_state) +{ + QEMUPutMouseEntry *entry; + QEMUPutMouseEvent *mouse_event; + void *mouse_event_opaque; + int width, height; + + if (!runstate_is_running() && !runstate_check(RUN_STATE_SUSPENDED)) { + return; + } + if (QTAILQ_EMPTY(&mouse_handlers)) { + return; + } + + entry = QTAILQ_FIRST(&mouse_handlers); + + mouse_event = entry->qemu_put_mouse_event; + mouse_event_opaque = entry->qemu_put_mouse_event_opaque; + + if (mouse_event) { + if (entry->qemu_put_mouse_event_absolute) { + width = 0x7fff; + height = 0x7fff; + } else { + width = graphic_width - 1; + height = graphic_height - 1; + } + + switch (graphic_rotate) { + case 0: + mouse_event(mouse_event_opaque, + dx, dy, dz, buttons_state); + break; + case 90: + mouse_event(mouse_event_opaque, + width - dy, dx, dz, buttons_state); + break; + case 180: + mouse_event(mouse_event_opaque, + width - dx, height - dy, dz, buttons_state); + break; + case 270: + mouse_event(mouse_event_opaque, + dy, height - dx, dz, buttons_state); + break; + } + } +} + +int kbd_mouse_is_absolute(void) +{ + if (QTAILQ_EMPTY(&mouse_handlers)) { + return 0; + } + + return QTAILQ_FIRST(&mouse_handlers)->qemu_put_mouse_event_absolute; +} + +int kbd_mouse_has_absolute(void) +{ + QEMUPutMouseEntry *entry; + + QTAILQ_FOREACH(entry, &mouse_handlers, node) { + if (entry->qemu_put_mouse_event_absolute) { + return 1; + } + } + + return 0; +} + +MouseInfoList *qmp_query_mice(Error **errp) +{ + MouseInfoList *mice_list = NULL; + QEMUPutMouseEntry *cursor; + bool current = true; + + QTAILQ_FOREACH(cursor, &mouse_handlers, node) { + MouseInfoList *info = g_malloc0(sizeof(*info)); + info->value = g_malloc0(sizeof(*info->value)); + info->value->name = g_strdup(cursor->qemu_put_mouse_event_name); + info->value->index = cursor->index; + info->value->absolute = !!cursor->qemu_put_mouse_event_absolute; + info->value->current = current; + + current = false; + + info->next = mice_list; + mice_list = info; + } + + return mice_list; +} + +void do_mouse_set(Monitor *mon, const QDict *qdict) +{ + QEMUPutMouseEntry *cursor; + int index = qdict_get_int(qdict, "index"); + int found = 0; + + if (QTAILQ_EMPTY(&mouse_handlers)) { + monitor_printf(mon, "No mouse devices connected\n"); + return; + } + + QTAILQ_FOREACH(cursor, &mouse_handlers, node) { + if (cursor->index == index) { + found = 1; + qemu_activate_mouse_event_handler(cursor); + break; + } + } + + if (!found) { + monitor_printf(mon, "Mouse at given index not found\n"); + } + + check_mode_change(); +} + +void qemu_add_mouse_mode_change_notifier(Notifier *notify) +{ + notifier_list_add(&mouse_mode_notifiers, notify); +} + +void qemu_remove_mouse_mode_change_notifier(Notifier *notify) +{ + notifier_remove(notify); +} -- cgit v1.2.3-55-g7522 From 7b1b5d191385ca52e96caae2a05c64f3a63855d9 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 17 Dec 2012 18:19:43 +0100 Subject: qapi: move include files to include/qobject/ Signed-off-by: Paolo Bonzini --- backends/rng-egd.c | 2 +- backends/rng-random.c | 2 +- backends/rng.c | 2 +- balloon.c | 2 +- block.c | 2 +- block.h | 2 +- block/qcow2.c | 2 +- block/qed.c | 2 +- block_int.h | 2 +- blockdev-nbd.c | 2 +- blockdev.c | 4 +- blockdev.h | 2 +- blockjob.c | 2 +- dump-stub.c | 2 +- dump.c | 2 +- error.c | 8 +- error.h | 80 ----------- hmp.h | 2 +- hw/ivshmem.c | 2 +- hw/mc146818rtc.c | 2 +- hw/pci/pci-hotplug.c | 2 +- hw/pci/pcie_aer.c | 2 +- hw/qdev-addr.c | 2 +- hw/qdev-core.h | 2 +- hw/qdev-properties.c | 4 +- hw/qdev.c | 4 +- hw/vga_int.h | 2 +- hw/watchdog.c | 2 +- include/net/net.h | 2 +- include/net/slirp.h | 2 +- include/qapi/dealloc-visitor.h | 26 ++++ include/qapi/error.h | 80 +++++++++++ include/qapi/opts-visitor.h | 31 +++++ include/qapi/qmp-input-visitor.h | 29 ++++ include/qapi/qmp-output-visitor.h | 28 ++++ include/qapi/qmp/dispatch.h | 55 ++++++++ include/qapi/qmp/json-lexer.h | 51 +++++++ include/qapi/qmp/json-parser.h | 24 ++++ include/qapi/qmp/json-streamer.h | 40 ++++++ include/qapi/qmp/qbool.h | 29 ++++ include/qapi/qmp/qdict.h | 67 ++++++++++ include/qapi/qmp/qerror.h | 252 +++++++++++++++++++++++++++++++++++ include/qapi/qmp/qfloat.h | 29 ++++ include/qapi/qmp/qint.h | 28 ++++ include/qapi/qmp/qjson.h | 29 ++++ include/qapi/qmp/qlist.h | 64 +++++++++ include/qapi/qmp/qobject.h | 112 ++++++++++++++++ include/qapi/qmp/qstring.h | 35 +++++ include/qapi/qmp/types.h | 25 ++++ include/qapi/string-input-visitor.h | 25 ++++ include/qapi/string-output-visitor.h | 26 ++++ include/qapi/visitor-impl.h | 63 +++++++++ include/qapi/visitor.h | 55 ++++++++ include/qemu/rng.h | 2 +- include/ui/console.h | 4 +- json-lexer.c | 10 +- json-lexer.h | 51 ------- json-parser.c | 18 +-- json-parser.h | 24 ---- json-streamer.c | 10 +- json-streamer.h | 40 ------ migration.h | 4 +- monitor.c | 16 +-- monitor.h | 4 +- net/net.c | 2 +- pixman | 2 +- qapi/opts-visitor.c | 6 +- qapi/opts-visitor.h | 31 ----- qapi/qapi-dealloc-visitor.c | 6 +- qapi/qapi-dealloc-visitor.h | 26 ---- qapi/qapi-visit-core.c | 6 +- qapi/qapi-visit-core.h | 55 -------- qapi/qapi-visit-impl.h | 63 --------- qapi/qmp-core.h | 55 -------- qapi/qmp-dispatch.c | 10 +- qapi/qmp-input-visitor.c | 8 +- qapi/qmp-input-visitor.h | 29 ---- qapi/qmp-output-visitor.c | 8 +- qapi/qmp-output-visitor.h | 28 ---- qapi/qmp-registry.c | 2 +- qapi/string-input-visitor.c | 6 +- qapi/string-input-visitor.h | 25 ---- qapi/string-output-visitor.c | 6 +- qapi/string-output-visitor.h | 26 ---- qbool.c | 4 +- qbool.h | 29 ---- qdict.c | 12 +- qdict.h | 67 ---------- qemu-char.h | 4 +- qemu-config.c | 2 +- qemu-config.h | 2 +- qemu-img.c | 2 +- qemu-objects.h | 25 ---- qemu-option.c | 6 +- qemu-option.h | 4 +- qemu_socket.h | 4 +- qerror.c | 4 +- qerror.h | 252 ----------------------------------- qfloat.c | 4 +- qfloat.h | 29 ---- qga/commands-posix.c | 2 +- qga/commands-win32.c | 2 +- qga/commands.c | 2 +- qga/guest-agent-core.h | 2 +- qga/main.c | 12 +- qint.c | 4 +- qint.h | 28 ---- qjson.c | 18 +-- qjson.h | 29 ---- qlist.c | 4 +- qlist.h | 64 --------- qobject.h | 112 ---------------- qom/object.c | 12 +- qom/qom-qobject.c | 2 +- qstring.c | 4 +- qstring.h | 35 ----- scripts/qapi-commands.py | 14 +- scripts/qapi-types.py | 2 +- scripts/qapi-visit.py | 2 +- stubs/arch-query-cpu-def.c | 2 +- target-i386/cpu-qom.h | 2 +- target-i386/cpu.c | 4 +- target-openrisc/cpu.h | 2 +- tests/check-qdict.c | 6 +- tests/check-qfloat.c | 2 +- tests/check-qint.c | 2 +- tests/check-qjson.c | 14 +- tests/check-qlist.c | 4 +- tests/check-qstring.c | 2 +- tests/test-qmp-commands.c | 4 +- tests/test-qmp-input-strict.c | 2 +- tests/test-qmp-input-visitor.c | 2 +- tests/test-qmp-output-visitor.c | 2 +- tests/test-string-input-visitor.c | 2 +- tests/test-string-output-visitor.c | 2 +- tests/test-visitor-serialization.c | 2 +- ui/input.c | 2 +- ui/spice-core.c | 8 +- ui/vnc-enc-tight.c | 2 +- ui/vnc-palette.h | 2 +- ui/vnc.c | 2 +- vl.c | 2 +- 142 files changed, 1405 insertions(+), 1405 deletions(-) delete mode 100644 error.h create mode 100644 include/qapi/dealloc-visitor.h create mode 100644 include/qapi/error.h create mode 100644 include/qapi/opts-visitor.h create mode 100644 include/qapi/qmp-input-visitor.h create mode 100644 include/qapi/qmp-output-visitor.h create mode 100644 include/qapi/qmp/dispatch.h create mode 100644 include/qapi/qmp/json-lexer.h create mode 100644 include/qapi/qmp/json-parser.h create mode 100644 include/qapi/qmp/json-streamer.h create mode 100644 include/qapi/qmp/qbool.h create mode 100644 include/qapi/qmp/qdict.h create mode 100644 include/qapi/qmp/qerror.h create mode 100644 include/qapi/qmp/qfloat.h create mode 100644 include/qapi/qmp/qint.h create mode 100644 include/qapi/qmp/qjson.h create mode 100644 include/qapi/qmp/qlist.h create mode 100644 include/qapi/qmp/qobject.h create mode 100644 include/qapi/qmp/qstring.h create mode 100644 include/qapi/qmp/types.h create mode 100644 include/qapi/string-input-visitor.h create mode 100644 include/qapi/string-output-visitor.h create mode 100644 include/qapi/visitor-impl.h create mode 100644 include/qapi/visitor.h delete mode 100644 json-lexer.h delete mode 100644 json-parser.h delete mode 100644 json-streamer.h delete mode 100644 qapi/opts-visitor.h delete mode 100644 qapi/qapi-dealloc-visitor.h delete mode 100644 qapi/qapi-visit-core.h delete mode 100644 qapi/qapi-visit-impl.h delete mode 100644 qapi/qmp-core.h delete mode 100644 qapi/qmp-input-visitor.h delete mode 100644 qapi/qmp-output-visitor.h delete mode 100644 qapi/string-input-visitor.h delete mode 100644 qapi/string-output-visitor.h delete mode 100644 qbool.h delete mode 100644 qdict.h delete mode 100644 qemu-objects.h delete mode 100644 qerror.h delete mode 100644 qfloat.h delete mode 100644 qint.h delete mode 100644 qjson.h delete mode 100644 qlist.h delete mode 100644 qobject.h delete mode 100644 qstring.h (limited to 'ui/input.c') diff --git a/backends/rng-egd.c b/backends/rng-egd.c index ad8473777c..3a7d1ecbe0 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -12,7 +12,7 @@ #include "qemu/rng.h" #include "qemu-char.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "hw/qdev.h" /* just for DEFINE_PROP_CHR */ #define TYPE_RNG_EGD "rng-egd" diff --git a/backends/rng-random.c b/backends/rng-random.c index 9c9923b2ac..c201953f29 100644 --- a/backends/rng-random.c +++ b/backends/rng-random.c @@ -12,7 +12,7 @@ #include "qemu/rng-random.h" #include "qemu/rng.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "main-loop.h" struct RndRandom diff --git a/backends/rng.c b/backends/rng.c index 06f261180c..48a5840cd5 100644 --- a/backends/rng.c +++ b/backends/rng.c @@ -11,7 +11,7 @@ */ #include "qemu/rng.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" void rng_backend_request_entropy(RngBackend *s, size_t size, EntropyReceiveFunc *receive_entropy, diff --git a/balloon.c b/balloon.c index e02ab1c884..610fe6d626 100644 --- a/balloon.c +++ b/balloon.c @@ -30,7 +30,7 @@ #include "balloon.h" #include "trace.h" #include "qmp-commands.h" -#include "qjson.h" +#include "qapi/qmp/qjson.h" static QEMUBalloonEvent *balloon_event_fn; static QEMUBalloonStatus *balloon_stat_fn; diff --git a/block.c b/block.c index 0668c4be17..e962a5afe9 100644 --- a/block.c +++ b/block.c @@ -28,7 +28,7 @@ #include "block_int.h" #include "blockjob.h" #include "module.h" -#include "qjson.h" +#include "qapi/qmp/qjson.h" #include "sysemu.h" #include "notify.h" #include "qemu-coroutine.h" diff --git a/block.h b/block.h index 893448a5fc..0b22892d61 100644 --- a/block.h +++ b/block.h @@ -5,7 +5,7 @@ #include "qemu-common.h" #include "qemu-option.h" #include "qemu-coroutine.h" -#include "qobject.h" +#include "qapi/qmp/qobject.h" #include "qapi-types.h" /* block.c */ diff --git a/block/qcow2.c b/block/qcow2.c index 8520bda21a..217b4e422f 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -28,7 +28,7 @@ #include "aes.h" #include "block/qcow2.h" #include "qemu-error.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "trace.h" /* diff --git a/block/qed.c b/block/qed.c index 0b5374a202..ca1fafb47e 100644 --- a/block/qed.c +++ b/block/qed.c @@ -15,7 +15,7 @@ #include "qemu-timer.h" #include "trace.h" #include "qed.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "migration.h" static void qed_aio_cancel(BlockDriverAIOCB *blockacb) diff --git a/block_int.h b/block_int.h index bf3f79b3db..a748b6c571 100644 --- a/block_int.h +++ b/block_int.h @@ -30,7 +30,7 @@ #include "qemu-coroutine.h" #include "qemu-timer.h" #include "qapi-types.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "monitor.h" #define BLOCK_FLAG_ENCRYPT 1 diff --git a/blockdev-nbd.c b/blockdev-nbd.c index 6b26bbf8c5..a194ecd392 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -12,7 +12,7 @@ #include "blockdev.h" #include "hw/block-common.h" #include "monitor.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "sysemu.h" #include "qmp-commands.h" #include "trace.h" diff --git a/blockdev.c b/blockdev.c index 9a05e57009..c85c614577 100644 --- a/blockdev.c +++ b/blockdev.c @@ -11,10 +11,10 @@ #include "hw/block-common.h" #include "blockjob.h" #include "monitor.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "qemu-option.h" #include "qemu-config.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" #include "sysemu.h" #include "block_int.h" #include "qmp-commands.h" diff --git a/blockdev.h b/blockdev.h index d73d552a98..6e36d9f2c2 100644 --- a/blockdev.h +++ b/blockdev.h @@ -11,7 +11,7 @@ #define BLOCKDEV_H #include "block.h" -#include "error.h" +#include "qapi/error.h" #include "qemu-queue.h" void blockdev_mark_auto_del(BlockDriverState *bs); diff --git a/blockjob.c b/blockjob.c index cda12c6933..8c0a286a77 100644 --- a/blockjob.c +++ b/blockjob.c @@ -30,7 +30,7 @@ #include "block.h" #include "blockjob.h" #include "block_int.h" -#include "qjson.h" +#include "qapi/qmp/qjson.h" #include "qemu-coroutine.h" #include "qmp-commands.h" #include "qemu-timer.h" diff --git a/dump-stub.c b/dump-stub.c index 56d4564f0f..0842e6f916 100644 --- a/dump-stub.c +++ b/dump-stub.c @@ -13,7 +13,7 @@ #include "qemu-common.h" #include "dump.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "qmp-commands.h" /* we need this function in hmp.c */ diff --git a/dump.c b/dump.c index 5640c2c2ff..7b45b53a8f 100644 --- a/dump.c +++ b/dump.c @@ -21,7 +21,7 @@ #include "dump.h" #include "sysemu.h" #include "memory_mapping.h" -#include "error.h" +#include "qapi/error.h" #include "qmp-commands.h" #include "gdbstub.h" diff --git a/error.c b/error.c index 128d88cd91..519f6b6ce0 100644 --- a/error.c +++ b/error.c @@ -11,11 +11,11 @@ */ #include "qemu-common.h" -#include "error.h" -#include "qjson.h" -#include "qdict.h" +#include "qapi/error.h" +#include "qapi/qmp/qjson.h" +#include "qapi/qmp/qdict.h" #include "qapi-types.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" struct Error { diff --git a/error.h b/error.h deleted file mode 100644 index 4d52e7369e..0000000000 --- a/error.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * QEMU Error Objects - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2. See - * the COPYING.LIB file in the top-level directory. - */ -#ifndef ERROR_H -#define ERROR_H - -#include "compiler.h" -#include "qapi-types.h" -#include - -/** - * A class representing internal errors within QEMU. An error has a ErrorClass - * code and a human message. - */ -typedef struct Error Error; - -/** - * Set an indirect pointer to an error given a ErrorClass value and a - * printf-style human message. This function is not meant to be used outside - * of QEMU. - */ -void error_set(Error **err, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(3, 4); - -/** - * Set an indirect pointer to an error given a ErrorClass value and a - * printf-style human message, followed by a strerror() string if - * @os_error is not zero. - */ -void error_set_errno(Error **err, int os_error, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(4, 5); - -/** - * Same as error_set(), but sets a generic error - */ -#define error_setg(err, fmt, ...) \ - error_set(err, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__) -#define error_setg_errno(err, os_error, fmt, ...) \ - error_set_errno(err, os_error, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__) - -/** - * Returns true if an indirect pointer to an error is pointing to a valid - * error object. - */ -bool error_is_set(Error **err); - -/* - * Get the error class of an error object. - */ -ErrorClass error_get_class(const Error *err); - -/** - * Returns an exact copy of the error passed as an argument. - */ -Error *error_copy(const Error *err); - -/** - * Get a human readable representation of an error object. - */ -const char *error_get_pretty(Error *err); - -/** - * Propagate an error to an indirect pointer to an error. This function will - * always transfer ownership of the error reference and handles the case where - * dst_err is NULL correctly. Errors after the first are discarded. - */ -void error_propagate(Error **dst_err, Error *local_err); - -/** - * Free an error object. - */ -void error_free(Error *err); - -#endif diff --git a/hmp.h b/hmp.h index 0ab03be982..21f3e05d09 100644 --- a/hmp.h +++ b/hmp.h @@ -16,7 +16,7 @@ #include "qemu-common.h" #include "qapi-types.h" -#include "qdict.h" +#include "qapi/qmp/qdict.h" void hmp_info_name(Monitor *mon); void hmp_info_version(Monitor *mon); diff --git a/hw/ivshmem.c b/hw/ivshmem.c index 5c648d98d3..d15760b314 100644 --- a/hw/ivshmem.c +++ b/hw/ivshmem.c @@ -22,7 +22,7 @@ #include "pci/msix.h" #include "kvm.h" #include "migration.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "event_notifier.h" #include "qemu-char.h" diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index c79fca7d68..2a1278f393 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -25,7 +25,7 @@ #include "qemu-timer.h" #include "sysemu.h" #include "mc146818rtc.h" -#include "qapi/qapi-visit-core.h" +#include "qapi/visitor.h" #ifdef TARGET_I386 #include "apic.h" diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c index b850400252..5ba7558ecd 100644 --- a/hw/pci/pci-hotplug.c +++ b/hw/pci/pci-hotplug.c @@ -32,7 +32,7 @@ #include "hw/virtio-blk.h" #include "qemu-config.h" #include "blockdev.h" -#include "error.h" +#include "qapi/error.h" #if defined(TARGET_I386) static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c index 8a2032ca49..b6f4f8510f 100644 --- a/hw/pci/pcie_aer.c +++ b/hw/pci/pcie_aer.c @@ -19,7 +19,7 @@ */ #include "sysemu.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" #include "monitor.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pcie.h" diff --git a/hw/qdev-addr.c b/hw/qdev-addr.c index ea32c31ab6..552ee21f82 100644 --- a/hw/qdev-addr.c +++ b/hw/qdev-addr.c @@ -1,7 +1,7 @@ #include "qdev.h" #include "qdev-addr.h" #include "hwaddr.h" -#include "qapi/qapi-visit-core.h" +#include "qapi/visitor.h" /* --- target physical address --- */ diff --git a/hw/qdev-core.h b/hw/qdev-core.h index d672ccafe6..506977c109 100644 --- a/hw/qdev-core.h +++ b/hw/qdev-core.h @@ -6,7 +6,7 @@ #include "qemu-types.h" #include "qemu/object.h" #include "hw/irq.h" -#include "error.h" +#include "qapi/error.h" enum DevState { DEV_STATE_CREATED = 1, diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 7ab55efe43..ba6c648fed 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -1,10 +1,10 @@ #include "net/net.h" #include "qdev.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "blockdev.h" #include "hw/block-common.h" #include "net/hub.h" -#include "qapi/qapi-visit-core.h" +#include "qapi/visitor.h" #include "qemu-char.h" void *qdev_get_prop_ptr(DeviceState *dev, Property *prop) diff --git a/hw/qdev.c b/hw/qdev.c index 6b91fb987b..0a2a32d5d3 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -28,8 +28,8 @@ #include "net/net.h" #include "qdev.h" #include "sysemu.h" -#include "error.h" -#include "qapi/qapi-visit-core.h" +#include "qapi/error.h" +#include "qapi/visitor.h" int qdev_hotplug = 0; static bool qdev_hot_added = false; diff --git a/hw/vga_int.h b/hw/vga_int.h index ad02404b3c..5efaee81d9 100644 --- a/hw/vga_int.h +++ b/hw/vga_int.h @@ -25,7 +25,7 @@ #define HW_VGA_INT_H 1 #include -#include "error.h" +#include "qapi/error.h" #include "memory.h" #define ST01_V_RETRACE 0x08 diff --git a/hw/watchdog.c b/hw/watchdog.c index 5c82c17d09..f878bec860 100644 --- a/hw/watchdog.c +++ b/hw/watchdog.c @@ -23,7 +23,7 @@ #include "qemu-option.h" #include "qemu-config.h" #include "qemu-queue.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" #include "monitor.h" #include "sysemu.h" #include "hw/watchdog.h" diff --git a/include/net/net.h b/include/net/net.h index 9ff9305d7a..26dd0cf29c 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -3,7 +3,7 @@ #include "qemu-queue.h" #include "qemu-common.h" -#include "qdict.h" +#include "qapi/qmp/qdict.h" #include "qemu-option.h" #include "net/queue.h" #include "vmstate.h" diff --git a/include/net/slirp.h b/include/net/slirp.h index 2ca09b65b7..ac9d44964f 100644 --- a/include/net/slirp.h +++ b/include/net/slirp.h @@ -25,7 +25,7 @@ #define QEMU_NET_SLIRP_H #include "qemu-common.h" -#include "qdict.h" +#include "qapi/qmp/qdict.h" #include "qemu-option.h" #include "qapi-types.h" diff --git a/include/qapi/dealloc-visitor.h b/include/qapi/dealloc-visitor.h new file mode 100644 index 0000000000..cf4c36d2d3 --- /dev/null +++ b/include/qapi/dealloc-visitor.h @@ -0,0 +1,26 @@ +/* + * Dealloc Visitor + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Michael Roth + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QAPI_DEALLOC_VISITOR_H +#define QAPI_DEALLOC_VISITOR_H + +#include "qapi/visitor.h" + +typedef struct QapiDeallocVisitor QapiDeallocVisitor; + +QapiDeallocVisitor *qapi_dealloc_visitor_new(void); +void qapi_dealloc_visitor_cleanup(QapiDeallocVisitor *d); + +Visitor *qapi_dealloc_get_visitor(QapiDeallocVisitor *v); + +#endif diff --git a/include/qapi/error.h b/include/qapi/error.h new file mode 100644 index 0000000000..4d52e7369e --- /dev/null +++ b/include/qapi/error.h @@ -0,0 +1,80 @@ +/* + * QEMU Error Objects + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2. See + * the COPYING.LIB file in the top-level directory. + */ +#ifndef ERROR_H +#define ERROR_H + +#include "compiler.h" +#include "qapi-types.h" +#include + +/** + * A class representing internal errors within QEMU. An error has a ErrorClass + * code and a human message. + */ +typedef struct Error Error; + +/** + * Set an indirect pointer to an error given a ErrorClass value and a + * printf-style human message. This function is not meant to be used outside + * of QEMU. + */ +void error_set(Error **err, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(3, 4); + +/** + * Set an indirect pointer to an error given a ErrorClass value and a + * printf-style human message, followed by a strerror() string if + * @os_error is not zero. + */ +void error_set_errno(Error **err, int os_error, ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(4, 5); + +/** + * Same as error_set(), but sets a generic error + */ +#define error_setg(err, fmt, ...) \ + error_set(err, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__) +#define error_setg_errno(err, os_error, fmt, ...) \ + error_set_errno(err, os_error, ERROR_CLASS_GENERIC_ERROR, fmt, ## __VA_ARGS__) + +/** + * Returns true if an indirect pointer to an error is pointing to a valid + * error object. + */ +bool error_is_set(Error **err); + +/* + * Get the error class of an error object. + */ +ErrorClass error_get_class(const Error *err); + +/** + * Returns an exact copy of the error passed as an argument. + */ +Error *error_copy(const Error *err); + +/** + * Get a human readable representation of an error object. + */ +const char *error_get_pretty(Error *err); + +/** + * Propagate an error to an indirect pointer to an error. This function will + * always transfer ownership of the error reference and handles the case where + * dst_err is NULL correctly. Errors after the first are discarded. + */ +void error_propagate(Error **dst_err, Error *local_err); + +/** + * Free an error object. + */ +void error_free(Error *err); + +#endif diff --git a/include/qapi/opts-visitor.h b/include/qapi/opts-visitor.h new file mode 100644 index 0000000000..31fa4c5628 --- /dev/null +++ b/include/qapi/opts-visitor.h @@ -0,0 +1,31 @@ +/* + * Options Visitor + * + * Copyright Red Hat, Inc. 2012 + * + * Author: Laszlo Ersek + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef OPTS_VISITOR_H +#define OPTS_VISITOR_H + +#include "qapi/visitor.h" +#include "qemu-option.h" + +typedef struct OptsVisitor OptsVisitor; + +/* Contrarily to qemu-option.c::parse_option_number(), OptsVisitor's "int" + * parser relies on strtoll() instead of strtoull(). Consequences: + * - string representations of negative numbers yield negative values, + * - values below INT64_MIN or LLONG_MIN are rejected, + * - values above INT64_MAX or LLONG_MAX are rejected. + */ +OptsVisitor *opts_visitor_new(const QemuOpts *opts); +void opts_visitor_cleanup(OptsVisitor *nv); +Visitor *opts_get_visitor(OptsVisitor *nv); + +#endif diff --git a/include/qapi/qmp-input-visitor.h b/include/qapi/qmp-input-visitor.h new file mode 100644 index 0000000000..3ed499cc42 --- /dev/null +++ b/include/qapi/qmp-input-visitor.h @@ -0,0 +1,29 @@ +/* + * Input Visitor + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QMP_INPUT_VISITOR_H +#define QMP_INPUT_VISITOR_H + +#include "qapi/visitor.h" +#include "qapi/qmp/qobject.h" + +typedef struct QmpInputVisitor QmpInputVisitor; + +QmpInputVisitor *qmp_input_visitor_new(QObject *obj); +QmpInputVisitor *qmp_input_visitor_new_strict(QObject *obj); + +void qmp_input_visitor_cleanup(QmpInputVisitor *v); + +Visitor *qmp_input_get_visitor(QmpInputVisitor *v); + +#endif diff --git a/include/qapi/qmp-output-visitor.h b/include/qapi/qmp-output-visitor.h new file mode 100644 index 0000000000..22667706ab --- /dev/null +++ b/include/qapi/qmp-output-visitor.h @@ -0,0 +1,28 @@ +/* + * Output Visitor + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QMP_OUTPUT_VISITOR_H +#define QMP_OUTPUT_VISITOR_H + +#include "qapi/visitor.h" +#include "qapi/qmp/qobject.h" + +typedef struct QmpOutputVisitor QmpOutputVisitor; + +QmpOutputVisitor *qmp_output_visitor_new(void); +void qmp_output_visitor_cleanup(QmpOutputVisitor *v); + +QObject *qmp_output_get_qobject(QmpOutputVisitor *v); +Visitor *qmp_output_get_visitor(QmpOutputVisitor *v); + +#endif diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h new file mode 100644 index 0000000000..1ce11f5df0 --- /dev/null +++ b/include/qapi/qmp/dispatch.h @@ -0,0 +1,55 @@ +/* + * Core Definitions for QAPI/QMP Dispatch + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QMP_CORE_H +#define QMP_CORE_H + +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qdict.h" +#include "qapi/error.h" + +typedef void (QmpCommandFunc)(QDict *, QObject **, Error **); + +typedef enum QmpCommandType +{ + QCT_NORMAL, +} QmpCommandType; + +typedef enum QmpCommandOptions +{ + QCO_NO_OPTIONS = 0x0, + QCO_NO_SUCCESS_RESP = 0x1, +} QmpCommandOptions; + +typedef struct QmpCommand +{ + const char *name; + QmpCommandType type; + QmpCommandFunc *fn; + QmpCommandOptions options; + QTAILQ_ENTRY(QmpCommand) node; + bool enabled; +} QmpCommand; + +void qmp_register_command(const char *name, QmpCommandFunc *fn, + QmpCommandOptions options); +QmpCommand *qmp_find_command(const char *name); +QObject *qmp_dispatch(QObject *request); +void qmp_disable_command(const char *name); +void qmp_enable_command(const char *name); +bool qmp_command_is_enabled(const char *name); +char **qmp_get_command_list(void); +QObject *qmp_build_error_object(Error *errp); + +#endif + diff --git a/include/qapi/qmp/json-lexer.h b/include/qapi/qmp/json-lexer.h new file mode 100644 index 0000000000..cdff0460a8 --- /dev/null +++ b/include/qapi/qmp/json-lexer.h @@ -0,0 +1,51 @@ +/* + * JSON lexer + * + * Copyright IBM, Corp. 2009 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QEMU_JSON_LEXER_H +#define QEMU_JSON_LEXER_H + +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qlist.h" + +typedef enum json_token_type { + JSON_OPERATOR = 100, + JSON_INTEGER, + JSON_FLOAT, + JSON_KEYWORD, + JSON_STRING, + JSON_ESCAPE, + JSON_SKIP, + JSON_ERROR, +} JSONTokenType; + +typedef struct JSONLexer JSONLexer; + +typedef void (JSONLexerEmitter)(JSONLexer *, QString *, JSONTokenType, int x, int y); + +struct JSONLexer +{ + JSONLexerEmitter *emit; + int state; + QString *token; + int x, y; +}; + +void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func); + +int json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size); + +int json_lexer_flush(JSONLexer *lexer); + +void json_lexer_destroy(JSONLexer *lexer); + +#endif diff --git a/include/qapi/qmp/json-parser.h b/include/qapi/qmp/json-parser.h new file mode 100644 index 0000000000..44d88f3468 --- /dev/null +++ b/include/qapi/qmp/json-parser.h @@ -0,0 +1,24 @@ +/* + * JSON Parser + * + * Copyright IBM, Corp. 2009 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QEMU_JSON_PARSER_H +#define QEMU_JSON_PARSER_H + +#include "qemu-common.h" +#include "qapi/qmp/qlist.h" +#include "qapi/error.h" + +QObject *json_parser_parse(QList *tokens, va_list *ap); +QObject *json_parser_parse_err(QList *tokens, va_list *ap, Error **errp); + +#endif diff --git a/include/qapi/qmp/json-streamer.h b/include/qapi/qmp/json-streamer.h new file mode 100644 index 0000000000..823f7d7fa4 --- /dev/null +++ b/include/qapi/qmp/json-streamer.h @@ -0,0 +1,40 @@ +/* + * JSON streaming support + * + * Copyright IBM, Corp. 2009 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QEMU_JSON_STREAMER_H +#define QEMU_JSON_STREAMER_H + +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/json-lexer.h" + +typedef struct JSONMessageParser +{ + void (*emit)(struct JSONMessageParser *parser, QList *tokens); + JSONLexer lexer; + int brace_count; + int bracket_count; + QList *tokens; + uint64_t token_size; +} JSONMessageParser; + +void json_message_parser_init(JSONMessageParser *parser, + void (*func)(JSONMessageParser *, QList *)); + +int json_message_parser_feed(JSONMessageParser *parser, + const char *buffer, size_t size); + +int json_message_parser_flush(JSONMessageParser *parser); + +void json_message_parser_destroy(JSONMessageParser *parser); + +#endif diff --git a/include/qapi/qmp/qbool.h b/include/qapi/qmp/qbool.h new file mode 100644 index 0000000000..c4eaab9bb9 --- /dev/null +++ b/include/qapi/qmp/qbool.h @@ -0,0 +1,29 @@ +/* + * QBool Module + * + * Copyright IBM, Corp. 2009 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QBOOL_H +#define QBOOL_H + +#include +#include "qapi/qmp/qobject.h" + +typedef struct QBool { + QObject_HEAD; + int value; +} QBool; + +QBool *qbool_from_int(int value); +int qbool_get_int(const QBool *qb); +QBool *qobject_to_qbool(const QObject *obj); + +#endif /* QBOOL_H */ diff --git a/include/qapi/qmp/qdict.h b/include/qapi/qmp/qdict.h new file mode 100644 index 0000000000..c815981d30 --- /dev/null +++ b/include/qapi/qmp/qdict.h @@ -0,0 +1,67 @@ +/* + * QDict Module + * + * Copyright (C) 2009 Red Hat Inc. + * + * Authors: + * Luiz Capitulino + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +#ifndef QDICT_H +#define QDICT_H + +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qlist.h" +#include "qemu-queue.h" +#include + +#define QDICT_BUCKET_MAX 512 + +typedef struct QDictEntry { + char *key; + QObject *value; + QLIST_ENTRY(QDictEntry) next; +} QDictEntry; + +typedef struct QDict { + QObject_HEAD; + size_t size; + QLIST_HEAD(,QDictEntry) table[QDICT_BUCKET_MAX]; +} QDict; + +/* Object API */ +QDict *qdict_new(void); +const char *qdict_entry_key(const QDictEntry *entry); +QObject *qdict_entry_value(const QDictEntry *entry); +size_t qdict_size(const QDict *qdict); +void qdict_put_obj(QDict *qdict, const char *key, QObject *value); +void qdict_del(QDict *qdict, const char *key); +int qdict_haskey(const QDict *qdict, const char *key); +QObject *qdict_get(const QDict *qdict, const char *key); +QDict *qobject_to_qdict(const QObject *obj); +void qdict_iter(const QDict *qdict, + void (*iter)(const char *key, QObject *obj, void *opaque), + void *opaque); +const QDictEntry *qdict_first(const QDict *qdict); +const QDictEntry *qdict_next(const QDict *qdict, const QDictEntry *entry); + +/* Helper to qdict_put_obj(), accepts any object */ +#define qdict_put(qdict, key, obj) \ + qdict_put_obj(qdict, key, QOBJECT(obj)) + +/* High level helpers */ +double qdict_get_double(const QDict *qdict, const char *key); +int64_t qdict_get_int(const QDict *qdict, const char *key); +int qdict_get_bool(const QDict *qdict, const char *key); +QList *qdict_get_qlist(const QDict *qdict, const char *key); +QDict *qdict_get_qdict(const QDict *qdict, const char *key); +const char *qdict_get_str(const QDict *qdict, const char *key); +int64_t qdict_get_try_int(const QDict *qdict, const char *key, + int64_t def_value); +int qdict_get_try_bool(const QDict *qdict, const char *key, int def_value); +const char *qdict_get_try_str(const QDict *qdict, const char *key); + +#endif /* QDICT_H */ diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h new file mode 100644 index 0000000000..d912297590 --- /dev/null +++ b/include/qapi/qmp/qerror.h @@ -0,0 +1,252 @@ +/* + * QError Module + * + * Copyright (C) 2009 Red Hat Inc. + * + * Authors: + * Luiz Capitulino + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ +#ifndef QERROR_H +#define QERROR_H + +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qstring.h" +#include "qemu-error.h" +#include "qapi/error.h" +#include "qapi-types.h" +#include + +typedef struct QError { + QObject_HEAD; + Location loc; + char *err_msg; + ErrorClass err_class; +} QError; + +QString *qerror_human(const QError *qerror); +void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +void qerror_report_err(Error *err); +void assert_no_error(Error *err); + +/* + * QError class list + * Please keep the definitions in alphabetical order. + * Use scripts/check-qerror.sh to check. + */ +#define QERR_ADD_CLIENT_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Could not add client" + +#define QERR_AMBIGUOUS_PATH \ + ERROR_CLASS_GENERIC_ERROR, "Path '%s' does not uniquely identify an object" + +#define QERR_BAD_BUS_FOR_DEVICE \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' can't go on a %s bus" + +#define QERR_BASE_NOT_FOUND \ + ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found" + +#define QERR_BLOCK_JOB_NOT_ACTIVE \ + ERROR_CLASS_DEVICE_NOT_ACTIVE, "No active block job on device '%s'" + +#define QERR_BLOCK_JOB_PAUSED \ + ERROR_CLASS_GENERIC_ERROR, "The block job for device '%s' is currently paused" + +#define QERR_BLOCK_JOB_NOT_READY \ + ERROR_CLASS_GENERIC_ERROR, "The active block job for device '%s' cannot be completed" + +#define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \ + ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by device '%s' does not support feature '%s'" + +#define QERR_BUFFER_OVERRUN \ + ERROR_CLASS_GENERIC_ERROR, "An internal buffer overran" + +#define QERR_BUS_NO_HOTPLUG \ + ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging" + +#define QERR_BUS_NOT_FOUND \ + ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found" + +#define QERR_COMMAND_DISABLED \ + ERROR_CLASS_GENERIC_ERROR, "The command %s has been disabled for this instance" + +#define QERR_COMMAND_NOT_FOUND \ + ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found" + +#define QERR_DEVICE_ENCRYPTED \ + ERROR_CLASS_DEVICE_ENCRYPTED, "'%s' (%s) is encrypted" + +#define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \ + ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when using feature '%s' in device '%s'" + +#define QERR_DEVICE_HAS_NO_MEDIUM \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium" + +#define QERR_DEVICE_INIT_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized" + +#define QERR_DEVICE_IN_USE \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use" + +#define QERR_DEVICE_IS_READ_ONLY \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' is read only" + +#define QERR_DEVICE_LOCKED \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' is locked" + +#define QERR_DEVICE_MULTIPLE_BUSSES \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' has multiple child busses" + +#define QERR_DEVICE_NO_BUS \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no child bus" + +#define QERR_DEVICE_NO_HOTPLUG \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging" + +#define QERR_DEVICE_NOT_ACTIVE \ + ERROR_CLASS_DEVICE_NOT_ACTIVE, "Device '%s' has not been activated" + +#define QERR_DEVICE_NOT_ENCRYPTED \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not encrypted" + +#define QERR_DEVICE_NOT_FOUND \ + ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found" + +#define QERR_DEVICE_NOT_REMOVABLE \ + ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not removable" + +#define QERR_DUPLICATE_ID \ + ERROR_CLASS_GENERIC_ERROR, "Duplicate ID '%s' for %s" + +#define QERR_FD_NOT_FOUND \ + ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found" + +#define QERR_FD_NOT_SUPPLIED \ + ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS" + +#define QERR_FEATURE_DISABLED \ + ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled" + +#define QERR_INVALID_BLOCK_FORMAT \ + ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'" + +#define QERR_INVALID_OPTION_GROUP \ + ERROR_CLASS_GENERIC_ERROR, "There is no option group '%s'" + +#define QERR_INVALID_PARAMETER \ + ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'" + +#define QERR_INVALID_PARAMETER_COMBINATION \ + ERROR_CLASS_GENERIC_ERROR, "Invalid parameter combination" + +#define QERR_INVALID_PARAMETER_TYPE \ + ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s" + +#define QERR_INVALID_PARAMETER_VALUE \ + ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s" + +#define QERR_INVALID_PASSWORD \ + ERROR_CLASS_GENERIC_ERROR, "Password incorrect" + +#define QERR_IO_ERROR \ + ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred" + +#define QERR_JSON_PARSE_ERROR \ + ERROR_CLASS_GENERIC_ERROR, "JSON parse error, %s" + +#define QERR_JSON_PARSING \ + ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax" + +#define QERR_KVM_MISSING_CAP \ + ERROR_CLASS_K_V_M_MISSING_CAP, "Using KVM without %s, %s unavailable" + +#define QERR_MIGRATION_ACTIVE \ + ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress" + +#define QERR_MIGRATION_NOT_SUPPORTED \ + ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'" + +#define QERR_MISSING_PARAMETER \ + ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing" + +#define QERR_NO_BUS_FOR_DEVICE \ + ERROR_CLASS_GENERIC_ERROR, "No '%s' bus found for device '%s'" + +#define QERR_NOT_SUPPORTED \ + ERROR_CLASS_GENERIC_ERROR, "Not supported" + +#define QERR_OPEN_FILE_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Could not open '%s'" + +#define QERR_PERMISSION_DENIED \ + ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation" + +#define QERR_PROPERTY_NOT_FOUND \ + ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' not found" + +#define QERR_PROPERTY_VALUE_BAD \ + ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'" + +#define QERR_PROPERTY_VALUE_IN_USE \ + ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't take value '%s', it's in use" + +#define QERR_PROPERTY_VALUE_NOT_FOUND \ + ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't find value '%s'" + +#define QERR_PROPERTY_VALUE_NOT_POWER_OF_2 \ + ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2" + +#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \ + ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" + +#define QERR_QGA_COMMAND_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'" + +#define QERR_QGA_LOGGING_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Guest agent failed to log non-optional log statement" + +#define QERR_QMP_BAD_INPUT_OBJECT \ + ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input" + +#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \ + ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'" + +#define QERR_QMP_EXTRA_MEMBER \ + ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected" + +#define QERR_RESET_REQUIRED \ + ERROR_CLASS_GENERIC_ERROR, "Resetting the Virtual Machine is required" + +#define QERR_SET_PASSWD_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Could not set password" + +#define QERR_TOO_MANY_FILES \ + ERROR_CLASS_GENERIC_ERROR, "Too many open files" + +#define QERR_UNDEFINED_ERROR \ + ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred" + +#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \ + ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s" + +#define QERR_UNSUPPORTED \ + ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported" + +#define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \ + ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when VirtFS export path '%s' is mounted in the guest using mount_tag '%s'" + +#define QERR_SOCKET_CONNECT_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket" + +#define QERR_SOCKET_LISTEN_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode" + +#define QERR_SOCKET_BIND_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket" + +#define QERR_SOCKET_CREATE_FAILED \ + ERROR_CLASS_GENERIC_ERROR, "Failed to create socket" + +#endif /* QERROR_H */ diff --git a/include/qapi/qmp/qfloat.h b/include/qapi/qmp/qfloat.h new file mode 100644 index 0000000000..a8658443dc --- /dev/null +++ b/include/qapi/qmp/qfloat.h @@ -0,0 +1,29 @@ +/* + * QFloat Module + * + * Copyright IBM, Corp. 2009 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QFLOAT_H +#define QFLOAT_H + +#include +#include "qapi/qmp/qobject.h" + +typedef struct QFloat { + QObject_HEAD; + double value; +} QFloat; + +QFloat *qfloat_from_double(double value); +double qfloat_get_double(const QFloat *qi); +QFloat *qobject_to_qfloat(const QObject *obj); + +#endif /* QFLOAT_H */ diff --git a/include/qapi/qmp/qint.h b/include/qapi/qmp/qint.h new file mode 100644 index 0000000000..48a41b0f2a --- /dev/null +++ b/include/qapi/qmp/qint.h @@ -0,0 +1,28 @@ +/* + * QInt Module + * + * Copyright (C) 2009 Red Hat Inc. + * + * Authors: + * Luiz Capitulino + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +#ifndef QINT_H +#define QINT_H + +#include +#include "qapi/qmp/qobject.h" + +typedef struct QInt { + QObject_HEAD; + int64_t value; +} QInt; + +QInt *qint_from_int(int64_t value); +int64_t qint_get_int(const QInt *qi); +QInt *qobject_to_qint(const QObject *obj); + +#endif /* QINT_H */ diff --git a/include/qapi/qmp/qjson.h b/include/qapi/qmp/qjson.h new file mode 100644 index 0000000000..0473374bf2 --- /dev/null +++ b/include/qapi/qmp/qjson.h @@ -0,0 +1,29 @@ +/* + * QObject JSON integration + * + * Copyright IBM, Corp. 2009 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef QJSON_H +#define QJSON_H + +#include +#include "compiler.h" +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qstring.h" + +QObject *qobject_from_json(const char *string) GCC_FMT_ATTR(1, 0); +QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2); +QObject *qobject_from_jsonv(const char *string, va_list *ap) GCC_FMT_ATTR(1, 0); + +QString *qobject_to_json(const QObject *obj); +QString *qobject_to_json_pretty(const QObject *obj); + +#endif /* QJSON_H */ diff --git a/include/qapi/qmp/qlist.h b/include/qapi/qmp/qlist.h new file mode 100644 index 0000000000..ffa0846d48 --- /dev/null +++ b/include/qapi/qmp/qlist.h @@ -0,0 +1,64 @@ +/* + * QList Module + * + * Copyright (C) 2009 Red Hat Inc. + * + * Authors: + * Luiz Capitulino + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +#ifndef QLIST_H +#define QLIST_H + +#include "qapi/qmp/qobject.h" +#include "qemu-queue.h" +#include "qemu-queue.h" + +typedef struct QListEntry { + QObject *value; + QTAILQ_ENTRY(QListEntry) next; +} QListEntry; + +typedef struct QList { + QObject_HEAD; + QTAILQ_HEAD(,QListEntry) head; +} QList; + +#define qlist_append(qlist, obj) \ + qlist_append_obj(qlist, QOBJECT(obj)) + +#define QLIST_FOREACH_ENTRY(qlist, var) \ + for ((var) = ((qlist)->head.tqh_first); \ + (var); \ + (var) = ((var)->next.tqe_next)) + +static inline QObject *qlist_entry_obj(const QListEntry *entry) +{ + return entry->value; +} + +QList *qlist_new(void); +QList *qlist_copy(QList *src); +void qlist_append_obj(QList *qlist, QObject *obj); +void qlist_iter(const QList *qlist, + void (*iter)(QObject *obj, void *opaque), void *opaque); +QObject *qlist_pop(QList *qlist); +QObject *qlist_peek(QList *qlist); +int qlist_empty(const QList *qlist); +size_t qlist_size(const QList *qlist); +QList *qobject_to_qlist(const QObject *obj); + +static inline const QListEntry *qlist_first(const QList *qlist) +{ + return QTAILQ_FIRST(&qlist->head); +} + +static inline const QListEntry *qlist_next(const QListEntry *entry) +{ + return QTAILQ_NEXT(entry, next); +} + +#endif /* QLIST_H */ diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h new file mode 100644 index 0000000000..9124649ed2 --- /dev/null +++ b/include/qapi/qmp/qobject.h @@ -0,0 +1,112 @@ +/* + * QEMU Object Model. + * + * Based on ideas by Avi Kivity + * + * Copyright (C) 2009 Red Hat Inc. + * + * Authors: + * Luiz Capitulino + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + * QObject Reference Counts Terminology + * ------------------------------------ + * + * - Returning references: A function that returns an object may + * return it as either a weak or a strong reference. If the reference + * is strong, you are responsible for calling QDECREF() on the reference + * when you are done. + * + * If the reference is weak, the owner of the reference may free it at + * any time in the future. Before storing the reference anywhere, you + * should call QINCREF() to make the reference strong. + * + * - Transferring ownership: when you transfer ownership of a reference + * by calling a function, you are no longer responsible for calling + * QDECREF() when the reference is no longer needed. In other words, + * when the function returns you must behave as if the reference to the + * passed object was weak. + */ +#ifndef QOBJECT_H +#define QOBJECT_H + +#include +#include + +typedef enum { + QTYPE_NONE, + QTYPE_QINT, + QTYPE_QSTRING, + QTYPE_QDICT, + QTYPE_QLIST, + QTYPE_QFLOAT, + QTYPE_QBOOL, + QTYPE_QERROR, +} qtype_code; + +struct QObject; + +typedef struct QType { + qtype_code code; + void (*destroy)(struct QObject *); +} QType; + +typedef struct QObject { + const QType *type; + size_t refcnt; +} QObject; + +/* Objects definitions must include this */ +#define QObject_HEAD \ + QObject base + +/* Get the 'base' part of an object */ +#define QOBJECT(obj) (&(obj)->base) + +/* High-level interface for qobject_incref() */ +#define QINCREF(obj) \ + qobject_incref(QOBJECT(obj)) + +/* High-level interface for qobject_decref() */ +#define QDECREF(obj) \ + qobject_decref(obj ? QOBJECT(obj) : NULL) + +/* Initialize an object to default values */ +#define QOBJECT_INIT(obj, qtype_type) \ + obj->base.refcnt = 1; \ + obj->base.type = qtype_type + +/** + * qobject_incref(): Increment QObject's reference count + */ +static inline void qobject_incref(QObject *obj) +{ + if (obj) + obj->refcnt++; +} + +/** + * qobject_decref(): Decrement QObject's reference count, deallocate + * when it reaches zero + */ +static inline void qobject_decref(QObject *obj) +{ + if (obj && --obj->refcnt == 0) { + assert(obj->type != NULL); + assert(obj->type->destroy != NULL); + obj->type->destroy(obj); + } +} + +/** + * qobject_type(): Return the QObject's type + */ +static inline qtype_code qobject_type(const QObject *obj) +{ + assert(obj->type != NULL); + return obj->type->code; +} + +#endif /* QOBJECT_H */ diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h new file mode 100644 index 0000000000..0e690f4849 --- /dev/null +++ b/include/qapi/qmp/qstring.h @@ -0,0 +1,35 @@ +/* + * QString Module + * + * Copyright (C) 2009 Red Hat Inc. + * + * Authors: + * Luiz Capitulino + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +#ifndef QSTRING_H +#define QSTRING_H + +#include +#include "qapi/qmp/qobject.h" + +typedef struct QString { + QObject_HEAD; + char *string; + size_t length; + size_t capacity; +} QString; + +QString *qstring_new(void); +QString *qstring_from_str(const char *str); +QString *qstring_from_substr(const char *str, int start, int end); +const char *qstring_get_str(const QString *qstring); +void qstring_append_int(QString *qstring, int64_t value); +void qstring_append(QString *qstring, const char *str); +void qstring_append_chr(QString *qstring, int c); +QString *qobject_to_qstring(const QObject *obj); + +#endif /* QSTRING_H */ diff --git a/include/qapi/qmp/types.h b/include/qapi/qmp/types.h new file mode 100644 index 0000000000..7782ec5a60 --- /dev/null +++ b/include/qapi/qmp/types.h @@ -0,0 +1,25 @@ +/* + * Include all QEMU objects. + * + * Copyright (C) 2009 Red Hat Inc. + * + * Authors: + * Luiz Capitulino + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + */ + +#ifndef QEMU_OBJECTS_H +#define QEMU_OBJECTS_H + +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qfloat.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/qjson.h" + +#endif /* QEMU_OBJECTS_H */ diff --git a/include/qapi/string-input-visitor.h b/include/qapi/string-input-visitor.h new file mode 100644 index 0000000000..089243c09e --- /dev/null +++ b/include/qapi/string-input-visitor.h @@ -0,0 +1,25 @@ +/* + * String parsing Visitor + * + * Copyright Red Hat, Inc. 2012 + * + * Author: Paolo Bonzini + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef STRING_INPUT_VISITOR_H +#define STRING_INPUT_VISITOR_H + +#include "qapi/visitor.h" + +typedef struct StringInputVisitor StringInputVisitor; + +StringInputVisitor *string_input_visitor_new(const char *str); +void string_input_visitor_cleanup(StringInputVisitor *v); + +Visitor *string_input_get_visitor(StringInputVisitor *v); + +#endif diff --git a/include/qapi/string-output-visitor.h b/include/qapi/string-output-visitor.h new file mode 100644 index 0000000000..ec81e42b60 --- /dev/null +++ b/include/qapi/string-output-visitor.h @@ -0,0 +1,26 @@ +/* + * String printing Visitor + * + * Copyright Red Hat, Inc. 2012 + * + * Author: Paolo Bonzini + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef STRING_OUTPUT_VISITOR_H +#define STRING_OUTPUT_VISITOR_H + +#include "qapi/visitor.h" + +typedef struct StringOutputVisitor StringOutputVisitor; + +StringOutputVisitor *string_output_visitor_new(void); +void string_output_visitor_cleanup(StringOutputVisitor *v); + +char *string_output_get_string(StringOutputVisitor *v); +Visitor *string_output_get_visitor(StringOutputVisitor *v); + +#endif diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h new file mode 100644 index 0000000000..5159964863 --- /dev/null +++ b/include/qapi/visitor-impl.h @@ -0,0 +1,63 @@ +/* + * Core Definitions for QAPI Visitor implementations + * + * Copyright (C) 2012 Red Hat, Inc. + * + * Author: Paolo Bonizni + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ +#ifndef QAPI_VISITOR_IMPL_H +#define QAPI_VISITOR_IMPL_H + +#include "qapi/error.h" +#include "qapi/visitor.h" + +struct Visitor +{ + /* Must be set */ + void (*start_struct)(Visitor *v, void **obj, const char *kind, + const char *name, size_t size, Error **errp); + void (*end_struct)(Visitor *v, Error **errp); + + void (*start_list)(Visitor *v, const char *name, Error **errp); + GenericList *(*next_list)(Visitor *v, GenericList **list, Error **errp); + void (*end_list)(Visitor *v, Error **errp); + + void (*type_enum)(Visitor *v, int *obj, const char *strings[], + const char *kind, const char *name, Error **errp); + + void (*type_int)(Visitor *v, int64_t *obj, const char *name, Error **errp); + void (*type_bool)(Visitor *v, bool *obj, const char *name, Error **errp); + void (*type_str)(Visitor *v, char **obj, const char *name, Error **errp); + void (*type_number)(Visitor *v, double *obj, const char *name, + Error **errp); + + /* May be NULL */ + void (*start_optional)(Visitor *v, bool *present, const char *name, + Error **errp); + void (*end_optional)(Visitor *v, Error **errp); + + void (*start_handle)(Visitor *v, void **obj, const char *kind, + const char *name, Error **errp); + void (*end_handle)(Visitor *v, Error **errp); + void (*type_uint8)(Visitor *v, uint8_t *obj, const char *name, Error **errp); + void (*type_uint16)(Visitor *v, uint16_t *obj, const char *name, Error **errp); + void (*type_uint32)(Visitor *v, uint32_t *obj, const char *name, Error **errp); + void (*type_uint64)(Visitor *v, uint64_t *obj, const char *name, Error **errp); + void (*type_int8)(Visitor *v, int8_t *obj, const char *name, Error **errp); + void (*type_int16)(Visitor *v, int16_t *obj, const char *name, Error **errp); + void (*type_int32)(Visitor *v, int32_t *obj, const char *name, Error **errp); + void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp); + /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */ + void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp); +}; + +void input_type_enum(Visitor *v, int *obj, const char *strings[], + const char *kind, const char *name, Error **errp); +void output_type_enum(Visitor *v, int *obj, const char *strings[], + const char *kind, const char *name, Error **errp); + +#endif diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h new file mode 100644 index 0000000000..1fef18c08f --- /dev/null +++ b/include/qapi/visitor.h @@ -0,0 +1,55 @@ +/* + * Core Definitions for QAPI Visitor Classes + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. + * See the COPYING.LIB file in the top-level directory. + * + */ +#ifndef QAPI_VISITOR_CORE_H +#define QAPI_VISITOR_CORE_H + +#include "qapi/error.h" +#include + +typedef struct GenericList +{ + void *value; + struct GenericList *next; +} GenericList; + +typedef struct Visitor Visitor; + +void visit_start_handle(Visitor *v, void **obj, const char *kind, + const char *name, Error **errp); +void visit_end_handle(Visitor *v, Error **errp); +void visit_start_struct(Visitor *v, void **obj, const char *kind, + const char *name, size_t size, Error **errp); +void visit_end_struct(Visitor *v, Error **errp); +void visit_start_list(Visitor *v, const char *name, Error **errp); +GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp); +void visit_end_list(Visitor *v, Error **errp); +void visit_start_optional(Visitor *v, bool *present, const char *name, + Error **errp); +void visit_end_optional(Visitor *v, Error **errp); +void visit_type_enum(Visitor *v, int *obj, const char *strings[], + const char *kind, const char *name, Error **errp); +void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp); +void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp); +void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp); +void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp); +void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp); +void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp); +void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp); +void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp); +void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp); +void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp); +void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp); +void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp); +void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp); + +#endif diff --git a/include/qemu/rng.h b/include/qemu/rng.h index d094bf8d4c..37912971e0 100644 --- a/include/qemu/rng.h +++ b/include/qemu/rng.h @@ -15,7 +15,7 @@ #include "qemu/object.h" #include "qemu-common.h" -#include "error.h" +#include "qapi/error.h" #define TYPE_RNG_BACKEND "rng-backend" #define RNG_BACKEND(obj) \ diff --git a/include/ui/console.h b/include/ui/console.h index 777881d4a3..eff5cc92d6 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -2,12 +2,12 @@ #define CONSOLE_H #include "ui/qemu-pixman.h" -#include "qdict.h" +#include "qapi/qmp/qdict.h" #include "notify.h" #include "monitor.h" #include "trace.h" #include "qapi-types.h" -#include "error.h" +#include "qapi/error.h" /* keyboard/mouse support */ diff --git a/json-lexer.c b/json-lexer.c index 3cd3285825..440df60392 100644 --- a/json-lexer.c +++ b/json-lexer.c @@ -11,12 +11,12 @@ * */ -#include "qstring.h" -#include "qlist.h" -#include "qdict.h" -#include "qint.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qint.h" #include "qemu-common.h" -#include "json-lexer.h" +#include "qapi/qmp/json-lexer.h" #define MAX_TOKEN_SIZE (64ULL << 20) diff --git a/json-lexer.h b/json-lexer.h deleted file mode 100644 index 10bc0a7798..0000000000 --- a/json-lexer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * JSON lexer - * - * Copyright IBM, Corp. 2009 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QEMU_JSON_LEXER_H -#define QEMU_JSON_LEXER_H - -#include "qstring.h" -#include "qlist.h" - -typedef enum json_token_type { - JSON_OPERATOR = 100, - JSON_INTEGER, - JSON_FLOAT, - JSON_KEYWORD, - JSON_STRING, - JSON_ESCAPE, - JSON_SKIP, - JSON_ERROR, -} JSONTokenType; - -typedef struct JSONLexer JSONLexer; - -typedef void (JSONLexerEmitter)(JSONLexer *, QString *, JSONTokenType, int x, int y); - -struct JSONLexer -{ - JSONLexerEmitter *emit; - int state; - QString *token; - int x, y; -}; - -void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func); - -int json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size); - -int json_lexer_flush(JSONLexer *lexer); - -void json_lexer_destroy(JSONLexer *lexer); - -#endif diff --git a/json-parser.c b/json-parser.c index 457291b161..05279c11eb 100644 --- a/json-parser.c +++ b/json-parser.c @@ -14,15 +14,15 @@ #include #include "qemu-common.h" -#include "qstring.h" -#include "qint.h" -#include "qdict.h" -#include "qlist.h" -#include "qfloat.h" -#include "qbool.h" -#include "json-parser.h" -#include "json-lexer.h" -#include "qerror.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/qfloat.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/json-parser.h" +#include "qapi/qmp/json-lexer.h" +#include "qapi/qmp/qerror.h" typedef struct JSONParserContext { diff --git a/json-parser.h b/json-parser.h deleted file mode 100644 index 8f2b5ec4bc..0000000000 --- a/json-parser.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * JSON Parser - * - * Copyright IBM, Corp. 2009 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QEMU_JSON_PARSER_H -#define QEMU_JSON_PARSER_H - -#include "qemu-common.h" -#include "qlist.h" -#include "error.h" - -QObject *json_parser_parse(QList *tokens, va_list *ap); -QObject *json_parser_parse_err(QList *tokens, va_list *ap, Error **errp); - -#endif diff --git a/json-streamer.c b/json-streamer.c index c255c7818f..1b2f9b1d10 100644 --- a/json-streamer.c +++ b/json-streamer.c @@ -11,12 +11,12 @@ * */ -#include "qlist.h" -#include "qint.h" -#include "qdict.h" +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qdict.h" #include "qemu-common.h" -#include "json-lexer.h" -#include "json-streamer.h" +#include "qapi/qmp/json-lexer.h" +#include "qapi/qmp/json-streamer.h" #define MAX_TOKEN_SIZE (64ULL << 20) #define MAX_NESTING (1ULL << 10) diff --git a/json-streamer.h b/json-streamer.h deleted file mode 100644 index f09bc4daec..0000000000 --- a/json-streamer.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * JSON streaming support - * - * Copyright IBM, Corp. 2009 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QEMU_JSON_STREAMER_H -#define QEMU_JSON_STREAMER_H - -#include "qlist.h" -#include "json-lexer.h" - -typedef struct JSONMessageParser -{ - void (*emit)(struct JSONMessageParser *parser, QList *tokens); - JSONLexer lexer; - int brace_count; - int bracket_count; - QList *tokens; - uint64_t token_size; -} JSONMessageParser; - -void json_message_parser_init(JSONMessageParser *parser, - void (*func)(JSONMessageParser *, QList *)); - -int json_message_parser_feed(JSONMessageParser *parser, - const char *buffer, size_t size); - -int json_message_parser_flush(JSONMessageParser *parser); - -void json_message_parser_destroy(JSONMessageParser *parser); - -#endif diff --git a/migration.h b/migration.h index c3a23cc6c8..af444d444b 100644 --- a/migration.h +++ b/migration.h @@ -14,10 +14,10 @@ #ifndef QEMU_MIGRATION_H #define QEMU_MIGRATION_H -#include "qdict.h" +#include "qapi/qmp/qdict.h" #include "qemu-common.h" #include "notify.h" -#include "error.h" +#include "qapi/error.h" #include "vmstate.h" #include "qapi-types.h" diff --git a/monitor.c b/monitor.c index 6546f8c30b..7d5c8a622c 100644 --- a/monitor.c +++ b/monitor.c @@ -47,14 +47,14 @@ #include "migration.h" #include "kvm.h" #include "acl.h" -#include "qint.h" -#include "qfloat.h" -#include "qlist.h" -#include "qbool.h" -#include "qstring.h" -#include "qjson.h" -#include "json-streamer.h" -#include "json-parser.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qfloat.h" +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qjson.h" +#include "qapi/qmp/json-streamer.h" +#include "qapi/qmp/json-parser.h" #include "osdep.h" #include "cpu.h" #include "trace.h" diff --git a/monitor.h b/monitor.h index 4595c217ed..7c29d9db34 100644 --- a/monitor.h +++ b/monitor.h @@ -2,8 +2,8 @@ #define MONITOR_H #include "qemu-common.h" -#include "qerror.h" -#include "qdict.h" +#include "qapi/qmp/qerror.h" +#include "qapi/qmp/qdict.h" #include "block.h" #include "readline.h" diff --git a/net/net.c b/net/net.c index a4395be140..ead7e96fe1 100644 --- a/net/net.c +++ b/net/net.c @@ -38,7 +38,7 @@ #include "iov.h" #include "qapi-visit.h" #include "qapi/opts-visitor.h" -#include "qapi/qapi-dealloc-visitor.h" +#include "qapi/dealloc-visitor.h" /* Net bridge is currently not supported for W32. */ #if !defined(_WIN32) diff --git a/pixman b/pixman index a5e5179b56..97336fad32 160000 --- a/pixman +++ b/pixman @@ -1 +1 @@ -Subproject commit a5e5179b5624c99c812e9bf6e7b907e355a811e8 +Subproject commit 97336fad32acf802003855cd8bd6477fa49a12e3 diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c index 6ccb8a1c33..f8149ce455 100644 --- a/qapi/opts-visitor.c +++ b/qapi/opts-visitor.c @@ -11,11 +11,11 @@ */ #include "qemu-common.h" -#include "qerror.h" -#include "opts-visitor.h" +#include "qapi/qmp/qerror.h" +#include "qapi/opts-visitor.h" #include "qemu-queue.h" #include "qemu-option-internal.h" -#include "qapi-visit-impl.h" +#include "qapi/visitor-impl.h" struct OptsVisitor diff --git a/qapi/opts-visitor.h b/qapi/opts-visitor.h deleted file mode 100644 index ea1a395573..0000000000 --- a/qapi/opts-visitor.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Options Visitor - * - * Copyright Red Hat, Inc. 2012 - * - * Author: Laszlo Ersek - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef OPTS_VISITOR_H -#define OPTS_VISITOR_H - -#include "qapi-visit-core.h" -#include "qemu-option.h" - -typedef struct OptsVisitor OptsVisitor; - -/* Contrarily to qemu-option.c::parse_option_number(), OptsVisitor's "int" - * parser relies on strtoll() instead of strtoull(). Consequences: - * - string representations of negative numbers yield negative values, - * - values below INT64_MIN or LLONG_MIN are rejected, - * - values above INT64_MAX or LLONG_MAX are rejected. - */ -OptsVisitor *opts_visitor_new(const QemuOpts *opts); -void opts_visitor_cleanup(OptsVisitor *nv); -Visitor *opts_get_visitor(OptsVisitor *nv); - -#endif diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c index 7c44042619..98f2a58efd 100644 --- a/qapi/qapi-dealloc-visitor.c +++ b/qapi/qapi-dealloc-visitor.c @@ -11,11 +11,11 @@ * */ -#include "qapi-dealloc-visitor.h" +#include "qapi/dealloc-visitor.h" #include "qemu-queue.h" #include "qemu-common.h" -#include "qemu-objects.h" -#include "qapi-visit-impl.h" +#include "qapi/qmp/types.h" +#include "qapi/visitor-impl.h" typedef struct StackEntry { diff --git a/qapi/qapi-dealloc-visitor.h b/qapi/qapi-dealloc-visitor.h deleted file mode 100644 index 5842bc79bd..0000000000 --- a/qapi/qapi-dealloc-visitor.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Dealloc Visitor - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Michael Roth - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QAPI_DEALLOC_VISITOR_H -#define QAPI_DEALLOC_VISITOR_H - -#include "qapi-visit-core.h" - -typedef struct QapiDeallocVisitor QapiDeallocVisitor; - -QapiDeallocVisitor *qapi_dealloc_visitor_new(void); -void qapi_dealloc_visitor_cleanup(QapiDeallocVisitor *d); - -Visitor *qapi_dealloc_get_visitor(QapiDeallocVisitor *v); - -#endif diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index 4649fb71b7..401ee6e597 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -12,9 +12,9 @@ */ #include "qemu-common.h" -#include "qerror.h" -#include "qapi/qapi-visit-core.h" -#include "qapi/qapi-visit-impl.h" +#include "qapi/qmp/qerror.h" +#include "qapi/visitor.h" +#include "qapi/visitor-impl.h" void visit_start_handle(Visitor *v, void **obj, const char *kind, const char *name, Error **errp) diff --git a/qapi/qapi-visit-core.h b/qapi/qapi-visit-core.h deleted file mode 100644 index 602debe753..0000000000 --- a/qapi/qapi-visit-core.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Core Definitions for QAPI Visitor Classes - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ -#ifndef QAPI_VISITOR_CORE_H -#define QAPI_VISITOR_CORE_H - -#include "error.h" -#include - -typedef struct GenericList -{ - void *value; - struct GenericList *next; -} GenericList; - -typedef struct Visitor Visitor; - -void visit_start_handle(Visitor *v, void **obj, const char *kind, - const char *name, Error **errp); -void visit_end_handle(Visitor *v, Error **errp); -void visit_start_struct(Visitor *v, void **obj, const char *kind, - const char *name, size_t size, Error **errp); -void visit_end_struct(Visitor *v, Error **errp); -void visit_start_list(Visitor *v, const char *name, Error **errp); -GenericList *visit_next_list(Visitor *v, GenericList **list, Error **errp); -void visit_end_list(Visitor *v, Error **errp); -void visit_start_optional(Visitor *v, bool *present, const char *name, - Error **errp); -void visit_end_optional(Visitor *v, Error **errp); -void visit_type_enum(Visitor *v, int *obj, const char *strings[], - const char *kind, const char *name, Error **errp); -void visit_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp); -void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp); -void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp); -void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp); -void visit_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp); -void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp); -void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp); -void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp); -void visit_type_int64(Visitor *v, int64_t *obj, const char *name, Error **errp); -void visit_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp); -void visit_type_bool(Visitor *v, bool *obj, const char *name, Error **errp); -void visit_type_str(Visitor *v, char **obj, const char *name, Error **errp); -void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp); - -#endif diff --git a/qapi/qapi-visit-impl.h b/qapi/qapi-visit-impl.h deleted file mode 100644 index 9337d62e75..0000000000 --- a/qapi/qapi-visit-impl.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Core Definitions for QAPI Visitor implementations - * - * Copyright (C) 2012 Red Hat, Inc. - * - * Author: Paolo Bonizni - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ -#ifndef QAPI_VISITOR_IMPL_H -#define QAPI_VISITOR_IMPL_H - -#include "error.h" -#include "qapi/qapi-visit-core.h" - -struct Visitor -{ - /* Must be set */ - void (*start_struct)(Visitor *v, void **obj, const char *kind, - const char *name, size_t size, Error **errp); - void (*end_struct)(Visitor *v, Error **errp); - - void (*start_list)(Visitor *v, const char *name, Error **errp); - GenericList *(*next_list)(Visitor *v, GenericList **list, Error **errp); - void (*end_list)(Visitor *v, Error **errp); - - void (*type_enum)(Visitor *v, int *obj, const char *strings[], - const char *kind, const char *name, Error **errp); - - void (*type_int)(Visitor *v, int64_t *obj, const char *name, Error **errp); - void (*type_bool)(Visitor *v, bool *obj, const char *name, Error **errp); - void (*type_str)(Visitor *v, char **obj, const char *name, Error **errp); - void (*type_number)(Visitor *v, double *obj, const char *name, - Error **errp); - - /* May be NULL */ - void (*start_optional)(Visitor *v, bool *present, const char *name, - Error **errp); - void (*end_optional)(Visitor *v, Error **errp); - - void (*start_handle)(Visitor *v, void **obj, const char *kind, - const char *name, Error **errp); - void (*end_handle)(Visitor *v, Error **errp); - void (*type_uint8)(Visitor *v, uint8_t *obj, const char *name, Error **errp); - void (*type_uint16)(Visitor *v, uint16_t *obj, const char *name, Error **errp); - void (*type_uint32)(Visitor *v, uint32_t *obj, const char *name, Error **errp); - void (*type_uint64)(Visitor *v, uint64_t *obj, const char *name, Error **errp); - void (*type_int8)(Visitor *v, int8_t *obj, const char *name, Error **errp); - void (*type_int16)(Visitor *v, int16_t *obj, const char *name, Error **errp); - void (*type_int32)(Visitor *v, int32_t *obj, const char *name, Error **errp); - void (*type_int64)(Visitor *v, int64_t *obj, const char *name, Error **errp); - /* visit_type_size() falls back to (*type_uint64)() if type_size is unset */ - void (*type_size)(Visitor *v, uint64_t *obj, const char *name, Error **errp); -}; - -void input_type_enum(Visitor *v, int *obj, const char *strings[], - const char *kind, const char *name, Error **errp); -void output_type_enum(Visitor *v, int *obj, const char *strings[], - const char *kind, const char *name, Error **errp); - -#endif diff --git a/qapi/qmp-core.h b/qapi/qmp-core.h deleted file mode 100644 index 00446cff9b..0000000000 --- a/qapi/qmp-core.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Core Definitions for QAPI/QMP Dispatch - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QMP_CORE_H -#define QMP_CORE_H - -#include "qobject.h" -#include "qdict.h" -#include "error.h" - -typedef void (QmpCommandFunc)(QDict *, QObject **, Error **); - -typedef enum QmpCommandType -{ - QCT_NORMAL, -} QmpCommandType; - -typedef enum QmpCommandOptions -{ - QCO_NO_OPTIONS = 0x0, - QCO_NO_SUCCESS_RESP = 0x1, -} QmpCommandOptions; - -typedef struct QmpCommand -{ - const char *name; - QmpCommandType type; - QmpCommandFunc *fn; - QmpCommandOptions options; - QTAILQ_ENTRY(QmpCommand) node; - bool enabled; -} QmpCommand; - -void qmp_register_command(const char *name, QmpCommandFunc *fn, - QmpCommandOptions options); -QmpCommand *qmp_find_command(const char *name); -QObject *qmp_dispatch(QObject *request); -void qmp_disable_command(const char *name); -void qmp_enable_command(const char *name); -bool qmp_command_is_enabled(const char *name); -char **qmp_get_command_list(void); -QObject *qmp_build_error_object(Error *errp); - -#endif - diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 4085994686..921de33bce 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -11,12 +11,12 @@ * */ -#include "qemu-objects.h" -#include "qapi/qmp-core.h" -#include "json-parser.h" +#include "qapi/qmp/types.h" +#include "qapi/qmp/dispatch.h" +#include "qapi/qmp/json-parser.h" #include "qapi-types.h" -#include "error.h" -#include "qerror.h" +#include "qapi/error.h" +#include "qapi/qmp/qerror.h" static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp) { diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c index 107d8d361b..8087909036 100644 --- a/qapi/qmp-input-visitor.c +++ b/qapi/qmp-input-visitor.c @@ -11,12 +11,12 @@ * */ -#include "qmp-input-visitor.h" -#include "qapi/qapi-visit-impl.h" +#include "qapi/qmp-input-visitor.h" +#include "qapi/visitor-impl.h" #include "qemu-queue.h" #include "qemu-common.h" -#include "qemu-objects.h" -#include "qerror.h" +#include "qapi/qmp/types.h" +#include "qapi/qmp/qerror.h" #define QIV_STACK_SIZE 1024 diff --git a/qapi/qmp-input-visitor.h b/qapi/qmp-input-visitor.h deleted file mode 100644 index e0a48a5f3b..0000000000 --- a/qapi/qmp-input-visitor.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Input Visitor - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QMP_INPUT_VISITOR_H -#define QMP_INPUT_VISITOR_H - -#include "qapi-visit-core.h" -#include "qobject.h" - -typedef struct QmpInputVisitor QmpInputVisitor; - -QmpInputVisitor *qmp_input_visitor_new(QObject *obj); -QmpInputVisitor *qmp_input_visitor_new_strict(QObject *obj); - -void qmp_input_visitor_cleanup(QmpInputVisitor *v); - -Visitor *qmp_input_get_visitor(QmpInputVisitor *v); - -#endif diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c index 2bce9d5db1..8015e3f88d 100644 --- a/qapi/qmp-output-visitor.c +++ b/qapi/qmp-output-visitor.c @@ -11,12 +11,12 @@ * */ -#include "qmp-output-visitor.h" -#include "qapi/qapi-visit-impl.h" +#include "qapi/qmp-output-visitor.h" +#include "qapi/visitor-impl.h" #include "qemu-queue.h" #include "qemu-common.h" -#include "qemu-objects.h" -#include "qerror.h" +#include "qapi/qmp/types.h" +#include "qapi/qmp/qerror.h" typedef struct QStackEntry { diff --git a/qapi/qmp-output-visitor.h b/qapi/qmp-output-visitor.h deleted file mode 100644 index 4a649c2504..0000000000 --- a/qapi/qmp-output-visitor.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Output Visitor - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QMP_OUTPUT_VISITOR_H -#define QMP_OUTPUT_VISITOR_H - -#include "qapi-visit-core.h" -#include "qobject.h" - -typedef struct QmpOutputVisitor QmpOutputVisitor; - -QmpOutputVisitor *qmp_output_visitor_new(void); -void qmp_output_visitor_cleanup(QmpOutputVisitor *v); - -QObject *qmp_output_get_qobject(QmpOutputVisitor *v); -Visitor *qmp_output_get_visitor(QmpOutputVisitor *v); - -#endif diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index c2c31b420d..70cdbca470 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -14,7 +14,7 @@ #include #include -#include "qapi/qmp-core.h" +#include "qapi/qmp/dispatch.h" static QTAILQ_HEAD(QmpCommandList, QmpCommand) qmp_commands = QTAILQ_HEAD_INITIALIZER(qmp_commands); diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index 497eb9a60a..8f1bc41333 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -11,9 +11,9 @@ */ #include "qemu-common.h" -#include "string-input-visitor.h" -#include "qapi/qapi-visit-impl.h" -#include "qerror.h" +#include "qapi/string-input-visitor.h" +#include "qapi/visitor-impl.h" +#include "qapi/qmp/qerror.h" struct StringInputVisitor { diff --git a/qapi/string-input-visitor.h b/qapi/string-input-visitor.h deleted file mode 100644 index d269d42cef..0000000000 --- a/qapi/string-input-visitor.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * String parsing Visitor - * - * Copyright Red Hat, Inc. 2012 - * - * Author: Paolo Bonzini - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef STRING_INPUT_VISITOR_H -#define STRING_INPUT_VISITOR_H - -#include "qapi-visit-core.h" - -typedef struct StringInputVisitor StringInputVisitor; - -StringInputVisitor *string_input_visitor_new(const char *str); -void string_input_visitor_cleanup(StringInputVisitor *v); - -Visitor *string_input_get_visitor(StringInputVisitor *v); - -#endif diff --git a/qapi/string-output-visitor.c b/qapi/string-output-visitor.c index 34e525eadd..921653d425 100644 --- a/qapi/string-output-visitor.c +++ b/qapi/string-output-visitor.c @@ -11,9 +11,9 @@ */ #include "qemu-common.h" -#include "string-output-visitor.h" -#include "qapi/qapi-visit-impl.h" -#include "qerror.h" +#include "qapi/string-output-visitor.h" +#include "qapi/visitor-impl.h" +#include "qapi/qmp/qerror.h" struct StringOutputVisitor { diff --git a/qapi/string-output-visitor.h b/qapi/string-output-visitor.h deleted file mode 100644 index 8868454110..0000000000 --- a/qapi/string-output-visitor.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * String printing Visitor - * - * Copyright Red Hat, Inc. 2012 - * - * Author: Paolo Bonzini - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef STRING_OUTPUT_VISITOR_H -#define STRING_OUTPUT_VISITOR_H - -#include "qapi-visit-core.h" - -typedef struct StringOutputVisitor StringOutputVisitor; - -StringOutputVisitor *string_output_visitor_new(void); -void string_output_visitor_cleanup(StringOutputVisitor *v); - -char *string_output_get_string(StringOutputVisitor *v); -Visitor *string_output_get_visitor(StringOutputVisitor *v); - -#endif diff --git a/qbool.c b/qbool.c index 590cd716ea..a3d2afa827 100644 --- a/qbool.c +++ b/qbool.c @@ -11,8 +11,8 @@ * */ -#include "qbool.h" -#include "qobject.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qobject.h" #include "qemu-common.h" static void qbool_destroy_obj(QObject *obj); diff --git a/qbool.h b/qbool.h deleted file mode 100644 index fe66fcd455..0000000000 --- a/qbool.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * QBool Module - * - * Copyright IBM, Corp. 2009 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QBOOL_H -#define QBOOL_H - -#include -#include "qobject.h" - -typedef struct QBool { - QObject_HEAD; - int value; -} QBool; - -QBool *qbool_from_int(int value); -int qbool_get_int(const QBool *qb); -QBool *qobject_to_qbool(const QObject *obj); - -#endif /* QBOOL_H */ diff --git a/qdict.c b/qdict.c index 4bf308b61c..fa7a62cff4 100644 --- a/qdict.c +++ b/qdict.c @@ -10,12 +10,12 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qint.h" -#include "qfloat.h" -#include "qdict.h" -#include "qbool.h" -#include "qstring.h" -#include "qobject.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qfloat.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qobject.h" #include "qemu-queue.h" #include "qemu-common.h" diff --git a/qdict.h b/qdict.h deleted file mode 100644 index 929d8d22f5..0000000000 --- a/qdict.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * QDict Module - * - * Copyright (C) 2009 Red Hat Inc. - * - * Authors: - * Luiz Capitulino - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - */ - -#ifndef QDICT_H -#define QDICT_H - -#include "qobject.h" -#include "qlist.h" -#include "qemu-queue.h" -#include - -#define QDICT_BUCKET_MAX 512 - -typedef struct QDictEntry { - char *key; - QObject *value; - QLIST_ENTRY(QDictEntry) next; -} QDictEntry; - -typedef struct QDict { - QObject_HEAD; - size_t size; - QLIST_HEAD(,QDictEntry) table[QDICT_BUCKET_MAX]; -} QDict; - -/* Object API */ -QDict *qdict_new(void); -const char *qdict_entry_key(const QDictEntry *entry); -QObject *qdict_entry_value(const QDictEntry *entry); -size_t qdict_size(const QDict *qdict); -void qdict_put_obj(QDict *qdict, const char *key, QObject *value); -void qdict_del(QDict *qdict, const char *key); -int qdict_haskey(const QDict *qdict, const char *key); -QObject *qdict_get(const QDict *qdict, const char *key); -QDict *qobject_to_qdict(const QObject *obj); -void qdict_iter(const QDict *qdict, - void (*iter)(const char *key, QObject *obj, void *opaque), - void *opaque); -const QDictEntry *qdict_first(const QDict *qdict); -const QDictEntry *qdict_next(const QDict *qdict, const QDictEntry *entry); - -/* Helper to qdict_put_obj(), accepts any object */ -#define qdict_put(qdict, key, obj) \ - qdict_put_obj(qdict, key, QOBJECT(obj)) - -/* High level helpers */ -double qdict_get_double(const QDict *qdict, const char *key); -int64_t qdict_get_int(const QDict *qdict, const char *key); -int qdict_get_bool(const QDict *qdict, const char *key); -QList *qdict_get_qlist(const QDict *qdict, const char *key); -QDict *qdict_get_qdict(const QDict *qdict, const char *key); -const char *qdict_get_str(const QDict *qdict, const char *key); -int64_t qdict_get_try_int(const QDict *qdict, const char *key, - int64_t def_value); -int qdict_get_try_bool(const QDict *qdict, const char *key, int def_value); -const char *qdict_get_try_str(const QDict *qdict, const char *key); - -#endif /* QDICT_H */ diff --git a/qemu-char.h b/qemu-char.h index a121e04cdc..3e230a1319 100644 --- a/qemu-char.h +++ b/qemu-char.h @@ -6,8 +6,8 @@ #include "qemu-option.h" #include "qemu-config.h" #include "qemu-aio.h" -#include "qobject.h" -#include "qstring.h" +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qstring.h" #include "main-loop.h" /* character device */ diff --git a/qemu-config.c b/qemu-config.c index b4ce0d8034..ceec6bd155 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -3,7 +3,7 @@ #include "qemu-option.h" #include "qemu-config.h" #include "hw/qdev.h" -#include "error.h" +#include "qapi/error.h" static QemuOptsList qemu_drive_opts = { .name = "drive", diff --git a/qemu-config.h b/qemu-config.h index eb50eca838..584491a29b 100644 --- a/qemu-config.h +++ b/qemu-config.h @@ -3,7 +3,7 @@ #include #include "qemu-option.h" -#include "error.h" +#include "qapi/error.h" #include "qemu-option.h" extern QemuOptsList qemu_fsdev_opts; diff --git a/qemu-img.c b/qemu-img.c index c989a52564..a13bc788cf 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -23,7 +23,7 @@ */ #include "qapi-visit.h" #include "qapi/qmp-output-visitor.h" -#include "qjson.h" +#include "qapi/qmp/qjson.h" #include "qemu-common.h" #include "qemu-option.h" #include "qemu-error.h" diff --git a/qemu-objects.h b/qemu-objects.h deleted file mode 100644 index c53fbaa217..0000000000 --- a/qemu-objects.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Include all QEMU objects. - * - * Copyright (C) 2009 Red Hat Inc. - * - * Authors: - * Luiz Capitulino - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - */ - -#ifndef QEMU_OBJECTS_H -#define QEMU_OBJECTS_H - -#include "qobject.h" -#include "qint.h" -#include "qfloat.h" -#include "qbool.h" -#include "qstring.h" -#include "qdict.h" -#include "qlist.h" -#include "qjson.h" - -#endif /* QEMU_OBJECTS_H */ diff --git a/qemu-option.c b/qemu-option.c index 94557cfde7..ebd3537063 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -28,9 +28,9 @@ #include "qemu-common.h" #include "qemu-error.h" -#include "qemu-objects.h" -#include "error.h" -#include "qerror.h" +#include "qapi/qmp/types.h" +#include "qapi/error.h" +#include "qapi/qmp/qerror.h" #include "qemu-option-internal.h" /* diff --git a/qemu-option.h b/qemu-option.h index 002dd07ee5..ca0dc041dd 100644 --- a/qemu-option.h +++ b/qemu-option.h @@ -28,8 +28,8 @@ #include #include "qemu-queue.h" -#include "error.h" -#include "qdict.h" +#include "qapi/error.h" +#include "qapi/qmp/qdict.h" enum QEMUOptionParType { OPT_FLAG, diff --git a/qemu_socket.h b/qemu_socket.h index 02490ad06c..42899fe138 100644 --- a/qemu_socket.h +++ b/qemu_socket.h @@ -27,8 +27,8 @@ int inet_aton(const char *cp, struct in_addr *ia); #endif /* !_WIN32 */ #include "qemu-option.h" -#include "error.h" -#include "qerror.h" +#include "qapi/error.h" +#include "qapi/qmp/qerror.h" /* misc helpers */ int qemu_socket(int domain, int type, int protocol); diff --git a/qerror.c b/qerror.c index 08185047b4..8c78104277 100644 --- a/qerror.c +++ b/qerror.c @@ -11,8 +11,8 @@ */ #include "monitor.h" -#include "qjson.h" -#include "qerror.h" +#include "qapi/qmp/qjson.h" +#include "qapi/qmp/qerror.h" #include "qemu-common.h" static void qerror_destroy_obj(QObject *obj); diff --git a/qerror.h b/qerror.h deleted file mode 100644 index 8db4309aef..0000000000 --- a/qerror.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - * QError Module - * - * Copyright (C) 2009 Red Hat Inc. - * - * Authors: - * Luiz Capitulino - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - */ -#ifndef QERROR_H -#define QERROR_H - -#include "qdict.h" -#include "qstring.h" -#include "qemu-error.h" -#include "error.h" -#include "qapi-types.h" -#include - -typedef struct QError { - QObject_HEAD; - Location loc; - char *err_msg; - ErrorClass err_class; -} QError; - -QString *qerror_human(const QError *qerror); -void qerror_report(ErrorClass err_class, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -void qerror_report_err(Error *err); -void assert_no_error(Error *err); - -/* - * QError class list - * Please keep the definitions in alphabetical order. - * Use scripts/check-qerror.sh to check. - */ -#define QERR_ADD_CLIENT_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Could not add client" - -#define QERR_AMBIGUOUS_PATH \ - ERROR_CLASS_GENERIC_ERROR, "Path '%s' does not uniquely identify an object" - -#define QERR_BAD_BUS_FOR_DEVICE \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' can't go on a %s bus" - -#define QERR_BASE_NOT_FOUND \ - ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found" - -#define QERR_BLOCK_JOB_NOT_ACTIVE \ - ERROR_CLASS_DEVICE_NOT_ACTIVE, "No active block job on device '%s'" - -#define QERR_BLOCK_JOB_PAUSED \ - ERROR_CLASS_GENERIC_ERROR, "The block job for device '%s' is currently paused" - -#define QERR_BLOCK_JOB_NOT_READY \ - ERROR_CLASS_GENERIC_ERROR, "The active block job for device '%s' cannot be completed" - -#define QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED \ - ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by device '%s' does not support feature '%s'" - -#define QERR_BUFFER_OVERRUN \ - ERROR_CLASS_GENERIC_ERROR, "An internal buffer overran" - -#define QERR_BUS_NO_HOTPLUG \ - ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging" - -#define QERR_BUS_NOT_FOUND \ - ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found" - -#define QERR_COMMAND_DISABLED \ - ERROR_CLASS_GENERIC_ERROR, "The command %s has been disabled for this instance" - -#define QERR_COMMAND_NOT_FOUND \ - ERROR_CLASS_COMMAND_NOT_FOUND, "The command %s has not been found" - -#define QERR_DEVICE_ENCRYPTED \ - ERROR_CLASS_DEVICE_ENCRYPTED, "'%s' (%s) is encrypted" - -#define QERR_DEVICE_FEATURE_BLOCKS_MIGRATION \ - ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when using feature '%s' in device '%s'" - -#define QERR_DEVICE_HAS_NO_MEDIUM \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium" - -#define QERR_DEVICE_INIT_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized" - -#define QERR_DEVICE_IN_USE \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use" - -#define QERR_DEVICE_IS_READ_ONLY \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' is read only" - -#define QERR_DEVICE_LOCKED \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' is locked" - -#define QERR_DEVICE_MULTIPLE_BUSSES \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' has multiple child busses" - -#define QERR_DEVICE_NO_BUS \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no child bus" - -#define QERR_DEVICE_NO_HOTPLUG \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging" - -#define QERR_DEVICE_NOT_ACTIVE \ - ERROR_CLASS_DEVICE_NOT_ACTIVE, "Device '%s' has not been activated" - -#define QERR_DEVICE_NOT_ENCRYPTED \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not encrypted" - -#define QERR_DEVICE_NOT_FOUND \ - ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found" - -#define QERR_DEVICE_NOT_REMOVABLE \ - ERROR_CLASS_GENERIC_ERROR, "Device '%s' is not removable" - -#define QERR_DUPLICATE_ID \ - ERROR_CLASS_GENERIC_ERROR, "Duplicate ID '%s' for %s" - -#define QERR_FD_NOT_FOUND \ - ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found" - -#define QERR_FD_NOT_SUPPLIED \ - ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS" - -#define QERR_FEATURE_DISABLED \ - ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled" - -#define QERR_INVALID_BLOCK_FORMAT \ - ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'" - -#define QERR_INVALID_OPTION_GROUP \ - ERROR_CLASS_GENERIC_ERROR, "There is no option group '%s'" - -#define QERR_INVALID_PARAMETER \ - ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'" - -#define QERR_INVALID_PARAMETER_COMBINATION \ - ERROR_CLASS_GENERIC_ERROR, "Invalid parameter combination" - -#define QERR_INVALID_PARAMETER_TYPE \ - ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s" - -#define QERR_INVALID_PARAMETER_VALUE \ - ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s" - -#define QERR_INVALID_PASSWORD \ - ERROR_CLASS_GENERIC_ERROR, "Password incorrect" - -#define QERR_IO_ERROR \ - ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred" - -#define QERR_JSON_PARSE_ERROR \ - ERROR_CLASS_GENERIC_ERROR, "JSON parse error, %s" - -#define QERR_JSON_PARSING \ - ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax" - -#define QERR_KVM_MISSING_CAP \ - ERROR_CLASS_K_V_M_MISSING_CAP, "Using KVM without %s, %s unavailable" - -#define QERR_MIGRATION_ACTIVE \ - ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress" - -#define QERR_MIGRATION_NOT_SUPPORTED \ - ERROR_CLASS_GENERIC_ERROR, "State blocked by non-migratable device '%s'" - -#define QERR_MISSING_PARAMETER \ - ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing" - -#define QERR_NO_BUS_FOR_DEVICE \ - ERROR_CLASS_GENERIC_ERROR, "No '%s' bus found for device '%s'" - -#define QERR_NOT_SUPPORTED \ - ERROR_CLASS_GENERIC_ERROR, "Not supported" - -#define QERR_OPEN_FILE_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Could not open '%s'" - -#define QERR_PERMISSION_DENIED \ - ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation" - -#define QERR_PROPERTY_NOT_FOUND \ - ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' not found" - -#define QERR_PROPERTY_VALUE_BAD \ - ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'" - -#define QERR_PROPERTY_VALUE_IN_USE \ - ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't take value '%s', it's in use" - -#define QERR_PROPERTY_VALUE_NOT_FOUND \ - ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' can't find value '%s'" - -#define QERR_PROPERTY_VALUE_NOT_POWER_OF_2 \ - ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value '%" PRId64 "', it's not a power of 2" - -#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \ - ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" - -#define QERR_QGA_COMMAND_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'" - -#define QERR_QGA_LOGGING_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Guest agent failed to log non-optional log statement" - -#define QERR_QMP_BAD_INPUT_OBJECT \ - ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input" - -#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \ - ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'" - -#define QERR_QMP_EXTRA_MEMBER \ - ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected" - -#define QERR_RESET_REQUIRED \ - ERROR_CLASS_GENERIC_ERROR, "Resetting the Virtual Machine is required" - -#define QERR_SET_PASSWD_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Could not set password" - -#define QERR_TOO_MANY_FILES \ - ERROR_CLASS_GENERIC_ERROR, "Too many open files" - -#define QERR_UNDEFINED_ERROR \ - ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred" - -#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \ - ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s" - -#define QERR_UNSUPPORTED \ - ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported" - -#define QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION \ - ERROR_CLASS_GENERIC_ERROR, "Migration is disabled when VirtFS export path '%s' is mounted in the guest using mount_tag '%s'" - -#define QERR_SOCKET_CONNECT_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Failed to connect to socket" - -#define QERR_SOCKET_LISTEN_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Failed to set socket to listening mode" - -#define QERR_SOCKET_BIND_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Failed to bind socket" - -#define QERR_SOCKET_CREATE_FAILED \ - ERROR_CLASS_GENERIC_ERROR, "Failed to create socket" - -#endif /* QERROR_H */ diff --git a/qfloat.c b/qfloat.c index 98338f3b71..7de0992dba 100644 --- a/qfloat.c +++ b/qfloat.c @@ -11,8 +11,8 @@ * */ -#include "qfloat.h" -#include "qobject.h" +#include "qapi/qmp/qfloat.h" +#include "qapi/qmp/qobject.h" #include "qemu-common.h" static void qfloat_destroy_obj(QObject *obj); diff --git a/qfloat.h b/qfloat.h deleted file mode 100644 index 9d6787659c..0000000000 --- a/qfloat.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * QFloat Module - * - * Copyright IBM, Corp. 2009 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QFLOAT_H -#define QFLOAT_H - -#include -#include "qobject.h" - -typedef struct QFloat { - QObject_HEAD; - double value; -} QFloat; - -QFloat *qfloat_from_double(double value); -double qfloat_get_double(const QFloat *qi); -QFloat *qobject_to_qfloat(const QObject *obj); - -#endif /* QFLOAT_H */ diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 726930a909..cedf2ccf28 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -17,7 +17,7 @@ #include #include "qga/guest-agent-core.h" #include "qga-qmp-commands.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #include "qemu-queue.h" #include "host-utils.h" diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 5bd8fb27f2..7e8ecb3b40 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -16,7 +16,7 @@ #include #include "qga/guest-agent-core.h" #include "qga-qmp-commands.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" #ifndef SHTDN_REASON_FLAG_PLANNED #define SHTDN_REASON_FLAG_PLANNED 0x80000000 diff --git a/qga/commands.c b/qga/commands.c index 46b0b083bc..7ffb35e4af 100644 --- a/qga/commands.c +++ b/qga/commands.c @@ -13,7 +13,7 @@ #include #include "qga/guest-agent-core.h" #include "qga-qmp-commands.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" /* Note: in some situations, like with the fsfreeze, logging may be * temporarilly disabled. if it is necessary that a command be able diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h index 49a7abee95..8934163375 100644 --- a/qga/guest-agent-core.h +++ b/qga/guest-agent-core.h @@ -10,7 +10,7 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ -#include "qapi/qmp-core.h" +#include "qapi/qmp/dispatch.h" #include "qemu-common.h" #define QGA_READ_COUNT_DEFAULT 4096 diff --git a/qga/main.c b/qga/main.c index 9b59a52461..ead58cc11f 100644 --- a/qga/main.c +++ b/qga/main.c @@ -20,15 +20,15 @@ #include #include #endif -#include "json-streamer.h" -#include "json-parser.h" -#include "qint.h" -#include "qjson.h" +#include "qapi/qmp/json-streamer.h" +#include "qapi/qmp/json-parser.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qjson.h" #include "qga/guest-agent-core.h" #include "module.h" #include "signal.h" -#include "qerror.h" -#include "qapi/qmp-core.h" +#include "qapi/qmp/qerror.h" +#include "qapi/qmp/dispatch.h" #include "qga/channel.h" #ifdef _WIN32 #include "qga/service-win32.h" diff --git a/qint.c b/qint.c index ee51804fbe..86b9b04f0b 100644 --- a/qint.c +++ b/qint.c @@ -10,8 +10,8 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qint.h" -#include "qobject.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qobject.h" #include "qemu-common.h" static void qint_destroy_obj(QObject *obj); diff --git a/qint.h b/qint.h deleted file mode 100644 index 6b1a15c088..0000000000 --- a/qint.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * QInt Module - * - * Copyright (C) 2009 Red Hat Inc. - * - * Authors: - * Luiz Capitulino - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - */ - -#ifndef QINT_H -#define QINT_H - -#include -#include "qobject.h" - -typedef struct QInt { - QObject_HEAD; - int64_t value; -} QInt; - -QInt *qint_from_int(int64_t value); -int64_t qint_get_int(const QInt *qi); -QInt *qobject_to_qint(const QObject *obj); - -#endif /* QINT_H */ diff --git a/qjson.c b/qjson.c index f9c8e77516..83a6b4f7c1 100644 --- a/qjson.c +++ b/qjson.c @@ -11,15 +11,15 @@ * */ -#include "json-lexer.h" -#include "json-parser.h" -#include "json-streamer.h" -#include "qjson.h" -#include "qint.h" -#include "qlist.h" -#include "qbool.h" -#include "qfloat.h" -#include "qdict.h" +#include "qapi/qmp/json-lexer.h" +#include "qapi/qmp/json-parser.h" +#include "qapi/qmp/json-streamer.h" +#include "qapi/qmp/qjson.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qfloat.h" +#include "qapi/qmp/qdict.h" typedef struct JSONParsingState { diff --git a/qjson.h b/qjson.h deleted file mode 100644 index 1190d8a86c..0000000000 --- a/qjson.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * QObject JSON integration - * - * Copyright IBM, Corp. 2009 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - */ - -#ifndef QJSON_H -#define QJSON_H - -#include -#include "compiler.h" -#include "qobject.h" -#include "qstring.h" - -QObject *qobject_from_json(const char *string) GCC_FMT_ATTR(1, 0); -QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2); -QObject *qobject_from_jsonv(const char *string, va_list *ap) GCC_FMT_ATTR(1, 0); - -QString *qobject_to_json(const QObject *obj); -QString *qobject_to_json_pretty(const QObject *obj); - -#endif /* QJSON_H */ diff --git a/qlist.c b/qlist.c index b48ec5b914..c5ac2115af 100644 --- a/qlist.c +++ b/qlist.c @@ -10,8 +10,8 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qlist.h" -#include "qobject.h" +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/qobject.h" #include "qemu-queue.h" #include "qemu-common.h" diff --git a/qlist.h b/qlist.h deleted file mode 100644 index 74089471df..0000000000 --- a/qlist.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * QList Module - * - * Copyright (C) 2009 Red Hat Inc. - * - * Authors: - * Luiz Capitulino - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - */ - -#ifndef QLIST_H -#define QLIST_H - -#include "qobject.h" -#include "qemu-queue.h" -#include "qemu-queue.h" - -typedef struct QListEntry { - QObject *value; - QTAILQ_ENTRY(QListEntry) next; -} QListEntry; - -typedef struct QList { - QObject_HEAD; - QTAILQ_HEAD(,QListEntry) head; -} QList; - -#define qlist_append(qlist, obj) \ - qlist_append_obj(qlist, QOBJECT(obj)) - -#define QLIST_FOREACH_ENTRY(qlist, var) \ - for ((var) = ((qlist)->head.tqh_first); \ - (var); \ - (var) = ((var)->next.tqe_next)) - -static inline QObject *qlist_entry_obj(const QListEntry *entry) -{ - return entry->value; -} - -QList *qlist_new(void); -QList *qlist_copy(QList *src); -void qlist_append_obj(QList *qlist, QObject *obj); -void qlist_iter(const QList *qlist, - void (*iter)(QObject *obj, void *opaque), void *opaque); -QObject *qlist_pop(QList *qlist); -QObject *qlist_peek(QList *qlist); -int qlist_empty(const QList *qlist); -size_t qlist_size(const QList *qlist); -QList *qobject_to_qlist(const QObject *obj); - -static inline const QListEntry *qlist_first(const QList *qlist) -{ - return QTAILQ_FIRST(&qlist->head); -} - -static inline const QListEntry *qlist_next(const QListEntry *entry) -{ - return QTAILQ_NEXT(entry, next); -} - -#endif /* QLIST_H */ diff --git a/qobject.h b/qobject.h deleted file mode 100644 index 9124649ed2..0000000000 --- a/qobject.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * QEMU Object Model. - * - * Based on ideas by Avi Kivity - * - * Copyright (C) 2009 Red Hat Inc. - * - * Authors: - * Luiz Capitulino - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - * - * QObject Reference Counts Terminology - * ------------------------------------ - * - * - Returning references: A function that returns an object may - * return it as either a weak or a strong reference. If the reference - * is strong, you are responsible for calling QDECREF() on the reference - * when you are done. - * - * If the reference is weak, the owner of the reference may free it at - * any time in the future. Before storing the reference anywhere, you - * should call QINCREF() to make the reference strong. - * - * - Transferring ownership: when you transfer ownership of a reference - * by calling a function, you are no longer responsible for calling - * QDECREF() when the reference is no longer needed. In other words, - * when the function returns you must behave as if the reference to the - * passed object was weak. - */ -#ifndef QOBJECT_H -#define QOBJECT_H - -#include -#include - -typedef enum { - QTYPE_NONE, - QTYPE_QINT, - QTYPE_QSTRING, - QTYPE_QDICT, - QTYPE_QLIST, - QTYPE_QFLOAT, - QTYPE_QBOOL, - QTYPE_QERROR, -} qtype_code; - -struct QObject; - -typedef struct QType { - qtype_code code; - void (*destroy)(struct QObject *); -} QType; - -typedef struct QObject { - const QType *type; - size_t refcnt; -} QObject; - -/* Objects definitions must include this */ -#define QObject_HEAD \ - QObject base - -/* Get the 'base' part of an object */ -#define QOBJECT(obj) (&(obj)->base) - -/* High-level interface for qobject_incref() */ -#define QINCREF(obj) \ - qobject_incref(QOBJECT(obj)) - -/* High-level interface for qobject_decref() */ -#define QDECREF(obj) \ - qobject_decref(obj ? QOBJECT(obj) : NULL) - -/* Initialize an object to default values */ -#define QOBJECT_INIT(obj, qtype_type) \ - obj->base.refcnt = 1; \ - obj->base.type = qtype_type - -/** - * qobject_incref(): Increment QObject's reference count - */ -static inline void qobject_incref(QObject *obj) -{ - if (obj) - obj->refcnt++; -} - -/** - * qobject_decref(): Decrement QObject's reference count, deallocate - * when it reaches zero - */ -static inline void qobject_decref(QObject *obj) -{ - if (obj && --obj->refcnt == 0) { - assert(obj->type != NULL); - assert(obj->type->destroy != NULL); - obj->type->destroy(obj); - } -} - -/** - * qobject_type(): Return the QObject's type - */ -static inline qtype_code qobject_type(const QObject *obj) -{ - assert(obj->type != NULL); - return obj->type->code; -} - -#endif /* QOBJECT_H */ diff --git a/qom/object.c b/qom/object.c index 8d3036dcf4..932f8b30de 100644 --- a/qom/object.c +++ b/qom/object.c @@ -12,18 +12,18 @@ #include "qemu/object.h" #include "qemu-common.h" -#include "qapi/qapi-visit-core.h" +#include "qapi/visitor.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" /* TODO: replace QObject with a simpler visitor to avoid a dependency * of the QOM core on QObject? */ #include "qemu/qom-qobject.h" -#include "qobject.h" -#include "qbool.h" -#include "qint.h" -#include "qstring.h" +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qstring.h" #define MAX_INTERFACES 32 diff --git a/qom/qom-qobject.c b/qom/qom-qobject.c index 0689914e15..f0fa652157 100644 --- a/qom/qom-qobject.c +++ b/qom/qom-qobject.c @@ -12,7 +12,7 @@ #include "qemu-common.h" #include "qemu/object.h" #include "qemu/qom-qobject.h" -#include "qapi/qapi-visit-core.h" +#include "qapi/visitor.h" #include "qapi/qmp-input-visitor.h" #include "qapi/qmp-output-visitor.h" diff --git a/qstring.c b/qstring.c index b7e12e4015..5f7376c336 100644 --- a/qstring.c +++ b/qstring.c @@ -10,8 +10,8 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "qobject.h" -#include "qstring.h" +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qstring.h" #include "qemu-common.h" static void qstring_destroy_obj(QObject *obj); diff --git a/qstring.h b/qstring.h deleted file mode 100644 index 84ccd96d61..0000000000 --- a/qstring.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * QString Module - * - * Copyright (C) 2009 Red Hat Inc. - * - * Authors: - * Luiz Capitulino - * - * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. - * See the COPYING.LIB file in the top-level directory. - */ - -#ifndef QSTRING_H -#define QSTRING_H - -#include -#include "qobject.h" - -typedef struct QString { - QObject_HEAD; - char *string; - size_t length; - size_t capacity; -} QString; - -QString *qstring_new(void); -QString *qstring_from_str(const char *str); -QString *qstring_from_substr(const char *str, int start, int end); -const char *qstring_get_str(const QString *qstring); -void qstring_append_int(QString *qstring, int64_t value); -void qstring_append(QString *qstring, const char *str); -void qstring_append_chr(QString *qstring, int c); -QString *qobject_to_qstring(const QObject *obj); - -#endif /* QSTRING_H */ diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py index 5d034c2c21..eccc28daee 100644 --- a/scripts/qapi-commands.py +++ b/scripts/qapi-commands.py @@ -342,8 +342,8 @@ def gen_command_decl_prologue(header, guard, prefix=""): #define %(guard)s #include "%(prefix)sqapi-types.h" -#include "qdict.h" -#include "error.h" +#include "qapi/qmp/qdict.h" +#include "qapi/error.h" ''', header=basename(header), guard=guardname(header), prefix=prefix) @@ -368,13 +368,13 @@ def gen_command_def_prologue(prefix="", proxy=False): #include "qemu-common.h" #include "module.h" -#include "qerror.h" -#include "qemu-objects.h" -#include "qapi/qmp-core.h" -#include "qapi/qapi-visit-core.h" +#include "qapi/qmp/qerror.h" +#include "qapi/qmp/types.h" +#include "qapi/qmp/dispatch.h" +#include "qapi/visitor.h" #include "qapi/qmp-output-visitor.h" #include "qapi/qmp-input-visitor.h" -#include "qapi/qapi-dealloc-visitor.h" +#include "qapi/dealloc-visitor.h" #include "%(prefix)sqapi-types.h" #include "%(prefix)sqapi-visit.h" diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 6bc2391874..9e19920970 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -248,7 +248,7 @@ fdef.write(mcgen(''' * */ -#include "qapi/qapi-dealloc-visitor.h" +#include "qapi/dealloc-visitor.h" #include "%(prefix)sqapi-types.h" #include "%(prefix)sqapi-visit.h" diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index f1aabb3813..a276540a18 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -322,7 +322,7 @@ fdecl.write(mcgen(''' #ifndef %(guard)s #define %(guard)s -#include "qapi/qapi-visit-core.h" +#include "qapi/visitor.h" #include "%(prefix)sqapi-types.h" ''', prefix=prefix, guard=guardname(h_file))) diff --git a/stubs/arch-query-cpu-def.c b/stubs/arch-query-cpu-def.c index 47b524628d..6eca8527d2 100644 --- a/stubs/arch-query-cpu-def.c +++ b/stubs/arch-query-cpu-def.c @@ -1,6 +1,6 @@ #include "qemu-common.h" #include "arch_init.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) { diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h index 5901140480..3a7bc6aef4 100644 --- a/target-i386/cpu-qom.h +++ b/target-i386/cpu-qom.h @@ -22,7 +22,7 @@ #include "qemu/cpu.h" #include "cpu.h" -#include "error.h" +#include "qapi/error.h" #ifdef TARGET_X86_64 #define TYPE_X86_CPU "x86_64-cpu" diff --git a/target-i386/cpu.c b/target-i386/cpu.c index e968006ed0..150c4dfb0c 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -26,9 +26,9 @@ #include "qemu-option.h" #include "qemu-config.h" -#include "qerror.h" +#include "qapi/qmp/qerror.h" -#include "qapi/qapi-visit-core.h" +#include "qapi/visitor.h" #include "arch_init.h" #include "hyperv.h" diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h index ebb5ad3124..c7b1750153 100644 --- a/target-openrisc/cpu.h +++ b/target-openrisc/cpu.h @@ -33,7 +33,7 @@ struct OpenRISCCPU; #include "cpu-defs.h" #include "softfloat.h" #include "qemu/cpu.h" -#include "error.h" +#include "qapi/error.h" #define TYPE_OPENRISC_CPU "or32-cpu" diff --git a/tests/check-qdict.c b/tests/check-qdict.c index fc0d276538..dc5f05a85f 100644 --- a/tests/check-qdict.c +++ b/tests/check-qdict.c @@ -11,9 +11,9 @@ */ #include -#include "qint.h" -#include "qdict.h" -#include "qstring.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qstring.h" #include "qemu-common.h" /* diff --git a/tests/check-qfloat.c b/tests/check-qfloat.c index cdc66ea10b..6404ac8df6 100644 --- a/tests/check-qfloat.c +++ b/tests/check-qfloat.c @@ -12,7 +12,7 @@ */ #include -#include "qfloat.h" +#include "qapi/qmp/qfloat.h" #include "qemu-common.h" /* diff --git a/tests/check-qint.c b/tests/check-qint.c index 5a27119ae2..86868844ab 100644 --- a/tests/check-qint.c +++ b/tests/check-qint.c @@ -11,7 +11,7 @@ */ #include -#include "qint.h" +#include "qapi/qmp/qint.h" #include "qemu-common.h" /* diff --git a/tests/check-qjson.c b/tests/check-qjson.c index 3b896f5f9c..32ffb436df 100644 --- a/tests/check-qjson.c +++ b/tests/check-qjson.c @@ -10,13 +10,13 @@ */ #include -#include "qstring.h" -#include "qint.h" -#include "qdict.h" -#include "qlist.h" -#include "qfloat.h" -#include "qbool.h" -#include "qjson.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/qfloat.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qjson.h" #include "qemu-common.h" diff --git a/tests/check-qlist.c b/tests/check-qlist.c index 501ba262da..b9c05d43fd 100644 --- a/tests/check-qlist.c +++ b/tests/check-qlist.c @@ -11,8 +11,8 @@ */ #include -#include "qint.h" -#include "qlist.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qlist.h" /* * Public Interface test-cases diff --git a/tests/check-qstring.c b/tests/check-qstring.c index addad6c673..95dc9e3e7b 100644 --- a/tests/check-qstring.c +++ b/tests/check-qstring.c @@ -11,7 +11,7 @@ */ #include -#include "qstring.h" +#include "qapi/qmp/qstring.h" #include "qemu-common.h" /* diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c index bf41034c62..61b533a071 100644 --- a/tests/test-qmp-commands.c +++ b/tests/test-qmp-commands.c @@ -1,8 +1,8 @@ #include #include "qemu-common.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" #include "test-qmp-commands.h" -#include "qapi/qmp-core.h" +#include "qapi/qmp/dispatch.h" #include "module.h" #include "qapi/qmp-input-visitor.h" #include "tests/test-qapi-types.h" diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c index 86f24d821c..6f68963a3d 100644 --- a/tests/test-qmp-input-strict.c +++ b/tests/test-qmp-input-strict.c @@ -18,7 +18,7 @@ #include "qapi/qmp-input-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" typedef struct TestInputVisitorData { QObject *obj; diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c index 6568c9907c..955a4c0b0a 100644 --- a/tests/test-qmp-input-visitor.c +++ b/tests/test-qmp-input-visitor.c @@ -17,7 +17,7 @@ #include "qapi/qmp-input-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" typedef struct TestInputVisitorData { QObject *obj; diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c index 84b1f41894..71367e6efa 100644 --- a/tests/test-qmp-output-visitor.c +++ b/tests/test-qmp-output-visitor.c @@ -16,7 +16,7 @@ #include "qapi/qmp-output-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" typedef struct TestOutputVisitorData { QmpOutputVisitor *qov; diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c index 36b3792980..899feda579 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -17,7 +17,7 @@ #include "qapi/string-input-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" typedef struct TestInputVisitorData { StringInputVisitor *siv; diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c index afb557a00f..79d815f888 100644 --- a/tests/test-string-output-visitor.c +++ b/tests/test-string-output-visitor.c @@ -16,7 +16,7 @@ #include "qapi/string-output-visitor.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" typedef struct TestOutputVisitorData { StringOutputVisitor *sov; diff --git a/tests/test-visitor-serialization.c b/tests/test-visitor-serialization.c index a251f878e1..3c6b8df607 100644 --- a/tests/test-visitor-serialization.c +++ b/tests/test-visitor-serialization.c @@ -18,7 +18,7 @@ #include "qemu-common.h" #include "test-qapi-types.h" #include "test-qapi-visit.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" #include "qapi/qmp-input-visitor.h" #include "qapi/qmp-output-visitor.h" #include "qapi/string-input-visitor.h" diff --git a/ui/input.c b/ui/input.c index 58d3b4709c..65950af9af 100644 --- a/ui/input.c +++ b/ui/input.c @@ -25,7 +25,7 @@ #include "sysemu.h" #include "monitor.h" #include "ui/console.h" -#include "error.h" +#include "qapi/error.h" #include "qmp-commands.h" #include "qapi-types.h" diff --git a/ui/spice-core.c b/ui/spice-core.c index ec925ecbb0..0550805b38 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -29,10 +29,10 @@ #include "qemu-x509.h" #include "qemu_socket.h" #include "qmp-commands.h" -#include "qint.h" -#include "qbool.h" -#include "qstring.h" -#include "qjson.h" +#include "qapi/qmp/qint.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qstring.h" +#include "qapi/qmp/qjson.h" #include "notify.h" #include "migration.h" #include "monitor.h" diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index 62d0fde77f..09199ef584 100644 --- a/ui/vnc-enc-tight.c +++ b/ui/vnc-enc-tight.c @@ -45,7 +45,7 @@ #endif #include "bswap.h" -#include "qint.h" +#include "qapi/qmp/qint.h" #include "vnc.h" #include "vnc-enc-tight.h" #include "vnc-palette.h" diff --git a/ui/vnc-palette.h b/ui/vnc-palette.h index b82dc5db91..bfc7fe642e 100644 --- a/ui/vnc-palette.h +++ b/ui/vnc-palette.h @@ -29,7 +29,7 @@ #ifndef VNC_PALETTE_H #define VNC_PALETTE_H -#include "qlist.h" +#include "qapi/qmp/qlist.h" #include "qemu-queue.h" #include #include diff --git a/ui/vnc.c b/ui/vnc.c index 04afcffc52..dad2ddee29 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -30,7 +30,7 @@ #include "qemu_socket.h" #include "qemu-timer.h" #include "acl.h" -#include "qemu-objects.h" +#include "qapi/qmp/types.h" #include "qmp-commands.h" #include "osdep.h" diff --git a/vl.c b/vl.c index 6713220905..975767a44b 100644 --- a/vl.c +++ b/vl.c @@ -143,7 +143,7 @@ int main(int argc, char **argv) #include "audio/audio.h" #include "migration.h" #include "kvm.h" -#include "qjson.h" +#include "qapi/qmp/qjson.h" #include "qemu-option.h" #include "qemu-config.h" #include "qemu-options.h" -- cgit v1.2.3-55-g7522 From 83c9089e73b81c69dc1ecdf859fa84d2c500fb5f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 17 Dec 2012 18:19:49 +0100 Subject: monitor: move include files to include/monitor/ Signed-off-by: Paolo Bonzini --- arch_init.c | 2 +- audio/audio.c | 2 +- audio/wavcapture.c | 2 +- balloon.c | 2 +- balloon.h | 2 +- block.c | 2 +- blockdev-nbd.c | 2 +- blockdev.c | 2 +- blockjob.c | 2 +- cpus.c | 2 +- disas.c | 2 +- dump.c | 2 +- gdbstub.c | 2 +- hmp.c | 2 +- hw/acpi.c | 2 +- hw/ccid-card-emulated.c | 2 +- hw/ccid-card-passthru.c | 2 +- hw/device-hotplug.c | 2 +- hw/i8259.c | 2 +- hw/ide/ahci.c | 2 +- hw/isa-bus.c | 2 +- hw/kvm/pci-assign.c | 2 +- hw/lm32_pic.c | 2 +- hw/loader.c | 2 +- hw/pc.c | 2 +- hw/pci/pci-hotplug.c | 2 +- hw/pci/pci-stub.c | 2 +- hw/pci/pci.c | 2 +- hw/pci/pcie_aer.c | 2 +- hw/qdev-monitor.c | 2 +- hw/qdev-monitor.h | 2 +- hw/qxl.c | 2 +- hw/s390-virtio-bus.c | 2 +- hw/s390-virtio.c | 2 +- hw/s390x/event-facility.c | 2 +- hw/slavio_intctl.c | 2 +- hw/spapr_vio.c | 2 +- hw/sun4c_intctl.c | 2 +- hw/sysbus.c | 2 +- hw/usb/bus.c | 2 +- hw/usb/dev-smartcard-reader.c | 2 +- hw/usb/dev-storage.c | 2 +- hw/usb/hcd-ehci.h | 2 +- hw/usb/host-bsd.c | 2 +- hw/usb/host-linux.c | 2 +- hw/usb/host-stub.c | 2 +- hw/usb/redirect.c | 2 +- hw/virtio-serial-bus.c | 2 +- hw/watchdog.c | 2 +- include/block/block_int.h | 2 +- include/monitor/monitor.h | 101 ++++++++++++++++++++++++++++++++++++++++++ include/monitor/readline.h | 55 +++++++++++++++++++++++ include/ui/console.h | 2 +- include/ui/qemu-spice.h | 4 +- migration-fd.c | 2 +- migration.c | 2 +- monitor.c | 4 +- monitor.h | 101 ------------------------------------------ net/hub.c | 2 +- net/net.c | 2 +- net/slirp.c | 2 +- net/socket.c | 2 +- net/tap.c | 2 +- osdep.c | 2 +- qemu-char.c | 2 +- qemu-error.c | 2 +- qemu-sockets.c | 2 +- qemu-timer.c | 2 +- qemu-tool.c | 2 +- qemu-user.c | 2 +- qerror.c | 2 +- readline.c | 4 +- readline.h | 55 ----------------------- savevm.c | 2 +- slirp/misc.c | 4 +- stubs/fdset-add-fd.c | 2 +- stubs/fdset-find-fd.c | 2 +- stubs/fdset-get-fd.c | 2 +- stubs/fdset-remove-fd.c | 2 +- stubs/get-fd.c | 2 +- target-i386/helper.c | 2 +- ui/input.c | 2 +- ui/spice-core.c | 2 +- ui/spice-display.c | 2 +- ui/vnc.h | 2 +- vl.c | 2 +- 86 files changed, 242 insertions(+), 242 deletions(-) create mode 100644 include/monitor/monitor.h create mode 100644 include/monitor/readline.h delete mode 100644 monitor.h delete mode 100644 readline.h (limited to 'ui/input.c') diff --git a/arch_init.c b/arch_init.c index e15cedad04..93d1e52f4a 100644 --- a/arch_init.c +++ b/arch_init.c @@ -29,7 +29,7 @@ #include #endif #include "config.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "bitops.h" #include "bitmap.h" diff --git a/audio/audio.c b/audio/audio.c index 1c7738930b..a0cc727020 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -23,7 +23,7 @@ */ #include "hw/hw.h" #include "audio.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qemu-timer.h" #include "sysemu.h" diff --git a/audio/wavcapture.c b/audio/wavcapture.c index 4f785f5f49..9d94623225 100644 --- a/audio/wavcapture.c +++ b/audio/wavcapture.c @@ -1,5 +1,5 @@ #include "hw/hw.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "audio.h" typedef struct { diff --git a/balloon.c b/balloon.c index c24458b5f9..d1de4352b4 100644 --- a/balloon.c +++ b/balloon.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "monitor.h" +#include "monitor/monitor.h" #include "exec/cpu-common.h" #include "kvm.h" #include "balloon.h" diff --git a/balloon.h b/balloon.h index b803a00741..bd9d39505d 100644 --- a/balloon.h +++ b/balloon.h @@ -14,7 +14,7 @@ #ifndef _QEMU_BALLOON_H #define _QEMU_BALLOON_H -#include "monitor.h" +#include "monitor/monitor.h" #include "qapi-types.h" typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target); diff --git a/block.c b/block.c index 5eab9e2519..0e7f18c6d3 100644 --- a/block.c +++ b/block.c @@ -24,7 +24,7 @@ #include "config-host.h" #include "qemu-common.h" #include "trace.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "block/block_int.h" #include "block/blockjob.h" #include "module.h" diff --git a/blockdev-nbd.c b/blockdev-nbd.c index 81aa1d34ef..596b47499d 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -11,7 +11,7 @@ #include "blockdev.h" #include "hw/block-common.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qapi/qmp/qerror.h" #include "sysemu.h" #include "qmp-commands.h" diff --git a/blockdev.c b/blockdev.c index ff6b333f69..a2308fa718 100644 --- a/blockdev.c +++ b/blockdev.c @@ -10,7 +10,7 @@ #include "blockdev.h" #include "hw/block-common.h" #include "block/blockjob.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qapi/qmp/qerror.h" #include "qemu-option.h" #include "qemu-config.h" diff --git a/blockjob.c b/blockjob.c index 004480d714..4bc60c7378 100644 --- a/blockjob.c +++ b/blockjob.c @@ -26,7 +26,7 @@ #include "config-host.h" #include "qemu-common.h" #include "trace.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "block/block.h" #include "block/blockjob.h" #include "block/block_int.h" diff --git a/cpus.c b/cpus.c index 8926873ad1..3a66401e0d 100644 --- a/cpus.c +++ b/cpus.c @@ -25,7 +25,7 @@ /* Needed early for CONFIG_BSD etc. */ #include "config-host.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "exec/gdbstub.h" #include "dma.h" diff --git a/disas.c b/disas.c index 8157b96fc1..a46faeed80 100644 --- a/disas.c +++ b/disas.c @@ -374,7 +374,7 @@ const char *lookup_symbol(target_ulong orig_addr) #if !defined(CONFIG_USER_ONLY) -#include "monitor.h" +#include "monitor/monitor.h" static int monitor_disas_is_physical; diff --git a/dump.c b/dump.c index e70e0f3b21..871ee1727a 100644 --- a/dump.c +++ b/dump.c @@ -16,7 +16,7 @@ #include "cpu.h" #include "exec/cpu-all.h" #include "exec/hwaddr.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "kvm.h" #include "dump.h" #include "sysemu.h" diff --git a/gdbstub.c b/gdbstub.c index 70ad79a748..9395c829a2 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -29,7 +29,7 @@ #include "qemu.h" #else -#include "monitor.h" +#include "monitor/monitor.h" #include "qemu-char.h" #include "sysemu.h" #include "exec/gdbstub.h" diff --git a/hmp.c b/hmp.c index f235134bb6..a76a8f06ea 100644 --- a/hmp.c +++ b/hmp.c @@ -20,7 +20,7 @@ #include "qemu-timer.h" #include "qmp-commands.h" #include "qemu_socket.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "ui/console.h" static void hmp_handle_error(Monitor *mon, Error **errp) diff --git a/hw/acpi.c b/hw/acpi.c index ae29a59077..fe9b76a9b0 100644 --- a/hw/acpi.c +++ b/hw/acpi.c @@ -22,7 +22,7 @@ #include "hw.h" #include "pc.h" #include "acpi.h" -#include "monitor.h" +#include "monitor/monitor.h" struct acpi_table_header { uint16_t _length; /* our length, not actual part of the hdr */ diff --git a/hw/ccid-card-emulated.c b/hw/ccid-card-emulated.c index f4a6da4283..845a764446 100644 --- a/hw/ccid-card-emulated.c +++ b/hw/ccid-card-emulated.c @@ -33,7 +33,7 @@ #include "qemu-thread.h" #include "qemu-char.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "hw/ccid.h" #define DPRINTF(card, lvl, fmt, ...) \ diff --git a/hw/ccid-card-passthru.c b/hw/ccid-card-passthru.c index bd6c77777d..f5b4794e90 100644 --- a/hw/ccid-card-passthru.c +++ b/hw/ccid-card-passthru.c @@ -10,7 +10,7 @@ #include "qemu-char.h" #include "qemu_socket.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "hw/ccid.h" #include "libcacard/vscard_common.h" diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c index 336ffc2274..809a598e3a 100644 --- a/hw/device-hotplug.c +++ b/hw/device-hotplug.c @@ -27,7 +27,7 @@ #include "blockdev.h" #include "qemu-config.h" #include "sysemu.h" -#include "monitor.h" +#include "monitor/monitor.h" DriveInfo *add_init_drive(const char *optstr) { diff --git a/hw/i8259.c b/hw/i8259.c index af0ba4d7c6..5e935e7f99 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -24,7 +24,7 @@ #include "hw.h" #include "pc.h" #include "isa.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qemu-timer.h" #include "i8259_internal.h" diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index f32a84761d..d38c6e4574 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -27,7 +27,7 @@ #include #include -#include "monitor.h" +#include "monitor/monitor.h" #include "dma.h" #include "exec/cpu-common.h" #include "internal.h" diff --git a/hw/isa-bus.c b/hw/isa-bus.c index 8f40974166..a2be67df56 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -17,7 +17,7 @@ * License along with this library; if not, see . */ #include "hw.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysbus.h" #include "sysemu.h" #include "isa.h" diff --git a/hw/kvm/pci-assign.c b/hw/kvm/pci-assign.c index 2629775589..ff0dc0dfd4 100644 --- a/hw/kvm/pci-assign.c +++ b/hw/kvm/pci-assign.c @@ -31,7 +31,7 @@ #include "qemu-error.h" #include "ui/console.h" #include "hw/loader.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "range.h" #include "sysemu.h" #include "hw/pci/pci.h" diff --git a/hw/lm32_pic.c b/hw/lm32_pic.c index 32f65db7f1..42d5602cf0 100644 --- a/hw/lm32_pic.c +++ b/hw/lm32_pic.c @@ -21,7 +21,7 @@ #include "hw.h" #include "pc.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysbus.h" #include "trace.h" #include "lm32_pic.h" diff --git a/hw/loader.c b/hw/loader.c index 03f0318d91..f5ef575b52 100644 --- a/hw/loader.c +++ b/hw/loader.c @@ -44,7 +44,7 @@ #include "hw.h" #include "disas/disas.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "uboot_image.h" #include "loader.h" diff --git a/hw/pc.c b/hw/pc.c index 2452fd4214..7aaff0f2fd 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -28,7 +28,7 @@ #include "fdc.h" #include "ide.h" #include "pci/pci.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "fw_cfg.h" #include "hpet_emul.h" #include "smbios.h" diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c index 5ba7558ecd..e5e8a7ab58 100644 --- a/hw/pci/pci-hotplug.c +++ b/hw/pci/pci-hotplug.c @@ -27,7 +27,7 @@ #include "hw/pci/pci.h" #include "net/net.h" #include "hw/pc.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "hw/scsi.h" #include "hw/virtio-blk.h" #include "qemu-config.h" diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index b5c43a935b..5891dc959d 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -19,7 +19,7 @@ */ #include "sysemu.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "hw/pci/pci.h" #include "qmp-commands.h" diff --git a/hw/pci/pci.c b/hw/pci/pci.c index fa0f08eb0a..e062f66088 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -25,7 +25,7 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_bus.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "net/net.h" #include "sysemu.h" #include "hw/loader.h" diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c index b6f4f8510f..f7f3633f5b 100644 --- a/hw/pci/pcie_aer.c +++ b/hw/pci/pcie_aer.c @@ -20,7 +20,7 @@ #include "sysemu.h" #include "qapi/qmp/types.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pcie.h" #include "hw/pci/msix.h" diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c index 5aaf74b98a..207282c4a4 100644 --- a/hw/qdev-monitor.c +++ b/hw/qdev-monitor.c @@ -18,7 +18,7 @@ */ #include "qdev.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qmp-commands.h" #include "arch_init.h" #include "qemu-config.h" diff --git a/hw/qdev-monitor.h b/hw/qdev-monitor.h index 220ceba4c5..fae1b1ec84 100644 --- a/hw/qdev-monitor.h +++ b/hw/qdev-monitor.h @@ -2,7 +2,7 @@ #define QEMU_QDEV_MONITOR_H #include "qdev-core.h" -#include "monitor.h" +#include "monitor/monitor.h" /*** monitor commands ***/ diff --git a/hw/qxl.c b/hw/qxl.c index 96887c4aad..ad0214827e 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -23,7 +23,7 @@ #include "qemu-common.h" #include "qemu-timer.h" #include "qemu-queue.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "trace.h" diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c index f7e1939288..769015c136 100644 --- a/hw/s390-virtio-bus.c +++ b/hw/s390-virtio-bus.c @@ -21,7 +21,7 @@ #include "block/block.h" #include "sysemu.h" #include "boards.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "loader.h" #include "elf.h" #include "hw/virtio.h" diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c index 0a15625b73..7dfe87ade3 100644 --- a/hw/s390-virtio.c +++ b/hw/s390-virtio.c @@ -23,7 +23,7 @@ #include "sysemu.h" #include "net/net.h" #include "boards.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "loader.h" #include "elf.h" #include "hw/virtio.h" diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index bc9cea9e1b..748118d0f0 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -15,7 +15,7 @@ * */ -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "sclp.h" diff --git a/hw/slavio_intctl.c b/hw/slavio_intctl.c index 6aafa8b233..a44ce95c1f 100644 --- a/hw/slavio_intctl.c +++ b/hw/slavio_intctl.c @@ -23,7 +23,7 @@ */ #include "sun4m.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysbus.h" #include "trace.h" diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index 1f19fedd0e..fdf8db9158 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -22,7 +22,7 @@ #include "hw.h" #include "sysemu.h" #include "boards.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "loader.h" #include "elf.h" #include "hw/sysbus.h" diff --git a/hw/sun4c_intctl.c b/hw/sun4c_intctl.c index 702e9f5444..b78d54f232 100644 --- a/hw/sun4c_intctl.c +++ b/hw/sun4c_intctl.c @@ -24,7 +24,7 @@ #include "hw.h" #include "sun4m.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysbus.h" //#define DEBUG_IRQ_COUNT diff --git a/hw/sysbus.c b/hw/sysbus.c index 7ab250463c..49a41775f8 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -18,7 +18,7 @@ */ #include "sysbus.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "exec/address-spaces.h" static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent); diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 8264c240ee..74728c94e5 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -2,7 +2,7 @@ #include "hw/usb.h" #include "hw/qdev.h" #include "sysemu.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "trace.h" static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent); diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index de955b709f..3862c9b6c9 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -38,7 +38,7 @@ #include "qemu-error.h" #include "hw/usb.h" #include "hw/usb/desc.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "hw/ccid.h" diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index de56fea610..0d7597b4d1 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -14,7 +14,7 @@ #include "hw/usb/desc.h" #include "hw/scsi.h" #include "ui/console.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "blockdev.h" diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index 837c63be85..740f7309fb 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -20,7 +20,7 @@ #include "hw/hw.h" #include "qemu-timer.h" #include "hw/usb.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "trace.h" #include "dma.h" #include "sysemu.h" diff --git a/hw/usb/host-bsd.c b/hw/usb/host-bsd.c index dae0009378..340c21aeb4 100644 --- a/hw/usb/host-bsd.c +++ b/hw/usb/host-bsd.c @@ -25,7 +25,7 @@ */ #include "qemu-common.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "hw/usb.h" /* usb.h declares these */ diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c index bdafb6bc87..5a56e99891 100644 --- a/hw/usb/host-linux.c +++ b/hw/usb/host-linux.c @@ -32,7 +32,7 @@ #include "qemu-common.h" #include "qemu-timer.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "trace.h" diff --git a/hw/usb/host-stub.c b/hw/usb/host-stub.c index e8da3221f6..58423a0f5c 100644 --- a/hw/usb/host-stub.c +++ b/hw/usb/host-stub.c @@ -33,7 +33,7 @@ #include "qemu-common.h" #include "ui/console.h" #include "hw/usb.h" -#include "monitor.h" +#include "monitor/monitor.h" void usb_host_info(Monitor *mon) { diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 9e7f6453f7..3621076020 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -27,7 +27,7 @@ #include "qemu-common.h" #include "qemu-timer.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "iov.h" diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index 155da58dcd..5559518a93 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -19,7 +19,7 @@ */ #include "iov.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qemu-queue.h" #include "sysbus.h" #include "trace.h" diff --git a/hw/watchdog.c b/hw/watchdog.c index f878bec860..623b299f71 100644 --- a/hw/watchdog.c +++ b/hw/watchdog.c @@ -24,7 +24,7 @@ #include "qemu-config.h" #include "qemu-queue.h" #include "qapi/qmp/types.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "hw/watchdog.h" diff --git a/include/block/block_int.h b/include/block/block_int.h index d06de2637b..14c57afd54 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -31,7 +31,7 @@ #include "qemu-timer.h" #include "qapi-types.h" #include "qapi/qmp/qerror.h" -#include "monitor.h" +#include "monitor/monitor.h" #define BLOCK_FLAG_ENCRYPT 1 #define BLOCK_FLAG_COMPAT6 4 diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h new file mode 100644 index 0000000000..87fb49c092 --- /dev/null +++ b/include/monitor/monitor.h @@ -0,0 +1,101 @@ +#ifndef MONITOR_H +#define MONITOR_H + +#include "qemu-common.h" +#include "qapi/qmp/qerror.h" +#include "qapi/qmp/qdict.h" +#include "block/block.h" +#include "monitor/readline.h" + +extern Monitor *cur_mon; +extern Monitor *default_mon; + +/* flags for monitor_init */ +#define MONITOR_IS_DEFAULT 0x01 +#define MONITOR_USE_READLINE 0x02 +#define MONITOR_USE_CONTROL 0x04 +#define MONITOR_USE_PRETTY 0x08 + +/* flags for monitor commands */ +#define MONITOR_CMD_ASYNC 0x0001 + +/* QMP events */ +typedef enum MonitorEvent { + QEVENT_SHUTDOWN, + QEVENT_RESET, + QEVENT_POWERDOWN, + QEVENT_STOP, + QEVENT_RESUME, + QEVENT_VNC_CONNECTED, + QEVENT_VNC_INITIALIZED, + QEVENT_VNC_DISCONNECTED, + QEVENT_BLOCK_IO_ERROR, + QEVENT_RTC_CHANGE, + QEVENT_WATCHDOG, + QEVENT_SPICE_CONNECTED, + QEVENT_SPICE_INITIALIZED, + QEVENT_SPICE_DISCONNECTED, + QEVENT_BLOCK_JOB_COMPLETED, + QEVENT_BLOCK_JOB_CANCELLED, + QEVENT_BLOCK_JOB_ERROR, + QEVENT_BLOCK_JOB_READY, + QEVENT_DEVICE_TRAY_MOVED, + QEVENT_SUSPEND, + QEVENT_SUSPEND_DISK, + QEVENT_WAKEUP, + QEVENT_BALLOON_CHANGE, + QEVENT_SPICE_MIGRATE_COMPLETED, + + /* Add to 'monitor_event_names' array in monitor.c when + * defining new events here */ + + QEVENT_MAX, +} MonitorEvent; + +int monitor_cur_is_qmp(void); + +void monitor_protocol_event(MonitorEvent event, QObject *data); +void monitor_init(CharDriverState *chr, int flags); + +int monitor_suspend(Monitor *mon); +void monitor_resume(Monitor *mon); + +int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, + BlockDriverCompletionFunc *completion_cb, + void *opaque); +int monitor_read_block_device_key(Monitor *mon, const char *device, + BlockDriverCompletionFunc *completion_cb, + void *opaque); + +int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp); +int monitor_handle_fd_param(Monitor *mon, const char *fdname); + +void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) + GCC_FMT_ATTR(2, 0); +void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +void monitor_print_filename(Monitor *mon, const char *filename); +void monitor_flush(Monitor *mon); +int monitor_set_cpu(int cpu_index); +int monitor_get_cpu_index(void); + +typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); + +void monitor_set_error(Monitor *mon, QError *qerror); +void monitor_read_command(Monitor *mon, int show_prompt); +ReadLineState *monitor_get_rs(Monitor *mon); +int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, + void *opaque); + +int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret); + +int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret); + +AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id, + bool has_opaque, const char *opaque, + Error **errp); +int monitor_fdset_get_fd(int64_t fdset_id, int flags); +int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd); +int monitor_fdset_dup_fd_remove(int dup_fd); +int monitor_fdset_dup_fd_find(int dup_fd); + +#endif /* !MONITOR_H */ diff --git a/include/monitor/readline.h b/include/monitor/readline.h new file mode 100644 index 0000000000..fc9806ecf1 --- /dev/null +++ b/include/monitor/readline.h @@ -0,0 +1,55 @@ +#ifndef READLINE_H +#define READLINE_H + +#include "qemu-common.h" + +#define READLINE_CMD_BUF_SIZE 4095 +#define READLINE_MAX_CMDS 64 +#define READLINE_MAX_COMPLETIONS 256 + +typedef void ReadLineFunc(Monitor *mon, const char *str, void *opaque); +typedef void ReadLineCompletionFunc(const char *cmdline); + +typedef struct ReadLineState { + char cmd_buf[READLINE_CMD_BUF_SIZE + 1]; + int cmd_buf_index; + int cmd_buf_size; + + char last_cmd_buf[READLINE_CMD_BUF_SIZE + 1]; + int last_cmd_buf_index; + int last_cmd_buf_size; + + int esc_state; + int esc_param; + + char *history[READLINE_MAX_CMDS]; + int hist_entry; + + ReadLineCompletionFunc *completion_finder; + char *completions[READLINE_MAX_COMPLETIONS]; + int nb_completions; + int completion_index; + + ReadLineFunc *readline_func; + void *readline_opaque; + int read_password; + char prompt[256]; + Monitor *mon; +} ReadLineState; + +void readline_add_completion(ReadLineState *rs, const char *str); +void readline_set_completion_index(ReadLineState *rs, int completion_index); + +const char *readline_get_history(ReadLineState *rs, unsigned int index); + +void readline_handle_byte(ReadLineState *rs, int ch); + +void readline_start(ReadLineState *rs, const char *prompt, int read_password, + ReadLineFunc *readline_func, void *opaque); +void readline_restart(ReadLineState *rs); +void readline_show_prompt(ReadLineState *rs); + +ReadLineState *readline_init(Monitor *mon, + ReadLineCompletionFunc *completion_finder); + +#endif /* !READLINE_H */ diff --git a/include/ui/console.h b/include/ui/console.h index eff5cc92d6..3db6635b0a 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -4,7 +4,7 @@ #include "ui/qemu-pixman.h" #include "qapi/qmp/qdict.h" #include "notify.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "trace.h" #include "qapi-types.h" #include "qapi/error.h" diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h index 5857b8a92e..3e08be06bf 100644 --- a/include/ui/qemu-spice.h +++ b/include/ui/qemu-spice.h @@ -24,7 +24,7 @@ #include "qemu-option.h" #include "qemu-config.h" -#include "monitor.h" +#include "monitor/monitor.h" extern int using_spice; @@ -47,7 +47,7 @@ void do_info_spice(Monitor *mon, QObject **ret_data); CharDriverState *qemu_chr_open_spice(QemuOpts *opts); #else /* CONFIG_SPICE */ -#include "monitor.h" +#include "monitor/monitor.h" #define using_spice 0 static inline int qemu_spice_set_passwd(const char *passwd, diff --git a/migration-fd.c b/migration-fd.c index e86228823f..73a1dfcc93 100644 --- a/migration-fd.c +++ b/migration-fd.c @@ -16,7 +16,7 @@ #include "qemu-common.h" #include "qemu_socket.h" #include "migration.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "buffered_file.h" #include "block/block.h" #include "qemu_socket.h" diff --git a/migration.c b/migration.c index 1fce152548..27a272eace 100644 --- a/migration.c +++ b/migration.c @@ -15,7 +15,7 @@ #include "qemu-common.h" #include "migration.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "buffered_file.h" #include "sysemu.h" #include "block/block.h" diff --git a/monitor.c b/monitor.c index a3e010968e..94c6bb6672 100644 --- a/monitor.c +++ b/monitor.c @@ -36,8 +36,8 @@ #include "qemu-char.h" #include "ui/qemu-spice.h" #include "sysemu.h" -#include "monitor.h" -#include "readline.h" +#include "monitor/monitor.h" +#include "monitor/readline.h" #include "ui/console.h" #include "blockdev.h" #include "audio/audio.h" diff --git a/monitor.h b/monitor.h deleted file mode 100644 index 9e96e83f5f..0000000000 --- a/monitor.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef MONITOR_H -#define MONITOR_H - -#include "qemu-common.h" -#include "qapi/qmp/qerror.h" -#include "qapi/qmp/qdict.h" -#include "block/block.h" -#include "readline.h" - -extern Monitor *cur_mon; -extern Monitor *default_mon; - -/* flags for monitor_init */ -#define MONITOR_IS_DEFAULT 0x01 -#define MONITOR_USE_READLINE 0x02 -#define MONITOR_USE_CONTROL 0x04 -#define MONITOR_USE_PRETTY 0x08 - -/* flags for monitor commands */ -#define MONITOR_CMD_ASYNC 0x0001 - -/* QMP events */ -typedef enum MonitorEvent { - QEVENT_SHUTDOWN, - QEVENT_RESET, - QEVENT_POWERDOWN, - QEVENT_STOP, - QEVENT_RESUME, - QEVENT_VNC_CONNECTED, - QEVENT_VNC_INITIALIZED, - QEVENT_VNC_DISCONNECTED, - QEVENT_BLOCK_IO_ERROR, - QEVENT_RTC_CHANGE, - QEVENT_WATCHDOG, - QEVENT_SPICE_CONNECTED, - QEVENT_SPICE_INITIALIZED, - QEVENT_SPICE_DISCONNECTED, - QEVENT_BLOCK_JOB_COMPLETED, - QEVENT_BLOCK_JOB_CANCELLED, - QEVENT_BLOCK_JOB_ERROR, - QEVENT_BLOCK_JOB_READY, - QEVENT_DEVICE_TRAY_MOVED, - QEVENT_SUSPEND, - QEVENT_SUSPEND_DISK, - QEVENT_WAKEUP, - QEVENT_BALLOON_CHANGE, - QEVENT_SPICE_MIGRATE_COMPLETED, - - /* Add to 'monitor_event_names' array in monitor.c when - * defining new events here */ - - QEVENT_MAX, -} MonitorEvent; - -int monitor_cur_is_qmp(void); - -void monitor_protocol_event(MonitorEvent event, QObject *data); -void monitor_init(CharDriverState *chr, int flags); - -int monitor_suspend(Monitor *mon); -void monitor_resume(Monitor *mon); - -int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs, - BlockDriverCompletionFunc *completion_cb, - void *opaque); -int monitor_read_block_device_key(Monitor *mon, const char *device, - BlockDriverCompletionFunc *completion_cb, - void *opaque); - -int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp); -int monitor_handle_fd_param(Monitor *mon, const char *fdname); - -void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) - GCC_FMT_ATTR(2, 0); -void monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3); -void monitor_print_filename(Monitor *mon, const char *filename); -void monitor_flush(Monitor *mon); -int monitor_set_cpu(int cpu_index); -int monitor_get_cpu_index(void); - -typedef void (MonitorCompletion)(void *opaque, QObject *ret_data); - -void monitor_set_error(Monitor *mon, QError *qerror); -void monitor_read_command(Monitor *mon, int show_prompt); -ReadLineState *monitor_get_rs(Monitor *mon); -int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func, - void *opaque); - -int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret); - -int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret); - -AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id, - bool has_opaque, const char *opaque, - Error **errp); -int monitor_fdset_get_fd(int64_t fdset_id, int flags); -int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd); -int monitor_fdset_dup_fd_remove(int dup_fd); -int monitor_fdset_dup_fd_find(int dup_fd); - -#endif /* !MONITOR_H */ diff --git a/net/hub.c b/net/hub.c index 8508ecf380..81a73b54a7 100644 --- a/net/hub.c +++ b/net/hub.c @@ -12,7 +12,7 @@ * */ -#include "monitor.h" +#include "monitor/monitor.h" #include "net/net.h" #include "clients.h" #include "hub.h" diff --git a/net/net.c b/net/net.c index ead7e96fe1..e4d85a9cfa 100644 --- a/net/net.c +++ b/net/net.c @@ -29,7 +29,7 @@ #include "net/slirp.h" #include "util.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qemu-common.h" #include "qemu_socket.h" #include "qemu-config.h" diff --git a/net/slirp.c b/net/slirp.c index 5a11ac5859..c37a5ef959 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -32,7 +32,7 @@ #include "net/net.h" #include "clients.h" #include "hub.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qemu_socket.h" #include "slirp/libslirp.h" #include "qemu-char.h" diff --git a/net/socket.c b/net/socket.c index 8430f1a161..bc2b951832 100644 --- a/net/socket.c +++ b/net/socket.c @@ -25,7 +25,7 @@ #include "net/net.h" #include "clients.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qemu-common.h" #include "qemu-error.h" #include "qemu-option.h" diff --git a/net/tap.c b/net/tap.c index f8cabc4f86..9a677e9864 100644 --- a/net/tap.c +++ b/net/tap.c @@ -35,7 +35,7 @@ #include "net/net.h" #include "clients.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "qemu-common.h" #include "qemu-error.h" diff --git a/osdep.c b/osdep.c index 3a63d26e75..807e90cf97 100644 --- a/osdep.c +++ b/osdep.c @@ -48,7 +48,7 @@ extern int madvise(caddr_t, size_t, int); #include "qemu-common.h" #include "trace.h" #include "qemu_socket.h" -#include "monitor.h" +#include "monitor/monitor.h" static bool fips_enabled = false; diff --git a/qemu-char.c b/qemu-char.c index bc53d09a9b..16021c5a43 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ #include "qemu-common.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "ui/console.h" #include "sysemu.h" #include "qemu-timer.h" diff --git a/qemu-error.c b/qemu-error.c index 7cd5ffe1e9..08a36f480c 100644 --- a/qemu-error.c +++ b/qemu-error.c @@ -11,7 +11,7 @@ */ #include -#include "monitor.h" +#include "monitor/monitor.h" /* * Print to current monitor if we have one, else to stderr. diff --git a/qemu-sockets.c b/qemu-sockets.c index c52a40a411..cea0a4b8ac 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -22,7 +22,7 @@ #include #include -#include "monitor.h" +#include "monitor/monitor.h" #include "qemu_socket.h" #include "qemu-common.h" /* for qemu_isdigit */ #include "main-loop.h" diff --git a/qemu-timer.c b/qemu-timer.c index 5a99403fda..8e0dccc087 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -23,7 +23,7 @@ */ #include "sysemu.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "ui/console.h" #include "hw/hw.h" diff --git a/qemu-tool.c b/qemu-tool.c index b46631e422..40453fdd99 100644 --- a/qemu-tool.c +++ b/qemu-tool.c @@ -14,7 +14,7 @@ */ #include "qemu-common.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "qemu-timer.h" #include "qemu-log.h" #include "migration.h" diff --git a/qemu-user.c b/qemu-user.c index 08ccb0fe8e..f8b450c03d 100644 --- a/qemu-user.c +++ b/qemu-user.c @@ -19,7 +19,7 @@ */ #include "qemu-common.h" -#include "monitor.h" +#include "monitor/monitor.h" Monitor *cur_mon; diff --git a/qerror.c b/qerror.c index 8c78104277..3aee1cf6a6 100644 --- a/qerror.c +++ b/qerror.c @@ -10,7 +10,7 @@ * See the COPYING.LIB file in the top-level directory. */ -#include "monitor.h" +#include "monitor/monitor.h" #include "qapi/qmp/qjson.h" #include "qapi/qmp/qerror.h" #include "qemu-common.h" diff --git a/readline.c b/readline.c index 540cd8a025..5fc9643c2b 100644 --- a/readline.c +++ b/readline.c @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "readline.h" -#include "monitor.h" +#include "monitor/readline.h" +#include "monitor/monitor.h" #define IS_NORM 0 #define IS_ESC 1 diff --git a/readline.h b/readline.h deleted file mode 100644 index fc9806ecf1..0000000000 --- a/readline.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef READLINE_H -#define READLINE_H - -#include "qemu-common.h" - -#define READLINE_CMD_BUF_SIZE 4095 -#define READLINE_MAX_CMDS 64 -#define READLINE_MAX_COMPLETIONS 256 - -typedef void ReadLineFunc(Monitor *mon, const char *str, void *opaque); -typedef void ReadLineCompletionFunc(const char *cmdline); - -typedef struct ReadLineState { - char cmd_buf[READLINE_CMD_BUF_SIZE + 1]; - int cmd_buf_index; - int cmd_buf_size; - - char last_cmd_buf[READLINE_CMD_BUF_SIZE + 1]; - int last_cmd_buf_index; - int last_cmd_buf_size; - - int esc_state; - int esc_param; - - char *history[READLINE_MAX_CMDS]; - int hist_entry; - - ReadLineCompletionFunc *completion_finder; - char *completions[READLINE_MAX_COMPLETIONS]; - int nb_completions; - int completion_index; - - ReadLineFunc *readline_func; - void *readline_opaque; - int read_password; - char prompt[256]; - Monitor *mon; -} ReadLineState; - -void readline_add_completion(ReadLineState *rs, const char *str); -void readline_set_completion_index(ReadLineState *rs, int completion_index); - -const char *readline_get_history(ReadLineState *rs, unsigned int index); - -void readline_handle_byte(ReadLineState *rs, int ch); - -void readline_start(ReadLineState *rs, const char *prompt, int read_password, - ReadLineFunc *readline_func, void *opaque); -void readline_restart(ReadLineState *rs); -void readline_show_prompt(ReadLineState *rs); - -ReadLineState *readline_init(Monitor *mon, - ReadLineCompletionFunc *completion_finder); - -#endif /* !READLINE_H */ diff --git a/savevm.c b/savevm.c index cb33501ecc..bf341bb25f 100644 --- a/savevm.c +++ b/savevm.c @@ -73,7 +73,7 @@ #include "hw/hw.h" #include "hw/qdev.h" #include "net/net.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "sysemu.h" #include "qemu-timer.h" #include "audio/audio.h" diff --git a/slirp/misc.c b/slirp/misc.c index 664532a663..d4df972d13 100644 --- a/slirp/misc.c +++ b/slirp/misc.c @@ -8,7 +8,7 @@ #include #include -#include "monitor.h" +#include "monitor/monitor.h" #ifdef DEBUG int slirp_debug = DBG_CALL|DBG_MISC|DBG_ERROR; @@ -242,7 +242,7 @@ strdup(str) } #endif -#include "monitor.h" +#include "monitor/monitor.h" void lprint(const char *format, ...) { diff --git a/stubs/fdset-add-fd.c b/stubs/fdset-add-fd.c index 09fe2a839a..ee1643708c 100644 --- a/stubs/fdset-add-fd.c +++ b/stubs/fdset-add-fd.c @@ -1,5 +1,5 @@ #include "qemu-common.h" -#include "monitor.h" +#include "monitor/monitor.h" int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd) { diff --git a/stubs/fdset-find-fd.c b/stubs/fdset-find-fd.c index f82baa066c..4f18344bad 100644 --- a/stubs/fdset-find-fd.c +++ b/stubs/fdset-find-fd.c @@ -1,5 +1,5 @@ #include "qemu-common.h" -#include "monitor.h" +#include "monitor/monitor.h" int monitor_fdset_dup_fd_find(int dup_fd) { diff --git a/stubs/fdset-get-fd.c b/stubs/fdset-get-fd.c index 4106cf90f0..7112c155e3 100644 --- a/stubs/fdset-get-fd.c +++ b/stubs/fdset-get-fd.c @@ -1,5 +1,5 @@ #include "qemu-common.h" -#include "monitor.h" +#include "monitor/monitor.h" int monitor_fdset_get_fd(int64_t fdset_id, int flags) { diff --git a/stubs/fdset-remove-fd.c b/stubs/fdset-remove-fd.c index 861b31247e..b3886d9f45 100644 --- a/stubs/fdset-remove-fd.c +++ b/stubs/fdset-remove-fd.c @@ -1,5 +1,5 @@ #include "qemu-common.h" -#include "monitor.h" +#include "monitor/monitor.h" int monitor_fdset_dup_fd_remove(int dupfd) { diff --git a/stubs/get-fd.c b/stubs/get-fd.c index 3561ab60e2..9f2c65cf0a 100644 --- a/stubs/get-fd.c +++ b/stubs/get-fd.c @@ -1,5 +1,5 @@ #include "qemu-common.h" -#include "monitor.h" +#include "monitor/monitor.h" int monitor_get_fd(Monitor *mon, const char *name, Error **errp) { diff --git a/target-i386/helper.c b/target-i386/helper.c index 00341c5233..bd47b8e58e 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -21,7 +21,7 @@ #include "kvm.h" #ifndef CONFIG_USER_ONLY #include "sysemu.h" -#include "monitor.h" +#include "monitor/monitor.h" #endif //#define DEBUG_MMU diff --git a/ui/input.c b/ui/input.c index 65950af9af..05f6c0c849 100644 --- a/ui/input.c +++ b/ui/input.c @@ -23,7 +23,7 @@ */ #include "sysemu.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "ui/console.h" #include "qapi/error.h" #include "qmp-commands.h" diff --git a/ui/spice-core.c b/ui/spice-core.c index 0550805b38..379677554e 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -35,7 +35,7 @@ #include "qapi/qmp/qjson.h" #include "notify.h" #include "migration.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "hw/hw.h" #include "ui/spice-display.h" diff --git a/ui/spice-display.c b/ui/spice-display.c index 681fe32fed..56ebf80805 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -19,7 +19,7 @@ #include "ui/qemu-spice.h" #include "qemu-timer.h" #include "qemu-queue.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "ui/console.h" #include "sysemu.h" #include "trace.h" diff --git a/ui/vnc.h b/ui/vnc.h index 7ec183372a..e5c043ff45 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -31,7 +31,7 @@ #include "qemu-queue.h" #include "qemu-thread.h" #include "ui/console.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "audio/audio.h" #include "bitmap.h" #include diff --git a/vl.c b/vl.c index 015f0a4757..9adaf28e64 100644 --- a/vl.c +++ b/vl.c @@ -129,7 +129,7 @@ int main(int argc, char **argv) #include "bt-host.h" #include "net/net.h" #include "net/slirp.h" -#include "monitor.h" +#include "monitor/monitor.h" #include "ui/console.h" #include "sysemu.h" #include "exec/gdbstub.h" -- cgit v1.2.3-55-g7522 From 9c17d615a66ebd655871bf891ec0fe901ad8b332 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 17 Dec 2012 18:20:04 +0100 Subject: softmmu: move include files to include/sysemu/ Signed-off-by: Paolo Bonzini --- arch_init.c | 6 +- arch_init.h | 39 ------ audio/audio.c | 2 +- audio/winwaveaudio.c | 2 +- balloon.c | 4 +- balloon.h | 29 ---- block-migration.c | 2 +- block.c | 2 +- block/vdi.c | 2 +- blockdev-nbd.c | 4 +- blockdev.c | 6 +- blockdev.h | 69 ---------- cpu-exec.c | 2 +- cpus.c | 10 +- cpus.h | 24 ---- device_tree.c | 2 +- device_tree.h | 54 -------- dma-helpers.c | 2 +- dma.h | 282 -------------------------------------- dump-stub.c | 2 +- dump.c | 8 +- dump.h | 35 ----- exec.c | 6 +- gdbstub.c | 4 +- hw/ac97.c | 2 +- hw/acpi.c | 2 +- hw/acpi_ich9.c | 4 +- hw/acpi_piix4.c | 2 +- hw/alpha_dp264.c | 2 +- hw/alpha_pci.c | 2 +- hw/alpha_typhoon.c | 2 +- hw/apb_pci.c | 2 +- hw/apic_common.c | 2 +- hw/arm_boot.c | 4 +- hw/arm_sysctl.c | 2 +- hw/axis_dev88.c | 2 +- hw/block-common.c | 2 +- hw/boards.h | 2 +- hw/bonito.c | 2 +- hw/cbus.c | 2 +- hw/collie.c | 2 +- hw/cuda.c | 2 +- hw/device-hotplug.c | 4 +- hw/e1000.c | 4 +- hw/eepro100.c | 4 +- hw/es1370.c | 2 +- hw/etraxfs_dma.c | 2 +- hw/etraxfs_timer.c | 2 +- hw/exynos4210.c | 2 +- hw/exynos4210_rtc.c | 2 +- hw/exynos4210_uart.c | 2 +- hw/exynos4_boards.c | 2 +- hw/fdc.c | 4 +- hw/fw_cfg.c | 2 +- hw/gumstix.c | 2 +- hw/highbank.c | 4 +- hw/ide/ahci.c | 2 +- hw/ide/cmd646.c | 4 +- hw/ide/core.c | 6 +- hw/ide/ich.c | 2 +- hw/ide/internal.h | 4 +- hw/ide/isa.c | 2 +- hw/ide/macio.c | 2 +- hw/ide/microdrive.c | 2 +- hw/ide/mmio.c | 2 +- hw/ide/pci.c | 2 +- hw/ide/piix.c | 6 +- hw/ide/qdev.c | 6 +- hw/ide/via.c | 4 +- hw/imx_ccm.c | 2 +- hw/imx_serial.c | 2 +- hw/integratorcp.c | 2 +- hw/intel-hda.c | 2 +- hw/isa-bus.c | 2 +- hw/ivshmem.c | 2 +- hw/kvm/apic.c | 2 +- hw/kvm/clock.c | 4 +- hw/kvm/i8254.c | 4 +- hw/kvm/i8259.c | 2 +- hw/kvm/ioapic.c | 2 +- hw/kvm/pci-assign.c | 2 +- hw/kvmvapic.c | 6 +- hw/kzm.c | 2 +- hw/lan9118.c | 2 +- hw/leon3.c | 2 +- hw/lm32_boards.c | 2 +- hw/lm32_sys.c | 2 +- hw/loader.c | 2 +- hw/lpc_ich9.c | 2 +- hw/lsi53c895a.c | 2 +- hw/m25p80.c | 2 +- hw/m48t59.c | 2 +- hw/mac_nvram.c | 2 +- hw/mainstone.c | 2 +- hw/mc146818rtc.c | 2 +- hw/mcf5206.c | 2 +- hw/mcf5208.c | 2 +- hw/megasas.c | 2 +- hw/microblaze_boot.c | 2 +- hw/milkymist-memcard.c | 4 +- hw/milkymist-sysctl.c | 2 +- hw/milkymist.c | 4 +- hw/mips_fulong2e.c | 4 +- hw/mips_jazz.c | 6 +- hw/mips_malta.c | 6 +- hw/mips_mipssim.c | 2 +- hw/mips_r4k.c | 4 +- hw/mpc8544_guts.c | 2 +- hw/multiboot.c | 2 +- hw/musicpal.c | 4 +- hw/nand.c | 2 +- hw/ne2000.c | 2 +- hw/nseries.c | 4 +- hw/omap1.c | 4 +- hw/omap2.c | 4 +- hw/omap_sx1.c | 2 +- hw/onenand.c | 2 +- hw/opencores_eth.c | 2 +- hw/openrisc_sim.c | 4 +- hw/palm.c | 2 +- hw/pam.c | 2 +- hw/parallel.c | 2 +- hw/pc.c | 8 +- hw/pc_piix.c | 8 +- hw/pc_q35.c | 4 +- hw/pc_sysfw.c | 6 +- hw/pci/pci-hotplug.c | 2 +- hw/pci/pci-stub.c | 2 +- hw/pci/pci.c | 2 +- hw/pci/pci.h | 2 +- hw/pci/pcie_aer.c | 2 +- hw/pckbd.c | 2 +- hw/pcnet-pci.c | 2 +- hw/pcnet.c | 2 +- hw/petalogix_ml605_mmu.c | 4 +- hw/petalogix_s3adsp1800_mmu.c | 4 +- hw/pl031.c | 2 +- hw/pl181.c | 2 +- hw/ppc.c | 4 +- hw/ppc/e500.c | 6 +- hw/ppc/e500plat.c | 4 +- hw/ppc/mpc8544ds.c | 2 +- hw/ppc405_boards.c | 4 +- hw/ppc405_uc.c | 2 +- hw/ppc440_bamboo.c | 6 +- hw/ppc_booke.c | 2 +- hw/ppc_newworld.c | 6 +- hw/ppc_oldworld.c | 6 +- hw/ppc_prep.c | 6 +- hw/ppce500_spin.c | 4 +- hw/ps2.c | 2 +- hw/pxa2xx.c | 4 +- hw/pxa2xx_lcd.c | 2 +- hw/pxa2xx_timer.c | 2 +- hw/qdev-monitor.c | 2 +- hw/qdev-properties.c | 2 +- hw/qdev.c | 2 +- hw/qxl.c | 2 +- hw/r2d.c | 4 +- hw/realview.c | 4 +- hw/rtl8139.c | 4 +- hw/s390-virtio-bus.c | 4 +- hw/s390-virtio.c | 6 +- hw/s390x/event-facility.c | 2 +- hw/s390x/sclp.c | 2 +- hw/s390x/sclpquiesce.c | 2 +- hw/scsi-bus.c | 4 +- hw/scsi-disk.c | 6 +- hw/scsi-generic.c | 2 +- hw/scsi.h | 2 +- hw/serial.h | 2 +- hw/sga.c | 2 +- hw/sh7750.c | 2 +- hw/shix.c | 2 +- hw/slavio_misc.c | 2 +- hw/smbios.c | 2 +- hw/smbus_ich9.c | 2 +- hw/spapr.c | 10 +- hw/spapr.h | 2 +- hw/spapr_events.c | 4 +- hw/spapr_hcall.c | 4 +- hw/spapr_iommu.c | 4 +- hw/spapr_nvram.c | 2 +- hw/spapr_rtas.c | 4 +- hw/spapr_vio.c | 6 +- hw/spapr_vio.h | 2 +- hw/spitz.c | 4 +- hw/ssi-sd.c | 2 +- hw/strongarm.c | 2 +- hw/sun4m.c | 4 +- hw/sun4u.c | 4 +- hw/tc6393xb.c | 2 +- hw/tosa.c | 2 +- hw/twl92230.c | 2 +- hw/usb/bus.c | 2 +- hw/usb/dev-network.c | 2 +- hw/usb/dev-storage.c | 4 +- hw/usb/hcd-ehci.h | 4 +- hw/usb/hcd-uhci.c | 2 +- hw/usb/host-linux.c | 2 +- hw/usb/libhw.c | 2 +- hw/usb/redirect.c | 2 +- hw/versatilepb.c | 4 +- hw/vexpress.c | 4 +- hw/vfio_pci.c | 2 +- hw/virtex_ml507.c | 6 +- hw/virtio-balloon.c | 4 +- hw/virtio-blk.c | 2 +- hw/virtio-pci.c | 4 +- hw/virtio.h | 2 +- hw/vmport.c | 2 +- hw/vt82c686.c | 2 +- hw/watchdog.c | 2 +- hw/xen_backend.h | 2 +- hw/xen_devconfig.c | 2 +- hw/xen_disk.c | 2 +- hw/xen_machine_pv.c | 2 +- hw/xilinx_spi.c | 2 +- hw/xilinx_spips.c | 2 +- hw/xilinx_zynq.c | 4 +- hw/xtensa_lx60.c | 4 +- hw/xtensa_sim.c | 2 +- hw/z2.c | 4 +- hw/zynq_slcr.c | 2 +- include/sysemu/arch_init.h | 39 ++++++ include/sysemu/balloon.h | 29 ++++ include/sysemu/blockdev.h | 69 ++++++++++ include/sysemu/cpus.h | 24 ++++ include/sysemu/device_tree.h | 54 ++++++++ include/sysemu/dma.h | 282 ++++++++++++++++++++++++++++++++++++++ include/sysemu/dump.h | 35 +++++ include/sysemu/kvm.h | 280 +++++++++++++++++++++++++++++++++++++ include/sysemu/memory_mapping.h | 64 +++++++++ include/sysemu/os-posix.h | 51 +++++++ include/sysemu/os-win32.h | 99 +++++++++++++ include/sysemu/qtest.h | 53 +++++++ include/sysemu/seccomp.h | 22 +++ include/sysemu/sysemu.h | 185 +++++++++++++++++++++++++ include/sysemu/xen-mapcache.h | 56 ++++++++ include/ui/spice-display.h | 2 +- kvm-all.c | 4 +- kvm-stub.c | 2 +- kvm.h | 280 ------------------------------------- memory.c | 2 +- memory_mapping-stub.c | 2 +- memory_mapping.c | 2 +- memory_mapping.h | 64 --------- migration.c | 2 +- monitor.c | 8 +- net/tap-bsd.c | 2 +- net/tap-linux.c | 2 +- net/tap-solaris.c | 2 +- net/tap-win32.c | 2 +- net/tap.c | 2 +- os-posix.c | 2 +- os-win32.c | 2 +- oslib-posix.c | 2 +- oslib-win32.c | 2 +- qemu-char.c | 2 +- qemu-common.h | 4 +- qemu-img.c | 2 +- qemu-os-posix.h | 51 ------- qemu-os-win32.h | 99 ------------- qemu-progress.c | 2 +- qemu-seccomp.c | 2 +- qemu-seccomp.h | 22 --- qemu-timer.c | 2 +- qemu-tool.c | 2 +- qmp.c | 8 +- qtest.c | 6 +- qtest.h | 53 ------- savevm.c | 4 +- stubs/arch-query-cpu-def.c | 2 +- sysemu.h | 185 ------------------------- target-alpha/sys_helper.c | 2 +- target-arm/cpu.c | 2 +- target-arm/helper.c | 2 +- target-i386/arch_dump.c | 2 +- target-i386/arch_memory_mapping.c | 2 +- target-i386/cpu.c | 6 +- target-i386/excp_helper.c | 2 +- target-i386/helper.c | 4 +- target-i386/kvm.c | 4 +- target-i386/kvm_i386.h | 2 +- target-i386/machine.c | 2 +- target-m68k/m68k-semi.c | 2 +- target-ppc/helper.c | 4 +- target-ppc/kvm.c | 8 +- target-ppc/kvm_ppc.c | 2 +- target-ppc/machine.c | 2 +- target-ppc/mmu_helper.c | 2 +- target-ppc/translate_init.c | 4 +- target-s390x/helper.c | 2 +- target-s390x/interrupt.c | 2 +- target-s390x/kvm.c | 6 +- target-s390x/misc_helper.c | 4 +- target-sparc/helper.c | 2 +- target-sparc/int32_helper.c | 2 +- target-xtensa/translate.c | 2 +- ui/cocoa.m | 2 +- ui/curses.c | 2 +- ui/input.c | 2 +- ui/keymaps.c | 2 +- ui/sdl.c | 2 +- ui/spice-core.c | 2 +- ui/spice-display.c | 2 +- ui/vnc.c | 2 +- vl.c | 16 +-- xen-all.c | 2 +- xen-mapcache.c | 4 +- xen-mapcache.h | 56 -------- 311 files changed, 1762 insertions(+), 1762 deletions(-) delete mode 100644 arch_init.h delete mode 100644 balloon.h delete mode 100644 blockdev.h delete mode 100644 cpus.h delete mode 100644 device_tree.h delete mode 100644 dma.h delete mode 100644 dump.h create mode 100644 include/sysemu/arch_init.h create mode 100644 include/sysemu/balloon.h create mode 100644 include/sysemu/blockdev.h create mode 100644 include/sysemu/cpus.h create mode 100644 include/sysemu/device_tree.h create mode 100644 include/sysemu/dma.h create mode 100644 include/sysemu/dump.h create mode 100644 include/sysemu/kvm.h create mode 100644 include/sysemu/memory_mapping.h create mode 100644 include/sysemu/os-posix.h create mode 100644 include/sysemu/os-win32.h create mode 100644 include/sysemu/qtest.h create mode 100644 include/sysemu/seccomp.h create mode 100644 include/sysemu/sysemu.h create mode 100644 include/sysemu/xen-mapcache.h delete mode 100644 kvm.h delete mode 100644 memory_mapping.h delete mode 100644 qemu-os-posix.h delete mode 100644 qemu-os-win32.h delete mode 100644 qemu-seccomp.h delete mode 100644 qtest.h delete mode 100644 sysemu.h delete mode 100644 xen-mapcache.h (limited to 'ui/input.c') diff --git a/arch_init.c b/arch_init.c index 9dacf5689b..a8b65416da 100644 --- a/arch_init.c +++ b/arch_init.c @@ -30,15 +30,15 @@ #endif #include "config.h" #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/bitops.h" #include "qemu/bitmap.h" -#include "arch_init.h" +#include "sysemu/arch_init.h" #include "audio/audio.h" #include "hw/pc.h" #include "hw/pci/pci.h" #include "hw/audiodev.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "migration/migration.h" #include "exec/gdbstub.h" #include "hw/smbios.h" diff --git a/arch_init.h b/arch_init.h deleted file mode 100644 index 5fc780c63d..0000000000 --- a/arch_init.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef QEMU_ARCH_INIT_H -#define QEMU_ARCH_INIT_H - -#include "qmp-commands.h" - -enum { - QEMU_ARCH_ALL = -1, - QEMU_ARCH_ALPHA = 1, - QEMU_ARCH_ARM = 2, - QEMU_ARCH_CRIS = 4, - QEMU_ARCH_I386 = 8, - QEMU_ARCH_M68K = 16, - QEMU_ARCH_LM32 = 32, - QEMU_ARCH_MICROBLAZE = 64, - QEMU_ARCH_MIPS = 128, - QEMU_ARCH_PPC = 256, - QEMU_ARCH_S390X = 512, - QEMU_ARCH_SH4 = 1024, - QEMU_ARCH_SPARC = 2048, - QEMU_ARCH_XTENSA = 4096, - QEMU_ARCH_OPENRISC = 8192, - QEMU_ARCH_UNICORE32 = 0x4000, -}; - -extern const uint32_t arch_type; - -void select_soundhw(const char *optarg); -void do_acpitable_option(const char *optarg); -void do_smbios_option(const char *optarg); -void cpudef_init(void); -int audio_available(void); -void audio_init(ISABus *isa_bus, PCIBus *pci_bus); -int tcg_available(void); -int kvm_available(void); -int xen_available(void); - -CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp); - -#endif diff --git a/audio/audio.c b/audio/audio.c index eb2222c10f..1510b598a6 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -25,7 +25,7 @@ #include "audio.h" #include "monitor/monitor.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #define AUDIO_CAP "audio" #include "audio_int.h" diff --git a/audio/winwaveaudio.c b/audio/winwaveaudio.c index 72babbf184..8dbd145ca1 100644 --- a/audio/winwaveaudio.c +++ b/audio/winwaveaudio.c @@ -1,7 +1,7 @@ /* public domain */ #include "qemu-common.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "audio.h" #define AUDIO_CAP "winwave" diff --git a/balloon.c b/balloon.c index d1de4352b4..e321f2c688 100644 --- a/balloon.c +++ b/balloon.c @@ -26,8 +26,8 @@ #include "monitor/monitor.h" #include "exec/cpu-common.h" -#include "kvm.h" -#include "balloon.h" +#include "sysemu/kvm.h" +#include "sysemu/balloon.h" #include "trace.h" #include "qmp-commands.h" #include "qapi/qmp/qjson.h" diff --git a/balloon.h b/balloon.h deleted file mode 100644 index bd9d39505d..0000000000 --- a/balloon.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Balloon - * - * Copyright IBM, Corp. 2008 - * - * Authors: - * Anthony Liguori - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#ifndef _QEMU_BALLOON_H -#define _QEMU_BALLOON_H - -#include "monitor/monitor.h" -#include "qapi-types.h" - -typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target); -typedef void (QEMUBalloonStatus)(void *opaque, BalloonInfo *info); - -int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, - QEMUBalloonStatus *stat_func, void *opaque); -void qemu_remove_balloon_handler(void *opaque); - -void qemu_balloon_changed(int64_t actual); - -#endif diff --git a/block-migration.c b/block-migration.c index 4e865a6781..ca4ba3fffb 100644 --- a/block-migration.c +++ b/block-migration.c @@ -20,7 +20,7 @@ #include "qemu/timer.h" #include "migration/block.h" #include "migration/migration.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include #define BLOCK_SIZE (BDRV_SECTORS_PER_DIRTY_CHUNK << BDRV_SECTOR_BITS) diff --git a/block.c b/block.c index 1af4b99ee8..4e28c55bc7 100644 --- a/block.c +++ b/block.c @@ -29,7 +29,7 @@ #include "block/blockjob.h" #include "qemu/module.h" #include "qapi/qmp/qjson.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/notify.h" #include "block/coroutine.h" #include "qmp-commands.h" diff --git a/block/vdi.c b/block/vdi.c index 7b6231941b..021abaa227 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -58,7 +58,7 @@ #include #else /* TODO: move uuid emulation to some central place in QEMU. */ -#include "sysemu.h" /* UUID_FMT */ +#include "sysemu/sysemu.h" /* UUID_FMT */ typedef unsigned char uuid_t[16]; #endif diff --git a/blockdev-nbd.c b/blockdev-nbd.c index 95b621699a..dc4e9a2462 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -9,11 +9,11 @@ * later. See the COPYING file in the top-level directory. */ -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "hw/block-common.h" #include "monitor/monitor.h" #include "qapi/qmp/qerror.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qmp-commands.h" #include "trace.h" #include "block/nbd.h" diff --git a/blockdev.c b/blockdev.c index 3ebff44310..d724e2dc5b 100644 --- a/blockdev.c +++ b/blockdev.c @@ -7,7 +7,7 @@ * later. See the COPYING file in the top-level directory. */ -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "hw/block-common.h" #include "block/blockjob.h" #include "monitor/monitor.h" @@ -15,11 +15,11 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "qapi/qmp/types.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "block/block_int.h" #include "qmp-commands.h" #include "trace.h" -#include "arch_init.h" +#include "sysemu/arch_init.h" static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives); diff --git a/blockdev.h b/blockdev.h deleted file mode 100644 index 1fe533299e..0000000000 --- a/blockdev.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * QEMU host block devices - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * 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 BLOCKDEV_H -#define BLOCKDEV_H - -#include "block/block.h" -#include "qapi/error.h" -#include "qemu/queue.h" - -void blockdev_mark_auto_del(BlockDriverState *bs); -void blockdev_auto_del(BlockDriverState *bs); - -typedef enum { - IF_DEFAULT = -1, /* for use with drive_add() only */ - /* - * IF_IDE must be zero, because we want QEMUMachine member - * block_default_type to default-initialize to IF_IDE - */ - IF_IDE = 0, - IF_NONE, - IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN, - IF_COUNT -} BlockInterfaceType; - -struct DriveInfo { - BlockDriverState *bdrv; - char *id; - const char *devaddr; - BlockInterfaceType type; - int bus; - int unit; - int auto_del; /* see blockdev_mark_auto_del() */ - int media_cd; - int cyls, heads, secs, trans; - QemuOpts *opts; - const char *serial; - QTAILQ_ENTRY(DriveInfo) next; - int refcount; -}; - -DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit); -DriveInfo *drive_get_by_index(BlockInterfaceType type, int index); -int drive_get_max_bus(BlockInterfaceType type); -DriveInfo *drive_get_next(BlockInterfaceType type); -void drive_get_ref(DriveInfo *dinfo); -void drive_put_ref(DriveInfo *dinfo); -DriveInfo *drive_get_by_blockdev(BlockDriverState *bs); - -QemuOpts *drive_def(const char *optstr); -QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file, - const char *optstr); -DriveInfo *drive_init(QemuOpts *arg, BlockInterfaceType block_default_type); - -/* device-hotplug */ - -DriveInfo *add_init_drive(const char *opts); - -void qmp_change_blockdev(const char *device, const char *filename, - bool has_format, const char *format, Error **errp); -void do_commit(Monitor *mon, const QDict *qdict); -int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data); -#endif diff --git a/cpu-exec.c b/cpu-exec.c index 54e62ed551..19ebb4a924 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -21,7 +21,7 @@ #include "disas/disas.h" #include "tcg.h" #include "qemu/atomic.h" -#include "qtest.h" +#include "sysemu/qtest.h" int tb_invalidated_flag; diff --git a/cpus.c b/cpus.c index 036418d62c..4a7782a541 100644 --- a/cpus.c +++ b/cpus.c @@ -26,15 +26,15 @@ #include "config-host.h" #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "exec/gdbstub.h" -#include "dma.h" -#include "kvm.h" +#include "sysemu/dma.h" +#include "sysemu/kvm.h" #include "qmp-commands.h" #include "qemu/thread.h" -#include "cpus.h" -#include "qtest.h" +#include "sysemu/cpus.h" +#include "sysemu/qtest.h" #include "qemu/main-loop.h" #include "qemu/bitmap.h" diff --git a/cpus.h b/cpus.h deleted file mode 100644 index 81bd81773f..0000000000 --- a/cpus.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef QEMU_CPUS_H -#define QEMU_CPUS_H - -/* cpus.c */ -void qemu_init_cpu_loop(void); -void resume_all_vcpus(void); -void pause_all_vcpus(void); -void cpu_stop_current(void); - -void cpu_synchronize_all_states(void); -void cpu_synchronize_all_post_reset(void); -void cpu_synchronize_all_post_init(void); - -void qtest_clock_warp(int64_t dest); - -/* vl.c */ -extern int smp_cores; -extern int smp_threads; -void set_numa_modes(void); -void set_cpu_log(const char *optarg); -void set_cpu_log_filename(const char *optarg); -void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg); - -#endif diff --git a/device_tree.c b/device_tree.c index c3e1ba4904..56af24b397 100644 --- a/device_tree.c +++ b/device_tree.c @@ -20,7 +20,7 @@ #include "config.h" #include "qemu-common.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" #include "hw/loader.h" #include "qemu/option.h" #include "qemu/config-file.h" diff --git a/device_tree.h b/device_tree.h deleted file mode 100644 index f0b3f35e03..0000000000 --- a/device_tree.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Header with function prototypes to help device tree manipulation using - * libfdt. It also provides functions to read entries from device tree proc - * interface. - * - * Copyright 2008 IBM Corporation. - * Authors: Jerone Young - * Hollis Blanchard - * - * This work is licensed under the GNU GPL license version 2 or later. - * - */ - -#ifndef __DEVICE_TREE_H__ -#define __DEVICE_TREE_H__ - -void *create_device_tree(int *sizep); -void *load_device_tree(const char *filename_path, int *sizep); - -int qemu_devtree_setprop(void *fdt, const char *node_path, - const char *property, const void *val_array, int size); -int qemu_devtree_setprop_cell(void *fdt, const char *node_path, - const char *property, uint32_t val); -int qemu_devtree_setprop_u64(void *fdt, const char *node_path, - const char *property, uint64_t val); -int qemu_devtree_setprop_string(void *fdt, const char *node_path, - const char *property, const char *string); -int qemu_devtree_setprop_phandle(void *fdt, const char *node_path, - const char *property, - const char *target_node_path); -const void *qemu_devtree_getprop(void *fdt, const char *node_path, - const char *property, int *lenp); -uint32_t qemu_devtree_getprop_cell(void *fdt, const char *node_path, - const char *property); -uint32_t qemu_devtree_get_phandle(void *fdt, const char *path); -uint32_t qemu_devtree_alloc_phandle(void *fdt); -int qemu_devtree_nop_node(void *fdt, const char *node_path); -int qemu_devtree_add_subnode(void *fdt, const char *name); - -#define qemu_devtree_setprop_cells(fdt, node_path, property, ...) \ - do { \ - uint32_t qdt_tmp[] = { __VA_ARGS__ }; \ - int i; \ - \ - for (i = 0; i < ARRAY_SIZE(qdt_tmp); i++) { \ - qdt_tmp[i] = cpu_to_be32(qdt_tmp[i]); \ - } \ - qemu_devtree_setprop(fdt, node_path, property, qdt_tmp, \ - sizeof(qdt_tmp)); \ - } while (0) - -void qemu_devtree_dumpdtb(void *fdt, int size); - -#endif /* __DEVICE_TREE_H__ */ diff --git a/dma-helpers.c b/dma-helpers.c index e6a6dd82fd..272632f367 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -7,7 +7,7 @@ * (GNU GPL), version 2 or later. */ -#include "dma.h" +#include "sysemu/dma.h" #include "trace.h" #include "qemu/range.h" #include "qemu/thread.h" diff --git a/dma.h b/dma.h deleted file mode 100644 index fd68f74c5b..0000000000 --- a/dma.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * DMA helper functions - * - * Copyright (c) 2009 Red Hat - * - * This work is licensed under the terms of the GNU General Public License - * (GNU GPL), version 2 or later. - */ - -#ifndef DMA_H -#define DMA_H - -#include -#include "exec/memory.h" -#include "hw/hw.h" -#include "block/block.h" -#include "kvm.h" - -typedef struct DMAContext DMAContext; -typedef struct ScatterGatherEntry ScatterGatherEntry; - -typedef enum { - DMA_DIRECTION_TO_DEVICE = 0, - DMA_DIRECTION_FROM_DEVICE = 1, -} DMADirection; - -struct QEMUSGList { - ScatterGatherEntry *sg; - int nsg; - int nalloc; - size_t size; - DMAContext *dma; -}; - -#ifndef CONFIG_USER_ONLY - -/* - * When an IOMMU is present, bus addresses become distinct from - * CPU/memory physical addresses and may be a different size. Because - * the IOVA size depends more on the bus than on the platform, we more - * or less have to treat these as 64-bit always to cover all (or at - * least most) cases. - */ -typedef uint64_t dma_addr_t; - -#define DMA_ADDR_BITS 64 -#define DMA_ADDR_FMT "%" PRIx64 - -typedef int DMATranslateFunc(DMAContext *dma, - dma_addr_t addr, - hwaddr *paddr, - hwaddr *len, - DMADirection dir); -typedef void* DMAMapFunc(DMAContext *dma, - dma_addr_t addr, - dma_addr_t *len, - DMADirection dir); -typedef void DMAUnmapFunc(DMAContext *dma, - void *buffer, - dma_addr_t len, - DMADirection dir, - dma_addr_t access_len); - -struct DMAContext { - AddressSpace *as; - DMATranslateFunc *translate; - DMAMapFunc *map; - DMAUnmapFunc *unmap; -}; - -/* A global DMA context corresponding to the address_space_memory - * AddressSpace, for sysbus devices which do DMA. - */ -extern DMAContext dma_context_memory; - -static inline void dma_barrier(DMAContext *dma, DMADirection dir) -{ - /* - * This is called before DMA read and write operations - * unless the _relaxed form is used and is responsible - * for providing some sane ordering of accesses vs - * concurrently running VCPUs. - * - * Users of map(), unmap() or lower level st/ld_* - * operations are responsible for providing their own - * ordering via barriers. - * - * This primitive implementation does a simple smp_mb() - * before each operation which provides pretty much full - * ordering. - * - * A smarter implementation can be devised if needed to - * use lighter barriers based on the direction of the - * transfer, the DMA context, etc... - */ - if (kvm_enabled()) { - smp_mb(); - } -} - -static inline bool dma_has_iommu(DMAContext *dma) -{ - return dma && dma->translate; -} - -/* Checks that the given range of addresses is valid for DMA. This is - * useful for certain cases, but usually you should just use - * dma_memory_{read,write}() and check for errors */ -bool iommu_dma_memory_valid(DMAContext *dma, dma_addr_t addr, dma_addr_t len, - DMADirection dir); -static inline bool dma_memory_valid(DMAContext *dma, - dma_addr_t addr, dma_addr_t len, - DMADirection dir) -{ - if (!dma_has_iommu(dma)) { - return true; - } else { - return iommu_dma_memory_valid(dma, addr, len, dir); - } -} - -int iommu_dma_memory_rw(DMAContext *dma, dma_addr_t addr, - void *buf, dma_addr_t len, DMADirection dir); -static inline int dma_memory_rw_relaxed(DMAContext *dma, dma_addr_t addr, - void *buf, dma_addr_t len, - DMADirection dir) -{ - if (!dma_has_iommu(dma)) { - /* Fast-path for no IOMMU */ - address_space_rw(dma->as, addr, buf, len, dir == DMA_DIRECTION_FROM_DEVICE); - return 0; - } else { - return iommu_dma_memory_rw(dma, addr, buf, len, dir); - } -} - -static inline int dma_memory_read_relaxed(DMAContext *dma, dma_addr_t addr, - void *buf, dma_addr_t len) -{ - return dma_memory_rw_relaxed(dma, addr, buf, len, DMA_DIRECTION_TO_DEVICE); -} - -static inline int dma_memory_write_relaxed(DMAContext *dma, dma_addr_t addr, - const void *buf, dma_addr_t len) -{ - return dma_memory_rw_relaxed(dma, addr, (void *)buf, len, - DMA_DIRECTION_FROM_DEVICE); -} - -static inline int dma_memory_rw(DMAContext *dma, dma_addr_t addr, - void *buf, dma_addr_t len, - DMADirection dir) -{ - dma_barrier(dma, dir); - - return dma_memory_rw_relaxed(dma, addr, buf, len, dir); -} - -static inline int dma_memory_read(DMAContext *dma, dma_addr_t addr, - void *buf, dma_addr_t len) -{ - return dma_memory_rw(dma, addr, buf, len, DMA_DIRECTION_TO_DEVICE); -} - -static inline int dma_memory_write(DMAContext *dma, dma_addr_t addr, - const void *buf, dma_addr_t len) -{ - return dma_memory_rw(dma, addr, (void *)buf, len, - DMA_DIRECTION_FROM_DEVICE); -} - -int iommu_dma_memory_set(DMAContext *dma, dma_addr_t addr, uint8_t c, - dma_addr_t len); - -int dma_memory_set(DMAContext *dma, dma_addr_t addr, uint8_t c, dma_addr_t len); - -void *iommu_dma_memory_map(DMAContext *dma, - dma_addr_t addr, dma_addr_t *len, - DMADirection dir); -static inline void *dma_memory_map(DMAContext *dma, - dma_addr_t addr, dma_addr_t *len, - DMADirection dir) -{ - if (!dma_has_iommu(dma)) { - hwaddr xlen = *len; - void *p; - - p = address_space_map(dma->as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE); - *len = xlen; - return p; - } else { - return iommu_dma_memory_map(dma, addr, len, dir); - } -} - -void iommu_dma_memory_unmap(DMAContext *dma, - void *buffer, dma_addr_t len, - DMADirection dir, dma_addr_t access_len); -static inline void dma_memory_unmap(DMAContext *dma, - void *buffer, dma_addr_t len, - DMADirection dir, dma_addr_t access_len) -{ - if (!dma_has_iommu(dma)) { - address_space_unmap(dma->as, buffer, (hwaddr)len, - dir == DMA_DIRECTION_FROM_DEVICE, access_len); - } else { - iommu_dma_memory_unmap(dma, buffer, len, dir, access_len); - } -} - -#define DEFINE_LDST_DMA(_lname, _sname, _bits, _end) \ - static inline uint##_bits##_t ld##_lname##_##_end##_dma(DMAContext *dma, \ - dma_addr_t addr) \ - { \ - uint##_bits##_t val; \ - dma_memory_read(dma, addr, &val, (_bits) / 8); \ - return _end##_bits##_to_cpu(val); \ - } \ - static inline void st##_sname##_##_end##_dma(DMAContext *dma, \ - dma_addr_t addr, \ - uint##_bits##_t val) \ - { \ - val = cpu_to_##_end##_bits(val); \ - dma_memory_write(dma, addr, &val, (_bits) / 8); \ - } - -static inline uint8_t ldub_dma(DMAContext *dma, dma_addr_t addr) -{ - uint8_t val; - - dma_memory_read(dma, addr, &val, 1); - return val; -} - -static inline void stb_dma(DMAContext *dma, dma_addr_t addr, uint8_t val) -{ - dma_memory_write(dma, addr, &val, 1); -} - -DEFINE_LDST_DMA(uw, w, 16, le); -DEFINE_LDST_DMA(l, l, 32, le); -DEFINE_LDST_DMA(q, q, 64, le); -DEFINE_LDST_DMA(uw, w, 16, be); -DEFINE_LDST_DMA(l, l, 32, be); -DEFINE_LDST_DMA(q, q, 64, be); - -#undef DEFINE_LDST_DMA - -void dma_context_init(DMAContext *dma, AddressSpace *as, DMATranslateFunc translate, - DMAMapFunc map, DMAUnmapFunc unmap); - -struct ScatterGatherEntry { - dma_addr_t base; - dma_addr_t len; -}; - -void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint, DMAContext *dma); -void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len); -void qemu_sglist_destroy(QEMUSGList *qsg); -#endif - -typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num, - QEMUIOVector *iov, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque); - -BlockDriverAIOCB *dma_bdrv_io(BlockDriverState *bs, - QEMUSGList *sg, uint64_t sector_num, - DMAIOFunc *io_func, BlockDriverCompletionFunc *cb, - void *opaque, DMADirection dir); -BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs, - QEMUSGList *sg, uint64_t sector, - BlockDriverCompletionFunc *cb, void *opaque); -BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs, - QEMUSGList *sg, uint64_t sector, - BlockDriverCompletionFunc *cb, void *opaque); -uint64_t dma_buf_read(uint8_t *ptr, int32_t len, QEMUSGList *sg); -uint64_t dma_buf_write(uint8_t *ptr, int32_t len, QEMUSGList *sg); - -void dma_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie, - QEMUSGList *sg, enum BlockAcctType type); - -#endif diff --git a/dump-stub.c b/dump-stub.c index 0842e6f916..a9d0b3c67b 100644 --- a/dump-stub.c +++ b/dump-stub.c @@ -12,7 +12,7 @@ */ #include "qemu-common.h" -#include "dump.h" +#include "sysemu/dump.h" #include "qapi/qmp/qerror.h" #include "qmp-commands.h" diff --git a/dump.c b/dump.c index 871ee1727a..a26b1a5e1a 100644 --- a/dump.c +++ b/dump.c @@ -17,10 +17,10 @@ #include "exec/cpu-all.h" #include "exec/hwaddr.h" #include "monitor/monitor.h" -#include "kvm.h" -#include "dump.h" -#include "sysemu.h" -#include "memory_mapping.h" +#include "sysemu/kvm.h" +#include "sysemu/dump.h" +#include "sysemu/sysemu.h" +#include "sysemu/memory_mapping.h" #include "qapi/error.h" #include "qmp-commands.h" #include "exec/gdbstub.h" diff --git a/dump.h b/dump.h deleted file mode 100644 index e25b7cfb73..0000000000 --- a/dump.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * QEMU dump - * - * Copyright Fujitsu, Corp. 2011, 2012 - * - * Authors: - * Wen Congyang - * - * 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 DUMP_H -#define DUMP_H - -typedef struct ArchDumpInfo { - int d_machine; /* Architecture */ - int d_endian; /* ELFDATA2LSB or ELFDATA2MSB */ - int d_class; /* ELFCLASS32 or ELFCLASS64 */ -} ArchDumpInfo; - -typedef int (*write_core_dump_function)(void *buf, size_t size, void *opaque); -int cpu_write_elf64_note(write_core_dump_function f, CPUArchState *env, - int cpuid, void *opaque); -int cpu_write_elf32_note(write_core_dump_function f, CPUArchState *env, - int cpuid, void *opaque); -int cpu_write_elf64_qemunote(write_core_dump_function f, CPUArchState *env, - void *opaque); -int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env, - void *opaque); -int cpu_get_dump_info(ArchDumpInfo *info); -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus); - -#endif diff --git a/exec.c b/exec.c index 917bec0ecd..28abd7e710 100644 --- a/exec.c +++ b/exec.c @@ -30,17 +30,17 @@ #include "hw/hw.h" #include "hw/qdev.h" #include "qemu/osdep.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "hw/xen.h" #include "qemu/timer.h" #include "qemu/config-file.h" #include "exec/memory.h" -#include "dma.h" +#include "sysemu/dma.h" #include "exec/address-spaces.h" #if defined(CONFIG_USER_ONLY) #include #else /* !CONFIG_USER_ONLY */ -#include "xen-mapcache.h" +#include "sysemu/xen-mapcache.h" #include "trace.h" #endif diff --git a/gdbstub.c b/gdbstub.c index 4b178a608f..2fca1a7ebf 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -31,7 +31,7 @@ #else #include "monitor/monitor.h" #include "qemu-char.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "exec/gdbstub.h" #endif @@ -39,7 +39,7 @@ #include "cpu.h" #include "qemu/sockets.h" -#include "kvm.h" +#include "sysemu/kvm.h" #ifndef TARGET_CPU_MEMORY_RW_DEBUG static inline int target_memory_rw_debug(CPUArchState *env, target_ulong addr, diff --git a/hw/ac97.c b/hw/ac97.c index 3e659b38df..5cd19c1d02 100644 --- a/hw/ac97.c +++ b/hw/ac97.c @@ -21,7 +21,7 @@ #include "audiodev.h" #include "audio/audio.h" #include "pci/pci.h" -#include "dma.h" +#include "sysemu/dma.h" enum { AC97_Reset = 0x00, diff --git a/hw/acpi.c b/hw/acpi.c index fe9b76a9b0..97617c4ef5 100644 --- a/hw/acpi.c +++ b/hw/acpi.c @@ -18,7 +18,7 @@ * Contributions after 2012-01-13 are licensed under the terms of the * GNU GPL, version 2 or (at your option) any later version. */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "hw.h" #include "pc.h" #include "acpi.h" diff --git a/hw/acpi_ich9.c b/hw/acpi_ich9.c index 8d1a689a36..37a50e6d7b 100644 --- a/hw/acpi_ich9.c +++ b/hw/acpi_ich9.c @@ -27,9 +27,9 @@ #include "pc.h" #include "pci/pci.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "acpi.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "exec/address-spaces.h" #include "ich9.h" diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index ebd015dc02..f53b969aa6 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -24,7 +24,7 @@ #include "pm_smbus.h" #include "pci/pci.h" #include "acpi.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/range.h" #include "exec/ioport.h" #include "fw_cfg.h" diff --git a/hw/alpha_dp264.c b/hw/alpha_dp264.c index 76d8ae8a84..e7e52c1f1c 100644 --- a/hw/alpha_dp264.c +++ b/hw/alpha_dp264.c @@ -11,7 +11,7 @@ #include "loader.h" #include "boards.h" #include "alpha_sys.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "mc146818rtc.h" #include "ide.h" #include "i8254.h" diff --git a/hw/alpha_pci.c b/hw/alpha_pci.c index 78d93e55ec..7327d488fd 100644 --- a/hw/alpha_pci.c +++ b/hw/alpha_pci.c @@ -9,7 +9,7 @@ #include "config.h" #include "alpha_sys.h" #include "qemu/log.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" /* PCI IO reads/writes, to byte-word addressable memory. */ diff --git a/hw/alpha_typhoon.c b/hw/alpha_typhoon.c index d61b2f483c..9f233d99f5 100644 --- a/hw/alpha_typhoon.c +++ b/hw/alpha_typhoon.c @@ -10,7 +10,7 @@ #include "exec/exec-all.h" #include "hw.h" #include "devices.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "alpha_sys.h" #include "exec/address-spaces.h" diff --git a/hw/apb_pci.c b/hw/apb_pci.c index 144a7cc8d3..c22e2b0fc3 100644 --- a/hw/apb_pci.c +++ b/hw/apb_pci.c @@ -32,7 +32,7 @@ #include "pci/pci_bridge.h" #include "pci/pci_bus.h" #include "apb_pci.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "exec/address-spaces.h" /* debug APB */ diff --git a/hw/apic_common.c b/hw/apic_common.c index 5f542764eb..0658be93c1 100644 --- a/hw/apic_common.c +++ b/hw/apic_common.c @@ -20,7 +20,7 @@ #include "apic.h" #include "apic_internal.h" #include "trace.h" -#include "kvm.h" +#include "sysemu/kvm.h" static int apic_irq_delivered; bool apic_report_tpr_access; diff --git a/hw/arm_boot.c b/hw/arm_boot.c index bb9889fbef..115f583876 100644 --- a/hw/arm_boot.c +++ b/hw/arm_boot.c @@ -10,11 +10,11 @@ #include "config.h" #include "hw.h" #include "arm-misc.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "loader.h" #include "elf.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" #include "qemu/config-file.h" #define KERNEL_ARGS_ADDR 0x100 diff --git a/hw/arm_sysctl.c b/hw/arm_sysctl.c index 0884f6275c..b733617aa0 100644 --- a/hw/arm_sysctl.c +++ b/hw/arm_sysctl.c @@ -11,7 +11,7 @@ #include "qemu/timer.h" #include "sysbus.h" #include "primecell.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #define LOCK_VALUE 0xa05f diff --git a/hw/axis_dev88.c b/hw/axis_dev88.c index e537aecc78..2ca606b835 100644 --- a/hw/axis_dev88.c +++ b/hw/axis_dev88.c @@ -30,7 +30,7 @@ #include "loader.h" #include "elf.h" #include "cris-boot.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #define D(x) diff --git a/hw/block-common.c b/hw/block-common.c index c24208e560..0f1b64ec95 100644 --- a/hw/block-common.c +++ b/hw/block-common.c @@ -7,7 +7,7 @@ * later. See the COPYING file in the top-level directory. */ -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "hw/block-common.h" #include "qemu/error-report.h" diff --git a/hw/boards.h b/hw/boards.h index c66fa16a9d..4540e952f7 100644 --- a/hw/boards.h +++ b/hw/boards.h @@ -3,7 +3,7 @@ #ifndef HW_BOARDS_H #define HW_BOARDS_H -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "qdev.h" typedef struct QEMUMachineInitArgs { diff --git a/hw/bonito.c b/hw/bonito.c index 78e264ccc0..0498c9be79 100644 --- a/hw/bonito.c +++ b/hw/bonito.c @@ -44,7 +44,7 @@ #include "pc.h" #include "mips.h" #include "pci/pci_host.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "exec/address-spaces.h" //#define DEBUG_BONITO diff --git a/hw/cbus.c b/hw/cbus.c index 7216899a09..6fd3905448 100644 --- a/hw/cbus.c +++ b/hw/cbus.c @@ -23,7 +23,7 @@ #include "qemu-common.h" #include "irq.h" #include "devices.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" //#define DEBUG diff --git a/hw/collie.c b/hw/collie.c index faf5ac9ac7..804d61a421 100644 --- a/hw/collie.c +++ b/hw/collie.c @@ -15,7 +15,7 @@ #include "strongarm.h" #include "arm-misc.h" #include "flash.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" static struct arm_boot_info collie_binfo = { diff --git a/hw/cuda.c b/hw/cuda.c index cf83956e1a..d59e0aeaa9 100644 --- a/hw/cuda.c +++ b/hw/cuda.c @@ -26,7 +26,7 @@ #include "ppc_mac.h" #include "adb.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" /* XXX: implement all timer modes */ diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c index 34543786e5..88da145a89 100644 --- a/hw/device-hotplug.c +++ b/hw/device-hotplug.c @@ -24,9 +24,9 @@ #include "hw.h" #include "boards.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "qemu/config-file.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "monitor/monitor.h" DriveInfo *add_init_drive(const char *optstr) diff --git a/hw/e1000.c b/hw/e1000.c index aeee3e61f4..92fb00a89f 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -30,8 +30,8 @@ #include "net/net.h" #include "net/checksum.h" #include "loader.h" -#include "sysemu.h" -#include "dma.h" +#include "sysemu/sysemu.h" +#include "sysemu/dma.h" #include "e1000_hw.h" diff --git a/hw/eepro100.c b/hw/eepro100.c index 9e2be4ea0d..6bbefb505f 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -45,8 +45,8 @@ #include "pci/pci.h" #include "net/net.h" #include "eeprom93xx.h" -#include "sysemu.h" -#include "dma.h" +#include "sysemu/sysemu.h" +#include "sysemu/dma.h" /* QEMU sends frames smaller than 60 bytes to ethernet nics. * Such frames are rejected by real nics and their emulations. diff --git a/hw/es1370.c b/hw/es1370.c index 65365788e1..59c3f2329e 100644 --- a/hw/es1370.c +++ b/hw/es1370.c @@ -30,7 +30,7 @@ #include "audiodev.h" #include "audio/audio.h" #include "pci/pci.h" -#include "dma.h" +#include "sysemu/dma.h" /* Missing stuff: SCTRL_P[12](END|ST)INC diff --git a/hw/etraxfs_dma.c b/hw/etraxfs_dma.c index 089267fcc1..d41500316f 100644 --- a/hw/etraxfs_dma.c +++ b/hw/etraxfs_dma.c @@ -26,7 +26,7 @@ #include "hw.h" #include "exec/address-spaces.h" #include "qemu-common.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "etraxfs_dma.h" diff --git a/hw/etraxfs_timer.c b/hw/etraxfs_timer.c index cc8b327715..e9273cd95d 100644 --- a/hw/etraxfs_timer.c +++ b/hw/etraxfs_timer.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/timer.h" #include "ptimer.h" diff --git a/hw/exynos4210.c b/hw/exynos4210.c index 22148cd946..a7b84d61a0 100644 --- a/hw/exynos4210.c +++ b/hw/exynos4210.c @@ -22,7 +22,7 @@ */ #include "boards.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sysbus.h" #include "arm-misc.h" #include "loader.h" diff --git a/hw/exynos4210_rtc.c b/hw/exynos4210_rtc.c index 6ebc9b1790..5694a6207b 100644 --- a/hw/exynos4210_rtc.c +++ b/hw/exynos4210_rtc.c @@ -32,7 +32,7 @@ #include "hw.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "exynos4210.h" diff --git a/hw/exynos4210_uart.c b/hw/exynos4210_uart.c index 20dcd9fb57..8950891a00 100644 --- a/hw/exynos4210_uart.c +++ b/hw/exynos4210_uart.c @@ -20,7 +20,7 @@ */ #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu-char.h" #include "exynos4210.h" diff --git a/hw/exynos4_boards.c b/hw/exynos4_boards.c index 5dd2961459..b26796847b 100644 --- a/hw/exynos4_boards.c +++ b/hw/exynos4_boards.c @@ -21,7 +21,7 @@ * */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sysbus.h" #include "net/net.h" #include "arm-misc.h" diff --git a/hw/fdc.c b/hw/fdc.c index b67d3a574b..ddc0cc3819 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -34,8 +34,8 @@ #include "isa.h" #include "sysbus.h" #include "qdev-addr.h" -#include "blockdev.h" -#include "sysemu.h" +#include "sysemu/blockdev.h" +#include "sysemu/sysemu.h" #include "qemu/log.h" /********************************************************/ diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c index 2a00163a04..26f7125fe2 100644 --- a/hw/fw_cfg.c +++ b/hw/fw_cfg.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ #include "hw.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "isa.h" #include "fw_cfg.h" #include "sysbus.h" diff --git a/hw/gumstix.c b/hw/gumstix.c index 4acb32c2a9..6fb068386c 100644 --- a/hw/gumstix.c +++ b/hw/gumstix.c @@ -40,7 +40,7 @@ #include "flash.h" #include "devices.h" #include "boards.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" static const int sector_len = 128 * 1024; diff --git a/hw/highbank.c b/hw/highbank.c index 6f5f2a9d9d..6005622f3a 100644 --- a/hw/highbank.c +++ b/hw/highbank.c @@ -22,10 +22,10 @@ #include "devices.h" #include "loader.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "sysbus.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #define SMP_BOOT_ADDR 0x100 diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index d38c6e4574..d0724499c7 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -28,7 +28,7 @@ #include #include "monitor/monitor.h" -#include "dma.h" +#include "sysemu/dma.h" #include "exec/cpu-common.h" #include "internal.h" #include diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index f6d15b9f2a..ee855b670f 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -27,8 +27,8 @@ #include #include #include "block/block.h" -#include "sysemu.h" -#include "dma.h" +#include "sysemu/sysemu.h" +#include "sysemu/dma.h" #include diff --git a/hw/ide/core.c b/hw/ide/core.c index bf65cb407e..6f1938a0a8 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -28,10 +28,10 @@ #include #include "qemu/error-report.h" #include "qemu/timer.h" -#include "sysemu.h" -#include "dma.h" +#include "sysemu/sysemu.h" +#include "sysemu/dma.h" #include "hw/block-common.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include diff --git a/hw/ide/ich.c b/hw/ide/ich.c index 3457b98cc1..de39b3067a 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -66,7 +66,7 @@ #include #include #include "block/block.h" -#include "dma.h" +#include "sysemu/dma.h" #include #include diff --git a/hw/ide/internal.h b/hw/ide/internal.h index c5016f0cea..d80360e85b 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -9,8 +9,8 @@ #include #include #include "exec/iorange.h" -#include "dma.h" -#include "sysemu.h" +#include "sysemu/dma.h" +#include "sysemu/sysemu.h" #include "hw/block-common.h" #include "hw/scsi-defs.h" diff --git a/hw/ide/isa.c b/hw/ide/isa.c index 39df87c608..aa0e7fa22d 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -26,7 +26,7 @@ #include #include #include "block/block.h" -#include "dma.h" +#include "sysemu/dma.h" #include diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 87cbb0c31e..d8f9b4bce1 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -26,7 +26,7 @@ #include #include #include "block/block.h" -#include "dma.h" +#include "sysemu/dma.h" #include diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c index 6cce5230c5..642774ef98 100644 --- a/hw/ide/microdrive.c +++ b/hw/ide/microdrive.c @@ -26,7 +26,7 @@ #include #include #include "block/block.h" -#include "dma.h" +#include "sysemu/dma.h" #include diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c index 40443513be..eb59976eda 100644 --- a/hw/ide/mmio.c +++ b/hw/ide/mmio.c @@ -24,7 +24,7 @@ */ #include #include "block/block.h" -#include "dma.h" +#include "sysemu/dma.h" #include diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 8821d5cceb..e6226e3197 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -27,7 +27,7 @@ #include #include #include "block/block.h" -#include "dma.h" +#include "sysemu/dma.h" #include diff --git a/hw/ide/piix.c b/hw/ide/piix.c index 5cf39cf8f0..df95aec195 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -27,9 +27,9 @@ #include #include #include -#include "blockdev.h" -#include "sysemu.h" -#include "dma.h" +#include "sysemu/blockdev.h" +#include "sysemu/sysemu.h" +#include "sysemu/dma.h" #include diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index c85e1ac018..d2fe77398f 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -17,12 +17,12 @@ * License along with this library; if not, see . */ #include -#include "dma.h" +#include "sysemu/dma.h" #include "qemu/error-report.h" #include -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "hw/block-common.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" /* --------------------------------- */ diff --git a/hw/ide/via.c b/hw/ide/via.c index 880f61cc8e..14acb3ac04 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -28,8 +28,8 @@ #include #include #include "block/block.h" -#include "sysemu.h" -#include "dma.h" +#include "sysemu/sysemu.h" +#include "sysemu/dma.h" #include diff --git a/hw/imx_ccm.c b/hw/imx_ccm.c index f2e623cd29..46962e4df9 100644 --- a/hw/imx_ccm.c +++ b/hw/imx_ccm.c @@ -12,7 +12,7 @@ #include "hw.h" #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "imx.h" #define CKIH_FREQ 26000000 /* 26MHz crystal input */ diff --git a/hw/imx_serial.c b/hw/imx_serial.c index dcd125fd25..e56e3ea726 100644 --- a/hw/imx_serial.c +++ b/hw/imx_serial.c @@ -19,7 +19,7 @@ #include "hw.h" #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu-char.h" #include "imx.h" diff --git a/hw/integratorcp.c b/hw/integratorcp.c index c995dc724f..47fc9cb944 100644 --- a/hw/integratorcp.c +++ b/hw/integratorcp.c @@ -13,7 +13,7 @@ #include "arm-misc.h" #include "net/net.h" #include "exec/address-spaces.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" typedef struct { SysBusDevice busdev; diff --git a/hw/intel-hda.c b/hw/intel-hda.c index 7ef3a15e08..98ff93679d 100644 --- a/hw/intel-hda.c +++ b/hw/intel-hda.c @@ -24,7 +24,7 @@ #include "audiodev.h" #include "intel-hda.h" #include "intel-hda-defs.h" -#include "dma.h" +#include "sysemu/dma.h" /* --------------------------------------------------------------------- */ /* hda bus */ diff --git a/hw/isa-bus.c b/hw/isa-bus.c index a2be67df56..86b0bbd3d1 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -19,7 +19,7 @@ #include "hw.h" #include "monitor/monitor.h" #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "isa.h" #include "exec/address-spaces.h" diff --git a/hw/ivshmem.c b/hw/ivshmem.c index af34f3b582..567c9a76a7 100644 --- a/hw/ivshmem.c +++ b/hw/ivshmem.c @@ -20,7 +20,7 @@ #include "pc.h" #include "pci/pci.h" #include "pci/msix.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "migration/migration.h" #include "qapi/qmp/qerror.h" #include "qemu/event_notifier.h" diff --git a/hw/kvm/apic.c b/hw/kvm/apic.c index beb418de8d..dad2f21c18 100644 --- a/hw/kvm/apic.c +++ b/hw/kvm/apic.c @@ -11,7 +11,7 @@ */ #include "hw/apic_internal.h" #include "hw/pci/msi.h" -#include "kvm.h" +#include "sysemu/kvm.h" static inline void kvm_apic_set_reg(struct kvm_lapic_state *kapic, int reg_id, uint32_t val) diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c index 824b978397..6fcca95ada 100644 --- a/hw/kvm/clock.c +++ b/hw/kvm/clock.c @@ -14,8 +14,8 @@ */ #include "qemu-common.h" -#include "sysemu.h" -#include "kvm.h" +#include "sysemu/sysemu.h" +#include "sysemu/kvm.h" #include "hw/sysbus.h" #include "hw/kvm/clock.h" diff --git a/hw/kvm/i8254.c b/hw/kvm/i8254.c index 8ee1c352cf..57faf64ab2 100644 --- a/hw/kvm/i8254.c +++ b/hw/kvm/i8254.c @@ -23,10 +23,10 @@ * THE SOFTWARE. */ #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "hw/i8254.h" #include "hw/i8254_internal.h" -#include "kvm.h" +#include "sysemu/kvm.h" #define KVM_PIT_REINJECT_BIT 0 diff --git a/hw/kvm/i8259.c b/hw/kvm/i8259.c index 1e24cd4f36..70e1d185de 100644 --- a/hw/kvm/i8259.c +++ b/hw/kvm/i8259.c @@ -11,7 +11,7 @@ */ #include "hw/i8259_internal.h" #include "hw/apic_internal.h" -#include "kvm.h" +#include "sysemu/kvm.h" static void kvm_pic_get(PICCommonState *s) { diff --git a/hw/kvm/ioapic.c b/hw/kvm/ioapic.c index f95c157591..30db6230b4 100644 --- a/hw/kvm/ioapic.c +++ b/hw/kvm/ioapic.c @@ -13,7 +13,7 @@ #include "hw/pc.h" #include "hw/ioapic_internal.h" #include "hw/apic_internal.h" -#include "kvm.h" +#include "sysemu/kvm.h" /* PC Utility function */ void kvm_pc_setup_irq_routing(bool pci_enabled) diff --git a/hw/kvm/pci-assign.c b/hw/kvm/pci-assign.c index 2f06c27e83..410b6c6eeb 100644 --- a/hw/kvm/pci-assign.c +++ b/hw/kvm/pci-assign.c @@ -33,7 +33,7 @@ #include "hw/loader.h" #include "monitor/monitor.h" #include "qemu/range.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "hw/pci/pci.h" #include "hw/pci/msi.h" #include "kvm_i386.h" diff --git a/hw/kvmvapic.c b/hw/kvmvapic.c index 60c8fc46aa..81f4bcfdf6 100644 --- a/hw/kvmvapic.c +++ b/hw/kvmvapic.c @@ -8,9 +8,9 @@ * (at your option) any later version. See the COPYING file in the * top-level directory. */ -#include "sysemu.h" -#include "cpus.h" -#include "kvm.h" +#include "sysemu/sysemu.h" +#include "sysemu/cpus.h" +#include "sysemu/kvm.h" #include "apic_internal.h" #define APIC_DEFAULT_ADDRESS 0xfee00000 diff --git a/hw/kzm.c b/hw/kzm.c index 9f92d30928..fd00af921e 100644 --- a/hw/kzm.c +++ b/hw/kzm.c @@ -19,7 +19,7 @@ #include "arm-misc.h" #include "devices.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "serial.h" #include "imx.h" diff --git a/hw/lan9118.c b/hw/lan9118.c index 4c72d0d98e..5adf91199b 100644 --- a/hw/lan9118.c +++ b/hw/lan9118.c @@ -13,7 +13,7 @@ #include "sysbus.h" #include "net/net.h" #include "devices.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "ptimer.h" /* For crc32 */ #include diff --git a/hw/leon3.c b/hw/leon3.c index 776ab97a78..d1d4541867 100644 --- a/hw/leon3.c +++ b/hw/leon3.c @@ -25,7 +25,7 @@ #include "qemu/timer.h" #include "ptimer.h" #include "qemu-char.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "loader.h" #include "elf.h" diff --git a/hw/lm32_boards.c b/hw/lm32_boards.c index 81afdf675c..42e8b6b52a 100644 --- a/hw/lm32_boards.c +++ b/hw/lm32_boards.c @@ -23,7 +23,7 @@ #include "devices.h" #include "boards.h" #include "loader.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "elf.h" #include "lm32_hwsetup.h" #include "lm32.h" diff --git a/hw/lm32_sys.c b/hw/lm32_sys.c index b3350890cb..e3a9db9748 100644 --- a/hw/lm32_sys.c +++ b/hw/lm32_sys.c @@ -33,7 +33,7 @@ #include "trace.h" #include "qemu/log.h" #include "qemu/error-report.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/log.h" enum { diff --git a/hw/loader.c b/hw/loader.c index f5ef575b52..3f59fcd14a 100644 --- a/hw/loader.c +++ b/hw/loader.c @@ -45,7 +45,7 @@ #include "hw.h" #include "disas/disas.h" #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "uboot_image.h" #include "loader.h" #include "fw_cfg.h" diff --git a/hw/lpc_ich9.c b/hw/lpc_ich9.c index 76217a74fc..a068715c04 100644 --- a/hw/lpc_ich9.c +++ b/hw/lpc_ich9.c @@ -44,7 +44,7 @@ #include "pam.h" #include "pci/pci_bus.h" #include "exec/address-spaces.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" static int ich9_lpc_sci_irq(ICH9LPCState *lpc); diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 4aac9a0cff..0aafb00b58 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -15,7 +15,7 @@ #include "hw.h" #include "pci/pci.h" #include "scsi.h" -#include "dma.h" +#include "sysemu/dma.h" //#define DEBUG_LSI //#define DEBUG_LSI_REG diff --git a/hw/m25p80.c b/hw/m25p80.c index 3895e73957..d39265632b 100644 --- a/hw/m25p80.c +++ b/hw/m25p80.c @@ -22,7 +22,7 @@ */ #include "hw.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "ssi.h" #include "devices.h" diff --git a/hw/m48t59.c b/hw/m48t59.c index 301b10ce79..393c5c049a 100644 --- a/hw/m48t59.c +++ b/hw/m48t59.c @@ -24,7 +24,7 @@ #include "hw.h" #include "nvram.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sysbus.h" #include "isa.h" #include "exec/address-spaces.h" diff --git a/hw/mac_nvram.c b/hw/mac_nvram.c index a0d14dd3c5..71093c2b10 100644 --- a/hw/mac_nvram.c +++ b/hw/mac_nvram.c @@ -24,7 +24,7 @@ */ #include "hw.h" #include "firmware_abi.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "ppc_mac.h" /* debug NVR */ diff --git a/hw/mainstone.c b/hw/mainstone.c index 80d6a9d54d..a5ddbeff9d 100644 --- a/hw/mainstone.c +++ b/hw/mainstone.c @@ -18,7 +18,7 @@ #include "devices.h" #include "boards.h" #include "flash.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "sysbus.h" #include "exec/address-spaces.h" diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index fba75029df..2ddd7de09e 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -23,7 +23,7 @@ */ #include "hw.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "mc146818rtc.h" #include "qapi/visitor.h" diff --git a/hw/mcf5206.c b/hw/mcf5206.c index fbc806ac18..fe7a48864f 100644 --- a/hw/mcf5206.c +++ b/hw/mcf5206.c @@ -9,7 +9,7 @@ #include "mcf.h" #include "qemu/timer.h" #include "ptimer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "exec/address-spaces.h" /* General purpose timer module. */ diff --git a/hw/mcf5208.c b/hw/mcf5208.c index fea8a69262..c1816cc9d1 100644 --- a/hw/mcf5208.c +++ b/hw/mcf5208.c @@ -9,7 +9,7 @@ #include "mcf.h" #include "qemu/timer.h" #include "ptimer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "net/net.h" #include "boards.h" #include "loader.h" diff --git a/hw/megasas.c b/hw/megasas.c index e80c0d1c25..eb191f5e12 100644 --- a/hw/megasas.c +++ b/hw/megasas.c @@ -20,7 +20,7 @@ #include "hw.h" #include "pci/pci.h" -#include "dma.h" +#include "sysemu/dma.h" #include "pci/msix.h" #include "qemu/iov.h" #include "scsi.h" diff --git a/hw/microblaze_boot.c b/hw/microblaze_boot.c index 76d33021c0..3ec5c0f7dd 100644 --- a/hw/microblaze_boot.c +++ b/hw/microblaze_boot.c @@ -27,7 +27,7 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "qemu-common.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" #include "loader.h" #include "elf.h" diff --git a/hw/milkymist-memcard.c b/hw/milkymist-memcard.c index 5dc30ace60..f80befc53a 100644 --- a/hw/milkymist-memcard.c +++ b/hw/milkymist-memcard.c @@ -23,10 +23,10 @@ #include "hw.h" #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "trace.h" #include "qemu/error-report.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "sd.h" enum { diff --git a/hw/milkymist-sysctl.c b/hw/milkymist-sysctl.c index 519462afcc..796e795f04 100644 --- a/hw/milkymist-sysctl.c +++ b/hw/milkymist-sysctl.c @@ -23,7 +23,7 @@ #include "hw.h" #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "trace.h" #include "qemu/timer.h" #include "ptimer.h" diff --git a/hw/milkymist.c b/hw/milkymist.c index 588522260b..0c23b672f3 100644 --- a/hw/milkymist.c +++ b/hw/milkymist.c @@ -20,12 +20,12 @@ #include "sysbus.h" #include "hw.h" #include "flash.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "devices.h" #include "boards.h" #include "loader.h" #include "elf.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "milkymist-hw.h" #include "lm32.h" #include "exec/address-spaces.h" diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c index 60dd8c69bb..e7eeda319e 100644 --- a/hw/mips_fulong2e.c +++ b/hw/mips_fulong2e.c @@ -31,7 +31,7 @@ #include "mips_cpudevs.h" #include "pci/pci.h" #include "qemu-char.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "audio/audio.h" #include "qemu/log.h" #include "loader.h" @@ -41,7 +41,7 @@ #include "vt82c686.h" #include "mc146818rtc.h" #include "i8254.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #define DEBUG_FULONG2E_INIT diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c index 0befc99210..63df2a734b 100644 --- a/hw/mips_jazz.c +++ b/hw/mips_jazz.c @@ -29,8 +29,8 @@ #include "serial.h" #include "isa.h" #include "fdc.h" -#include "sysemu.h" -#include "arch_init.h" +#include "sysemu/sysemu.h" +#include "sysemu/arch_init.h" #include "boards.h" #include "net/net.h" #include "esp.h" @@ -39,7 +39,7 @@ #include "mc146818rtc.h" #include "i8254.h" #include "pcspk.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "sysbus.h" #include "exec/address-spaces.h" diff --git a/hw/mips_malta.c b/hw/mips_malta.c index 04c7a2612c..bd31ced29d 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -35,8 +35,8 @@ #include "mips_cpudevs.h" #include "pci/pci.h" #include "qemu-char.h" -#include "sysemu.h" -#include "arch_init.h" +#include "sysemu/sysemu.h" +#include "sysemu/arch_init.h" #include "boards.h" #include "qemu/log.h" #include "mips-bios.h" @@ -45,7 +45,7 @@ #include "elf.h" #include "mc146818rtc.h" #include "i8254.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysbus.h" /* SysBusDevice */ diff --git a/hw/mips_mipssim.c b/hw/mips_mipssim.c index ac7dfa9b74..67066c0ca1 100644 --- a/hw/mips_mipssim.c +++ b/hw/mips_mipssim.c @@ -30,7 +30,7 @@ #include "serial.h" #include "isa.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "mips-bios.h" #include "loader.h" diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c index 511e1e41c0..59c43e591c 100644 --- a/hw/mips_r4k.c +++ b/hw/mips_r4k.c @@ -14,7 +14,7 @@ #include "serial.h" #include "isa.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "flash.h" #include "qemu/log.h" @@ -24,7 +24,7 @@ #include "elf.h" #include "mc146818rtc.h" #include "i8254.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #define MAX_IDE_BUS 2 diff --git a/hw/mpc8544_guts.c b/hw/mpc8544_guts.c index 873cb8cbfc..84522e9722 100644 --- a/hw/mpc8544_guts.c +++ b/hw/mpc8544_guts.c @@ -18,7 +18,7 @@ */ #include "hw.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sysbus.h" #define MPC8544_GUTS_MMIO_SIZE 0x1000 diff --git a/hw/multiboot.c b/hw/multiboot.c index 09ec5b2539..c4ec2e34a7 100644 --- a/hw/multiboot.c +++ b/hw/multiboot.c @@ -27,7 +27,7 @@ #include "multiboot.h" #include "loader.h" #include "elf.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" /* Show multiboot debug output */ //#define DEBUG_MULTIBOOT diff --git a/hw/musicpal.c b/hw/musicpal.c index 5a7bf8bee1..77a585eee6 100644 --- a/hw/musicpal.c +++ b/hw/musicpal.c @@ -13,7 +13,7 @@ #include "arm-misc.h" #include "devices.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "serial.h" #include "qemu/timer.h" @@ -22,7 +22,7 @@ #include "flash.h" #include "ui/console.h" #include "i2c.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "ui/pixel_ops.h" diff --git a/hw/nand.c b/hw/nand.c index a73205d866..16950c5ec4 100644 --- a/hw/nand.c +++ b/hw/nand.c @@ -20,7 +20,7 @@ # include "hw.h" # include "flash.h" -# include "blockdev.h" +# include "sysemu/blockdev.h" # include "sysbus.h" #include "qemu/error-report.h" diff --git a/hw/ne2000.c b/hw/ne2000.c index 2001264e14..00efa74a0f 100644 --- a/hw/ne2000.c +++ b/hw/ne2000.c @@ -26,7 +26,7 @@ #include "net/net.h" #include "ne2000.h" #include "loader.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" /* debug NE2000 card */ //#define DEBUG_NE2000 diff --git a/hw/nseries.c b/hw/nseries.c index 83adb97211..d96b750ccd 100644 --- a/hw/nseries.c +++ b/hw/nseries.c @@ -19,7 +19,7 @@ */ #include "qemu-common.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "omap.h" #include "arm-misc.h" #include "irq.h" @@ -31,7 +31,7 @@ #include "hw.h" #include "bt.h" #include "loader.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "sysbus.h" #include "exec/address-spaces.h" diff --git a/hw/omap1.c b/hw/omap1.c index 50c4570f31..8536e96687 100644 --- a/hw/omap1.c +++ b/hw/omap1.c @@ -19,9 +19,9 @@ #include "hw.h" #include "arm-misc.h" #include "omap.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "soc_dma.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "qemu/range.h" #include "sysbus.h" diff --git a/hw/omap2.c b/hw/omap2.c index 7ccee69661..dc6867c962 100644 --- a/hw/omap2.c +++ b/hw/omap2.c @@ -18,11 +18,11 @@ * with this program; if not, see . */ -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "hw.h" #include "arm-misc.h" #include "omap.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/timer.h" #include "qemu-char.h" #include "flash.h" diff --git a/hw/omap_sx1.c b/hw/omap_sx1.c index ca6eb9ddeb..0f03121505 100644 --- a/hw/omap_sx1.c +++ b/hw/omap_sx1.c @@ -31,7 +31,7 @@ #include "boards.h" #include "arm-misc.h" #include "flash.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" /*****************************************************************************/ diff --git a/hw/onenand.c b/hw/onenand.c index 2e26e3a05d..26bf991d6d 100644 --- a/hw/onenand.c +++ b/hw/onenand.c @@ -22,7 +22,7 @@ #include "hw.h" #include "flash.h" #include "irq.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/memory.h" #include "exec/address-spaces.h" #include "sysbus.h" diff --git a/hw/opencores_eth.c b/hw/opencores_eth.c index fd2f0f61c3..a0dfdce1f9 100644 --- a/hw/opencores_eth.c +++ b/hw/opencores_eth.c @@ -34,7 +34,7 @@ #include "hw.h" #include "sysbus.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "trace.h" /* RECSMALL is not used because it breaks tap networking in linux: diff --git a/hw/openrisc_sim.c b/hw/openrisc_sim.c index c12097e12b..d2b2379ae2 100644 --- a/hw/openrisc_sim.c +++ b/hw/openrisc_sim.c @@ -25,9 +25,9 @@ #include "net/net.h" #include "loader.h" #include "exec/address-spaces.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sysbus.h" -#include "qtest.h" +#include "sysemu/qtest.h" #define KERNEL_LOAD_ADDR 0x100 diff --git a/hw/palm.c b/hw/palm.c index e091bbcfc1..5219e37394 100644 --- a/hw/palm.c +++ b/hw/palm.c @@ -18,7 +18,7 @@ */ #include "hw.h" #include "audio/audio.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "ui/console.h" #include "omap.h" #include "boards.h" diff --git a/hw/pam.c b/hw/pam.c index a95e2cfb07..1d72e88e62 100644 --- a/hw/pam.c +++ b/hw/pam.c @@ -26,7 +26,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "pam.h" void smram_update(MemoryRegion *smram_region, uint8_t smram, diff --git a/hw/parallel.c b/hw/parallel.c index c4705bc89d..56b3760e8c 100644 --- a/hw/parallel.c +++ b/hw/parallel.c @@ -26,7 +26,7 @@ #include "qemu-char.h" #include "isa.h" #include "pc.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" //#define DEBUG_PARALLEL diff --git a/hw/pc.c b/hw/pc.c index 0a92ea6bed..71902e210b 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -40,16 +40,16 @@ #include "pcspk.h" #include "pci/msi.h" #include "sysbus.h" -#include "sysemu.h" -#include "kvm.h" +#include "sysemu/sysemu.h" +#include "sysemu/kvm.h" #include "kvm_i386.h" #include "xen.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "hw/block-common.h" #include "ui/qemu-spice.h" #include "exec/memory.h" #include "exec/address-spaces.h" -#include "arch_init.h" +#include "sysemu/arch_init.h" #include "qemu/bitmap.h" /* debug PC/ISA interrupts */ diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 0d011348f2..99747a774c 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -33,12 +33,12 @@ #include "net/net.h" #include "boards.h" #include "ide.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "kvm/clock.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sysbus.h" -#include "arch_init.h" -#include "blockdev.h" +#include "sysemu/arch_init.h" +#include "sysemu/blockdev.h" #include "smbus.h" #include "xen.h" #include "exec/memory.h" diff --git a/hw/pc_q35.c b/hw/pc_q35.c index 2580d5ff34..c7262d6315 100644 --- a/hw/pc_q35.c +++ b/hw/pc_q35.c @@ -28,12 +28,12 @@ * THE SOFTWARE. */ #include "hw.h" -#include "arch_init.h" +#include "sysemu/arch_init.h" #include "smbus.h" #include "boards.h" #include "mc146818rtc.h" #include "xen.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "kvm/clock.h" #include "q35.h" #include "exec/address-spaces.h" diff --git a/hw/pc_sysfw.c b/hw/pc_sysfw.c index d7ea3a5595..87e1fa961b 100644 --- a/hw/pc_sysfw.c +++ b/hw/pc_sysfw.c @@ -23,15 +23,15 @@ * THE SOFTWARE. */ -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "sysbus.h" #include "hw.h" #include "pc.h" #include "hw/boards.h" #include "loader.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "flash.h" -#include "kvm.h" +#include "sysemu/kvm.h" #define BIOS_FILENAME "bios.bin" diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c index 2bc02e344f..f38df30540 100644 --- a/hw/pci/pci-hotplug.c +++ b/hw/pci/pci-hotplug.c @@ -31,7 +31,7 @@ #include "hw/scsi.h" #include "hw/virtio-blk.h" #include "qemu/config-file.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "qapi/error.h" #if defined(TARGET_I386) diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index 5891dc959d..1dda89b593 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -18,7 +18,7 @@ * with this program; if not, see . */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "monitor/monitor.h" #include "hw/pci/pci.h" #include "qmp-commands.h" diff --git a/hw/pci/pci.c b/hw/pci/pci.c index c9ed95be89..94840c4af7 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -27,7 +27,7 @@ #include "hw/pci/pci_bus.h" #include "monitor/monitor.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "hw/loader.h" #include "qemu/range.h" #include "qmp-commands.h" diff --git a/hw/pci/pci.h b/hw/pci/pci.h index d6ef4f6574..3152050856 100644 --- a/hw/pci/pci.h +++ b/hw/pci/pci.h @@ -5,7 +5,7 @@ #include "hw/qdev.h" #include "exec/memory.h" -#include "dma.h" +#include "sysemu/dma.h" /* PCI includes legacy ISA access. */ #include "hw/isa.h" diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c index f7f3633f5b..1ce72ce944 100644 --- a/hw/pci/pcie_aer.c +++ b/hw/pci/pcie_aer.c @@ -18,7 +18,7 @@ * with this program; if not, see . */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qapi/qmp/types.h" #include "monitor/monitor.h" #include "hw/pci/pci_bridge.h" diff --git a/hw/pckbd.c b/hw/pckbd.c index 5bb3e0abf3..6db7bbcc06 100644 --- a/hw/pckbd.c +++ b/hw/pckbd.c @@ -25,7 +25,7 @@ #include "isa.h" #include "pc.h" #include "ps2.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" /* debug PC keyboard */ //#define DEBUG_KBD diff --git a/hw/pcnet-pci.c b/hw/pcnet-pci.c index 5e8eed3af8..40a0e6eda4 100644 --- a/hw/pcnet-pci.c +++ b/hw/pcnet-pci.c @@ -31,7 +31,7 @@ #include "net/net.h" #include "loader.h" #include "qemu/timer.h" -#include "dma.h" +#include "sysemu/dma.h" #include "pcnet.h" diff --git a/hw/pcnet.c b/hw/pcnet.c index 87736542e4..30f100007a 100644 --- a/hw/pcnet.c +++ b/hw/pcnet.c @@ -39,7 +39,7 @@ #include "net/net.h" #include "qemu/timer.h" #include "qemu/sockets.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "pcnet.h" diff --git a/hw/petalogix_ml605_mmu.c b/hw/petalogix_ml605_mmu.c index 4eab0f2d8b..1cfdb2f302 100644 --- a/hw/petalogix_ml605_mmu.c +++ b/hw/petalogix_ml605_mmu.c @@ -29,11 +29,11 @@ #include "hw.h" #include "net/net.h" #include "flash.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "devices.h" #include "boards.h" #include "xilinx.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "serial.h" #include "exec/address-spaces.h" #include "ssi.h" diff --git a/hw/petalogix_s3adsp1800_mmu.c b/hw/petalogix_s3adsp1800_mmu.c index 124a88eeda..27ecfe7752 100644 --- a/hw/petalogix_s3adsp1800_mmu.c +++ b/hw/petalogix_s3adsp1800_mmu.c @@ -27,11 +27,11 @@ #include "hw.h" #include "net/net.h" #include "flash.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "devices.h" #include "boards.h" #include "xilinx.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "microblaze_boot.h" diff --git a/hw/pl031.c b/hw/pl031.c index 834a20c917..3a23ecde48 100644 --- a/hw/pl031.c +++ b/hw/pl031.c @@ -13,7 +13,7 @@ #include "sysbus.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" //#define DEBUG_PL031 diff --git a/hw/pl181.c b/hw/pl181.c index 8a2895ce1b..cbddb741ce 100644 --- a/hw/pl181.c +++ b/hw/pl181.c @@ -7,7 +7,7 @@ * This code is licensed under the GPL. */ -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "sysbus.h" #include "sd.h" diff --git a/hw/ppc.c b/hw/ppc.c index f066367609..1559982625 100644 --- a/hw/ppc.c +++ b/hw/ppc.c @@ -24,11 +24,11 @@ #include "hw.h" #include "ppc.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "nvram.h" #include "qemu/log.h" #include "loader.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" //#define PPC_DEBUG_IRQ diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 3593f7c0e2..aa54fd84d7 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -24,10 +24,10 @@ #include "hw/serial.h" #include "hw/pci/pci.h" #include "hw/boards.h" -#include "sysemu.h" -#include "kvm.h" +#include "sysemu/sysemu.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" #include "hw/openpic.h" #include "hw/ppc.h" #include "hw/loader.h" diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c index 2992bd9794..4deb02ac38 100644 --- a/hw/ppc/e500plat.c +++ b/hw/ppc/e500plat.c @@ -13,8 +13,8 @@ #include "qemu-common.h" #include "e500.h" #include "../boards.h" -#include "device_tree.h" -#include "hw/pci.h" +#include "sysemu/device_tree.h" +#include "hw/pci/pci.h" static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt) { diff --git a/hw/ppc/mpc8544ds.c b/hw/ppc/mpc8544ds.c index 7e1761d20c..f9ae20f5a3 100644 --- a/hw/ppc/mpc8544ds.c +++ b/hw/ppc/mpc8544ds.c @@ -13,7 +13,7 @@ #include "qemu-common.h" #include "e500.h" #include "../boards.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt) { diff --git a/hw/ppc405_boards.c b/hw/ppc405_boards.c index 31bcc4bb95..8f7f0d07d1 100644 --- a/hw/ppc405_boards.c +++ b/hw/ppc405_boards.c @@ -26,12 +26,12 @@ #include "ppc405.h" #include "nvram.h" #include "flash.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "block/block.h" #include "boards.h" #include "qemu/log.h" #include "loader.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #define BIOS_FILENAME "ppc405_rom.bin" diff --git a/hw/ppc405_uc.c b/hw/ppc405_uc.c index b1ed8837d6..7e56ecb4af 100644 --- a/hw/ppc405_uc.c +++ b/hw/ppc405_uc.c @@ -26,7 +26,7 @@ #include "ppc405.h" #include "serial.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/log.h" #include "exec/address-spaces.h" diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c index 591d7b0088..4f1b734c22 100644 --- a/hw/ppc440_bamboo.c +++ b/hw/ppc440_bamboo.c @@ -17,16 +17,16 @@ #include "hw.h" #include "pci/pci.h" #include "boards.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" #include "loader.h" #include "elf.h" #include "exec/address-spaces.h" #include "serial.h" #include "ppc.h" #include "ppc405.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sysbus.h" #define BINARY_DEVICE_TREE_FILE "bamboo.dtb" diff --git a/hw/ppc_booke.c b/hw/ppc_booke.c index a7182be0d3..5c89fc313d 100644 --- a/hw/ppc_booke.c +++ b/hw/ppc_booke.c @@ -24,7 +24,7 @@ #include "hw.h" #include "ppc.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "nvram.h" #include "qemu/log.h" #include "loader.h" diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c index b2d02eaff2..fabcc08b40 100644 --- a/hw/ppc_newworld.c +++ b/hw/ppc_newworld.c @@ -54,7 +54,7 @@ #include "nvram.h" #include "pci/pci.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "fw_cfg.h" #include "escc.h" @@ -62,10 +62,10 @@ #include "ide.h" #include "loader.h" #include "elf.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" #include "hw/usb.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysbus.h" diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c index 7a8a039d7e..fff5129ca9 100644 --- a/hw/ppc_oldworld.c +++ b/hw/ppc_oldworld.c @@ -29,7 +29,7 @@ #include "adb.h" #include "mac_dbdma.h" #include "nvram.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "net/net.h" #include "isa.h" #include "pci/pci.h" @@ -39,9 +39,9 @@ #include "ide.h" #include "loader.h" #include "elf.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #define MAX_IDE_BUS 2 diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c index 072535294e..9c78c863e8 100644 --- a/hw/ppc_prep.c +++ b/hw/ppc_prep.c @@ -27,7 +27,7 @@ #include "serial.h" #include "fdc.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "isa.h" #include "pci/pci.h" #include "pci/pci_host.h" @@ -37,8 +37,8 @@ #include "ide.h" #include "loader.h" #include "mc146818rtc.h" -#include "blockdev.h" -#include "arch_init.h" +#include "sysemu/blockdev.h" +#include "sysemu/arch_init.h" #include "exec/address-spaces.h" //#define HARD_DEBUG_PPC_IO diff --git a/hw/ppce500_spin.c b/hw/ppce500_spin.c index c1a155bd31..177aa2d122 100644 --- a/hw/ppce500_spin.c +++ b/hw/ppce500_spin.c @@ -28,9 +28,9 @@ */ #include "hw.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sysbus.h" -#include "kvm.h" +#include "sysemu/kvm.h" #define MAX_CPUS 32 diff --git a/hw/ps2.c b/hw/ps2.c index ba80089aba..15cfd5bb76 100644 --- a/hw/ps2.c +++ b/hw/ps2.c @@ -24,7 +24,7 @@ #include "hw.h" #include "ps2.h" #include "ui/console.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" /* debug PC keyboard */ //#define DEBUG_KBD diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index e616979207..936e9f87cd 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -9,12 +9,12 @@ #include "sysbus.h" #include "pxa.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "serial.h" #include "i2c.h" #include "ssi.h" #include "qemu-char.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" static struct { hwaddr io_base; diff --git a/hw/pxa2xx_lcd.c b/hw/pxa2xx_lcd.c index b5efd4d426..512a27e702 100644 --- a/hw/pxa2xx_lcd.c +++ b/hw/pxa2xx_lcd.c @@ -15,7 +15,7 @@ #include "pxa.h" #include "ui/pixel_ops.h" /* FIXME: For graphic_rotate. Should probably be done in common code. */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "framebuffer.h" struct DMAChannel { diff --git a/hw/pxa2xx_timer.c b/hw/pxa2xx_timer.c index 1481c6d3e1..e4ffb15bb2 100644 --- a/hw/pxa2xx_timer.c +++ b/hw/pxa2xx_timer.c @@ -9,7 +9,7 @@ #include "hw.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "pxa.h" #include "sysbus.h" diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c index 1c6712e6de..b73986759b 100644 --- a/hw/qdev-monitor.c +++ b/hw/qdev-monitor.c @@ -20,7 +20,7 @@ #include "qdev.h" #include "monitor/monitor.h" #include "qmp-commands.h" -#include "arch_init.h" +#include "sysemu/arch_init.h" #include "qemu/config-file.h" /* diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index ba6c648fed..1cb97ea594 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -1,7 +1,7 @@ #include "net/net.h" #include "qdev.h" #include "qapi/qmp/qerror.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "hw/block-common.h" #include "net/hub.h" #include "qapi/visitor.h" diff --git a/hw/qdev.c b/hw/qdev.c index 0a2a32d5d3..c4a9857a05 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -27,7 +27,7 @@ #include "net/net.h" #include "qdev.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qapi/error.h" #include "qapi/visitor.h" diff --git a/hw/qxl.c b/hw/qxl.c index b88a39cc93..d08b9bd3c1 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -24,7 +24,7 @@ #include "qemu/timer.h" #include "qemu/queue.h" #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "trace.h" #include "qxl.h" diff --git a/hw/r2d.c b/hw/r2d.c index d7a26bf398..7cf1893d19 100644 --- a/hw/r2d.c +++ b/hw/r2d.c @@ -27,7 +27,7 @@ #include "hw.h" #include "sh.h" #include "devices.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "pci/pci.h" #include "net/net.h" @@ -36,7 +36,7 @@ #include "loader.h" #include "usb.h" #include "flash.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #define FLASH_BASE 0x00000000 diff --git a/hw/realview.c b/hw/realview.c index 9c55bf29b7..872b3b468a 100644 --- a/hw/realview.c +++ b/hw/realview.c @@ -13,10 +13,10 @@ #include "devices.h" #include "pci/pci.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "i2c.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #define SMP_BOOT_ADDR 0xe0000000 diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 19c31a02c6..c59ec6b6df 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -53,11 +53,11 @@ #include "hw.h" #include "pci/pci.h" -#include "dma.h" +#include "sysemu/dma.h" #include "qemu/timer.h" #include "net/net.h" #include "loader.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/iov.h" /* debug RTL8139 card */ diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c index 769015c136..963b4f0dc2 100644 --- a/hw/s390-virtio-bus.c +++ b/hw/s390-virtio-bus.c @@ -19,7 +19,7 @@ #include "hw.h" #include "block/block.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "monitor/monitor.h" #include "loader.h" @@ -29,7 +29,7 @@ #include "hw/virtio-serial.h" #include "hw/virtio-net.h" #include "hw/sysbus.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "hw/s390-virtio-bus.h" diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c index 7dfe87ade3..20827761d0 100644 --- a/hw/s390-virtio.c +++ b/hw/s390-virtio.c @@ -19,8 +19,8 @@ #include "hw.h" #include "block/block.h" -#include "blockdev.h" -#include "sysemu.h" +#include "sysemu/blockdev.h" +#include "sysemu/sysemu.h" #include "net/net.h" #include "boards.h" #include "monitor/monitor.h" @@ -28,7 +28,7 @@ #include "elf.h" #include "hw/virtio.h" #include "hw/sysbus.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "exec/address-spaces.h" #include "hw/s390-virtio-bus.h" diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 748118d0f0..89b1b66bd2 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -16,7 +16,7 @@ */ #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sclp.h" #include "event-facility.h" diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index bc9b0aeb00..7ad791d5e3 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -13,7 +13,7 @@ */ #include "cpu.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "exec/memory.h" #include "sclp.h" diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c index 9a773b87ff..6e6f5624df 100644 --- a/hw/s390x/sclpquiesce.c +++ b/hw/s390x/sclpquiesce.c @@ -12,7 +12,7 @@ * */ #include -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sclp.h" #include "event-facility.h" diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index 5dc9f512b5..970c1fc01b 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -3,9 +3,9 @@ #include "scsi.h" #include "scsi-defs.h" #include "qdev.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "trace.h" -#include "dma.h" +#include "sysemu/dma.h" static char *scsibus_get_dev_path(DeviceState *dev); static char *scsibus_get_fw_dev_path(DeviceState *dev); diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index c65da4a9c9..a69735b0a6 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -32,10 +32,10 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0) #include "qemu/error-report.h" #include "scsi.h" #include "scsi-defs.h" -#include "sysemu.h" -#include "blockdev.h" +#include "sysemu/sysemu.h" +#include "sysemu/blockdev.h" #include "hw/block-common.h" -#include "dma.h" +#include "sysemu/dma.h" #ifdef __linux #include diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index faeb61ee2c..4c702be19f 100644 --- a/hw/scsi-generic.c +++ b/hw/scsi-generic.c @@ -14,7 +14,7 @@ #include "qemu-common.h" #include "qemu/error-report.h" #include "scsi.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #ifdef __linux__ diff --git a/hw/scsi.h b/hw/scsi.h index 24ed522722..a5b5b2ec0d 100644 --- a/hw/scsi.h +++ b/hw/scsi.h @@ -4,7 +4,7 @@ #include "qdev.h" #include "block/block.h" #include "hw/block-common.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #define MAX_SCSI_DEVS 255 diff --git a/hw/serial.h b/hw/serial.h index 5722f8a353..98ee4241be 100644 --- a/hw/serial.h +++ b/hw/serial.h @@ -26,7 +26,7 @@ #define HW_SERIAL_H 1 #include "hw.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "exec/memory.h" #define UART_FIFO_LENGTH 16 /* 16550A Fifo Length */ diff --git a/hw/sga.c b/hw/sga.c index 5d80efd0c2..d5c91ed98e 100644 --- a/hw/sga.c +++ b/hw/sga.c @@ -27,7 +27,7 @@ #include "pci/pci.h" #include "pc.h" #include "loader.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #define SGABIOS_FILENAME "sgabios.bin" diff --git a/hw/sh7750.c b/hw/sh7750.c index 08945750c4..666f8655ed 100644 --- a/hw/sh7750.c +++ b/hw/sh7750.c @@ -25,7 +25,7 @@ #include #include "hw.h" #include "sh.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sh7750_regs.h" #include "sh7750_regnames.h" #include "sh_intc.h" diff --git a/hw/shix.c b/hw/shix.c index 821196e84c..86d703ad70 100644 --- a/hw/shix.c +++ b/hw/shix.c @@ -29,7 +29,7 @@ */ #include "hw.h" #include "sh.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "loader.h" #include "exec/address-spaces.h" diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c index 682fb457f5..704f2b173b 100644 --- a/hw/slavio_misc.c +++ b/hw/slavio_misc.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "sysbus.h" #include "trace.h" diff --git a/hw/smbios.c b/hw/smbios.c index c57237d279..a7b8bfc383 100644 --- a/hw/smbios.c +++ b/hw/smbios.c @@ -13,7 +13,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "smbios.h" #include "loader.h" diff --git a/hw/smbus_ich9.c b/hw/smbus_ich9.c index b7bddc80d3..16db3a743c 100644 --- a/hw/smbus_ich9.c +++ b/hw/smbus_ich9.c @@ -28,7 +28,7 @@ #include "pc.h" #include "pm_smbus.h" #include "pci/pci.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "i2c.h" #include "smbus.h" diff --git a/hw/spapr.c b/hw/spapr.c index 1abfde2a05..fdd1eb6925 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -24,13 +24,13 @@ * THE SOFTWARE. * */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "hw.h" #include "elf.h" #include "net/net.h" -#include "blockdev.h" -#include "cpus.h" -#include "kvm.h" +#include "sysemu/blockdev.h" +#include "sysemu/cpus.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" #include "hw/boards.h" @@ -43,7 +43,7 @@ #include "hw/xics.h" #include "hw/pci/msi.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" #include "pci/pci.h" diff --git a/hw/spapr.h b/hw/spapr.h index 600722f132..3a1f69f2a9 100644 --- a/hw/spapr.h +++ b/hw/spapr.h @@ -1,7 +1,7 @@ #if !defined(__HW_SPAPR_H__) #define __HW_SPAPR_H__ -#include "dma.h" +#include "sysemu/dma.h" #include "hw/xics.h" struct VIOsPAPRBus; diff --git a/hw/spapr_events.c b/hw/spapr_events.c index 18ccd4a9e0..7956601466 100644 --- a/hw/spapr_events.c +++ b/hw/spapr_events.c @@ -25,10 +25,10 @@ * */ #include "cpu.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu-char.h" #include "hw/qdev.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" #include "hw/spapr.h" #include "hw/spapr_vio.h" diff --git a/hw/spapr_hcall.c b/hw/spapr_hcall.c index 1fac362329..afb12973f2 100644 --- a/hw/spapr_hcall.c +++ b/hw/spapr_hcall.c @@ -1,6 +1,6 @@ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "cpu.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "helper_regs.h" #include "hw/spapr.h" diff --git a/hw/spapr_iommu.c b/hw/spapr_iommu.c index fb968b250b..d8a098cb1b 100644 --- a/hw/spapr_iommu.c +++ b/hw/spapr_iommu.c @@ -17,10 +17,10 @@ * License along with this library; if not, see . */ #include "hw.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "qdev.h" #include "kvm_ppc.h" -#include "dma.h" +#include "sysemu/dma.h" #include "exec/address-spaces.h" #include "hw/spapr.h" diff --git a/hw/spapr_nvram.c b/hw/spapr_nvram.c index 512bb8d5d1..f20f6b4fdd 100644 --- a/hw/spapr_nvram.c +++ b/hw/spapr_nvram.c @@ -24,7 +24,7 @@ #include #include -#include "device_tree.h" +#include "sysemu/device_tree.h" #include "hw/sysbus.h" #include "hw/spapr.h" #include "hw/spapr_vio.h" diff --git a/hw/spapr_rtas.c b/hw/spapr_rtas.c index e618c2db53..d29736285c 100644 --- a/hw/spapr_rtas.c +++ b/hw/spapr_rtas.c @@ -25,10 +25,10 @@ * */ #include "cpu.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu-char.h" #include "hw/qdev.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" #include "hw/spapr.h" #include "hw/spapr_vio.h" diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c index fdf8db9158..a58621d17e 100644 --- a/hw/spapr_vio.c +++ b/hw/spapr_vio.c @@ -20,14 +20,14 @@ */ #include "hw.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "monitor/monitor.h" #include "loader.h" #include "elf.h" #include "hw/sysbus.h" -#include "kvm.h" -#include "device_tree.h" +#include "sysemu/kvm.h" +#include "sysemu/device_tree.h" #include "kvm_ppc.h" #include "hw/spapr.h" diff --git a/hw/spapr_vio.h b/hw/spapr_vio.h index cc85d26101..f98ec0a2e5 100644 --- a/hw/spapr_vio.h +++ b/hw/spapr_vio.h @@ -21,7 +21,7 @@ * License along with this library; if not, see . */ -#include "dma.h" +#include "sysemu/dma.h" #define TYPE_VIO_SPAPR_DEVICE "vio-spapr-device" #define VIO_SPAPR_DEVICE(obj) \ diff --git a/hw/spitz.c b/hw/spitz.c index 1259e32974..8e1be7fb21 100644 --- a/hw/spitz.c +++ b/hw/spitz.c @@ -13,7 +13,7 @@ #include "hw.h" #include "pxa.h" #include "arm-misc.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "pcmcia.h" #include "i2c.h" #include "ssi.h" @@ -25,7 +25,7 @@ #include "block/block.h" #include "audio/audio.h" #include "boards.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "sysbus.h" #include "exec/address-spaces.h" diff --git a/hw/ssi-sd.c b/hw/ssi-sd.c index c5505ee24f..d61c3328d9 100644 --- a/hw/ssi-sd.c +++ b/hw/ssi-sd.c @@ -10,7 +10,7 @@ * GNU GPL, version 2 or (at your option) any later version. */ -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "ssi.h" #include "sd.h" diff --git a/hw/strongarm.c b/hw/strongarm.c index f776fee3bc..5d5f454b1d 100644 --- a/hw/strongarm.c +++ b/hw/strongarm.c @@ -31,7 +31,7 @@ #include "qemu/error-report.h" #include "arm-misc.h" #include "qemu-char.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "ssi.h" //#define DEBUG diff --git a/hw/sun4m.c b/hw/sun4m.c index 4245854949..0d84b373b1 100644 --- a/hw/sun4m.c +++ b/hw/sun4m.c @@ -27,7 +27,7 @@ #include "nvram.h" #include "sparc32_dma.h" #include "fdc.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "net/net.h" #include "boards.h" #include "firmware_abi.h" @@ -40,7 +40,7 @@ #include "qdev-addr.h" #include "loader.h" #include "elf.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "trace.h" /* diff --git a/hw/sun4u.c b/hw/sun4u.c index 8bca4fdff9..cbfd217587 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -30,7 +30,7 @@ #include "fdc.h" #include "net/net.h" #include "qemu/timer.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "firmware_abi.h" #include "fw_cfg.h" @@ -38,7 +38,7 @@ #include "ide.h" #include "loader.h" #include "elf.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" //#define DEBUG_IRQ diff --git a/hw/tc6393xb.c b/hw/tc6393xb.c index edf76817b5..e815f83198 100644 --- a/hw/tc6393xb.c +++ b/hw/tc6393xb.c @@ -15,7 +15,7 @@ #include "flash.h" #include "ui/console.h" #include "ui/pixel_ops.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #define IRQ_TC6393_NAND 0 #define IRQ_TC6393_MMC 1 diff --git a/hw/tosa.c b/hw/tosa.c index 6fdbec53ee..6ee4693840 100644 --- a/hw/tosa.c +++ b/hw/tosa.c @@ -21,7 +21,7 @@ #include "boards.h" #include "i2c.h" #include "ssi.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "sysbus.h" #include "exec/address-spaces.h" diff --git a/hw/twl92230.c b/hw/twl92230.c index 3210b9ef4e..c71e4a2af0 100644 --- a/hw/twl92230.c +++ b/hw/twl92230.c @@ -22,7 +22,7 @@ #include "hw.h" #include "qemu/timer.h" #include "i2c.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "ui/console.h" #define VERBOSE 1 diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 74728c94e5..10260a13ac 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -1,7 +1,7 @@ #include "hw/hw.h" #include "hw/usb.h" #include "hw/qdev.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "monitor/monitor.h" #include "trace.h" diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index e8ada9f02c..1c54863452 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -29,7 +29,7 @@ #include "net/net.h" #include "qemu/queue.h" #include "qemu/config-file.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/iov.h" /*#define TRAFFIC_DEBUG*/ diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 6d27bac94f..5025597673 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -15,8 +15,8 @@ #include "hw/scsi.h" #include "ui/console.h" #include "monitor/monitor.h" -#include "sysemu.h" -#include "blockdev.h" +#include "sysemu/sysemu.h" +#include "sysemu/blockdev.h" //#define DEBUG_MSD diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index 5bc80031bf..e35144d386 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -22,8 +22,8 @@ #include "hw/usb.h" #include "monitor/monitor.h" #include "trace.h" -#include "dma.h" -#include "sysemu.h" +#include "sysemu/dma.h" +#include "sysemu/sysemu.h" #ifndef EHCI_DEBUG #define EHCI_DEBUG 0 diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index c9b8a31465..2af754b5cf 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -30,7 +30,7 @@ #include "hw/pci/pci.h" #include "qemu/timer.h" #include "qemu/iov.h" -#include "dma.h" +#include "sysemu/dma.h" #include "trace.h" //#define DEBUG diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c index 9a8c26ceaf..669fbd245c 100644 --- a/hw/usb/host-linux.c +++ b/hw/usb/host-linux.c @@ -33,7 +33,7 @@ #include "qemu-common.h" #include "qemu/timer.h" #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "trace.h" #include diff --git a/hw/usb/libhw.c b/hw/usb/libhw.c index 672d7a5598..75f022f4ec 100644 --- a/hw/usb/libhw.c +++ b/hw/usb/libhw.c @@ -22,7 +22,7 @@ #include "qemu-common.h" #include "exec/cpu-common.h" #include "hw/usb.h" -#include "dma.h" +#include "sysemu/dma.h" int usb_packet_map(USBPacket *p, QEMUSGList *sgl) { diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 31e5f27595..b65e8682b6 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -28,7 +28,7 @@ #include "qemu-common.h" #include "qemu/timer.h" #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/iov.h" #include diff --git a/hw/versatilepb.c b/hw/versatilepb.c index bd9c01564a..5e89e747a2 100644 --- a/hw/versatilepb.c +++ b/hw/versatilepb.c @@ -11,11 +11,11 @@ #include "arm-misc.h" #include "devices.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "pci/pci.h" #include "i2c.h" #include "boards.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "flash.h" diff --git a/hw/vexpress.c b/hw/vexpress.c index e7b9e93852..93c3176667 100644 --- a/hw/vexpress.c +++ b/hw/vexpress.c @@ -26,10 +26,10 @@ #include "primecell.h" #include "devices.h" #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "exec/address-spaces.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "flash.h" #define VEXPRESS_BOARD_ID 0x8e0 diff --git a/hw/vfio_pci.c b/hw/vfio_pci.c index 9f204bc113..41fb7ad1de 100644 --- a/hw/vfio_pci.c +++ b/hw/vfio_pci.c @@ -29,7 +29,7 @@ #include "config.h" #include "qemu/event_notifier.h" #include "exec/address-spaces.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "exec/memory.h" #include "pci/msi.h" #include "pci/msix.h" diff --git a/hw/virtex_ml507.c b/hw/virtex_ml507.c index 5134e2f477..5238c7cbd6 100644 --- a/hw/virtex_ml507.c +++ b/hw/virtex_ml507.c @@ -26,10 +26,10 @@ #include "hw.h" #include "serial.h" #include "flash.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "devices.h" #include "boards.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" #include "loader.h" #include "elf.h" #include "qemu/log.h" @@ -39,7 +39,7 @@ #include "ppc4xx.h" #include "ppc405.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "xilinx.h" #define EPAPR_MAGIC (0x45504150) diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c index 2eb709b422..3040bc63ab 100644 --- a/hw/virtio-balloon.c +++ b/hw/virtio-balloon.c @@ -18,9 +18,9 @@ #include "virtio.h" #include "pc.h" #include "cpu.h" -#include "balloon.h" +#include "sysemu/balloon.h" #include "virtio-balloon.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "exec/address-spaces.h" #if defined(__linux__) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 208caa2642..90cfa246db 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -15,7 +15,7 @@ #include "qemu/error-report.h" #include "trace.h" #include "hw/block-common.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "virtio-blk.h" #include "scsi-defs.h" #ifdef __linux__ diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index f58917f75f..d2d2454493 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -27,8 +27,8 @@ #include "pci/msi.h" #include "pci/msix.h" #include "loader.h" -#include "kvm.h" -#include "blockdev.h" +#include "sysemu/kvm.h" +#include "sysemu/blockdev.h" #include "virtio-pci.h" #include "qemu/range.h" diff --git a/hw/virtio.h b/hw/virtio.h index 511a16992e..541600484e 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -17,7 +17,7 @@ #include "hw.h" #include "net/net.h" #include "qdev.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/event_notifier.h" #ifdef CONFIG_LINUX #include "9p.h" diff --git a/hw/vmport.c b/hw/vmport.c index 3ab3a1405c..7d425237ac 100644 --- a/hw/vmport.c +++ b/hw/vmport.c @@ -24,7 +24,7 @@ #include "hw.h" #include "isa.h" #include "pc.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "qdev.h" //#define VMPORT_DEBUG diff --git a/hw/vt82c686.c b/hw/vt82c686.c index a18aaed217..d3469d49f1 100644 --- a/hw/vt82c686.c +++ b/hw/vt82c686.c @@ -22,7 +22,7 @@ #include "apm.h" #include "acpi.h" #include "pm_smbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/timer.h" #include "exec/address-spaces.h" diff --git a/hw/watchdog.c b/hw/watchdog.c index 5b04215374..072d256882 100644 --- a/hw/watchdog.c +++ b/hw/watchdog.c @@ -25,7 +25,7 @@ #include "qemu/queue.h" #include "qapi/qmp/types.h" #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "hw/watchdog.h" /* Possible values for action parameter. */ diff --git a/hw/xen_backend.h b/hw/xen_backend.h index 92ab501d37..f37afb1f05 100644 --- a/hw/xen_backend.h +++ b/hw/xen_backend.h @@ -2,7 +2,7 @@ #define QEMU_HW_XEN_BACKEND_H 1 #include "xen_common.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "net/net.h" /* ------------------------------------------------------------- */ diff --git a/hw/xen_devconfig.c b/hw/xen_devconfig.c index d83e8d0f64..e2ba741d54 100644 --- a/hw/xen_devconfig.c +++ b/hw/xen_devconfig.c @@ -1,5 +1,5 @@ #include "xen_backend.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" /* ------------------------------------------------------------- */ diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 423b580cff..a6a64a2455 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -38,7 +38,7 @@ #include "hw.h" #include "xen_backend.h" #include "xen_blkif.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" /* ------------------------------------------------------------- */ diff --git a/hw/xen_machine_pv.c b/hw/xen_machine_pv.c index 426470351e..9feecd5a27 100644 --- a/hw/xen_machine_pv.c +++ b/hw/xen_machine_pv.c @@ -27,7 +27,7 @@ #include "boards.h" #include "xen_backend.h" #include "xen_domainbuild.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" static void xen_init_pv(QEMUMachineInitArgs *args) { diff --git a/hw/xilinx_spi.c b/hw/xilinx_spi.c index 4eed1828e3..77f9178008 100644 --- a/hw/xilinx_spi.c +++ b/hw/xilinx_spi.c @@ -25,7 +25,7 @@ */ #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/log.h" #include "fifo.h" diff --git a/hw/xilinx_spips.c b/hw/xilinx_spips.c index ebe375e56f..42e019dc05 100644 --- a/hw/xilinx_spips.c +++ b/hw/xilinx_spips.c @@ -23,7 +23,7 @@ */ #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "ptimer.h" #include "qemu/log.h" #include "fifo.h" diff --git a/hw/xilinx_zynq.c b/hw/xilinx_zynq.c index 156648a5d1..da0a7d0aa1 100644 --- a/hw/xilinx_zynq.c +++ b/hw/xilinx_zynq.c @@ -19,10 +19,10 @@ #include "arm-misc.h" #include "net/net.h" #include "exec/address-spaces.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "flash.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "loader.h" #include "ssi.h" diff --git a/hw/xtensa_lx60.c b/hw/xtensa_lx60.c index c6c880eba5..9c7bb75f81 100644 --- a/hw/xtensa_lx60.c +++ b/hw/xtensa_lx60.c @@ -25,7 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "loader.h" #include "elf.h" @@ -35,7 +35,7 @@ #include "net/net.h" #include "sysbus.h" #include "flash.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "qemu-char.h" #include "xtensa_bootparam.h" diff --git a/hw/xtensa_sim.c b/hw/xtensa_sim.c index 29b5f22a18..14fe85b2fc 100644 --- a/hw/xtensa_sim.c +++ b/hw/xtensa_sim.c @@ -25,7 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "boards.h" #include "loader.h" #include "elf.h" diff --git a/hw/z2.c b/hw/z2.c index ec35f3e444..09b03687d1 100644 --- a/hw/z2.c +++ b/hw/z2.c @@ -18,9 +18,9 @@ #include "i2c.h" #include "ssi.h" #include "boards.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "flash.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "ui/console.h" #include "audio/audio.h" #include "exec/address-spaces.h" diff --git a/hw/zynq_slcr.c b/hw/zynq_slcr.c index c7ce51f4a6..97ec578262 100644 --- a/hw/zynq_slcr.c +++ b/hw/zynq_slcr.c @@ -17,7 +17,7 @@ #include "hw.h" #include "qemu/timer.h" #include "sysbus.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #ifdef ZYNQ_ARM_SLCR_ERR_DEBUG #define DB_PRINT(...) do { \ diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h new file mode 100644 index 0000000000..5fc780c63d --- /dev/null +++ b/include/sysemu/arch_init.h @@ -0,0 +1,39 @@ +#ifndef QEMU_ARCH_INIT_H +#define QEMU_ARCH_INIT_H + +#include "qmp-commands.h" + +enum { + QEMU_ARCH_ALL = -1, + QEMU_ARCH_ALPHA = 1, + QEMU_ARCH_ARM = 2, + QEMU_ARCH_CRIS = 4, + QEMU_ARCH_I386 = 8, + QEMU_ARCH_M68K = 16, + QEMU_ARCH_LM32 = 32, + QEMU_ARCH_MICROBLAZE = 64, + QEMU_ARCH_MIPS = 128, + QEMU_ARCH_PPC = 256, + QEMU_ARCH_S390X = 512, + QEMU_ARCH_SH4 = 1024, + QEMU_ARCH_SPARC = 2048, + QEMU_ARCH_XTENSA = 4096, + QEMU_ARCH_OPENRISC = 8192, + QEMU_ARCH_UNICORE32 = 0x4000, +}; + +extern const uint32_t arch_type; + +void select_soundhw(const char *optarg); +void do_acpitable_option(const char *optarg); +void do_smbios_option(const char *optarg); +void cpudef_init(void); +int audio_available(void); +void audio_init(ISABus *isa_bus, PCIBus *pci_bus); +int tcg_available(void); +int kvm_available(void); +int xen_available(void); + +CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp); + +#endif diff --git a/include/sysemu/balloon.h b/include/sysemu/balloon.h new file mode 100644 index 0000000000..bd9d39505d --- /dev/null +++ b/include/sysemu/balloon.h @@ -0,0 +1,29 @@ +/* + * Balloon + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef _QEMU_BALLOON_H +#define _QEMU_BALLOON_H + +#include "monitor/monitor.h" +#include "qapi-types.h" + +typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target); +typedef void (QEMUBalloonStatus)(void *opaque, BalloonInfo *info); + +int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, + QEMUBalloonStatus *stat_func, void *opaque); +void qemu_remove_balloon_handler(void *opaque); + +void qemu_balloon_changed(int64_t actual); + +#endif diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h new file mode 100644 index 0000000000..1fe533299e --- /dev/null +++ b/include/sysemu/blockdev.h @@ -0,0 +1,69 @@ +/* + * QEMU host block devices + * + * Copyright (c) 2003-2008 Fabrice Bellard + * + * 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 BLOCKDEV_H +#define BLOCKDEV_H + +#include "block/block.h" +#include "qapi/error.h" +#include "qemu/queue.h" + +void blockdev_mark_auto_del(BlockDriverState *bs); +void blockdev_auto_del(BlockDriverState *bs); + +typedef enum { + IF_DEFAULT = -1, /* for use with drive_add() only */ + /* + * IF_IDE must be zero, because we want QEMUMachine member + * block_default_type to default-initialize to IF_IDE + */ + IF_IDE = 0, + IF_NONE, + IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN, + IF_COUNT +} BlockInterfaceType; + +struct DriveInfo { + BlockDriverState *bdrv; + char *id; + const char *devaddr; + BlockInterfaceType type; + int bus; + int unit; + int auto_del; /* see blockdev_mark_auto_del() */ + int media_cd; + int cyls, heads, secs, trans; + QemuOpts *opts; + const char *serial; + QTAILQ_ENTRY(DriveInfo) next; + int refcount; +}; + +DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit); +DriveInfo *drive_get_by_index(BlockInterfaceType type, int index); +int drive_get_max_bus(BlockInterfaceType type); +DriveInfo *drive_get_next(BlockInterfaceType type); +void drive_get_ref(DriveInfo *dinfo); +void drive_put_ref(DriveInfo *dinfo); +DriveInfo *drive_get_by_blockdev(BlockDriverState *bs); + +QemuOpts *drive_def(const char *optstr); +QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file, + const char *optstr); +DriveInfo *drive_init(QemuOpts *arg, BlockInterfaceType block_default_type); + +/* device-hotplug */ + +DriveInfo *add_init_drive(const char *opts); + +void qmp_change_blockdev(const char *device, const char *filename, + bool has_format, const char *format, Error **errp); +void do_commit(Monitor *mon, const QDict *qdict); +int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data); +#endif diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h new file mode 100644 index 0000000000..81bd81773f --- /dev/null +++ b/include/sysemu/cpus.h @@ -0,0 +1,24 @@ +#ifndef QEMU_CPUS_H +#define QEMU_CPUS_H + +/* cpus.c */ +void qemu_init_cpu_loop(void); +void resume_all_vcpus(void); +void pause_all_vcpus(void); +void cpu_stop_current(void); + +void cpu_synchronize_all_states(void); +void cpu_synchronize_all_post_reset(void); +void cpu_synchronize_all_post_init(void); + +void qtest_clock_warp(int64_t dest); + +/* vl.c */ +extern int smp_cores; +extern int smp_threads; +void set_numa_modes(void); +void set_cpu_log(const char *optarg); +void set_cpu_log_filename(const char *optarg); +void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg); + +#endif diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h new file mode 100644 index 0000000000..f0b3f35e03 --- /dev/null +++ b/include/sysemu/device_tree.h @@ -0,0 +1,54 @@ +/* + * Header with function prototypes to help device tree manipulation using + * libfdt. It also provides functions to read entries from device tree proc + * interface. + * + * Copyright 2008 IBM Corporation. + * Authors: Jerone Young + * Hollis Blanchard + * + * This work is licensed under the GNU GPL license version 2 or later. + * + */ + +#ifndef __DEVICE_TREE_H__ +#define __DEVICE_TREE_H__ + +void *create_device_tree(int *sizep); +void *load_device_tree(const char *filename_path, int *sizep); + +int qemu_devtree_setprop(void *fdt, const char *node_path, + const char *property, const void *val_array, int size); +int qemu_devtree_setprop_cell(void *fdt, const char *node_path, + const char *property, uint32_t val); +int qemu_devtree_setprop_u64(void *fdt, const char *node_path, + const char *property, uint64_t val); +int qemu_devtree_setprop_string(void *fdt, const char *node_path, + const char *property, const char *string); +int qemu_devtree_setprop_phandle(void *fdt, const char *node_path, + const char *property, + const char *target_node_path); +const void *qemu_devtree_getprop(void *fdt, const char *node_path, + const char *property, int *lenp); +uint32_t qemu_devtree_getprop_cell(void *fdt, const char *node_path, + const char *property); +uint32_t qemu_devtree_get_phandle(void *fdt, const char *path); +uint32_t qemu_devtree_alloc_phandle(void *fdt); +int qemu_devtree_nop_node(void *fdt, const char *node_path); +int qemu_devtree_add_subnode(void *fdt, const char *name); + +#define qemu_devtree_setprop_cells(fdt, node_path, property, ...) \ + do { \ + uint32_t qdt_tmp[] = { __VA_ARGS__ }; \ + int i; \ + \ + for (i = 0; i < ARRAY_SIZE(qdt_tmp); i++) { \ + qdt_tmp[i] = cpu_to_be32(qdt_tmp[i]); \ + } \ + qemu_devtree_setprop(fdt, node_path, property, qdt_tmp, \ + sizeof(qdt_tmp)); \ + } while (0) + +void qemu_devtree_dumpdtb(void *fdt, int size); + +#endif /* __DEVICE_TREE_H__ */ diff --git a/include/sysemu/dma.h b/include/sysemu/dma.h new file mode 100644 index 0000000000..a52c93a553 --- /dev/null +++ b/include/sysemu/dma.h @@ -0,0 +1,282 @@ +/* + * DMA helper functions + * + * Copyright (c) 2009 Red Hat + * + * This work is licensed under the terms of the GNU General Public License + * (GNU GPL), version 2 or later. + */ + +#ifndef DMA_H +#define DMA_H + +#include +#include "exec/memory.h" +#include "hw/hw.h" +#include "block/block.h" +#include "sysemu/kvm.h" + +typedef struct DMAContext DMAContext; +typedef struct ScatterGatherEntry ScatterGatherEntry; + +typedef enum { + DMA_DIRECTION_TO_DEVICE = 0, + DMA_DIRECTION_FROM_DEVICE = 1, +} DMADirection; + +struct QEMUSGList { + ScatterGatherEntry *sg; + int nsg; + int nalloc; + size_t size; + DMAContext *dma; +}; + +#ifndef CONFIG_USER_ONLY + +/* + * When an IOMMU is present, bus addresses become distinct from + * CPU/memory physical addresses and may be a different size. Because + * the IOVA size depends more on the bus than on the platform, we more + * or less have to treat these as 64-bit always to cover all (or at + * least most) cases. + */ +typedef uint64_t dma_addr_t; + +#define DMA_ADDR_BITS 64 +#define DMA_ADDR_FMT "%" PRIx64 + +typedef int DMATranslateFunc(DMAContext *dma, + dma_addr_t addr, + hwaddr *paddr, + hwaddr *len, + DMADirection dir); +typedef void* DMAMapFunc(DMAContext *dma, + dma_addr_t addr, + dma_addr_t *len, + DMADirection dir); +typedef void DMAUnmapFunc(DMAContext *dma, + void *buffer, + dma_addr_t len, + DMADirection dir, + dma_addr_t access_len); + +struct DMAContext { + AddressSpace *as; + DMATranslateFunc *translate; + DMAMapFunc *map; + DMAUnmapFunc *unmap; +}; + +/* A global DMA context corresponding to the address_space_memory + * AddressSpace, for sysbus devices which do DMA. + */ +extern DMAContext dma_context_memory; + +static inline void dma_barrier(DMAContext *dma, DMADirection dir) +{ + /* + * This is called before DMA read and write operations + * unless the _relaxed form is used and is responsible + * for providing some sane ordering of accesses vs + * concurrently running VCPUs. + * + * Users of map(), unmap() or lower level st/ld_* + * operations are responsible for providing their own + * ordering via barriers. + * + * This primitive implementation does a simple smp_mb() + * before each operation which provides pretty much full + * ordering. + * + * A smarter implementation can be devised if needed to + * use lighter barriers based on the direction of the + * transfer, the DMA context, etc... + */ + if (kvm_enabled()) { + smp_mb(); + } +} + +static inline bool dma_has_iommu(DMAContext *dma) +{ + return dma && dma->translate; +} + +/* Checks that the given range of addresses is valid for DMA. This is + * useful for certain cases, but usually you should just use + * dma_memory_{read,write}() and check for errors */ +bool iommu_dma_memory_valid(DMAContext *dma, dma_addr_t addr, dma_addr_t len, + DMADirection dir); +static inline bool dma_memory_valid(DMAContext *dma, + dma_addr_t addr, dma_addr_t len, + DMADirection dir) +{ + if (!dma_has_iommu(dma)) { + return true; + } else { + return iommu_dma_memory_valid(dma, addr, len, dir); + } +} + +int iommu_dma_memory_rw(DMAContext *dma, dma_addr_t addr, + void *buf, dma_addr_t len, DMADirection dir); +static inline int dma_memory_rw_relaxed(DMAContext *dma, dma_addr_t addr, + void *buf, dma_addr_t len, + DMADirection dir) +{ + if (!dma_has_iommu(dma)) { + /* Fast-path for no IOMMU */ + address_space_rw(dma->as, addr, buf, len, dir == DMA_DIRECTION_FROM_DEVICE); + return 0; + } else { + return iommu_dma_memory_rw(dma, addr, buf, len, dir); + } +} + +static inline int dma_memory_read_relaxed(DMAContext *dma, dma_addr_t addr, + void *buf, dma_addr_t len) +{ + return dma_memory_rw_relaxed(dma, addr, buf, len, DMA_DIRECTION_TO_DEVICE); +} + +static inline int dma_memory_write_relaxed(DMAContext *dma, dma_addr_t addr, + const void *buf, dma_addr_t len) +{ + return dma_memory_rw_relaxed(dma, addr, (void *)buf, len, + DMA_DIRECTION_FROM_DEVICE); +} + +static inline int dma_memory_rw(DMAContext *dma, dma_addr_t addr, + void *buf, dma_addr_t len, + DMADirection dir) +{ + dma_barrier(dma, dir); + + return dma_memory_rw_relaxed(dma, addr, buf, len, dir); +} + +static inline int dma_memory_read(DMAContext *dma, dma_addr_t addr, + void *buf, dma_addr_t len) +{ + return dma_memory_rw(dma, addr, buf, len, DMA_DIRECTION_TO_DEVICE); +} + +static inline int dma_memory_write(DMAContext *dma, dma_addr_t addr, + const void *buf, dma_addr_t len) +{ + return dma_memory_rw(dma, addr, (void *)buf, len, + DMA_DIRECTION_FROM_DEVICE); +} + +int iommu_dma_memory_set(DMAContext *dma, dma_addr_t addr, uint8_t c, + dma_addr_t len); + +int dma_memory_set(DMAContext *dma, dma_addr_t addr, uint8_t c, dma_addr_t len); + +void *iommu_dma_memory_map(DMAContext *dma, + dma_addr_t addr, dma_addr_t *len, + DMADirection dir); +static inline void *dma_memory_map(DMAContext *dma, + dma_addr_t addr, dma_addr_t *len, + DMADirection dir) +{ + if (!dma_has_iommu(dma)) { + hwaddr xlen = *len; + void *p; + + p = address_space_map(dma->as, addr, &xlen, dir == DMA_DIRECTION_FROM_DEVICE); + *len = xlen; + return p; + } else { + return iommu_dma_memory_map(dma, addr, len, dir); + } +} + +void iommu_dma_memory_unmap(DMAContext *dma, + void *buffer, dma_addr_t len, + DMADirection dir, dma_addr_t access_len); +static inline void dma_memory_unmap(DMAContext *dma, + void *buffer, dma_addr_t len, + DMADirection dir, dma_addr_t access_len) +{ + if (!dma_has_iommu(dma)) { + address_space_unmap(dma->as, buffer, (hwaddr)len, + dir == DMA_DIRECTION_FROM_DEVICE, access_len); + } else { + iommu_dma_memory_unmap(dma, buffer, len, dir, access_len); + } +} + +#define DEFINE_LDST_DMA(_lname, _sname, _bits, _end) \ + static inline uint##_bits##_t ld##_lname##_##_end##_dma(DMAContext *dma, \ + dma_addr_t addr) \ + { \ + uint##_bits##_t val; \ + dma_memory_read(dma, addr, &val, (_bits) / 8); \ + return _end##_bits##_to_cpu(val); \ + } \ + static inline void st##_sname##_##_end##_dma(DMAContext *dma, \ + dma_addr_t addr, \ + uint##_bits##_t val) \ + { \ + val = cpu_to_##_end##_bits(val); \ + dma_memory_write(dma, addr, &val, (_bits) / 8); \ + } + +static inline uint8_t ldub_dma(DMAContext *dma, dma_addr_t addr) +{ + uint8_t val; + + dma_memory_read(dma, addr, &val, 1); + return val; +} + +static inline void stb_dma(DMAContext *dma, dma_addr_t addr, uint8_t val) +{ + dma_memory_write(dma, addr, &val, 1); +} + +DEFINE_LDST_DMA(uw, w, 16, le); +DEFINE_LDST_DMA(l, l, 32, le); +DEFINE_LDST_DMA(q, q, 64, le); +DEFINE_LDST_DMA(uw, w, 16, be); +DEFINE_LDST_DMA(l, l, 32, be); +DEFINE_LDST_DMA(q, q, 64, be); + +#undef DEFINE_LDST_DMA + +void dma_context_init(DMAContext *dma, AddressSpace *as, DMATranslateFunc translate, + DMAMapFunc map, DMAUnmapFunc unmap); + +struct ScatterGatherEntry { + dma_addr_t base; + dma_addr_t len; +}; + +void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint, DMAContext *dma); +void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len); +void qemu_sglist_destroy(QEMUSGList *qsg); +#endif + +typedef BlockDriverAIOCB *DMAIOFunc(BlockDriverState *bs, int64_t sector_num, + QEMUIOVector *iov, int nb_sectors, + BlockDriverCompletionFunc *cb, void *opaque); + +BlockDriverAIOCB *dma_bdrv_io(BlockDriverState *bs, + QEMUSGList *sg, uint64_t sector_num, + DMAIOFunc *io_func, BlockDriverCompletionFunc *cb, + void *opaque, DMADirection dir); +BlockDriverAIOCB *dma_bdrv_read(BlockDriverState *bs, + QEMUSGList *sg, uint64_t sector, + BlockDriverCompletionFunc *cb, void *opaque); +BlockDriverAIOCB *dma_bdrv_write(BlockDriverState *bs, + QEMUSGList *sg, uint64_t sector, + BlockDriverCompletionFunc *cb, void *opaque); +uint64_t dma_buf_read(uint8_t *ptr, int32_t len, QEMUSGList *sg); +uint64_t dma_buf_write(uint8_t *ptr, int32_t len, QEMUSGList *sg); + +void dma_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie, + QEMUSGList *sg, enum BlockAcctType type); + +#endif diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h new file mode 100644 index 0000000000..e25b7cfb73 --- /dev/null +++ b/include/sysemu/dump.h @@ -0,0 +1,35 @@ +/* + * QEMU dump + * + * Copyright Fujitsu, Corp. 2011, 2012 + * + * Authors: + * Wen Congyang + * + * 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 DUMP_H +#define DUMP_H + +typedef struct ArchDumpInfo { + int d_machine; /* Architecture */ + int d_endian; /* ELFDATA2LSB or ELFDATA2MSB */ + int d_class; /* ELFCLASS32 or ELFCLASS64 */ +} ArchDumpInfo; + +typedef int (*write_core_dump_function)(void *buf, size_t size, void *opaque); +int cpu_write_elf64_note(write_core_dump_function f, CPUArchState *env, + int cpuid, void *opaque); +int cpu_write_elf32_note(write_core_dump_function f, CPUArchState *env, + int cpuid, void *opaque); +int cpu_write_elf64_qemunote(write_core_dump_function f, CPUArchState *env, + void *opaque); +int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env, + void *opaque); +int cpu_get_dump_info(ArchDumpInfo *info); +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus); + +#endif diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h new file mode 100644 index 0000000000..131d2bdc15 --- /dev/null +++ b/include/sysemu/kvm.h @@ -0,0 +1,280 @@ +/* + * QEMU KVM support + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * 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_KVM_H +#define QEMU_KVM_H + +#include +#include "config-host.h" +#include "qemu/queue.h" + +#ifdef CONFIG_KVM +#include +#include +#endif + +extern int kvm_allowed; +extern bool kvm_kernel_irqchip; +extern bool kvm_async_interrupts_allowed; +extern bool kvm_irqfds_allowed; +extern bool kvm_msi_via_irqfd_allowed; +extern bool kvm_gsi_routing_allowed; + +#if defined CONFIG_KVM || !defined NEED_CPU_H +#define kvm_enabled() (kvm_allowed) +/** + * kvm_irqchip_in_kernel: + * + * Returns: true if the user asked us to create an in-kernel + * irqchip via the "kernel_irqchip=on" machine option. + * What this actually means is architecture and machine model + * specific: on PC, for instance, it means that the LAPIC, + * IOAPIC and PIT are all in kernel. This function should never + * be used from generic target-independent code: use one of the + * following functions or some other specific check instead. + */ +#define kvm_irqchip_in_kernel() (kvm_kernel_irqchip) + +/** + * kvm_async_interrupts_enabled: + * + * Returns: true if we can deliver interrupts to KVM + * asynchronously (ie by ioctl from any thread at any time) + * rather than having to do interrupt delivery synchronously + * (where the vcpu must be stopped at a suitable point first). + */ +#define kvm_async_interrupts_enabled() (kvm_async_interrupts_allowed) + +/** + * kvm_irqfds_enabled: + * + * Returns: true if we can use irqfds to inject interrupts into + * a KVM CPU (ie the kernel supports irqfds and we are running + * with a configuration where it is meaningful to use them). + */ +#define kvm_irqfds_enabled() (kvm_irqfds_allowed) + +/** + * kvm_msi_via_irqfd_enabled: + * + * Returns: true if we can route a PCI MSI (Message Signaled Interrupt) + * to a KVM CPU via an irqfd. This requires that the kernel supports + * this and that we're running in a configuration that permits it. + */ +#define kvm_msi_via_irqfd_enabled() (kvm_msi_via_irqfd_allowed) + +/** + * kvm_gsi_routing_enabled: + * + * Returns: true if GSI routing is enabled (ie the kernel supports + * it and we're running in a configuration that permits it). + */ +#define kvm_gsi_routing_enabled() (kvm_gsi_routing_allowed) + +#else +#define kvm_enabled() (0) +#define kvm_irqchip_in_kernel() (false) +#define kvm_async_interrupts_enabled() (false) +#define kvm_irqfds_enabled() (false) +#define kvm_msi_via_irqfd_enabled() (false) +#define kvm_gsi_routing_allowed() (false) +#endif + +struct kvm_run; +struct kvm_lapic_state; + +typedef struct KVMCapabilityInfo { + const char *name; + int value; +} KVMCapabilityInfo; + +#define KVM_CAP_INFO(CAP) { "KVM_CAP_" stringify(CAP), KVM_CAP_##CAP } +#define KVM_CAP_LAST_INFO { NULL, 0 } + +struct KVMState; +typedef struct KVMState KVMState; +extern KVMState *kvm_state; + +/* external API */ + +int kvm_init(void); + +int kvm_has_sync_mmu(void); +int kvm_has_vcpu_events(void); +int kvm_has_robust_singlestep(void); +int kvm_has_debugregs(void); +int kvm_has_xsave(void); +int kvm_has_xcrs(void); +int kvm_has_pit_state2(void); +int kvm_has_many_ioeventfds(void); +int kvm_has_gsi_routing(void); +int kvm_has_intx_set_mask(void); + +#ifdef NEED_CPU_H +int kvm_init_vcpu(CPUArchState *env); + +int kvm_cpu_exec(CPUArchState *env); + +#if !defined(CONFIG_USER_ONLY) +void *kvm_vmalloc(ram_addr_t size); +void *kvm_arch_vmalloc(ram_addr_t size); +void kvm_setup_guest_memory(void *start, size_t size); + +void kvm_flush_coalesced_mmio_buffer(void); +#endif + +int kvm_insert_breakpoint(CPUArchState *current_env, target_ulong addr, + target_ulong len, int type); +int kvm_remove_breakpoint(CPUArchState *current_env, target_ulong addr, + target_ulong len, int type); +void kvm_remove_all_breakpoints(CPUArchState *current_env); +int kvm_update_guest_debug(CPUArchState *env, unsigned long reinject_trap); +#ifndef _WIN32 +int kvm_set_signal_mask(CPUArchState *env, const sigset_t *sigset); +#endif + +int kvm_on_sigbus_vcpu(CPUArchState *env, int code, void *addr); +int kvm_on_sigbus(int code, void *addr); + +/* internal API */ + +int kvm_ioctl(KVMState *s, int type, ...); + +int kvm_vm_ioctl(KVMState *s, int type, ...); + +int kvm_vcpu_ioctl(CPUArchState *env, int type, ...); + +/* Arch specific hooks */ + +extern const KVMCapabilityInfo kvm_arch_required_capabilities[]; + +void kvm_arch_pre_run(CPUArchState *env, struct kvm_run *run); +void kvm_arch_post_run(CPUArchState *env, struct kvm_run *run); + +int kvm_arch_handle_exit(CPUArchState *env, struct kvm_run *run); + +int kvm_arch_process_async_events(CPUArchState *env); + +int kvm_arch_get_registers(CPUArchState *env); + +/* state subset only touched by the VCPU itself during runtime */ +#define KVM_PUT_RUNTIME_STATE 1 +/* state subset modified during VCPU reset */ +#define KVM_PUT_RESET_STATE 2 +/* full state set, modified during initialization or on vmload */ +#define KVM_PUT_FULL_STATE 3 + +int kvm_arch_put_registers(CPUArchState *env, int level); + +int kvm_arch_init(KVMState *s); + +int kvm_arch_init_vcpu(CPUArchState *env); + +void kvm_arch_reset_vcpu(CPUArchState *env); + +int kvm_arch_on_sigbus_vcpu(CPUArchState *env, int code, void *addr); +int kvm_arch_on_sigbus(int code, void *addr); + +void kvm_arch_init_irq_routing(KVMState *s); + +int kvm_set_irq(KVMState *s, int irq, int level); +int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg); + +void kvm_irqchip_add_irq_route(KVMState *s, int gsi, int irqchip, int pin); + +void kvm_put_apic_state(DeviceState *d, struct kvm_lapic_state *kapic); +void kvm_get_apic_state(DeviceState *d, struct kvm_lapic_state *kapic); + +struct kvm_guest_debug; +struct kvm_debug_exit_arch; + +struct kvm_sw_breakpoint { + target_ulong pc; + target_ulong saved_insn; + int use_count; + QTAILQ_ENTRY(kvm_sw_breakpoint) entry; +}; + +QTAILQ_HEAD(kvm_sw_breakpoint_head, kvm_sw_breakpoint); + +struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUArchState *env, + target_ulong pc); + +int kvm_sw_breakpoints_active(CPUArchState *env); + +int kvm_arch_insert_sw_breakpoint(CPUArchState *current_env, + struct kvm_sw_breakpoint *bp); +int kvm_arch_remove_sw_breakpoint(CPUArchState *current_env, + struct kvm_sw_breakpoint *bp); +int kvm_arch_insert_hw_breakpoint(target_ulong addr, + target_ulong len, int type); +int kvm_arch_remove_hw_breakpoint(target_ulong addr, + target_ulong len, int type); +void kvm_arch_remove_all_hw_breakpoints(void); + +void kvm_arch_update_guest_debug(CPUArchState *env, struct kvm_guest_debug *dbg); + +bool kvm_arch_stop_on_emulation_error(CPUArchState *env); + +int kvm_check_extension(KVMState *s, unsigned int extension); + +uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function, + uint32_t index, int reg); +void kvm_cpu_synchronize_state(CPUArchState *env); +void kvm_cpu_synchronize_post_reset(CPUArchState *env); +void kvm_cpu_synchronize_post_init(CPUArchState *env); + +/* generic hooks - to be moved/refactored once there are more users */ + +static inline void cpu_synchronize_state(CPUArchState *env) +{ + if (kvm_enabled()) { + kvm_cpu_synchronize_state(env); + } +} + +static inline void cpu_synchronize_post_reset(CPUArchState *env) +{ + if (kvm_enabled()) { + kvm_cpu_synchronize_post_reset(env); + } +} + +static inline void cpu_synchronize_post_init(CPUArchState *env) +{ + if (kvm_enabled()) { + kvm_cpu_synchronize_post_init(env); + } +} + + +#if !defined(CONFIG_USER_ONLY) +int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr, + hwaddr *phys_addr); +#endif + +#endif +int kvm_set_ioeventfd_mmio(int fd, uint32_t adr, uint32_t val, bool assign, + uint32_t size); + +int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign); + +int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg); +int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg); +void kvm_irqchip_release_virq(KVMState *s, int virq); + +int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq); +int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq); +void kvm_pc_gsi_handler(void *opaque, int n, int level); +void kvm_pc_setup_irq_routing(bool pci_enabled); +#endif diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h new file mode 100644 index 0000000000..1256125963 --- /dev/null +++ b/include/sysemu/memory_mapping.h @@ -0,0 +1,64 @@ +/* + * QEMU memory mapping + * + * Copyright Fujitsu, Corp. 2011, 2012 + * + * Authors: + * Wen Congyang + * + * 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 MEMORY_MAPPING_H +#define MEMORY_MAPPING_H + +#include "qemu/queue.h" + +/* The physical and virtual address in the memory mapping are contiguous. */ +typedef struct MemoryMapping { + hwaddr phys_addr; + target_ulong virt_addr; + ram_addr_t length; + QTAILQ_ENTRY(MemoryMapping) next; +} MemoryMapping; + +typedef struct MemoryMappingList { + unsigned int num; + MemoryMapping *last_mapping; + QTAILQ_HEAD(, MemoryMapping) head; +} MemoryMappingList; + +int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env); +bool cpu_paging_enabled(CPUArchState *env); + +/* + * add or merge the memory region [phys_addr, phys_addr + length) into the + * memory mapping's list. The region's virtual address starts with virt_addr, + * and is contiguous. The list is sorted by phys_addr. + */ +void memory_mapping_list_add_merge_sorted(MemoryMappingList *list, + hwaddr phys_addr, + hwaddr virt_addr, + ram_addr_t length); + +void memory_mapping_list_free(MemoryMappingList *list); + +void memory_mapping_list_init(MemoryMappingList *list); + +/* + * Return value: + * 0: success + * -1: failed + * -2: unsupported + */ +int qemu_get_guest_memory_mapping(MemoryMappingList *list); + +/* get guest's memory mapping without do paging(virtual address is 0). */ +void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list); + +void memory_mapping_filter(MemoryMappingList *list, int64_t begin, + int64_t length); + +#endif diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h new file mode 100644 index 0000000000..7f198e475c --- /dev/null +++ b/include/sysemu/os-posix.h @@ -0,0 +1,51 @@ +/* + * posix specific declarations + * + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2010 Jes Sorensen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef QEMU_OS_POSIX_H +#define QEMU_OS_POSIX_H + +void os_set_line_buffering(void); +void os_set_proc_name(const char *s); +void os_setup_signal_handling(void); +void os_daemonize(void); +void os_setup_post(void); + +typedef struct timeval qemu_timeval; +#define qemu_gettimeofday(tp) gettimeofday(tp, NULL) + +#ifndef CONFIG_UTIMENSAT +#ifndef UTIME_NOW +# define UTIME_NOW ((1l << 30) - 1l) +#endif +#ifndef UTIME_OMIT +# define UTIME_OMIT ((1l << 30) - 2l) +#endif +#endif +typedef struct timespec qemu_timespec; +int qemu_utimens(const char *path, const qemu_timespec *times); + +bool is_daemonized(void); + +#endif diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h new file mode 100644 index 0000000000..d0e9234d24 --- /dev/null +++ b/include/sysemu/os-win32.h @@ -0,0 +1,99 @@ +/* + * win32 specific declarations + * + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2010 Jes Sorensen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef QEMU_OS_WIN32_H +#define QEMU_OS_WIN32_H + +#include +#include + +/* Workaround for older versions of MinGW. */ +#ifndef ECONNREFUSED +# define ECONNREFUSED WSAECONNREFUSED +#endif +#ifndef EINPROGRESS +# define EINPROGRESS WSAEINPROGRESS +#endif +#ifndef EHOSTUNREACH +# define EHOSTUNREACH WSAEHOSTUNREACH +#endif +#ifndef EINTR +# define EINTR WSAEINTR +#endif +#ifndef EINPROGRESS +# define EINPROGRESS WSAEINPROGRESS +#endif +#ifndef ENETUNREACH +# define ENETUNREACH WSAENETUNREACH +#endif +#ifndef ENOTCONN +# define ENOTCONN WSAENOTCONN +#endif +#ifndef EWOULDBLOCK +# define EWOULDBLOCK WSAEWOULDBLOCK +#endif + +#if defined(_WIN64) +/* On w64, setjmp is implemented by _setjmp which needs a second parameter. + * If this parameter is NULL, longjump does no stack unwinding. + * That is what we need for QEMU. Passing the value of register rsp (default) + * lets longjmp try a stack unwinding which will crash with generated code. */ +# undef setjmp +# define setjmp(env) _setjmp(env, NULL) +#endif + +/* Declaration of ffs() is missing in MinGW's strings.h. */ +int ffs(int i); + +/* Missing POSIX functions. Don't use MinGW-w64 macros. */ +#undef gmtime_r +struct tm *gmtime_r(const time_t *timep, struct tm *result); +#undef localtime_r +struct tm *localtime_r(const time_t *timep, struct tm *result); + +static inline void os_setup_signal_handling(void) {} +static inline void os_daemonize(void) {} +static inline void os_setup_post(void) {} +void os_set_line_buffering(void); +static inline void os_set_proc_name(const char *dummy) {} + +#if !defined(EPROTONOSUPPORT) +# define EPROTONOSUPPORT EINVAL +#endif + +int setenv(const char *name, const char *value, int overwrite); + +typedef struct { + long tv_sec; + long tv_usec; +} qemu_timeval; +int qemu_gettimeofday(qemu_timeval *tp); + +static inline bool is_daemonized(void) +{ + return false; +} + +#endif diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h new file mode 100644 index 0000000000..723a4f9536 --- /dev/null +++ b/include/sysemu/qtest.h @@ -0,0 +1,53 @@ +/* + * Test Server + * + * Copyright IBM, Corp. 2011 + * + * Authors: + * Anthony Liguori + * + * 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 QTEST_H +#define QTEST_H + +#include "qemu-common.h" + +#if !defined(CONFIG_USER_ONLY) +extern int qtest_allowed; +extern const char *qtest_chrdev; +extern const char *qtest_log; + +static inline bool qtest_enabled(void) +{ + return qtest_allowed; +} + +static inline int qtest_available(void) +{ + return 1; +} + +int qtest_init(void); +#else +static inline bool qtest_enabled(void) +{ + return false; +} + +static inline int qtest_available(void) +{ + return 0; +} + +static inline int qtest_init(void) +{ + return 0; +} + +#endif + +#endif diff --git a/include/sysemu/seccomp.h b/include/sysemu/seccomp.h new file mode 100644 index 0000000000..1189fa241d --- /dev/null +++ b/include/sysemu/seccomp.h @@ -0,0 +1,22 @@ +/* + * QEMU seccomp mode 2 support with libseccomp + * + * Copyright IBM, Corp. 2012 + * + * Authors: + * Eduardo Otubo + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ +#ifndef QEMU_SECCOMP_H +#define QEMU_SECCOMP_H + +#include +#include "qemu/osdep.h" + +int seccomp_start(void); +#endif diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h new file mode 100644 index 0000000000..8eaa4707a0 --- /dev/null +++ b/include/sysemu/sysemu.h @@ -0,0 +1,185 @@ +#ifndef SYSEMU_H +#define SYSEMU_H +/* Misc. things related to the system emulator. */ + +#include "qemu/typedefs.h" +#include "qemu/option.h" +#include "qemu/queue.h" +#include "qemu/timer.h" +#include "qapi-types.h" +#include "qemu/notify.h" +#include "qemu/main-loop.h" + +/* vl.c */ + +extern const char *bios_name; + +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" + +bool runstate_check(RunState state); +void runstate_set(RunState new_state); +int runstate_is_running(void); +typedef struct vm_change_state_entry VMChangeStateEntry; +typedef void VMChangeStateHandler(void *opaque, int running, RunState state); + +VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, + void *opaque); +void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); +void vm_state_notify(int running, RunState state); + +#define VMRESET_SILENT false +#define VMRESET_REPORT true + +void vm_start(void); +void vm_stop(RunState state); +void vm_stop_force_state(RunState state); + +typedef enum WakeupReason { + QEMU_WAKEUP_REASON_OTHER = 0, + QEMU_WAKEUP_REASON_RTC, + QEMU_WAKEUP_REASON_PMTIMER, +} WakeupReason; + +void qemu_system_reset_request(void); +void qemu_system_suspend_request(void); +void qemu_register_suspend_notifier(Notifier *notifier); +void qemu_system_wakeup_request(WakeupReason reason); +void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); +void qemu_register_wakeup_notifier(Notifier *notifier); +void qemu_system_shutdown_request(void); +void qemu_system_powerdown_request(void); +void qemu_register_powerdown_notifier(Notifier *notifier); +void qemu_system_debug_request(void); +void qemu_system_vmstop_request(RunState reason); +int qemu_shutdown_requested_get(void); +int qemu_reset_requested_get(void); +void qemu_system_killed(int signal, pid_t pid); +void qemu_devices_reset(void); +void qemu_system_reset(bool report); + +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); +int load_vmstate(const char *name); +void do_delvm(Monitor *mon, const QDict *qdict); +void do_info_snapshots(Monitor *mon); + +void qemu_announce_self(void); + +bool qemu_savevm_state_blocked(Error **errp); +int qemu_savevm_state_begin(QEMUFile *f, + const MigrationParams *params); +int qemu_savevm_state_iterate(QEMUFile *f); +int qemu_savevm_state_complete(QEMUFile *f); +void qemu_savevm_state_cancel(QEMUFile *f); +int qemu_loadvm_state(QEMUFile *f); + +/* SLIRP */ +void do_info_slirp(Monitor *mon); + +typedef enum DisplayType +{ + DT_DEFAULT, + DT_CURSES, + DT_SDL, + DT_NOGRAPHIC, + DT_NONE, +} DisplayType; + +extern int autostart; +extern int bios_size; + +typedef enum { + VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, +} VGAInterfaceType; + +extern int vga_interface_type; +#define xenfb_enabled (vga_interface_type == VGA_XENFB) +#define qxl_enabled (vga_interface_type == VGA_QXL) + +extern int graphic_width; +extern int graphic_height; +extern int graphic_depth; +extern DisplayType display_type; +extern const char *keyboard_layout; +extern int win2k_install_hack; +extern int alt_grab; +extern int ctrl_grab; +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; +extern uint8_t *boot_splash_filedata; +extern int boot_splash_filedata_size; +extern uint8_t qemu_extra_params_fw[2]; +extern QEMUClock *rtc_clock; + +#define MAX_NODES 64 +#define MAX_CPUMASK_BITS 255 +extern int nb_numa_nodes; +extern uint64_t node_mem[MAX_NODES]; +extern unsigned long *node_cpumask[MAX_NODES]; + +#define MAX_OPTION_ROMS 16 +typedef struct QEMUOptionRom { + const char *name; + int32_t bootindex; +} QEMUOptionRom; +extern QEMUOptionRom option_rom[MAX_OPTION_ROMS]; +extern int nb_option_roms; + +#define MAX_PROM_ENVS 128 +extern const char *prom_envs[MAX_PROM_ENVS]; +extern unsigned int nb_prom_envs; + +/* pci-hotplug */ +void pci_device_hot_add(Monitor *mon, const QDict *qdict); +int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo); +void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict); + +/* generic hotplug */ +void drive_hot_add(Monitor *mon, const QDict *qdict); + +/* pcie aer error injection */ +void pcie_aer_inject_error_print(Monitor *mon, const QObject *data); +int do_pcie_aer_inject_error(Monitor *mon, + const QDict *qdict, QObject **ret_data); + +/* serial ports */ + +#define MAX_SERIAL_PORTS 4 + +extern CharDriverState *serial_hds[MAX_SERIAL_PORTS]; + +/* parallel ports */ + +#define MAX_PARALLEL_PORTS 3 + +extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; + +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); + +void add_boot_device_path(int32_t bootindex, DeviceState *dev, + const char *suffix); +char *get_boot_devices_list(uint32_t *size); + +bool usb_enabled(bool default_usb); + +#endif diff --git a/include/sysemu/xen-mapcache.h b/include/sysemu/xen-mapcache.h new file mode 100644 index 0000000000..c59804060b --- /dev/null +++ b/include/sysemu/xen-mapcache.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2011 Citrix Ltd. + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef XEN_MAPCACHE_H +#define XEN_MAPCACHE_H + +#include + +typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr start_addr, + ram_addr_t size, + void *opaque); +#ifdef CONFIG_XEN + +void xen_map_cache_init(phys_offset_to_gaddr_t f, + void *opaque); +uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size, + uint8_t lock); +ram_addr_t xen_ram_addr_from_mapcache(void *ptr); +void xen_invalidate_map_cache_entry(uint8_t *buffer); +void xen_invalidate_map_cache(void); + +#else + +static inline void xen_map_cache_init(phys_offset_to_gaddr_t f, + void *opaque) +{ +} + +static inline uint8_t *xen_map_cache(hwaddr phys_addr, + hwaddr size, + uint8_t lock) +{ + abort(); +} + +static inline ram_addr_t xen_ram_addr_from_mapcache(void *ptr) +{ + abort(); +} + +static inline void xen_invalidate_map_cache_entry(uint8_t *buffer) +{ +} + +static inline void xen_invalidate_map_cache(void) +{ +} + +#endif + +#endif /* !XEN_MAPCACHE_H */ diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h index a0d1a50487..8b192e9613 100644 --- a/include/ui/spice-display.h +++ b/include/ui/spice-display.h @@ -21,7 +21,7 @@ #include "qemu/thread.h" #include "ui/qemu-pixman.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #define NUM_MEMSLOTS 8 #define MEMSLOT_GENERATION_BITS 8 diff --git a/kvm-all.c b/kvm-all.c index 41ea3aa6ee..5aa65c4c15 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -24,11 +24,11 @@ #include "qemu/atomic.h" #include "qemu/option.h" #include "qemu/config-file.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "hw/hw.h" #include "hw/pci/msi.h" #include "exec/gdbstub.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "qemu/bswap.h" #include "exec/memory.h" #include "exec/address-spaces.h" diff --git a/kvm-stub.c b/kvm-stub.c index 8de8ebd3d2..5b971521cd 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -15,7 +15,7 @@ #include "hw/pci/msi.h" #include "cpu.h" #include "exec/gdbstub.h" -#include "kvm.h" +#include "sysemu/kvm.h" KVMState *kvm_state; bool kvm_kernel_irqchip; diff --git a/kvm.h b/kvm.h deleted file mode 100644 index 131d2bdc15..0000000000 --- a/kvm.h +++ /dev/null @@ -1,280 +0,0 @@ -/* - * QEMU KVM support - * - * Copyright IBM, Corp. 2008 - * - * Authors: - * Anthony Liguori - * - * 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_KVM_H -#define QEMU_KVM_H - -#include -#include "config-host.h" -#include "qemu/queue.h" - -#ifdef CONFIG_KVM -#include -#include -#endif - -extern int kvm_allowed; -extern bool kvm_kernel_irqchip; -extern bool kvm_async_interrupts_allowed; -extern bool kvm_irqfds_allowed; -extern bool kvm_msi_via_irqfd_allowed; -extern bool kvm_gsi_routing_allowed; - -#if defined CONFIG_KVM || !defined NEED_CPU_H -#define kvm_enabled() (kvm_allowed) -/** - * kvm_irqchip_in_kernel: - * - * Returns: true if the user asked us to create an in-kernel - * irqchip via the "kernel_irqchip=on" machine option. - * What this actually means is architecture and machine model - * specific: on PC, for instance, it means that the LAPIC, - * IOAPIC and PIT are all in kernel. This function should never - * be used from generic target-independent code: use one of the - * following functions or some other specific check instead. - */ -#define kvm_irqchip_in_kernel() (kvm_kernel_irqchip) - -/** - * kvm_async_interrupts_enabled: - * - * Returns: true if we can deliver interrupts to KVM - * asynchronously (ie by ioctl from any thread at any time) - * rather than having to do interrupt delivery synchronously - * (where the vcpu must be stopped at a suitable point first). - */ -#define kvm_async_interrupts_enabled() (kvm_async_interrupts_allowed) - -/** - * kvm_irqfds_enabled: - * - * Returns: true if we can use irqfds to inject interrupts into - * a KVM CPU (ie the kernel supports irqfds and we are running - * with a configuration where it is meaningful to use them). - */ -#define kvm_irqfds_enabled() (kvm_irqfds_allowed) - -/** - * kvm_msi_via_irqfd_enabled: - * - * Returns: true if we can route a PCI MSI (Message Signaled Interrupt) - * to a KVM CPU via an irqfd. This requires that the kernel supports - * this and that we're running in a configuration that permits it. - */ -#define kvm_msi_via_irqfd_enabled() (kvm_msi_via_irqfd_allowed) - -/** - * kvm_gsi_routing_enabled: - * - * Returns: true if GSI routing is enabled (ie the kernel supports - * it and we're running in a configuration that permits it). - */ -#define kvm_gsi_routing_enabled() (kvm_gsi_routing_allowed) - -#else -#define kvm_enabled() (0) -#define kvm_irqchip_in_kernel() (false) -#define kvm_async_interrupts_enabled() (false) -#define kvm_irqfds_enabled() (false) -#define kvm_msi_via_irqfd_enabled() (false) -#define kvm_gsi_routing_allowed() (false) -#endif - -struct kvm_run; -struct kvm_lapic_state; - -typedef struct KVMCapabilityInfo { - const char *name; - int value; -} KVMCapabilityInfo; - -#define KVM_CAP_INFO(CAP) { "KVM_CAP_" stringify(CAP), KVM_CAP_##CAP } -#define KVM_CAP_LAST_INFO { NULL, 0 } - -struct KVMState; -typedef struct KVMState KVMState; -extern KVMState *kvm_state; - -/* external API */ - -int kvm_init(void); - -int kvm_has_sync_mmu(void); -int kvm_has_vcpu_events(void); -int kvm_has_robust_singlestep(void); -int kvm_has_debugregs(void); -int kvm_has_xsave(void); -int kvm_has_xcrs(void); -int kvm_has_pit_state2(void); -int kvm_has_many_ioeventfds(void); -int kvm_has_gsi_routing(void); -int kvm_has_intx_set_mask(void); - -#ifdef NEED_CPU_H -int kvm_init_vcpu(CPUArchState *env); - -int kvm_cpu_exec(CPUArchState *env); - -#if !defined(CONFIG_USER_ONLY) -void *kvm_vmalloc(ram_addr_t size); -void *kvm_arch_vmalloc(ram_addr_t size); -void kvm_setup_guest_memory(void *start, size_t size); - -void kvm_flush_coalesced_mmio_buffer(void); -#endif - -int kvm_insert_breakpoint(CPUArchState *current_env, target_ulong addr, - target_ulong len, int type); -int kvm_remove_breakpoint(CPUArchState *current_env, target_ulong addr, - target_ulong len, int type); -void kvm_remove_all_breakpoints(CPUArchState *current_env); -int kvm_update_guest_debug(CPUArchState *env, unsigned long reinject_trap); -#ifndef _WIN32 -int kvm_set_signal_mask(CPUArchState *env, const sigset_t *sigset); -#endif - -int kvm_on_sigbus_vcpu(CPUArchState *env, int code, void *addr); -int kvm_on_sigbus(int code, void *addr); - -/* internal API */ - -int kvm_ioctl(KVMState *s, int type, ...); - -int kvm_vm_ioctl(KVMState *s, int type, ...); - -int kvm_vcpu_ioctl(CPUArchState *env, int type, ...); - -/* Arch specific hooks */ - -extern const KVMCapabilityInfo kvm_arch_required_capabilities[]; - -void kvm_arch_pre_run(CPUArchState *env, struct kvm_run *run); -void kvm_arch_post_run(CPUArchState *env, struct kvm_run *run); - -int kvm_arch_handle_exit(CPUArchState *env, struct kvm_run *run); - -int kvm_arch_process_async_events(CPUArchState *env); - -int kvm_arch_get_registers(CPUArchState *env); - -/* state subset only touched by the VCPU itself during runtime */ -#define KVM_PUT_RUNTIME_STATE 1 -/* state subset modified during VCPU reset */ -#define KVM_PUT_RESET_STATE 2 -/* full state set, modified during initialization or on vmload */ -#define KVM_PUT_FULL_STATE 3 - -int kvm_arch_put_registers(CPUArchState *env, int level); - -int kvm_arch_init(KVMState *s); - -int kvm_arch_init_vcpu(CPUArchState *env); - -void kvm_arch_reset_vcpu(CPUArchState *env); - -int kvm_arch_on_sigbus_vcpu(CPUArchState *env, int code, void *addr); -int kvm_arch_on_sigbus(int code, void *addr); - -void kvm_arch_init_irq_routing(KVMState *s); - -int kvm_set_irq(KVMState *s, int irq, int level); -int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg); - -void kvm_irqchip_add_irq_route(KVMState *s, int gsi, int irqchip, int pin); - -void kvm_put_apic_state(DeviceState *d, struct kvm_lapic_state *kapic); -void kvm_get_apic_state(DeviceState *d, struct kvm_lapic_state *kapic); - -struct kvm_guest_debug; -struct kvm_debug_exit_arch; - -struct kvm_sw_breakpoint { - target_ulong pc; - target_ulong saved_insn; - int use_count; - QTAILQ_ENTRY(kvm_sw_breakpoint) entry; -}; - -QTAILQ_HEAD(kvm_sw_breakpoint_head, kvm_sw_breakpoint); - -struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUArchState *env, - target_ulong pc); - -int kvm_sw_breakpoints_active(CPUArchState *env); - -int kvm_arch_insert_sw_breakpoint(CPUArchState *current_env, - struct kvm_sw_breakpoint *bp); -int kvm_arch_remove_sw_breakpoint(CPUArchState *current_env, - struct kvm_sw_breakpoint *bp); -int kvm_arch_insert_hw_breakpoint(target_ulong addr, - target_ulong len, int type); -int kvm_arch_remove_hw_breakpoint(target_ulong addr, - target_ulong len, int type); -void kvm_arch_remove_all_hw_breakpoints(void); - -void kvm_arch_update_guest_debug(CPUArchState *env, struct kvm_guest_debug *dbg); - -bool kvm_arch_stop_on_emulation_error(CPUArchState *env); - -int kvm_check_extension(KVMState *s, unsigned int extension); - -uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function, - uint32_t index, int reg); -void kvm_cpu_synchronize_state(CPUArchState *env); -void kvm_cpu_synchronize_post_reset(CPUArchState *env); -void kvm_cpu_synchronize_post_init(CPUArchState *env); - -/* generic hooks - to be moved/refactored once there are more users */ - -static inline void cpu_synchronize_state(CPUArchState *env) -{ - if (kvm_enabled()) { - kvm_cpu_synchronize_state(env); - } -} - -static inline void cpu_synchronize_post_reset(CPUArchState *env) -{ - if (kvm_enabled()) { - kvm_cpu_synchronize_post_reset(env); - } -} - -static inline void cpu_synchronize_post_init(CPUArchState *env) -{ - if (kvm_enabled()) { - kvm_cpu_synchronize_post_init(env); - } -} - - -#if !defined(CONFIG_USER_ONLY) -int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr, - hwaddr *phys_addr); -#endif - -#endif -int kvm_set_ioeventfd_mmio(int fd, uint32_t adr, uint32_t val, bool assign, - uint32_t size); - -int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign); - -int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg); -int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg); -void kvm_irqchip_release_virq(KVMState *s, int virq); - -int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNotifier *n, int virq); -int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq); -void kvm_pc_gsi_handler(void *opaque, int n, int level); -void kvm_pc_setup_irq_routing(bool pci_enabled); -#endif diff --git a/memory.c b/memory.c index d44200335b..35e6122dd7 100644 --- a/memory.c +++ b/memory.c @@ -17,7 +17,7 @@ #include "exec/address-spaces.h" #include "exec/ioport.h" #include "qemu/bitops.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include #include "exec/memory-internal.h" diff --git a/memory_mapping-stub.c b/memory_mapping-stub.c index 5f5fb99c58..24d5d67371 100644 --- a/memory_mapping-stub.c +++ b/memory_mapping-stub.c @@ -13,7 +13,7 @@ #include "cpu.h" #include "exec/cpu-all.h" -#include "memory_mapping.h" +#include "sysemu/memory_mapping.h" int qemu_get_guest_memory_mapping(MemoryMappingList *list) { diff --git a/memory_mapping.c b/memory_mapping.c index c829a9fa34..530f1d6793 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -13,7 +13,7 @@ #include "cpu.h" #include "exec/cpu-all.h" -#include "memory_mapping.h" +#include "sysemu/memory_mapping.h" static void memory_mapping_list_add_mapping_sorted(MemoryMappingList *list, MemoryMapping *mapping) diff --git a/memory_mapping.h b/memory_mapping.h deleted file mode 100644 index 1256125963..0000000000 --- a/memory_mapping.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * QEMU memory mapping - * - * Copyright Fujitsu, Corp. 2011, 2012 - * - * Authors: - * Wen Congyang - * - * 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 MEMORY_MAPPING_H -#define MEMORY_MAPPING_H - -#include "qemu/queue.h" - -/* The physical and virtual address in the memory mapping are contiguous. */ -typedef struct MemoryMapping { - hwaddr phys_addr; - target_ulong virt_addr; - ram_addr_t length; - QTAILQ_ENTRY(MemoryMapping) next; -} MemoryMapping; - -typedef struct MemoryMappingList { - unsigned int num; - MemoryMapping *last_mapping; - QTAILQ_HEAD(, MemoryMapping) head; -} MemoryMappingList; - -int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env); -bool cpu_paging_enabled(CPUArchState *env); - -/* - * add or merge the memory region [phys_addr, phys_addr + length) into the - * memory mapping's list. The region's virtual address starts with virt_addr, - * and is contiguous. The list is sorted by phys_addr. - */ -void memory_mapping_list_add_merge_sorted(MemoryMappingList *list, - hwaddr phys_addr, - hwaddr virt_addr, - ram_addr_t length); - -void memory_mapping_list_free(MemoryMappingList *list); - -void memory_mapping_list_init(MemoryMappingList *list); - -/* - * Return value: - * 0: success - * -1: failed - * -2: unsupported - */ -int qemu_get_guest_memory_mapping(MemoryMappingList *list); - -/* get guest's memory mapping without do paging(virtual address is 0). */ -void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list); - -void memory_mapping_filter(MemoryMappingList *list, int64_t begin, - int64_t length); - -#endif diff --git a/migration.c b/migration.c index 8c5c5670d8..810f25e7eb 100644 --- a/migration.c +++ b/migration.c @@ -17,7 +17,7 @@ #include "migration/migration.h" #include "monitor/monitor.h" #include "buffered_file.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "block/block.h" #include "qemu/sockets.h" #include "migration/block.h" diff --git a/monitor.c b/monitor.c index 878b2317af..200bef452f 100644 --- a/monitor.c +++ b/monitor.c @@ -35,17 +35,17 @@ #include "net/slirp.h" #include "qemu-char.h" #include "ui/qemu-spice.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "monitor/monitor.h" #include "monitor/readline.h" #include "ui/console.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "audio/audio.h" #include "disas/disas.h" -#include "balloon.h" +#include "sysemu/balloon.h" #include "qemu/timer.h" #include "migration/migration.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "qemu/acl.h" #include "qapi/qmp/qint.h" #include "qapi/qmp/qfloat.h" diff --git a/net/tap-bsd.c b/net/tap-bsd.c index b48182f678..01c705b4c0 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -24,7 +24,7 @@ #include "tap_int.h" #include "qemu-common.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/error-report.h" #ifdef __NetBSD__ diff --git a/net/tap-linux.c b/net/tap-linux.c index dd4b915243..059f5f34ab 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -30,7 +30,7 @@ #include #include -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu-common.h" #include "qemu/error-report.h" diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 3d5fee5542..486a7ea838 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -23,7 +23,7 @@ */ #include "tap_int.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include #include diff --git a/net/tap-win32.c b/net/tap-win32.c index 1ddd6fa6e6..0c63cbd203 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -31,7 +31,7 @@ #include "qemu-common.h" #include "clients.h" /* net_init_tap */ #include "net/net.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/error-report.h" #include #include diff --git a/net/tap.c b/net/tap.c index d34ff13398..eb40c42d7d 100644 --- a/net/tap.c +++ b/net/tap.c @@ -36,7 +36,7 @@ #include "net/net.h" #include "clients.h" #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu-common.h" #include "qemu/error-report.h" diff --git a/os-posix.c b/os-posix.c index 488e48005f..5c64518902 100644 --- a/os-posix.c +++ b/os-posix.c @@ -36,7 +36,7 @@ /* Needed early for CONFIG_BSD etc. */ #include "config-host.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "net/slirp.h" #include "qemu-options.h" diff --git a/os-win32.c b/os-win32.c index 13892ba320..9673a81c7d 100644 --- a/os-win32.c +++ b/os-win32.c @@ -30,7 +30,7 @@ #include #include #include "config-host.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu-options.h" /***********************************************************/ diff --git a/oslib-posix.c b/oslib-posix.c index a737d6e0e3..4f5ec6788b 100644 --- a/oslib-posix.c +++ b/oslib-posix.c @@ -49,7 +49,7 @@ extern int daemon(int, int); #endif #include "config-host.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "trace.h" #include "qemu/sockets.h" diff --git a/oslib-win32.c b/oslib-win32.c index 7f0dd07e5f..e7e283e875 100644 --- a/oslib-win32.c +++ b/oslib-win32.c @@ -27,7 +27,7 @@ */ #include #include "config-host.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/main-loop.h" #include "trace.h" #include "qemu/sockets.h" diff --git a/qemu-char.c b/qemu-char.c index 5a8d8f75a4..0cbe85318e 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -24,7 +24,7 @@ #include "qemu-common.h" #include "monitor/monitor.h" #include "ui/console.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/timer.h" #include "qemu-char.h" #include "hw/usb.h" diff --git a/qemu-common.h b/qemu-common.h index 40cd198fc1..6871cab371 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -43,11 +43,11 @@ #include #ifdef _WIN32 -#include "qemu-os-win32.h" +#include "sysemu/os-win32.h" #endif #ifdef CONFIG_POSIX -#include "qemu-os-posix.h" +#include "sysemu/os-posix.h" #endif #ifndef O_LARGEFILE diff --git a/qemu-img.c b/qemu-img.c index 4c8e2f3849..69cc02871b 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -28,7 +28,7 @@ #include "qemu/option.h" #include "qemu/error-report.h" #include "qemu/osdep.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "block/block_int.h" #include #include diff --git a/qemu-os-posix.h b/qemu-os-posix.h deleted file mode 100644 index 7f198e475c..0000000000 --- a/qemu-os-posix.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * posix specific declarations - * - * Copyright (c) 2003-2008 Fabrice Bellard - * Copyright (c) 2010 Jes Sorensen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef QEMU_OS_POSIX_H -#define QEMU_OS_POSIX_H - -void os_set_line_buffering(void); -void os_set_proc_name(const char *s); -void os_setup_signal_handling(void); -void os_daemonize(void); -void os_setup_post(void); - -typedef struct timeval qemu_timeval; -#define qemu_gettimeofday(tp) gettimeofday(tp, NULL) - -#ifndef CONFIG_UTIMENSAT -#ifndef UTIME_NOW -# define UTIME_NOW ((1l << 30) - 1l) -#endif -#ifndef UTIME_OMIT -# define UTIME_OMIT ((1l << 30) - 2l) -#endif -#endif -typedef struct timespec qemu_timespec; -int qemu_utimens(const char *path, const qemu_timespec *times); - -bool is_daemonized(void); - -#endif diff --git a/qemu-os-win32.h b/qemu-os-win32.h deleted file mode 100644 index d0e9234d24..0000000000 --- a/qemu-os-win32.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * win32 specific declarations - * - * Copyright (c) 2003-2008 Fabrice Bellard - * Copyright (c) 2010 Jes Sorensen - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef QEMU_OS_WIN32_H -#define QEMU_OS_WIN32_H - -#include -#include - -/* Workaround for older versions of MinGW. */ -#ifndef ECONNREFUSED -# define ECONNREFUSED WSAECONNREFUSED -#endif -#ifndef EINPROGRESS -# define EINPROGRESS WSAEINPROGRESS -#endif -#ifndef EHOSTUNREACH -# define EHOSTUNREACH WSAEHOSTUNREACH -#endif -#ifndef EINTR -# define EINTR WSAEINTR -#endif -#ifndef EINPROGRESS -# define EINPROGRESS WSAEINPROGRESS -#endif -#ifndef ENETUNREACH -# define ENETUNREACH WSAENETUNREACH -#endif -#ifndef ENOTCONN -# define ENOTCONN WSAENOTCONN -#endif -#ifndef EWOULDBLOCK -# define EWOULDBLOCK WSAEWOULDBLOCK -#endif - -#if defined(_WIN64) -/* On w64, setjmp is implemented by _setjmp which needs a second parameter. - * If this parameter is NULL, longjump does no stack unwinding. - * That is what we need for QEMU. Passing the value of register rsp (default) - * lets longjmp try a stack unwinding which will crash with generated code. */ -# undef setjmp -# define setjmp(env) _setjmp(env, NULL) -#endif - -/* Declaration of ffs() is missing in MinGW's strings.h. */ -int ffs(int i); - -/* Missing POSIX functions. Don't use MinGW-w64 macros. */ -#undef gmtime_r -struct tm *gmtime_r(const time_t *timep, struct tm *result); -#undef localtime_r -struct tm *localtime_r(const time_t *timep, struct tm *result); - -static inline void os_setup_signal_handling(void) {} -static inline void os_daemonize(void) {} -static inline void os_setup_post(void) {} -void os_set_line_buffering(void); -static inline void os_set_proc_name(const char *dummy) {} - -#if !defined(EPROTONOSUPPORT) -# define EPROTONOSUPPORT EINVAL -#endif - -int setenv(const char *name, const char *value, int overwrite); - -typedef struct { - long tv_sec; - long tv_usec; -} qemu_timeval; -int qemu_gettimeofday(qemu_timeval *tp); - -static inline bool is_daemonized(void) -{ - return false; -} - -#endif diff --git a/qemu-progress.c b/qemu-progress.c index 08d67949a1..9a3f96cd47 100644 --- a/qemu-progress.c +++ b/qemu-progress.c @@ -24,7 +24,7 @@ #include "qemu-common.h" #include "qemu/osdep.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include struct progress_state { diff --git a/qemu-seccomp.c b/qemu-seccomp.c index 2a71d6fee9..031da1dfee 100644 --- a/qemu-seccomp.c +++ b/qemu-seccomp.c @@ -14,7 +14,7 @@ */ #include #include -#include "qemu-seccomp.h" +#include "sysemu/seccomp.h" struct QemuSeccompSyscall { int32_t num; diff --git a/qemu-seccomp.h b/qemu-seccomp.h deleted file mode 100644 index 1189fa241d..0000000000 --- a/qemu-seccomp.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * QEMU seccomp mode 2 support with libseccomp - * - * Copyright IBM, Corp. 2012 - * - * Authors: - * Eduardo Otubo - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - * Contributions after 2012-01-13 are licensed under the terms of the - * GNU GPL, version 2 or (at your option) any later version. - */ -#ifndef QEMU_SECCOMP_H -#define QEMU_SECCOMP_H - -#include -#include "qemu/osdep.h" - -int seccomp_start(void); -#endif diff --git a/qemu-timer.c b/qemu-timer.c index 80b3f2eb31..8fb5c75df7 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "monitor/monitor.h" #include "ui/console.h" diff --git a/qemu-tool.c b/qemu-tool.c index 8ac45ff39b..1a474c45bc 100644 --- a/qemu-tool.c +++ b/qemu-tool.c @@ -19,7 +19,7 @@ #include "qemu/log.h" #include "migration/migration.h" #include "qemu/main-loop.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/sockets.h" #include "slirp/libslirp.h" diff --git a/qmp.c b/qmp.c index 5b3a5d7d03..be63fe1029 100644 --- a/qmp.c +++ b/qmp.c @@ -14,15 +14,15 @@ */ #include "qemu-common.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qmp-commands.h" #include "qemu-char.h" #include "ui/qemu-spice.h" #include "ui/vnc.h" -#include "kvm.h" -#include "arch_init.h" +#include "sysemu/kvm.h" +#include "sysemu/arch_init.h" #include "hw/qdev.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "qom/qom-qobject.h" NameInfo *qmp_query_name(Error **errp) diff --git a/qtest.c b/qtest.c index ebe3963167..468c921310 100644 --- a/qtest.c +++ b/qtest.c @@ -11,14 +11,14 @@ * */ -#include "qtest.h" +#include "sysemu/qtest.h" #include "hw/qdev.h" #include "qemu-char.h" #include "exec/ioport.h" #include "exec/memory.h" #include "hw/irq.h" -#include "sysemu.h" -#include "cpus.h" +#include "sysemu/sysemu.h" +#include "sysemu/cpus.h" #define MAX_IRQ 256 diff --git a/qtest.h b/qtest.h deleted file mode 100644 index 723a4f9536..0000000000 --- a/qtest.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Test Server - * - * Copyright IBM, Corp. 2011 - * - * Authors: - * Anthony Liguori - * - * 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 QTEST_H -#define QTEST_H - -#include "qemu-common.h" - -#if !defined(CONFIG_USER_ONLY) -extern int qtest_allowed; -extern const char *qtest_chrdev; -extern const char *qtest_log; - -static inline bool qtest_enabled(void) -{ - return qtest_allowed; -} - -static inline int qtest_available(void) -{ - return 1; -} - -int qtest_init(void); -#else -static inline bool qtest_enabled(void) -{ - return false; -} - -static inline int qtest_available(void) -{ - return 0; -} - -static inline int qtest_init(void) -{ - return 0; -} - -#endif - -#endif diff --git a/savevm.c b/savevm.c index ea01e9baf6..b2a844f2b1 100644 --- a/savevm.c +++ b/savevm.c @@ -74,14 +74,14 @@ #include "hw/qdev.h" #include "net/net.h" #include "monitor/monitor.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/timer.h" #include "audio/audio.h" #include "migration/migration.h" #include "qemu/sockets.h" #include "qemu/queue.h" #include "qemu/timer.h" -#include "cpus.h" +#include "sysemu/cpus.h" #include "exec/memory.h" #include "qmp-commands.h" #include "trace.h" diff --git a/stubs/arch-query-cpu-def.c b/stubs/arch-query-cpu-def.c index 6eca8527d2..fa6789598a 100644 --- a/stubs/arch-query-cpu-def.c +++ b/stubs/arch-query-cpu-def.c @@ -1,5 +1,5 @@ #include "qemu-common.h" -#include "arch_init.h" +#include "sysemu/arch_init.h" #include "qapi/qmp/qerror.h" CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp) diff --git a/sysemu.h b/sysemu.h deleted file mode 100644 index 8eaa4707a0..0000000000 --- a/sysemu.h +++ /dev/null @@ -1,185 +0,0 @@ -#ifndef SYSEMU_H -#define SYSEMU_H -/* Misc. things related to the system emulator. */ - -#include "qemu/typedefs.h" -#include "qemu/option.h" -#include "qemu/queue.h" -#include "qemu/timer.h" -#include "qapi-types.h" -#include "qemu/notify.h" -#include "qemu/main-loop.h" - -/* vl.c */ - -extern const char *bios_name; - -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" - -bool runstate_check(RunState state); -void runstate_set(RunState new_state); -int runstate_is_running(void); -typedef struct vm_change_state_entry VMChangeStateEntry; -typedef void VMChangeStateHandler(void *opaque, int running, RunState state); - -VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, - void *opaque); -void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); -void vm_state_notify(int running, RunState state); - -#define VMRESET_SILENT false -#define VMRESET_REPORT true - -void vm_start(void); -void vm_stop(RunState state); -void vm_stop_force_state(RunState state); - -typedef enum WakeupReason { - QEMU_WAKEUP_REASON_OTHER = 0, - QEMU_WAKEUP_REASON_RTC, - QEMU_WAKEUP_REASON_PMTIMER, -} WakeupReason; - -void qemu_system_reset_request(void); -void qemu_system_suspend_request(void); -void qemu_register_suspend_notifier(Notifier *notifier); -void qemu_system_wakeup_request(WakeupReason reason); -void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); -void qemu_register_wakeup_notifier(Notifier *notifier); -void qemu_system_shutdown_request(void); -void qemu_system_powerdown_request(void); -void qemu_register_powerdown_notifier(Notifier *notifier); -void qemu_system_debug_request(void); -void qemu_system_vmstop_request(RunState reason); -int qemu_shutdown_requested_get(void); -int qemu_reset_requested_get(void); -void qemu_system_killed(int signal, pid_t pid); -void qemu_devices_reset(void); -void qemu_system_reset(bool report); - -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); -int load_vmstate(const char *name); -void do_delvm(Monitor *mon, const QDict *qdict); -void do_info_snapshots(Monitor *mon); - -void qemu_announce_self(void); - -bool qemu_savevm_state_blocked(Error **errp); -int qemu_savevm_state_begin(QEMUFile *f, - const MigrationParams *params); -int qemu_savevm_state_iterate(QEMUFile *f); -int qemu_savevm_state_complete(QEMUFile *f); -void qemu_savevm_state_cancel(QEMUFile *f); -int qemu_loadvm_state(QEMUFile *f); - -/* SLIRP */ -void do_info_slirp(Monitor *mon); - -typedef enum DisplayType -{ - DT_DEFAULT, - DT_CURSES, - DT_SDL, - DT_NOGRAPHIC, - DT_NONE, -} DisplayType; - -extern int autostart; -extern int bios_size; - -typedef enum { - VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, -} VGAInterfaceType; - -extern int vga_interface_type; -#define xenfb_enabled (vga_interface_type == VGA_XENFB) -#define qxl_enabled (vga_interface_type == VGA_QXL) - -extern int graphic_width; -extern int graphic_height; -extern int graphic_depth; -extern DisplayType display_type; -extern const char *keyboard_layout; -extern int win2k_install_hack; -extern int alt_grab; -extern int ctrl_grab; -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; -extern uint8_t *boot_splash_filedata; -extern int boot_splash_filedata_size; -extern uint8_t qemu_extra_params_fw[2]; -extern QEMUClock *rtc_clock; - -#define MAX_NODES 64 -#define MAX_CPUMASK_BITS 255 -extern int nb_numa_nodes; -extern uint64_t node_mem[MAX_NODES]; -extern unsigned long *node_cpumask[MAX_NODES]; - -#define MAX_OPTION_ROMS 16 -typedef struct QEMUOptionRom { - const char *name; - int32_t bootindex; -} QEMUOptionRom; -extern QEMUOptionRom option_rom[MAX_OPTION_ROMS]; -extern int nb_option_roms; - -#define MAX_PROM_ENVS 128 -extern const char *prom_envs[MAX_PROM_ENVS]; -extern unsigned int nb_prom_envs; - -/* pci-hotplug */ -void pci_device_hot_add(Monitor *mon, const QDict *qdict); -int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo); -void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict); - -/* generic hotplug */ -void drive_hot_add(Monitor *mon, const QDict *qdict); - -/* pcie aer error injection */ -void pcie_aer_inject_error_print(Monitor *mon, const QObject *data); -int do_pcie_aer_inject_error(Monitor *mon, - const QDict *qdict, QObject **ret_data); - -/* serial ports */ - -#define MAX_SERIAL_PORTS 4 - -extern CharDriverState *serial_hds[MAX_SERIAL_PORTS]; - -/* parallel ports */ - -#define MAX_PARALLEL_PORTS 3 - -extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; - -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); - -void add_boot_device_path(int32_t bootindex, DeviceState *dev, - const char *suffix); -char *get_boot_devices_list(uint32_t *size); - -bool usb_enabled(bool default_usb); - -#endif diff --git a/target-alpha/sys_helper.c b/target-alpha/sys_helper.c index 2bc2b02815..434a63a97d 100644 --- a/target-alpha/sys_helper.c +++ b/target-alpha/sys_helper.c @@ -19,7 +19,7 @@ #include "cpu.h" #include "helper.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/timer.h" diff --git a/target-arm/cpu.c b/target-arm/cpu.c index b00f5fa547..17875ed0f0 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -23,7 +23,7 @@ #if !defined(CONFIG_USER_ONLY) #include "hw/loader.h" #endif -#include "sysemu.h" +#include "sysemu/sysemu.h" static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque) { diff --git a/target-arm/helper.c b/target-arm/helper.c index eef2acd18a..e343fac853 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -2,7 +2,7 @@ #include "exec/gdbstub.h" #include "helper.h" #include "qemu/host-utils.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/bitops.h" #ifndef CONFIG_USER_ONLY diff --git a/target-i386/arch_dump.c b/target-i386/arch_dump.c index 50d866f4c6..8209ce9ee2 100644 --- a/target-i386/arch_dump.c +++ b/target-i386/arch_dump.c @@ -13,7 +13,7 @@ #include "cpu.h" #include "exec/cpu-all.h" -#include "dump.h" +#include "sysemu/dump.h" #include "elf.h" #ifdef TARGET_X86_64 diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c index 6dfb0f3f56..c6c7874474 100644 --- a/target-i386/arch_memory_mapping.c +++ b/target-i386/arch_memory_mapping.c @@ -13,7 +13,7 @@ #include "cpu.h" #include "exec/cpu-all.h" -#include "memory_mapping.h" +#include "sysemu/memory_mapping.h" /* PAE Paging or IA-32e Paging */ static void walk_pte(MemoryMappingList *list, hwaddr pte_start_addr, diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 8abc5561e9..1837f5af04 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -22,14 +22,14 @@ #include #include "cpu.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "qemu/option.h" #include "qemu/config-file.h" #include "qapi/qmp/qerror.h" #include "qapi/visitor.h" -#include "arch_init.h" +#include "sysemu/arch_init.h" #include "hyperv.h" @@ -38,7 +38,7 @@ #include #endif -#include "sysemu.h" +#include "sysemu/sysemu.h" #ifndef CONFIG_USER_ONLY #include "hw/xen.h" #include "hw/sysbus.h" diff --git a/target-i386/excp_helper.c b/target-i386/excp_helper.c index 64c8346d3b..179ea82f0f 100644 --- a/target-i386/excp_helper.c +++ b/target-i386/excp_helper.c @@ -19,7 +19,7 @@ #include "cpu.h" #include "qemu/log.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "helper.h" #if 0 diff --git a/target-i386/helper.c b/target-i386/helper.c index bd47b8e58e..dca1360962 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -18,9 +18,9 @@ */ #include "cpu.h" -#include "kvm.h" +#include "sysemu/kvm.h" #ifndef CONFIG_USER_ONLY -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "monitor/monitor.h" #endif diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 340ed3f33e..f63b1fbfda 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -21,8 +21,8 @@ #include #include "qemu-common.h" -#include "sysemu.h" -#include "kvm.h" +#include "sysemu/sysemu.h" +#include "sysemu/kvm.h" #include "kvm_i386.h" #include "cpu.h" #include "exec/gdbstub.h" diff --git a/target-i386/kvm_i386.h b/target-i386/kvm_i386.h index f6ab82f93c..4392ab4359 100644 --- a/target-i386/kvm_i386.h +++ b/target-i386/kvm_i386.h @@ -11,7 +11,7 @@ #ifndef QEMU_KVM_I386_H #define QEMU_KVM_I386_H -#include "kvm.h" +#include "sysemu/kvm.h" bool kvm_allows_irq0_override(void); diff --git a/target-i386/machine.c b/target-i386/machine.c index 477150887b..8c1fed1005 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -4,7 +4,7 @@ #include "hw/isa.h" #include "cpu.h" -#include "kvm.h" +#include "sysemu/kvm.h" static const VMStateDescription vmstate_segment = { .name = "segment", diff --git a/target-m68k/m68k-semi.c b/target-m68k/m68k-semi.c index e6c7dd2f9b..239fadbad5 100644 --- a/target-m68k/m68k-semi.c +++ b/target-m68k/m68k-semi.c @@ -36,7 +36,7 @@ #include "exec/gdbstub.h" #include "exec/softmmu-semi.h" #endif -#include "sysemu.h" +#include "sysemu/sysemu.h" #define HOSTED_EXIT 0 #define HOSTED_INIT_SIM 1 diff --git a/target-ppc/helper.c b/target-ppc/helper.c index 48b19a7e1d..103855afe0 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -19,9 +19,9 @@ #include "cpu.h" #include "helper_regs.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" -#include "cpus.h" +#include "sysemu/cpus.h" PowerPCCPU *cpu_ppc_init(const char *cpu_model) { diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 2546c577f6..88650d4ae4 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -24,12 +24,12 @@ #include "qemu-common.h" #include "qemu/timer.h" -#include "sysemu.h" -#include "kvm.h" +#include "sysemu/sysemu.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" #include "cpu.h" -#include "cpus.h" -#include "device_tree.h" +#include "sysemu/cpus.h" +#include "sysemu/device_tree.h" #include "hw/sysbus.h" #include "hw/spapr.h" diff --git a/target-ppc/kvm_ppc.c b/target-ppc/kvm_ppc.c index 2de59fd43b..1b192a8038 100644 --- a/target-ppc/kvm_ppc.c +++ b/target-ppc/kvm_ppc.c @@ -14,7 +14,7 @@ #include "qemu-common.h" #include "qemu/timer.h" #include "kvm_ppc.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" #define PROC_DEVTREE_PATH "/proc/device-tree" diff --git a/target-ppc/machine.c b/target-ppc/machine.c index 5e7bc00e26..e014c0c1af 100644 --- a/target-ppc/machine.c +++ b/target-ppc/machine.c @@ -1,6 +1,6 @@ #include "hw/hw.h" #include "hw/boards.h" -#include "kvm.h" +#include "sysemu/kvm.h" void cpu_save(QEMUFile *f, void *opaque) { diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c index 318ce92adb..0aee7a9063 100644 --- a/target-ppc/mmu_helper.c +++ b/target-ppc/mmu_helper.c @@ -18,7 +18,7 @@ */ #include "cpu.h" #include "helper.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "kvm_ppc.h" //#define DEBUG_MMU diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index cca63abf5d..42ed748b59 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -25,9 +25,9 @@ #include "disas/bfd.h" #include "exec/gdbstub.h" -#include +#include #include "kvm_ppc.h" -#include "arch_init.h" +#include "sysemu/arch_init.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR diff --git a/target-s390x/helper.c b/target-s390x/helper.c index 8e135457a3..42e06eb85e 100644 --- a/target-s390x/helper.c +++ b/target-s390x/helper.c @@ -22,7 +22,7 @@ #include "exec/gdbstub.h" #include "qemu/timer.h" #ifndef CONFIG_USER_ONLY -#include "sysemu.h" +#include "sysemu/sysemu.h" #endif //#define DEBUG_S390 diff --git a/target-s390x/interrupt.c b/target-s390x/interrupt.c index c1b034f775..6c0024b426 100644 --- a/target-s390x/interrupt.c +++ b/target-s390x/interrupt.c @@ -8,7 +8,7 @@ */ #include "cpu.h" -#include "kvm.h" +#include "sysemu/kvm.h" #if !defined(CONFIG_USER_ONLY) /* service interrupts are floating therefore we must not pass an cpustate */ diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index dc70699919..762231d845 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -26,10 +26,10 @@ #include "qemu-common.h" #include "qemu/timer.h" -#include "sysemu.h" -#include "kvm.h" +#include "sysemu/sysemu.h" +#include "sysemu/kvm.h" #include "cpu.h" -#include "device_tree.h" +#include "sysemu/device_tree.h" /* #define DEBUG_KVM */ diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c index 2e73d30756..e521ed55cc 100644 --- a/target-s390x/misc_helper.c +++ b/target-s390x/misc_helper.c @@ -23,7 +23,7 @@ #include "qemu/host-utils.h" #include "helper.h" #include -#include "kvm.h" +#include "sysemu/kvm.h" #include "qemu/timer.h" #ifdef CONFIG_KVM #include @@ -31,7 +31,7 @@ #if !defined(CONFIG_USER_ONLY) #include "exec/softmmu_exec.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #endif /* #define DEBUG_HELPER */ diff --git a/target-sparc/helper.c b/target-sparc/helper.c index e0d78f3852..91ecfc7aa8 100644 --- a/target-sparc/helper.c +++ b/target-sparc/helper.c @@ -20,7 +20,7 @@ #include "cpu.h" #include "qemu/host-utils.h" #include "helper.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" void helper_raise_exception(CPUSPARCState *env, int tt) { diff --git a/target-sparc/int32_helper.c b/target-sparc/int32_helper.c index 507c355cac..c35f522e0f 100644 --- a/target-sparc/int32_helper.c +++ b/target-sparc/int32_helper.c @@ -19,7 +19,7 @@ #include "cpu.h" #include "trace.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #define DEBUG_PCALL diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c index f61a497d21..0a037291ef 100644 --- a/target-xtensa/translate.c +++ b/target-xtensa/translate.c @@ -35,7 +35,7 @@ #include "disas/disas.h" #include "tcg-op.h" #include "qemu/log.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "helper.h" #define GEN_HELPER 1 diff --git a/ui/cocoa.m b/ui/cocoa.m index 0afa6f86dd..3bf1c6e890 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -27,7 +27,7 @@ #include "qemu-common.h" #include "ui/console.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #ifndef MAC_OS_X_VERSION_10_4 #define MAC_OS_X_VERSION_10_4 1040 diff --git a/ui/curses.c b/ui/curses.c index 5d15e9e16e..d78e378440 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -30,7 +30,7 @@ #include "qemu-common.h" #include "ui/console.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #define FONT_HEIGHT 16 #define FONT_WIDTH 8 diff --git a/ui/input.c b/ui/input.c index 05f6c0c849..259fd1808d 100644 --- a/ui/input.c +++ b/ui/input.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "monitor/monitor.h" #include "ui/console.h" #include "qapi/error.h" diff --git a/ui/keymaps.c b/ui/keymaps.c index f55a2aa464..9625d82fa1 100644 --- a/ui/keymaps.c +++ b/ui/keymaps.c @@ -23,7 +23,7 @@ */ #include "keymaps.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" static int get_keysym(const name2keysym_t *table, const char *name) diff --git a/ui/sdl.c b/ui/sdl.c index bcbf89daeb..1657848e9f 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -30,7 +30,7 @@ #include "qemu-common.h" #include "ui/console.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "x_keymap.h" #include "sdl_zoom.h" diff --git a/ui/spice-core.c b/ui/spice-core.c index 8727bf49ca..5fe3e0e4cf 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -19,7 +19,7 @@ #include #include -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu-common.h" #include "ui/qemu-spice.h" diff --git a/ui/spice-display.c b/ui/spice-display.c index a19b3d95fb..dc7e58d0ed 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -21,7 +21,7 @@ #include "qemu/queue.h" #include "monitor/monitor.h" #include "ui/console.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "trace.h" #include "ui/spice-display.h" diff --git a/ui/vnc.c b/ui/vnc.c index d9e5315e79..8912b78945 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -26,7 +26,7 @@ #include "vnc.h" #include "vnc-jobs.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "qemu/sockets.h" #include "qemu/timer.h" #include "qemu/acl.h" diff --git a/vl.c b/vl.c index 9b80e7abc4..75a30a1720 100644 --- a/vl.c +++ b/vl.c @@ -65,7 +65,7 @@ #endif #ifdef CONFIG_SECCOMP -#include "qemu-seccomp.h" +#include "sysemu/seccomp.h" #endif #ifdef __sun__ @@ -131,18 +131,18 @@ int main(int argc, char **argv) #include "net/slirp.h" #include "monitor/monitor.h" #include "ui/console.h" -#include "sysemu.h" +#include "sysemu/sysemu.h" #include "exec/gdbstub.h" #include "qemu/timer.h" #include "qemu-char.h" #include "qemu/cache-utils.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "hw/block-common.h" #include "migration/block.h" -#include "dma.h" +#include "sysemu/dma.h" #include "audio/audio.h" #include "migration/migration.h" -#include "kvm.h" +#include "sysemu/kvm.h" #include "qapi/qmp/qjson.h" #include "qemu/option.h" #include "qemu/config-file.h" @@ -152,7 +152,7 @@ int main(int argc, char **argv) #ifdef CONFIG_VIRTFS #include "fsdev/qemu-fsdev.h" #endif -#include "qtest.h" +#include "sysemu/qtest.h" #include "disas/disas.h" @@ -163,8 +163,8 @@ int main(int argc, char **argv) #include "trace.h" #include "trace/control.h" #include "qemu/queue.h" -#include "cpus.h" -#include "arch_init.h" +#include "sysemu/cpus.h" +#include "sysemu/arch_init.h" #include "qemu/osdep.h" #include "ui/qemu-spice.h" diff --git a/xen-all.c b/xen-all.c index 6965626db8..b659321184 100644 --- a/xen-all.c +++ b/xen-all.c @@ -17,7 +17,7 @@ #include "qmp-commands.h" #include "qemu/range.h" -#include "xen-mapcache.h" +#include "sysemu/xen-mapcache.h" #include "trace.h" #include "exec/address-spaces.h" diff --git a/xen-mapcache.c b/xen-mapcache.c index 8f4648cc32..dc6d1fadb7 100644 --- a/xen-mapcache.c +++ b/xen-mapcache.c @@ -13,13 +13,13 @@ #include #include "hw/xen_backend.h" -#include "blockdev.h" +#include "sysemu/blockdev.h" #include "qemu/bitmap.h" #include #include -#include "xen-mapcache.h" +#include "sysemu/xen-mapcache.h" #include "trace.h" diff --git a/xen-mapcache.h b/xen-mapcache.h deleted file mode 100644 index c59804060b..0000000000 --- a/xen-mapcache.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2011 Citrix Ltd. - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#ifndef XEN_MAPCACHE_H -#define XEN_MAPCACHE_H - -#include - -typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr start_addr, - ram_addr_t size, - void *opaque); -#ifdef CONFIG_XEN - -void xen_map_cache_init(phys_offset_to_gaddr_t f, - void *opaque); -uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size, - uint8_t lock); -ram_addr_t xen_ram_addr_from_mapcache(void *ptr); -void xen_invalidate_map_cache_entry(uint8_t *buffer); -void xen_invalidate_map_cache(void); - -#else - -static inline void xen_map_cache_init(phys_offset_to_gaddr_t f, - void *opaque) -{ -} - -static inline uint8_t *xen_map_cache(hwaddr phys_addr, - hwaddr size, - uint8_t lock) -{ - abort(); -} - -static inline ram_addr_t xen_ram_addr_from_mapcache(void *ptr) -{ - abort(); -} - -static inline void xen_invalidate_map_cache_entry(uint8_t *buffer) -{ -} - -static inline void xen_invalidate_map_cache(void) -{ -} - -#endif - -#endif /* !XEN_MAPCACHE_H */ -- cgit v1.2.3-55-g7522