Even more moves.

  include/ui + ui/
  include/qapi/qmp/ + qobject/

Change-Id: Ief236a08cb234d9dd692e85907757678ef32f035
diff --git a/Makefile.common b/Makefile.common
index 62f0cc1..dcfd53d 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -419,25 +419,16 @@
     buffered_file.c \
     cbuffer.c \
     charpipe.c \
-    console.c \
-    d3des.c \
     input.c \
     iohandler.c \
     ioport.c \
     net-android.c \
-    path.c \
     qemu-char.c \
-    qemu-config.c \
-    qemu-error.c \
     qemu-malloc.c \
-    qemu-option.c \
-    qemu-sockets-android.c \
-    qerror.c \
     readline.c \
     savevm.c \
     shaper.c \
     tcpdump.c \
-    vnc-android.c \
     android/boot-properties.c \
     android/config.c \
     android/core-init-utils.c   \
@@ -465,12 +456,21 @@
     android/multitouch-screen.c \
     android/multitouch-port.c \
     android/utils/jpeg-compress.c \
+    qobject/qerror.c \
+    ui/console.c \
+    ui/d3des.c \
+    ui/vnc-android.c \
     util/acl.c \
     util/aes.c \
     util/cutils.c \
     util/module.c \
     util/notify.c \
     util/osdep.c \
+    util/path.c \
+    util/qemu-config.c \
+    util/qemu-error.c \
+    util/qemu-option.c \
+    util/qemu-sockets-android.c \
 
 ifeq ($(HOST_ARCH),x86)
     CORE_MISC_SOURCES += i386-dis.c
@@ -485,7 +485,7 @@
 
 ifeq ($(HOST_OS),linux)
     CORE_MISC_SOURCES += usb-linux.c \
-                         qemu-thread.c \
+                         util/qemu-thread.c \
                          android/camera/camera-capture-linux.c
 else
     CORE_MISC_SOURCES += usb-dummy-android.c
@@ -560,16 +560,16 @@
 # integrated into android emulator
 #
 common_LOCAL_SRC_FILES += \
-    json-lexer.c \
-    json-parser.c \
-    json-streamer.c \
-    qjson.c \
-    qbool.c \
-    qdict.c \
-    qfloat.c \
-    qint.c \
-    qlist.c \
-    qstring.c \
+    qobject/json-lexer.c \
+    qobject/json-parser.c \
+    qobject/json-streamer.c \
+    qobject/qjson.c \
+    qobject/qbool.c \
+    qobject/qdict.c \
+    qobject/qfloat.c \
+    qobject/qint.c \
+    qobject/qlist.c \
+    qobject/qstring.c \
 
 ifeq ($(QEMU_TARGET_XML_SOURCES),)
     QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
diff --git a/Makefile.target b/Makefile.target
index aff7736..e21a507 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -267,9 +267,9 @@
 # What a mess, os-posix.c depends on the exact values of options
 # which are target specific.
 ifeq ($(HOST_OS),windows)
-    common_LOCAL_SRC_FILES += os-win32.c oslib-win32.c
+    common_LOCAL_SRC_FILES += os-win32.c util/oslib-win32.c
 else
-    common_LOCAL_SRC_FILES += os-posix.c oslib-posix.c
+    common_LOCAL_SRC_FILES += os-posix.c util/oslib-posix.c
 endif
 
 
diff --git a/android/display-core.h b/android/display-core.h
index e6a1b7d..4a2b129 100644
--- a/android/display-core.h
+++ b/android/display-core.h
@@ -18,7 +18,7 @@
 #ifndef _ANDROID_DISPLAY_CORE_H
 #define _ANDROID_DISPLAY_CORE_H
 
