]> xenbits.xensource.com Git - people/pauldu/qemu.git/commitdiff
util: move declarations out of qemu-common.h
authorVeronia Bahaa <veroniabahaa@gmail.com>
Sun, 20 Mar 2016 17:16:19 +0000 (19:16 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 22 Mar 2016 21:20:17 +0000 (22:20 +0100)
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)

Signed-off-by: Veronia Bahaa <veroniabahaa@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
149 files changed:
arch_init.c
audio/audio.c
block.c
block/archipelago.c
block/backup.c
block/blkdebug.c
block/blkverify.c
block/block-backend.c
block/curl.c
block/io.c
block/nbd.c
block/qapi.c
block/qcow2-snapshot.c
block/qcow2.c
block/qed.h
block/raw-posix.c
block/raw-win32.c
block/rbd.c
block/sheepdog.c
block/vdi.c
block/vmdk.c
block/vvfat.c
blockdev.c
bsd-user/elfload.c
bsd-user/main.c
contrib/ivshmem-server/main.c
disas/i386.c
dump.c
exec.c
gdbstub.c
hmp.c
hw/9pfs/9p-handle.c
hw/9pfs/9p-local.c
hw/9pfs/9p-proxy.c
hw/9pfs/9p-synth.c
hw/alpha/dp264.c
hw/arm/nseries.c
hw/arm/omap1.c
hw/arm/pxa2xx.c
hw/arm/strongarm.c
hw/block/nvme.h
hw/bt/hci.c
hw/core/loader.c
hw/core/machine.c
hw/cris/boot.c
hw/ide/core.c
hw/lm32/lm32_hwsetup.h
hw/lm32/milkymist.c
hw/microblaze/boot.c
hw/mips/mips_jazz.c
hw/misc/ivshmem.c
hw/misc/macio/cuda.c
hw/nvram/fw_cfg.c
hw/nvram/mac_nvram.c
hw/pci/pci.c
hw/ppc/mac_newworld.c
hw/ppc/mac_oldworld.c
hw/ppc/prep.c
hw/ppc/spapr.c
hw/ppc/spapr_drc.c
hw/ppc/spapr_events.c
hw/ppc/spapr_rtas.c
hw/ppc/spapr_rtc.c
hw/scsi/scsi-bus.c
hw/scsi/scsi-disk.c
hw/scsi/vhost-scsi.c
hw/sparc/sun4m.c
hw/sparc64/sun4u.c
hw/timer/ds1338.c
hw/timer/exynos4210_rtc.c
hw/timer/m48t59.c
hw/timer/mc146818rtc.c
hw/timer/pl031.c
hw/timer/twl92230.c
hw/usb/bus.c
hw/usb/dev-network.c
hw/usb/dev-serial.c
hw/usb/dev-storage.c
hw/watchdog/watchdog.c
hw/xen/xen-host-pci-device.c
include/qemu-common.h
include/qemu/bcd.h [new file with mode: 0644]
include/qemu/cutils.h [new file with mode: 0644]
include/qemu/help_option.h [new file with mode: 0644]
include/qemu/id.h [new file with mode: 0644]
include/qemu/path.h [new file with mode: 0644]
include/qemu/unicode.h [new file with mode: 0644]
linux-user/elfload.c
linux-user/main.c
linux-user/syscall.c
linux-user/uaccess.c
main-loop.c
migration/block.c
migration/migration.c
migration/ram.c
migration/rdma.c
migration/savevm.c
migration/xbzrle.c
monitor.c
net/net.c
net/netmap.c
net/slirp.c
net/tap-bsd.c
net/tap-linux.c
net/tap-solaris.c
net/tap.c
os-posix.c
qapi/opts-visitor.c
qdev-monitor.c
qemu-char.c
qemu-img.c
qemu-io-cmds.c
qemu-nbd.c
qga/commands-posix.c
qga/commands.c
qga/main.c
qmp.c
qobject/json-parser.c
qobject/qdict.c
qobject/qjson.c
qom/object.c
slirp/slirp.c
slirp/tftp.c
target-arm/arm-semi.c
target-i386/cpu.c
target-ppc/kvm.c
target-s390x/cpu.c
tcg/tcg.c
tests/qom-test.c
tests/tcg/linux-test.c
tests/test-cutils.c
tests/test-xbzrle.c
trace/control.c
ui/gtk.c
ui/sdl.c
ui/vnc.c
util/cutils.c
util/event_notifier-posix.c
util/id.c
util/iov.c
util/osdep.c
util/oslib-posix.c
util/oslib-win32.c
util/path.c
util/qemu-option.c
util/qemu-sockets.c
util/readline.c
util/unicode.c
vl.c

index f6aba02cb259e7260d83b39ed275b39224027f0a..e3bb1b3ac4195c5863edba54fc20e3121dd05f8f 100644 (file)
@@ -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;
index ab0ade87f8961dbf1bfbe1a6b1b92935a66c012d..e60c124de82c9370c301a23c33a076454146a327 100644 (file)
@@ -27,6 +27,7 @@
 #include "monitor/monitor.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
+#include "qemu/cutils.h"
 
 #define AUDIO_CAP "audio"
 #include "audio_int.h"
diff --git a/block.c b/block.c
index b4107fcd4c568fcc2cb2511f6ae779acc5709b06..2a09403649e89c779cae87c9986f16ca8125db9e 100644 (file)
--- a/block.c
+++ b/block.c
@@ -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>
index 0507589063f195be5c034a14665ba93dca17727d..b9f5e69d4a3ea504790fbcb6489a6e472deee987 100644 (file)
@@ -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"
index 77280c6b3583d24f062364a2c1c3599da2c35057..9170983ba912c3a413d1f432bc4e1783bcb4e8b9 100644 (file)
@@ -20,6 +20,7 @@
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/ratelimit.h"
+#include "qemu/cutils.h"
 #include "sysemu/block-backend.h"
 #include "qemu/bitmap.h"
 
index 792d36b994944b84f61d86a5a8a38ce58b7edd39..20d25bda67fb9e442903d6d9bdf51cc3daef3b0c 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/config-file.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
index 41432e556525ed56bd60ba5eba766280fa0a2d6a..9414b7a84e4f78e7676244843aa77fde23f78a92 100644 (file)
@@ -13,6 +13,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;
index dca21d1eeb6d61e29984be83157e88108f2ec63a..adf592e8676136e26657d9d148780dcd227fa3a3 100644 (file)
@@ -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
index fe331ca1f559075e8d5985cad2cabe43c6251dc6..5a8f8b6239516c4b9f03bcbe9e37e1256ab61faa 100644 (file)
@@ -30,6 +30,7 @@
 #include "qapi/qmp/qstring.h"
 #include "crypto/secret.h"
 #include <curl/curl.h>
+#include "qemu/cutils.h"
 
 // #define DEBUG_CURL
 // #define DEBUG_VERBOSE
index 041af3c71127668dcd17c0f6a691454fb9a972a0..c2611e53c86b38ceb64928424c9d19d7ee16472b 100644 (file)
@@ -28,6 +28,7 @@
 #include "block/blockjob.h"
 #include "block/block_int.h"
 #include "block/throttle-groups.h"
+#include "qemu/cutils.h"
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 
index d1038941200786d0a067cdbc9720da343e8aab78..896064a131b198d6376a4631267c4d025df708d9 100644 (file)
@@ -36,7 +36,7 @@
 #include "qapi/qmp/qjson.h"
 #include "qapi/qmp/qint.h"
 #include "qapi/qmp/qstring.h"
-
+#include "qemu/cutils.h"
 
 #define EN_OPTSTR ":exportname="
 
