Skip to contentSkip to conversation

util: move declarations out of qemu-common.h

PATCH In review [email protected] 2 participants 2 messages Mar 20, 2016 – Mar 21, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 util: move declarations out of qemu-common.h

From: Veronia <[email protected]>

Move declarations out of qemu-common.h for functions declared in utils/ files: e.g. include/qemu/path.h for utils/path.c. Move inline functions out of qemu-common.h and into new files (e.g. include/qemu/bcd.h)

---
 arch_init.c                   |    1 +
 audio/audio.c                 |    2 +
 block.c                       |    3 +-
 block/archipelago.c           |    2 +-
 block/blkdebug.c              |    2 +-
 block/blkverify.c             |    1 +
 block/block-backend.c         |    1 +
 block/curl.c                  |    1 +
 block/nbd.c                   |    2 +-
 block/qapi.c                  |    1 +
 block/qcow2-snapshot.c        |    2 +-
 block/qcow2.c                 |    2 +-
 block/qed.h                   |    1 +
 block/raw-posix.c             |    2 +-
 block/raw-win32.c             |    2 +-
 block/rbd.c                   |    3 +-
 block/sheepdog.c              |    2 +-
 block/vdi.c                   |    2 +-
 block/vmdk.c                  |    2 +-
 block/vvfat.c                 |    3 +-
 blockdev.c                    |    2 +
 bsd-user/elfload.c            |    1 +
 bsd-user/main.c               |    3 +-
 contrib/ivshmem-server/main.c |    2 +-
 disas/i386.c                  |    2 +
 dump.c                        |    3 +-
 exec.c                        |    2 +-
 gdbstub.c                     |    3 +-
 hmp.c                         |    1 +
 hw/9pfs/9p-proxy.c            |    1 +
 hw/9pfs/9p-synth.c            |    1 +
 hw/alpha/dp264.c              |    1 +
 hw/arm/nseries.c              |    2 +-
 hw/arm/omap1.c                |    2 +
 hw/arm/pxa2xx.c               |    1 +
 hw/arm/strongarm.c            |    1 +
 hw/block/nvme.h               |    1 +
 hw/bt/hci.c                   |    1 +
 hw/core/loader.c              |    1 +
 hw/core/machine.c             |    1 +
 hw/core/qdev-properties.c     |    1 +
 hw/core/qdev.c                |    1 +
 hw/cris/boot.c                |    1 +
 hw/dma/pl330.c                |    1 +
 hw/ide/core.c                 |    1 +
 hw/lm32/lm32_hwsetup.h        |    1 +
 hw/lm32/milkymist.c           |    1 +
 hw/microblaze/boot.c          |    1 +
 hw/mips/mips_jazz.c           |    1 +
 hw/misc/ivshmem.c             |    1 +
 hw/misc/macio/cuda.c          |    1 +
 hw/net/fsl_etsec/etsec.c      |    1 +
 hw/net/fsl_etsec/rings.c      |    1 +
 hw/nvram/fw_cfg.c             |    1 +
 hw/nvram/mac_nvram.c          |    1 +
 hw/pci/pci.c                  |    1 +
 hw/ppc/mac_newworld.c         |    1 +
 hw/ppc/mac_oldworld.c         |    1 +
 hw/ppc/prep.c                 |    1 +
 hw/ppc/spapr.c                |    2 +-
 hw/ppc/spapr_drc.c            |    1 +
 hw/ppc/spapr_events.c         |    3 +-
 hw/ppc/spapr_rtas.c           |    1 +
 hw/ppc/spapr_rtc.c            |    1 +
 hw/scsi/scsi-bus.c            |    1 +
 hw/scsi/scsi-disk.c           |    2 +-
 hw/scsi/vhost-scsi.c          |    1 +
 hw/sparc/sun4m.c              |    1 +
 hw/sparc64/sun4u.c            |    1 +
 hw/timer/ds1338.c             |    1 +
 hw/timer/exynos4210_rtc.c     |    1 +
 hw/timer/m48t59.c             |    1 +
 hw/timer/mc146818rtc.c        |    2 +
 hw/timer/pl031.c              |    1 +
 hw/timer/twl92230.c           |    1 +
 hw/usb/bus.c                  |    1 +
 hw/usb/dev-network.c          |    1 +
 hw/usb/dev-serial.c           |    1 +
 hw/usb/dev-storage.c          |    1 +
 hw/usb/redirect.c             |    1 +
 hw/watchdog/watchdog.c        |    2 +-
 hw/xen/xen-host-pci-device.c  |    1 +
 include/qemu-common.h         |  265 -----------------------------------------
 include/qemu/bcd.h            |   10 ++
 include/qemu/cutils.h         |  167 ++++++++++++++++++++++++++
 include/qemu/help_option.h    |   17 +++
 include/qemu/id.h             |    8 ++
 include/qemu/path.h           |   47 ++++++++
 include/qemu/unicode.h        |    5 +
 io/channel-socket.c           |    1 +
 io/channel-util.c             |    2 +-
 linux-user/elfload.c          |    1 +
 linux-user/main.c             |    4 +-
 linux-user/syscall.c          |    2 +
 linux-user/uaccess.c          |    1 +
 main-loop.c                   |    2 +-
 migration/migration.c         |    2 +-
 migration/qemu-file-unix.c    |    2 +-
 migration/savevm.c            |    3 +-
 monitor.c                     |    2 +
 net/net.c                     |    3 +-
 net/netmap.c                  |    1 +
 net/slirp.c                   |    1 +
 net/socket.c                  |    2 +-
 net/tap-bsd.c                 |    2 +-
 net/tap-linux.c               |    2 +-
 net/tap-solaris.c             |    1 +
 net/tap.c                     |    1 +
 os-posix.c                    |    1 +
 qapi/opts-visitor.c           |    2 +-
 qdev-monitor.c                |    1 +
 qemu-char.c                   |    3 +-
 qemu-img.c                    |    2 +-
 qemu-io-cmds.c                |    1 +
 qemu-nbd.c                    |    3 +-
 qga/commands-posix.c          |    2 +
 qga/commands.c                |    1 +
 qga/main.c                    |    1 +
 qmp.c                         |    2 +-
 qobject/json-parser.c         |    2 +-
 qobject/qdict.c               |    1 +
 qobject/qjson.c               |    1 +
 qom/object.c                  |    2 +-
 slirp/ip_icmp.c               |    1 +
 slirp/misc.c                  |    1 +
 slirp/slirp.c                 |    1 +
 slirp/socket.c                |    2 +-
 slirp/tcp_subr.c              |    1 +
 slirp/tftp.c                  |    1 +
 target-arm/arm-semi.c         |    1 +
 target-i386/cpu.c             |    1 +
 target-ppc/kvm.c              |    1 +
 target-ppc/translate_init.c   |    1 +
 target-s390x/cpu.c            |    1 +
 tcg/tcg.c                     |    2 +-
 tests/bios-tables-test.c      |    2 +-
 tests/ivshmem-test.c          |    1 +
 tests/qom-test.c              |    1 +
 tests/tcg/linux-test.c        |    1 +
 tests/test-cutils.c           |    3 +-
 tests/test-rfifolock.c        |    1 +
 trace/control.c               |    1 +
 ui/gtk.c                      |    1 +
 ui/keymaps.c                  |    1 +
 ui/sdl.c                      |    1 +
 ui/vnc.c                      |    1 +
 util/cutils.c                 |    3 +-
 util/event_notifier-posix.c   |    3 +-
 util/hexdump.c                |    2 +-
 util/id.c                     |    3 +-
 util/iov.c                    |    1 +
 util/osdep.c                  |    3 +-
 util/oslib-posix.c            |    2 +
 util/oslib-win32.c            |    1 +
 util/path.c                   |    3 +-
 util/qemu-openpty.c           |    1 +
 util/qemu-option.c            |    3 +
 util/qemu-sockets.c           |    2 +
 util/readline.c               |    3 +-
 util/unicode.c                |    2 +-
 vl.c                          |    3 +-
 161 files changed, 439 insertions(+), 320 deletions(-)
 create mode 100644 include/qemu/bcd.h
 create mode 100644 include/qemu/cutils.h
 create mode 100644 include/qemu/help_option.h
 create mode 100644 include/qemu/id.h
 create mode 100644 include/qemu/path.h
 create mode 100644 include/qemu/unicode.h
