@@ -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;
@@ -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"
@@ -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>
@@ -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"
@@ -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"
@@ -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;
@@ -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
@@ -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
@@ -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="
@@ -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)
{
@@ -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)
{
@@ -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:
@@ -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:
*
@@ -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"
@@ -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"
@@ -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>
@@ -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
@@ -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>
@@ -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>
@@ -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
@@ -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);
@@ -5,6 +5,7 @@
#include "qemu.h"
#include "disas/disas.h"
+#include "qemu/path.h"
#ifdef _ARCH_PPC64
#undef ARCH_DLINFO
@@ -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"
@@ -7,7 +7,7 @@
*/
#include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
#include "ivshmem-server.h"
@@ -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
@@ -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"
@@ -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"
@@ -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"
@@ -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>
@@ -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;
@@ -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 = {
@@ -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
@@ -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"
@@ -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)
@@ -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;
@@ -36,6 +36,7 @@
#include "sysemu/char.h"
#include "sysemu/sysemu.h"
#include "hw/ssi/ssi.h"
+#include "qemu/cutils.h"
//#define DEBUG
@@ -1,5 +1,6 @@
#ifndef HW_NVME_H
#define HW_NVME_H
+#include "qemu/cutils.h"
typedef struct NvmeBar {
uint64_t cap;
@@ -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);
@@ -53,6 +53,7 @@
#include "exec/memory.h"
#include "exec/address-spaces.h"
#include "hw/boards.h"
+#include "qemu/cutils.h"
#include <zlib.h>
@@ -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)
{
@@ -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)
@@ -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;
@@ -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)
{
@@ -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
@@ -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>
@@ -26,6 +26,7 @@
#define QEMU_HW_LM32_HWSETUP_H
#include "qemu-common.h"
+#include "qemu/cutils.h"
#include "hw/loader.h"
typedef struct {
@@ -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
@@ -33,6 +33,7 @@
#include "sysemu/sysemu.h"
#include "hw/loader.h"
#include "elf.h"
+#include "qemu/cutils.h"
#include "boot.h"
@@ -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
{
@@ -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"
@@ -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 */
@@ -33,6 +33,7 @@
#include "hw/ptimer.h"
#include "etsec.h"
#include "registers.h"
+#include "qemu/unicode.h"
/* #define HEX_DUMP */
/* #define DEBUG_REGISTER */
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
#include "net/checksum.h"
+#include "qemu/unicode.h"
#include "etsec.h"
#include "registers.h"
@@ -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
@@ -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 */
@@ -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
@@ -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
@@ -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
@@ -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
@@ -63,7 +63,7 @@
#include "hw/nmi.h"
#include "hw/compat.h"
-#include "qemu-common.h"
+#include "qemu/cutils.h"
#include <libfdt.h>
@@ -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"
@@ -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 {
@@ -39,6 +39,7 @@
#include <libfdt.h>
#include "hw/ppc/spapr_drc.h"
+#include "qemu/cutils.h"
/* #define DEBUG_SPAPR */
@@ -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)
@@ -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);
@@ -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>
@@ -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[] = {
@@ -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:
@@ -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
@@ -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.
@@ -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"
@@ -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
@@ -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"
@@ -15,6 +15,7 @@
#include "hw/sysbus.h"
#include "qemu/timer.h"
#include "sysemu/sysemu.h"
+#include "qemu/cutils.h"
//#define DEBUG_PL031
@@ -25,6 +25,7 @@
#include "hw/i2c/i2c.h"
#include "sysemu/sysemu.h"
#include "ui/console.h"
+#include "qemu/bcd.h"
#define VERBOSE 1
@@ -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);
@@ -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.
@@ -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"
@@ -21,6 +21,7 @@
#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
#include "qapi/visitor.h"
+#include "qemu/cutils.h"
//#define DEBUG_MSD
@@ -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>
@@ -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;
@@ -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 \
@@ -59,251 +59,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))
-#define qemu_isdigit(c) isdigit((unsigned char)(c))
-#define qemu_isgraph(c) isgraph((unsigned char)(c))
-#define qemu_islower(c) islower((unsigned char)(c))
-#define qemu_isprint(c) isprint((unsigned char)(c))
-#define qemu_ispunct(c) ispunct((unsigned char)(c))
-#define qemu_isspace(c) isspace((unsigned char)(c))
-#define qemu_isupper(c) isupper((unsigned char)(c))
-#define qemu_isxdigit(c) isxdigit((unsigned char)(c))
-#define qemu_tolower(c) tolower((unsigned char)(c))
-#define qemu_toupper(c) toupper((unsigned char)(c))
-#define qemu_isascii(c) isascii((unsigned char)(c))
-#define qemu_toascii(c) toascii((unsigned char)(c))
-
-void *qemu_oom_check(void *ptr);
-
-ssize_t qemu_write_full(int fd, const void *buf, size_t count)
- QEMU_WARN_UNUSED_RESULT;
-
-#ifndef _WIN32
-int qemu_pipe(int pipefd[2]);
-/* like openpty() but also makes it raw; return master fd */
-int qemu_openpty_raw(int *aslave, char *pty_name);
-#endif
-
-#ifdef _WIN32
-/* MinGW needs type casts for the 'buf' and 'optval' arguments. */
-#define qemu_getsockopt(sockfd, level, optname, optval, optlen) \
- getsockopt(sockfd, level, optname, (void *)optval, optlen)
-#define qemu_setsockopt(sockfd, level, optname, optval, optlen) \
- setsockopt(sockfd, level, optname, (const void *)optval, optlen)
-#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
-#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
- sendto(sockfd, (const void *)buf, len, flags, destaddr, addrlen)
-#else
-#define qemu_getsockopt(sockfd, level, optname, optval, optlen) \
- getsockopt(sockfd, level, optname, optval, optlen)
-#define qemu_setsockopt(sockfd, level, optname, optval, optlen) \
- setsockopt(sockfd, level, optname, optval, optlen)
-#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags)
-#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
- sendto(sockfd, buf, len, flags, destaddr, addrlen)
-#endif
-
/* Error handling. */
void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
@@ -409,17 +164,6 @@ 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);
-}
-
/* Round number down to multiple */
#define QEMU_ALIGN_DOWN(n, m) ((n) / (m) * (m))
@@ -436,15 +180,6 @@ static inline uint8_t from_bcd(uint8_t val)
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>
new file mode 100644
@@ -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);
+}
new file mode 100644
@@ -0,0 +1,167 @@
+#include "qemu/typedefs.h"
+#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")
new file mode 100644
@@ -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");
+}
new file mode 100644
@@ -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);
new file mode 100644
@@ -0,0 +1,47 @@
+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))
+#define qemu_isdigit(c) isdigit((unsigned char)(c))
+#define qemu_isgraph(c) isgraph((unsigned char)(c))
+#define qemu_islower(c) islower((unsigned char)(c))
+#define qemu_isprint(c) isprint((unsigned char)(c))
+#define qemu_ispunct(c) ispunct((unsigned char)(c))
+#define qemu_isspace(c) isspace((unsigned char)(c))
+#define qemu_isupper(c) isupper((unsigned char)(c))
+#define qemu_isxdigit(c) isxdigit((unsigned char)(c))
+#define qemu_tolower(c) tolower((unsigned char)(c))
+#define qemu_toupper(c) toupper((unsigned char)(c))
+#define qemu_isascii(c) isascii((unsigned char)(c))
+#define qemu_toascii(c) toascii((unsigned char)(c))
+
+void *qemu_oom_check(void *ptr);
+
+ssize_t qemu_write_full(int fd, const void *buf, size_t count)
+QEMU_WARN_UNUSED_RESULT;
+
+#ifndef _WIN32
+int qemu_pipe(int pipefd[2]);
+/* like openpty() but also makes it raw; return master fd */
+int qemu_openpty_raw(int *aslave, char *pty_name);
+#endif
+
+#ifdef _WIN32
+/* MinGW needs type casts for the 'buf' and 'optval' arguments. */
+#define qemu_getsockopt(sockfd, level, optname, optval, optlen) \
+ getsockopt(sockfd, level, optname, (void *)optval, optlen)
+#define qemu_setsockopt(sockfd, level, optname, optval, optlen) \
+ setsockopt(sockfd, level, optname, (const void *)optval, optlen)
+#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
+#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
+ sendto(sockfd, (const void *)buf, len, flags, destaddr, addrlen)
+#else
+#define qemu_getsockopt(sockfd, level, optname, optval, optlen) \
+ getsockopt(sockfd, level, optname, optval, optlen)
+#define qemu_setsockopt(sockfd, level, optname, optval, optlen) \
+ setsockopt(sockfd, level, optname, optval, optlen)
+#define qemu_recv(sockfd, buf, len, flags) recv(sockfd, buf, len, flags)
+#define qemu_sendto(sockfd, buf, len, flags, destaddr, addrlen) \
+ sendto(sockfd, buf, len, flags, destaddr, addrlen)
+#endif
new file mode 100644
@@ -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);
@@ -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
@@ -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)
{
@@ -7,6 +7,7 @@
#include "qemu.h"
#include "disas/disas.h"
+#include "qemu/path.h"
#ifdef _ARCH_PPC64
#undef ARCH_DLINFO
@@ -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"
@@ -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>
@@ -1,5 +1,6 @@
/* User memory access */
#include "qemu/osdep.h"
+#include "qemu/cutils.h"
#include "qemu.h"
@@ -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"
@@ -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"
@@ -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;
@@ -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
@@ -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)
@@ -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"
@@ -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;
@@ -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)
{
@@ -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"
@@ -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"
@@ -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"
@@ -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>
@@ -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"
@@ -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>
@@ -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"
@@ -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
@@ -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"
@@ -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"
@@ -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
@@ -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"
@@ -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__
@@ -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)
@@ -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"
@@ -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"
@@ -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"
@@ -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
@@ -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
{
@@ -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"
@@ -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 */
@@ -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;
@@ -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;
@@ -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__
@@ -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 */
@@ -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)
{
@@ -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
@@ -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"
@@ -42,6 +42,7 @@
#include "exec/gdbstub.h"
#include "exec/memattrs.h"
#include "sysemu/hostmem.h"
+#include "qemu/cutils.h"
//#define DEBUG_KVM
@@ -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
@@ -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"
@@ -36,7 +36,7 @@
#define NDEBUG
#endif
-#include "qemu-common.h"
+#include "qemu/cutils.h"
#include "qemu/host-utils.h"
#include "qemu/timer.h"
@@ -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"
@@ -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;
@@ -11,6 +11,7 @@
#include <glib.h>
#include "qemu-common.h"
+#include "qemu/cutils.h"
#include "libqtest.h"
#include "qapi/qmp/types.h"
@@ -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
@@ -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)
{
@@ -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)
@@ -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
@@ -36,6 +36,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "qemu/cutils.h"
#include "ui/console.h"
#include "ui/gtk.h"
@@ -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)
@@ -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"
@@ -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
@@ -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)
{
@@ -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"
@@ -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)
{
@@ -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)
{
@@ -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)
@@ -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"
@@ -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>
@@ -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>
@@ -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
{
@@ -34,6 +34,7 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
+#include "qemu/path.h"
#if defined(__GLIBC__)
# include <pty.h>
@@ -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
@@ -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
@@ -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
@@ -11,7 +11,7 @@
*/
#include "qemu/osdep.h"
-#include "qemu-common.h"
+#include "qemu/unicode.h"
/**
* mod_utf8_codepoint:
@@ -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"
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<veronia@veroniabahaa@gmail.com> --- 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