index 6a4869a8d94e70fff5e210bcbc150f47642dacc8..089614ee9dd9e40551c4bb5e65d59bd3fab71de2 100644 (file)
@@ -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)
 {
index 269acc2f4ef878035de42daf25eeda8274f1de61..5f4a17e473d8e52b753b2828da20618bd3e51396 100644 (file)
 
 #include "qemu/osdep.h"
 #include "qapi/error.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)
 {
index cec5bd02f274403aceb3b65ebcc4ee226e804615..642802971cc607830860d093eeee99573194f3ce 100644 (file)
@@ -22,7 +22,6 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
@@ -36,6 +35,7 @@
 #include "qapi-event.h"
 #include "trace.h"
 #include "qemu/option_int.h"
+#include "qemu/cutils.h"
 
 /*
   Differences with QCOW:
index 615e676fc87a967a851f9c06019e696873bbfe5d..22b3198751e0e280de8fa0b63d023d40530ec6bc 100644 (file)
@@ -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:
  *
index 29dc658e43ea9a1e758bbd83db9f5344f5b9e767..c8e2ec40fbfdb27eb1fdaa7e176b5f6cfe549525 100644 (file)
@@ -23,7 +23,7 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
 #include "qemu/log.h"
index bd07c93461db8d59274e2f8cbe9094e4e2a061ff..fd23891534815a59e13081b6d00ced1a66080918 100644 (file)
@@ -23,7 +23,7 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/timer.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
index 4f3fa304d525a1a462c8bd033b7cdd0b38c2e55c..5bc5b32530b8155b416b28d846e2211b06cce9f9 100644 (file)
 #include "qemu/osdep.h"
 
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "block/block_int.h"
 #include "crypto/secret.h"
+#include "qemu/cutils.h"
 
 #include <rbd/librbd.h>
 
index a6b179b11d857dda693bb5ea33473024a108a405..48fc16542294cbdb14280922ba42f5821f7f6112 100644 (file)
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "qemu/uri.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/bitops.h"
+#include "qemu/cutils.h"
 
 #define SD_PROTO_VER 0x01
 
index cdf6b85216b20003121ff0fb9cbc72b612db6171..71f417c461650a5739eee85ba8e732d3cb95aaeb 100644 (file)
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "block/block_int.h"
 #include "sysemu/block-backend.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>
index 5e341c678bc96d1a08f277ceaf3790d8472e9d5d..a1a9371bf878c1b4ea01f9d964c505606ad9985f 100644 (file)
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "block/block_int.h"
 #include "sysemu/block-backend.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>
 
index bdce8da320fa121ddbf7aafbb282570e4dd46cc5..eb1126cbadd431dd1e4754c2bac4576c14913533 100644 (file)
 #include "qemu/osdep.h"
 #include <dirent.h>
 #include "qapi/error.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"
 
 #ifndef S_IWGRP
 #define S_IWGRP 0
index 24c886142a4e393580cb39d50fc69976ef2d8443..3eb05d1a90568081eace11cb2906d3ec69014e95 100644 (file)
@@ -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);
index 0a6092bdf76565be3ab7e12762abaaa4ab94498f..898ee05472e218ad33a4a91acaf3d225c0000e3d 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "qemu.h"
 #include "disas/disas.h"
+#include "qemu/path.h"
 
 #ifdef _ARCH_PPC64
 #undef ARCH_DLINFO
index 287ec1d36953434b7ef9bb461b532b09fe6bef22..27854c1f9176731cd59408c23df128f0e555dc26 100644 (file)
@@ -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"
index 4c9a11f2c5ce2b9ccc7f6b08cd19c0460f0ad18f..533f501593cfa3d5d9ea457ea0797ac2844c41e0 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 
 #include "ivshmem-server.h"
 
index d40b72ab10140f38f9e28320aae128c4a27fcf0a..894b0a1e0f133af6e805e18d2ffd201fcd285ea3 100644 (file)
@@ -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
diff --git a/dump.c b/dump.c
index 81d2d4f5a04638a9234f5357e5df10713b2ec9a6..9726f1f477d56c8aadb9c01c872b159ac581ee18 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -12,7 +12,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "elf.h"
 #include "cpu.h"
 #include "exec/cpu-all.h"
diff --git a/exec.c b/exec.c
index 151908ebdfe3c89a8327dc786b94b340cd7f0fd0..be2a644619a1933537c5e0dad5bf6ff3ad884bfd 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -22,7 +22,7 @@
 #include <sys/mman.h>
 #endif
 
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "cpu.h"
 #include "tcg.h"
 #include "hw/hw.h"
index e4e480f66811dfb8955c12722a5ce9a7c77ab164..0e431fd4dfcd22f7a89fede84fc6f0ac1f5f0f36 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -18,9 +18,9 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
-#ifdef CONFIG_USER_ONLY
+#include "qemu/cutils.h"
 
+#ifdef CONFIG_USER_ONLY
 #include "qemu.h"
 #else
 #include "monitor/monitor.h"
diff --git a/hmp.c b/hmp.c
index 6ace227c6668f6533a80a2b9589cee3b48ec7ddd..d51023667753d2b3b97c2204196712a4f2da3089 100644 (file)
--- a/hmp.c
+++ b/hmp.c
@@ -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>
index 5088ef5dcb3d3f09af91974a1df09e8ab9740a79..894041488abb518f5de65eff4cc5317f17e0c46a 100644 (file)
@@ -20,6 +20,7 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include "qemu/xattr.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include <linux/fs.h>
 #ifdef CONFIG_LINUX_MAGIC_H
index ca995a79dba8caee735f7f8e855f541dc35b9231..16f45f4854ca3f2b00985a79a2d867747041cade 100644 (file)
@@ -21,6 +21,7 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include "qemu/xattr.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include <libgen.h>
 #include <linux/fs.h>
index 0805c9cab4132e36bb043cd5f68a0f8d7e793308..00a4eb2a7bcf5b4b4ecdf1e5fffab3dc9d6b6857 100644 (file)
@@ -13,6 +13,7 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include "9p.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "fsdev/qemu-fsdev.h"
 #include "9p-proxy.h"
index 365623e8f3ade61fa0ed64eb60e702daf2027efe..f1475dfd6def3c5f57379ce75691fd1e370f843e 100644 (file)
@@ -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 = {
index 1eee68b748e003056f61d6a1c15a42178882a87b..f1267b54419610766eeb2bbbef86fab8d91e64eb 100644 (file)
@@ -20,6 +20,7 @@
 #include "hw/ide.h"
 #include "hw/timer/i8254.h"
 #include "hw/char/serial.h"
+#include "qemu/cutils.h"
 
 #define MAX_IDE_BUS 2
 
index 4561d4a48381a2ee77006beb012f466aea775c27..53825055596ab4234379c004038e0fa5f7f505f7 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "sysemu/sysemu.h"
 #include "hw/arm/omap.h"
 #include "hw/arm/arm.h"
index 56844c30304bfe93a7bef6ed95222e12d3b10dde..b3cf0ec690d8ebb72e07827841687fd6fadb263b 100644 (file)
@@ -31,6 +31,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)
index 2076098b1d5edfab348173c241269e8b755bc82d..1a8c36033a5791847a3c642236fb0e3a1675e874 100644 (file)
@@ -20,6 +20,7 @@
 #include "sysemu/char.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
+#include "qemu/cutils.h"
 
 static struct {
     hwaddr io_base;
index 80041280e2cc21dbd44383d9daab53a5b91f5ef6..1eeb1ab391a9249c85a94d0facefd84118a582a0 100644 (file)
@@ -37,6 +37,7 @@
 #include "sysemu/char.h"
 #include "sysemu/sysemu.h"
 #include "hw/ssi/ssi.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG
 
index bf3a3ccac8d352d8321e4ca2e89062de002dce73..8fb0c10756e7c7ee53a2b0486e252e225b994591 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef HW_NVME_H
 #define HW_NVME_H
+#include "qemu/cutils.h"
 
 typedef struct NvmeBar {
     uint64_t    cap;
index 1eaa442c38c9cf68518097747b14e8d5bee144cf..7d5220509318616b0bcf355f18bf5c3eda5abd5b 100644 (file)
@@ -27,6 +27,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);
index 93410e35b53fa2b1156772702bc20cd20c6196f2..6b949fe44ffa88e28762380112bbd40efde346d2 100644 (file)
@@ -54,6 +54,7 @@
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
 #include "hw/boards.h"
+#include "qemu/cutils.h"
 
 #include <zlib.h>
 
index 136bf275bcc3732199f9cb4ca87633595fc97237..6dbbc85b97aac766da249cda5a33517fd4d12abd 100644 (file)
@@ -18,6 +18,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)
 {
index 7d423ed92f53bae1488ead873aacf298f40365bd..f896ed7f863570e71f06bbab70b72e727d2c1c4f 100644 (file)
@@ -29,6 +29,7 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "boot.h"
+#include "qemu/cutils.h"
 
 static void main_cpu_reset(void *opaque)
 {
index f8883b21100665c0353779da0c1fcb4681b22652..90524d5e1642c2e4a792af5935052b261f05b3a1 100644 (file)
@@ -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>
 
index 838754d5d83ffbfd4fe82cb638ddfcf9ee02e848..b71e6eafba48314ebabb23001c4f715488df5603 100644 (file)
@@ -26,6 +26,7 @@
 #define QEMU_HW_LM32_HWSETUP_H
 
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "hw/loader.h"
 
 typedef struct {
index 22169008bedf245e1b6aae47cf7c58ae34b2c2c1..96e6f4dc2ee86b4b266e4ee2c45c0ce7c047fead 100644 (file)
@@ -33,6 +33,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
index 7a3759d6924d20dad5e1ee139fc30f6823687640..9eebb1a521ae99500343c801169152a9d26b54a2 100644 (file)
@@ -35,6 +35,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/loader.h"
 #include "elf.h"
+#include "qemu/cutils.h"
 
 #include "boot.h"
 
index 4931cb1bf4c5d1fd609fb12b0918339ce1c029ed..ac7c641258c2991d94ecfcb88a0daa0b1a0b51f9 100644 (file)
@@ -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
 {
index 55071dc7678655d631e0c80a353cc03c046098f2..30ba1be957d57a285bc131dbec822f346671633e 100644 (file)
@@ -18,6 +18,7 @@
  */
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/cutils.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/pci/pci.h"
index 83995ccf0f07d85654ed31998fb9722b5a9e17ed..c7472aaa9d1288a2137303535052bf4b4f12783c 100644 (file)
@@ -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 */
 
index 7866248b936879b3b662e56d618194d3dd661ee4..d96932f6ca3adfd182a06374702103433489b74e 100644 (file)
@@ -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
index 1671f4686e074effa582bd1fd490a50036a69f87..24f61212bad16a834144ab2d300ad4b1999704f8 100644 (file)
@@ -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 */
index e67664deb31237327d7a4da96be90a105391c20e..bb605efae0236b506e0dc044879deca87147cdf6 100644 (file)
@@ -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
index 1086f88d832863453534673763a06f3278330cac..32e88b3786871a30e4ad192d329e233c41c0e5a6 100644 (file)
@@ -71,6 +71,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
index 9bfa02e0976eb7e2070ebff3e9da38feca25bac5..a9bb1c27df1fc31b967ea81daa055628c4f5b458 100644 (file)
@@ -45,6 +45,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
index 793b9ed34e8a2d0f1f769401b99c62a4749ab048..3ffb85e601c0425a15efb9556ef76cd6c064b3a0 100644 (file)
@@ -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
index 7e80f8ac3cdbfb8a4cbf6698326e44729839bffb..2c380c26c5865d780a864391047a084065fa58c0 100644 (file)
@@ -64,7 +64,7 @@
 #include "hw/nmi.h"
 
 #include "hw/compat.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 
 #include <libfdt.h>
 
index 96d66d658cf12df482cf9b45bdc527f801a26611..e6eedf8946a22c26cd64d7541aa0e2cea843e8e5 100644 (file)
@@ -12,8 +12,8 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "cpu.h"
+#include "qemu/cutils.h"
 #include "hw/ppc/spapr_drc.h"
 #include "qom/object.h"
 #include "hw/qdev.h"
index 61204f0b6bbf2ddc3b16632895147101a7249cf7..1abec27ec6292a38e29bbb0894d94dae70a33e0d 100644 (file)
@@ -37,7 +37,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 {
index b7c5ebde4002fe9c38f9f20ffcbfcd73b2dd620b..2db229272ec68d6c537c508455930437102d34b6 100644 (file)
@@ -39,6 +39,7 @@
 
 #include <libfdt.h>
 #include "hw/ppc/spapr_drc.h"
+#include "qemu/cutils.h"
 
 /* #define DEBUG_SPAPR */
 
index 02fa373aeeb290a5768dcfb756dea73e23ad534f..3a17ac42e44be65cd2710cc05d7513af62f4fc8e 100644 (file)
@@ -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)
index a5ad3c7ae54ecc2b86e01ef72b5e8c2d87964aee..ad6f398c329ddd83b7674d91d397f942175c529e 100644 (file)
@@ -9,6 +9,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);
index 96c7953ecfe8c30035842a8ace1e1540c639e540..c3ce54a203a8fc1c25d58e605a7561eac5453537 100644 (file)
@@ -30,7 +30,6 @@ do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "hw/scsi/scsi.h"
 #include "block/scsi.h"
@@ -39,6 +38,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>
index 97a0dd1c1d1b8b9b9ff410d699a7640c18188c77..9261d51da799b39f5988b28643fd2f29496efb26 100644 (file)
@@ -28,6 +28,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[] = {
index 30a6afcb9ce40010d56dad410220103fa3afaf6e..7bfc00abc2d6db1b52ca9ed3a592dd2e7ad372c3 100644 (file)
@@ -46,6 +46,7 @@
 #include "elf.h"
 #include "sysemu/block-backend.h"
 #include "trace.h"
+#include "qemu/cutils.h"
 
 /*
  * Sun4m architecture was used in the following machines:
index ee602805c070fa7fac9a9ff3da0c920392a3ab5f..3165e18eb7b4677ee711d88535c37e131d7946a0 100644 (file)
@@ -44,6 +44,7 @@
 #include "elf.h"
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG_IRQ
 //#define DEBUG_EBUS
index 385b7d3076311786daed3e993284cbfdf590a220..0112949e2300270b6d2743eec6a5dabcfab75189 100644 (file)
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "hw/i2c/i2c.h"
+#include "qemu/bcd.h"
 
 /* Size of NVRAM including both the user-accessible area and the
  * secondary register area.
index f21fb54f5c21428fb3d5f7bc5f90a4445eed14cd..da4dd451b9355d9ad208584c3d5a25f048b35524 100644 (file)
@@ -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"
index c4db0e64622bfd25e8bac53ceeaadb89f8ab9710..e46ca883915c62a90dc40b4f7a17abcb1804d614 100644 (file)
@@ -31,6 +31,7 @@
 #include "hw/sysbus.h"
 #include "hw/isa/isa.h"
 #include "exec/address-spaces.h"
+#include "qemu/bcd.h"
 
 //#define DEBUG_NVRAM
 
index 496a7cd8157eed43e8425ccfd8d499e47f2691e5..2ac0fd3e489a46d35cc2c5bc8e554a1e7e5d69c8 100644 (file)
@@ -23,6 +23,8 @@
  */
 #include "qemu/osdep.h"
 #include "config-target.h"
+#include "qemu/cutils.h"
+#include "qemu/bcd.h"
 #include "hw/hw.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
index bdec4785bb1302274f423c2635081abfea19ea3d..38e0cb5ad64e30c3b4ed5969de4b76933e91f749 100644 (file)
@@ -15,6 +15,7 @@
 #include "hw/sysbus.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG_PL031
 
index 1c92438b18b6094cc14e81747ef88ab394a27ab3..7ba4e9a7c989ccd05615245816b89a1afea92bb9 100644 (file)
@@ -25,6 +25,7 @@
 #include "hw/i2c/i2c.h"
 #include "sysemu/sysemu.h"
 #include "ui/console.h"
+#include "qemu/bcd.h"
 
 #define VERBOSE 1
 
index a9a6f9e56dce804838f5e271089281b97cd6a599..16c3461d99717642b6b0ab13357fc7325a1dbc56 100644 (file)
@@ -7,6 +7,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);
 
index b183cafece4fd3ffe1b1e02d034e41d7fee058bd..74306b58e302491f3df936e2965b149565e6a441 100644 (file)
@@ -34,6 +34,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.
index ff4b0c588f8e62d404f43ff4517b6e2f12203cef..ba8538e60ea110e6f802d197b29cc0ef3ded8213 100644 (file)
@@ -11,6 +11,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "hw/usb.h"
 #include "hw/usb/desc.h"
index 284024e6f499afabda959e84f5b1599572ca015c..248a580457ba28080d5407db838376e67c54468a 100644 (file)
@@ -22,6 +22,7 @@
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "qapi/visitor.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG_MSD
 
index 194c9b4ed9e62ff4dd14f490efe0aaf2596fe857..bbf3646bae9e5947ffe32b722e23436f66da6c5d 100644 (file)
@@ -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;
index 4005d6ae766d58d4cf7ad430c91909ef2bcd4975..eed8cc88e33da41dcf0780e19ef334b50a6d4664 100644 (file)
@@ -9,6 +9,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "xen-host-pci-device.h"
 
 #define XEN_HOST_PCI_MAX_EXT_CAP \
index bbb45b2e64b767d6e4028a8da8d075bb1fda8a02..163bcbb861b7026b74e272b5bfd7fdaa10117086 100644 (file)
@@ -49,205 +49,6 @@ int qemu_main(int argc, char **argv, char **envp);
 void qemu_get_timedate(struct tm *tm, int offset);
 int qemu_timedate_diff(struct tm *tm);
 
-/**
- * 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");
-}
-
-/* util/cutils.c */
-/**
- * pstrcpy:
- * @buf: buffer to copy string into
- * @buf_size: size of @buf in bytes
- * @str: string to copy
- *
- * Copy @str into @buf, including the trailing NUL, but do not
- * write more than @buf_size bytes. The resulting buffer is
- * always NUL terminated (even if the source string was too long).
- * If @buf_size is zero or negative then no bytes are copied.
- *
- * This function is similar to strncpy(), but avoids two of that
- * function's problems:
- *  * if @str fits in the buffer, pstrcpy() does not zero-fill the
- *    remaining space at the end of @buf
- *  * if @str is too long, pstrcpy() will copy the first @buf_size-1
- *    bytes and then add a NUL
- */
-void pstrcpy(char *buf, int buf_size, const char *str);
-/**
- * strpadcpy:
- * @buf: buffer to copy string into
- * @buf_size: size of @buf in bytes
- * @str: string to copy
- * @pad: character to pad the remainder of @buf with
- *
- * Copy @str into @buf (but *not* its trailing NUL!), and then pad the
- * rest of the buffer with the @pad character. If @str is too large
- * for the buffer then it is truncated, so that @buf contains the
- * first @buf_size characters of @str, with no terminator.
- */
-void strpadcpy(char *buf, int buf_size, const char *str, char pad);
-/**
- * pstrcat:
- * @buf: buffer containing existing string
- * @buf_size: size of @buf in bytes
- * @s: string to concatenate to @buf
- *
- * Append a copy of @s to the string already in @buf, but do not
- * allow the buffer to overflow. If the existing contents of @buf
- * plus @str would total more than @buf_size bytes, then write
- * as much of @str as will fit followed by a NUL terminator.
- *
- * @buf must already contain a NUL-terminated string, or the
- * behaviour is undefined.
- *
- * Returns: @buf.
- */
-char *pstrcat(char *buf, int buf_size, const char *s);
-/**
- * strstart:
- * @str: string to test
- * @val: prefix string to look for
- * @ptr: NULL, or pointer to be written to indicate start of
- *       the remainder of the string
- *
- * Test whether @str starts with the prefix @val.
- * If it does (including the degenerate case where @str and @val
- * are equal) then return true. If @ptr is not NULL then a
- * pointer to the first character following the prefix is written
- * to it. If @val is not a prefix of @str then return false (and
- * @ptr is not written to).
- *
- * Returns: true if @str starts with prefix @val, false otherwise.
- */
-int strstart(const char *str, const char *val, const char **ptr);
-/**
- * stristart:
- * @str: string to test
- * @val: prefix string to look for
- * @ptr: NULL, or pointer to be written to indicate start of
- *       the remainder of the string
- *
- * Test whether @str starts with the case-insensitive prefix @val.
- * This function behaves identically to strstart(), except that the
- * comparison is made after calling qemu_toupper() on each pair of
- * characters.
- *
- * Returns: true if @str starts with case-insensitive prefix @val,
- *          false otherwise.
- */
-int stristart(const char *str, const char *val, const char **ptr);
-/**
- * qemu_strnlen:
- * @s: string
- * @max_len: maximum number of bytes in @s to scan
- *
- * Return the length of the string @s, like strlen(), but do not
- * examine more than @max_len bytes of the memory pointed to by @s.
- * If no NUL terminator is found within @max_len bytes, then return
- * @max_len instead.
- *
- * This function has the same behaviour as the POSIX strnlen()
- * function.
- *
- * Returns: length of @s in bytes, or @max_len, whichever is smaller.
- */
-int qemu_strnlen(const char *s, int max_len);
-/**
- * qemu_strsep:
- * @input: pointer to string to parse
- * @delim: string containing delimiter characters to search for
- *
- * Locate the first occurrence of any character in @delim within
- * the string referenced by @input, and replace it with a NUL.
- * The location of the next character after the delimiter character
- * is stored into @input.
- * If the end of the string was reached without finding a delimiter
- * character, then NULL is stored into @input.
- * If @input points to a NULL pointer on entry, return NULL.
- * The return value is always the original value of *@input (and
- * so now points to a NUL-terminated string corresponding to the
- * part of the input up to the first delimiter).
- *
- * This function has the same behaviour as the BSD strsep() function.
- *
- * Returns: the pointer originally in @input.
- */
-char *qemu_strsep(char **input, const char *delim);
-time_t mktimegm(struct tm *tm);
-int qemu_fdatasync(int fd);
-int fcntl_setfl(int fd, int flag);
-int qemu_parse_fd(const char *param);
-int qemu_strtol(const char *nptr, const char **endptr, int base,
-                long *result);
-int qemu_strtoul(const char *nptr, const char **endptr, int base,
-                 unsigned long *result);
-int qemu_strtoll(const char *nptr, const char **endptr, int base,
-                 int64_t *result);
-int qemu_strtoull(const char *nptr, const char **endptr, int base,
-                  uint64_t *result);
-
-int parse_uint(const char *s, unsigned long long *value, char **endptr,
-               int base);
-int parse_uint_full(const char *s, unsigned long long *value, int base);
-
-/*
- * qemu_strtosz() suffixes used to specify the default treatment of an
- * argument passed to qemu_strtosz() without an explicit suffix.
- * These should be defined using upper case characters in the range
- * A-Z, as qemu_strtosz() will use qemu_toupper() on the given argument
- * prior to comparison.
- */
-#define QEMU_STRTOSZ_DEFSUFFIX_EB 'E'
-#define QEMU_STRTOSZ_DEFSUFFIX_PB 'P'
-#define QEMU_STRTOSZ_DEFSUFFIX_TB 'T'
-#define QEMU_STRTOSZ_DEFSUFFIX_GB 'G'
-#define QEMU_STRTOSZ_DEFSUFFIX_MB 'M'
-#define QEMU_STRTOSZ_DEFSUFFIX_KB 'K'
-#define QEMU_STRTOSZ_DEFSUFFIX_B 'B'
-int64_t qemu_strtosz(const char *nptr, char **end);
-int64_t qemu_strtosz_suffix(const char *nptr, char **end,
-                            const char default_suffix);
-int64_t qemu_strtosz_suffix_unit(const char *nptr, char **end,
-                            const char default_suffix, int64_t unit);
-#define K_BYTE     (1ULL << 10)
-#define M_BYTE     (1ULL << 20)
-#define G_BYTE     (1ULL << 30)
-#define T_BYTE     (1ULL << 40)
-#define P_BYTE     (1ULL << 50)
-#define E_BYTE     (1ULL << 60)
-
-/* used to print char* safely */
-#define STR_OR_NULL(str) ((str) ? (str) : "null")
-
-/* id.c */
-
-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);
-
-/* path.c */
-void init_paths(const char *prefix);
-const char *path(const char *pathname);
-
 #define qemu_isalnum(c)                isalnum((unsigned char)(c))
 #define qemu_isalpha(c)                isalpha((unsigned char)(c))
 #define qemu_iscntrl(c)                iscntrl((unsigned char)(c))