arch_init.c +1 -0
index f6aba02..e3bb1b3 100644
@@ -31,6 +31,7 @@
 #include "qemu/error-report.h"
 #include "qmp-commands.h"
 #include "hw/acpi/acpi.h"
+#include "qemu/help_option.h"
 
 #ifdef TARGET_SPARC
 int graphic_width = 1024;
audio/audio.c +2 -0
index e841532..b64df3f 100644
@@ -27,6 +27,8 @@
 #include "monitor/monitor.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 #define AUDIO_CAP "audio"
 #include "audio_int.h"
block.c +2 -1
index ba24b8e..72fa5b2 100644
@@ -22,7 +22,6 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "trace.h"
 #include "block/block_int.h"
 #include "block/blockjob.h"
@@ -40,6 +39,8 @@
 #include "qemu/timer.h"
 #include "qapi-event.h"
 #include "block/throttle-groups.h"
+#include "qemu/cutils.h"
+#include "qemu/id.h"
 
 #ifdef CONFIG_BSD
 #include <sys/ioctl.h>
block/archipelago.c +1 -1
index 0507589..b9f5e69 100644
@@ -51,7 +51,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "block/block_int.h"
 #include "qemu/error-report.h"
 #include "qemu/thread.h"
block/blkdebug.c +1 -1
index f85c54b..301a12a 100644
@@ -23,7 +23,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/config-file.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
block/blkverify.c +1 -0
index 2a885cc..8ba3217 100644
@@ -12,6 +12,7 @@
 #include "block/block_int.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qstring.h"