-#include "console.h"
+#include "ui/console.h"
 
 /*
  * Initializes one and only one instance of a core display.
diff --git a/android/display.h b/android/display.h
index 4b9e908..75b471c 100644
--- a/android/display.h
+++ b/android/display.h
@@ -12,7 +12,7 @@
 #ifndef _ANDROID_DISPLAY_H
 #define _ANDROID_DISPLAY_H
 
-#include "console.h"
+#include "ui/console.h"
 #include "android/framebuffer.h"
 
 extern void android_display_init(DisplayState* ds, QFrameBuffer* qfbuff);
diff --git a/android/main-common.c b/android/main-common.c
index b724e4b..7db5976 100644
--- a/android/main-common.c
+++ b/android/main-common.c
@@ -22,7 +22,7 @@
 #include <SDL.h>
 #include <SDL_syswm.h>
 
-#include "console.h"
+#include "ui/console.h"
 
 #include "android/avd/util.h"
 #include "android/utils/debug.h"
diff --git a/android/main.c b/android/main.c
index 332183a..1ca94df 100644
--- a/android/main.c
+++ b/android/main.c
@@ -23,7 +23,7 @@
 #include "android/android.h"
 #include "qemu-common.h"
 #include "sysemu.h"
-#include "console.h"
+#include "ui/console.h"
 #include "user-events.h"
 
 #include <SDL.h>
diff --git a/android/protocol/core-commands-proxy.c b/android/protocol/core-commands-proxy.c
index 0a50794..3449952 100644
--- a/android/protocol/core-commands-proxy.c
+++ b/android/protocol/core-commands-proxy.c
@@ -15,7 +15,7 @@
  * part of the UI control protocol. Here we send UI control commands to the Core.
  */
 
-#include "console.h"
+#include "ui/console.h"
 #include "android/looper.h"
 #include "android/async-utils.h"
 #include "android/sync-utils.h"
diff --git a/android/protocol/fb-updates-proxy.c b/android/protocol/fb-updates-proxy.c
index c1b431e..10d1e71 100644
--- a/android/protocol/fb-updates-proxy.c
+++ b/android/protocol/fb-updates-proxy.c
@@ -15,7 +15,7 @@
  * to the UI connected to the core.
  */
 
-#include "console.h"
+#include "ui/console.h"
 #include "android/looper.h"
 #include "android/display-core.h"
 #include "android/async-utils.h"
diff --git a/android/protocol/user-events-proxy.c b/android/protocol/user-events-proxy.c
index 3796ff9..16bd9f4 100644
--- a/android/protocol/user-events-proxy.c
+++ b/android/protocol/user-events-proxy.c
@@ -11,7 +11,7 @@
 */
 
 #include "user-events.h"
-#include "console.h"
+#include "ui/console.h"
 #include "android/looper.h"
 #include "android/async-utils.h"
 #include "android/utils/debug.h"
diff --git a/block.h b/block.h
index db131a3..d83a24b 100644
--- a/block.h
+++ b/block.h
@@ -4,7 +4,7 @@
 #include "qemu-aio.h"
 #include "qemu-common.h"
 #include "qemu-option.h"
-#include "qobject.h"
+#include "qapi/qmp/qobject.h"
 
 /* block.c */
 typedef struct BlockDriver BlockDriver;
diff --git a/blockdev.c b/blockdev.c
index ff7602b..55d60f8 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -10,9 +10,9 @@
 #include "block.h"
 #include "blockdev.h"
 #include "monitor.h"
-#include "qerror.h"
+#include "qapi/qmp/qerror.h"
 #include "qemu-option.h"
-#include "qemu-config.h"
+#include "qemu/config-file.h"
 #include "sysemu.h"
 
 static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives);
diff --git a/curses.c b/curses.c
index 3ce12b9..934d497 100644
--- a/curses.c
+++ b/curses.c
@@ -34,7 +34,7 @@
 #endif
 
 #include "qemu-common.h"
-#include "console.h"
+#include "ui/console.h"
 #include "sysemu.h"
 
 #define FONT_HEIGHT 16
diff --git a/hw/android_arm.c b/hw/android_arm.c
index c93a4db..e217b59 100644
--- a/hw/android_arm.c
+++ b/hw/android_arm.c
@@ -19,7 +19,7 @@
 #include "android/globals.h"
 #include "audio/audio.h"
 #include "arm-misc.h"
-#include "console.h"
+#include "ui/console.h"
 #include "blockdev.h"
 #include "goldfish_pipe.h"
 #ifdef CONFIG_MEMCHECK
diff --git a/hw/goldfish_events_device.c b/hw/goldfish_events_device.c
index dad76ad..d6a6d82 100644
--- a/hw/goldfish_events_device.c
+++ b/hw/goldfish_events_device.c
@@ -16,7 +16,7 @@
 #include "android/multitouch-screen.h"
 #include "irq.h"
 #include "user-events.h"
-#include "console.h"
+#include "ui/console.h"
 
 #define MAX_EVENTS 256*4
 