@@ -335,8 +136,6 @@ ssize_t qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send);
 #define qemu_co_send(sockfd, buf, bytes) \
   qemu_co_send_recv(sockfd, buf, bytes, true)
 
-bool buffer_is_zero(const void *buf, size_t len);
-
 void qemu_progress_init(int enabled, float min_skip);
 void qemu_progress_end(void);
 void qemu_progress_print(float delta, int max);
@@ -351,70 +150,14 @@ void os_setup_early_signal_handling(void);
 char *os_find_datadir(void);
 void os_parse_cmd_args(int index, const char *optarg);
 
-/* 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/module.h"
 
-/*
- * Implementation of ULEB128 (http://en.wikipedia.org/wiki/LEB128)
- * Input is limited to 14-bit numbers
- */
-
-int uleb128_encode_small(uint8_t *out, uint32_t n);
-int uleb128_decode_small(const uint8_t *in, uint32_t *n);
-
-/* 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>
-/* The altivec.h header says we're allowed to undef these for
- * C++ compatibility.  Here we don't care about C++, but we
- * undef them anyway to avoid namespace pollution.
- */
-#undef vector
-#undef pixel
-#undef bool
-#define VECTYPE        __vector unsigned char
-#define SPLAT(p)       vec_splat(vec_ld(0, p), 0)
-#define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
-#define VEC_OR(v1, v2) ((v1) | (v2))
-/* altivec.h may redefine the bool macro as vector type.
- * Reset it to POSIX semantics. */
-#define bool _Bool
-#elif defined __SSE2__
-#include <emmintrin.h>
-#define VECTYPE        __m128i
-#define SPLAT(p)       _mm_set1_epi8(*(p))
-#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF)
-#define VEC_OR(v1, v2) (_mm_or_si128(v1, v2))
-#else
-#define VECTYPE        unsigned long
-#define SPLAT(p)       (*(p) * (~0UL / 255))
-#define ALL_EQ(v1, v2) ((v1) == (v2))
-#define VEC_OR(v1, v2) ((v1) | (v2))
-#endif
-
-#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8
-bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len);
-size_t buffer_find_nonzero_offset(const void *buf, size_t len);
-
 /*
  * helper to parse debug environment variables
  */
