From: Paolo Bonzini Date: Mon, 17 Dec 2012 17:20:05 +0000 (+0100) Subject: softmmu: move remaining include files to include/ subdirectories X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~900^2~59^2~1143^2~5^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=927d4878b0ff319ed87fed9363f314613b0a5ed9;p=sdk%2Femulator%2Fqemu.git softmmu: move remaining include files to include/ subdirectories Signed-off-by: Paolo Bonzini --- diff --git a/backends/rng-egd.c b/backends/rng-egd.c index 3a7d1ecbe0..fd41b53188 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -11,7 +11,7 @@ */ #include "qemu/rng.h" -#include "qemu-char.h" +#include "char/char.h" #include "qapi/qmp/qerror.h" #include "hw/qdev.h" /* just for DEFINE_PROP_CHR */ diff --git a/bt-host.c b/bt-host.c index 4f5f9f93c5..2092754530 100644 --- a/bt-host.c +++ b/bt-host.c @@ -18,7 +18,7 @@ */ #include "qemu-common.h" -#include "bt-host.h" +#include "bt/bt.h" #include "qemu/main-loop.h" #ifndef _WIN32 diff --git a/bt-host.h b/bt-host.h deleted file mode 100644 index 2bc6d53cca..0000000000 --- a/bt-host.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef BT_HOST_H -#define BT_HOST_H - -/* BT HCI info */ - -struct HCIInfo { - int (*bdaddr_set)(struct HCIInfo *hci, const uint8_t *bd_addr); - void (*cmd_send)(struct HCIInfo *hci, const uint8_t *data, int len); - void (*sco_send)(struct HCIInfo *hci, const uint8_t *data, int len); - void (*acl_send)(struct HCIInfo *hci, const uint8_t *data, int len); - void *opaque; - void (*evt_recv)(void *opaque, const uint8_t *data, int len); - void (*acl_recv)(void *opaque, const uint8_t *data, int len); -}; - -/* bt-host.c */ -struct HCIInfo *bt_host_hci(const char *id); -struct HCIInfo *qemu_next_hci(void); - -#endif diff --git a/bt-vhci.c b/bt-vhci.c index f5d856a809..a6a7ab0329 100644 --- a/bt-vhci.c +++ b/bt-vhci.c @@ -18,7 +18,7 @@ */ #include "qemu-common.h" -#include "bt-host.h" +#include "bt/bt.h" #include "hw/bt.h" #include "qemu/main-loop.h" diff --git a/event_notifier-posix.c b/event_notifier-posix.c index a53b95688d..713d7560d0 100644 --- a/event_notifier-posix.c +++ b/event_notifier-posix.c @@ -12,7 +12,7 @@ #include "qemu-common.h" #include "qemu/event_notifier.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/main-loop.h" #ifdef CONFIG_EVENTFD diff --git a/gdbstub.c b/gdbstub.c index 2fca1a7ebf..a8dd437ec0 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -30,7 +30,7 @@ #include "qemu.h" #else #include "monitor/monitor.h" -#include "qemu-char.h" +#include "char/char.h" #include "sysemu/sysemu.h" #include "exec/gdbstub.h" #endif diff --git a/hmp.c b/hmp.c index 3d056b0e38..9e9e62450e 100644 --- a/hmp.c +++ b/hmp.c @@ -15,7 +15,7 @@ #include "hmp.h" #include "net/net.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/option.h" #include "qemu/timer.h" #include "qmp-commands.h" diff --git a/hw/baum.c b/hw/baum.c index 97d13ea344..09dcb9cc74 100644 --- a/hw/baum.c +++ b/hw/baum.c @@ -22,7 +22,7 @@ * THE SOFTWARE. */ #include "qemu-common.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/timer.h" #include "usb.h" #include "baum.h" diff --git a/hw/bt-hci-csr.c b/hw/bt-hci-csr.c index e1dcb6d099..2070bb940c 100644 --- a/hw/bt-hci-csr.c +++ b/hw/bt-hci-csr.c @@ -19,10 +19,10 @@ */ #include "qemu-common.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/timer.h" #include "irq.h" -#include "bt-host.h" +#include "bt/bt.h" #include "bt.h" struct csrhci_s { diff --git a/hw/bt-hci.c b/hw/bt-hci.c index da096d8c37..69d2c73862 100644 --- a/hw/bt-hci.c +++ b/hw/bt-hci.c @@ -21,7 +21,7 @@ #include "qemu-common.h" #include "qemu/timer.h" #include "usb.h" -#include "bt-host.h" +#include "bt/bt.h" #include "bt.h" struct bt_hci_s { diff --git a/hw/bt.c b/hw/bt.c index 3fea0983d4..4f2372d794 100644 --- a/hw/bt.c +++ b/hw/bt.c @@ -18,7 +18,7 @@ */ #include "qemu-common.h" -#include "bt-host.h" +#include "bt/bt.h" #include "bt.h" /* Slave implementations can ignore this */ diff --git a/hw/cadence_uart.c b/hw/cadence_uart.c index f34acc8c46..7dd2fe54ed 100644 --- a/hw/cadence_uart.c +++ b/hw/cadence_uart.c @@ -17,7 +17,7 @@ */ #include "sysbus.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/timer.h" #ifdef CADENCE_UART_ERR_DEBUG diff --git a/hw/ccid-card-emulated.c b/hw/ccid-card-emulated.c index e508380482..6fd44695ae 100644 --- a/hw/ccid-card-emulated.c +++ b/hw/ccid-card-emulated.c @@ -32,7 +32,7 @@ #include #include "qemu/thread.h" -#include "qemu-char.h" +#include "char/char.h" #include "monitor/monitor.h" #include "hw/ccid.h" diff --git a/hw/ccid-card-passthru.c b/hw/ccid-card-passthru.c index 48e4228b9d..4be05471a9 100644 --- a/hw/ccid-card-passthru.c +++ b/hw/ccid-card-passthru.c @@ -8,7 +8,7 @@ * See the COPYING file in the top-level directory. */ -#include "qemu-char.h" +#include "char/char.h" #include "qemu/sockets.h" #include "monitor/monitor.h" #include "hw/ccid.h" diff --git a/hw/debugcon.c b/hw/debugcon.c index 14ab326be3..14f83f1962 100644 --- a/hw/debugcon.c +++ b/hw/debugcon.c @@ -25,7 +25,7 @@ */ #include "hw.h" -#include "qemu-char.h" +#include "char/char.h" #include "isa.h" #include "pc.h" diff --git a/hw/escc.c b/hw/escc.c index 38e8164e44..f09904aae4 100644 --- a/hw/escc.c +++ b/hw/escc.c @@ -25,7 +25,7 @@ #include "hw.h" #include "sysbus.h" #include "escc.h" -#include "qemu-char.h" +#include "char/char.h" #include "ui/console.h" #include "trace.h" diff --git a/hw/etraxfs_ser.c b/hw/etraxfs_ser.c index 59cb7d2172..7bde8004d0 100644 --- a/hw/etraxfs_ser.c +++ b/hw/etraxfs_ser.c @@ -23,7 +23,7 @@ */ #include "sysbus.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/log.h" #define D(x) diff --git a/hw/exynos4210_uart.c b/hw/exynos4210_uart.c index 8950891a00..4f23079095 100644 --- a/hw/exynos4210_uart.c +++ b/hw/exynos4210_uart.c @@ -21,7 +21,7 @@ #include "sysbus.h" #include "sysemu/sysemu.h" -#include "qemu-char.h" +#include "char/char.h" #include "exynos4210.h" diff --git a/hw/grlib_apbuart.c b/hw/grlib_apbuart.c index 0865764deb..88c46780d1 100644 --- a/hw/grlib_apbuart.c +++ b/hw/grlib_apbuart.c @@ -23,7 +23,7 @@ */ #include "sysbus.h" -#include "qemu-char.h" +#include "char/char.h" #include "trace.h" diff --git a/hw/imx_serial.c b/hw/imx_serial.c index e56e3ea726..124dbb2860 100644 --- a/hw/imx_serial.c +++ b/hw/imx_serial.c @@ -20,7 +20,7 @@ #include "hw.h" #include "sysbus.h" #include "sysemu/sysemu.h" -#include "qemu-char.h" +#include "char/char.h" #include "imx.h" //#define DEBUG_SERIAL 1 diff --git a/hw/ivshmem.c b/hw/ivshmem.c index 567c9a76a7..fcf5d05bae 100644 --- a/hw/ivshmem.c +++ b/hw/ivshmem.c @@ -24,7 +24,7 @@ #include "migration/migration.h" #include "qapi/qmp/qerror.h" #include "qemu/event_notifier.h" -#include "qemu-char.h" +#include "char/char.h" #include #include diff --git a/hw/leon3.c b/hw/leon3.c index d1d4541867..79b3a41def 100644 --- a/hw/leon3.c +++ b/hw/leon3.c @@ -24,7 +24,7 @@ #include "hw.h" #include "qemu/timer.h" #include "ptimer.h" -#include "qemu-char.h" +#include "char/char.h" #include "sysemu/sysemu.h" #include "boards.h" #include "loader.h" diff --git a/hw/lm32_juart.c b/hw/lm32_juart.c index f07ed3977f..7c2d202d6a 100644 --- a/hw/lm32_juart.c +++ b/hw/lm32_juart.c @@ -20,7 +20,7 @@ #include "hw.h" #include "sysbus.h" #include "trace.h" -#include "qemu-char.h" +#include "char/char.h" #include "lm32_juart.h" diff --git a/hw/lm32_uart.c b/hw/lm32_uart.c index bf2f507523..89605b8e77 100644 --- a/hw/lm32_uart.c +++ b/hw/lm32_uart.c @@ -25,7 +25,7 @@ #include "hw.h" #include "sysbus.h" #include "trace.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/error-report.h" enum { diff --git a/hw/mcf_uart.c b/hw/mcf_uart.c index 2eca2c6ae9..c44344317a 100644 --- a/hw/mcf_uart.c +++ b/hw/mcf_uart.c @@ -7,7 +7,7 @@ */ #include "hw.h" #include "mcf.h" -#include "qemu-char.h" +#include "char/char.h" #include "exec/address-spaces.h" typedef struct { diff --git a/hw/milkymist-uart.c b/hw/milkymist-uart.c index ef5518e5c2..19e9dbdc75 100644 --- a/hw/milkymist-uart.c +++ b/hw/milkymist-uart.c @@ -24,7 +24,7 @@ #include "hw.h" #include "sysbus.h" #include "trace.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/error-report.h" enum { diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c index e7eeda319e..4d8ee8c09c 100644 --- a/hw/mips_fulong2e.c +++ b/hw/mips_fulong2e.c @@ -30,7 +30,7 @@ #include "mips.h" #include "mips_cpudevs.h" #include "pci/pci.h" -#include "qemu-char.h" +#include "char/char.h" #include "sysemu/sysemu.h" #include "audio/audio.h" #include "qemu/log.h" diff --git a/hw/mips_malta.c b/hw/mips_malta.c index bd31ced29d..635143d20c 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -34,7 +34,7 @@ #include "mips.h" #include "mips_cpudevs.h" #include "pci/pci.h" -#include "qemu-char.h" +#include "char/char.h" #include "sysemu/sysemu.h" #include "sysemu/arch_init.h" #include "boards.h" diff --git a/hw/msmouse.c b/hw/msmouse.c index decb1a3b5d..ef47aed4e9 100644 --- a/hw/msmouse.c +++ b/hw/msmouse.c @@ -23,7 +23,7 @@ */ #include #include "qemu-common.h" -#include "qemu-char.h" +#include "char/char.h" #include "ui/console.h" #include "msmouse.h" diff --git a/hw/omap2.c b/hw/omap2.c index dc6867c962..c8358500bc 100644 --- a/hw/omap2.c +++ b/hw/omap2.c @@ -24,7 +24,7 @@ #include "omap.h" #include "sysemu/sysemu.h" #include "qemu/timer.h" -#include "qemu-char.h" +#include "char/char.h" #include "flash.h" #include "soc_dma.h" #include "sysbus.h" diff --git a/hw/omap_uart.c b/hw/omap_uart.c index 159b2d1cdd..0ebfbf8cae 100644 --- a/hw/omap_uart.c +++ b/hw/omap_uart.c @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License along * with this program; if not, see . */ -#include "qemu-char.h" +#include "char/char.h" #include "hw.h" #include "omap.h" #include "serial.h" diff --git a/hw/parallel.c b/hw/parallel.c index 56b3760e8c..64a46c6055 100644 --- a/hw/parallel.c +++ b/hw/parallel.c @@ -23,7 +23,7 @@ * THE SOFTWARE. */ #include "hw.h" -#include "qemu-char.h" +#include "char/char.h" #include "isa.h" #include "pc.h" #include "sysemu/sysemu.h" diff --git a/hw/pl011.c b/hw/pl011.c index 1f7ce2f94c..35835f36c0 100644 --- a/hw/pl011.c +++ b/hw/pl011.c @@ -8,7 +8,7 @@ */ #include "sysbus.h" -#include "qemu-char.h" +#include "char/char.h" typedef struct { SysBusDevice busdev; diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index 936e9f87cd..3c51bc82aa 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -13,7 +13,7 @@ #include "serial.h" #include "i2c.h" #include "ssi.h" -#include "qemu-char.h" +#include "char/char.h" #include "sysemu/blockdev.h" static struct { diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 1cb97ea594..04d605dd37 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -5,7 +5,7 @@ #include "hw/block-common.h" #include "net/hub.h" #include "qapi/visitor.h" -#include "qemu-char.h" +#include "char/char.h" void *qdev_get_prop_ptr(DeviceState *dev, Property *prop) { diff --git a/hw/s390x/sclpconsole.c b/hw/s390x/sclpconsole.c index ca78d6796a..aa70e16665 100644 --- a/hw/s390x/sclpconsole.c +++ b/hw/s390x/sclpconsole.c @@ -17,7 +17,7 @@ #include "sclp.h" #include "event-facility.h" -#include "qemu-char.h" +#include "char/char.h" typedef struct ASCIIConsoleData { EventBufferHeader ebh; diff --git a/hw/serial.c b/hw/serial.c index 2cbb5447a7..a5b2a0c609 100644 --- a/hw/serial.c +++ b/hw/serial.c @@ -24,7 +24,7 @@ */ #include "serial.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/timer.h" #include "exec/address-spaces.h" diff --git a/hw/sh_serial.c b/hw/sh_serial.c index 63723496f1..21c5b1362d 100644 --- a/hw/sh_serial.c +++ b/hw/sh_serial.c @@ -26,7 +26,7 @@ */ #include "hw.h" #include "sh.h" -#include "qemu-char.h" +#include "char/char.h" #include "exec/address-spaces.h" //#define DEBUG_SERIAL diff --git a/hw/spapr_events.c b/hw/spapr_events.c index 7956601466..ce78f0922e 100644 --- a/hw/spapr_events.c +++ b/hw/spapr_events.c @@ -26,7 +26,7 @@ */ #include "cpu.h" #include "sysemu/sysemu.h" -#include "qemu-char.h" +#include "char/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" diff --git a/hw/spapr_rtas.c b/hw/spapr_rtas.c index d29736285c..81eecd0940 100644 --- a/hw/spapr_rtas.c +++ b/hw/spapr_rtas.c @@ -26,7 +26,7 @@ */ #include "cpu.h" #include "sysemu/sysemu.h" -#include "qemu-char.h" +#include "char/char.h" #include "hw/qdev.h" #include "sysemu/device_tree.h" diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c index 14f862fba1..ec81a7e6e8 100644 --- a/hw/spapr_vty.c +++ b/hw/spapr_vty.c @@ -1,5 +1,5 @@ #include "qdev.h" -#include "qemu-char.h" +#include "char/char.h" #include "hw/spapr.h" #include "hw/spapr_vio.h" diff --git a/hw/strongarm.c b/hw/strongarm.c index 5d5f454b1d..804c1a37a6 100644 --- a/hw/strongarm.c +++ b/hw/strongarm.c @@ -30,7 +30,7 @@ #include "strongarm.h" #include "qemu/error-report.h" #include "arm-misc.h" -#include "qemu-char.h" +#include "char/char.h" #include "sysemu/sysemu.h" #include "ssi.h" diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c index 4a37442288..a0d7a88d91 100644 --- a/hw/usb/dev-bluetooth.c +++ b/hw/usb/dev-bluetooth.c @@ -21,7 +21,7 @@ #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h" -#include "bt-host.h" +#include "bt/bt.h" #include "hw/bt.h" struct USBBtState { diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c index 2ff4fe247a..20cf5337b7 100644 --- a/hw/usb/dev-serial.c +++ b/hw/usb/dev-serial.c @@ -12,7 +12,7 @@ #include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h" -#include "qemu-char.h" +#include "char/char.h" //#define DEBUG_Serial diff --git a/hw/virtio-console.c b/hw/virtio-console.c index df0951e973..002b028b99 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -10,7 +10,7 @@ * the COPYING file in the top-level directory. */ -#include "qemu-char.h" +#include "char/char.h" #include "qemu/error-report.h" #include "trace.h" #include "virtio-serial.h" diff --git a/hw/xen_backend.c b/hw/xen_backend.c index 270584fc10..3fa30098ca 100644 --- a/hw/xen_backend.c +++ b/hw/xen_backend.c @@ -35,7 +35,7 @@ #include #include "hw.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/log.h" #include "xen_backend.h" diff --git a/hw/xen_console.c b/hw/xen_console.c index 9426d7374f..ac36ceb47c 100644 --- a/hw/xen_console.c +++ b/hw/xen_console.c @@ -30,7 +30,7 @@ #include #include "hw.h" -#include "qemu-char.h" +#include "char/char.h" #include "xen_backend.h" #include diff --git a/hw/xenfb.c b/hw/xenfb.c index b1122bd933..903efd3073 100644 --- a/hw/xenfb.c +++ b/hw/xenfb.c @@ -37,7 +37,7 @@ #include "hw.h" #include "ui/console.h" -#include "qemu-char.h" +#include "char/char.h" #include "xen_backend.h" #include diff --git a/hw/xgmac.c b/hw/xgmac.c index acc3d37648..9639b6141b 100644 --- a/hw/xgmac.c +++ b/hw/xgmac.c @@ -25,7 +25,7 @@ */ #include "sysbus.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/log.h" #include "net/net.h" #include "net/checksum.h" diff --git a/hw/xilinx_uartlite.c b/hw/xilinx_uartlite.c index 02c5850331..abd256ae00 100644 --- a/hw/xilinx_uartlite.c +++ b/hw/xilinx_uartlite.c @@ -23,7 +23,7 @@ */ #include "sysbus.h" -#include "qemu-char.h" +#include "char/char.h" #define DUART(x) diff --git a/hw/xtensa_lx60.c b/hw/xtensa_lx60.c index 9c7bb75f81..0b9a52851a 100644 --- a/hw/xtensa_lx60.c +++ b/hw/xtensa_lx60.c @@ -36,7 +36,7 @@ #include "sysbus.h" #include "flash.h" #include "sysemu/blockdev.h" -#include "qemu-char.h" +#include "char/char.h" #include "xtensa_bootparam.h" typedef struct LxBoardDesc { diff --git a/include/bt/bt.h b/include/bt/bt.h new file mode 100644 index 0000000000..2bc6d53cca --- /dev/null +++ b/include/bt/bt.h @@ -0,0 +1,20 @@ +#ifndef BT_HOST_H +#define BT_HOST_H + +/* BT HCI info */ + +struct HCIInfo { + int (*bdaddr_set)(struct HCIInfo *hci, const uint8_t *bd_addr); + void (*cmd_send)(struct HCIInfo *hci, const uint8_t *data, int len); + void (*sco_send)(struct HCIInfo *hci, const uint8_t *data, int len); + void (*acl_send)(struct HCIInfo *hci, const uint8_t *data, int len); + void *opaque; + void (*evt_recv)(void *opaque, const uint8_t *data, int len); + void (*acl_recv)(void *opaque, const uint8_t *data, int len); +}; + +/* bt-host.c */ +struct HCIInfo *bt_host_hci(const char *id); +struct HCIInfo *qemu_next_hci(void); + +#endif diff --git a/include/char/char.h b/include/char/char.h new file mode 100644 index 0000000000..baa5d035fd --- /dev/null +++ b/include/char/char.h @@ -0,0 +1,254 @@ +#ifndef QEMU_CHAR_H +#define QEMU_CHAR_H + +#include "qemu-common.h" +#include "qemu/queue.h" +#include "qemu/option.h" +#include "qemu/config-file.h" +#include "block/aio.h" +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qstring.h" +#include "qemu/main-loop.h" + +/* character device */ + +#define CHR_EVENT_BREAK 0 /* serial break char */ +#define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */ +#define CHR_EVENT_OPENED 2 /* new connection established */ +#define CHR_EVENT_MUX_IN 3 /* mux-focus was set to this terminal */ +#define CHR_EVENT_MUX_OUT 4 /* mux-focus will move on */ +#define CHR_EVENT_CLOSED 5 /* connection closed */ + + +#define CHR_IOCTL_SERIAL_SET_PARAMS 1 +typedef struct { + int speed; + int parity; + int data_bits; + int stop_bits; +} QEMUSerialSetParams; + +#define CHR_IOCTL_SERIAL_SET_BREAK 2 + +#define CHR_IOCTL_PP_READ_DATA 3 +#define CHR_IOCTL_PP_WRITE_DATA 4 +#define CHR_IOCTL_PP_READ_CONTROL 5 +#define CHR_IOCTL_PP_WRITE_CONTROL 6 +#define CHR_IOCTL_PP_READ_STATUS 7 +#define CHR_IOCTL_PP_EPP_READ_ADDR 8 +#define CHR_IOCTL_PP_EPP_READ 9 +#define CHR_IOCTL_PP_EPP_WRITE_ADDR 10 +#define CHR_IOCTL_PP_EPP_WRITE 11 +#define CHR_IOCTL_PP_DATA_DIR 12 + +#define CHR_IOCTL_SERIAL_SET_TIOCM 13 +#define CHR_IOCTL_SERIAL_GET_TIOCM 14 + +#define CHR_TIOCM_CTS 0x020 +#define CHR_TIOCM_CAR 0x040 +#define CHR_TIOCM_DSR 0x100 +#define CHR_TIOCM_RI 0x080 +#define CHR_TIOCM_DTR 0x002 +#define CHR_TIOCM_RTS 0x004 + +typedef void IOEventHandler(void *opaque, int event); + +struct CharDriverState { + void (*init)(struct CharDriverState *s); + int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len); + void (*chr_update_read_handler)(struct CharDriverState *s); + int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg); + int (*get_msgfd)(struct CharDriverState *s); + int (*chr_add_client)(struct CharDriverState *chr, int fd); + IOEventHandler *chr_event; + IOCanReadHandler *chr_can_read; + IOReadHandler *chr_read; + void *handler_opaque; + void (*chr_close)(struct CharDriverState *chr); + void (*chr_accept_input)(struct CharDriverState *chr); + void (*chr_set_echo)(struct CharDriverState *chr, bool echo); + void (*chr_guest_open)(struct CharDriverState *chr); + void (*chr_guest_close)(struct CharDriverState *chr); + void *opaque; + QEMUTimer *open_timer; + char *label; + char *filename; + int opened; + int avail_connections; + QTAILQ_ENTRY(CharDriverState) next; +}; + +/** + * @qemu_chr_new_from_opts: + * + * Create a new character backend from a QemuOpts list. + * + * @opts see qemu-config.c for a list of valid options + * @init not sure.. + * + * Returns: a new character backend + */ +CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, + void (*init)(struct CharDriverState *s)); + +/** + * @qemu_chr_new: + * + * Create a new character backend from a URI. + * + * @label the name of the backend + * @filename the URI + * @init not sure.. + * + * Returns: a new character backend + */ +CharDriverState *qemu_chr_new(const char *label, const char *filename, + void (*init)(struct CharDriverState *s)); + +/** + * @qemu_chr_delete: + * + * Destroy a character backend. + */ +void qemu_chr_delete(CharDriverState *chr); + +/** + * @qemu_chr_fe_set_echo: + * + * Ask the backend to override its normal echo setting. This only really + * applies to the stdio backend and is used by the QMP server such that you + * can see what you type if you try to type QMP commands. + * + * @echo true to enable echo, false to disable echo + */ +void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo); + +/** + * @qemu_chr_fe_open: + * + * Open a character backend. This function call is an indication that the + * front end is ready to begin doing I/O. + */ +void qemu_chr_fe_open(struct CharDriverState *chr); + +/** + * @qemu_chr_fe_close: + * + * Close a character backend. This function call indicates that the front end + * no longer is able to process I/O. To process I/O again, the front end will + * call @qemu_chr_fe_open. + */ +void qemu_chr_fe_close(struct CharDriverState *chr); + +/** + * @qemu_chr_fe_printf: + * + * Write to a character backend using a printf style interface. + * + * @fmt see #printf + */ +void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...) + GCC_FMT_ATTR(2, 3); + +/** + * @qemu_chr_fe_write: + * + * Write data to a character backend from the front end. This function will + * send data from the front end to the back end. + * + * @buf the data + * @len the number of bytes to send + * + * Returns: the number of bytes consumed + */ +int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len); + +/** + * @qemu_chr_fe_ioctl: + * + * Issue a device specific ioctl to a backend. + * + * @cmd see CHR_IOCTL_* + * @arg the data associated with @cmd + * + * Returns: if @cmd is not supported by the backend, -ENOTSUP, otherwise the + * return value depends on the semantics of @cmd + */ +int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg); + +/** + * @qemu_chr_fe_get_msgfd: + * + * For backends capable of fd passing, return the latest file descriptor passed + * by a client. + * + * Returns: -1 if fd passing isn't supported or there is no pending file + * descriptor. If a file descriptor is returned, subsequent calls to + * this function will return -1 until a client sends a new file + * descriptor. + */ +int qemu_chr_fe_get_msgfd(CharDriverState *s); + +/** + * @qemu_chr_be_can_write: + * + * Determine how much data the front end can currently accept. This function + * returns the number of bytes the front end can accept. If it returns 0, the + * front end cannot receive data at the moment. The function must be polled + * to determine when data can be received. + * + * Returns: the number of bytes the front end can receive via @qemu_chr_be_write + */ +int qemu_chr_be_can_write(CharDriverState *s); + +/** + * @qemu_chr_be_write: + * + * Write data from the back end to the front end. Before issuing this call, + * the caller should call @qemu_chr_be_can_write to determine how much data + * the front end can currently accept. + * + * @buf a buffer to receive data from the front end + * @len the number of bytes to receive from the front end + */ +void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len); + + +/** + * @qemu_chr_be_event: + * + * Send an event from the back end to the front end. + * + * @event the event to send + */ +void qemu_chr_be_event(CharDriverState *s, int event); + +void qemu_chr_add_handlers(CharDriverState *s, + IOCanReadHandler *fd_can_read, + IOReadHandler *fd_read, + IOEventHandler *fd_event, + void *opaque); + +void qemu_chr_generic_open(CharDriverState *s); +void qemu_chr_accept_input(CharDriverState *s); +int qemu_chr_add_client(CharDriverState *s, int fd); +void qemu_chr_info_print(Monitor *mon, const QObject *ret_data); +void qemu_chr_info(Monitor *mon, QObject **ret_data); +CharDriverState *qemu_chr_find(const char *name); + +QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename); + +/* add an eventfd to the qemu devices that are polled */ +CharDriverState *qemu_chr_open_eventfd(int eventfd); + +extern int term_escape_char; + +/* memory chardev */ +void qemu_chr_init_mem(CharDriverState *chr); +void qemu_chr_close_mem(CharDriverState *chr); +QString *qemu_chr_mem_to_qs(CharDriverState *chr); +size_t qemu_chr_mem_osize(const CharDriverState *chr); + +CharDriverState *qemu_char_get_next_serial(void); + +#endif diff --git a/monitor.c b/monitor.c index 200bef452f..9cf419bb1d 100644 --- a/monitor.c +++ b/monitor.c @@ -33,7 +33,7 @@ #include "exec/gdbstub.h" #include "net/net.h" #include "net/slirp.h" -#include "qemu-char.h" +#include "char/char.h" #include "ui/qemu-spice.h" #include "sysemu/sysemu.h" #include "monitor/monitor.h" diff --git a/net/slirp.c b/net/slirp.c index 87bdc9d031..c14259f004 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -35,7 +35,7 @@ #include "monitor/monitor.h" #include "qemu/sockets.h" #include "slirp/libslirp.h" -#include "qemu-char.h" +#include "char/char.h" static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) { diff --git a/qemu-char.c b/qemu-char.c index 0cbe85318e..e39e6f168c 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -26,7 +26,7 @@ #include "ui/console.h" #include "sysemu/sysemu.h" #include "qemu/timer.h" -#include "qemu-char.h" +#include "char/char.h" #include "hw/usb.h" #include "hw/baum.h" #include "hw/msmouse.h" diff --git a/qemu-char.h b/qemu-char.h deleted file mode 100644 index baa5d035fd..0000000000 --- a/qemu-char.h +++ /dev/null @@ -1,254 +0,0 @@ -#ifndef QEMU_CHAR_H -#define QEMU_CHAR_H - -#include "qemu-common.h" -#include "qemu/queue.h" -#include "qemu/option.h" -#include "qemu/config-file.h" -#include "block/aio.h" -#include "qapi/qmp/qobject.h" -#include "qapi/qmp/qstring.h" -#include "qemu/main-loop.h" - -/* character device */ - -#define CHR_EVENT_BREAK 0 /* serial break char */ -#define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */ -#define CHR_EVENT_OPENED 2 /* new connection established */ -#define CHR_EVENT_MUX_IN 3 /* mux-focus was set to this terminal */ -#define CHR_EVENT_MUX_OUT 4 /* mux-focus will move on */ -#define CHR_EVENT_CLOSED 5 /* connection closed */ - - -#define CHR_IOCTL_SERIAL_SET_PARAMS 1 -typedef struct { - int speed; - int parity; - int data_bits; - int stop_bits; -} QEMUSerialSetParams; - -#define CHR_IOCTL_SERIAL_SET_BREAK 2 - -#define CHR_IOCTL_PP_READ_DATA 3 -#define CHR_IOCTL_PP_WRITE_DATA 4 -#define CHR_IOCTL_PP_READ_CONTROL 5 -#define CHR_IOCTL_PP_WRITE_CONTROL 6 -#define CHR_IOCTL_PP_READ_STATUS 7 -#define CHR_IOCTL_PP_EPP_READ_ADDR 8 -#define CHR_IOCTL_PP_EPP_READ 9 -#define CHR_IOCTL_PP_EPP_WRITE_ADDR 10 -#define CHR_IOCTL_PP_EPP_WRITE 11 -#define CHR_IOCTL_PP_DATA_DIR 12 - -#define CHR_IOCTL_SERIAL_SET_TIOCM 13 -#define CHR_IOCTL_SERIAL_GET_TIOCM 14 - -#define CHR_TIOCM_CTS 0x020 -#define CHR_TIOCM_CAR 0x040 -#define CHR_TIOCM_DSR 0x100 -#define CHR_TIOCM_RI 0x080 -#define CHR_TIOCM_DTR 0x002 -#define CHR_TIOCM_RTS 0x004 - -typedef void IOEventHandler(void *opaque, int event); - -struct CharDriverState { - void (*init)(struct CharDriverState *s); - int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len); - void (*chr_update_read_handler)(struct CharDriverState *s); - int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg); - int (*get_msgfd)(struct CharDriverState *s); - int (*chr_add_client)(struct CharDriverState *chr, int fd); - IOEventHandler *chr_event; - IOCanReadHandler *chr_can_read; - IOReadHandler *chr_read; - void *handler_opaque; - void (*chr_close)(struct CharDriverState *chr); - void (*chr_accept_input)(struct CharDriverState *chr); - void (*chr_set_echo)(struct CharDriverState *chr, bool echo); - void (*chr_guest_open)(struct CharDriverState *chr); - void (*chr_guest_close)(struct CharDriverState *chr); - void *opaque; - QEMUTimer *open_timer; - char *label; - char *filename; - int opened; - int avail_connections; - QTAILQ_ENTRY(CharDriverState) next; -}; - -/** - * @qemu_chr_new_from_opts: - * - * Create a new character backend from a QemuOpts list. - * - * @opts see qemu-config.c for a list of valid options - * @init not sure.. - * - * Returns: a new character backend - */ -CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, - void (*init)(struct CharDriverState *s)); - -/** - * @qemu_chr_new: - * - * Create a new character backend from a URI. - * - * @label the name of the backend - * @filename the URI - * @init not sure.. - * - * Returns: a new character backend - */ -CharDriverState *qemu_chr_new(const char *label, const char *filename, - void (*init)(struct CharDriverState *s)); - -/** - * @qemu_chr_delete: - * - * Destroy a character backend. - */ -void qemu_chr_delete(CharDriverState *chr); - -/** - * @qemu_chr_fe_set_echo: - * - * Ask the backend to override its normal echo setting. This only really - * applies to the stdio backend and is used by the QMP server such that you - * can see what you type if you try to type QMP commands. - * - * @echo true to enable echo, false to disable echo - */ -void qemu_chr_fe_set_echo(struct CharDriverState *chr, bool echo); - -/** - * @qemu_chr_fe_open: - * - * Open a character backend. This function call is an indication that the - * front end is ready to begin doing I/O. - */ -void qemu_chr_fe_open(struct CharDriverState *chr); - -/** - * @qemu_chr_fe_close: - * - * Close a character backend. This function call indicates that the front end - * no longer is able to process I/O. To process I/O again, the front end will - * call @qemu_chr_fe_open. - */ -void qemu_chr_fe_close(struct CharDriverState *chr); - -/** - * @qemu_chr_fe_printf: - * - * Write to a character backend using a printf style interface. - * - * @fmt see #printf - */ -void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...) - GCC_FMT_ATTR(2, 3); - -/** - * @qemu_chr_fe_write: - * - * Write data to a character backend from the front end. This function will - * send data from the front end to the back end. - * - * @buf the data - * @len the number of bytes to send - * - * Returns: the number of bytes consumed - */ -int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len); - -/** - * @qemu_chr_fe_ioctl: - * - * Issue a device specific ioctl to a backend. - * - * @cmd see CHR_IOCTL_* - * @arg the data associated with @cmd - * - * Returns: if @cmd is not supported by the backend, -ENOTSUP, otherwise the - * return value depends on the semantics of @cmd - */ -int qemu_chr_fe_ioctl(CharDriverState *s, int cmd, void *arg); - -/** - * @qemu_chr_fe_get_msgfd: - * - * For backends capable of fd passing, return the latest file descriptor passed - * by a client. - * - * Returns: -1 if fd passing isn't supported or there is no pending file - * descriptor. If a file descriptor is returned, subsequent calls to - * this function will return -1 until a client sends a new file - * descriptor. - */ -int qemu_chr_fe_get_msgfd(CharDriverState *s); - -/** - * @qemu_chr_be_can_write: - * - * Determine how much data the front end can currently accept. This function - * returns the number of bytes the front end can accept. If it returns 0, the - * front end cannot receive data at the moment. The function must be polled - * to determine when data can be received. - * - * Returns: the number of bytes the front end can receive via @qemu_chr_be_write - */ -int qemu_chr_be_can_write(CharDriverState *s); - -/** - * @qemu_chr_be_write: - * - * Write data from the back end to the front end. Before issuing this call, - * the caller should call @qemu_chr_be_can_write to determine how much data - * the front end can currently accept. - * - * @buf a buffer to receive data from the front end - * @len the number of bytes to receive from the front end - */ -void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len); - - -/** - * @qemu_chr_be_event: - * - * Send an event from the back end to the front end. - * - * @event the event to send - */ -void qemu_chr_be_event(CharDriverState *s, int event); - -void qemu_chr_add_handlers(CharDriverState *s, - IOCanReadHandler *fd_can_read, - IOReadHandler *fd_read, - IOEventHandler *fd_event, - void *opaque); - -void qemu_chr_generic_open(CharDriverState *s); -void qemu_chr_accept_input(CharDriverState *s); -int qemu_chr_add_client(CharDriverState *s, int fd); -void qemu_chr_info_print(Monitor *mon, const QObject *ret_data); -void qemu_chr_info(Monitor *mon, QObject **ret_data); -CharDriverState *qemu_chr_find(const char *name); - -QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename); - -/* add an eventfd to the qemu devices that are polled */ -CharDriverState *qemu_chr_open_eventfd(int eventfd); - -extern int term_escape_char; - -/* memory chardev */ -void qemu_chr_init_mem(CharDriverState *chr); -void qemu_chr_close_mem(CharDriverState *chr); -QString *qemu_chr_mem_to_qs(CharDriverState *chr); -size_t qemu_chr_mem_osize(const CharDriverState *chr); - -CharDriverState *qemu_char_get_next_serial(void); - -#endif diff --git a/qmp.c b/qmp.c index be63fe1029..55b056b558 100644 --- a/qmp.c +++ b/qmp.c @@ -16,7 +16,7 @@ #include "qemu-common.h" #include "sysemu/sysemu.h" #include "qmp-commands.h" -#include "qemu-char.h" +#include "char/char.h" #include "ui/qemu-spice.h" #include "ui/vnc.h" #include "sysemu/kvm.h" diff --git a/qtest.c b/qtest.c index 468c921310..c9b58ceb8b 100644 --- a/qtest.c +++ b/qtest.c @@ -13,7 +13,7 @@ #include "sysemu/qtest.h" #include "hw/qdev.h" -#include "qemu-char.h" +#include "char/char.h" #include "exec/ioport.h" #include "exec/memory.h" #include "hw/irq.h" diff --git a/slirp/slirp.c b/slirp/slirp.c index 4b51a67e7d..e93b578832 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -23,7 +23,7 @@ */ #include "qemu-common.h" #include "qemu/timer.h" -#include "qemu-char.h" +#include "char/char.h" #include "slirp.h" #include "hw/hw.h" diff --git a/spice-qemu-char.c b/spice-qemu-char.c index 41b1657ccd..4b03143f68 100644 --- a/spice-qemu-char.c +++ b/spice-qemu-char.c @@ -1,7 +1,7 @@ #include "config-host.h" #include "trace.h" #include "ui/qemu-spice.h" -#include "qemu-char.h" +#include "char/char.h" #include #include diff --git a/ui/console.c b/ui/console.c index a4bff8ce8a..d880ebff07 100644 --- a/ui/console.c +++ b/ui/console.c @@ -25,7 +25,7 @@ #include "ui/console.h" #include "qemu/timer.h" #include "qmp-commands.h" -#include "qemu-char.h" +#include "char/char.h" //#define DEBUG_CONSOLE #define DEFAULT_BACKSCROLL 512 diff --git a/vl.c b/vl.c index 75a30a1720..e6a8d89acc 100644 --- a/vl.c +++ b/vl.c @@ -126,7 +126,7 @@ int main(int argc, char **argv) #include "hw/xen.h" #include "hw/qdev.h" #include "hw/loader.h" -#include "bt-host.h" +#include "bt/bt.h" #include "net/net.h" #include "net/slirp.h" #include "monitor/monitor.h" @@ -134,7 +134,7 @@ int main(int argc, char **argv) #include "sysemu/sysemu.h" #include "exec/gdbstub.h" #include "qemu/timer.h" -#include "qemu-char.h" +#include "char/char.h" #include "qemu/cache-utils.h" #include "sysemu/blockdev.h" #include "hw/block-common.h"