diff --git a/hw/goldfish_fb.c b/hw/goldfish_fb.c
index 16450b3..53a1428 100644
--- a/hw/goldfish_fb.c
+++ b/hw/goldfish_fb.c
@@ -14,7 +14,7 @@
 #include "android/utils/debug.h"
 #include "android/utils/duff.h"
 #include "goldfish_device.h"
-#include "console.h"
+#include "ui/console.h"
 
 /* These values *must* match the platform definitions found under
  * hardware/libhardware/include/hardware/hardware.h
diff --git a/hw/msmouse.c b/hw/msmouse.c
index 05f893c..24fd38c 100644
--- a/hw/msmouse.c
+++ b/hw/msmouse.c
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 #include "../qemu-common.h"
 #include "../qemu-char.h"
-#include "../console.h"
+#include "ui/console.h"
 #include "msmouse.h"
 
 #define MSMOUSE_LO6(n) ((n) & 0x3f)
diff --git a/hw/pc.c b/hw/pc.c
index a8d609a..973635a 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -38,7 +38,7 @@
 //#include "hpet_emul.h"
 #include "watchdog.h"
 #include "smbios.h"
-#include "console.h"
+#include "ui/console.h"
 
 #include "goldfish_device.h"
 #include "goldfish_pipe.h"
diff --git a/hw/ps2.c b/hw/ps2.c
index 9149598..6a160ae 100644
--- a/hw/ps2.c
+++ b/hw/ps2.c
@@ -23,7 +23,7 @@
  */
 #include "hw.h"
 #include "ps2.h"
-#include "console.h"
+#include "ui/console.h"
 
 /* debug PC keyboard */
 //#define DEBUG_KBD
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index c850a91..cf70a8f 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -23,7 +23,7 @@
  * THE SOFTWARE.
  */
 #include "hw.h"
-#include "console.h"
+#include "ui/console.h"
 #include "usb.h"
 
 /* HID interface requests */
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 16e482e..da4100c 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -11,7 +11,7 @@
 #include "usb.h"
 #include "block.h"
 #include "scsi-disk.h"
-#include "console.h"
+#include "ui/console.h"
 
 //#define DEBUG_MSD
 
diff --git a/qbool.h b/include/qapi/qmp/qbool.h
similarity index 94%
rename from qbool.h
rename to include/qapi/qmp/qbool.h
index fe66fcd..c4eaab9 100644
--- a/qbool.h
+++ b/include/qapi/qmp/qbool.h
@@ -15,7 +15,7 @@
 #define QBOOL_H
 
 #include <stdint.h>