diff --git a/include/qemu/bcd.h b/include/qemu/bcd.h
new file mode 100644 (file)
index 0000000..b4c9b64
--- /dev/null
@@ -0,0 +1,15 @@
+#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
diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
new file mode 100644 (file)
index 0000000..db7adad
--- /dev/null
@@ -0,0 +1,183 @@
+#ifndef QEMU_CUTILS_H
+#define QEMU_CUTILS_H 1
+
+#include "qemu/fprintf-fn.h"
+
+/**
+ * pstrcpy:
+ * @buf: buffer to copy string into
+ * @buf_size: size of @buf in bytes
+ * @str: string to copy
+ *
+ * Copy @str into @buf, including the trailing NUL, but do not
+ * write more than @buf_size bytes. The resulting buffer is
+ * always NUL terminated (even if the source string was too long).
+ * If @buf_size is zero or negative then no bytes are copied.
+ *
+ * This function is similar to strncpy(), but avoids two of that
+ * function's problems:
+ *  * if @str fits in the buffer, pstrcpy() does not zero-fill the
+ *    remaining space at the end of @buf
+ *  * if @str is too long, pstrcpy() will copy the first @buf_size-1
+ *    bytes and then add a NUL
+ */
+void pstrcpy(char *buf, int buf_size, const char *str);
+/**
+ * strpadcpy:
+ * @buf: buffer to copy string into
+ * @buf_size: size of @buf in bytes
+ * @str: string to copy
+ * @pad: character to pad the remainder of @buf with
+ *
+ * Copy @str into @buf (but *not* its trailing NUL!), and then pad the
+ * rest of the buffer with the @pad character. If @str is too large
+ * for the buffer then it is truncated, so that @buf contains the
+ * first @buf_size characters of @str, with no terminator.
+ */
+void strpadcpy(char *buf, int buf_size, const char *str, char pad);
+/**
+ * pstrcat:
+ * @buf: buffer containing existing string
+ * @buf_size: size of @buf in bytes
+ * @s: string to concatenate to @buf
+ *
+ * Append a copy of @s to the string already in @buf, but do not
+ * allow the buffer to overflow. If the existing contents of @buf
+ * plus @str would total more than @buf_size bytes, then write
+ * as much of @str as will fit followed by a NUL terminator.
+ *
+ * @buf must already contain a NUL-terminated string, or the
+ * behaviour is undefined.
+ *
+ * Returns: @buf.
+ */
+char *pstrcat(char *buf, int buf_size, const char *s);
+/**
+ * strstart:
+ * @str: string to test
+ * @val: prefix string to look for
+ * @ptr: NULL, or pointer to be written to indicate start of
+ *       the remainder of the string
+ *
+ * Test whether @str starts with the prefix @val.
+ * If it does (including the degenerate case where @str and @val
+ * are equal) then return true. If @ptr is not NULL then a
+ * pointer to the first character following the prefix is written
+ * to it. If @val is not a prefix of @str then return false (and
+ * @ptr is not written to).
+ *
+ * Returns: true if @str starts with prefix @val, false otherwise.
+ */
+int strstart(const char *str, const char *val, const char **ptr);
+/**
+ * stristart:
+ * @str: string to test
+ * @val: prefix string to look for
+ * @ptr: NULL, or pointer to be written to indicate start of
+ *       the remainder of the string
+ *
+ * Test whether @str starts with the case-insensitive prefix @val.
+ * This function behaves identically to strstart(), except that the
+ * comparison is made after calling qemu_toupper() on each pair of
+ * characters.
+ *
+ * Returns: true if @str starts with case-insensitive prefix @val,
+ *          false otherwise.
+ */
+int stristart(const char *str, const char *val, const char **ptr);
+/**
+ * qemu_strnlen:
+ * @s: string
+ * @max_len: maximum number of bytes in @s to scan
+ *
+ * Return the length of the string @s, like strlen(), but do not
+ * examine more than @max_len bytes of the memory pointed to by @s.
+ * If no NUL terminator is found within @max_len bytes, then return
+ * @max_len instead.
+ *
+ * This function has the same behaviour as the POSIX strnlen()
+ * function.
+ *
+ * Returns: length of @s in bytes, or @max_len, whichever is smaller.
+ */
+int qemu_strnlen(const char *s, int max_len);
+/**
+ * qemu_strsep:
+ * @input: pointer to string to parse
+ * @delim: string containing delimiter characters to search for
+ *
+ * Locate the first occurrence of any character in @delim within
+ * the string referenced by @input, and replace it with a NUL.
+ * The location of the next character after the delimiter character
+ * is stored into @input.
+ * If the end of the string was reached without finding a delimiter
+ * character, then NULL is stored into @input.
+ * If @input points to a NULL pointer on entry, return NULL.
+ * The return value is always the original value of *@input (and
+ * so now points to a NUL-terminated string corresponding to the
+ * part of the input up to the first delimiter).
+ *
+ * This function has the same behaviour as the BSD strsep() function.
+ *
+ * Returns: the pointer originally in @input.
+ */
+char *qemu_strsep(char **input, const char *delim);
+time_t mktimegm(struct tm *tm);
+int qemu_fdatasync(int fd);
+int fcntl_setfl(int fd, int flag);
+int qemu_parse_fd(const char *param);
+int qemu_strtol(const char *nptr, const char **endptr, int base,
+                long *result);
+int qemu_strtoul(const char *nptr, const char **endptr, int base,
+                 unsigned long *result);
+int qemu_strtoll(const char *nptr, const char **endptr, int base,
+                 int64_t *result);
+int qemu_strtoull(const char *nptr, const char **endptr, int base,
+                  uint64_t *result);
+
+int parse_uint(const char *s, unsigned long long *value, char **endptr,
+               int base);
+int parse_uint_full(const char *s, unsigned long long *value, int base);
+
+/*
+ * qemu_strtosz() suffixes used to specify the default treatment of an
+ * argument passed to qemu_strtosz() without an explicit suffix.
+ * These should be defined using upper case characters in the range
+ * A-Z, as qemu_strtosz() will use qemu_toupper() on the given argument
+ * prior to comparison.
+ */
+#define QEMU_STRTOSZ_DEFSUFFIX_EB 'E'
+#define QEMU_STRTOSZ_DEFSUFFIX_PB 'P'
+#define QEMU_STRTOSZ_DEFSUFFIX_TB 'T'
+#define QEMU_STRTOSZ_DEFSUFFIX_GB 'G'
+#define QEMU_STRTOSZ_DEFSUFFIX_MB 'M'
+#define QEMU_STRTOSZ_DEFSUFFIX_KB 'K'
+#define QEMU_STRTOSZ_DEFSUFFIX_B 'B'
+int64_t qemu_strtosz(const char *nptr, char **end);
+int64_t qemu_strtosz_suffix(const char *nptr, char **end,
+                            const char default_suffix);
+int64_t qemu_strtosz_suffix_unit(const char *nptr, char **end,
+                            const char default_suffix, int64_t unit);
+#define K_BYTE     (1ULL << 10)
+#define M_BYTE     (1ULL << 20)
+#define G_BYTE     (1ULL << 30)
+#define T_BYTE     (1ULL << 40)
+#define P_BYTE     (1ULL << 50)
+#define E_BYTE     (1ULL << 60)
+
+/* used to print char* safely */
+#define STR_OR_NULL(str) ((str) ? (str) : "null")
+
+bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len);
+size_t buffer_find_nonzero_offset(const void *buf, size_t len);
+bool buffer_is_zero(const void *buf, size_t len);
+
+/*
+ * Implementation of ULEB128 (http://en.wikipedia.org/wiki/LEB128)
+ * Input is limited to 14-bit numbers
+ */
+
+int uleb128_encode_small(uint8_t *out, uint32_t n);
+int uleb128_decode_small(const uint8_t *in, uint32_t *n);
+
+#endif
diff --git a/include/qemu/help_option.h b/include/qemu/help_option.h
new file mode 100644 (file)
index 0000000..e39a66e
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef QEMU_HELP_OPTION_H
+#define QEMU_HELP_OPTION_H 1
+
+/**
+ * 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");
+}
+
+#endif
diff --git a/include/qemu/id.h b/include/qemu/id.h
new file mode 100644 (file)
index 0000000..7d90335
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef QEMU_ID_H
+#define QEMU_ID_H 1
+
+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);
+
+#endif
diff --git a/include/qemu/path.h b/include/qemu/path.h
new file mode 100644 (file)
index 0000000..ed5fee0
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef QEMU_PATH_H
+#define QEMU_PATH_H 1
+
+void init_paths(const char *prefix);
+const char *path(const char *pathname);
+
+#endif
diff --git a/include/qemu/unicode.h b/include/qemu/unicode.h
new file mode 100644 (file)
index 0000000..d873165
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef QEMU_UNICODE_H
+#define QEMU_UNICODE_H 1
+
+int mod_utf8_codepoint(const char *s, size_t n, char **end);
+
+#endif
index 19dc7f5457d43829dd7ac1d3141324ee557ecc51..e47caff7aec7c55e54cf2cc663e4bbd3d06bc842 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "qemu.h"
 #include "disas/disas.h"
+#include "qemu/path.h"
 
 #ifdef _ARCH_PPC64
 #undef ARCH_DLINFO
index 2b1e7552da91f69b3ed8374251d5dc731c6f5a44..b432bf2b1ed5e3dc1da787fb82903fa050ef1b56 100644 (file)
@@ -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"
index 951753143c97c86c6bc95f8af7a9f2c03e05b26a..032d33886903d1913b40410f97818d55068552f1 100644 (file)
@@ -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>
index 75d890dfef74a748a17a1f1f88a14703db87b470..0a5c0b0b29727995acdf8a984277c6f97d303af4 100644 (file)
@@ -1,5 +1,6 @@
 /* User memory access */
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
 
 #include "qemu.h"
 