+#include "qemu/cutils.h"
 
 typedef struct {
     BdrvChild *test_file;
block/block-backend.c +1 -0
index ebdf78a..015aa2d 100644
@@ -18,6 +18,7 @@
 #include "sysemu/blockdev.h"
 #include "sysemu/sysemu.h"
 #include "qapi-event.h"
+#include "qemu/id.h"
 
 /* Number of coroutines to reserve per attached device model */
 #define COROUTINE_POOL_RESERVATION 64
block/curl.c +1 -0
index c70bfb4..57962dc 100644
@@ -29,6 +29,7 @@
 #include "qapi/qmp/qstring.h"
 #include "crypto/secret.h"
 #include <curl/curl.h>
+#include "qemu/cutils.h"
 
 // #define DEBUG_CURL
 // #define DEBUG_VERBOSE
block/nbd.c +1 -1
index 9f333c9..7d67520 100644
@@ -35,7 +35,7 @@
 #include "qapi/qmp/qjson.h"
 #include "qapi/qmp/qint.h"
 #include "qapi/qmp/qstring.h"
-
+#include "qemu/cutils.h"
 
 #define EN_OPTSTR ":exportname="
 
block/qapi.c +1 -0
index db2d3fb..87c5e0b 100644
@@ -32,6 +32,7 @@
 #include "qapi/qmp-output-visitor.h"
 #include "qapi/qmp/types.h"
 #include "sysemu/block-backend.h"
+#include "qemu/cutils.h"
 
 BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs, Error **errp)
 {
block/qcow2-snapshot.c +1 -1
index 13f88d1..85cbc2b 100644
@@ -23,10 +23,10 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "block/block_int.h"
 #include "block/qcow2.h"
 #include "qemu/error-report.h"
+#include "qemu/cutils.h"
 
 void qcow2_free_snapshots(BlockDriverState *bs)
 {
block/qcow2.c +1 -1
index 8babecd..60feb7b 100644
@@ -22,7 +22,6 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
 #include <zlib.h>
@@ -35,6 +34,7 @@
 #include "qapi-event.h"
 #include "trace.h"
 #include "qemu/option_int.h"
+#include "qemu/cutils.h"
 
 /*
   Differences with QCOW:
block/qed.h +1 -0
index 615e676..22b3198 100644
@@ -16,6 +16,7 @@
 #define BLOCK_QED_H
 
 #include "block/block_int.h"
+#include "qemu/cutils.h"
 
 /* The layout of a QED file is as follows:
  *
block/raw-posix.c +1 -1
index 8866121..1a3d3f5 100644
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
 #include "qemu/log.h"
block/raw-win32.c +1 -1
index 21a6cb8..9f8f199 100644
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/timer.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
block/rbd.c +2 -1
index abfea61..f19b15f 100644
@@ -13,10 +13,11 @@
 
 #include "qemu/osdep.h"
 
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "block/block_int.h"
 #include "crypto/secret.h"
+#include "qemu/cutils.h"
 
 #include <rbd/librbd.h>
 
block/sheepdog.c +1 -1
index 05677ed..ccd1f07 100644
@@ -13,12 +13,12 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "qemu/uri.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
 #include "block/block_int.h"
 #include "qemu/bitops.h"
+#include "qemu/cutils.h"
 
 #define SD_PROTO_VER 0x01
 
block/vdi.c +1 -1
index b403243..50055e1 100644
@@ -50,11 +50,11 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
 #include "migration/migration.h"
 #include "qemu/coroutine.h"
+#include "qemu/cutils.h"
 
 #if defined(CONFIG_UUID)
 #include <uuid/uuid.h>
block/vmdk.c +1 -1
index a8db5d9..c74c503 100644
@@ -24,12 +24,12 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "block/block_int.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "migration/migration.h"
+#include "qemu/cutils.h"
 #include <zlib.h>
 #include <glib.h>
 
block/vvfat.c +2 -1
index b8d29e1..c1637d8 100644
@@ -24,13 +24,14 @@
  */
 #include "qemu/osdep.h"
 #include <dirent.h>
-#include "qemu-common.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
 #include "migration/migration.h"
 #include "qapi/qmp/qint.h"
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qstring.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 #ifndef S_IWGRP
 #define S_IWGRP 0
blockdev.c +2 -0
index 0f20c65..94d4760 100644
@@ -50,6 +50,8 @@
 #include "qmp-commands.h"
 #include "trace.h"
 #include "sysemu/arch_init.h"
+#include "qemu/cutils.h"
+#include "qemu/help_option.h"
 
 static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states =
     QTAILQ_HEAD_INITIALIZER(monitor_bdrv_states);
bsd-user/elfload.c +1 -0
index 0a6092b..898ee05 100644
@@ -5,6 +5,7 @@
 
 #include "qemu.h"
 #include "disas/disas.h"
+#include "qemu/path.h"
 
 #ifdef _ARCH_PPC64
 #undef ARCH_DLINFO
bsd-user/main.c +2 -1
index 287ec1d..27854c1 100644
@@ -21,7 +21,8 @@
 #include <sys/mman.h>
 
 #include "qemu.h"
-#include "qemu-common.h"
+#include "qemu/path.h"
+#include "qemu/help_option.h"
 /* For tb_lock */
 #include "cpu.h"
 #include "tcg.h"
contrib/ivshmem-server/main.c +1 -1
index cca1061..685c2ce 100644
@@ -7,7 +7,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 
 #include "ivshmem-server.h"
 
disas/i386.c +2 -0
index d40b72a..894b0a1 100644
@@ -33,6 +33,8 @@
 
 #include "qemu/osdep.h"
 #include "disas/bfd.h"
+#include "qemu/cutils.h"
+
 /* include/opcode/i386.h r1.78 */
 
 /* opcode/i386.h -- Intel 80386 opcode macros
dump.c +2 -1
index 81d2d4f..cbd140f 100644
@@ -12,7 +12,8 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 #include "elf.h"
 #include "cpu.h"
 #include "exec/cpu-all.h"
exec.c +1 -1
index f09dd4e..857c971 100644
@@ -21,7 +21,7 @@
 #include <sys/mman.h>
 #endif
 
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "cpu.h"
 #include "tcg.h"
 #include "hw/hw.h"
gdbstub.c +2 -1
index 61c12b1..69c50d8 100644
@@ -17,7 +17,8 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 #ifdef CONFIG_USER_ONLY
 
 #include "qemu.h"
hmp.c +1 -0
index 5b6084a..cb92717 100644
@@ -34,6 +34,7 @@
 #include "ui/console.h"
 #include "block/qapi.h"
 #include "qemu-io.h"
+#include "qemu/cutils.h"
 
 #ifdef CONFIG_SPICE
 #include <spice/enums.h>
hw/9pfs/9p-proxy.c +1 -0
index 0805c9c..1174cf7 100644
@@ -16,6 +16,7 @@
 #include "qemu/error-report.h"
 #include "fsdev/qemu-fsdev.h"
 #include "9p-proxy.h"
+#include "qemu/path.h"
 
 typedef struct V9fsProxy {
     int sockfd;
hw/9pfs/9p-synth.c +1 -0
index 365623e..f1475df 100644
@@ -20,6 +20,7 @@
 #include "9p-synth.h"
 #include "qemu/rcu.h"
 #include "qemu/rcu_queue.h"
+#include "qemu/cutils.h"
 
 /* Root node for synth file system */
 static V9fsSynthNode v9fs_synth_root = {
hw/alpha/dp264.c +1 -0
index 7c5989b..54466b5 100644
@@ -18,6 +18,7 @@
 #include "hw/ide.h"
 #include "hw/timer/i8254.h"
 #include "hw/char/serial.h"
+#include "qemu/cutils.h"
 
 #define MAX_IDE_BUS 2
 
hw/arm/nseries.c +1 -1
index d9e61f7..05d430c 100644
@@ -19,7 +19,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "sysemu/sysemu.h"
 #include "hw/arm/omap.h"
 #include "hw/arm/arm.h"
hw/arm/omap1.c +2 -0
index 6f68130..e3c162e 100644
@@ -28,6 +28,8 @@
 #include "sysemu/blockdev.h"
 #include "qemu/range.h"
 #include "hw/sysbus.h"
+#include "qemu/cutils.h"
+#include "qemu/bcd.h"
 
 /* Should signal the TCMI/GPMC */
 uint32_t omap_badwidth_read8(void *opaque, hwaddr addr)
hw/arm/pxa2xx.c +1 -0
index ff6ac7a..fed1eeb 100644
@@ -17,6 +17,7 @@
 #include "sysemu/char.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
+#include "qemu/cutils.h"
 
 static struct {
     hwaddr io_base;
hw/arm/strongarm.c +1 -0
index 3b17a21..3cef2a3 100644
@@ -36,6 +36,7 @@
 #include "sysemu/char.h"
 #include "sysemu/sysemu.h"
 #include "hw/ssi/ssi.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG
 
hw/block/nvme.h +1 -0
index bf3a3cc..8fb0c10 100644
@@ -1,5 +1,6 @@
 #ifndef HW_NVME_H
 #define HW_NVME_H
+#include "qemu/cutils.h"
 
 typedef struct NvmeBar {
     uint64_t    cap;
hw/bt/hci.c +1 -0
index 8bc33b5..a26cc26 100644
@@ -26,6 +26,7 @@
 #include "hw/bt.h"
 #include "qapi/qmp/qerror.h"
 #include "sysemu/replay.h"
+#include "qemu/cutils.h"
 
 struct bt_hci_s {
     uint8_t *(*evt_packet)(void *opaque);
hw/core/loader.c +1 -0
index 8e8031c..a2f1341 100644
@@ -53,6 +53,7 @@
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
 #include "hw/boards.h"
+#include "qemu/cutils.h"
 
 #include <zlib.h>
 
hw/core/machine.c +1 -0
index a8c4680..6b9fc69 100644
@@ -17,6 +17,7 @@
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
 #include "qemu/error-report.h"
+#include "qemu/cutils.h"
 
 static char *machine_get_accel(Object *obj, Error **errp)
 {
hw/core/qdev-properties.c +1 -0
index bc89800..5b9fff4 100644
@@ -8,6 +8,7 @@
 #include "net/hub.h"
 #include "qapi/visitor.h"
 #include "sysemu/char.h"
+#include "qemu/path.h"
 
 void qdev_prop_set_after_realize(DeviceState *dev, const char *name,
                                   Error **errp)
hw/core/qdev.c +1 -0
index db41aa1..902414d 100644
@@ -36,6 +36,7 @@
 #include "hw/hotplug.h"
 #include "hw/boards.h"
 #include "qapi-event.h"
+#include "qemu/path.h"
 
 int qdev_hotplug = 0;
 static bool qdev_hot_added = false;
hw/cris/boot.c +1 -0
index 42485a4..5eb27e2 100644
@@ -27,6 +27,7 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "boot.h"
+#include "qemu/cutils.h"
 
 static void main_cpu_reset(void *opaque)
 {
hw/dma/pl330.c +1 -0
index 37ea7e4..0bd5bab 100644
@@ -18,6 +18,7 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "sysemu/dma.h"
+#include "qemu/unicode.h"
 
 #ifndef PL330_ERR_DEBUG
 #define PL330_ERR_DEBUG 0
hw/ide/core.c +1 -0
index 241e840..2a43a20 100644
@@ -33,6 +33,7 @@
 #include "sysemu/dma.h"
 #include "hw/block/block.h"
 #include "sysemu/block-backend.h"
+#include "qemu/cutils.h"
 
 #include <hw/ide/internal.h>
 
hw/lm32/lm32_hwsetup.h +1 -0
index 838754d..b71e6ea 100644
@@ -26,6 +26,7 @@
 #define QEMU_HW_LM32_HWSETUP_H
 
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "hw/loader.h"
 
 typedef struct {
hw/lm32/milkymist.c +1 -0
index f71492e..5f14c1f 100644
@@ -31,6 +31,7 @@
 #include "milkymist-hw.h"
 #include "lm32.h"
 #include "exec/address-spaces.h"
+#include "qemu/cutils.h"
 
 #define BIOS_FILENAME    "mmone-bios.bin"
 #define BIOS_OFFSET      0x00860000
hw/microblaze/boot.c +1 -0
index c24014a..d0f6705 100644
@@ -33,6 +33,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/loader.h"
 #include "elf.h"
+#include "qemu/cutils.h"
 
 #include "boot.h"
 
hw/mips/mips_jazz.c +1 -0
index d6d8058..a6acbfa 100644
@@ -45,6 +45,7 @@
 #include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
 #include "qemu/error-report.h"
+#include "qemu/help_option.h"
 
 enum jazz_model_e
 {
hw/misc/ivshmem.c +1 -0
index 1838bc8..8608d94 100644
@@ -17,6 +17,7 @@
  * GNU GPL, version 2 or (at your option) any later version.
  */
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
hw/misc/macio/cuda.c +1 -0
index 481abdb..e15bb1d 100644
@@ -28,6 +28,7 @@
 #include "hw/input/adb.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
+#include "qemu/cutils.h"
 
 /* XXX: implement all timer modes */
 
hw/net/fsl_etsec/etsec.c +1 -0
index 1e35f7f..af13f51 100644
@@ -33,6 +33,7 @@
 #include "hw/ptimer.h"
 #include "etsec.h"
 #include "registers.h"
+#include "qemu/unicode.h"
 
 /* #define HEX_DUMP */
 /* #define DEBUG_REGISTER */
hw/net/fsl_etsec/rings.c +1 -0
index ed1de7d..a48afb5 100644
@@ -23,6 +23,7 @@
  */
 #include "qemu/osdep.h"
 #include "net/checksum.h"
+#include "qemu/unicode.h"
 
 #include "etsec.h"
 #include "registers.h"
hw/nvram/fw_cfg.c +1 -0
index 7866248..d96932f 100644
@@ -31,6 +31,7 @@
 #include "trace.h"
 #include "qemu/error-report.h"
 #include "qemu/config-file.h"
+#include "qemu/cutils.h"
 
 #define FW_CFG_NAME "fw_cfg"
 #define FW_CFG_PATH "/machine/" FW_CFG_NAME
hw/nvram/mac_nvram.c +1 -0
index 1671f46..24f6121 100644
@@ -27,6 +27,7 @@
 #include "hw/nvram/openbios_firmware_abi.h"
 #include "sysemu/sysemu.h"
 #include "hw/ppc/mac.h"
+#include "qemu/cutils.h"
 #include <zlib.h>
 
 /* debug NVR */
hw/pci/pci.c +1 -0
index e67664d..bb605ef 100644
@@ -40,6 +40,7 @@
 #include "exec/address-spaces.h"
 #include "hw/hotplug.h"
 #include "hw/boards.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG_PCI
 #ifdef DEBUG_PCI
hw/ppc/mac_newworld.c +1 -0
index f0a36b3..4b75ee9 100644
@@ -70,6 +70,7 @@
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
 #include "hw/sysbus.h"
+#include "qemu/cutils.h"
 
 #define MAX_IDE_BUS 2
 #define CFG_ADDR 0xf0000510
hw/ppc/mac_oldworld.c +1 -0
index d952713..ab983c3 100644
@@ -44,6 +44,7 @@
 #include "kvm_ppc.h"
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
+#include "qemu/cutils.h"
 
 #define MAX_IDE_BUS 2
 #define CFG_ADDR 0xf0000510
hw/ppc/prep.c +1 -0
index 793b9ed..3ffb85e 100644
@@ -46,6 +46,7 @@
 #include "exec/address-spaces.h"
 #include "trace.h"
 #include "elf.h"
+#include "qemu/cutils.h"
 
 /* SMP is not enabled, for now */
 #define MAX_CPUS 1
hw/ppc/spapr.c +1 -1
index 64c4acc..56973b5 100644
@@ -63,7 +63,7 @@
 #include "hw/nmi.h"
 
 #include "hw/compat.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 
 #include <libfdt.h>
 
hw/ppc/spapr_drc.c +1 -0
index ef063c0..a727ae6 100644
@@ -11,6 +11,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
 #include "hw/ppc/spapr_drc.h"
 #include "qom/object.h"
 #include "hw/qdev.h"
hw/ppc/spapr_events.c +2 -1
index 39f4682..37de7a0 100644
@@ -36,7 +36,8 @@
 #include "hw/pci/pci.h"
 #include "hw/pci-host/spapr.h"
 #include "hw/ppc/spapr_drc.h"
-
+#include "qemu/help_option.h"
+#include "qemu/bcd.h"
 #include <libfdt.h>
 
 struct rtas_error_log {
hw/ppc/spapr_rtas.c +1 -0
index b7c5ebd..2db2292 100644
@@ -39,6 +39,7 @@
 
 #include <libfdt.h>
 #include "hw/ppc/spapr_drc.h"
+#include "qemu/cutils.h"
 
 /* #define DEBUG_SPAPR */
 
hw/ppc/spapr_rtc.c +1 -0
index 02fa373..3a17ac4 100644
@@ -31,6 +31,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/ppc/spapr.h"
 #include "qapi-event.h"
+#include "qemu/cutils.h"
 
 #define SPAPR_RTC(obj) \
     OBJECT_CHECK(sPAPRRTCState, (obj), TYPE_SPAPR_RTC)
hw/scsi/scsi-bus.c +1 -0
index a21752b..004aa8a 100644
@@ -8,6 +8,7 @@
 #include "sysemu/blockdev.h"
 #include "trace.h"
 #include "sysemu/dma.h"
+#include "qemu/cutils.h"
 
 static char *scsibus_get_dev_path(DeviceState *dev);
 static char *scsibus_get_fw_dev_path(DeviceState *dev);
hw/scsi/scsi-disk.c +1 -1
index 469aec2..157674b 100644
@@ -29,7 +29,6 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
 #endif
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "hw/scsi/scsi.h"
 #include "block/scsi.h"
@@ -38,6 +37,7 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
 #include "sysemu/blockdev.h"
 #include "hw/block/block.h"
 #include "sysemu/dma.h"
+#include "qemu/cutils.h"
 
 #ifdef __linux
 #include <scsi/sg.h>
hw/scsi/vhost-scsi.c +1 -0
index c86622c..2d809e3 100644
@@ -27,6 +27,7 @@
 #include "hw/virtio/virtio-access.h"
 #include "hw/fw-path-provider.h"
 #include "linux/vhost.h"
+#include "qemu/cutils.h"
 
 /* Features supported by host kernel. */
 static const int kernel_feature_bits[] = {
hw/sparc/sun4m.c +1 -0
index eebef37..850db7c 100644
@@ -43,6 +43,7 @@
 #include "elf.h"
 #include "sysemu/block-backend.h"
 #include "trace.h"
+#include "qemu/cutils.h"
 
 /*
  * Sun4m architecture was used in the following machines:
hw/sparc64/sun4u.c +1 -0
index 0a6f453..41ea0e6 100644
@@ -41,6 +41,7 @@
 #include "elf.h"
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG_IRQ
 //#define DEBUG_EBUS
hw/timer/ds1338.c +1 -0
index ff31561..cc1a778 100644
@@ -12,6 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/i2c/i2c.h"
+#include "qemu/bcd.h"
 
 /* Size of NVRAM including both the user-accessible area and the
  * secondary register area.
hw/timer/exynos4210_rtc.c +1 -0
index f21fb54..da4dd45 100644
@@ -29,6 +29,7 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "qemu-common.h"
+#include "qemu/bcd.h"
 #include "hw/ptimer.h"
 
 #include "hw/hw.h"
hw/timer/m48t59.c +1 -0
index bbcfeb2..82e3e40 100644
@@ -30,6 +30,7 @@
 #include "hw/sysbus.h"
 #include "hw/isa/isa.h"
 #include "exec/address-spaces.h"
+#include "qemu/bcd.h"
 
 //#define DEBUG_NVRAM
 
hw/timer/mc146818rtc.c +2 -0
index eb0100a..266ebd7 100644
@@ -22,6 +22,8 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
+#include "qemu/bcd.h"
 #include "hw/hw.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
hw/timer/pl031.c +1 -0
index 3ccb2cb..1c8cdd9 100644
@@ -15,6 +15,7 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG_PL031
 
hw/timer/twl92230.c +1 -0
index 1c92438..7ba4e9a 100644
@@ -25,6 +25,7 @@
 #include "hw/i2c/i2c.h"
 #include "sysemu/sysemu.h"
 #include "ui/console.h"
+#include "qemu/bcd.h"
 
 #define VERBOSE 1
 
hw/usb/bus.c +1 -0
index 4452bdb..a34a3c9 100644
@@ -6,6 +6,7 @@
 #include "sysemu/sysemu.h"
 #include "monitor/monitor.h"
 #include "trace.h"
+#include "qemu/cutils.h"
 
 static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent);
 
hw/usb/dev-network.c +1 -0
index c6abd38..1a6e824 100644
@@ -33,6 +33,7 @@
 #include "qemu/config-file.h"
 #include "sysemu/sysemu.h"
 #include "qemu/iov.h"
+#include "qemu/cutils.h"
 
 /*#define TRAFFIC_DEBUG*/
 /* Thanks to NetChip Technologies for donating this product ID.
hw/usb/dev-serial.c +1 -0
index afad1db..0859ae5 100644
@@ -10,6 +10,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "hw/usb.h"
 #include "hw/usb/desc.h"
hw/usb/dev-storage.c +1 -0
index 5ae0424..ad44560 100644
@@ -21,6 +21,7 @@
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "qapi/visitor.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG_MSD
 
hw/usb/redirect.c +1 -0
index 38a5393..3539a11 100644
@@ -33,6 +33,7 @@
 #include "qemu/error-report.h"
 #include "qemu/iov.h"
 #include "sysemu/char.h"
+#include "qemu/path.h"
 
 #include <sys/ioctl.h>
 #include <usbredirparser.h>
hw/watchdog/watchdog.c +1 -1
index 194c9b4..bbf3646 100644
@@ -20,7 +20,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/queue.h"
@@ -29,6 +28,7 @@
 #include "sysemu/watchdog.h"
 #include "qapi-event.h"
 #include "hw/nmi.h"
+#include "qemu/help_option.h"
 
 static int watchdog_action = WDT_RESET;
 static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list;
hw/xen/xen-host-pci-device.c +1 -0
index 9666fff..b2524af 100644
@@ -8,6 +8,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "xen-host-pci-device.h"
 
 #define XEN_HOST_PCI_MAX_EXT_CAP \
include/qemu-common.h +0 -265

283 lines not on this page · raw message

include/qemu/bcd.h new file +10 -0
new file mode 100644
index 0000000..7e720c4
@@ -0,0 +1,10 @@
+/* Convert a byte between binary and BCD.  */
+static inline uint8_t to_bcd(uint8_t val)
+{
+    return ((val / 10) << 4) | (val % 10);
+}
+
+static inline uint8_t from_bcd(uint8_t val)
+{
+    return ((val >> 4) * 10) + (val & 0x0f);
+}
include/qemu/cutils.h new file +167 -0

167 lines not on this page · raw message

include/qemu/help_option.h new file +17 -0
new file mode 100644
index 0000000..a7a3177
@@ -0,0 +1,17 @@
+/**
+ * is_help_option:
+ * @s: string to test
+ *
+ * Check whether @s is one of the standard strings which indicate
+ * that the user is asking for a list of the valid values for a
+ * command option like -cpu or -M. The current accepted strings
+ * are 'help' and '?'. '?' is deprecated (it is a shell wildcard
+ * which makes it annoying to use in a reliable way) but provided
+ * for backwards compatibility.
+ *
+ * Returns: true if @s is a request for a list.
+ */
+static inline bool is_help_option(const char *s)
+{
+    return !strcmp(s, "?") || !strcmp(s, "help");
+}
include/qemu/id.h new file +8 -0
new file mode 100644
index 0000000..3ed104e
@@ -0,0 +1,8 @@
+typedef enum IdSubSystems {
+    ID_QDEV,
+    ID_BLOCK,
+    ID_MAX      /* last element, used as array size */
+} IdSubSystems;
+
+char *id_generate(IdSubSystems id);
+bool id_wellformed(const char *id);
include/qemu/path.h new file +47 -0

47 lines not on this page · raw message

include/qemu/unicode.h new file +5 -0
new file mode 100644
index 0000000..80dcd0d
@@ -0,0 +1,5 @@
+int mod_utf8_codepoint(const char *s, size_t n, char **end);
+/*
+Hexdump a buffer to a file. An optional string prefix is added to every line
+*/
+void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
io/channel-socket.c +1 -0
index d005070..2d274ec 100644
@@ -22,6 +22,7 @@
 #include "io/channel-socket.h"
 #include "io/channel-watch.h"
 #include "trace.h"
+#include "qemu/path.h"
 
 #define SOCKET_MAX_FDS 16
 
io/channel-util.c +1 -1
index 0fb4bd0..b826397 100644
@@ -22,7 +22,7 @@
 #include "io/channel-util.h"
 #include "io/channel-file.h"
 #include "io/channel-socket.h"
-
+#include "qemu/path.h"
 
 static bool fd_is_socket(int fd)
 {
linux-user/elfload.c +1 -0
index 19dc7f5..e47caff 100644
@@ -7,6 +7,7 @@
 
 #include "qemu.h"
 #include "disas/disas.h"
+#include "qemu/path.h"
 
 #ifdef _ARCH_PPC64
 #undef ARCH_DLINFO
linux-user/main.c +3 -1
index 2b1e755..b432bf2 100644
@@ -22,7 +22,9 @@
 #include <sys/resource.h>
 
 #include "qemu.h"
-#include "qemu-common.h"
+#include "qemu/path.h"
+#include "qemu/cutils.h"
+#include "qemu/help_option.h"
 #include "cpu.h"
 #include "tcg.h"
 #include "qemu/timer.h"
linux-user/syscall.c +2 -0
index 9517531..032d338 100644
@@ -18,6 +18,8 @@
  */
 #define _ATFILE_SOURCE
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 #include <elf.h>
 #include <endian.h>
 #include <grp.h>
linux-user/uaccess.c +1 -0
index 75d890d..0a5c0b0 100644
@@ -1,5 +1,6 @@
 /* User memory access */
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
 
 #include "qemu.h"
 
main-loop.c +1 -1
index 19beae7..f08a0f2 100644
@@ -23,7 +23,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/timer.h"
 #include "qemu/sockets.h"	// struct in_addr needed for libslirp.h
 #include "sysemu/qtest.h"
migration/migration.c +1 -1
index 034a918..991313a 100644
@@ -14,7 +14,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 #include "migration/migration.h"
migration/qemu-file-unix.c +1 -1
index 4474e18..8af5648 100644
@@ -22,13 +22,13 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "qemu/iov.h"
 #include "qemu/sockets.h"
 #include "qemu/coroutine.h"
 #include "migration/qemu-file.h"
 #include "migration/qemu-file-internal.h"
+#include "qemu/path.h"
 
 typedef struct QEMUFileSocket {
     int fd;
migration/savevm.c +1 -2
index 0a33c22..16ba443 100644
@@ -27,7 +27,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "hw/boards.h"
 #include "hw/hw.h"
 #include "hw/qdev.h"
@@ -50,7 +49,7 @@
 #include "qemu/iov.h"
 #include "block/snapshot.h"
 #include "block/qapi.h"
-
+#include "qemu/cutils.h"
 
 #ifndef ETH_P_RARP
 #define ETH_P_RARP 0x8035
monitor.c +2 -0
index e99ca8c..7660927 100644
@@ -76,6 +76,8 @@
 #include "qapi-event.h"
 #include "qmp-introspect.h"
 #include "sysemu/block-backend.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 /* for hmp_info_irq/pic */
 #if defined(TARGET_SPARC)
net/net.c +2 -1
index b0c832e..3a0542b 100644
@@ -31,7 +31,8 @@
 #include "util.h"
 
 #include "monitor/monitor.h"
-#include "qemu-common.h"
+#include "qemu/path.h"
+#include "qemu/help_option.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
net/netmap.c +1 -0
index 1b42728..f1e9b8b 100644
@@ -37,6 +37,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/error-report.h"
 #include "qemu/iov.h"
+#include "qemu/cutils.h"
 
 typedef struct NetmapState {
     NetClientState      nc;
net/slirp.c +1 -0
index 6b51fbc..fa171a7 100644
@@ -37,6 +37,7 @@
 #include "qemu/sockets.h"
 #include "slirp/libslirp.h"
 #include "sysemu/char.h"
+#include "qemu/cutils.h"
 
 static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
 {
net/socket.c +1 -1
index 73dc49a..450ad3f 100644
@@ -26,7 +26,7 @@
 #include "net/net.h"
 #include "clients.h"
 #include "monitor/monitor.h"
-#include "qemu-common.h"
+#include "qemu/path.h"
 #include "qemu/error-report.h"
 #include "qemu/option.h"
 #include "qemu/sockets.h"
net/tap-bsd.c +1 -1
index 83de19a..ff47033 100644
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "tap_int.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "sysemu/sysemu.h"
 #include "qemu/error-report.h"
 
net/tap-linux.c +1 -1
index 0929cf7..494c834 100644
@@ -32,8 +32,8 @@
 #include <sys/ioctl.h>
 
 #include "sysemu/sysemu.h"
-#include "qemu-common.h"
 #include "qemu/error-report.h"
+#include "qemu/cutils.h"
 
 #define PATH_NET_TUN "/dev/net/tun"
 
net/tap-solaris.c +1 -0
index e3907a8..aef59c1 100644
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include "tap_int.h"
 #include "sysemu/sysemu.h"
+#include "qemu/cutils.h"
 
 #include <sys/ethernet.h>
 #include <sys/sockio.h>
net/tap.c +1 -0
index cd7a7fc..9ff068d 100644
@@ -37,6 +37,7 @@
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 
 #include "net/tap.h"
os-posix.c +1 -0
index 92fa3ba..107fde3 100644
@@ -38,6 +38,7 @@
 #include "qemu/rcu.h"
 #include "qemu/error-report.h"
 #include "qemu/log.h"
+#include "qemu/cutils.h"
 
 #ifdef CONFIG_LINUX
 #include <sys/prctl.h>
qapi/opts-visitor.c +1 -1
index 73e4ace..13cc8f0 100644
@@ -11,7 +11,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/opts-visitor.h"
 #include "qemu/queue.h"
qdev-monitor.c +1 -0
index 81e3ff3..46a5404 100644
@@ -27,6 +27,7 @@
 #include "qapi/qmp/qerror.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
+#include "qemu/help_option.h"
 
 /*
  * Aliases were a bad idea from the start.  Let's keep them
qemu-char.c +2 -1
index 3bf30b5..95efb8c 100644
@@ -22,7 +22,8 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
 #include "qemu/error-report.h"
qemu-img.c +1 -1
index 2edb139..2611ba9 100644
@@ -26,7 +26,7 @@
 #include "qapi/qmp-output-visitor.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/qmp/qjson.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/config-file.h"
 #include "qemu/option.h"
 #include "qemu/error-report.h"
qemu-io-cmds.c +1 -0
index e929d24..0346a71 100644
@@ -18,6 +18,7 @@
 #include "qemu/main-loop.h"
 #include "qemu/timer.h"
 #include "sysemu/block-backend.h"
+#include "qemu/cutils.h"
 
 #define CMD_NOFILE_OK   0x01
 
qemu-nbd.c +2 -1
index a5c1d95..713d46d 100644
@@ -17,7 +17,8 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 #include "sysemu/block-backend.h"
 #include "block/block_int.h"
 #include "block/nbd.h"
qga/commands-posix.c +2 -0
index 9f51fae..ca1a8de 100644
@@ -23,6 +23,8 @@
 #include "qemu/host-utils.h"
 #include "qemu/sockets.h"
 #include "qemu/base64.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 #ifndef CONFIG_HAS_ENVIRON
 #ifdef __APPLE__
qga/commands.c +1 -0
index e091ee1..95d8b04 100644
@@ -16,6 +16,7 @@
 #include "qga-qmp-commands.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/base64.h"
+#include "qemu/cutils.h"
 
 /* Maximum captured guest-exec out_data/err_data - 16MB */
 #define GUEST_EXEC_MAX_OUTPUT (16*1024*1024)
qga/main.c +1 -0
index 0a168e2..053e08c 100644
@@ -29,6 +29,7 @@
 #include "qapi/qmp/dispatch.h"
 #include "qga/channel.h"
 #include "qemu/bswap.h"
+#include "qemu/help_option.h"
 #ifdef _WIN32
 #include "qga/service-win32.h"
 #include "qga/vss-win32.h"
qmp.c +1 -1
index 3f16a77..9d0953b 100644
@@ -14,7 +14,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
 #include "qmp-commands.h"
qobject/json-parser.c +1 -1
index 6c05f6c..31b9c7c 100644
@@ -13,7 +13,7 @@
 
 #include "qemu/osdep.h"
 
-#include "qemu-common.h"
+#include "qemu/path.h"
 #include "qapi/qmp/qstring.h"
 #include "qapi/qmp/qint.h"
 #include "qapi/qmp/qdict.h"
qobject/qdict.c +1 -0
index 9833bd0..a128536 100644
@@ -19,6 +19,7 @@
 #include "qapi/qmp/qobject.h"
 #include "qemu/queue.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 
 /**
  * qdict_new(): Create a new QDict
qobject/qjson.c +1 -0
index 06dc210..ef160d2 100644
@@ -21,6 +21,7 @@
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qfloat.h"
 #include "qapi/qmp/qdict.h"
+#include "qemu/unicode.h"
 
 typedef struct JSONParsingState
 {
qom/object.c +1 -1
index 844ae7a..5158862 100644
@@ -13,7 +13,7 @@
 #include "qemu/osdep.h"
 #include "qom/object.h"
 #include "qom/object_interfaces.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qapi/visitor.h"
 #include "qapi-visit.h"
 #include "qapi/string-input-visitor.h"
slirp/ip_icmp.c +1 -0
index ace3982..acc5c96 100644
@@ -33,6 +33,7 @@
 #include "qemu/osdep.h"
 #include "slirp.h"
 #include "ip_icmp.h"
+#include "qemu/path.h"
 
 /* The message sent when emulating PING */
 /* Be nice and tell them it's just a pseudo-ping packet */
slirp/misc.c +1 -0
index e2eea2e..bdb8929 100644
@@ -12,6 +12,7 @@
 #include "monitor/monitor.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
+#include "qemu/path.h"
 
 #ifdef DEBUG
 int slirp_debug = DBG_CALL|DBG_MISC|DBG_ERROR;
slirp/slirp.c +1 -0
index 0466d33..63d96c2 100644
@@ -28,6 +28,7 @@
 #include "sysemu/char.h"
 #include "slirp.h"
 #include "hw/hw.h"
+#include "qemu/cutils.h"
 
 /* host loopback address */
 struct in_addr loopback_addr;
slirp/socket.c +1 -1
index 2b5453e..0666bfe 100644
@@ -6,7 +6,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/path.h"
 #include <slirp.h>
 #include "ip_icmp.h"
 #ifdef __sun__
slirp/tcp_subr.c +1 -0
index b1aa1f2..92be294 100644
@@ -40,6 +40,7 @@
 
 #include "qemu/osdep.h"
 #include <slirp.h>
+#include "qemu/path.h"
 
 /* patchable/settable parameters for tcp */
 /* Don't do rfc1323 performance enhancements */
slirp/tftp.c +1 -0
index abb0106..e01369b 100644
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include <slirp.h>
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 
 static inline int tftp_session_in_use(struct tftp_session *spt)
 {
target-arm/arm-semi.c +1 -0
index 76c33b9..8be0645 100644
@@ -30,6 +30,7 @@
 #include "qemu-common.h"
 #include "exec/gdbstub.h"
 #include "hw/arm/arm.h"
+#include "qemu/cutils.h"
 #endif
 
 #define TARGET_SYS_OPEN        0x01
target-i386/cpu.c +1 -0
index 0f38d1e..08dc88c 100644
@@ -17,6 +17,7 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
 
 #include "cpu.h"
 #include "sysemu/kvm.h"
target-ppc/kvm.c +1 -0
index d67c169..5caa5dd 100644
@@ -42,6 +42,7 @@
 #include "exec/gdbstub.h"
 #include "exec/memattrs.h"
 #include "sysemu/hostmem.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG_KVM
 
target-ppc/translate_init.c +1 -0
index bd0cffc..0714b0e 100644
@@ -31,6 +31,7 @@
 #include "qemu/error-report.h"
 #include "qapi/visitor.h"
 #include "hw/qdev-properties.h"
+#include "qemu/path.h"
 
 //#define PPC_DUMP_CPU
 //#define PPC_DEBUG_SPR
target-s390x/cpu.c +1 -0
index 1cbf703..d66d7b1 100644
@@ -26,6 +26,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
 #include "hw/hw.h"
tcg/tcg.c +1 -1
index 550671b..4c8c2d2 100644
@@ -36,7 +36,7 @@
 #define NDEBUG
 #endif
 
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/host-utils.h"
 #include "qemu/timer.h"
 
tests/bios-tables-test.c +1 -1
index 0a80ddf..f1e2336 100644
@@ -13,7 +13,7 @@
 #include "qemu/osdep.h"
 #include <glib.h>
 #include <glib/gstdio.h>
-#include "qemu-common.h"
+#include "qemu/path.h"
 #include "libqtest.h"
 #include "hw/acpi/acpi-defs.h"
 #include "hw/smbios/smbios.h"
tests/ivshmem-test.c +1 -0
index e184c67..253556e 100644
@@ -16,6 +16,7 @@
 #include "libqos/pci-pc.h"
 #include "libqtest.h"
 #include "qemu-common.h"
+#include "qemu/path.h"
 
 #define TMPSHMSIZE (1 << 20)
 static char *tmpshm;
tests/qom-test.c +1 -0
index 3c6cfca..bd5cdde 100644
@@ -11,6 +11,7 @@
 #include <glib.h>
 
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "libqtest.h"
 #include "qapi/qmp/types.h"
 
tests/tcg/linux-test.c +1 -0
index 1c6c013..5070d31 100644
@@ -39,6 +39,7 @@
 #include <dirent.h>
 #include <setjmp.h>
 #include <sys/shm.h>
+#include "qemu/cutils.h"
 
 #define TESTPATH "/tmp/linux-test.tmp"
 #define TESTPORT 7654
tests/test-cutils.c +1 -2
index 398700d..fb8f5b5 100644
@@ -28,8 +28,7 @@
 #include "qemu/osdep.h"
 #include <glib.h>
 
-#include "qemu-common.h"
-
+#include "qemu/cutils.h"
 
 static void test_parse_uint_null(void)
 {
tests/test-rfifolock.c +1 -0
index 9a3cb24..c8d5553 100644
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include <glib.h>
 #include "qemu-common.h"
+#include "qemu/path.h"
 #include "qemu/rfifolock.h"
 
 static void test_nesting(void)
trace/control.c +1 -0
index 20d3370..ccddda5 100644
@@ -9,6 +9,7 @@
 
 #include "qemu/osdep.h"
 #include "trace/control.h"
+#include "qemu/help_option.h"
 #ifdef CONFIG_TRACE_SIMPLE
 #include "trace/simple.h"
 #endif
ui/gtk.c +1 -0
index 38ef3fd..f372a6d 100644
@@ -36,6 +36,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 
 #include "ui/console.h"
 #include "ui/gtk.h"
ui/keymaps.c +1 -0
index 8899a0b..8b03ac1 100644
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include "keymaps.h"
 #include "sysemu/sysemu.h"
+#include "qemu/path.h"
 
 static int get_keysym(const name2keysym_t *table,
                       const char *name)
ui/sdl.c +1 -0
index abeef33..d8cf5bc 100644
@@ -30,6 +30,7 @@
 #include <SDL_syswm.h>
 
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "ui/console.h"
 #include "ui/input.h"
 #include "sysemu/sysemu.h"
ui/vnc.c +1 -0
index 729f630..e06d39c 100644
@@ -44,6 +44,7 @@
 #include "crypto/tlscredsanon.h"
 #include "crypto/tlscredsx509.h"
 #include "qom/object_interfaces.h"
+#include "qemu/cutils.h"
 
 #define VNC_REFRESH_INTERVAL_BASE GUI_REFRESH_INTERVAL_DEFAULT
 #define VNC_REFRESH_INTERVAL_INC  50
util/cutils.c +2 -1
index c3dd534..7e70931 100644
@@ -22,13 +22,14 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "qemu/host-utils.h"
 #include <math.h>
 
 #include "qemu/sockets.h"
 #include "qemu/iov.h"
 #include "net/net.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 void strpadcpy(char *buf, int buf_size, const char *str, char pad)
 {
util/event_notifier-posix.c +2 -1
index 2e30e74..836532e 100644
@@ -11,7 +11,8 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 #include "qemu/event_notifier.h"
 #include "sysemu/char.h"
 #include "qemu/main-loop.h"
util/hexdump.c +1 -1
index 1d9c129..65ac909 100644
@@ -14,7 +14,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/unicode.h"
 
 void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size)
 {
util/id.c +2 -1
index bbbadcc..5d29e32 100644
@@ -11,7 +11,8 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/id.h"
+#include "qemu/path.h"
 
 bool id_wellformed(const char *id)
 {
util/iov.c +1 -0
index 062f4e5..5641e2e 100644
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "qemu/iov.h"
 #include "qemu/sockets.h"
+#include "qemu/unicode.h"
 
 size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt,
                          size_t offset, const void *buf, size_t bytes)
util/osdep.c +2 -1
index 8356bdd..44d22f8 100644
@@ -36,7 +36,8 @@
 extern int madvise(caddr_t, size_t, int);
 #endif
 
-#include "qemu-common.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 #include "qemu/sockets.h"
 #include "qemu/error-report.h"
 #include "monitor/monitor.h"
util/oslib-posix.c +2 -0
index 7615be4..048a5c7 100644
@@ -51,6 +51,8 @@
 #include <libgen.h>
 #include <setjmp.h>
 #include <sys/signal.h>
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 #ifdef CONFIG_LINUX
 #include <sys/syscall.h>
util/oslib-win32.c +1 -0
index a3f0664..e67e31e 100644
@@ -36,6 +36,7 @@
 #include "qemu/main-loop.h"
 #include "trace.h"
 #include "qemu/sockets.h"
+#include "qemu/cutils.h"
 
 /* this must come after including "trace.h" */
 #include <shlobj.h>
util/path.c +2 -1
index d09e8c5..7f9fc27 100644
@@ -6,7 +6,8 @@
 #include "qemu/osdep.h"
 #include <sys/param.h>
 #include <dirent.h>
-#include "qemu-common.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 struct pathelem
 {
util/qemu-openpty.c +1 -0
index 2e8b43b..8c9c4a9 100644
@@ -34,6 +34,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/path.h"
 
 #if defined(__GLIBC__)
 # include <pty.h>
util/qemu-option.c +3 -0
index e7aa43f..1d23934 100644
@@ -30,6 +30,9 @@
 #include "qapi/qmp/types.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/option_int.h"
+#include "qemu/cutils.h"
+#include "qemu/id.h"
+#include "qemu/help_option.h"
 
 /*
  * Extracts the name of an option from the parameter string (p points at the
util/qemu-sockets.c +2 -0
index fd37ac2..8ea2a15 100644
@@ -23,6 +23,8 @@
 #include "qapi/qmp-input-visitor.h"
 #include "qapi/qmp-output-visitor.h"
 #include "qapi-visit.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 #ifndef AI_ADDRCONFIG
 # define AI_ADDRCONFIG 0
util/readline.c +2 -1
index e94c975..a97fe0d 100644
@@ -23,8 +23,9 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "qemu/readline.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 #define IS_NORM 0
 #define IS_ESC  1
util/unicode.c +1 -1
index 524dca8..a812a35 100644
@@ -11,7 +11,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/unicode.h"
 
 /**
  * mod_utf8_codepoint:
vl.c +2 -1
index 7a28982..2a42e1b 100644
@@ -22,7 +22,8 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-
+#include "qemu/cutils.h"
+#include "qemu/help_option.h"
 
 #ifdef CONFIG_SECCOMP
 #include "sysemu/seccomp.h"
Signature · 1 line
1.7.9.5
#1 lore raw

There are only two issues with the patch, which I fixed before queuing it for my next pull request.

include/qemu-common.h int qemu_main(int argc, char **argv, char **envp); · line 259

Quoted 3 lines · On 20/03/2016 18:16, [email protected] wrote:
include/qemu-common.h +0 -3
-/* path.c */
-void init_paths(const char *prefix);
-const char *path(const char *pathname);

The first is that only the above two lines were really for path.c, so I have removed everything else from path.h. Likewise, unicode.c only has mod_utf8_codepoint.

Quoted 18 lines
include/qemu-common.h +0 -9
-/* unicode.c */
-int mod_utf8_codepoint(const char *s, size_t n, char **end);
-
-/*
- * Hexdump a buffer to a file. An optional string prefix is added to every line
- */
-
-void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
-
 /* vector definitions */
 #ifdef __ALTIVEC__
 #include <altivec.h>
include/qemu/bcd.h new file +0 -0
new file mode 100644
index 0000000..7e720c4

include/qemu/bcd.h line 10

Quoted 10 lines
include/qemu/bcd.h new file +10 -0
@@ -0,0 +1,10 @@
+/* Convert a byte between binary and BCD.  */
+static inline uint8_t to_bcd(uint8_t val)
+{
+    return ((val / 10) << 4) | (val % 10);
+}
+
+static inline uint8_t from_bcd(uint8_t val)
+{
+    return ((val >> 4) * 10) + (val & 0x0f);
+}

The second is that you need multiple-inclusion guards here, like

#ifndef QEMU_BCD_H
#define QEMU_BCD_H 1

/* Convert a byte between binary and BCD. */
static inline uint8_t to_bcd(uint8_t val)

{
    return ((val / 10) << 4) | (val % 10);
}

static inline uint8_t from_bcd(uint8_t val)

{
    return ((val >> 4) * 10) + (val & 0x0f);
}

#endif

That said, great job, considering that even just creating qemu/bcd.h would have been enough. Instead, you went ahead and touched 140 files.
Thanks!

Paolo