-#include "qobject.h"
+#include "qapi/qmp/qobject.h"
 
 typedef struct QBool {
     QObject_HEAD;
diff --git a/qerror.h b/include/qapi/qmp/qerror.h
similarity index 98%
rename from qerror.h
rename to include/qapi/qmp/qerror.h
index df61d2c..5616f37 100644
--- a/qerror.h
+++ b/include/qapi/qmp/qerror.h
@@ -13,8 +13,8 @@
 #define QERROR_H
 
 #include "qdict.h"
-#include "qstring.h"
-#include "qemu-error.h"
+#include "qapi/qmp/qstring.h"
+#include "qemu/error-report.h"
 #include <stdarg.h>
 
 typedef struct QErrorStringTable {
diff --git a/qfloat.h b/include/qapi/qmp/qfloat.h
similarity index 94%
rename from qfloat.h
rename to include/qapi/qmp/qfloat.h
index 9d67876..a865844 100644
--- a/qfloat.h
+++ b/include/qapi/qmp/qfloat.h
@@ -15,7 +15,7 @@
 #define QFLOAT_H
 
 #include <stdint.h>
-#include "qobject.h"
+#include "qapi/qmp/qobject.h"
 
 typedef struct QFloat {
     QObject_HEAD;
diff --git a/qint.h b/include/qapi/qmp/qint.h
similarity index 94%
rename from qint.h
rename to include/qapi/qmp/qint.h
index 6b1a15c..48a41b0 100644
--- a/qint.h
+++ b/include/qapi/qmp/qint.h
@@ -14,7 +14,7 @@
 #define QINT_H
 
 #include <stdint.h>
-#include "qobject.h"
+#include "qapi/qmp/qobject.h"
 
 typedef struct QInt {
     QObject_HEAD;
diff --git a/qjson.h b/include/qapi/qmp/qjson.h
similarity index 91%
rename from qjson.h
rename to include/qapi/qmp/qjson.h
index 65b10ea..0bebab4 100644
--- a/qjson.h
+++ b/include/qapi/qmp/qjson.h
@@ -15,8 +15,8 @@
 #define QJSON_H
 
 #include <stdarg.h>
-#include "qobject.h"
-#include "qstring.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);
diff --git a/qlist.h b/include/qapi/qmp/qlist.h
similarity index 97%
rename from qlist.h
rename to include/qapi/qmp/qlist.h
index dbe7b92..3925e7d 100644
--- a/qlist.h
+++ b/include/qapi/qmp/qlist.h
@@ -13,7 +13,7 @@
 #ifndef QLIST_H
 #define QLIST_H
 
-#include "qobject.h"
+#include "qapi/qmp/qobject.h"
 #include "qemu-queue.h"
 #include "qemu-common.h"
 
diff --git a/qobject.h b/include/qapi/qmp/qobject.h
similarity index 100%
rename from qobject.h
rename to include/qapi/qmp/qobject.h
diff --git a/qstring.h b/include/qapi/qmp/qstring.h
similarity index 96%
rename from qstring.h
rename to include/qapi/qmp/qstring.h
index 84ccd96..0e690f4 100644
--- a/qstring.h
+++ b/include/qapi/qmp/qstring.h
@@ -14,7 +14,7 @@
 #define QSTRING_H
 
 #include <stdint.h>
-#include "qobject.h"
+#include "qapi/qmp/qobject.h"
 
 typedef struct QString {
     QObject_HEAD;
diff --git a/qemu-config.h b/include/qemu/config-file.h
similarity index 100%
rename from qemu-config.h
rename to include/qemu/config-file.h
diff --git a/qemu-error.h b/include/qemu/error-report.h
similarity index 100%
rename from qemu-error.h
rename to include/qemu/error-report.h
diff --git a/console.h b/include/ui/console.h
similarity index 100%
rename from console.h
rename to include/ui/console.h
diff --git a/input.c b/input.c
index d20347f..39a03f7 100644
--- a/input.c
+++ b/input.c
@@ -25,8 +25,8 @@
 #include "sysemu.h"
 #include "net.h"
 #include "monitor.h"
-#include "console.h"
-#include "qjson.h"
+#include "ui/console.h"
+#include "qapi/qmp/qjson.h"
 
 #ifdef CONFIG_SKINNING
 QEMUPutMouseEntry *original_qemu_add_mouse_event_handler(QEMUPutMouseEvent *func,
diff --git a/json-lexer.h b/json-lexer.h
index 3b50c46..cd81943 100644
--- a/json-lexer.h
+++ b/json-lexer.h
@@ -14,8 +14,8 @@
 #ifndef QEMU_JSON_LEXER_H
 #define QEMU_JSON_LEXER_H
 
-#include "qstring.h"
-#include "qlist.h"
+#include "qapi/qmp/qstring.h"
+#include "qapi/qmp/qlist.h"
 
 typedef enum json_token_type {
     JSON_OPERATOR = 100,
diff --git a/json-parser.h b/json-parser.h
index 97f43f6..1bbac16 100644
--- a/json-parser.h
+++ b/json-parser.h
@@ -15,7 +15,7 @@
 #define QEMU_JSON_PARSER_H
 
 #include "qemu-common.h"
-#include "qlist.h"
+#include "qapi/qmp/qlist.h"
 
 QObject *json_parser_parse(QList *tokens, va_list *ap);
 
diff --git a/json-streamer.h b/json-streamer.h
index 09f3bd7..2030e86 100644
--- a/json-streamer.h
+++ b/json-streamer.h
@@ -14,7 +14,7 @@
 #ifndef QEMU_JSON_STREAMER_H
 #define QEMU_JSON_STREAMER_H
 
-#include "qlist.h"
+#include "qapi/qmp/qlist.h"
 #include "json-lexer.h"
 
 typedef struct JSONMessageParser
diff --git a/monitor.c b/monitor.c
index 9da86a1..bfc0084 100644
--- a/monitor.c
+++ b/monitor.c
@@ -35,7 +35,7 @@
 #include "sysemu.h"
 #include "monitor.h"
 #include "readline.h"
-#include "console.h"
+#include "ui/console.h"
 #include "blockdev.h"
 #include "audio/audio.h"
 #include "disas.h"
diff --git a/monitor.h b/monitor.h
index 6f2a3e2..4955c62 100644
--- a/monitor.h
+++ b/monitor.h
@@ -3,7 +3,7 @@
 
 #include "qemu-common.h"
 #include "qemu-char.h"
-#include "qerror.h"
+#include "qapi/qmp/qerror.h"
 #include "qdict.h"
 #include "block.h"
 
diff --git a/qdict.h b/qdict.h
index 929d8d2..c815981 100644
--- a/qdict.h
+++ b/qdict.h
@@ -13,8 +13,8 @@
 #ifndef QDICT_H
 #define QDICT_H
 
-#include "qobject.h"
-#include "qlist.h"
+#include "qapi/qmp/qobject.h"
+#include "qapi/qmp/qlist.h"
 #include "qemu-queue.h"
 #include <stdint.h>
 
diff --git a/qemu-char.c b/qemu-char.c
index e2fea82..b73cb9f 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -25,7 +25,7 @@
 #include "sockets.h"
 #include "net.h"
 #include "monitor.h"
-#include "console.h"
+#include "ui/console.h"
 #include "sysemu.h"
 #include "qemu/timer.h"
 #include "qemu-char.h"
diff --git a/qemu-char.h b/qemu-char.h
index 30ea925..ab29cbb 100644
--- a/qemu-char.h
+++ b/qemu-char.h
@@ -4,9 +4,9 @@
 #include "qemu-common.h"
 #include "qemu-queue.h"
 #include "qemu-option.h"
-#include "qemu-config.h"
-#include "qobject.h"
-#include "qstring.h"
+#include "qemu/config-file.h"
+#include "qapi/qmp/qobject.h"
+#include "qapi/qmp/qstring.h"
 
 /* character device */
 
diff --git a/qemu-objects.h b/qemu-objects.h
index c53fbaa..ae85c58 100644
--- a/qemu-objects.h
+++ b/qemu-objects.h
@@ -13,13 +13,13 @@
 #ifndef QEMU_OBJECTS_H
 #define QEMU_OBJECTS_H
 
-#include "qobject.h"
-#include "qint.h"
-#include "qfloat.h"
-#include "qbool.h"
-#include "qstring.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 "qdict.h"
-#include "qlist.h"
-#include "qjson.h"
+#include "qapi/qmp/qlist.h"
+#include "qapi/qmp/qjson.h"
 
 #endif /* QEMU_OBJECTS_H */
diff --git a/qemu-timer.c b/qemu-timer.c
index 353002c..87a85d6 100644
--- a/qemu-timer.c
+++ b/qemu-timer.c
@@ -25,7 +25,7 @@
 #include "sysemu.h"
 #include "net.h"
 #include "monitor.h"
-#include "console.h"
+#include "ui/console.h"
 
 #include "hw/hw.h"
 
diff --git a/json-lexer.c b/qobject/json-lexer.c
similarity index 98%
rename from json-lexer.c
rename to qobject/json-lexer.c
index 65c9720..b97c24f 100644
--- a/json-lexer.c
+++ b/qobject/json-lexer.c
@@ -11,10 +11,10 @@
  *
  */
 
-#include "qstring.h"
-#include "qlist.h"
+#include "qapi/qmp/qstring.h"
+#include "qapi/qmp/qlist.h"
 #include "qdict.h"
-#include "qint.h"
+#include "qapi/qmp/qint.h"
 #include "qemu-common.h"
 #include "json-lexer.h"
 
diff --git a/json-parser.c b/qobject/json-parser.c
similarity index 98%
rename from json-parser.c
rename to qobject/json-parser.c
index 6c06ef9..47ea78e 100644
--- a/json-parser.c
+++ b/qobject/json-parser.c
@@ -14,12 +14,12 @@
 #include <stdarg.h>
 
 #include "qemu-common.h"
-#include "qstring.h"
-#include "qint.h"
+#include "qapi/qmp/qstring.h"
+#include "qapi/qmp/qint.h"
 #include "qdict.h"
-#include "qlist.h"
-#include "qfloat.h"
-#include "qbool.h"
+#include "qapi/qmp/qlist.h"
+#include "qapi/qmp/qfloat.h"
+#include "qapi/qmp/qbool.h"
 #include "json-parser.h"
 #include "json-lexer.h"
 
diff --git a/json-streamer.c b/qobject/json-streamer.c
similarity index 97%
rename from json-streamer.c
rename to qobject/json-streamer.c
index f7e7a68..efe63f0 100644
--- a/json-streamer.c
+++ b/qobject/json-streamer.c
@@ -11,8 +11,8 @@
  *
  */
 
-#include "qlist.h"
-#include "qint.h"
+#include "qapi/qmp/qlist.h"
+#include "qapi/qmp/qint.h"
 #include "qdict.h"
 #include "qemu-common.h"
 #include "json-lexer.h"
diff --git a/qbool.c b/qobject/qbool.c
similarity index 94%
rename from qbool.c
rename to qobject/qbool.c
index ad4873f..5108dce 100644
--- a/qbool.c
+++ b/qobject/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/qdict.c b/qobject/qdict.c
similarity index 98%
rename from qdict.c
rename to qobject/qdict.c
index dee0fb4..1ed7d4b 100644
--- a/qdict.c
+++ b/qobject/qdict.c
@@ -10,12 +10,12 @@
  * See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qint.h"
-#include "qfloat.h"
+#include "qapi/qmp/qint.h"
+#include "qapi/qmp/qfloat.h"
 #include "qdict.h"
-#include "qbool.h"
-#include "qstring.h"
-#include "qobject.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/qerror.c b/qobject/qerror.c
similarity index 99%
rename from qerror.c
rename to qobject/qerror.c
index 4855604..a64ca97 100644
--- a/qerror.c
+++ b/qobject/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/qfloat.c b/qobject/qfloat.c
similarity index 94%
rename from qfloat.c
rename to qobject/qfloat.c
index f8c8a2e..08b2e57 100644
--- a/qfloat.c
+++ b/qobject/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/qint.c b/qobject/qint.c
similarity index 94%
rename from qint.c
rename to qobject/qint.c
index fb3823a..fe33b8f 100644
--- a/qint.c
+++ b/qobject/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/qjson.c b/qobject/qjson.c
similarity index 97%
rename from qjson.c
rename to qobject/qjson.c
index f9c8e77..0ae70a2 100644
--- a/qjson.c
+++ b/qobject/qjson.c
@@ -14,11 +14,11 @@
 #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 "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 "qdict.h"
 
 typedef struct JSONParsingState
diff --git a/qlist.c b/qobject/qlist.c
similarity index 97%
rename from qlist.c
rename to qobject/qlist.c
index 5730fb8..ef852d8 100644
--- a/qlist.c
+++ b/qobject/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/qstring.c b/qobject/qstring.c
similarity index 97%
rename from qstring.c
rename to qobject/qstring.c
index 4e2ba08..77bd4c7 100644
--- a/qstring.c
+++ b/qobject/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/sysemu.h b/sysemu.h
index cf34ee6..8ade116 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -7,7 +7,7 @@
 #include "qemu-queue.h"
 #include "qemu/timer.h"
 #include "qdict.h"
-#include "qerror.h"
+#include "qapi/qmp/qerror.h"
 
 #ifdef _WIN32
 #include <windows.h>
diff --git a/console.c b/ui/console.c
similarity index 99%
rename from console.c
rename to ui/console.c
index af7d7cf..93e910e 100644
--- a/console.c
+++ b/ui/console.c
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu-common.h"
-#include "console.h"
+#include "ui/console.h"
 #include "qemu/timer.h"
 
 //#define DEBUG_CONSOLE
diff --git a/d3des.c b/ui/d3des.c
similarity index 100%
rename from d3des.c
rename to ui/d3des.c
diff --git a/d3des.h b/ui/d3des.h
similarity index 100%
rename from d3des.h
rename to ui/d3des.h
diff --git a/vnc-android.c b/ui/vnc-android.c
similarity index 100%
rename from vnc-android.c
rename to ui/vnc-android.c
diff --git a/vnc-tls.h b/ui/vnc-tls.h
similarity index 100%
rename from vnc-tls.h
rename to ui/vnc-tls.h
diff --git a/vnc.c b/ui/vnc.c
similarity index 100%
rename from vnc.c
rename to ui/vnc.c
diff --git a/vnc.h b/ui/vnc.h
similarity index 99%
rename from vnc.h
rename to ui/vnc.h
index 3ae95f3..d0f1b03 100644
--- a/vnc.h
+++ b/ui/vnc.h
@@ -28,7 +28,7 @@
 #define __QEMU_VNC_H
 
 #include "qemu-common.h"
-#include "console.h"
+#include "ui/console.h"
 #include "monitor.h"
 #include "audio/audio.h"
 #include <zlib.h>
diff --git a/vnc_keysym.h b/ui/vnc_keysym.h
similarity index 100%
rename from vnc_keysym.h
rename to ui/vnc_keysym.h
diff --git a/vnchextile.h b/ui/vnchextile.h
similarity index 100%
rename from vnchextile.h
rename to ui/vnchextile.h
diff --git a/user-events-qemu.c b/user-events-qemu.c
index 45a994a..518a4c0 100644
--- a/user-events-qemu.c
+++ b/user-events-qemu.c
@@ -11,7 +11,7 @@
 */
 #include "user-events.h"
 #include "android/utils/debug.h"
-#include "console.h"
+#include "ui/console.h"
 #include <stdio.h>
 
 void
diff --git a/oslib-posix.c b/util/oslib-posix.c
similarity index 100%
rename from oslib-posix.c
rename to util/oslib-posix.c
diff --git a/oslib-win32.c b/util/oslib-win32.c
similarity index 100%
rename from oslib-win32.c
rename to util/oslib-win32.c
diff --git a/path.c b/util/path.c
similarity index 100%
rename from path.c
rename to util/path.c
diff --git a/qemu-config.c b/util/qemu-config.c
similarity index 99%
rename from qemu-config.c
rename to util/qemu-config.c
index 14d3419..c237ec9 100644
--- a/qemu-config.c
+++ b/util/qemu-config.c
@@ -1,7 +1,7 @@
 #include "qemu-common.h"
-#include "qemu-error.h"
+#include "qemu/error-report.h"
 #include "qemu-option.h"
-#include "qemu-config.h"
+#include "qemu/config-file.h"
 #include "hw/qdev.h"
 
 static QemuOptsList qemu_drive_opts = {
diff --git a/qemu-error.c b/util/qemu-error.c
similarity index 100%
rename from qemu-error.c
rename to util/qemu-error.c
diff --git a/qemu-option.c b/util/qemu-option.c
similarity index 99%
rename from qemu-option.c
rename to util/qemu-option.c
index 65db542..c394cb3 100644
--- a/qemu-option.c
+++ b/util/qemu-option.c
@@ -27,10 +27,10 @@
 #include <string.h>
 
 #include "qemu-common.h"
-#include "qemu-error.h"
+#include "qemu/error-report.h"
 #include "qemu-objects.h"
 #include "qemu-option.h"
-#include "qerror.h"
+#include "qapi/qmp/qerror.h"
 
 /*
  * Extracts the name of an option from the parameter string (p points at the
diff --git a/qemu-sockets-android.c b/util/qemu-sockets-android.c
similarity index 100%
rename from qemu-sockets-android.c
rename to util/qemu-sockets-android.c
diff --git a/qemu-sockets.c b/util/qemu-sockets.c
similarity index 100%
rename from qemu-sockets.c
rename to util/qemu-sockets.c
diff --git a/qemu-thread.c b/util/qemu-thread.c
similarity index 100%
rename from qemu-thread.c
rename to util/qemu-thread.c
diff --git a/vl-android-ui.c b/vl-android-ui.c
index e36dbb5..c14fd9b 100644
--- a/vl-android-ui.c
+++ b/vl-android-ui.c
@@ -38,7 +38,7 @@
 
 #include "qemu-common.h"
 #include "net.h"
-#include "console.h"
+#include "ui/console.h"
 #include "qemu/timer.h"
 #include "qemu-char.h"
 #include "block.h"
diff --git a/vl-android.c b/vl-android.c
index c519cd2..b33a958 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -38,7 +38,7 @@
 #include "hw/baum.h"
 #include "hw/goldfish_nand.h"
 #include "net.h"
-#include "console.h"
+#include "ui/console.h"
 #include "sysemu.h"
 #include "gdbstub.h"
 #include "qemu/timer.h"
@@ -189,7 +189,7 @@
 #include "bt-host.h"
 #include "net.h"
 #include "monitor.h"
-#include "console.h"
+#include "ui/console.h"
 #include "sysemu.h"
 #include "gdbstub.h"
 #include "qemu/timer.h"
diff --git a/vl.c b/vl.c
index 4bcb145..c0c35a5 100644
--- a/vl.c
+++ b/vl.c
@@ -147,7 +147,7 @@
 #include "bt-host.h"
 #include "net.h"
 #include "monitor.h"
-#include "console.h"
+#include "ui/console.h"
 #include "sysemu.h"
 #include "gdbstub.h"
 #include "qemu/timer.h"