index 9598c5f4c722d3348c482c9f2e8b736b7cec5d5f..89a699419f4da2020b5f114af1753bd9003e1598 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.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"
index af8e16dfc7abb6eb93a109d8ed8a3d1d67b7e4a8..1743317288af55a22a537ac95c9176e9d38ba202 100644 (file)
@@ -20,6 +20,7 @@
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 #include "hw/hw.h"
+#include "qemu/cutils.h"
 #include "qemu/queue.h"
 #include "qemu/timer.h"
 #include "migration/block.h"
index 034a918d326e231c117855a7ac79dd9927b49361..991313a8629a9fbff7785ba35535e2a7535fa597 100644 (file)
@@ -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"
index 704f6a95bf12c3587b8dba9dfffe7bbe66f529d9..3f057388cb03bc32e74643873d2ebb0a8c338fd4 100644 (file)
@@ -28,6 +28,7 @@
 #include "qemu/osdep.h"
 #include <zlib.h>
 #include "qapi-event.h"
+#include "qemu/cutils.h"
 #include "qemu/bitops.h"
 #include "qemu/bitmap.h"
 #include "qemu/timer.h"
index 0601d528bcc0a3b71f44367676e0cbb4c9124d35..f6a9992b3e3d1b5416289356861de335539234cb 100644 (file)
@@ -14,6 +14,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "exec/cpu-common.h"
index 0a33c227c569fe7ccd6a58c8ba16e4fc063d111b..16ba44379870d48342e7693406d8f3929cfc8699 100644 (file)
@@ -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
index 4db3f6c5cc69799766de74716f2b7ab4afcb4ee1..c858339259fbc5be710d0c3682f37037023e47a7 100644 (file)
@@ -11,7 +11,7 @@
  *
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "include/migration/migration.h"
 
 /*
index 3533602c236c5dabb7cdbef3900684286b493e2d..955ed3530324dc4b16969b819cbe149ae9c97ab1 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -78,6 +78,7 @@
 #include "qmp-introspect.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/qtest.h"
+#include "qemu/cutils.h"
 
 /* for hmp_info_irq/pic */
 #if defined(TARGET_SPARC)
index 1a78edf751646b45fe8721a8961d490aac2a8b7d..3b5a14298c5424416e93f10ec2f8936f486955e6 100644 (file)
--- a/net/net.c
+++ b/net/net.c
 
 #include "monitor/monitor.h"
 #include "qemu-common.h"
+#include "qemu/help_option.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
+#include "qemu/cutils.h"
 #include "qemu/config-file.h"
 #include "qmp-commands.h"
 #include "hw/qdev.h"
index 6fa2c418a58af88c6db92c8f5b2ea409c3438ab1..d9c21b2b8630c338c07eb053e5408d640ed3f8fa 100644 (file)
@@ -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;
index 95239bceb0fa7ac7c87387e9afbc4a0732b3f8b9..0bcef226e229be855d27bfda01ec0be738367b31 100644 (file)
@@ -38,6 +38,7 @@
 #include "slirp/libslirp.h"
 #include "slirp/ip6.h"
 #include "sysemu/char.h"
+#include "qemu/cutils.h"
 
 static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
 {
index 33642ae518f1e2805d0e9a41abc51e1595f05621..c506ac31d6689e0d7b5645e73f386d785192343f 100644 (file)
@@ -25,7 +25,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "tap_int.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "sysemu/sysemu.h"
 #include "qemu/error-report.h"
 
index 8077d2b5759b2339a94254bd92597fdaf0fe2025..a503fa9c6eebd21db04b0f68f98417ded98ede49 100644 (file)
@@ -33,8 +33,8 @@
 
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "qemu/error-report.h"
+#include "qemu/cutils.h"
 
 #define PATH_NET_TUN "/dev/net/tun"
 
index 26d204292213466c13deb4672811508930ec7d27..a2a92356c1a017ae0270e4d4ee8c8b665969c788 100644 (file)
@@ -26,6 +26,7 @@
 #include "qapi/error.h"
 #include "tap_int.h"
 #include "sysemu/sysemu.h"
+#include "qemu/cutils.h"
 
 #include <sys/ethernet.h>
 #include <sys/sockio.h>
index 3ddf9ecd7d5e7cb6b87bf1958f94501818dbef62..740e8a26138cc4cf66a31de38304f620fd6ad38c 100644 (file)
--- a/net/tap.c
+++ b/net/tap.c
@@ -38,6 +38,7 @@
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/error-report.h"
 
 #include "net/tap.h"
index 92fa3baa1a5b7090ef35a77be9028bc49ffe6b09..107fde38bfddfab87aaa98a315d89e4c5fecb0dc 100644 (file)
@@ -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>
index 5e2b8832a820971b99ffc2398d6ca27ee077b168..602f2609cc46c1622e34eef0403bfddd57333f13 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/opts-visitor.h"
 #include "qemu/queue.h"
index be6a07ee4996f09c916282afc5e82058286f1be4..e19617fa8b33c9eb200037734a8504993d1693c7 100644 (file)
@@ -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
index f90e4c1208aa9dcb7bafc2d1539de6d5b022599b..97aaaae4390612a51e4f1bd1412765092de56958 100644 (file)
@@ -23,6 +23,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/block-backend.h"
index 8b54d0548697b810931becfca00da06a38a78f2f..bd93d0a774d534241983147a56cefcc1e1d6be0e 100644 (file)
@@ -27,7 +27,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"
index 13fbb5944c330a16a7c00f2f947465a097a2e9b5..139f7ebcbbd55f08ea802756642f0fd9bb8e223b 100644 (file)
@@ -19,6 +19,7 @@
 #include "qemu/main-loop.h"
 #include "qemu/timer.h"
 #include "sysemu/block-backend.h"
+#include "qemu/cutils.h"
 
 #define CMD_NOFILE_OK   0x01
 
index 2963c56df77ce852f8f9826c7370f79174c95004..9bb9cb7f61829cd2c40fcf5107a0a7b93455e7e5 100644 (file)
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "sysemu/block-backend.h"
 #include "block/block_int.h"
 #include "block/nbd.h"
index 9f51faea802f0fd92f38ee87c5955313b1dd4ea2..2ae37255d45031c343eb8835bb3d1eb7536e0d17 100644 (file)
@@ -23,6 +23,7 @@
 #include "qemu/host-utils.h"
 #include "qemu/sockets.h"
 #include "qemu/base64.h"
+#include "qemu/cutils.h"
 
 #ifndef CONFIG_HAS_ENVIRON
 #ifdef __APPLE__
index e091ee1af1d5203c6e8e2c749987e6e23eea7bbf..95d8b04a163bf378cbc1cdfef2b6f109c45a576f 100644 (file)
@@ -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)
index fb2f6638ba41d9f743120910314ac4ca6047abfe..f1cbd2a74c0d362d1d12fd0cc684927f45493f92 100644 (file)
@@ -28,6 +28,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"
diff --git a/qmp.c b/qmp.c
index 3f16a77b444bdd318dbe21af0efe67e9cf9b9e63..9d0953bc294f8d7de030f421f12b840da187ac9d 100644 (file)
--- a/qmp.c
+++ b/qmp.c
@@ -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"
index 6e65b8226404d978163275e90216f0f5a32fa3de..67ed727318df6fb893eb79a68d9249c6f653599e 100644 (file)
@@ -12,7 +12,6 @@
  */
 
 #include "qemu/osdep.h"
-
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "qapi/qmp/qstring.h"
index 9833bd0730b201e475e94ac9689e0bf3c44e3366..a1285361c444ae21e825ac05cfe435a161804a1b 100644 (file)
@@ -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
index 06dc210cbf796735600a84853879243f5707fc9c..ef160d2119eb18aa917b71b40e37d54880b1ac7f 100644 (file)
@@ -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
 {
index 6a1f03019b87f69846183725536920a20e9ab925..8e6e68dffc5fd7ac424557c4075309a395c40de2 100644 (file)
@@ -14,7 +14,7 @@
 #include "qapi/error.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"
index 9ccf4157d882a336ac520c45541f4a9f1d10ded9..3481fcc94bda513da388dbe57058c9f7e4787ac7 100644 (file)
@@ -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;
index 25ad6efdf82779c8456a159ee2a865ec5ebf6eba..12b5ff6e2595f1bd44a2f402ad0b872952207117 100644 (file)
@@ -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)
 {
index 76c33b97e7f8bd482e49b5f89c4fb6148d283c7c..8be0645eb08bdb3a27e11d9da668fe23f25649ac 100644 (file)
@@ -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
index 3ea6b294a45a46099ff1d679388f26764b31ee07..eee00d6bbde02075c9712dbc4ae66947670882ec 100644 (file)
@@ -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"
index 40ec6fded29a7d111a45f119872f77bf5c223903..159ec69790cbc7d579ef323aee3b7b55ffd63cd0 100644 (file)
@@ -42,6 +42,7 @@
 #include "exec/gdbstub.h"
 #include "exec/memattrs.h"
 #include "sysemu/hostmem.h"
+#include "qemu/cutils.h"
 
 //#define DEBUG_KVM
 
index 9746b1ddfef0b9316ffcd6dec20591767714ddaa..4bfff341dc3702abbe5992349338a6621be4eb79 100644 (file)
@@ -27,6 +27,7 @@
 #include "qapi/error.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"
index 550671b94dbc7f31863a25654f99fb4b514879ec..4c8c2d2991a4167b766c83ce8ca32b6d096023db 100644 (file)
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -36,7 +36,7 @@
 #define NDEBUG
 #endif
 
-#include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/host-utils.h"
 #include "qemu/timer.h"
 
index 3c6cfca78856ae30a729a29961e604cd9bd422f6..bd5cdde261e86eea137f1323b1ebc96fc3aff745 100644 (file)
@@ -11,6 +11,7 @@
 #include <glib.h>
 
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "libqtest.h"
 #include "qapi/qmp/types.h"
 
index 1c6c01318ecf95a16070671baf66a772f9fb11a2..5070d31446ab5c33df0cb61720b58f6b710fc257 100644 (file)
@@ -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
index 398700df45ab6edeb2bf2a559db177931ec41ffa..fb8f5b5321a7e847e382ab95df4770a18b3ab259 100644 (file)
@@ -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)
 {
index abd309d4181143faa690ab649c6f02b7d3de095f..49f64195a6fe1a4aaf784a162e72b770db991f8b 100644 (file)
@@ -12,6 +12,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "include/migration/migration.h"
 
 #define PAGE_SIZE 4096
index 20d3370bf86a766352ed1cc995640f6550c252ca..ccddda537ffbf5a1372be4c3e5125f462934b148 100644 (file)
@@ -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
index 38ef3fdb42dc1b13b094479cd60e427baceff443..f372a6d5ae25a10c5014e96ddf3544f08361a9ad 100644 (file)
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -36,6 +36,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 
 #include "ui/console.h"
 #include "ui/gtk.h"
index abeef3309593eafd27c2783b963f7f799e1539a4..d8cf5bcf740317a5675bbb4b09fe463af3e0c27c 100644 (file)
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -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"
index 6d39ddd3f949fd132976b42c6f7a5c5ceec52992..d2ebf1fb71cc8f1ec154e3f0cf22a46522e42da5 100644 (file)
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -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
index c3dd53453a0760871aea42f56eb62a52a63ee469..43d1afbbecb599b3f8112aa7a32f2ccc365db0d6 100644 (file)
@@ -29,6 +29,7 @@
 #include "qemu/sockets.h"
 #include "qemu/iov.h"
 #include "net/net.h"
+#include "qemu/cutils.h"
 
 void strpadcpy(char *buf, int buf_size, const char *str, char pad)
 {
@@ -160,6 +161,38 @@ int qemu_fdatasync(int fd)
 #endif
 }
 
+/* vector definitions */
+#ifdef __ALTIVEC__
+#include <altivec.h>
+/* The altivec.h header says we're allowed to undef these for
+ * C++ compatibility.  Here we don't care about C++, but we
+ * undef them anyway to avoid namespace pollution.
+ */
+#undef vector
+#undef pixel
+#undef bool
+#define VECTYPE        __vector unsigned char
+#define SPLAT(p)       vec_splat(vec_ld(0, p), 0)
+#define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
+#define VEC_OR(v1, v2) ((v1) | (v2))
+/* altivec.h may redefine the bool macro as vector type.
+ * Reset it to POSIX semantics. */
+#define bool _Bool
+#elif defined __SSE2__
+#include <emmintrin.h>
+#define VECTYPE        __m128i
+#define SPLAT(p)       _mm_set1_epi8(*(p))
+#define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF)
+#define VEC_OR(v1, v2) (_mm_or_si128(v1, v2))
+#else
+#define VECTYPE        unsigned long
+#define SPLAT(p)       (*(p) * (~0UL / 255))
+#define ALL_EQ(v1, v2) ((v1) == (v2))
+#define VEC_OR(v1, v2) ((v1) | (v2))
+#endif
+
+#define BUFFER_FIND_NONZERO_OFFSET_UNROLL_FACTOR 8
+
 static bool
 can_use_buffer_find_nonzero_offset_inner(const void *buf, size_t len)
 {
index 2e30e74bd63f800dbd520b37cbf64d1ca016d08f..b00189a754a48f5289033f990071ca21fda63500 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/event_notifier.h"
 #include "sysemu/char.h"
 #include "qemu/main-loop.h"
index bbbadcc7841cac091c59d39f1e5c69fdba1dec9b..614135295536be17fac07ab2e487705de8ffa0bb 100644 (file)
--- a/util/id.c
+++ b/util/id.c
@@ -12,6 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/id.h"
 
 bool id_wellformed(const char *id)
 {
index b69e4b7534b396c26b69be16f0c7b7a22269313b..003fcce66f21c5028de0a2cf028981effefe4e37 100644 (file)
@@ -20,6 +20,7 @@
 #include "qemu-common.h"
 #include "qemu/iov.h"
 #include "qemu/sockets.h"
+#include "qemu/cutils.h"
 
 size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt,
                          size_t offset, const void *buf, size_t bytes)
index 8356bdd3d842588e6997fef48c7299d51df8ba5d..d56d0711116762ad0142d30180baea82851dec20 100644 (file)
@@ -37,6 +37,7 @@ extern int madvise(caddr_t, size_t, int);
 #endif
 
 #include "qemu-common.h"
+#include "qemu/cutils.h"
 #include "qemu/sockets.h"
 #include "qemu/error-report.h"
 #include "monitor/monitor.h"
index dcc3c7ea01e53f5032f83bf71f302d3a046f26ac..09082564c433ed25d5321d6f7a98dd7d5928969f 100644 (file)
@@ -52,6 +52,7 @@
 #include <libgen.h>
 #include <setjmp.h>
 #include <sys/signal.h>
+#include "qemu/cutils.h"
 
 #ifdef CONFIG_LINUX
 #include <sys/syscall.h>
index 4ef4a9a13bf0a890982efa66ff43087a262bd28b..c926db4a5c44b4df5d8a6e99d155ce41bc547c65 100644 (file)
@@ -37,6 +37,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>
index d09e8c5e142582aab7004d8e175d4065d73fd3c5..5479f76c6d831c0eb28b23952c5e5d7a0fd26135 100644 (file)
@@ -7,6 +7,8 @@
 #include <sys/param.h>
 #include <dirent.h>
 #include "qemu-common.h"
+#include "qemu/cutils.h"
+#include "qemu/path.h"
 
 struct pathelem
 {
index 98967ffde92c3ee7f5e201ff8877e4e8c4b50d82..dd9e73df54d47ad2ab9800710ebe832d489538e9 100644 (file)
@@ -31,6 +31,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
index 6f344d4405a83eec378f9201f39225f6aa3c2b9a..b87e17fa56e490bb7389c7272afe78d105a439dd 100644 (file)
@@ -24,6 +24,7 @@
 #include "qapi/qmp-input-visitor.h"
 #include "qapi/qmp-output-visitor.h"
 #include "qapi-visit.h"
+#include "qemu/cutils.h"
 
 #ifndef AI_ADDRCONFIG
 # define AI_ADDRCONFIG 0
index e94c97521b51c9776d8ac95010ae1c7fdc22a86d..bbdee790b02517cbf6008ca2c0006c016c2ce896 100644 (file)
@@ -25,6 +25,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/readline.h"
+#include "qemu/cutils.h"
 
 #define IS_NORM 0
 #define IS_ESC  1
index 524dca8c7c4f1ea92857fc5005a865d83d0892c0..a812a351710b51960bbda234c22d25abf967f8d8 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/unicode.h"
 
 /**
  * mod_utf8_codepoint:
diff --git a/vl.c b/vl.c
index 40ed4d0cb9c05491869a3584366a7adc0123aacd..6566da22d3a4c76c1614730c04db57343c81dec8 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -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"